Changeset 842cd8d


Ignore:
Timestamp:
2010-03-18T11:22:17Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
638feab
Parents:
00a0bc5
Message:

Fixed a bug that caused full JIDs to get lost sometimes with the new way
of storing full JIDs belongong to a contact.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber_util.c

    r00a0bc5 r842cd8d  
    44*  Jabber module - Misc. stuff                                              *
    55*                                                                           *
    6 *  Copyright 2006 Wilmer van der Gaast <wilmer@gaast.net>                   *
     6*  Copyright 2006-2010 Wilmer van der Gaast <wilmer@gaast.net>             
    77*                                                                           *
    88*  This program is free software; you can redistribute it and/or modify     *
     
    556556{
    557557        struct jabber_data *jd = ic->proto_data;
    558         struct jabber_buddy *bud, *prev, *bi;
     558        struct jabber_buddy *bud, *prev = NULL, *bi;
    559559        char *s, *full_jid;
    560560       
     
    567567        {
    568568                if( bud->next )
    569                         bud = bud->next;
     569                        bud = (prev=bud)->next;
    570570               
    571571                /* If there's only one item in the list (and if the resource
     
    587587                else
    588588                {
    589                         for( bi = bud, prev = NULL; bi; bi = (prev=bi)->next )
     589                        for( bi = bud; bi; bi = (prev=bi)->next )
    590590                                if( strcmp( bi->resource, s + 1 ) == 0 )
    591591                                        break;
     
    598598                                        prev->next = bi->next;
    599599                                else
    600                                         /* The hash table should point at the second
    601                                            item, because we're removing the first. */
     600                                        /* Don't think this should ever happen anymore. */
    602601                                        g_hash_table_replace( jd->buddies, bi->bare_jid, bi->next );
    603602                               
  • tests/check_jabber_util.c

    r00a0bc5 r842cd8d  
    8484        fail_unless( jabber_buddy_remove( ic, "nekkid@lamejab.net" ) );
    8585        fail_if( jabber_buddy_by_jid( ic, "nekkid@lamejab.net", 0 ) );
     86       
     87        /* Fixing a bug in this branch that caused information to get lost when
     88           removing the first full JID from a list. */
     89        jabber_buddy_add( ic, "bugtest@google.com/A" );
     90        jabber_buddy_add( ic, "bugtest@google.com/B" );
     91        jabber_buddy_add( ic, "bugtest@google.com/C" );
     92        fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/A" ) );
     93        fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/B" ) );
     94        fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/C" ) );
    8695}
    8796
Note: See TracChangeset for help on using the changeset viewer.