On Thu, 2009-03-26 at 22:01 -0400, Alex Vandiver wrote:
> That sounds correct.  Attached is a patch, which _does_ add a dep of
> Unicode::Stringprep, but is probably as faithful of an implementation of
> the spec as we might be able to get.

  Note that this has an effect on existing rosters (which is actually
where I first noticed it).  Specifically, JIDs which are "the same",
like [email protected] and [email protected], show up separately in
the roster, and hence can have different subscriptions.  For instance,
the query below[1], on Hiveminder's DJabberd::RosterStorage::SQLite
backend, returns 24 JIDs that exist more than once, with anywhere
between 2 and 4 different variations of case.
  If the patch I previously sent is applied, JIDs which exist in the
roster in a non-canonical form will appear vanish from the roster.
Attached is a script which walks a DJabberd::RosterStorage::SQLite
database, and adjusts rosters, groups, and the like for case folding.
 - Alex

[1] SQL query to detect multiply-ocurring JIDs in the roster:
SELECT LOWER(first.jid),
       COUNT(DISTINCT other.jid)
  FROM jidmap first
       JOIN jidmap other
         ON LOWER(first.jid) = LOWER(other.jid)
       LEFT JOIN jidmap later
         ON LOWER(later.jid) = LOWER(first.jid)
        AND later.jidid > first.jidid
 GROUP BY first.jid
HAVING COUNT(DISTINCT other.jid) > 1
   AND later.jid IS NULL
 ORDER BY COUNT(DISTINCT other.jid), LOWER(first.jid);

Attachment: fix-jabber-roster-case
Description: Perl program

Reply via email to