# HG changeset patch # User Elliott Sales de Andrade # Date 1234739478 0 # Node ID 93463c6114aa3f733caffc8fc700c144f45b76b8 # Parent 15fc25014ce261aa8086e0d13b1308597e332089# Parent 2cece7df80c3fd2597af1194dfc86df82039c083 merge of '4021ee6bbfa81bd2fda8e2760cb4ae05d5c30083' and 'efefbfc4bbf45f2744736df7f5e2ee83c21629f6' diff -r 15fc25014ce2 -r 93463c6114aa COPYRIGHT --- a/COPYRIGHT Sun Feb 15 23:08:38 2009 +0000 +++ b/COPYRIGHT Sun Feb 15 23:11:18 2009 +0000 @@ -14,6 +14,7 @@ Patrick Aussems Anibal Avelar Ali Albazaz +Kosta Arvanitis Christopher Ayoup Alex Badea John Bailey @@ -66,6 +67,7 @@ Ludovico Cavedon Steve Cavilia Julien Cegarra +Matěj Cepl Cerulean Studios, LLC Jonathan Champ Christophe Chapuis @@ -204,6 +206,7 @@ Intel Corporation Scott Jackson Hans Petter Jansson +David Jedelsky Henry Jen Benjamin Kahn Anders Kaseorg @@ -419,6 +422,7 @@ Andreas Stührk Oleg Sukhodolsky Sun Microsystems +Marcus Sundberg Mårten Svantesson (fursten) Amir Szekely (kichik) Robert T. diff -r 15fc25014ce2 -r 93463c6114aa ChangeLog --- a/ChangeLog Sun Feb 15 23:08:38 2009 +0000 +++ b/ChangeLog Sun Feb 15 23:11:18 2009 +0000 @@ -7,6 +7,8 @@ enable, check the "Use SSL" option from the Advanced tab when editing your AIM or ICQ account. (Paul Aurich) * Fix a memory leak in SILC. (Luke Petre) + * Fix some string handling in the SIMPLE prpl, which fixes some buddy name + handling and other issues. (Paul Aurich, Marcus Sundberg) ICQ: * Fix retrieval of status messages from users of ICQ 6.x, Miranda, and @@ -15,6 +17,7 @@ of buddy icons and available messages. * Properly publish status messages for statuses other than Available. ICQ 6.x users can now see these status messages. (Daniel Ljungborg) + * Fix recipt of messages from the mobile client Slick. (David Jedelsky) MSN: * Fix transfer of buddy icons, custom smileys, and files from the @@ -27,6 +30,20 @@ for lots of debugging and testing. * Messages from Yahoo! buddies are no longer silently dropped. + XMPP: + * Resources using __HOSTNAME__ substitution will now grab only the short + hostname instead of the FQDN on systems which put the FQDN in the + hostname. (Matěj Cepl) + * No longer send a 'to' attribute on an outgoing stanza when we haven't + received one. This fixes a registration bug as described in ticket + #6635. + + Pidgin: + * Tooltip windows now appear below the mouse cursor. (Kosta Arvanitis) + * Tooltip windows now disappear on keypress events. (Kosta Arvanitis) + * Tooltip windows no longer linger when scrolling the buddy list. (Kosta + Arvanitis) + Finch: * Allow rebinding keys to change the focused widget (details in the man-page, look for GntBox::binding) diff -r 15fc25014ce2 -r 93463c6114aa finch/libgnt/gntwm.c --- a/finch/libgnt/gntwm.c Sun Feb 15 23:08:38 2009 +0000 +++ b/finch/libgnt/gntwm.c Sun Feb 15 23:11:18 2009 +0000 @@ -353,7 +353,8 @@ p->y = y; g_hash_table_replace(wm->positions, g_strdup(title + 1), p); } else { - gnt_warning("Invalid number of arguments (%d) for positioning a window.", l); + gnt_warning("Invalid number of arguments (%" G_GSIZE_FORMAT + ") for positioning a window.", l); } g_strfreev(coords); } diff -r 15fc25014ce2 -r 93463c6114aa libpurple/protocols/jabber/jabber.c --- a/libpurple/protocols/jabber/jabber.c Sun Feb 15 23:08:38 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.c Sun Feb 15 23:11:18 2009 +0000 @@ -148,7 +148,8 @@ } static char *jabber_prep_resource(char *input) { - char hostname[256]; /* current hostname */ + char hostname[256], /* current hostname */ + *dot = NULL; /* Empty resource == don't send any */ if (input == NULL || *input == '\0') @@ -170,6 +171,12 @@ } hostname[sizeof(hostname) - 1] = '\0'; + /* We want only the short hostname, not the FQDN - this will prevent the + * resource string from being unreasonably long on systems which stuff the + * whole FQDN in the hostname */ + if((dot = strchr(hostname, '.'))) + dot = '\0'; + return purple_strreplace(input, "__HOSTNAME__", hostname); } @@ -802,10 +809,11 @@ js->user->node, js->user->domain); if(account->registration_cb) (account->registration_cb)(account, TRUE, account->registration_cb_user_data); - } - else + } else { + g_return_if_fail(to != NULL); buf = g_strdup_printf(_("Registration to %s successful"), to); + } purple_notify_info(NULL, _("Registration Successful"), _("Registration Successful"), buf); g_free(buf); @@ -832,7 +840,11 @@ const char *type = xmlnode_get_attrib(packet, "type"); char *buf; char *to = data; - + + /* This function is never called for unregistering our XMPP account from + * the server, so there should always be a 'to' address. */ + g_return_if_fail(to != NULL); + if(!strcmp(type, "result")) { buf = g_strdup_printf(_("Registration from %s successfully removed"), to); @@ -867,7 +879,8 @@ iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register"); query = xmlnode_get_child(iq->node, "query"); - xmlnode_set_attrib(iq->node, "to", cbdata->who); + if (cbdata->who) + xmlnode_set_attrib(iq->node, "to", cbdata->who); for(groups = purple_request_fields_get_groups(fields); groups; groups = groups->next) { @@ -883,7 +896,8 @@ jabber_iq_free(iq); iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register"); query = xmlnode_get_child(iq->node, "query"); - xmlnode_set_attrib(iq->node,"to",cbdata->who); + if (cbdata->who) + xmlnode_set_attrib(iq->node,"to",cbdata->who); xmlnode_new_child(query, "remove"); jabber_iq_set_callback(iq, jabber_unregistration_result_cb, cbdata->who); @@ -928,8 +942,7 @@ } xmlnode_insert_data(y, value, -1); if(cbdata->js->registration && !strcmp(id, "username")) { - if(cbdata->js->user->node) - g_free(cbdata->js->user->node); + g_free(cbdata->js->user->node); cbdata->js->user->node = g_strdup(value); } if(cbdata->js->registration && !strcmp(id, "password")) @@ -972,7 +985,8 @@ iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); query = xmlnode_get_child(iq->node, "query"); - xmlnode_set_attrib(iq->node,"to",to); + if (to) + xmlnode_set_attrib(iq->node,"to",to); xmlnode_insert_child(query, result); @@ -997,10 +1011,7 @@ return; from = xmlnode_get_attrib(packet, "from"); - if (!from) - from = js->serverFQDN; - g_return_if_fail(from != NULL); - + if(js->registration) { /* get rid of the login thingy */ purple_connection_set_state(js->gc, PURPLE_CONNECTED); @@ -1145,7 +1156,9 @@ purple_connection_get_account(js->gc), NULL, NULL, cbdata); else { - char *title = registered?g_strdup_printf(_("Change Account Registration at %s"), from) + char *title; + g_return_if_fail(from != NULL); + title = registered ? g_strdup_printf(_("Change Account Registration at %s"), from) :g_strdup_printf(_("Register New Account at %s"), from); purple_request_fields(js->gc, title, title, instructions, fields, diff -r 15fc25014ce2 -r 93463c6114aa libpurple/protocols/oscar/family_icbm.c --- a/libpurple/protocols/oscar/family_icbm.c Sun Feb 15 23:08:38 2009 +0000 +++ b/libpurple/protocols/oscar/family_icbm.c Sun Feb 15 23:11:18 2009 +0000 @@ -1566,9 +1566,10 @@ static int incomingim_ch1(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, guint16 channel, aim_userinfo_t *userinfo, ByteStream *bs, guint8 *cookie) { - guint16 type, length; + guint16 type, length, magic1, msglen; aim_rxcallback_t userfunc; int ret = 0; + int rev = 0; struct aim_incomingim_ch1_args args; unsigned int endpos; @@ -1603,10 +1604,30 @@ * - 0101 -- Unknown * - Message * + * Slick and possible others reverse 'Features' and 'Messages' section. + * Thus, the TLV could have following layout: + * - 0101 -- Unknown (possibly magic for message section) + * - Message + * - 0501 -- Unknown (possibly magic for features section) + * - Features: Don't know how to interpret these */ - byte_stream_get8(bs); /* 05 */ - byte_stream_get8(bs); /* 01 */ + magic1 = byte_stream_get16(bs); /* 0501 or 0101 */ + if (magic1 == 0x101) /* Bad, message comes before attributes */ + { + /* Jump to the features section */ + msglen = byte_stream_get16(bs); + bs->offset += msglen; + rev = 1; + + magic1 = byte_stream_get16(bs); /* 0501 */ + } + + if (magic1 != 0x501) + { + purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->sn); + break; + } args.featureslen = byte_stream_get16(bs); if (args.featureslen > byte_stream_empty(bs)) @@ -1624,11 +1645,25 @@ args.icbmflags |= AIM_IMFLAGS_CUSTOMFEATURES; } + if (rev) + { + /* Fix buffer back to message */ + bs->offset -= args.featureslen + 2 + 2 + msglen + 2 + 2; + } + + magic1 = byte_stream_get16(bs); /* 01 01 */ + if (magic1 != 0x101) /* Bad, message comes before attributes */ + { + purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->sn); + break; + } + msglen = byte_stream_get16(bs); + /* * The rest of the TLV contains one or more message * blocks... */ - incomingim_ch1_parsemsgs(od, userinfo, bs->data + bs->offset /* XXX evil!!! */, length - 2 - 2 - args.featureslen, &args); + incomingim_ch1_parsemsgs(od, userinfo, bs->data + bs->offset - 2 - 2 /* XXX evil!!! */, msglen + 2 + 2, &args); } else if (type == 0x0003) { /* Server Ack Requested */ diff -r 15fc25014ce2 -r 93463c6114aa libpurple/protocols/simple/simple.c --- a/libpurple/protocols/simple/simple.c Sun Feb 15 23:08:38 2009 +0000 +++ b/libpurple/protocols/simple/simple.c Sun Feb 15 23:11:18 2009 +0000 @@ -196,7 +196,7 @@ { struct simple_account_data *sip = (struct simple_account_data *)gc->proto_data; struct simple_buddy *b; - if(strcmp("sip:", buddy->name)) { + if(strncmp(buddy->name, "sip:", 4)) { gchar *buf = g_strdup_printf("sip:%s", buddy->name); purple_blist_rename_buddy(buddy, buf); g_free(buf); @@ -834,10 +834,10 @@ "Event: presence\r\n", expiration); - if(strstr(buddy->name, "sip:")) + if(strncmp(buddy->name, "sip:", 4)) + to = g_strdup_printf("sip:%s", buddy->name); + else to = g_strdup(buddy->name); - else - to = g_strdup_printf("sip:%s", buddy->name); tmp = get_contact(sip); contact = g_strdup_printf("%sContact: %s\r\n", tmp2, tmp); @@ -881,7 +881,7 @@ tmp = sipmsg_find_header(msg, "Event"); - if(tmp && !strcmp(tmp, "vnd-microsoft-roaming-contacts")){ + if(tmp && !strncmp(tmp, "vnd-microsoft-roaming-contacts", 30)){ purple_debug_info("simple", "simple_add_lcs_contacts->%s-%d\n", msg->body, len); /*Convert the contact from XML to Purple Buddies*/ @@ -1013,11 +1013,11 @@ static void simple_send_message(struct simple_account_data *sip, const char *to, const char *msg, const char *type) { gchar *hdr; gchar *fullto; - if(strcmp("sip:", to)) { + if(strncmp(to, "sip:", 4)) fullto = g_strdup_printf("sip:%s", to); - } else { + else fullto = g_strdup(to); - } + if(type) { hdr = g_strdup_printf("Content-Type: %s\r\n", type); } else { @@ -1050,12 +1050,12 @@ purple_debug(PURPLE_DEBUG_MISC, "simple", "got message from %s: %s\n", from, msg->body); contenttype = sipmsg_find_header(msg, "Content-Type"); - if(!contenttype || !strcmp(contenttype, "text/plain") || !strcmp(contenttype, "text/html")) { + if(!contenttype || !strncmp(contenttype, "text/plain", 10) || !strncmp(contenttype, "text/html", 9)) { serv_got_im(sip->gc, from, msg->body, 0, time(NULL)); send_sip_response(sip->gc, msg, 200, "OK", NULL); found = TRUE; } - else if(!strcmp(contenttype, "application/im-iscomposing+xml")) { + else if(!strncmp(contenttype, "application/im-iscomposing+xml", 30)) { xmlnode *isc = xmlnode_from_str(msg->body, msg->bodylen); xmlnode *state; gchar *statedata; diff -r 15fc25014ce2 -r 93463c6114aa pidgin/gtkblist.c --- a/pidgin/gtkblist.c Sun Feb 15 23:08:38 2009 +0000 +++ b/pidgin/gtkblist.c Sun Feb 15 23:11:18 2009 +0000 @@ -66,7 +66,7 @@ #include #include -#define HEADLINE_CLOSE_SIZE 12 +#define HEADLINE_CLOSE_SIZE 11 typedef struct { @@ -4554,6 +4554,9 @@ if (!gtkblist) return FALSE; + /* clear any tooltips */ + pidgin_blist_tooltip_destroy(); + widget = gtk_window_get_focus(GTK_WINDOW(gtkblist->window)); if (GTK_IS_IMHTML(widget) || GTK_IS_ENTRY(widget)) { @@ -5387,7 +5390,8 @@ NULL); gtk_widget_set_name(gtkblist->headline_hbox, "gtk-tooltips"); - gtkblist->headline_close = gtk_widget_render_icon(ebox, GTK_STOCK_CLOSE, HEADLINE_CLOSE_SIZE, NULL); + gtkblist->headline_close = gtk_widget_render_icon(ebox, GTK_STOCK_CLOSE, + gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC), NULL); gtkblist->hand_cursor = gdk_cursor_new (GDK_HAND2); gtkblist->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR); diff -r 15fc25014ce2 -r 93463c6114aa pidgin/gtkconv.c --- a/pidgin/gtkconv.c Sun Feb 15 23:08:38 2009 +0000 +++ b/pidgin/gtkconv.c Sun Feb 15 23:11:18 2009 +0000 @@ -1959,6 +1959,9 @@ win = gtkconv->win; curconv = gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook)); + /* clear any tooltips */ + pidgin_tooltip_destroy(); + /* If CTRL was held down... */ if (event->state & GDK_CONTROL_MASK) { switch (event->keyval) { diff -r 15fc25014ce2 -r 93463c6114aa pidgin/pidgintooltip.c --- a/pidgin/pidgintooltip.c Sun Feb 15 23:08:38 2009 +0000 +++ b/pidgin/pidgintooltip.c Sun Feb 15 23:11:18 2009 +0000 @@ -135,14 +135,14 @@ setup_tooltip_window_position(gpointer data, int w, int h) { int sig; - int scr_w, scr_h, x, y; + int scr_w, scr_h, x, y, dy; #if GTK_CHECK_VERSION(2,2,0) int mon_num; GdkScreen *screen = NULL; #endif GdkRectangle mon_size; GtkWidget *tipwindow = pidgin_tooltip.tipwindow; - + #if GTK_CHECK_VERSION(2,2,0) gdk_display_get_pointer(gdk_display_get_default(), &screen, &x, &y, NULL); mon_num = gdk_screen_get_monitor_at_point(screen, x, y); @@ -158,6 +158,12 @@ mon_size.y = 0; #endif +#if GTK_CHECK_VERSION(2,4,0) + dy = gdk_display_get_default_cursor_size(gdk_display_get_default()) / 2; +#else + dy = 0; +#endif + #if GTK_CHECK_VERSION(2,2,0) if (w > mon_size.width) w = mon_size.width - 10; @@ -168,9 +174,9 @@ x -= ((w >> 1) + 4); if ((y + h + 4) > scr_h) - y = y - h - 5; + y = y - h - dy - 5; else - y = y + 6; + y = y + dy + 6; if (y < mon_size.y) y = mon_size.y; @@ -353,6 +359,7 @@ g_signal_connect(G_OBJECT(tree), "motion-notify-event", G_CALLBACK(row_motion_cb), tdata); g_signal_connect(G_OBJECT(tree), "leave-notify-event", G_CALLBACK(widget_leave_cb), NULL); + g_signal_connect(G_OBJECT(tree), "scroll-event", G_CALLBACK(widget_leave_cb), NULL); g_signal_connect_swapped(G_OBJECT(tree), "destroy", G_CALLBACK(destroy_tooltip_data), tdata); return TRUE; } @@ -381,6 +388,7 @@ g_signal_connect(G_OBJECT(widget), "motion-notify-event", G_CALLBACK(widget_motion_cb), wdata); g_signal_connect(G_OBJECT(widget), "leave-notify-event", G_CALLBACK(widget_leave_cb), NULL); + g_signal_connect(G_OBJECT(widget), "scroll-event", G_CALLBACK(widget_leave_cb), NULL); g_signal_connect_swapped(G_OBJECT(widget), "destroy", G_CALLBACK(destroy_tooltip_data), wdata); return TRUE; }