powered by Jive Software

Some MUC occupant roles questions


When I’'m joining a persistent room with no one inside, should I be able to get my own nickname in the occupants list after I joined?

The main reason I’‘d like that is that I want to be able to retrieve my Role in the room to see if I’'m a moderator or participant and make client applet behave appropriately.

Thanks in advance!


and if i remember correctly you need to do your fully qualified nickname: user@muconference.server/nickname

In that case it doesn’‘t work when I’'m the first person to join the room, even after creating it myself.

after you create the room are you submitting the room configuration?

Yes, but the same thing happens when I’‘m joining an already created room e.g. by the Admin Console so maybe there’‘s something wrong with the MultiUserChat#join method or Jive Messenger’‘s presence packet processor - I’'m currently looking into it.

Edit: Ok, I did and discovered that Smack eats the first presence packet after joining the room and the room object probably doesn’'t get the presence of the only participant, me.

Yes, I shouldve mentioned it before but I didnt go back in to check my code so I didnt remember my work around but i made a bit of a hack. I just configure the listener to listen for a presence packet from myself and then after that is recieved i know that my Occupant is stored in MultiUserChatRoom so i just do a #getOccupant(from)

Edit by AWenckus: I didn’‘t have this problem when joining a room as a loan occupant… just rememeber that the rooms might be destroyed when there is no longer anyone in them so you might be joining a room that doesn’'t exsist which should throw an exception in Smack

Of course I remember but I have these problems in a persistent room.

So then should I setup a presence listener before I join the room? I thought that in any case the join() runs its own packetcollector of first presence received after joining.

Thanks for your help!

Hello again,

I returned to my XMPP chat room applet and still have the problem of smack returning 0 occupants after joining a persistent room. The server says there’‘s one, always, smack gets my presence only occasionally, in a totally random behavior. If there is a person already in the room and I’‘m joining, smack only sees that person. Any ideas? I’'m desperate!

Edit: I disabled the PacketCollector in MultiUserChat#join and I the PresenceListener signals my presence every time! Though it’‘s not a solution, I’'m trying to find one. Seems that the PacketCollector eats the Packet event before PresenceListener gets a chance to handle it. Or is it just me?

Someone with more expertise might need to speak on this but I dont think that the packet collector eats the packet, or at least it shouldn’'t because PacketListener gets associated with a PacketCollector. When you stopped using PacketCollector did the problem of 0 occupants dissapear?

Yes, now I get a proper count of occupants every time.

I was analysing the presencelistener created by MultiUserChat#init() method, and when PacketCollector in join() was on, it never got the first presence after joining the room. Now it works without any glitches.

I connect to the server

I log in

I create a new MultiUserChat object with an existing (yes, it does exist for sure ) room in constructor parameters

I join() it

Is there anything else I should be doing in the process?

Message was edited by:


Are you using multiple threads?

Nope, everything happens in a single applet’‘s (or java commandline app’'s) thread.

Well I am pretty much stumped then as to why the PacketCollector wouldn’'t work then. But at least it all works with the listener

That’'s what I hate myself for - if I have a problem, I have a huge problem.

The temporary solution so far (I’'m going to test it more thoroughly) is:

I leave the join method intact besides checking the PacketCollected presence packet if it contains my own room presence. If yes, according to the JEP-45, it’‘s the last presence sent and because I’‘m joining the room right now, I assume it’‘s the only one. Then I put it in the occupantsMap by hand and voilla. We’'ll see how it works.

Thanks anyway.