Anyone have trouble with Gaim and Presence?

Hi,

First off, great work on Smack. Love the debugger window.

I’‘m checking out Smack for a potential project and I’'ve ran into a snag. For whatever reason, Smack is not receiving presence messages from Gaim clients. Psi clients and others work fine, but Gaim clients are pretty much invisible.

The odd thing is that Gaim->Psi works fine, it’'s just Gaim->Smack that is the problem.

I’‘m using Jabber 1.4 as the server, Gaim 1.0.1 on Windows and Linux, Smack 1.4, and the most recent Psi. I’'ve watched the traffic in the Smack debugger (great work on that) and sure enough, Smack never receives the Gaim presence messages but does receive the Psi messages.

So, anyone run into this or might have a clue?

Zed

Zed,

That’‘s strange. Did you take a look at the Raw Incoming Packets? If you don’'t see anything in that tab then Smack is not receiving the packet that you are expecting from the server. What server are you using? Are you sure that the packet sequence is the same when you try with different clients?

Regards,

– Gato

I’‘m having a similar problem, but it could easily be user error… I have Jive Messanger running on my local development box, and Gaim. Gaim is connecting to the XMPP server without problems, and I can send messages from my servlet that uses Smack to my Gaim client. But when I request the presence from the roster I get null [which I think should only happen if the requested user is ‘‘offline’’, not a valid user, or I’'m blocked from seeing that users presence. None of which appear to be the case.

During the servlet init(), I connect to Jive Messager server login and create a Roster object. Then when in doGet I have the following code:

if (request.getParameter(“statusImage”)!=null) {

Presence presence = roster.getPresence(request.getParameter(“statusImage”));

// at this point presence is null even when a valid account name is provided

}

Any thoughts?

melinate

I think I found the problem. I was not adding the Gaim account to my servlet account’'s roster properly.

Hi,

I’‘m currently still having the problem, and I’‘m sure it is how I’'m using smack. Would you be kind enough to put the code that you had to change to get the roster working properly? Thank you.

Zed

Well, so far I’‘ve figured out that while Smack can automatically accept requests from other clients, it has problems actually adding people to its own roster such that it is never notified of presence changes. I’‘ve come to think that Smack is actually useless just because of this one annoyance. ACCEPT_ALL in my mind means that, when someone adds me I add them. If this isn’‘t the case then give me some code in the documentation that says "here’‘s the full sequence for adding somebody to your roster after they request to add you". Even the unit tests don’‘t do this. I think the chief source of this problem is that Roster.getPresence() returns a null, which is just bad form people. C’'mon, how hard is it to add extend presence so that you can return a “NOT_AVAILABLE”, “OFFLINE”, etc. field in the Presence object. Much cleaner and more consistent.

So, I’‘m going to start looking elsewhere for a solution, but if you’‘re interested, here’'s the code in my roster listener that should give me the presence of the newly added or existing person:

Presence presence = myRoster.getPresence(user);

RosterEntry entry = myRoster.getEntry(user);

System.out.println("Presence changed: " + presence + " user: " + user);

Person person = null;

if(presence == null) {

// WTF: they should have some presence, they were just added.

System.out.println(“USER has no presence: " + entry.getUser() + " has no presence.”);

person = new Person(entry.getUser(), entry.getName(), “OFFLINE”, “”);

} else {

person = new Person(presence, entry);

}

The only other thing is that I subscription mode with:

myRoster.setSubscriptionMode(Roster.SUBSCRIPTION_ACCEPT_ALL);

And that should be all I need to do. People request to be added, Smack adds them and then nothing happens.

Well, good luck with Smack. Hopefully you can beef up the docs to clue people in, but until then I have to move on. Thanks again.

Zed A. Shaw

Zed,

Sorry to hear that you are still having problems. Did you take a look at the Raw Incoming Packets to see if in fact Smack is receiving those presence packets? Are you sure that the packet sequence is the same when you try with different clients?

– Gato