From: Sean E. <sea...@us...> - 2002-09-16 08:35:28
|
Update of /cvsroot/gaim/gaim/src In directory usw-pr-cvs1:/tmp/cvs-serv22869/src Modified Files: aim.c away.c buddy.c buddy_chat.c conversation.c core.h gaim.h idle.c module.c multi.c multi.h perl.c server.c ui.h Log Message: Rob McQueen added a mute feature to his nice little docklet. I added a queuing feature. Configure the docklet in the plugins dialog to queue unread messages, and when you receive a message the docklet will eat it up and show a little message pending icon. Click on it, and read your message. ICQ people will like it. I also made plugin_event use a va_list. I bet this breaks perl. Index: aim.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/aim.c,v retrieving revision 1.195 retrieving revision 1.196 diff -u -d -r1.195 -r1.196 --- aim.c 14 Sep 2002 23:27:26 -0000 1.195 +++ aim.c 16 Sep 2002 08:35:17 -0000 1.196 @@ -63,6 +63,7 @@ GSList *away_messages = NULL; GList *conversations = NULL; GSList *message_queue = NULL; +GSList *unread_message_queue = NULL; GSList *away_time_queue = NULL; GtkWidget *mainwindow = NULL; @@ -98,7 +99,7 @@ { #ifdef GAIM_PLUGINS /* first we tell those who have requested it we're quitting */ - plugin_event(event_quit, 0, 0, 0, 0); + plugin_event(event_quit); /* then we remove everyone in a mass suicide */ remove_all_plugins(); Index: away.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/away.c,v retrieving revision 1.73 retrieving revision 1.74 diff -u -d -r1.73 -r1.74 --- away.c 15 Sep 2002 15:46:06 -0000 1.73 +++ away.c 16 Sep 2002 08:35:17 -0000 1.74 @@ -53,15 +53,15 @@ imaway = NULL; } -void purge_away_queue() +void purge_away_queue(GSList *queue) { struct conversation *cnv; gtk_clist_freeze(GTK_CLIST(clistqueue)); gtk_clist_clear(GTK_CLIST(clistqueue)); - while (message_queue) { - struct queued_message *qm = message_queue->data; + while (queue) { + struct queued_message *qm = queue->data; cnv = find_conversation(qm->name); if (!cnv) @@ -70,7 +70,7 @@ set_convo_gc(cnv, qm->gc); write_to_conv(cnv, qm->message, qm->flags, NULL, qm->tm, qm->len); - message_queue = g_slist_remove(message_queue, qm); + queue = g_slist_remove(queue, qm); g_free(qm->message); g_free(qm); @@ -134,7 +134,7 @@ } else { gtk_widget_hide(clistqueue); gtk_widget_hide(clistqueuesw); - purge_away_queue(); + purge_away_queue(message_queue); } } @@ -143,7 +143,7 @@ if (imaway) { GtkWidget *tmp = imaway; - purge_away_queue(); + purge_away_queue(message_queue); imaway = NULL; gtk_widget_destroy(tmp); Index: buddy.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/buddy.c,v retrieving revision 1.329 retrieving revision 1.330 diff -u -d -r1.329 -r1.330 --- buddy.c 14 Sep 2002 23:27:26 -0000 1.329 +++ buddy.c 16 Sep 2002 08:35:18 -0000 1.330 @@ -110,8 +110,7 @@ }; static GSList *shows = NULL; -static gboolean blist_hidden; -static int docklet_refcount = 0; +static int docklet_count = 0; /* Predefine some functions */ static void new_bp_callback(GtkWidget *w, struct buddy *bs); @@ -703,7 +702,7 @@ } /* we send the menu widget so we can add menuitems within a plugin */ - plugin_event(event_draw_menu, menu, b->name, 0, 0); + plugin_event(event_draw_menu, menu, b->name); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time); @@ -1400,7 +1399,7 @@ void do_quit() { /* first we tell those who have requested it we're quitting */ - plugin_event(event_quit, 0, 0, 0, 0); + plugin_event(event_quit); signoff_all(); #ifdef GAIM_PLUGINS @@ -1993,10 +1992,39 @@ return g; } + +void docklet_toggle() { + /* Useful for the docklet plugin and also for the win32 tray icon*/ + /* This is called when one of those is clicked--it will show/hide the + buddy list/login window--depending on which is active */ + if (connections) { + if (GTK_WIDGET_VISIBLE(blist)) { + if (DOCKLET_WINDOW_ICONIFIED(blist)) { + unhide_buddy_list(); + } else { + hide_buddy_list(); + } + } else { + unhide_buddy_list(); + } + } else { + if (GTK_WIDGET_VISIBLE(mainwindow)) { + if (DOCKLET_WINDOW_ICONIFIED(mainwindow)) { + gtk_window_present(GTK_WINDOW(mainwindow)); + } else { + gtk_widget_hide(mainwindow); + } + } else { + gtk_window_present(GTK_WINDOW(mainwindow)); + } + } +} + + /* used by this file, and by iconaway.so */ void hide_buddy_list() { if (blist) { - if (!connections || docklet_refcount) { + if (!connections || docklet_count) { gtk_widget_hide(blist); } else { gtk_window_iconify(GTK_WINDOW(blist)); @@ -2020,7 +2048,7 @@ /* for the delete_event handler */ static void close_buddy_list() { - if (docklet_refcount) { + if (docklet_count) { hide_buddy_list(); } else { do_quit(); @@ -2028,16 +2056,16 @@ } void docklet_add() { - docklet_refcount++; - printf("docklet_refcount: %d\n",docklet_refcount); + docklet_count++; + printf("docklet_count: %d\n",docklet_count); } void docklet_remove() { - if (docklet_refcount) { - docklet_refcount--; + if (docklet_count) { + docklet_count--; } - printf("docklet_refcount: %d\n",docklet_refcount); - if (!docklet_refcount) { + printf("docklet_count: %d\n",docklet_count); + if (!docklet_count) { if (connections) { unhide_buddy_list(); } else { Index: buddy_chat.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/buddy_chat.c,v retrieving revision 1.158 retrieving revision 1.159 diff -u -d -r1.158 -r1.159 --- buddy_chat.c 30 Aug 2002 03:14:00 -0000 1.158 +++ buddy_chat.c 16 Sep 2002 08:35:20 -0000 1.159 @@ -955,7 +955,7 @@ char tmp[BUF_LONG]; int pos; - plugin_event(event_chat_buddy_join, b->gc, (void *)b->id, name, 0); + plugin_event(event_chat_buddy_join, b->gc, b->id, name); b->in_room = g_list_insert_sorted(b->in_room, name, insertname); pos = g_list_index(b->in_room, name); @@ -1048,7 +1048,7 @@ char tmp[BUF_LONG]; - plugin_event(event_chat_buddy_leave, b->gc, (void *)b->id, buddy, 0); + plugin_event(event_chat_buddy_leave, b->gc, b->id, buddy); while (names) { if (!g_strcasecmp((char *)names->data, buddy)) { Index: conversation.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/conversation.c,v retrieving revision 1.376 retrieving revision 1.377 diff -u -d -r1.376 -r1.377 --- conversation.c 14 Sep 2002 16:37:24 -0000 1.376 +++ conversation.c 16 Sep 2002 08:35:20 -0000 1.377 @@ -194,7 +194,7 @@ update_icon(c); update_checkbox(c); update_smilies(c); - plugin_event(event_new_conversation, name, 0, 0, 0); + plugin_event(event_new_conversation, name); return c; } @@ -259,7 +259,7 @@ void delete_conversation(struct conversation *c) { - plugin_event(event_del_conversation, c, 0, 0, 0); + plugin_event(event_del_conversation, c); conversations = g_list_remove(conversations, c); if (c->fg_color_dialog) gtk_widget_destroy(c->fg_color_dialog); @@ -949,13 +949,6 @@ toggle_font(c->font, c); gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); break; - case 'k': - case 'K': - quiet_set(c->fgcolorbtn, - !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->fgcolorbtn))); - toggle_fg_color(c->fgcolorbtn, c); - gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); - break; } } if (convo_options & OPT_CONVO_CTL_SMILEYS) { @@ -1188,7 +1181,7 @@ enum gaim_event evnt = c->is_chat ? event_chat_send : event_im_send; int plugin_return = plugin_event(evnt, c->gc, c->is_chat ? (void *)c->id : c->name, - &buffy, 0); + &buffy); if (!buffy) { g_free(buf2); g_free(buf); @@ -1210,7 +1203,7 @@ gboolean binary = FALSE; buffy = g_strdup(buf); - plugin_event(event_im_displayed_sent, c->gc, c->name, &buffy, 0); + plugin_event(event_im_displayed_sent, c->gc, c->name, &buffy); if (buffy) { int imflags = 0; if (c->check && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->check))) Index: core.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/core.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- core.h 14 Sep 2002 23:27:27 -0000 1.25 +++ core.h 16 Sep 2002 08:35:21 -0000 1.26 @@ -26,6 +26,7 @@ #include <config.h> #endif +#include <sys/types.h> #ifdef HAVE_ICONV #include <iconv.h> #endif @@ -189,7 +190,7 @@ #ifdef USE_PERL extern void perl_autoload(); extern void perl_end(); -extern int perl_event(enum gaim_event, void *, void *, void *, void *); +extern int perl_event(enum gaim_event, void *, void *, void *, void *, void *); extern int perl_load_file(char *); extern void unload_perl_scripts(); extern void list_perl_scripts(); @@ -205,7 +206,7 @@ extern void gaim_plugin_unload(GModule *); extern void remove_all_plugins(); #endif -extern int plugin_event(enum gaim_event, void *, void *, void *, void *); +extern int plugin_event(enum gaim_event, ...); extern char *event_name(enum gaim_event); /* Functions in server.c */ Index: gaim.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/gaim.h,v retrieving revision 1.336 retrieving revision 1.337 diff -u -d -r1.336 -r1.337 --- gaim.h 10 Sep 2002 15:31:33 -0000 1.336 +++ gaim.h 16 Sep 2002 08:35:21 -0000 1.337 @@ -333,12 +333,14 @@ #define OPT_AWAY_NO_AUTO_RESP 0x00000010 #define OPT_AWAY_QUEUE 0x00000020 #define OPT_AWAY_IDLE_RESP 0x00000040 +#define OPT_AWAY_QUEUE_UNREAD 0x00000060 extern guint away_resend; extern int report_idle; extern int web_browser; extern GSList *aim_users; extern GSList *message_queue; +extern GSList *unread_message_queue; extern GSList *away_time_queue; extern char sound_cmd[2048]; extern char web_command[2048]; @@ -351,6 +353,7 @@ extern void do_pounce(struct gaim_connection *, char *, int); void create_prpl_icon(GtkWidget *widget, struct gaim_connection *gc, GdkPixmap **pixmap, GdkBitmap **mask); +void docklet_toggle(); /* Functions in buddy_chat.c */ extern void show_new_buddy_chat(struct conversation *); Index: idle.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/idle.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- idle.c 28 Sep 2001 05:17:16 -0000 1.32 +++ idle.c 16 Sep 2002 08:35:22 -0000 1.33 @@ -50,7 +50,7 @@ /* Not idle, really... :) */ update_idle_times(); - plugin_event(event_blist_update, 0, 0, 0, 0); + plugin_event(event_blist_update); time(&t); Index: module.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/module.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- module.c 14 Sep 2002 23:27:27 -0000 1.20 +++ module.c 16 Sep 2002 08:35:23 -0000 1.21 @@ -376,144 +376,35 @@ return buf; } -static void debug_event(enum gaim_event event, void *arg1, void *arg2, void *arg3, void *arg4) -{ - if (!opt_debug && !(misc_options & OPT_MISC_DEBUG)) - return; - - switch (event) { - case event_blist_update: - /* this happens *really* often */ - if (opt_debug) { - debug_printf("%s\n", event_name(event)); - } - break; - case event_quit: - debug_printf("%s\n", event_name(event)); - break; - case event_signon: - case event_signoff: - debug_printf("%s: %s\n", event_name(event), - ((struct gaim_connection *)arg1)->username); - break; - case event_new_conversation: - debug_printf("%s: %s\n", event_name(event), (char *)arg1); - break; - case event_error: - debug_printf("%s: %d\n", event_name(event), (int)arg1); - break; - case event_buddy_signon: - case event_buddy_signoff: - case event_buddy_away: - case event_buddy_back: - case event_buddy_idle: - case event_buddy_unidle: - case event_set_info: - case event_got_typing: - debug_printf("%s: %s %s\n", event_name(event), - ((struct gaim_connection *)arg1)->username, (char *)arg2); - break; - case event_chat_leave: - debug_printf("%s: %s %d\n", event_name(event), - ((struct gaim_connection *)arg1)->username, (int)arg2); - break; - case event_im_send: - case event_im_displayed_sent: - debug_printf("%s: %s %s %s\n", event_name(event), - ((struct gaim_connection *)arg1)->username, - (char *)arg2, *(char **)arg3 ? *(char **)arg3 : ""); - break; - case event_chat_join: - case event_chat_buddy_join: - case event_chat_buddy_leave: - debug_printf("%s: %s %d %s\n", event_name(event), - ((struct gaim_connection *)arg1)->username, - (int)arg2, (char *)arg3); - break; - case event_chat_send: - debug_printf("%s: %s %d %s\n", event_name(event), - ((struct gaim_connection *)arg1)->username, - (int)arg2, *(char **)arg3 ? *(char **)arg3 : ""); - break; - case event_away: - debug_printf("%s: %s %s %s\n", event_name(event), - ((struct gaim_connection *)arg1)->username, - (char *)arg2, (char *)arg3 ? (char *)arg3 : ""); - break; - case event_warned: - debug_printf("%s: %s %s %d\n", event_name(event), - ((struct gaim_connection *)arg1)->username, - (char *)arg2 ? (char *)arg2 : "", (int)arg3); - break; - case event_im_recv: - debug_printf("%s: %s %s %s\n", event_name(event), - ((struct gaim_connection *)arg1)->username, - *(char **)arg2 ? *(char **)arg2 : "", - *(char **)arg3 ? *(char **)arg3 : ""); - break; - case event_im_displayed_rcvd: - debug_printf("%s: %s %s %s\n", event_name(event), - ((struct gaim_connection *)arg1)->username, - (char *)arg2 ? (char *)arg2 : "", - (char *)arg3 ? (char *)arg3 : ""); - break; - case event_chat_recv: - debug_printf("%s: %s %d %s\n", event_name(event), - ((struct gaim_connection *)arg1)->username, - (int)arg2, - *(char **)arg3 ? *(char **)arg3 : "", - *(char **)arg4 ? *(char **)arg4 : ""); - break; - case event_chat_send_invite: - debug_printf("%s: %s %d %s %s\n", event_name(event), - ((struct gaim_connection *)arg1)->username, - (int)arg2, (char *)arg3, - *(char **)arg4 ? *(char **)arg4 : ""); - break; - case event_chat_invited: - debug_printf("%s: %s %s %s %s\n", event_name(event), - ((struct gaim_connection *)arg1)->username, - (char *)arg2, (char *)arg3, - (char *)arg4 ? (char *)arg4 : ""); - break; - case event_del_conversation: - debug_printf("%s: %s\n", event_name(event), (char *)arg1); - break; - case event_connecting: - debug_printf("%s: %s\n", event_name(event), ((struct aim_user *)arg1)->username); - break; - default: - debug_printf("%s: um, right. yeah.\n", event_name(event)); - break; - } -} - -int plugin_event(enum gaim_event event, void *arg1, void *arg2, void *arg3, void *arg4) +int plugin_event(enum gaim_event event, ...) { #ifdef GAIM_PLUGINS GList *c = callbacks; struct gaim_callback *g; + va_list arrg; + void *arg1 = NULL, + *arg2 = NULL, + *arg3 = NULL, + *arg4 = NULL, + *arg5 = NULL; #endif - debug_event(event, arg1, arg2, arg3, arg4); + debug_printf("%s\n", event_name(event)); #ifdef GAIM_PLUGINS while (c) { - void (*zero)(void *); - void (*one)(void *, void *); - void (*two)(void *, void *, void *); - void (*three)(void *, void *, void *, void *); - void (*four)(void *, void *, void *, void *, void *); - + void (*cbfunc)(void *, ...); + g = (struct gaim_callback *)c->data; if (g->event == event && g->function != NULL) { + cbfunc=g->function; + va_start(arrg, event); switch (event) { /* no args */ case event_blist_update: case event_quit: - zero = g->function; - zero(g->data); + cbfunc(g->data); break; /* one arg */ @@ -523,8 +414,8 @@ case event_del_conversation: case event_error: case event_connecting: - one = g->function; - one(arg1, g->data); + arg1 = va_arg(arrg, void *); + cbfunc(arg1, g->data); break; /* two args */ @@ -534,48 +425,101 @@ case event_buddy_back: case event_buddy_idle: case event_buddy_unidle: - case event_chat_leave: case event_set_info: case event_draw_menu: case event_got_typing: - two = g->function; - two(arg1, arg2, g->data); + arg1 = va_arg(arrg, void *); + arg2 = va_arg(arrg, void *); + cbfunc(arg1, arg2, g->data); + break; + case event_chat_leave: + { + int id; + arg1 = va_arg(arrg, void*); + id = va_arg(arrg, int); + cbfunc(arg1, id, g->data); + } break; - /* three args */ case event_im_send: case event_im_displayed_sent: - case event_chat_join: + case event_away: + arg1 = va_arg(arrg, void *); + arg2 = va_arg(arrg, void *); + arg3 = va_arg(arrg, void *); + cbfunc(arg1, arg2, arg3, g->data); + break; case event_chat_buddy_join: case event_chat_buddy_leave: case event_chat_send: - case event_away: - case event_back: + case event_chat_join: + { + int id; + arg1 = va_arg(arrg, void*); + id = va_arg(arrg, int); + arg3 = va_arg(arrg, void*); + cbfunc(arg1, id, arg3, g->data); + } + break; case event_warned: - three = g->function; - three(arg1, arg2, arg3, g->data); + { + int id; + arg1 = va_arg(arrg, void*); + arg2 = va_arg(arrg, void*); + id = va_arg(arrg, int); + cbfunc(arg1, arg2, id, g->data); + } break; - /* four args */ case event_im_recv: - case event_chat_recv: - case event_im_displayed_rcvd: - case event_chat_send_invite: case event_chat_invited: - four = g->function; - four(arg1, arg2, arg3, arg4, g->data); + arg1 = va_arg(arrg, void *); + arg2 = va_arg(arrg, void *); + arg3 = va_arg(arrg, void *); + arg4 = va_arg(arrg, void *); + cbfunc(arg1, arg2, arg3, arg4, g->data); break; + case event_chat_recv: + case event_chat_send_invite: + { + int id; + arg1 = va_arg(arrg, void *); + id = va_arg(arrg, int); - default: + arg3 = va_arg(arrg, void *); + arg4 = va_arg(arrg, void *); + cbfunc(arg1, id, arg3, arg4, g->data); + } + break; + /* five args */ + case event_im_displayed_rcvd: + { + time_t time; + arg1 = va_arg(arrg, void *); + arg2 = va_arg(arrg, void *); + arg3 = va_arg(arrg, void *); + arg4 = va_arg(arrg, void *); + time = va_arg(arrg, time_t); + cbfunc(arg1, arg2, arg3, arg4, time, g->data); + } + break; + default: debug_printf("unknown event %d\n", event); break; } + va_end(arrg); } c = c->next; } #endif /* GAIM_PLUGINS */ #ifdef USE_PERL - return perl_event(event, arg1, arg2, arg3, arg4); + va_start(arrg, event); + arg1 = va_arg(arrg, void *); + arg2 = va_arg(arrg, void *); + arg3 = va_arg(arrg, void *); + arg4 = va_arg(arrg, void *); + arg5 = va_arg(arrg, void *); + return perl_event(event, arg1, arg2, arg3, arg4, arg5); #else return 0; #endif Index: multi.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/multi.c,v retrieving revision 1.128 retrieving revision 1.129 diff -u -d -r1.128 -r1.129 --- multi.c 14 Sep 2002 23:27:27 -0000 1.128 +++ multi.c 16 Sep 2002 08:35:23 -0000 1.129 @@ -40,6 +40,7 @@ #define LOGIN_STEPS 5 GSList *connections; +int connecting_count = 0; static GtkWidget *acctedit = NULL; static GtkWidget *list = NULL; /* the clist of names in the accteditor */ @@ -1156,7 +1157,9 @@ gaim_setup(gc); gc->user->connecting = FALSE; - plugin_event(event_signon, gc, 0, 0, 0); + connecting_count--; + + plugin_event(event_signon, gc); system_log(log_signon, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); /* away option given? */ @@ -1445,12 +1448,15 @@ /* remove this here so plugins get a sensible count of connections */ connections = g_slist_remove(connections, gc); debug_printf("date: %s\n", full_date()); - plugin_event(event_signoff, gc, 0, 0, 0); + plugin_event(event_signoff, gc); system_log(log_signoff, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); /* set this in case the plugin died before really connecting. do it after calling the plugins so they can determine if this user was ever on-line or not */ - gc->user->connecting = FALSE; + if (gc->user->connecting) { + gc->user->connecting = FALSE; + connecting_count--; + } serv_close(gc); /* more UI stuff */ Index: multi.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/multi.h,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- multi.h 17 Mar 2002 20:23:33 -0000 1.41 +++ multi.h 16 Sep 2002 08:35:23 -0000 1.42 @@ -98,6 +98,9 @@ /* now that we have our struct, we're going to need lots of them. Maybe even a list of them. */ extern GSList *connections; +/* number of accounts that are currently in the process of connecting */ +extern int connecting_count; + struct aim_user *new_user(const char *, int, int); struct gaim_connection *new_gaim_conn(struct aim_user *); void destroy_gaim_conn(struct gaim_connection *); Index: perl.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/perl.c,v retrieving revision 1.76 retrieving revision 1.77 diff -u -d -r1.76 -r1.77 --- perl.c 14 Sep 2002 23:27:27 -0000 1.76 +++ perl.c 16 Sep 2002 08:35:23 -0000 1.77 @@ -662,7 +662,7 @@ XSRETURN(0); } -int perl_event(enum gaim_event event, void *arg1, void *arg2, void *arg3, void *arg4) +int perl_event(enum gaim_event event, void *arg1, void *arg2, void *arg3, void *arg4, void *arg5) { char *buf = NULL; GList *handler; @@ -754,6 +754,7 @@ arg2 ? escape_quotes(arg2) : "", (int)arg3); break; case event_quit: + case event_blist_update: buf = g_malloc0(1); break; case event_new_conversation: @@ -780,6 +781,9 @@ g_free(tmp3); } break; + case event_draw_menu: + /* we can't handle this usefully without gtk/perl bindings */ + return 0; default: debug_printf("someone forgot to handle %s in the perl binding\n", event_name(event)); return 0; Index: server.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/server.c,v retrieving revision 1.235 retrieving revision 1.236 diff -u -d -r1.235 -r1.236 --- server.c 14 Sep 2002 23:27:28 -0000 1.235 +++ server.c 16 Sep 2002 08:35:24 -0000 1.236 @@ -55,7 +55,8 @@ debug_printf(PACKAGE " " VERSION " logging in %s using %s\n", user->username, p->name()); user->connecting = TRUE; - plugin_event(event_connecting, user, 0, 0, 0); + connecting_count++; + plugin_event(event_connecting, user); p->login(user); } } @@ -207,7 +208,7 @@ gc->prpl->set_away(gc, state, buf); - plugin_event(event_away, gc, state, buf, 0); + plugin_event(event_away, gc, state, buf); if (buf) g_free(buf); @@ -231,7 +232,7 @@ void serv_set_info(struct gaim_connection *g, char *info) { if (g && g_slist_find(connections, g) && g->prpl && g->prpl->set_info) { - if (plugin_event(event_set_info, g, info, 0, 0)) + if (plugin_event(event_set_info, g, info)) return; g->prpl->set_info(g, info); } @@ -523,7 +524,7 @@ buffy = g_malloc(MAX(strlen(message) + 1, BUF_LONG)); strcpy(buffy, message); angel = g_strdup(name); - plugin_return = plugin_event(event_im_recv, gc, &angel, &buffy, (void *)&flags); + plugin_return = plugin_event(event_im_recv, gc, &angel, &buffy, &flags); if (!buffy || !angel || plugin_return) { if (buffy) @@ -687,21 +688,34 @@ /* we're not away. this is easy. if the convo window doesn't exist, create and update * it (if it does exist it was updated earlier), then play a sound indicating we've * received it and then display it. easy. */ - if (cnv == NULL) { - cnv = new_conversation(name); - set_convo_gc(cnv, gc); + if (away_options & OPT_AWAY_QUEUE_UNREAD && !find_conversation(name)) { + /* We're gonna queue it up and wait for the user to ask for it... probably + * by clicking the docklet or windows tray icon. */ + struct queued_message *qm; + qm = g_new0(struct queued_message, 1); + g_snprintf(qm->name, sizeof(qm->name), "%s", name); + qm->message = g_strdup(message); + qm->gc = gc; + qm->tm = mtime; + qm->flags = away | WFLAG_RECV; + qm->len = len; + unread_message_queue = g_slist_append(unread_message_queue, qm); + } else { + if (cnv == NULL) { + cnv = new_conversation(name); + set_convo_gc(cnv, gc); + } + if (new_conv && (sound_options & OPT_SOUND_FIRST_RCV)) + play_sound(SND_FIRST_RECEIVE); + else if (cnv->makesound) + play_sound(SND_RECEIVE); + + set_convo_name(cnv, name); + + write_to_conv(cnv, message, away | WFLAG_RECV, NULL, mtime, len); } - if (new_conv && (sound_options & OPT_SOUND_FIRST_RCV)) - play_sound(SND_FIRST_RECEIVE); - else if (cnv->makesound) - play_sound(SND_RECEIVE); - - set_convo_name(cnv, name); - - write_to_conv(cnv, message, away | WFLAG_RECV, NULL, mtime, len); } - - plugin_event(event_im_displayed_rcvd, gc, name, message, (void *)flags); + plugin_event(event_im_displayed_rcvd, gc, name, message, flags, mtime); g_free(name); g_free(message); } @@ -739,12 +753,12 @@ } if (!b->idle && idle) { - plugin_event(event_buddy_idle, gc, b->name, 0, 0); + plugin_event(event_buddy_idle, gc, b->name); system_log(log_idle, gc, b, OPT_LOG_BUDDY_IDLE); } if (b->idle && !idle) { do_pounce(gc, b->name, OPT_POUNCE_UNIDLE); - plugin_event(event_buddy_unidle, gc, b->name, 0, 0); + plugin_event(event_buddy_unidle, gc, b->name); system_log(log_unidle, gc, b, OPT_LOG_BUDDY_IDLE); } @@ -753,10 +767,10 @@ if ((b->uc & UC_UNAVAILABLE) && !(type & UC_UNAVAILABLE)) { do_pounce(gc, b->name, OPT_POUNCE_UNAWAY); - plugin_event(event_buddy_back, gc, b->name, 0, 0); + plugin_event(event_buddy_back, gc, b->name); system_log(log_back, gc, b, OPT_LOG_BUDDY_AWAY); } else if (!(b->uc & UC_UNAVAILABLE) && (type & UC_UNAVAILABLE)) { - plugin_event(event_buddy_away, gc, b->name, 0, 0); + plugin_event(event_buddy_away, gc, b->name); system_log(log_away, gc, b, OPT_LOG_BUDDY_AWAY); } @@ -770,12 +784,12 @@ if (!b->present) { b->present = 1; do_pounce(gc, b->name, OPT_POUNCE_SIGNON); - plugin_event(event_buddy_signon, gc, b->name, 0, 0); + plugin_event(event_buddy_signon, gc, b->name); system_log(log_signon, gc, b, OPT_LOG_BUDDY_SIGNON); } } else { if (b->present) { - plugin_event(event_buddy_signoff, gc, b->name, 0, 0); + plugin_event(event_buddy_signoff, gc, b->name); system_log(log_signoff, gc, b, OPT_LOG_BUDDY_SIGNON); } b->present = 0; @@ -789,7 +803,7 @@ { char buf2[1024]; - plugin_event(event_warned, gc, name, (void *)lev, 0); + plugin_event(event_warned, gc, name, lev); if (gc->evil >= lev) { gc->evil = lev; @@ -810,7 +824,7 @@ set_convo_gc(cnv, gc); show_typing(cnv); } else return; - plugin_event(event_got_typing, gc, name, 0, 0); + plugin_event(event_got_typing, gc, name); do_pounce(gc, name, OPT_POUNCE_TYPING); if (timeout > 0) { if (cnv->typing_timeout) @@ -916,7 +930,7 @@ { struct conversation *b; - plugin_event(event_chat_join, gc, (void *)id, name, 0); + plugin_event(event_chat_join, gc, id, name); b = (struct conversation *)g_new0(struct conversation, 1); gc->buddy_chats = g_slist_append(gc->buddy_chats, b); @@ -975,7 +989,7 @@ if (!b) return; - plugin_event(event_chat_leave, g, (void *)b->id, 0, 0); + plugin_event(event_chat_leave, g, b->id); debug_printf("Leaving room %s.\n", b->name); @@ -1014,7 +1028,7 @@ buffy = g_malloc(MAX(strlen(message) + 1, BUF_LONG)); strcpy(buffy, message); angel = g_strdup(who); - plugin_return = plugin_event(event_chat_recv, g, (void *)b->id, &angel, &buffy); + plugin_return = plugin_event(event_chat_recv, g, b->id, &angel, &buffy); if (!buffy || !angel || plugin_return) { if (buffy) Index: ui.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/ui.h,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- ui.h 15 Sep 2002 15:46:06 -0000 1.53 +++ ui.h 16 Sep 2002 08:35:24 -0000 1.54 @@ -36,6 +36,8 @@ #define gtk_accel_group_attach(x, y) _gtk_accel_group_attach(x, y) #define gtk_widget_lock_accelerators(x) +#define DOCKLET_WINDOW_ICONIFIED(x) (gdk_window_get_state(GTK_WIDGET(x)->window) & GDK_WINDOW_STATE_ICONIFIED) + #define DEFAULT_FONT_FACE "Helvetica" #define BROWSER_NETSCAPE 0 @@ -318,7 +320,7 @@ extern void away_list_unclicked(GtkWidget *, struct away_message *); extern void away_list_clicked(GtkWidget *, struct away_message *); extern void toggle_away_queue(); -extern void purge_away_queue(); +extern void purge_away_queue(GSList*); /* Functions in browser.c */ extern void open_url(GtkWidget *, char *); |