dequis/bitlbee — pull request #47 by dequis (2014-10-11 08:26:52+00:00)
Title: [review] From trac: Add jabber_normalize_ext() to fix case sensitivity issues with ext jids

Patch by `Juan Luis Boya ` from trac.

Ticket: http://bugs.bitlbee.org/bitlbee/ticket/1106

Title of the issue it fixes:

>Can't send private messages to chatroom members whose name contain upper case

He wrote:

>It seems there is a problem with jabber_buddy_by_ext_jid. At the beginning of the function it calls jabber_normalize.
>
>jabber_normalize is intended to return the canonical form of a JID, in which the node and the domain are lowercase but the case of the resource is preserved, as it's case sensitive. JIDs follow the syntax node@domain/resource, so it does the job searching for a slash / character and converting all characters before to lowercase. If it does not find a slash, it converts all characters to lowercase.
>
>Note though jabber_buddy_by_ext_jid does not treat with real JIDs as understood in the XMPP protocol, but with adapted "ext JIDs" in the form resource=node@domain. Passing these ext JIDs to jabber_normalize function triggers conversion of all the string to lowercase, breaking the resource.
>
>As chatroom members nicknames are encoded in the resource part, this bug effectively breaks private conversations with any partner whose nickname is not entirely lowercase.
>
>Instead, I've created a new function jabber_normalize_ext to deal with "ext JIDs". It does a similar job to that of jabber_normalize, converting all characters after the equal sign = to lowercase and keeping the case of those before. This way the issue is solved.