Hi Scott,
yep, you are right... but I have change the ID because I'm trying to
following some tips from this thread:
http://community.igniterealtime.org/thread/35976
Now I'm connecting... :D I think that my mistake was to setup the
ids on the product file instead of the launcher... because the
launcher is not updated once created... :(
but the ChatRobotApplication still not working properly...
The method handlePresence is trying to do something that is not
working. It is putting the fromChatId inside the rosterUsers:
public void handlePresence(ID fromID,
IPresence presence) {
System.out.println("handlePresence fromID="+fromID+"
presence="+presence);
IChatID fromChatID = (IChatID)
fromID.getAdapter(IChatID.class);
if (fromChatID != null) {
rosterUsers.put(fromChatID.getUsername() + "@" +
fromChatID.getHostname(), fromID);
}
and later rosterUsers is being compared with the TargetId that I've
setup... If my target is different from my sender, it will never
work... right ?
// Get desired user ID from
rosterUsers map. This is just looking for a user that's active
and on our contacts list
ID targetID = (ID) rosterUsers.get(originalArgs[2]);
if (targetID == null) {
System.out.println("target user="+originalArgs[2]+" is
not on active on your contacts list. Cannot send message to this
user");
return new Integer(0);
}
I could watch in debug that the right contacts of the sender could
be seen on the roster field from presenceHelper from XMPPContainer
from XMPPChatClient:
client XMPPChatClient (id=177)
container XMPPContainer (id=179)
accountManager XMPPContainerAccountManager (id=198)
chatRoomManager XMPPChatRoomManager (id=201)
config SOContainerConfig (id=204)
connection ECFConnection (id=206)
connectionState 2
connectLock ClientSOContainer$Lock (id=213)
connectPolicy null
containerListeners ArrayList<E> (id=215)
groupManager SOContainerGMM (id=223)
isClosing false
keepAlive 30000
loadingThreadGroup ThreadGroup (id=226)
outgoingFileTransferContainerAdapter
XMPPOutgoingFileTransferHelper (id=229)
policy null
presenceHelper XMPPContainerPresenceHelper (id=69)
ALLOWED_MESSAGES Message$Type[4] (id=254)
chatManager XMPPChatManager (id=196)
config SOConfig (id=258)
container XMPPContainer (id=179)
presenceListeners ArrayList<E> (id=261)
roster Roster (id=262)
rosterManager
XMPPContainerPresenceHelper$PresenceRosterManager (id=264)
sharedObjectMessageListeners ArrayList<E>
(id=269)
vcardCache WeakHashMap<K,V> (id=270)
presenceHelperID StringID (id=232)
namespace StringID$StringIDNamespace (id=251)
value
"org.eclipse.ecf.provider.xmpp.XMPPContainer.xmpphandler"
(id=253)
receiver SOContainer$2 (id=234)
remoteServerID XMPPID (id=192)
searchManager XMPPUserSearchManager (id=240)
sequenceNumber 0
sharedObjectManager SOManager (id=244)
sharedObjectMessageSerializer SOContainer$1 (id=247)
sharedObjectThreadGroup ThreadGroup (id=29)
presence XMPPContainer (id=179)
presenceListener ChatRobotApplication (id=58)
receiver ChatRobotApplication (id=58)
sender XMPPChatManager$1 (id=189)
userID XMPPID (id=192)
But I couldn't find the right method to get into it. Could you give
a tip to get there?
thanks
Cristiano
On 27/07/11 12:51, Scott Lewis wrote:
Hi Christiano,
I believe the easiest thing to do would be to use c4bizconsulting@xxxxxxxxx
instead of c4bizconsulting@xxxxxxxxxxxxxx
as the sender account/connectID.
The provider connection logic (see ECFConnection.connect code here
[1]) does support having overriding hosts...but the connect ID
syntax has to include the other overriding host...e.g.
// Check for the URI form of "joe@xxxxxxxxxx;talk.google.com", which
// would at this point would have
// - username = "joe"
// - hostname = "blogs.org;talk.google.com"
// - hostnameOverride = null
//
// We need to turn this into:
// - username = "joe"
// - hostname = "bloggs.org"
// - hostnameOverride = "talk.google.com"
So I believe you could use params of
ChatRobotApplication c4bizconsulting@xxxxxxxxxxxxxx;talk.google.com
xxxxxxxx cvgaviao@xxxxxxxxx
to explicitly set things to use the talk.google.com service...as
you do in your Smack code below. Although if I understand the
relationship between googlemail and gmail correctly I believe just
using c4bizconsulting@xxxxxxxxx
should work.
If things still don't work for googlmail/gmail, then you can see
what's happening with ECFConnection.connect [1]...and if it's not
supporting your use case then please open an enhancement
request...and ideally contribute a patch/fix to the
ECFConnection.connect logic.
Thanks,
Scott
[1]
http://git.eclipse.org/c/ecf/org.eclipse.ecf.git/tree/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/internal/provider/xmpp/smack/ECFConnection.java
On 7/27/2011 6:09 AM, Cristiano Gavião wrote:
Hi
ECF people,
I'm learning ECF and now I'm trying to use ChatRobotApplication.
I've change the the launcher args to this: c4bizconsulting@xxxxxxxxxxxxxx
xxxxxxxx cvgaviao@xxxxxxxxx Hi,
ECF Robot is sending you a message
But I'm getting this error :
!ENTRY org.eclipse.osgi 4 0 2011-07-27 08:34:52.235
!MESSAGE Application error
!STACK 1
org.eclipse.ecf.core.ContainerConnectException: Login attempt
failed
at
org.eclipse.ecf.internal.provider.xmpp.smack.ECFConnection.connect(ECFConnection.java:249)
at
org.eclipse.ecf.provider.generic.ClientSOContainer.connect(ClientSOContainer.java:145)
at
org.eclipse.ecf.provider.xmpp.XMPPContainer.connect(XMPPContainer.java:218)
at
org.eclipse.ecf.example.clients.XMPPChatClient.doConnect(XMPPChatClient.java:102)
at
org.eclipse.ecf.example.clients.XMPPChatClient.connect(XMPPChatClient.java:95)
at
org.eclipse.ecf.example.clients.applications.ChatRobotApplication.start(ChatRobotApplication.java:53)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: SASL authentication failed using mechanism PLAIN:
at
org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:325)
at
org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:395)
at
org.eclipse.ecf.internal.provider.xmpp.smack.ECFConnection.connect(ECFConnection.java:244)
... 18 more
I've created a little plugin to test the connection using the
bundle org.jivesoftware.smack from ECF source and I'm connecting
successfully with this code:
public void start(BundleContext context) throws Exception {
System.out.println("Hello World!!");
ConnectionConfiguration cc = new
ConnectionConfiguration("talk.google.com", 5222, "gmail.com");
XMPPConnection connection = new XMPPConnection(cc);
try {
connection.connect();
// You have to put this code before you login
SASLAuthentication.supportSASLMechanism("PLAIN",
0);
// You have to specify your gmail addres WITH
@gmail.com at the end
connection.login("c4bizconsulting@xxxxxxxxx",
"xxxxxxxx", "resource");
// See if you are authenticated
System.out.println(connection.isAuthenticated());
} catch (XMPPException e1) {
e1.printStackTrace();
}
}
Am I missing something?
thanks for any tip
cheers
Cristiano
_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev
_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev
|