Mercurial > pidgin.yaz
changeset 25483:c3fbb357cc81
propagate from branch 'im.pidgin.pidgin' (head 4398ffa92e9bb0a16dbede7756a4cbc5dfa96602)
to branch 'im.pidgin.pidgin.yaz' (head 0d5786076f662dd1df375b07dc5310f396f57676)
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Wed, 16 May 2007 09:10:30 +0000 |
parents | e4ee1c5bd51e (current diff) 7cdc1d7fad55 (diff) |
children | d3a7e037f3e9 |
files | pidgin/gtkconv.c |
diffstat | 7 files changed, 175 insertions(+), 81 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue May 15 02:39:12 2007 +0000 +++ b/ChangeLog Wed May 16 09:10:30 2007 +0000 @@ -30,6 +30,7 @@ * File transfer progress for transfers on MSN is now correctly displayed * You can set/change alias of buddies/chats by double-clicking on the conversation tabs. (Ma Xuan) + * Fix IRC connection bug with dircproxy (xjoe) Finch: * Userlist in chat windows, which can be turned on or off using
--- a/libpurple/plugins/joinpart.c Tue May 15 02:39:12 2007 +0000 +++ b/libpurple/plugins/joinpart.c Wed May 16 09:10:30 2007 +0000 @@ -156,7 +156,7 @@ static gboolean check_expire_time(struct joinpart_key *key, time_t *last_said, time_t *limit) { - purple_debug_info("joinpart", "Removing key for %s/%s\n", key->conv->name, key->user); + purple_debug_info("joinpart", "Removing key for %s\n", key->user); return (*last_said < *limit); }
--- a/libpurple/plugins/perl/Makefile.am Tue May 15 02:39:12 2007 +0000 +++ b/libpurple/plugins/perl/Makefile.am Wed May 16 09:10:30 2007 +0000 @@ -78,7 +78,8 @@ # common/fallback/const-xs.inc perl_scripts = \ - scripts/function_list.pl + scripts/function_list.pl \ + scripts/signals-test.pl EXTRA_DIST = \ Makefile.mingw \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libpurple/plugins/perl/scripts/signals-test.pl Wed May 16 09:10:30 2007 +0000 @@ -0,0 +1,80 @@ +$MODULE_NAME = "Signals Test Script in Perl"; + +use Purple; + +%PLUGIN_INFO = ( + perl_api_version => 2, + name => "Perl: $MODULE_NAME", + version => "0.1", + summary => "Signals Test plugin for the Perl interpreter.", + description => "Demonstrate the user of purple signals from " . + "a perl plugin.", + author => "Sadrul Habib Chowdhury <sadrul\@pidgin.im>", + url => "http://developer.pidgin.im/wiki/sadrul/", + + load => "plugin_load", + unload => "plugin_unload" +); + +# Accounts +sub account_connecting_cb +{ + my $account = shift; + Purple::Debug::misc("signals test in perl", "account-connecting (" . $account->get_username() . ")\n"); +} + +# Buddylist +sub buddy_signed_on +{ + my $buddy = shift; + Purple::Debug::misc("signals test in perl", "buddy-signed-on (" . $buddy->get_name() . ")\n"); +} + +# Connections +sub signed_on +{ + my $conn = shift; + Purple::Debug::misc("signals test in perl", "signed-on (" . $conn->get_account()->get_username() . ")\n"); +} + +# Conversations +sub conv_received_msg +{ + my ($account, $sender, $message, $conv, $flags, $data) = @_; + Purple::Debug::misc("signals test in perl", "$data (" . $account->get_username() . ", $sender, $message, $flags)\n"); +} + +sub plugin_load +{ + my $plugin = shift; + + # Hook to the signals + + # Accounts + $act_handle = Purple::Accounts::get_handle(); + Purple::Signal::connect($act_handle, "account-connecting", $plugin, + \&account_connecting_cb, 0); + + # Buddy List + $blist = Purple::BuddyList::get_handle(); + Purple::Signal::connect($blist, "buddy-signed-on", $plugin, + \&buddy_signed_on, 0); + + # Connections + $conn = Purple::Connections::get_handle(); + Purple::Signal::connect($conn, "signed-on", $plugin, + \&signed_on, 0); + + # Conversations + $conv = Purple::Conversations::get_handle(); + Purple::Signal::connect($conv, "received-im-msg", $plugin, + \&conv_received_msg, "received im message"); + Purple::Signal::connect($conv, "received-chat-msg", $plugin, + \&conv_received_msg, "received chat message"); +} + +sub plugin_unload +{ + # Nothing to do here for this plugin. +} +
--- a/libpurple/protocols/irc/msgs.c Tue May 15 02:39:12 2007 +0000 +++ b/libpurple/protocols/irc/msgs.c Wed May 16 09:10:30 2007 +0000 @@ -35,6 +35,7 @@ static char *irc_mask_userhost(const char *mask); static void irc_chat_remove_buddy(PurpleConversation *convo, char *data[2]); static void irc_buddy_status(char *name, struct irc_buddy *ib, struct irc_conn *irc); +static void irc_connected(struct irc_conn *irc, const char *nick); static void irc_msg_handle_privmsg(struct irc_conn *irc, const char *name, const char *from, const char *to, @@ -70,6 +71,52 @@ g_free(message); } +static void irc_connected(struct irc_conn *irc, const char *nick) +{ + PurpleConnection *gc; + PurpleStatus *status; + PurpleBlistNode *gnode, *cnode, *bnode; + + if ((gc = purple_account_get_connection(irc->account)) == NULL + || PURPLE_CONNECTION_IS_CONNECTED(gc)) + return; + + purple_connection_set_display_name(gc, nick); + purple_connection_set_state(gc, PURPLE_CONNECTED); + + /* If we're away then set our away message */ + status = purple_account_get_active_status(irc->account); + if (!purple_status_get_type(status) != PURPLE_STATUS_AVAILABLE) { + PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info->set_status(irc->account, status); + } + + /* this used to be in the core, but it's not now */ + for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) + continue; + for(cnode = gnode->child; cnode; cnode = cnode->next) { + if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) + continue; + for(bnode = cnode->child; bnode; bnode = bnode->next) { + PurpleBuddy *b; + if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) + continue; + b = (PurpleBuddy *)bnode; + if(b->account == gc->account) { + struct irc_buddy *ib = g_new0(struct irc_buddy, 1); + ib->name = g_strdup(b->name); + g_hash_table_insert(irc->buddies, ib->name, ib); + } + } + } + } + + irc_blist_timeout(irc); + if (!irc->timer) + irc->timer = purple_timeout_add(45000, (GSourceFunc)irc_blist_timeout, (gpointer)irc); +} + void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args) { purple_debug(PURPLE_DEBUG_INFO, "irc", "Unrecognized message: %s\n", args[0]); @@ -95,56 +142,16 @@ void irc_msg_luser(struct irc_conn *irc, const char *name, const char *from, char **args) { - PurpleConnection *gc; - PurpleStatus *status; - PurpleBlistNode *gnode, *cnode, *bnode; - - if (!args || !args[0] || !args[1]) - return; - - gc = purple_account_get_connection(irc->account); - if (!gc) + if (!args || !args[0]) return; if (!strcmp(name, "251")) { - /* 251 is required, so we pluck our nick from here */ - purple_connection_set_display_name(gc, args[0]); + /* 251 is required, so we pluck our nick from here and + * finalize connection */ + irc_connected(irc, args[0]); /* Some IRC servers seem to not send a 255 numeric, so * I guess we can't require it; 251 will do. */ /* } else if (!strcmp(name, "255")) { */ - purple_connection_set_state(gc, PURPLE_CONNECTED); - - /* If we're away then set our away message */ - status = purple_account_get_active_status(irc->account); - if (!purple_status_get_type(status) != PURPLE_STATUS_AVAILABLE) { - PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); - prpl_info->set_status(irc->account, status); - } - - /* this used to be in the core, but it's not now */ - for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { - if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) - continue; - for(cnode = gnode->child; cnode; cnode = cnode->next) { - if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) - continue; - for(bnode = cnode->child; bnode; bnode = bnode->next) { - PurpleBuddy *b; - if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - b = (PurpleBuddy *)bnode; - if(b->account == gc->account) { - struct irc_buddy *ib = g_new0(struct irc_buddy, 1); - ib->name = g_strdup(b->name); - g_hash_table_insert(irc->buddies, ib->name, ib); - } - } - } - } - - irc_blist_timeout(irc); - if (!irc->timer) - irc->timer = purple_timeout_add(45000, (GSourceFunc)irc_blist_timeout, (gpointer)irc); } } @@ -523,6 +530,9 @@ { char *escaped; + if (!args || !args[0]) + return; + if (!irc->motd) irc->motd = g_string_new(""); @@ -532,7 +542,9 @@ irc->motd = g_string_new(""); return; } else if (!strcmp(name, "376")) { - /* We no longer have to do anything for ENDMOTD */ + /* dircproxy 1.0.5 does not send 251 on reconnection, so + * finalize the connection here if it is not already done. */ + irc_connected(irc, args[0]); return; } @@ -541,6 +553,9 @@ return; } + if (!args[1]) + return; + escaped = g_markup_escape_text(args[1], -1); g_string_append_printf(irc->motd, "%s<br>", escaped); g_free(escaped);
--- a/pidgin/gtkconv.c Tue May 15 02:39:12 2007 +0000 +++ b/pidgin/gtkconv.c Wed May 16 09:10:30 2007 +0000 @@ -4626,6 +4626,18 @@ } } +static gboolean +ignore_middle_click(GtkWidget *widget, GdkEventButton *e, gpointer null) +{ + /* A click on the pane is propagated to the notebook containing the pane. + * So if Stu accidentally aims high and middle clicks on the pane-handle, + * it causes a conversation tab to close. Let's stop that from happening. + */ + if (e->button == 2 && e->type == GDK_BUTTON_PRESS) + return TRUE; + return FALSE; +} + /************************************************************************** * Conversation UI operations **************************************************************************/ @@ -4699,6 +4711,8 @@ te, sizeof(te) / sizeof(GtkTargetEntry), GDK_ACTION_COPY); + g_signal_connect(G_OBJECT(pane), "button_press_event", + G_CALLBACK(ignore_middle_click), NULL); g_signal_connect(G_OBJECT(pane), "drag_data_received", G_CALLBACK(conv_dnd_recv), gtkconv); g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", @@ -7423,8 +7437,7 @@ PidginWindow *dest_win; GtkNotebook *dest_notebook; GtkWidget *tab; - gint nb_x, nb_y, page_num; - gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; + gint page_num; gboolean horiz_tabs = FALSE; PidginConversation *gtkconv; gboolean to_right = FALSE; @@ -7440,52 +7453,35 @@ dest_notebook = GTK_NOTEBOOK(dest_win->notebook); - gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); - - arrow1_x = arrow2_x = nb_x; - arrow1_y = arrow2_y = nb_y; - page_num = pidgin_conv_get_tab_at_xy(dest_win, e->x_root, e->y_root, &to_right); to_right = to_right && (win != dest_win); if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || - gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { - - horiz_tabs = TRUE; - } + gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { + horiz_tabs = TRUE; + } gtkconv = pidgin_conv_window_get_gtkconv_at_index(dest_win, page_num); tab = gtkconv->tabby; if (horiz_tabs) { - arrow1_x = arrow2_x = nb_x + tab->allocation.x; - if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) { - arrow1_x += tab->allocation.width; - arrow2_x += tab->allocation.width; + dnd_hints_show_relative(HINT_ARROW_DOWN, tab, HINT_POSITION_RIGHT, HINT_POSITION_TOP); + dnd_hints_show_relative(HINT_ARROW_UP, tab, HINT_POSITION_RIGHT, HINT_POSITION_BOTTOM); + } else { + dnd_hints_show_relative(HINT_ARROW_DOWN, tab, HINT_POSITION_LEFT, HINT_POSITION_TOP); + dnd_hints_show_relative(HINT_ARROW_UP, tab, HINT_POSITION_LEFT, HINT_POSITION_BOTTOM); } - - arrow1_y = nb_y + tab->allocation.y; - arrow2_y = nb_y + tab->allocation.y + tab->allocation.height; } else { - arrow1_x = nb_x + tab->allocation.x; - arrow2_x = nb_x + tab->allocation.x + tab->allocation.width; - arrow1_y = arrow2_y = nb_y + tab->allocation.y; - if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) { - arrow1_y += tab->allocation.height; - arrow2_y += tab->allocation.height; + dnd_hints_show_relative(HINT_ARROW_RIGHT, tab, HINT_POSITION_LEFT, HINT_POSITION_BOTTOM); + dnd_hints_show_relative(HINT_ARROW_LEFT, tab, HINT_POSITION_RIGHT, HINT_POSITION_BOTTOM); + } else { + dnd_hints_show_relative(HINT_ARROW_RIGHT, tab, HINT_POSITION_LEFT, HINT_POSITION_TOP); + dnd_hints_show_relative(HINT_ARROW_LEFT, tab, HINT_POSITION_RIGHT, HINT_POSITION_TOP); } } - - if (horiz_tabs) { - dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); - dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); - } else { - dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); - dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); - } } return TRUE; @@ -8337,6 +8333,7 @@ } ebox = gtk_event_box_new(); + gtk_event_box_set_visible_window(GTK_EVENT_BOX(ebox), FALSE); gtk_container_add(GTK_CONTAINER(ebox), gtkconv->tabby); g_signal_connect(G_OBJECT(ebox), "button-press-event", G_CALLBACK(alias_double_click_cb), gtkconv);
--- a/pidgin/gtkdnd-hints.c Tue May 15 02:39:12 2007 +0000 +++ b/pidgin/gtkdnd-hints.c Wed May 16 09:10:30 2007 +0000 @@ -91,8 +91,6 @@ if (w->parent && w->parent->window == w->window) { get_widget_coords(w->parent, &ox, &oy, NULL, NULL); - ox += w->allocation.x; - oy += w->allocation.y; height = w->allocation.height; width = w->allocation.width; } @@ -174,6 +172,8 @@ gint x = 0, y = 0; get_widget_coords(widget, &x1, &y1, &x2, &y2); + x1 += widget->allocation.x; x2 += widget->allocation.x; + y1 += widget->allocation.y; y2 += widget->allocation.y; switch (horiz) {