Mercurial > pidgin
changeset 25762:7d6280b006a8
propagate from branch 'im.pidgin.pidgin' (head c06356e8e8d2c586f0192a5564053c2584020da8)
to branch 'im.pidgin.cpw.malu.xmpp.ibb_ft' (head 76275d22249f19043373d55c8502373df61bc61f)
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Tue, 23 Dec 2008 20:13:30 +0000 |
parents | 1fb7db5e1d7c (current diff) 41e69c65b006 (diff) |
children | 8095bbba9832 |
files | libpurple/protocols/jabber/disco.c libpurple/protocols/jabber/libxmpp.c |
diffstat | 19 files changed, 161 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Dec 22 08:38:39 2008 +0000 +++ b/ChangeLog Tue Dec 23 20:13:30 2008 +0000 @@ -7,6 +7,9 @@ * Don't ignore namespace information when parsing XMPP data. (Michal Witkowski) + XMPP: + * Support for XEP-0191 blocking. (Vijay Raghunathan) + version 2.5.3 (12/20/2008): libpurple: * The Buddy State Notification plugin no longer prints duplicate
--- a/libpurple/blist.c Mon Dec 22 08:38:39 2008 +0000 +++ b/libpurple/blist.c Tue Dec 23 20:13:30 2008 +0000 @@ -1029,7 +1029,7 @@ return; dest = purple_find_group(new_name); - if (dest != NULL) { + if (dest != NULL && purple_utf8_strcasecmp(source->name, dest->name) != 0) { /* We're merging two groups */ PurpleBlistNode *prev, *child, *next;
--- a/libpurple/protocols/gg/buddylist.c Mon Dec 22 08:38:39 2008 +0000 +++ b/libpurple/protocols/gg/buddylist.c Tue Dec 23 20:13:30 2008 +0000 @@ -216,13 +216,14 @@ PurpleBlistNode *gnode, *cnode, *bnode; PurpleGroup *group; PurpleBuddy *buddy; - - char *buddylist = g_strdup(""); + GString *buddylist; char *ptr; if ((blist = purple_get_blist()) == NULL) return NULL; + buddylist = g_string_sized_new(1024); + for (gnode = blist->root; gnode != NULL; gnode = gnode->next) { if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; @@ -247,19 +248,16 @@ alias = buddy->alias ? buddy->alias : buddy->name; gname = group->name; - ptr = buddylist; - buddylist = g_strdup_printf( - "%s%s;%s;%s;%s;%s;%s;%s;%s%s\r\n", - ptr, alias, alias, alias, alias, + g_string_append_printf(buddylist, + "%s;%s;%s;%s;%s;%s;%s;%s%s\r\n", + alias, alias, alias, alias, "", gname, name, "", ""); - - g_free(ptr); } } } - ptr = charset_convert(buddylist, "UTF-8", "CP1250"); - g_free(buddylist); + ptr = charset_convert(buddylist->str, "UTF-8", "CP1250"); + g_string_free(buddylist, TRUE); return ptr; } /* }}} */
--- a/libpurple/protocols/jabber/disco.c Mon Dec 22 08:38:39 2008 +0000 +++ b/libpurple/protocols/jabber/disco.c Tue Dec 23 20:13:30 2008 +0000 @@ -357,6 +357,11 @@ jabber_adhoc_server_get_list(js); } + /* If the server supports blocking, request the block list */ + if (js->server_caps & JABBER_CAP_BLOCKING) { + jabber_request_block_list(js); + } + /* If there are manually specified bytestream proxies, query them */ ft_proxies = purple_account_get_string(js->gc->account, "ft_proxies", NULL); if (ft_proxies) { @@ -456,6 +461,8 @@ jabber_google_roster_init(js); } else if (!strcmp("http://jabber.org/protocol/commands", var)) { js->server_caps |= JABBER_CAP_ADHOC; + } else if (!strcmp("urn:xmpp:blocking", var)) { + js->server_caps |= JABBER_CAP_BLOCKING; } }
--- a/libpurple/protocols/jabber/jabber.c Mon Dec 22 08:38:39 2008 +0000 +++ b/libpurple/protocols/jabber/jabber.c Tue Dec 23 20:13:30 2008 +0000 @@ -31,6 +31,7 @@ #include "message.h" #include "notify.h" #include "pluginpref.h" +#include "privacy.h" #include "proxy.h" #include "prpl.h" #include "request.h" @@ -150,7 +151,7 @@ char hostname[256]; /* current hostname */ /* Empty resource == don't send any */ - if (*input == '\0') + if (input == NULL || *input == '\0') return NULL; if (strstr(input, "__HOSTNAME__") == NULL) @@ -1454,6 +1455,106 @@ js->idle = idle ? time(NULL) - idle : idle; } +static void jabber_blocklist_parse(JabberStream *js, xmlnode *packet, gpointer data) +{ + xmlnode *blocklist, *item; + PurpleAccount *account; + + blocklist = xmlnode_get_child_with_namespace(packet, + "blocklist", "urn:xmpp:blocking"); + account = purple_connection_get_account(js->gc); + + if (blocklist == NULL) + return; + + item = xmlnode_get_child(blocklist, "item"); + while (item != NULL) { + const char *jid = xmlnode_get_attrib(item, "jid"); + + purple_privacy_deny_add(account, jid, TRUE); + item = xmlnode_get_next_twin(item); + } +} + +void jabber_request_block_list(JabberStream *js) +{ + JabberIq *iq; + xmlnode *blocklist; + + iq = jabber_iq_new(js, JABBER_IQ_GET); + + blocklist = xmlnode_new_child(iq->node, "blocklist"); + xmlnode_set_namespace(blocklist, "urn:xmpp:blocking"); + + jabber_iq_set_callback(iq, jabber_blocklist_parse, NULL); + + jabber_iq_send(iq); +} + +void jabber_add_deny(PurpleConnection *gc, const char *who) +{ + JabberStream *js; + JabberIq *iq; + xmlnode *block, *item; + + js = gc->proto_data; + if (js == NULL) + return; + + if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER) + { + jabber_google_roster_add_deny(gc, who); + return; + } + + if (!(js->server_caps & JABBER_CAP_BLOCKING)) + { + purple_notify_error(NULL, _("Server doesn't support blocking"), + _("Server doesn't support blocking"), NULL); + return; + } + + iq = jabber_iq_new(js, JABBER_IQ_SET); + + block = xmlnode_new_child(iq->node, "block"); + xmlnode_set_namespace(block, "urn:xmpp:blocking"); + + item = xmlnode_new_child(block, "item"); + xmlnode_set_attrib(item, "jid", who); + + jabber_iq_send(iq); +} + +void jabber_rem_deny(PurpleConnection *gc, const char *who) +{ + JabberStream *js; + JabberIq *iq; + xmlnode *unblock, *item; + + js = gc->proto_data; + if (js == NULL) + return; + + if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER) + { + jabber_google_roster_rem_deny(gc, who); + return; + } + + if (!(js->server_caps & JABBER_CAP_BLOCKING)) + return; + + iq = jabber_iq_new(js, JABBER_IQ_SET); + + unblock = xmlnode_new_child(iq->node, "unblock"); + xmlnode_set_namespace(unblock, "urn:xmpp:blocking"); + + item = xmlnode_new_child(unblock, "item"); + xmlnode_set_attrib(item, "jid", who); + + jabber_iq_send(iq); +} + void jabber_add_feature(const char *shortname, const char *namespace, JabberFeatureEnabled cb) { JabberFeature *feat;
--- a/libpurple/protocols/jabber/jabber.h Mon Dec 22 08:38:39 2008 +0000 +++ b/libpurple/protocols/jabber/jabber.h Tue Dec 23 20:13:30 2008 +0000 @@ -42,7 +42,8 @@ JABBER_CAP_PING = 1 << 11, JABBER_CAP_ADHOC = 1 << 12, - + JABBER_CAP_BLOCKING = 1 << 13, + JABBER_CAP_RETRIEVED = 1 << 31 } JabberCapabilities; @@ -294,6 +295,9 @@ void jabber_login(PurpleAccount *account); void jabber_close(PurpleConnection *gc); void jabber_idle_set(PurpleConnection *gc, int idle); +void jabber_request_block_list(JabberStream *js); +void jabber_add_deny(PurpleConnection *gc, const char *who); +void jabber_rem_deny(PurpleConnection *gc, const char *who); void jabber_keepalive(PurpleConnection *gc); void jabber_register_gateway(JabberStream *js, const char *gateway); void jabber_register_account(PurpleAccount *account);
--- a/libpurple/protocols/jabber/libxmpp.c Mon Dec 22 08:38:39 2008 +0000 +++ b/libpurple/protocols/jabber/libxmpp.c Tue Dec 23 20:13:30 2008 +0000 @@ -78,9 +78,9 @@ jabber_roster_remove_buddy, /* remove_buddy */ NULL, /* remove_buddies */ NULL, /* add_permit */ - jabber_google_roster_add_deny, /* add_deny */ + jabber_add_deny, /* add_deny */ NULL, /* rem_permit */ - jabber_google_roster_rem_deny, /* rem_deny */ + jabber_rem_deny, /* rem_deny */ NULL, /* set_permit_deny */ jabber_chat_join, /* join_chat */ NULL, /* reject_chat */
--- a/libpurple/protocols/myspace/session.h Mon Dec 22 08:38:39 2008 +0000 +++ b/libpurple/protocols/myspace/session.h Tue Dec 23 20:13:30 2008 +0000 @@ -35,7 +35,7 @@ guint userid; /**< This user's numeric user ID */ gchar *username; /**< This user's unique username */ gboolean show_only_to_list; - int privacy_mode; + int privacy_mode; /**< This is a bitmask */ int offline_message_mode; gint fd; /**< File descriptor to/from server */
--- a/libpurple/protocols/myspace/user.c Mon Dec 22 08:38:39 2008 +0000 +++ b/libpurple/protocols/myspace/user.c Tue Dec 23 20:13:30 2008 +0000 @@ -406,10 +406,11 @@ } if (msim_msg_get_integer(msg, "dsn") == MG_OWN_IM_INFO_DSN && - msim_msg_get_integer(msg, "lid") == MG_OWN_IM_INFO_LID) { + msim_msg_get_integer(msg, "lid") == MG_OWN_IM_INFO_LID) + { /* * Some of this info will be available on the buddy list if the - * has themselves as their own buddy. + * user has themselves as their own buddy. * * Much of the info is already available in MsimSession, * stored in msim_we_are_logged_on(). @@ -431,7 +432,7 @@ "idlist", MSIM_TYPE_STRING, g_strdup_printf("w%d|c%d", session->show_only_to_list ? 1 : 0, - session->privacy_mode), + session->privacy_mode & 1), NULL); } else if (msim_msg_get_integer(msg, "dsn") == MG_OWN_MYSPACE_INFO_DSN && msim_msg_get_integer(msg, "lid") == MG_OWN_MYSPACE_INFO_LID) {
--- a/libpurple/protocols/oscar/odc.c Mon Dec 22 08:38:39 2008 +0000 +++ b/libpurple/protocols/oscar/odc.c Tue Dec 23 20:13:30 2008 +0000 @@ -567,6 +567,7 @@ { purple_debug_info("oscar", "Unknown ODC frame type 0x%04hx, " "subtype 0x%04hx.\n", frame->type, frame->subtype); + g_free(frame); return; } @@ -607,6 +608,7 @@ g_free(tmp); peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); + g_free(frame); return; }
--- a/libpurple/protocols/qq/group_internal.c Mon Dec 22 08:38:39 2008 +0000 +++ b/libpurple/protocols/qq/group_internal.c Tue Dec 23 20:13:30 2008 +0000 @@ -30,7 +30,7 @@ #include "group_internal.h" #include "utils.h" -static qq_room_data *room_data_new(guint32 id, guint32 ext_id, gchar *title) +static qq_room_data *room_data_new(guint32 id, guint32 ext_id, const gchar *title) { qq_room_data *rmd; @@ -62,9 +62,9 @@ value = g_hash_table_lookup(data, QQ_ROOM_KEY_INTERNAL_ID); id = value ? strtoul(value, NULL, 10) : 0; - value= g_hash_table_lookup(data, QQ_ROOM_KEY_EXTERNAL_ID); + value = g_hash_table_lookup(data, QQ_ROOM_KEY_EXTERNAL_ID); ext_id = value ? strtoul(value, NULL, 10) : 0; - value = g_strdup(g_hash_table_lookup(data, QQ_ROOM_KEY_TITLE_UTF8)); + value = g_hash_table_lookup(data, QQ_ROOM_KEY_TITLE_UTF8); rmd = room_data_new(id, ext_id, value); rmd->my_role = QQ_ROOM_ROLE_YES;
--- a/libpurple/protocols/qq/group_opt.c Mon Dec 22 08:38:39 2008 +0000 +++ b/libpurple/protocols/qq/group_opt.c Tue Dec 23 20:13:30 2008 +0000 @@ -416,11 +416,6 @@ bytes += qq_get_vstr(&reason, QQ_CHARSET_DEFAULT, data + bytes); - add_req = g_new0(qq_room_req, 1); - add_req->gc = gc; - add_req->id = id; - add_req->member = member_id; - purple_debug_info("QQ", "%u requested to join room, ext id %u\n", member_id, ext_id); rmd = qq_room_data_find(gc, id); @@ -442,6 +437,11 @@ who = uid_to_purple_name(member_id); msg = g_strdup_printf(_("%u request to join Qun %u"), member_id, ext_id); + add_req = g_new0(qq_room_req, 1); + add_req->gc = gc; + add_req->id = id; + add_req->member = member_id; + purple_request_action(gc, _("QQ Qun Operation"), msg, reason, PURPLE_DEFAULT_ACTION_NONE,
--- a/libpurple/protocols/sametime/sametime.c Mon Dec 22 08:38:39 2008 +0000 +++ b/libpurple/protocols/sametime/sametime.c Tue Dec 23 20:13:30 2008 +0000 @@ -3724,7 +3724,6 @@ gc->flags |= PURPLE_CONNECTION_NO_IMAGES; user = g_strdup(purple_account_get_username(account)); - pass = g_strdup(purple_account_get_password(account)); host = strrchr(user, ':'); if(host) { @@ -3741,10 +3740,12 @@ if(! host || ! *host) { /* somehow, we don't have a host to connect to. Well, we need one to actually continue, so let's ask the user directly. */ + g_free(user); prompt_host(gc); return; } + pass = g_strdup(purple_account_get_password(account)); port = purple_account_get_int(account, MW_KEY_PORT, MW_PLUGIN_DEFAULT_PORT); DEBUG_INFO("user: '%s'\n", user);
--- a/libpurple/server.c Mon Dec 22 08:38:39 2008 +0000 +++ b/libpurple/server.c Tue Dec 23 20:13:30 2008 +0000 @@ -804,7 +804,7 @@ { PurpleAccount *account; char buf2[BUF_LONG]; - struct chat_invite_data *cid = g_new0(struct chat_invite_data, 1); + struct chat_invite_data *cid; int plugin_return; account = purple_connection_get_account(gc); @@ -817,6 +817,8 @@ } } + cid = g_new0(struct chat_invite_data, 1); + plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1( purple_conversations_get_handle(), "chat-invited", account, who, name, message, data));
--- a/libpurple/util.c Mon Dec 22 08:38:39 2008 +0000 +++ b/libpurple/util.c Tue Dec 23 20:13:30 2008 +0000 @@ -1676,20 +1676,18 @@ size = "xx-small"; break; case 2: - size = "x-small"; + size = "small"; break; case 3: - size = "small"; + size = "medium"; break; case 4: - size = "medium"; + size = "large"; break; case 5: - size = "large"; + size = "x-large"; break; case 6: - size = "x-large"; - break; case 7: size = "xx-large"; break;
--- a/libpurple/xmlnode.c Mon Dec 22 08:38:39 2008 +0000 +++ b/libpurple/xmlnode.c Tue Dec 23 20:13:30 2008 +0000 @@ -662,7 +662,7 @@ vsnprintf(errmsg, sizeof(errmsg), msg, args); va_end(args); - purple_debug_error("xmlnode", "Error parsing xml file: %s\n", errmsg); + purple_debug_error("xmlnode", "Error parsing xml file: %s", errmsg); } static xmlSAXHandler xmlnode_parser_libxml = {
--- a/pidgin/gtkblist.c Mon Dec 22 08:38:39 2008 +0000 +++ b/pidgin/gtkblist.c Tue Dec 23 20:13:30 2008 +0000 @@ -602,7 +602,7 @@ break; case PURPLE_BLIST_GROUP_NODE: dest = purple_find_group(arg2); - if (dest != NULL && strcmp(arg2, ((PurpleGroup*) node)->name)) { + if (dest != NULL && purple_utf8_strcasecmp(arg2, ((PurpleGroup*) node)->name)) { pidgin_dialogs_merge_groups((PurpleGroup*) node, arg2); } else purple_blist_rename_group((PurpleGroup*)node, arg2);
--- a/pidgin/gtkimhtml.c Mon Dec 22 08:38:39 2008 +0000 +++ b/pidgin/gtkimhtml.c Tue Dec 23 20:13:30 2008 +0000 @@ -3117,15 +3117,15 @@ else if (g_ascii_strcasecmp(size, "smaller") == 0 || g_ascii_strcasecmp(size, "x-small") == 0) font->size = 2; - else if (g_ascii_strcasecmp(size, "larger") == 0 - || g_ascii_strcasecmp(size, "medium") == 0) + else if (g_ascii_strcasecmp(size, "medium") == 0) + font->size = 3; + else if (g_ascii_strcasecmp(size, "large") == 0 + || g_ascii_strcasecmp(size, "larger") == 0) font->size = 4; - else if (g_ascii_strcasecmp(size, "large") == 0) + else if (g_ascii_strcasecmp(size, "x-large") == 0) font->size = 5; - else if (g_ascii_strcasecmp(size, "x-large") == 0) + else if (g_ascii_strcasecmp(size, "xx-large") == 0) font->size = 6; - else if (g_ascii_strcasecmp(size, "xx-large") == 0) - font->size = 7; /* * TODO: Handle other values, like percentages, or