Ticket #1106: normalize.patch

File normalize.patch, 1.1 KB (added by Juan Luis Boya <ntrrgc@…>, at 2014-02-01T09:13:28Z)

Patch

  • bitlbee-3.2.1/protocols/jabber/jabber_util.c

    a b  
    327327        return new;
    328328}
    329329
     330/* Similar to jabber_normalize, but works with addresses in the form
     331 * resource=chatroom@example.com */
     332char *jabber_normalize_ext( const char *orig)
     333{
     334    int len, i;
     335    char *new;
     336   
     337    len = strlen( orig );
     338    new = g_new( char, len + 1 );
     339   
     340    for( i = 0; i < len && orig[i] != '='; i ++ )
     341        new[i] = orig[i];
     342    for( ; orig[i]; i ++ )
     343        new[i] = tolower( orig[i] );
     344   
     345    new[i] = 0;
     346    return new;
     347}
     348
    330349/* Adds a buddy/resource to our list. Returns NULL if full_jid is not really a
    331350   FULL jid or if we already have this buddy/resource. XXX: No, great, actually
    332351   buddies from transports don't (usually) have resources. So we'll really have
     
    533552        struct jabber_buddy *bud;
    534553        char *s, *jid;
    535554       
    536         jid = jabber_normalize( jid_ );
     555        jid = jabber_normalize_ext( jid_ );
    537556       
    538557        if( ( s = strchr( jid, '=' ) ) == NULL )
    539558                return NULL;