Mercurial > pidgin.yaz
changeset 4850:b5508e864987
[gaim-migrate @ 5175]
I made the buddy ticker not crash gaim when clizicking on a buddy.
I had to make the ticker pass gaim_conversation_new an account instead
of NULL, so I made the ticker look up the account for the buddy.
This fixes http://sourceforge.net/tracker/index.php?func=detail&aid=707223&group_id=235&atid=100235
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 21 Mar 2003 21:48:13 +0000 |
parents | adf9ca39578f |
children | 4b6bf5ed9c5e |
files | plugins/ticker/ticker.c |
diffstat | 1 files changed, 46 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/ticker/ticker.c Fri Mar 21 20:59:31 2003 +0000 +++ b/plugins/ticker/ticker.c Fri Mar 21 21:48:13 2003 +0000 @@ -73,7 +73,7 @@ BuddyTickerDestroyWindow( GtkWidget *window ) { BuddyTickerClearList(); - gtk_ticker_stop_scroll( GTK_TICKER( ticker ) ); + gtk_ticker_stop_scroll( GTK_TICKER( ticker ) ); gtk_widget_destroy( window ); ticker = tickerwindow = (GtkWidget *) NULL; userclose = TRUE; @@ -86,28 +86,28 @@ BuddyTickerCreateWindow() { - if ( tickerwindow != (GtkWidget *) NULL ) + if ( tickerwindow != (GtkWidget *) NULL ) return; debug_printf("Making ticker\n"); - tickerwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); - g_signal_connect (GTK_OBJECT(tickerwindow), "destroy", - G_CALLBACK (BuddyTickerDestroyWindow), "WM destroy"); - gtk_window_set_title (GTK_WINDOW(tickerwindow), _("Gaim - Buddy Ticker")); - gtk_window_set_role (GTK_WINDOW(tickerwindow), "ticker"); + tickerwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); + g_signal_connect (GTK_OBJECT(tickerwindow), "destroy", + G_CALLBACK (BuddyTickerDestroyWindow), "WM destroy"); + gtk_window_set_title (GTK_WINDOW(tickerwindow), _("Gaim - Buddy Ticker")); + gtk_window_set_role (GTK_WINDOW(tickerwindow), "ticker"); gtk_widget_realize(tickerwindow); - ticker = gtk_ticker_new(); + ticker = gtk_ticker_new(); if (!ticker) return; - gtk_ticker_set_spacing( GTK_TICKER( ticker ), 20 ); - gtk_widget_set_size_request( ticker, 500, -1 ); - gtk_container_add( GTK_CONTAINER( tickerwindow ), ticker ); - gtk_ticker_set_interval( GTK_TICKER( ticker ), 500 ); - gtk_ticker_set_scootch( GTK_TICKER( ticker ), 10 ); + gtk_ticker_set_spacing( GTK_TICKER( ticker ), 20 ); + gtk_widget_set_size_request( ticker, 500, -1 ); + gtk_container_add( GTK_CONTAINER( tickerwindow ), ticker ); + gtk_ticker_set_interval( GTK_TICKER( ticker ), 500 ); + gtk_ticker_set_scootch( GTK_TICKER( ticker ), 10 ); /* Damned egotists - msgw = gtk_label_new( msg ); - gtk_ticker_add( GTK_TICKER( ticker ), msgw ); - */ + msgw = gtk_label_new( msg ); + gtk_ticker_add( GTK_TICKER( ticker ), msgw ); + */ gtk_ticker_start_scroll( GTK_TICKER( ticker ) ); g_timeout_add( 60000, BuddyTickerMessageRemove, NULL); @@ -120,7 +120,29 @@ ButtonPressCallback( GtkWidget *widget, GdkEvent *event, gpointer callback_data ) { TickerData *p = (TickerData *) callback_data; - gaim_conversation_new(GAIM_CONV_IM, NULL, p->buddy); + struct gaim_buddy_list *gaimbuddylist; + GaimBlistNode *group; + GaimBlistNode *buddy; + struct buddy *b = NULL; + char *norm_name = g_strdup(normalize(p->buddy)); + + if (!(gaimbuddylist = gaim_get_blist())) + return TRUE; + + group = gaimbuddylist->root; + while (group) { + buddy = group->child; + while (buddy) { + if (!gaim_utf8_strcasecmp(normalize(((struct buddy*)buddy)->name), norm_name)) + b = (struct buddy*)buddy; + buddy = buddy->next; + } + group = group->next; + } + g_free(norm_name); + + if (b->account) + gaim_conversation_new(GAIM_CONV_IM, b->account, p->buddy); return TRUE; } @@ -162,9 +184,9 @@ /* click detection */ - gtk_widget_set_events (p->ebox, GDK_BUTTON_PRESS_MASK); - g_signal_connect (GTK_OBJECT (p->ebox), "button_press_event", - G_CALLBACK(ButtonPressCallback), (gpointer) p); + gtk_widget_set_events (p->ebox, GDK_BUTTON_PRESS_MASK); + g_signal_connect (GTK_OBJECT (p->ebox), "button_press_event", + G_CALLBACK(ButtonPressCallback), (gpointer) p); gtk_box_pack_start_defaults( GTK_BOX( p->hbox ), p->ebox ); gtk_widget_show( p->ebox ); @@ -177,7 +199,7 @@ gtk_widget_show( p->label ); - gtk_widget_show( tickerwindow ); + gtk_widget_show( tickerwindow ); } void @@ -351,9 +373,9 @@ } void signon_cb(struct gaim_connection *gc, char *who) { - struct buddy *b = gaim_find_buddy(gc->account, who); + struct buddy *b = gaim_find_buddy(gc->account, who); const char *xpm = NULL; - + if (gc->prpl->list_icon) xpm = gc->prpl->list_icon(b->account, b); @@ -373,7 +395,7 @@ } void away_cb(struct gaim_connection *gc, char *who) { - struct buddy *b = gaim_find_buddy(gc->account, who); + struct buddy *b = gaim_find_buddy(gc->account, who); const char *xpm = NULL; if (gc->prpl->list_icon)