Mercurial > pidgin
comparison src/protocols/jabber/jabber.c @ 4705:e34fe984f999
[gaim-migrate @ 5016]
believe it or not, we do work on things besides the buddy list ;-)
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Tue, 11 Mar 2003 18:15:36 +0000 |
parents | e19f91053ad0 |
children | c15e0699acae |
comparison
equal
deleted
inserted
replaced
4704:56c70997fe5c | 4705:e34fe984f999 |
---|---|
1741 ask = xmlnode_get_attrib(x, "ask"); | 1741 ask = xmlnode_get_attrib(x, "ask"); |
1742 | 1742 |
1743 if((buddyname = get_realwho(gjc, who, FALSE, &gjid)) == NULL) | 1743 if((buddyname = get_realwho(gjc, who, FALSE, &gjid)) == NULL) |
1744 return; | 1744 return; |
1745 | 1745 |
1746 | |
1746 /* JFIXME: jabber_handleroster() had a "FIXME: transport" at this | 1747 /* JFIXME: jabber_handleroster() had a "FIXME: transport" at this |
1747 * equivilent point. So... | 1748 * equivilent point. So... |
1748 * | 1749 * |
1749 * We haven't done anything interesting to this point, so we'll | 1750 * We haven't done anything interesting to this point, so we'll |
1750 * violate Good Coding Structure here by simply bailing out. | 1751 * violate Good Coding Structure here by simply bailing out. |
1763 /* | 1764 /* |
1764 * Add or remove a buddy? Change buddy's alias or group? | 1765 * Add or remove a buddy? Change buddy's alias or group? |
1765 */ | 1766 */ |
1766 if (BUD_SUB_TO_PEND(sub, ask) || BUD_SUBD_TO(sub, ask)) { | 1767 if (BUD_SUB_TO_PEND(sub, ask) || BUD_SUBD_TO(sub, ask)) { |
1767 if ((b = gaim_find_buddy(GJ_GC(gjc)->account, buddyname)) == NULL) { | 1768 if ((b = gaim_find_buddy(GJ_GC(gjc)->account, buddyname)) == NULL) { |
1768 struct buddy *b = gaim_buddy_new(GJ_GC(gjc)->account, buddyname, name ? name : NULL); | 1769 struct buddy *b = gaim_buddy_new(GJ_GC(gjc)->account, buddyname, name); |
1769 struct group *g; | 1770 struct group *g; |
1770 if (groupname) { | 1771 if (groupname) { |
1771 if (!(g = gaim_find_group(groupname))) | 1772 if (!(g = gaim_find_group(groupname))) |
1772 g = gaim_group_new(groupname); | 1773 g = gaim_group_new(groupname); |
1773 } else | 1774 } else |
1789 | 1790 |
1790 /* | 1791 /* |
1791 * seems rude, but it seems to be the only way... | 1792 * seems rude, but it seems to be the only way... |
1792 */ | 1793 */ |
1793 gaim_blist_remove_buddy(b); | 1794 gaim_blist_remove_buddy(b); |
1794 b = gaim_buddy_new(GJ_GC(gjc)->account, buddyname, name ? name : NULL); | 1795 b = gaim_buddy_new(GJ_GC(gjc)->account, buddyname, name); |
1795 gaim_blist_add_buddy(b, gaim_find_group(groupname), NULL); | 1796 gaim_blist_add_buddy(b, gaim_find_group(groupname), NULL); |
1796 gaim_blist_save(); | 1797 gaim_blist_save(); |
1797 if(present) { | 1798 if(present) { |
1798 serv_got_update(GJ_GC(gjc), buddyname, 1, 0, signon, idle, | 1799 serv_got_update(GJ_GC(gjc), buddyname, 1, 0, signon, idle, |
1799 uc, 0); | 1800 uc, 0); |
1800 } | 1801 } |
1801 } else if(name != NULL && strcmp(b->alias, name)) { | 1802 } else if(name != NULL && strcmp(b->alias, name)) { |
1802 g_snprintf(b->alias, sizeof(b->alias), "%s", name); | 1803 g_free(b->alias); |
1804 b->alias = g_strdup(name); | |
1803 gaim_blist_rename_buddy(b, buddyname); | 1805 gaim_blist_rename_buddy(b, buddyname); |
1804 gaim_blist_save(); | 1806 gaim_blist_save(); |
1805 } | 1807 } |
1806 } | 1808 } |
1807 } else if (BUD_USUB_TO_PEND(sub, ask) || BUD_USUBD_TO(sub, ask) || !strcasecmp(sub, "remove")) { | 1809 } else if (BUD_USUB_TO_PEND(sub, ask) || BUD_USUBD_TO(sub, ask) || !strcasecmp(sub, "remove")) { |
2498 * See if there's an explict (new?) alias for the buddy or we can pull | 2500 * See if there's an explict (new?) alias for the buddy or we can pull |
2499 * one out of current Gaim buddylist data for him. | 2501 * one out of current Gaim buddylist data for him. |
2500 */ | 2502 */ |
2501 if(alias && alias[0] != '\0') { | 2503 if(alias && alias[0] != '\0') { |
2502 my_alias = alias; | 2504 my_alias = alias; |
2503 } else if(buddy && buddy->alias[0]) { | 2505 } else if(buddy && buddy->alias) { |
2504 my_alias = buddy->alias; | 2506 my_alias = buddy->alias; |
2505 } | 2507 } |
2506 | 2508 |
2507 /* If there's an alias for the buddy, it's not 0-length | 2509 /* If there's an alias for the buddy, it's not 0-length |
2508 * and it doesn't match his JID, add the "name" attribute. | 2510 * and it doesn't match his JID, add the "name" attribute. |