[Pidgin] #2049: Changing XMPP resource string destroys pounces

Pidgin trac at pidgin.im
Thu Dec 6 04:36:33 EST 2007


#2049: Changing XMPP resource string destroys pounces
---------------------------+------------------------------------------------
  Reporter:  shreevatsa    |       Owner:       
      Type:  patch         |      Status:  new  
  Priority:  minor         |   Milestone:  2.3.1
 Component:  pidgin (gtk)  |     Version:  2.0.2
Resolution:                |    Keywords:       
   Pending:  0             |  
---------------------------+------------------------------------------------
Comment (by sadrul):

 Saving the normalized username of the account in pounces.xml seem to solve
 the problem:

 {{{
 #
 # old_revision [076fb2999e7fc1cf1042c25d00f69e8c909b1fe7]
 #
 # patch "libpurple/account.c"
 #  from [4913e4cbb4bcb3af7af553ca85a2e3fbf8c39d31]
 #    to [138ab18ae667976f500279067c7527fdf6a4d1ee]
 #
 # patch "libpurple/pounce.c"
 #  from [d0750f8226cca76d80e87e6ce2c1ff68a07cd810]
 #    to [f233c62325a39c831e318edf257241dd0c5b8125]
 #
 ============================================================
 --- libpurple/account.c 4913e4cbb4bcb3af7af553ca85a2e3fbf8c39d31
 +++ libpurple/account.c 138ab18ae667976f500279067c7527fdf6a4d1ee
 @@ -2534,7 +2534,7 @@ purple_accounts_find(const char *name, c
         for (l = purple_accounts_get_all(); l != NULL; l = l->next) {
                 account = (PurpleAccount *)l->data;

 -               if (!strcmp(purple_normalize(NULL,
 purple_account_get_username(account)), who) &&
 +               if (!strcmp(purple_normalize(account,
 purple_account_get_username(account)), who) &&
                         (!protocol_id || !strcmp(account->protocol_id,
 protocol_id))) {

                         break;
 ============================================================
 --- libpurple/pounce.c  d0750f8226cca76d80e87e6ce2c1ff68a07cd810
 +++ libpurple/pounce.c  f233c62325a39c831e318edf257241dd0c5b8125
 @@ -181,7 +181,8 @@ pounce_to_xmlnode(PurplePounce *pounce)

         child = xmlnode_new_child(node, "account");
         xmlnode_set_attrib(child, "protocol", pouncer->protocol_id);
 -       xmlnode_insert_data(child, purple_account_get_username(pouncer),
 -1);
 +       xmlnode_insert_data(child,
 +                       purple_normalize(pouncer,
 purple_account_get_username(pouncer)), -1);

         child = xmlnode_new_child(node, "pouncee");
         xmlnode_insert_data(child, purple_pounce_get_pouncee(pounce), -1);
 }}}

 Perhaps we should do the same in other places as well? If this looks good,
 I can look at the other places where this can be useful.

 On a sidenote, does purple_accounts_find look OK? I think instead of
 normalizing 'name' at the very beginning, we should be normalizing it for
 each account and then compare it to the normalized username of the
 account.

-- 
Ticket URL: <http://developer.pidgin.im/ticket/2049#comment:3>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list