Mercurial > pidgin.yaz
changeset 20517:2ebde8bd0e58
explicit merge of '7ca52e5d60c8f4d7842faad73378b57df9db9007'
and 'b1148e355b30c726e5fdcc11dc57ddb0cc8736ea'
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sun, 16 Sep 2007 18:06:22 +0000 |
parents | 97559afd70e4 (diff) 5bc492d82ff4 (current diff) |
children | 4b20ec37460f |
files | libpurple/protocols/msn/msg.c libpurple/protocols/msn/msn-utils.c libpurple/protocols/msn/msn-utils.h |
diffstat | 7 files changed, 146 insertions(+), 106 deletions(-) [+] |
line wrap: on
line diff
--- a/finch/libgnt/pygnt/example/rss/gntrss.py Sun Sep 16 18:05:55 2007 +0000 +++ b/finch/libgnt/pygnt/example/rss/gntrss.py Sun Sep 16 18:06:22 2007 +0000 @@ -61,6 +61,9 @@ self.parent = parent self.unread = True + def __del__(self): + pass + def remove(self): self.emit('delete', self.parent) if self.unread:
--- a/finch/libgnt/pygnt/test.py Sun Sep 16 18:05:55 2007 +0000 +++ b/finch/libgnt/pygnt/test.py Sun Sep 16 18:06:22 2007 +0000 @@ -16,6 +16,9 @@ self.__gobject_init__() self.set_property(type, value) + def __del__(self): + pass + def do_set_property(self, pspec, value): if pspec.name == 'string': self.string = value
--- a/libpurple/protocols/jabber/buddy.c Sun Sep 16 18:05:55 2007 +0000 +++ b/libpurple/protocols/jabber/buddy.c Sun Sep 16 18:06:22 2007 +0000 @@ -799,6 +799,12 @@ purple_notify_user_info_add_pair(user_info, _("Operating System"), jbr->client.os); } } +#if 0 + /* #if 0 this for now; I think this would be far more useful if we limited this to a particular set of features + * of particular interest (-vv jumps out as one). As it is now, I don't picture people getting all excited: "Oh sweet crap! + * So-and-so supports 'jabber:x:data' AND 'Collaborative Data Objects'!" + */ + if(jbr && jbr->caps) { GString *tmp = g_string_new(""); GList *iter; @@ -907,15 +913,16 @@ feature = _("Hop Check"); else if(g_str_has_suffix(feature, "+notify")) feature = NULL; - if(feature) - g_string_append_printf(tmp, "%s\n", feature); + g_string_append_printf(tmp, "%s<br/>", feature); } + if(strlen(tmp->str) > 0) purple_notify_user_info_add_pair(user_info, _("Capabilities"), tmp->str); g_string_free(tmp, TRUE); } +#endif } else { for(resources = jbi->jb->resources; resources; resources = resources->next) { char *purdy = NULL; @@ -957,6 +964,7 @@ purple_notify_user_info_add_pair(user_info, _("Operating System"), jbr->client.os); } } +#if 0 if(jbr && jbr->caps) { GString *tmp = g_string_new(""); GList *iter; @@ -1074,6 +1082,7 @@ g_string_free(tmp, TRUE); } +#endif } } @@ -1151,6 +1160,17 @@ jabber_iq_send(iq); } +static void +jabber_string_escape_and_append(GString *string, const char *name, const char *value, gboolean indent) +{ + gchar *escaped; + + escaped = g_markup_escape_text(value, -1); + g_string_append_printf(string, "%s<b>%s:</b> %s<br/>", + indent ? " " : "", name, escaped); + g_free(escaped); +} + static void jabber_vcard_parse(JabberStream *js, xmlnode *packet, gpointer data) { const char *id, *from; @@ -1195,8 +1215,8 @@ text = xmlnode_get_data(child); if(text && !strcmp(child->name, "FN")) { - g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", - _("Full Name"), text); + jabber_string_escape_and_append(info_text, + _("Full Name"), text, FALSE); } else if(!strcmp(child->name, "N")) { for(child2 = child->child; child2; child2 = child2->next) { @@ -1207,17 +1227,14 @@ text2 = xmlnode_get_data(child2); if(text2 && !strcmp(child2->name, "FAMILY")) { - g_string_append_printf(info_text, - "<b>%s:</b> %s<br/>", - _("Family Name"), text2); + jabber_string_escape_and_append(info_text, + _("Family Name"), text2, FALSE); } else if(text2 && !strcmp(child2->name, "GIVEN")) { - g_string_append_printf(info_text, - "<b>%s:</b> %s<br/>", - _("Given Name"), text2); + jabber_string_escape_and_append(info_text, + _("Given Name"), text2, FALSE); } else if(text2 && !strcmp(child2->name, "MIDDLE")) { - g_string_append_printf(info_text, - "<b>%s:</b> %s<br/>", - _("Middle Name"), text2); + jabber_string_escape_and_append(info_text, + _("Middle Name"), text2, FALSE); } g_free(text2); } @@ -1226,11 +1243,11 @@ if(b) { purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", text); } - g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", - _("Nickname"), text); + jabber_string_escape_and_append(info_text, + _("Nickname"), text, FALSE); } else if(text && !strcmp(child->name, "BDAY")) { - g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", - _("Birthday"), text); + jabber_string_escape_and_append(info_text, + _("Birthday"), text, FALSE); } else if(!strcmp(child->name, "ADR")) { gboolean address_line_added = FALSE; @@ -1255,34 +1272,27 @@ } if(!strcmp(child2->name, "POBOX")) { - g_string_append_printf(info_text, - " <b>%s:</b> %s<br/>", - _("P.O. Box"), text2); + jabber_string_escape_and_append(info_text, + _("P.O. Box"), text2, TRUE); } else if(!strcmp(child2->name, "EXTADR")) { - g_string_append_printf(info_text, - " <b>%s:</b> %s<br/>", - _("Extended Address"), text2); + jabber_string_escape_and_append(info_text, + _("Extended Address"), text2, TRUE); } else if(!strcmp(child2->name, "STREET")) { - g_string_append_printf(info_text, - " <b>%s:</b> %s<br/>", - _("Street Address"), text2); + jabber_string_escape_and_append(info_text, + _("Street Address"), text2, TRUE); } else if(!strcmp(child2->name, "LOCALITY")) { - g_string_append_printf(info_text, - " <b>%s:</b> %s<br/>", - _("Locality"), text2); + jabber_string_escape_and_append(info_text, + _("Locality"), text2, TRUE); } else if(!strcmp(child2->name, "REGION")) { - g_string_append_printf(info_text, - " <b>%s:</b> %s<br/>", - _("Region"), text2); + jabber_string_escape_and_append(info_text, + _("Region"), text2, TRUE); } else if(!strcmp(child2->name, "PCODE")) { - g_string_append_printf(info_text, - " <b>%s:</b> %s<br/>", - _("Postal Code"), text2); + jabber_string_escape_and_append(info_text, + _("Postal Code"), text2, TRUE); } else if(!strcmp(child2->name, "CTRY") || !strcmp(child2->name, "COUNTRY")) { - g_string_append_printf(info_text, - " <b>%s:</b> %s<br/>", - _("Country"), text2); + jabber_string_escape_and_append(info_text, + _("Country"), text2, TRUE); } g_free(text2); } @@ -1292,34 +1302,38 @@ /* show what kind of number it is */ number = xmlnode_get_data(child2); if(number) { - g_string_append_printf(info_text, - "<b>%s:</b> %s<br/>", _("Telephone"), number); + jabber_string_escape_and_append(info_text, + _("Telephone"), number, FALSE); g_free(number); } } else if((number = xmlnode_get_data(child))) { /* lots of clients (including purple) do this, but it's * out of spec */ - g_string_append_printf(info_text, - "<b>%s:</b> %s<br/>", _("Telephone"), number); + jabber_string_escape_and_append(info_text, + _("Telephone"), number, FALSE); g_free(number); } } else if(!strcmp(child->name, "EMAIL")) { - char *userid; + char *userid, *escaped; if((child2 = xmlnode_get_child(child, "USERID"))) { /* show what kind of email it is */ userid = xmlnode_get_data(child2); if(userid) { + escaped = g_markup_escape_text(userid, -1); g_string_append_printf(info_text, - "<b>%s:</b> <a href='mailto:%s'>%s</a><br/>", - _("E-Mail"), userid, userid); + "<b>%s:</b> <a href=\"mailto:%s\">%s</a><br/>", + _("E-Mail"), escaped, escaped); + g_free(escaped); g_free(userid); } } else if((userid = xmlnode_get_data(child))) { /* lots of clients (including purple) do this, but it's * out of spec */ - g_string_append_printf(info_text, - "<b>%s:</b> <a href='mailto:%s'>%s</a><br/>", - _("E-Mail"), userid, userid); + escaped = g_markup_escape_text(userid, -1); + g_string_append_printf(info_text, + "<b>%s:</b> <a href=\"mailto:%s\">%s</a><br/>", + _("E-Mail"), escaped, escaped); + g_free(escaped); g_free(userid); } } else if(!strcmp(child->name, "ORG")) { @@ -1332,25 +1346,23 @@ text2 = xmlnode_get_data(child2); if(text2 && !strcmp(child2->name, "ORGNAME")) { - g_string_append_printf(info_text, - "<b>%s:</b> %s<br/>", - _("Organization Name"), text2); + jabber_string_escape_and_append(info_text, + _("Organization Name"), text2, FALSE); } else if(text2 && !strcmp(child2->name, "ORGUNIT")) { - g_string_append_printf(info_text, - "<b>%s:</b> %s<br/>", - _("Organization Unit"), text2); + jabber_string_escape_and_append(info_text, + _("Organization Unit"), text2, FALSE); } g_free(text2); } } else if(text && !strcmp(child->name, "TITLE")) { - g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", - _("Title"), text); + jabber_string_escape_and_append(info_text, + _("Title"), text, FALSE); } else if(text && !strcmp(child->name, "ROLE")) { - g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", - _("Role"), text); + jabber_string_escape_and_append(info_text, + _("Role"), text, FALSE); } else if(text && !strcmp(child->name, "DESC")) { - g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", - _("Description"), text); + jabber_string_escape_and_append(info_text, + _("Description"), text, FALSE); } else if(!strcmp(child->name, "PHOTO") || !strcmp(child->name, "LOGO")) { char *bintext = NULL;
--- a/libpurple/protocols/jabber/caps.c Sun Sep 16 18:05:55 2007 +0000 +++ b/libpurple/protocols/jabber/caps.c Sun Sep 16 18:06:22 2007 +0000 @@ -116,8 +116,14 @@ static void jabber_caps_load(void) { xmlnode *capsdata = purple_util_read_xml_from_file(JABBER_CAPS_FILENAME, "XMPP capabilities cache"); xmlnode *client; - if(!capsdata || strcmp(capsdata->name, "capabilities")) + + if(!capsdata) return; + + if (strcmp(capsdata->name, "capabilities") != 0) { + xmlnode_free(capsdata); + return; + } for(client = capsdata->child; client; client = client->next) { if(client->type != XMLNODE_TYPE_TAG) @@ -183,6 +189,7 @@ g_hash_table_replace(capstable, key, value); } } + xmlnode_free(capsdata); } static void jabber_caps_store_ext(gpointer key, gpointer value, gpointer user_data) { @@ -191,17 +198,18 @@ xmlnode *root = user_data; xmlnode *ext = xmlnode_new_child(root,"ext"); GList *iter; - + xmlnode_set_attrib(ext,"identifier",extname); - + for(iter = props->identities; iter; iter = g_list_next(iter)) { JabberCapsIdentity *id = iter->data; xmlnode *identity = xmlnode_new_child(ext, "identity"); xmlnode_set_attrib(identity, "category", id->category); xmlnode_set_attrib(identity, "type", id->type); - xmlnode_set_attrib(identity, "name", id->name); + if (id->name) + xmlnode_set_attrib(identity, "name", id->name); } - + for(iter = props->features; iter; iter = g_list_next(iter)) { const char *feat = iter->data; xmlnode *feature = xmlnode_new_child(ext, "feature"); @@ -237,9 +245,13 @@ } static void jabber_caps_store(void) { + char *str; xmlnode *root = xmlnode_new("capabilities"); g_hash_table_foreach(capstable, jabber_caps_store_client, root); - purple_util_write_data_to_file(JABBER_CAPS_FILENAME, xmlnode_to_formatted_str(root, NULL), -1); + str = xmlnode_to_formatted_str(root, NULL); + xmlnode_free(root); + purple_util_write_data_to_file(JABBER_CAPS_FILENAME, str, -1); + g_free(str); } /* this function assumes that all information is available locally */ @@ -249,13 +261,11 @@ JabberCapsValue *caps; GList *iter; - key->node = g_strdup(node); - key->ver = g_strdup(ver); + key->node = (char *)node; + key->ver = (char *)ver; caps = g_hash_table_lookup(capstable,key); - g_free(key->node); - g_free(key->ver); g_free(key); /* join all information */ @@ -334,6 +344,11 @@ unsigned extOutstanding; } jabber_caps_cbplususerdata; +typedef struct jabber_ext_userdata { + jabber_caps_cbplususerdata *userdata; + char *node; +} jabber_ext_userdata; + static void jabber_caps_get_info_check_completion(jabber_caps_cbplususerdata *userdata) { if(userdata->extOutstanding == 0) { userdata->cb(jabber_caps_collect_info(userdata->node, userdata->ver, userdata->ext), userdata->user_data); @@ -352,25 +367,25 @@ /* collect data and fetch all exts */ xmlnode *query = xmlnode_get_child_with_namespace(packet,"query","http://jabber.org/protocol/disco#info"); xmlnode *child; - jabber_caps_cbplususerdata *userdata = data; - JabberCapsKey *clientkey = g_new0(JabberCapsKey, 1); + jabber_ext_userdata *extuserdata = data; + jabber_caps_cbplususerdata *userdata = extuserdata->userdata; JabberCapsValue *client; - JabberCapsValueExt *value = g_new0(JabberCapsValueExt, 1); - const char *node = xmlnode_get_attrib(query, "node"); + const char *node = extuserdata->node; const char *key; --userdata->extOutstanding; if(node) { - clientkey->node = g_strdup(userdata->node); - clientkey->ver = g_strdup(userdata->ver); - + JabberCapsValueExt *value = g_new0(JabberCapsValueExt, 1); + + JabberCapsKey *clientkey = g_new0(JabberCapsKey, 1); + clientkey->node = userdata->node; + clientkey->ver = userdata->ver; + client = g_hash_table_lookup(capstable,clientkey); - - g_free(clientkey->node); - g_free(clientkey->ver); + g_free(clientkey); - + /* split node by #, key either points to \0 or the correct ext afterwards */ for(key = node; key[0] != '\0'; ++key) { if(key[0] == '#') { @@ -404,7 +419,8 @@ jabber_caps_store(); } - + g_free(extuserdata->node); + g_free(extuserdata); jabber_caps_get_info_check_completion(userdata); } @@ -449,11 +465,14 @@ JabberIq *iq = jabber_iq_new_query(js,JABBER_IQ_GET,"http://jabber.org/protocol/disco#info"); xmlnode *query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#info"); char *node = g_strdup_printf("%s#%s", userdata->node, (const char*)iter->data); + jabber_ext_userdata *ext_data = g_new0(jabber_ext_userdata, 1); + ext_data->node = node; + ext_data->userdata = userdata; + xmlnode_set_attrib(query, "node", node); - g_free(node); xmlnode_set_attrib(iq->node, "to", userdata->who); - jabber_iq_set_callback(iq,jabber_caps_ext_iqcb,userdata); + jabber_iq_set_callback(iq,jabber_caps_ext_iqcb,ext_data); jabber_iq_send(iq); } @@ -474,25 +493,23 @@ userdata->ver = g_strdup(ver); if(originalext) { - gchar **tmp; + int i; gchar **splat = g_strsplit(originalext, " ", 0); - for(tmp = splat; *tmp; tmp++) { - userdata->ext = g_list_append(userdata->ext, tmp); + for(i =0; splat[i]; i++) { + userdata->ext = g_list_append(userdata->ext, splat[i]); ++userdata->extOutstanding; } g_free(splat); } g_free(originalext); - - key->node = g_strdup(node); - key->ver = g_strdup(ver); - + + key->node = (char *)node; + key->ver = (char *)ver; + client = g_hash_table_lookup(capstable, key); - - g_free(key->node); - g_free(key->ver); + g_free(key); - + if(!client) { JabberIq *iq = jabber_iq_new_query(js,JABBER_IQ_GET,"http://jabber.org/protocol/disco#info"); xmlnode *query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#info"); @@ -500,32 +517,37 @@ xmlnode_set_attrib(query, "node", nodever); g_free(nodever); xmlnode_set_attrib(iq->node, "to", who); - + jabber_iq_set_callback(iq,jabber_caps_client_iqcb,userdata); jabber_iq_send(iq); } else { - GList *iter; + GList *iter; /* fetch unknown exts only */ for(iter = userdata->ext; iter; iter = g_list_next(iter)) { JabberCapsValueExt *extvalue = g_hash_table_lookup(client->ext, (const char*)iter->data); JabberIq *iq; xmlnode *query; char *nodever; - + jabber_ext_userdata *ext_data; + if(extvalue) { /* we already have this ext, don't bother with it */ --userdata->extOutstanding; continue; } - + + ext_data = g_new0(jabber_ext_userdata, 1); + iq = jabber_iq_new_query(js,JABBER_IQ_GET,"http://jabber.org/protocol/disco#info"); query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#info"); nodever = g_strdup_printf("%s#%s", node, (const char*)iter->data); xmlnode_set_attrib(query, "node", nodever); - g_free(nodever); xmlnode_set_attrib(iq->node, "to", who); - - jabber_iq_set_callback(iq,jabber_caps_ext_iqcb,userdata); + + ext_data->node = nodever; + ext_data->userdata = userdata; + + jabber_iq_set_callback(iq, jabber_caps_ext_iqcb, ext_data); jabber_iq_send(iq); } /* maybe we have all data available anyways? This is the ideal case where no network traffic is necessary */
--- a/libpurple/protocols/jabber/jabber.c Sun Sep 16 18:05:55 2007 +0000 +++ b/libpurple/protocols/jabber/jabber.c Sun Sep 16 18:06:22 2007 +0000 @@ -1427,6 +1427,7 @@ JabberBuddyResource *jbr = NULL; const char *sub; GList *l; + const char *mood; if (full) { PurpleStatus *status; @@ -1452,8 +1453,7 @@ status = purple_presence_get_active_status(purple_buddy_get_presence(b)); value = purple_status_get_attr_value(status, "mood"); - if(value && purple_value_get_type(value) == PURPLE_TYPE_STRING) { - const char *mood = purple_value_get_string(value); + if (value && purple_value_get_type(value) == PURPLE_TYPE_STRING && (mood = purple_value_get_string(value))) { value = purple_status_get_attr_value(status, "moodtext"); if(value && purple_value_get_type(value) == PURPLE_TYPE_STRING) {
--- a/libpurple/protocols/msn/msg.c Sun Sep 16 18:05:55 2007 +0000 +++ b/libpurple/protocols/msn/msg.c Sun Sep 16 18:06:22 2007 +0000 @@ -401,7 +401,7 @@ GList *l; char *n, *base, *end; int len; - size_t body_len; + size_t body_len = 0; const void *body; g_return_val_if_fail(msg != NULL, NULL);
--- a/libpurple/protocols/myspace/myspace.c Sun Sep 16 18:05:55 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.c Sun Sep 16 18:06:22 2007 +0000 @@ -2933,7 +2933,7 @@ /** Based on MSN's plugin info comments. */ -PurplePluginInfo info = { +static PurplePluginInfo info = { PURPLE_PLUGIN_MAGIC, PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION,