Mercurial > pidgin
comparison libpurple/protocols/jabber/usernick.c @ 20685:02df6998b466
propagate from branch 'im.pidgin.rlaager.merging.2_2_1_conflicts' (head 4ad1081695d083df424898e6e7091f731b401265)
to branch 'im.pidgin.pidgin' (head d33243e8f5347776c81f81a0e4ba3a76ae5505a5)
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Fri, 28 Sep 2007 16:34:43 +0000 |
parents | 5103485b4b26 |
children | 591267f6f1d5 |
comparison
equal
deleted
inserted
replaced
20258:509ca8ebe515 | 20685:02df6998b466 |
---|---|
31 static void jabber_nick_cb(JabberStream *js, const char *from, xmlnode *items) { | 31 static void jabber_nick_cb(JabberStream *js, const char *from, xmlnode *items) { |
32 /* it doesn't make sense to have more than one item here, so let's just pick the first one */ | 32 /* it doesn't make sense to have more than one item here, so let's just pick the first one */ |
33 xmlnode *item = xmlnode_get_child(items, "item"); | 33 xmlnode *item = xmlnode_get_child(items, "item"); |
34 JabberBuddy *buddy = jabber_buddy_find(js, from, FALSE); | 34 JabberBuddy *buddy = jabber_buddy_find(js, from, FALSE); |
35 xmlnode *nick; | 35 xmlnode *nick; |
36 const char *nickname = NULL; | 36 char *nickname = NULL; |
37 | 37 |
38 /* ignore the tune of people not on our buddy list */ | 38 /* ignore the tune of people not on our buddy list */ |
39 if (!buddy || !item) | 39 if (!buddy || !item) |
40 return; | 40 return; |
41 | 41 |
42 nick = xmlnode_get_child_with_namespace(item, "nick", "http://jabber.org/protocol/nick"); | 42 nick = xmlnode_get_child_with_namespace(item, "nick", "http://jabber.org/protocol/nick"); |
43 if (!nick) | 43 if (!nick) |
44 return; | 44 return; |
45 nickname = xmlnode_get_data(nick); | 45 nickname = xmlnode_get_data(nick); |
46 | |
47 serv_got_alias(js->gc, from, nickname); | 46 serv_got_alias(js->gc, from, nickname); |
47 g_free(nickname); | |
48 } | 48 } |
49 | 49 |
50 static void do_nick_set(JabberStream *js, const char *nick) { | 50 static void do_nick_set(JabberStream *js, const char *nick) { |
51 xmlnode *publish, *nicknode; | 51 xmlnode *publish, *nicknode; |
52 | 52 |
62 /* publish is freed by jabber_pep_publish -> jabber_iq_send -> jabber_iq_free | 62 /* publish is freed by jabber_pep_publish -> jabber_iq_send -> jabber_iq_free |
63 (yay for well-defined memory management rules) */ | 63 (yay for well-defined memory management rules) */ |
64 } | 64 } |
65 | 65 |
66 static void do_nick_got_own_nick_cb(JabberStream *js, const char *from, xmlnode *items) { | 66 static void do_nick_got_own_nick_cb(JabberStream *js, const char *from, xmlnode *items) { |
67 const char *oldnickname = NULL; | 67 char *oldnickname = NULL; |
68 xmlnode *item = xmlnode_get_child(items,"item"); | 68 xmlnode *item = xmlnode_get_child(items,"item"); |
69 | 69 |
70 if(item) { | 70 if(item) { |
71 xmlnode *nick = xmlnode_get_child_with_namespace(item,"nick","http://jabber.org/protocol/nick"); | 71 xmlnode *nick = xmlnode_get_child_with_namespace(item,"nick","http://jabber.org/protocol/nick"); |
72 if(nick) | 72 if(nick) |
75 | 75 |
76 purple_request_input(js->gc, _("Set User Nickname"), _("Please specify a new nickname for you."), | 76 purple_request_input(js->gc, _("Set User Nickname"), _("Please specify a new nickname for you."), |
77 _("This information is visible to all contacts on your contact list, so choose something appropriate."), | 77 _("This information is visible to all contacts on your contact list, so choose something appropriate."), |
78 oldnickname, FALSE, FALSE, NULL, _("Set"), PURPLE_CALLBACK(do_nick_set), _("Cancel"), NULL, | 78 oldnickname, FALSE, FALSE, NULL, _("Set"), PURPLE_CALLBACK(do_nick_set), _("Cancel"), NULL, |
79 purple_connection_get_account(js->gc), NULL, NULL, js); | 79 purple_connection_get_account(js->gc), NULL, NULL, js); |
80 g_free(oldnickname); | |
80 } | 81 } |
81 | 82 |
82 static void do_nick_set_nick(PurplePluginAction *action) { | 83 static void do_nick_set_nick(PurplePluginAction *action) { |
83 PurpleConnection *gc = (PurpleConnection *) action->context; | 84 PurpleConnection *gc = (PurpleConnection *) action->context; |
84 JabberStream *js = gc->proto_data; | 85 JabberStream *js = gc->proto_data; |