Mercurial > pidgin.yaz
diff libpurple/protocols/jabber/buddy.c @ 25443:5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
xmpp branches.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 02 Mar 2009 06:37:05 +0000 |
parents | 4b8c4870b13a |
children | ae2b4394fbe2 13541e130064 7e020fbe2cdb 439f07ce4c8a c4fd9222dda1 5c6cf6d1e65f |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c Mon Mar 02 06:26:15 2009 +0000 +++ b/libpurple/protocols/jabber/buddy.c Mon Mar 02 06:37:05 2009 +0000 @@ -170,7 +170,7 @@ g_return_if_fail(jbr != NULL); jbr->jb->resources = g_list_remove(jbr->jb->resources, jbr); - + while(jbr->commands) { JabberAdHocCommands *cmd = jbr->commands->data; g_free(cmd->jid); @@ -179,7 +179,7 @@ g_free(cmd); jbr->commands = g_list_delete_link(jbr->commands, jbr->commands); } - + jabber_caps_free_clientinfo(jbr->caps); g_free(jbr->name); @@ -495,7 +495,7 @@ { PurplePresence *gpresence; PurpleStatus *status; - + if(((JabberStream*)purple_connection_get_protocol_data(gc))->pep) { /* XEP-0084: User Avatars */ if(img) { @@ -539,37 +539,37 @@ guint32 height = ntohl(png->ihdr.height); xmlnode *publish, *item, *data, *metadata, *info; char *lengthstring, *widthstring, *heightstring; - + /* compute the sha1 hash */ char *hash = jabber_calculate_data_sha1sum(purple_imgstore_get_data(img), purple_imgstore_get_size(img)); char *base64avatar; - + publish = xmlnode_new("publish"); xmlnode_set_attrib(publish,"node",AVATARNAMESPACEDATA); - + item = xmlnode_new_child(publish, "item"); xmlnode_set_attrib(item, "id", hash); - + data = xmlnode_new_child(item, "data"); xmlnode_set_namespace(data,AVATARNAMESPACEDATA); - + base64avatar = purple_base64_encode(purple_imgstore_get_data(img), purple_imgstore_get_size(img)); xmlnode_insert_data(data,base64avatar,-1); g_free(base64avatar); - + /* publish the avatar itself */ jabber_pep_publish((JabberStream*)purple_connection_get_protocol_data(gc), publish); - + /* next step: publish the metadata */ publish = xmlnode_new("publish"); xmlnode_set_attrib(publish,"node",AVATARNAMESPACEMETA); - + item = xmlnode_new_child(publish, "item"); xmlnode_set_attrib(item, "id", hash); - + metadata = xmlnode_new_child(item, "metadata"); xmlnode_set_namespace(metadata,AVATARNAMESPACEMETA); - + info = xmlnode_new_child(metadata, "info"); xmlnode_set_attrib(info, "id", hash); xmlnode_set_attrib(info, "type", "image/png"); @@ -582,10 +582,10 @@ heightstring = g_strdup_printf("%u", height); xmlnode_set_attrib(info, "height", heightstring); g_free(heightstring); - + /* publish the metadata */ jabber_pep_publish((JabberStream*)purple_connection_get_protocol_data(gc), publish); - + g_free(hash); } else { purple_debug_error("jabber", "jabber_set_buddy_icon received non-png data"); @@ -796,18 +796,18 @@ (jbr->client.version ? jbr->client.version : "")); purple_notify_user_info_add_pair(user_info, _("Client"), tmp); g_free(tmp); - + if(jbr->client.os) { purple_notify_user_info_prepend_pair(user_info, _("Operating System"), jbr->client.os); } - } + } if(jbir) { if(jbir->idle_seconds > 0) { char *idle = purple_str_seconds_to_string(jbir->idle_seconds); purple_notify_user_info_prepend_pair(user_info, _("Idle"), idle); g_free(idle); } - } + } if(jbr) { char *purdy = NULL; const char *status_name = jabber_buddy_state_get_name(jbr->state); @@ -825,7 +825,7 @@ } else { purple_notify_user_info_prepend_pair(user_info, _("Status"), _("Unknown")); } -#if 0 +#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'!" @@ -836,7 +836,7 @@ GList *iter; for(iter = jbr->caps->features; iter; iter = g_list_next(iter)) { const char *feature = iter->data; - + if(!strcmp(feature, "jabber:iq:last")) feature = _("Last Activity"); else if(!strcmp(feature, "http://jabber.org/protocol/disco#info")) @@ -945,7 +945,7 @@ if(strlen(tmp->str) > 0) purple_notify_user_info_prepend_pair(user_info, _("Capabilities"), tmp->str); - + g_string_free(tmp, TRUE); } #endif @@ -965,7 +965,7 @@ purple_notify_user_info_prepend_pair(user_info, _("Client"), tmp); g_free(tmp); - + if(jbr->client.os) { purple_notify_user_info_prepend_pair(user_info, _("Operating System"), jbr->client.os); } @@ -984,14 +984,14 @@ purdy = purple_strdup_withhtml(jbr->status); if(status_name && purdy && !strcmp(status_name, purdy)) status_name = NULL; - + tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""), ((status_name && purdy) ? ": " : ""), (purdy ? purdy : "")); purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp); g_free(tmp); g_free(purdy); - + if(multiple_resources) { tmp = g_strdup_printf("%d", jbr->priority); purple_notify_user_info_prepend_pair(user_info, _("Priority"), tmp); @@ -1006,7 +1006,7 @@ GList *iter; for(iter = jbr->caps->features; iter; iter = g_list_next(iter)) { const char *feature = iter->data; - + if(!strcmp(feature, "jabber:iq:last")) feature = _("Last Activity"); else if(!strcmp(feature, "http://jabber.org/protocol/disco#info")) @@ -1109,13 +1109,13 @@ feature = _("Hop Check"); else if(g_str_has_suffix(feature, "+notify")) feature = NULL; - + if(feature) g_string_append_printf(tmp, "%s\n", feature); } if(strlen(tmp->str) > 0) purple_notify_user_info_prepend_pair(user_info, _("Capabilities"), tmp->str); - + g_string_free(tmp, TRUE); } #endif @@ -1183,7 +1183,7 @@ void jabber_vcard_fetch_mine(JabberStream *js) { JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET); - + xmlnode *vcard = xmlnode_new_child(iq->node, "vCard"); xmlnode_set_namespace(vcard, "vcard-temp"); jabber_iq_set_callback(iq, jabber_vcard_save_mine, NULL); @@ -1257,13 +1257,13 @@ } g_free(text2); } - } else if(text && !strcmp(child->name, "NICKNAME")) { + } else if(text && !strcmp(child->name, "NICKNAME")) { /* Prefer the Nickcname to the Full Name as the serverside alias if it's not just part of the jid. * Ignore it if it's part of the jid. */ if (strstr(bare_jid, text) == NULL) { g_free(serverside_alias); serverside_alias = g_strdup(text); - + purple_notify_user_info_add_pair(user_info, _("Nickname"), text); } } else if(text && !strcmp(child->name, "BDAY")) { @@ -1308,7 +1308,7 @@ } g_free(text2); } - + if (address_line_added) purple_notify_user_info_add_section_break(user_info); @@ -1350,8 +1350,8 @@ escaped = g_markup_escape_text(userid, -1); mailto = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", escaped, escaped); purple_notify_user_info_add_pair(user_info, _("Email"), mailto); - - g_free(mailto); + + g_free(mailto); g_free(escaped); g_free(userid); } @@ -1418,7 +1418,7 @@ if (b) { purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", serverside_alias); } - + g_free(serverside_alias); } @@ -1440,7 +1440,7 @@ "do_buddy_avatar_update_fromurl got error \"%s\"", error_message); return; } - + purple_buddy_icons_set_for_user(purple_connection_get_account(info->js->gc), info->from, (void*)url_text, len, info->id); g_free(info->from); g_free(info->id); @@ -1455,29 +1455,29 @@ size_t size; if(!items) return; - + item = xmlnode_get_child(items, "item"); if(!item) return; - + data = xmlnode_get_child_with_namespace(item,"data",AVATARNAMESPACEDATA); if(!data) return; - + checksum = xmlnode_get_attrib(item,"id"); if(!checksum) return; - + b64data = xmlnode_get_data(data); if(!b64data) return; - + img = purple_base64_decode(b64data, &size); if(!img) { g_free(b64data); return; } - + purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, img, size, checksum); g_free(b64data); } @@ -1488,7 +1488,7 @@ xmlnode *item, *metadata; if(!buddy) return; - + checksum = purple_buddy_icons_get_checksum_for_user(buddy); item = xmlnode_get_child(items,"item"); metadata = xmlnode_get_child_with_namespace(item, "metadata", AVATARNAMESPACEMETA); @@ -1508,7 +1508,7 @@ if(info->type == XMLNODE_TYPE_TAG && !strcmp(info->name,"info")) { const char *type = xmlnode_get_attrib(info,"type"); const char *id = xmlnode_get_attrib(info,"id"); - + if(checksum && id && !strcmp(id, checksum)) { /* we already have that avatar, so we don't have to do anything */ goodinfo = NULL; @@ -1524,7 +1524,7 @@ } else if(goodinfo) { const char *url = xmlnode_get_attrib(goodinfo, "url"); const char *id = xmlnode_get_attrib(goodinfo,"id"); - + /* the avatar might either be stored in a pep node, or on a HTTP/HTTPS URL */ if(!url) jabber_pep_request_item(js, from, AVATARNAMESPACEDATA, id, do_buddy_avatar_update_data); @@ -1922,14 +1922,14 @@ JabberBuddyState state; char *msg; int priority; - + purple_status_to_jabber(status, &state, &msg, &priority); presence = jabber_presence_create_js(js, state, msg, priority); - + g_free(msg); - + xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); - + jabber_send(js, presence); xmlnode_free(presence); } @@ -1942,11 +1942,11 @@ PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); JabberStream *js = purple_connection_get_protocol_data(gc); xmlnode *presence; - + presence = jabber_presence_create_js(js, JABBER_BUDDY_STATE_UNAVAILABLE, NULL, 0); - + xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); - + jabber_send(js, presence); xmlnode_free(presence); } @@ -2003,7 +2003,7 @@ NULL, NULL); m = g_list_append(m, act); } - + /* * This if-condition implements parts of XEP-0100: Gateway Interaction * @@ -2022,7 +2022,7 @@ NULL, NULL); m = g_list_append(m, act); } - + /* add all ad hoc commands to the action menu */ for(jbrs = jb->resources; jbrs; jbrs = g_list_next(jbrs)) { JabberBuddyResource *jbr = jbrs->data;