Mercurial > pidgin.yaz
comparison libpurple/protocols/oscar/oscar.c @ 20630:41dd71aa79d6
Another patch from Collin from ComBOTS Product GmbH. Now, if you
change the alias for one of your buddies while signed in at
another location it should update the alias in this location,
as well. Fixes #3205.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 24 Sep 2007 00:40:20 +0000 |
parents | 77fda34d4289 |
children | 0bd4e35741f4 |
comparison
equal
deleted
inserted
replaced
20629:77fda34d4289 | 20630:41dd71aa79d6 |
---|---|
187 static int purple_popup (OscarData *, FlapConnection *, FlapFrame *, ...); | 187 static int purple_popup (OscarData *, FlapConnection *, FlapFrame *, ...); |
188 static int purple_ssi_parseerr (OscarData *, FlapConnection *, FlapFrame *, ...); | 188 static int purple_ssi_parseerr (OscarData *, FlapConnection *, FlapFrame *, ...); |
189 static int purple_ssi_parserights (OscarData *, FlapConnection *, FlapFrame *, ...); | 189 static int purple_ssi_parserights (OscarData *, FlapConnection *, FlapFrame *, ...); |
190 static int purple_ssi_parselist (OscarData *, FlapConnection *, FlapFrame *, ...); | 190 static int purple_ssi_parselist (OscarData *, FlapConnection *, FlapFrame *, ...); |
191 static int purple_ssi_parseack (OscarData *, FlapConnection *, FlapFrame *, ...); | 191 static int purple_ssi_parseack (OscarData *, FlapConnection *, FlapFrame *, ...); |
192 static int purple_ssi_parseadd (OscarData *, FlapConnection *, FlapFrame *, ...); | 192 static int purple_ssi_parseaddmod (OscarData *, FlapConnection *, FlapFrame *, ...); |
193 static int purple_ssi_authgiven (OscarData *, FlapConnection *, FlapFrame *, ...); | 193 static int purple_ssi_authgiven (OscarData *, FlapConnection *, FlapFrame *, ...); |
194 static int purple_ssi_authrequest (OscarData *, FlapConnection *, FlapFrame *, ...); | 194 static int purple_ssi_authrequest (OscarData *, FlapConnection *, FlapFrame *, ...); |
195 static int purple_ssi_authreply (OscarData *, FlapConnection *, FlapFrame *, ...); | 195 static int purple_ssi_authreply (OscarData *, FlapConnection *, FlapFrame *, ...); |
196 static int purple_ssi_gotadded (OscarData *, FlapConnection *, FlapFrame *, ...); | 196 static int purple_ssi_gotadded (OscarData *, FlapConnection *, FlapFrame *, ...); |
197 | 197 |
1218 oscar_data_addhandler(od, SNAC_FAMILY_CHATNAV, SNAC_SUBTYPE_CHATNAV_INFO, purple_chatnav_info, 0); | 1218 oscar_data_addhandler(od, SNAC_FAMILY_CHATNAV, SNAC_SUBTYPE_CHATNAV_INFO, purple_chatnav_info, 0); |
1219 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ERROR, purple_ssi_parseerr, 0); | 1219 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ERROR, purple_ssi_parseerr, 0); |
1220 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RIGHTSINFO, purple_ssi_parserights, 0); | 1220 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RIGHTSINFO, purple_ssi_parserights, 0); |
1221 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_LIST, purple_ssi_parselist, 0); | 1221 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_LIST, purple_ssi_parselist, 0); |
1222 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SRVACK, purple_ssi_parseack, 0); | 1222 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SRVACK, purple_ssi_parseack, 0); |
1223 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ADD, purple_ssi_parseadd, 0); | 1223 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ADD, purple_ssi_parseaddmod, 0); |
1224 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTH, purple_ssi_authgiven, 0); | 1224 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTH, purple_ssi_authgiven, 0); |
1225 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTHREQ, purple_ssi_authrequest, 0); | 1225 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTHREQ, purple_ssi_authrequest, 0); |
1226 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTHREP, purple_ssi_authreply, 0); | 1226 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTHREP, purple_ssi_authreply, 0); |
1227 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ADDED, purple_ssi_gotadded, 0); | 1227 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ADDED, purple_ssi_gotadded, 0); |
1228 oscar_data_addhandler(od, SNAC_FAMILY_ICBM, 0x0005, purple_icbm_param_info, 0); | 1228 oscar_data_addhandler(od, SNAC_FAMILY_ICBM, 0x0005, purple_icbm_param_info, 0); |
4932 alias_utf8 = NULL; | 4932 alias_utf8 = NULL; |
4933 | 4933 |
4934 b = purple_find_buddy_in_group(gc->account, curitem->name, g); | 4934 b = purple_find_buddy_in_group(gc->account, curitem->name, g); |
4935 if (b) { | 4935 if (b) { |
4936 /* Get server stored alias */ | 4936 /* Get server stored alias */ |
4937 if (alias_utf8) { | 4937 purple_blist_alias_buddy(b, alias_utf8); |
4938 g_free(b->alias); | |
4939 b->alias = g_strdup(alias_utf8); | |
4940 } | |
4941 } else { | 4938 } else { |
4942 b = purple_buddy_new(gc->account, curitem->name, alias_utf8); | 4939 b = purple_buddy_new(gc->account, curitem->name, alias_utf8); |
4943 | 4940 |
4944 purple_debug_info("oscar", | 4941 purple_debug_info("oscar", |
4945 "ssi: adding buddy %s to group %s to local list\n", curitem->name, g->name); | 4942 "ssi: adding buddy %s to group %s to local list\n", curitem->name, g->name); |
5079 } | 5076 } |
5080 | 5077 |
5081 return 1; | 5078 return 1; |
5082 } | 5079 } |
5083 | 5080 |
5084 static int purple_ssi_parseadd(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { | 5081 static int |
5085 PurpleConnection *gc = od->gc; | 5082 purple_ssi_parseaddmod(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) |
5083 { | |
5084 PurpleConnection *gc; | |
5085 PurpleAccount *account; | |
5086 char *gname, *gname_utf8, *alias, *alias_utf8; | 5086 char *gname, *gname_utf8, *alias, *alias_utf8; |
5087 PurpleBuddy *b; | 5087 PurpleBuddy *b; |
5088 PurpleGroup *g; | 5088 PurpleGroup *g; |
5089 va_list ap; | 5089 va_list ap; |
5090 guint16 type; | 5090 guint16 snac_subtype, type; |
5091 const char *name; | 5091 const char *name; |
5092 | 5092 |
5093 gc = od->gc; | |
5094 account = purple_connection_get_account(gc); | |
5095 | |
5093 va_start(ap, fr); | 5096 va_start(ap, fr); |
5097 snac_subtype = (guint16)va_arg(ap, int); | |
5094 type = (guint16)va_arg(ap, int); | 5098 type = (guint16)va_arg(ap, int); |
5095 name = va_arg(ap, char *); | 5099 name = va_arg(ap, char *); |
5096 va_end(ap); | 5100 va_end(ap); |
5097 | 5101 |
5098 if ((type != 0x0000) || (name == NULL)) | 5102 if ((type != 0x0000) || (name == NULL)) |
5099 return 1; | 5103 return 1; |
5100 | 5104 |
5101 gname = aim_ssi_itemlist_findparentname(od->ssi.local, name); | 5105 gname = aim_ssi_itemlist_findparentname(od->ssi.local, name); |
5102 gname_utf8 = gname ? oscar_utf8_try_convert(gc->account, gname) : NULL; | 5106 gname_utf8 = gname ? oscar_utf8_try_convert(account, gname) : NULL; |
5103 | 5107 |
5104 alias = aim_ssi_getalias(od->ssi.local, gname, name); | 5108 alias = aim_ssi_getalias(od->ssi.local, gname, name); |
5105 if (alias != NULL) | 5109 if (alias != NULL) |
5106 { | 5110 { |
5107 if (g_utf8_validate(alias, -1, NULL)) | 5111 if (g_utf8_validate(alias, -1, NULL)) |
5108 alias_utf8 = g_strdup(alias); | 5112 alias_utf8 = g_strdup(alias); |
5109 else | 5113 else |
5110 alias_utf8 = oscar_utf8_try_convert(purple_connection_get_account(gc), alias); | 5114 alias_utf8 = oscar_utf8_try_convert(account, alias); |
5111 } | 5115 } |
5112 else | 5116 else |
5113 alias_utf8 = NULL; | 5117 alias_utf8 = NULL; |
5114 | |
5115 b = purple_find_buddy(gc->account, name); | |
5116 g_free(alias); | 5118 g_free(alias); |
5117 | 5119 |
5120 b = purple_find_buddy(account, name); | |
5118 if (b) { | 5121 if (b) { |
5119 /* Get server stored alias */ | 5122 /* |
5120 if (alias_utf8) { | 5123 * You're logged in somewhere else and you aliased one |
5121 g_free(b->alias); | 5124 * of your buddies, so update our local buddy list with |
5122 b->alias = g_strdup(alias_utf8); | 5125 * the person's new alias. |
5123 } | 5126 */ |
5124 } else { | 5127 purple_blist_alias_buddy(b, alias_utf8); |
5125 b = purple_buddy_new(gc->account, name, alias_utf8); | 5128 } else if (snac_subtype == 0x0008) { |
5129 /* | |
5130 * You're logged in somewhere else and you added a buddy to | |
5131 * your server list, so add them to your local buddy list. | |
5132 */ | |
5133 b = purple_buddy_new(account, name, alias_utf8); | |
5126 | 5134 |
5127 if (!(g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { | 5135 if (!(g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { |
5128 g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); | 5136 g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); |
5129 purple_blist_add_group(g, NULL); | 5137 purple_blist_add_group(g, NULL); |
5130 } | 5138 } |
5131 | 5139 |
5132 purple_debug_info("oscar", | 5140 purple_debug_info("oscar", |
5133 "ssi: adding buddy %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans")); | 5141 "ssi: adding buddy %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans")); |
5134 purple_blist_add_buddy(b, NULL, g, NULL); | 5142 purple_blist_add_buddy(b, NULL, g, NULL); |
5135 } | 5143 } |
5144 | |
5136 g_free(gname_utf8); | 5145 g_free(gname_utf8); |
5137 g_free(alias_utf8); | 5146 g_free(alias_utf8); |
5138 | 5147 |
5139 return 1; | 5148 return 1; |
5140 } | 5149 } |