powered by Jive Software

Discovering initial presence information

This sort of goes along with my earlier post regarding being able to tell if a room was just created or not but I’'ve hit another snag because of the same bug.

here is the code from MultiUserChat#create:

MUCUser mucUser = getMUCUserExtension(presence);
        if (mucUser != null && mucUser.getStatus() != null) {
            if ("201".equals(mucUser.getStatus().getCode())) {
                // Room was created and the user has joined the room
                return;
            }
        }

I am not recieving this packet in the PacketListener or PresenceUpdate so i have no way of knowing my initial presence information, IE role and affiliation. When I join a room I am fine because this initial packet is not being “eaten” by the packetcollector. But this is a problem because my presence in the presence map isn’'t then being properly updated.

Thanks,

Alexander Wenckus

Hey Alexander,

I’‘m not sure I’'m understanding the problem here. Once you sent MultiUserChat#create or MultiUserChat#join, you can use MultiUserChat#getOccupantPresence(String) to get your own presence. Notice that the parameter should be the occupant JID (eg. room@server.com/MyNick). The returned presence will contain everything the server sent to the client.

Let me know if something is not working fine.

Thanks,

– Gato