Mercurial > pidgin
changeset 19172:069c036d9b72
propagate from branch 'tmpbranch' (head fd482c25cc81ccebcc993d06cad489169e942c22)
to branch 'im.pidgin.soc.2007.finchfeat' (head 627c3377bc204d06f54462d88bd59d01fbb753a1)
author | Eric Polino <aluink@pidgin.im> |
---|---|
date | Tue, 24 Jul 2007 19:39:58 +0000 |
parents | 9f7587b86b0d (current diff) cf9dfbbe8cd6 (diff) |
children | e9151f52a4f1 |
files | finch/gntblist.c pidgin/sounds/Makefile.am pidgin/sounds/Makefile.mingw pidgin/sounds/alert.wav pidgin/sounds/login.wav pidgin/sounds/logout.wav pidgin/sounds/receive.wav pidgin/sounds/send.wav |
diffstat | 13 files changed, 160 insertions(+), 76 deletions(-) [+] |
line wrap: on
line diff
--- a/finch/gntblist.c Sun Jul 22 01:28:19 2007 +0000 +++ b/finch/gntblist.c Tue Jul 24 19:39:58 2007 +0000 @@ -98,7 +98,7 @@ } u; } StatusBoxItem; -FinchBlist *ggblist; +static FinchBlist *ggblist; static void add_buddy(PurpleBuddy *buddy, FinchBlist *ggblist); static void add_contact(PurpleContact *contact, FinchBlist *ggblist); @@ -354,11 +354,13 @@ PurpleGroup *grp; GHashTable *hash = NULL; PurpleConnection *gc; + gboolean autojoin; account = purple_request_fields_get_account(allfields, "account"); name = purple_request_fields_get_string(allfields, "name"); alias = purple_request_fields_get_string(allfields, "alias"); group = purple_request_fields_get_string(allfields, "group"); + autojoin = purple_request_fields_get_bool(allfields, "autojoin"); if (!purple_account_is_connected(account) || !name || !*name) return; @@ -380,6 +382,9 @@ } purple_blist_add_chat(chat, grp, NULL); purple_blist_alias_chat(chat, alias); + purple_blist_node_set_bool((PurpleBlistNode*)chat, "gnt-autojoin", autojoin); + if (autojoin) + serv_join_chat(chat->account->gc, chat->components); } } @@ -407,6 +412,9 @@ field = purple_request_field_string_new("group", _("Group"), grp ? grp->name : NULL, FALSE); purple_request_field_group_add_field(group, field); + field = purple_request_field_bool_new("autojoin", _("Auto-join"), FALSE); + purple_request_field_group_add_field(group, field); + purple_request_fields(NULL, _("Add Chat"), NULL, _("You can edit more information from the context menu later."), fields, _("Add"), G_CALLBACK(add_chat_cb), _("Cancel"), NULL, @@ -1670,7 +1678,7 @@ } /* Now the popular statuses */ - for (iter = purple_savedstatuses_get_popular(6); iter; iter = iter->next) + for (iter = purple_savedstatuses_get_popular(6); iter; iter = g_list_delete_link(iter, iter)) { item = g_new0(StatusBoxItem, 1); item->type = STATUS_SAVED_POPULAR;
--- a/libpurple/plugin.c Sun Jul 22 01:28:19 2007 +0000 +++ b/libpurple/plugin.c Tue Jul 24 19:39:58 2007 +0000 @@ -692,7 +692,10 @@ dependency = purple_plugins_find_with_id(dep_name); - dependency->dependent_plugins = g_list_remove(dependency->dependent_plugins, plugin->info->id); + if (dependency != NULL) + dependency->dependent_plugins = g_list_remove(dependency->dependent_plugins, plugin->info->id); + else + purple_debug_error("plugins", "Unable to remove from dependency list for %s\n", dep_name); } if (plugin->native_plugin) {
--- a/libpurple/protocols/oscar/family_locate.c Sun Jul 22 01:28:19 2007 +0000 +++ b/libpurple/protocols/oscar/family_locate.c Tue Jul 24 19:39:58 2007 +0000 @@ -636,13 +636,15 @@ * Parse out the Type-Length-Value triples as they're found. */ for (curtlv = 0; curtlv < tlvcnt; curtlv++) { + guint16 type; + guint8 number, length; int endpos; - guint16 type, length; type = byte_stream_get16(bs); - length = byte_stream_get16(bs); + number = byte_stream_get8(bs); + length = byte_stream_get8(bs); - endpos = byte_stream_curpos(bs) + length; + endpos = byte_stream_curpos(bs) + MIN(length, byte_stream_empty(bs)); if (type == 0x0001) { /* @@ -814,27 +816,33 @@ * contain information about the buddy icon the user * has stored on the server. */ - int type2, number, length2; + guint16 type2; + guint8 number2, length2; + int endpos2; - while (byte_stream_curpos(bs) < endpos) { + /* + * Continue looping as long as we're able to read type2, + * number2, and length2. + */ + while (byte_stream_curpos(bs) + 4 <= endpos) { type2 = byte_stream_get16(bs); - number = byte_stream_get8(bs); + number2 = byte_stream_get8(bs); length2 = byte_stream_get8(bs); + endpos2 = byte_stream_curpos(bs) + MIN(length2, byte_stream_empty(bs)); + switch (type2) { case 0x0000: { /* This is an official buddy icon? */ /* This is always 5 bytes of "0x02 01 d2 04 72"? */ - byte_stream_advance(bs, length2); } break; case 0x0001: { /* A buddy icon checksum */ - if ((length2 > 0) && ((number == 0x00) || (number == 0x01))) { + if ((length2 > 0) && ((number2 == 0x00) || (number2 == 0x01))) { g_free(outinfo->iconcsum); - outinfo->iconcsumtype = number; + outinfo->iconcsumtype = number2; outinfo->iconcsum = byte_stream_getraw(bs, length2); outinfo->iconcsumlen = length2; - } else - byte_stream_advance(bs, length2); + } } break; case 0x0002: { /* A status/available message */ @@ -879,11 +887,10 @@ outinfo->itmsurl_encoding = NULL; } } break; + } - default: { - byte_stream_advance(bs, length2); - } break; - } + /* Save ourselves. */ + byte_stream_setpos(bs, endpos2); } } else if (type == 0x001e) {
--- a/libpurple/protocols/oscar/flap_connection.c Sun Jul 22 01:28:19 2007 +0000 +++ b/libpurple/protocols/oscar/flap_connection.c Tue Jul 24 19:39:58 2007 +0000 @@ -356,16 +356,21 @@ FlapConnection *conn; OscarData *od; PurpleAccount *account; + aim_rxcallback_t userfunc; conn = data; od = conn->od; account = (PURPLE_CONNECTION_IS_VALID(od->gc) ? purple_connection_get_account(od->gc) : NULL); purple_debug_info("oscar", "Destroying oscar connection of " - "type 0x%04hx\n", conn->type); + "type 0x%04hx. Disconnect reason is %d\n", + conn->type, conn->disconnect_reason); od->oscar_connections = g_slist_remove(od->oscar_connections, conn); + if ((userfunc = aim_callhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR))) + userfunc(od, conn, NULL, conn->disconnect_code, conn->error_message); + /* * TODO: If we don't have a SNAC_FAMILY_LOCATE connection then * we should try to request one instead of disconnecting. @@ -375,7 +380,10 @@ { /* No more FLAP connections! Sign off this PurpleConnection! */ gchar *tmp; - if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) + if (conn->disconnect_code == 0x0001) { + tmp = g_strdup(_("You have signed on from another location.")); + od->gc->wants_to_die = TRUE; + } else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) tmp = g_strdup(_("Server closed the connection.")); else if (conn->disconnect_reason == OSCAR_DISCONNECT_LOST_CONNECTION) tmp = g_strdup_printf(_("Lost connection with server:\n%s"), @@ -695,8 +703,6 @@ { GSList *tlvlist; char *msg = NULL; - guint16 code = 0; - aim_rxcallback_t userfunc; if (byte_stream_empty(&frame->data) == 0) { /* XXX should do something with this */ @@ -713,13 +719,17 @@ tlvlist = aim_tlvlist_read(&frame->data); if (aim_tlv_gettlv(tlvlist, 0x0009, 1)) - code = aim_tlv_get16(tlvlist, 0x0009, 1); + conn->disconnect_code = aim_tlv_get16(tlvlist, 0x0009, 1); if (aim_tlv_gettlv(tlvlist, 0x000b, 1)) msg = aim_tlv_getstr(tlvlist, 0x000b, 1); - if ((userfunc = aim_callhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR))) - userfunc(od, conn, frame, code, msg); + /* + * The server ended this FLAP connnection, so let's be nice and + * close the physical TCP connection + */ + flap_connection_schedule_destroy(conn, + OSCAR_DISCONNECT_REMOTE_CLOSED, msg); aim_tlvlist_free(tlvlist);
--- a/libpurple/protocols/oscar/oscar.c Sun Jul 22 01:28:19 2007 +0000 +++ b/libpurple/protocols/oscar/oscar.c Tue Jul 24 19:39:58 2007 +0000 @@ -1383,7 +1383,6 @@ } purple_debug_info("oscar", "Login Error Code 0x%04hx\n", info->errorcode); purple_debug_info("oscar", "Error URL: %s\n", info->errorurl); - od->killme = TRUE; return 1; } @@ -1410,7 +1409,6 @@ if (newconn->connect_data == NULL) { purple_connection_error(gc, _("Could Not Connect")); - od->killme = TRUE; return 0; } @@ -1433,12 +1431,10 @@ purple_parse_auth_securid_request_no_cb(gpointer user_data, const char *value) { PurpleConnection *gc = user_data; - OscarData *od = gc->proto_data; /* Disconnect */ gc->wants_to_die = TRUE; purple_connection_error(gc, _("The SecurID key entered is invalid.")); - od->killme = TRUE; } static int @@ -3472,33 +3468,32 @@ purple_debug_info("oscar", "Disconnected. Code is 0x%04x and msg is %s\n", code, (msg != NULL ? msg : "")); - g_return_val_if_fail(fr != NULL, 1); g_return_val_if_fail(conn != NULL, 1); - if (conn->type == SNAC_FAMILY_LOCATE) { - if (code == 0x0001) { - gc->wants_to_die = TRUE; - purple_connection_error(gc, _("You have signed on from another location.")); - } else { - purple_connection_error(gc, _("You have been signed off for an unknown reason.")); - } - od->killme = TRUE; - } else if (conn->type == SNAC_FAMILY_CHAT) { + if (conn->type == SNAC_FAMILY_CHAT) { struct chat_connection *cc; - PurpleConversation *conv; + PurpleConversation *conv = NULL; cc = find_oscar_chat_by_conn(gc, conn); - conv = purple_find_chat(gc, cc->id); - - if (conv != NULL) + if (cc != NULL) { - gchar *buf; - buf = g_strdup_printf(_("You have been disconnected from chat " - "room %s."), cc->name); - purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_ERROR, time(NULL)); - g_free(buf); + conv = purple_find_chat(gc, cc->id); + + if (conv != NULL) + { + /* + * TOOD: Have flap_connection_destroy_cb() send us the + * error message stored in 'tmp', which should be + * human-friendly, and print that to the chat room. + */ + gchar *buf; + buf = g_strdup_printf(_("You have been disconnected from chat " + "room %s."), cc->name); + purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_ERROR, time(NULL)); + g_free(buf); + } + oscar_chat_kill(gc, cc); } - oscar_chat_kill(gc, cc); } return 1;
--- a/libpurple/protocols/oscar/oscar.h Sun Jul 22 01:28:19 2007 +0000 +++ b/libpurple/protocols/oscar/oscar.h Tue Jul 24 19:39:58 2007 +0000 @@ -378,6 +378,7 @@ guint destroy_timeout; OscarDisconnectReason disconnect_reason; gchar *error_message; + guint16 disconnect_code; /* A few variables that are only used when connecting */ PurpleProxyConnectData *connect_data; @@ -442,7 +443,6 @@ GHashTable *buddyinfo; GSList *requesticon; - gboolean killme; gboolean icq; guint icontimer; guint getblisttimer;
--- a/libpurple/protocols/oscar/tlv.c Sun Jul 22 01:28:19 2007 +0000 +++ b/libpurple/protocols/oscar/tlv.c Tue Jul 24 19:39:58 2007 +0000 @@ -718,12 +718,10 @@ for (cur = list, i = 0; cur != NULL; cur = cur->next) { tlv = cur->data; - if (tlv != NULL) { /* TODO: This NULL check shouldn't be needed */ - if (tlv->type == type) - i++; - if (i >= nth) - return tlv; - } + if (tlv->type == type) + i++; + if (i >= nth) + return tlv; } return NULL;
--- a/libpurple/purple-remote Sun Jul 22 01:28:19 2007 +0000 +++ b/libpurple/purple-remote Tue Jul 24 19:39:58 2007 +0000 @@ -59,7 +59,7 @@ quit PurpleAccountsFindConnected?name=&protocol=prpl-jabber - PurpleAccountFindConnected(,prpl-jabber) + PurpleAccountsFindConnected(,prpl-jabber) """ % sys.argv[0] cpurple = CheckedObject(purple)
--- a/libpurple/util.c Sun Jul 22 01:28:19 2007 +0000 +++ b/libpurple/util.c Tue Jul 24 19:39:58 2007 +0000 @@ -3994,6 +3994,10 @@ if (*c <= ' ' || *c >= 127) return FALSE; if (strchr(rfc822_specials, *c)) return FALSE; } + + /* It's obviously not an email address if we didn't find an '@' above */ + if (*c == '\0') return FALSE; + /* strictly we should return false if (*(c - 1) == '.') too, but I think * we should permit user.@domain type addresses - they do work :) */ if (c == address) return FALSE;
--- a/pidgin/gtkconv.c Sun Jul 22 01:28:19 2007 +0000 +++ b/pidgin/gtkconv.c Tue Jul 24 19:39:58 2007 +0000 @@ -4804,6 +4804,11 @@ else gtk_widget_hide(gtkconv->toolbar); + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons")) + gtk_widget_show(gtkconv->infopane_hbox); + else + gtk_widget_hide(gtkconv->infopane_hbox); + gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps")); gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), @@ -6783,9 +6788,14 @@ for (l = purple_get_conversations(); l != NULL; l = l->next) { PurpleConversation *conv = l->data; - - if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) + if (GPOINTER_TO_INT(value)) + gtk_widget_show(PIDGIN_CONVERSATION(conv)->infopane_hbox); + else + gtk_widget_hide(PIDGIN_CONVERSATION(conv)->infopane_hbox); + + if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { pidgin_conv_update_buddy_icon(conv); + } } } @@ -8259,8 +8269,8 @@ return FALSE; /* carry on normally */ /* store the position */ - purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/x", x); - purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/y", y); + purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/x", x); + purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/y", y); purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/width", event->width); purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/height", event->height); @@ -8269,6 +8279,38 @@ } +static void +pidgin_conv_restore_position(PidginWindow *win) { + int conv_x, conv_y, conv_width, conv_height; + + conv_width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/width"); + + /* if the window exists, is hidden, we're saving positions, and the + * position is sane... */ + if (win && win->window && + !GTK_WIDGET_VISIBLE(win->window) && conv_width != 0) { + + conv_x = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/x"); + conv_y = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/y"); + conv_height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/height"); + + /* ...check position is on screen... */ + if (conv_x >= gdk_screen_width()) + conv_x = gdk_screen_width() - 100; + else if (conv_x + conv_width < 0) + conv_x = 100; + + if (conv_y >= gdk_screen_height()) + conv_y = gdk_screen_height() - 100; + else if (conv_y + conv_height < 0) + conv_y = 100; + + /* ...and move it back. */ + gtk_window_move(GTK_WINDOW(win->window), conv_x, conv_y); + gtk_window_resize(GTK_WINDOW(win->window), conv_width, conv_height); + } +} + PidginWindow * pidgin_conv_window_new() { @@ -8283,8 +8325,7 @@ /* Create the window. */ win->window = pidgin_create_window(NULL, 0, "conversation", TRUE); - gtk_window_set_default_size(GTK_WINDOW(win->window), purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/width"), - purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/height")); + pidgin_conv_restore_position(win); if (available_list == NULL) { create_icon_lists(win->window); @@ -8438,6 +8479,10 @@ win->gtkconvs = g_list_append(win->gtkconvs, gtkconv); gtkconv->win = win; + if (win->gtkconvs && win->gtkconvs->next && win->gtkconvs->next->next == NULL) + pidgin_conv_tab_pack(win, ((PidginConversation*)win->gtkconvs->data)); + + /* Close button. */ gtkconv->close = gtk_button_new(); gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &close_button_width, &close_button_height); @@ -8507,9 +8552,11 @@ /* Er, bug in notebooks? Switch to the page manually. */ gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0); - gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE); - } else + gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), + purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/tabs")); + } else { gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), TRUE); + } focus_gtkconv = g_list_nth_data(pidgin_conv_window_get_gtkconvs(win), gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook))); @@ -8535,11 +8582,14 @@ angle = 270; #if GTK_CHECK_VERSION(2,6,0) - if (!angle) + if (!angle && pidgin_conv_window_get_gtkconv_count(win) > 1) { g_object_set(G_OBJECT(gtkconv->tab_label), "ellipsize", PANGO_ELLIPSIZE_END, NULL); - else + gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), 6); + } else { g_object_set(G_OBJECT(gtkconv->tab_label), "ellipsize", PANGO_ELLIPSIZE_NONE, NULL); - gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), 6); + gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), -1); + } + if (tabs_side) { gtk_label_set_width_chars( GTK_LABEL(gtkconv->tab_label), @@ -8598,10 +8648,12 @@ gtk_notebook_set_tab_label(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, ebox); } - gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, !tabs_side && !angle, TRUE, GTK_PACK_START); + gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, + !tabs_side && !angle && pidgin_conv_window_get_gtkconv_count(win) > 1, + TRUE, GTK_PACK_START); /* show the widgets */ -/* XXX gtk_widget_show(gtkconv->icon); */ + gtk_widget_show(gtkconv->icon); gtk_widget_show(gtkconv->tab_label); if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs")) gtk_widget_show(gtkconv->close); @@ -8625,13 +8677,14 @@ /* go back to tabless */ if (pidgin_conv_window_get_gtkconv_count(win) <= 2) { - gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE); + gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), + purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/tabs")); } win->gtkconvs = g_list_remove(win->gtkconvs, gtkconv); - if (!win->gtkconvs || !win->gtkconvs->next) - gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE); + if (win->gtkconvs && win->gtkconvs->next == NULL) + pidgin_conv_tab_pack(win, win->gtkconvs->data); if (!win->gtkconvs && win != hidden_convwin) pidgin_conv_window_destroy(win);
--- a/pidgin/gtkprefs.c Sun Jul 22 01:28:19 2007 +0000 +++ b/pidgin/gtkprefs.c Tue Jul 24 19:39:58 2007 +0000 @@ -994,7 +994,7 @@ pidgin_prefs_checkbox(_("Show _formatting on incoming messages"), PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", vbox); - iconpref1 = pidgin_prefs_checkbox(_("Show buddy _icons"), + iconpref1 = pidgin_prefs_checkbox(_("Show Buddy _Details"), PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons", vbox); iconpref2 = pidgin_prefs_checkbox(_("Enable buddy ic_on animation"), PIDGIN_PREFS_ROOT "/conversations/im/animate_buddy_icons", vbox);
--- a/pidgin/gtkrequest.c Sun Jul 22 01:28:19 2007 +0000 +++ b/pidgin/gtkrequest.c Tue Jul 24 19:39:58 2007 +0000 @@ -581,9 +581,14 @@ /* Create the dialog. */ data->dialog = dialog = gtk_dialog_new(); +#if GTK_CHECK_VERSION(2,10,0) + gtk_window_set_deletable(GTK_WINDOW(data->dialog), FALSE); +#endif + if (title != NULL) gtk_window_set_title(GTK_WINDOW(dialog), title); #ifdef _WIN32 + else gtk_window_set_title(GTK_WINDOW(dialog), PIDGIN_ALERT_TITLE); #endif
--- a/pidgin/plugins/gtkbuddynote.c Sun Jul 22 01:28:19 2007 +0000 +++ b/pidgin/plugins/gtkbuddynote.c Tue Jul 24 19:39:58 2007 +0000 @@ -107,8 +107,6 @@ bninfo->flags = PURPLE_PLUGIN_FLAG_INVISIBLE; - info.dependencies = g_list_append(info.dependencies, - "core-plugin_pack-buddynote"); /* If non-gtk buddy note plugin is loaded, but we are not, then load * ourselves, otherwise people upgrading from pre-gtkbuddynote days @@ -134,6 +132,9 @@ /* Use g_idle_add so that the rest of the plugins can get loaded * before we do our check. */ g_idle_add(check_for_buddynote, plugin); + + info.dependencies = g_list_append(info.dependencies, + "core-plugin_pack-buddynote"); } PURPLE_INIT_PLUGIN(gtkbuddynote, init_plugin, info)