Hey Karl,
JIDs in XMPP are not case insensitive.
Yes, I understand. The resource identifier is the perfect example. Smack itself uses “Smack” as the default resource.
Each part of a
JID must conform a set of rules as
[url=XMPP | XMPP RFCs
]defined in the spec[/url]. Basically, usernames must
be in lowercase and must not contain any white
space.
This is the part I think I’‘m missing: where does it say usernames must be in lowercase? (I’‘m honestly not trying to sound pretentious; I’'m generally curious). Is it RFC3454 (“stringprep”)? Lower case usually makes sense in Latin-based alphabets, but loses its meaning as you move into more complex languages.
The Jive server automatically lower cases usernames when you create the account. iain’'s post a while back makes sense to me (http://www.jivesoftware.org/forums/thread.jspa?messageID=69981):
“”"Servers have the option of preserving an address or converting it to a ‘‘stringprep’’ version (for most latin languages this means essentially lowercase, for asian languages it can be a bit more complex). Clients can’‘t and shouldn’'t rely on the addresses to maintain their case (just as domain names are not case sensitive).
Messenger plays it safe and always sends the stringprep’‘d version. I can understand the desire to preserve case and will add it to the wish list. I think some client developers may find it better that the addresses are stringprep’‘d so that they can do a simple binary comparison of addresses to check for equality without having to worry about stringprep’‘ing (it can be an intensive operation). As a client developer though, you need to be prepared for stringprep’'d addresses since messages pass from server to server, and there is no way to guarantee the addresses will maintain their case in transit.“”"
So when you add a contact to your roster whose JID is
invalid, the server may not validate the contact’'s
JID but be sure that the intended target user will
not get an authorization request from you. Therefore,
Smack will never get a presence of the other user.
OK, so a username with capital letters is invalid. Why can you send messages using Smack to recipients with capital letters (i.e., Packet.setTo(“someUser@somemachine.com”) and it will be received on the other end? Message and IQ packets work this way. Perhaps I should post to the Jive forum instead.
I’'m just genuinely interested at this point as to why I can properly send Messages and IQs to “someUser”, but checking presence of “someUser” will fail.
Thanks ahead of time to anyone willing to reply.