Quantcast
Channel: Ignite Realtime : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 10742

ChatManager name checks and case-sensitivity

$
0
0

ChatManager keeps track of chats in a case-sensitive map, which can cause issues for applications where the jabber credentials may be fetched from another source, such as a support or personnel database, if that source has different cases than the jabber server.  When a Chat is created, ChatManager will create and track it using:

 

    Chat chat = new Chat(this, userJID, threadID);    this.threadChats.put(threadID, chat);    this.jidChats.put(userJID, chat);    this.baseJidChats.put(StringUtils.parseBareAddress(userJID), chat);

 

So, if our application initiates a chat from FirstNameLastName@domain.org, we have maps like this pseudo-json:

 

{FirstNameLastName@domain.org:chat1}

 

When the server responds to firstnamelastname@domain.org, chat1 will not be found in the maps.  A new chat is created, so our map becomes:

 

{FirstNameLastName@domain.org:chat1, firstnamelastname@domain.org:chat2}

 

The message will appear to the server to be delivered, but the application using smack will not see the response, because the response goes to chat2 and its MessageListener, not to chat1.

 

From:

 

http://xmpp.org/extensions/xep-0029.html#sect-idp666800

 

It appears that nodes should be compared in "case-normalized canonical form", domains are case-inensitive, and resources are case-sensitive, but the maps in ChatManager do not behave that way.  Is this a bug in smack, or do applications need to consult the Presence roster and normalize cases themselves before initiating any chat?


Viewing all articles
Browse latest Browse all 10742

Trending Articles