Index: doc/conversation-signals.dox =================================================================== RCS file: /cvsroot/gaim/gaim/doc/conversation-signals.dox,v retrieving revision 1.11 diff -u -p -u -r1.11 conversation-signals.dox --- doc/conversation-signals.dox 21 Apr 2004 01:43:16 -0000 1.11 +++ doc/conversation-signals.dox 21 May 2004 11:57:18 -0000 @@ -7,6 +7,7 @@ @signal displayed-im-msg @signal sending-im-msg @signal sent-im-msg + @signal receiving-im-msg @signal received-im-msg @signal writing-chat-msg @signal wrote-chat-msg @@ -14,6 +15,7 @@ @signal displayed-chat-msg @signal sending-chat-msg @signal sent-chat-msg + @signal receiving-chat-msg @signal received-chat-msg @signal conversation-switching @signal conversation-switched @@ -118,9 +120,9 @@ void (*sent_im_msg)(GaimAccount *account @param message The message that was sent. @endsignaldef - @signaldef received-im-msg + @signaldef receiving-im-msg @signalproto -gboolean (*received_im_msg)(GaimAccount *account, char **sender, +gboolean (*receiving_im_msg)(GaimAccount *account, char **sender, char **message, int *flags); @endsignalproto @signaldesc @@ -137,6 +139,19 @@ gboolean (*received_im_msg)(GaimAccount @param flags The message flags. @endsignaldef + @signaldef received-im-msg + @signalproto +void (*received_im_msg)(GaimAccount *account, char *sender, + char *message, int flags); + @endsignalproto + @signaldesc + Emitted after an IM is received. + @param account The account the message was received on. + @param sender The username of the sender. + @param message The message that was sent. + @param flags The message flags. + @endsignaldef + @signaldef writing-chat-msg @signalproto gboolean (*writing_chat_msg)(GaimAccount *account, GaimConversation *conv, char **message); @@ -222,9 +237,9 @@ void (*sent_chat_msg)(GaimAccount *accou @param id The ID of the chat. @endsignaldef - @signaldef received-chat-msg + @signaldef receiving-chat-msg @signalproto -gboolean (*received_chat_msg)(GaimAccount *account, char **sender, +gboolean (*receiving_chat_msg)(GaimAccount *account, char **sender, char **message, GaimConversation *conv); @endsignalproto @signaldesc @@ -241,6 +256,19 @@ gboolean (*received_chat_msg)(GaimAccoun @param conv The chat conversation. @endsignaldef + @signaldef received-chat-msg + @signalproto +void (*received_chat_msg)(GaimAccount *account, char *sender, + char *message, GaimConversation *conv); + @endsignalproto + @signaldesc + Emitted after a chat message is received. + @param account The account the message was received on. + @param sender The username of the sender. + @param message The message that was sent. + @param conv The chat conversation. + @endsignaldef + @signaldef conversation-switching @signalproto void (*conversation_switching)(GaimConversation *old_conv, Index: plugins/gaiminc.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/gaiminc.c,v retrieving revision 1.16 diff -u -p -u -r1.16 gaiminc.c --- plugins/gaiminc.c 22 Apr 2004 01:53:01 -0000 1.16 +++ plugins/gaiminc.c 21 May 2004 11:57:18 -0000 @@ -64,7 +64,7 @@ plugin_load(GaimPlugin *plugin) plugin, GAIM_CALLBACK(echo_hi), NULL); /* this is for doing something fun when we get a message */ - gaim_signal_connect(gaim_conversations_get_handle(), "received-im-msg", + gaim_signal_connect(gaim_conversations_get_handle(), "receiving-im-msg", plugin, GAIM_CALLBACK(reverse), NULL); /* this is for doing something fun when a buddy comes online */ Index: plugins/notify.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/notify.c,v retrieving revision 1.50 diff -u -p -u -r1.50 notify.c --- plugins/notify.c 21 May 2004 00:32:32 -0000 1.50 +++ plugins/notify.c 21 May 2004 11:57:19 -0000 @@ -231,7 +231,7 @@ renotify(GaimConvWindow *gaimwin) } static gboolean -chat_recv_im(GaimAccount *account, char **who, char **text, int id, void *m) +chat_recv_im(GaimAccount *account, char *who, char *text, int id, void *m) { GaimConversation *conv = gaim_find_chat(gaim_account_get_connection(account), id); @@ -253,9 +253,9 @@ chat_sent_im(GaimAccount *account, char } static gboolean -im_recv_im(GaimAccount *account, char **who, char **what, int *flags, void *m) +im_recv_im(GaimAccount *account, char *who, char *what, int flags, void *m) { - GaimConversation *conv = gaim_find_conversation_with_account(*who, account); + GaimConversation *conv = gaim_find_conversation_with_account(who, account); notify(conv, TRUE); Index: plugins/signals-test.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/signals-test.c,v retrieving revision 1.10 diff -u -p -u -r1.10 signals-test.c --- plugins/signals-test.c 21 May 2004 00:32:33 -0000 1.10 +++ plugins/signals-test.c 21 May 2004 11:57:19 -0000 @@ -108,6 +108,19 @@ buddy_signed_off_cb(GaimBuddy *buddy, vo gaim_debug_misc("signals test", "buddy-signed-off (%s)\n", buddy->name); } +static void +buddy_extended_menu_cb(GaimBuddy *buddy, void *data) +{ + gaim_debug_misc("signals test", "buddy-extended-menu (%s)\n", buddy->name); +} + +static void +group_extended_menu_cb(GaimGroup *group, void *data) +{ + gaim_debug_misc("signals test", "group-extended-menu (%s)\n", group->name); +} + + /************************************************************************** * Connection subsystem signal callbacks **************************************************************************/ @@ -175,16 +188,25 @@ sent_im_msg_cb(GaimAccount *account, con } static gboolean -received_im_msg_cb(GaimAccount *account, char **sender, char **buffer, +receiving_im_msg_cb(GaimAccount *account, char **sender, char **buffer, int *flags, void *data) { - gaim_debug_misc("signals test", "received-im-msg (%s, %s, %s, %d)\n", + gaim_debug_misc("signals test", "receiving-im-msg (%s, %s, %s, %d)\n", gaim_account_get_username(account), *sender, *buffer, *flags); return FALSE; } +static void +received_im_msg_cb(GaimAccount *account, char *sender, char *buffer, + int flags, void *data) +{ + gaim_debug_misc("signals test", "received-im-msg (%s, %s, %s, %d)\n", + gaim_account_get_username(account), sender, buffer, + flags); +} + static gboolean displaying_chat_msg_cb(GaimAccount *account, GaimConversation *conv, char **buffer, void *data) @@ -219,11 +241,11 @@ sent_chat_msg_cb(GaimAccount *account, c } static gboolean -received_chat_msg_cb(GaimAccount *account, char **sender, char **buffer, +receiving_chat_msg_cb(GaimAccount *account, char **sender, char **buffer, GaimConversation *chat, void *data) { gaim_debug_misc("signals test", - "received-chat-msg (%s, %s, %s, %s, %s)\n", + "receiving-chat-msg (%s, %s, %s, %s)\n", gaim_account_get_username(account), *sender, *buffer, gaim_conversation_get_name(chat)); @@ -231,6 +253,16 @@ received_chat_msg_cb(GaimAccount *accoun } static void +received_chat_msg_cb(GaimAccount *account, char *sender, char *buffer, + GaimConversation *chat, void *data) +{ + gaim_debug_misc("signals test", + "received-chat-msg (%s, %s, %s, %s)\n", + gaim_account_get_username(account), sender, buffer, + gaim_conversation_get_name(chat)); +} + +static void conversation_switching_cb(GaimConversation *old_conv, GaimConversation *new_conv, void *data) { @@ -384,6 +416,10 @@ plugin_load(GaimPlugin *plugin) plugin, GAIM_CALLBACK(buddy_signed_on_cb), NULL); gaim_signal_connect(blist_handle, "buddy-signed-off", plugin, GAIM_CALLBACK(buddy_signed_off_cb), NULL); + gaim_signal_connect(blist_handle, "buddy-extended-menu", + plugin, GAIM_CALLBACK(buddy_extended_menu_cb), NULL); + gaim_signal_connect(blist_handle, "group-extended-menu", + plugin, GAIM_CALLBACK(group_extended_menu_cb), NULL); /* Connection subsystem signals */ gaim_signal_connect(conn_handle, "signing-on", @@ -404,6 +440,8 @@ plugin_load(GaimPlugin *plugin) plugin, GAIM_CALLBACK(sending_im_msg_cb), NULL); gaim_signal_connect(conv_handle, "sent-im-msg", plugin, GAIM_CALLBACK(sent_im_msg_cb), NULL); + gaim_signal_connect(conv_handle, "receiving-im-msg", + plugin, GAIM_CALLBACK(receiving_im_msg_cb), NULL); gaim_signal_connect(conv_handle, "received-im-msg", plugin, GAIM_CALLBACK(received_im_msg_cb), NULL); gaim_signal_connect(conv_handle, "displaying-chat-msg", @@ -414,6 +452,8 @@ plugin_load(GaimPlugin *plugin) plugin, GAIM_CALLBACK(sending_chat_msg_cb), NULL); gaim_signal_connect(conv_handle, "sent-chat-msg", plugin, GAIM_CALLBACK(sent_chat_msg_cb), NULL); + gaim_signal_connect(conv_handle, "receiving-chat-msg", + plugin, GAIM_CALLBACK(receiving_chat_msg_cb), NULL); gaim_signal_connect(conv_handle, "received-chat-msg", plugin, GAIM_CALLBACK(received_chat_msg_cb), NULL); gaim_signal_connect(conv_handle, "conversation-switching", Index: plugins/docklet/docklet.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/docklet/docklet.c,v retrieving revision 1.63 diff -u -p -u -r1.63 docklet.c --- plugins/docklet/docklet.c 21 May 2004 00:32:34 -0000 1.63 +++ plugins/docklet/docklet.c 21 May 2004 11:57:19 -0000 @@ -376,8 +376,8 @@ gaim_away(GaimAccount *account, char *st } static gboolean -gaim_conv_im_recv(GaimAccount *account, char **sender, - char **message, int *flags, void *data) +gaim_conv_im_recv(GaimAccount *account, char *sender, + char *message, int flags, void *data) { /* if message queuing while away is enabled, this event could be the first message so we need to see if the status (and hence icon) needs changing. Index: plugins/tcl/TCL-HOWTO =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/tcl/TCL-HOWTO,v retrieving revision 1.4 diff -u -p -u -r1.4 TCL-HOWTO --- plugins/tcl/TCL-HOWTO 26 Apr 2004 16:24:16 -0000 1.4 +++ plugins/tcl/TCL-HOWTO 21 May 2004 11:57:19 -0000 @@ -296,7 +296,7 @@ Check the file SIGNALS for the meaning o intended to be a list only of their arguments. Signal callbacks will be made in their own namespace, and arguments to those signal callbacks will live in the namespace 'event' underneath that -namespace. To briefly illustrate, the signal received-im-msg is +namespace. To briefly illustrate, the signal receiving-im-msg is provided with three arguments; the account on which the IM was received, the screen name of the user sending the IM, and the text of the IM. These arguments live in the variables event::account, @@ -304,14 +304,14 @@ event::sender, and event::buffer, respec which notifies the user of an incoming IM containing the word 'shizzle' might look like this: -gaim::signal connect [gaim::conversation handle] received-im-msg { +gaim::signal connect [gaim::conversation handle] receiving-im-msg { if {[ string match "*shizzle*" $event::buffer ]} { gaim::notify -info "tcl plugin" "Fo' shizzle" \ "$event::sender is down with the shizzle" } } -Note that for some signals (notably received-im-msg, sending-im-msg, +Note that for some signals (notably receiving-im-msg, sending-im-msg, and their chat counterparts), changes to the event arguments will change the message itself from Gaim's vantage. For those signals whose return value is meaningful, returning a value from the Tcl event Index: plugins/tcl/signal-test.tcl =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/tcl/signal-test.tcl,v retrieving revision 1.3 diff -u -p -u -r1.3 signal-test.tcl --- plugins/tcl/signal-test.tcl 15 Jan 2004 23:11:46 -0000 1.3 +++ plugins/tcl/signal-test.tcl 21 May 2004 11:57:19 -0000 @@ -46,14 +46,22 @@ gaim::signal connect [gaim::core handle] gaim::debug -info "tcl signal" "quitting" } +gaim::signal connect [gaim::conversation handle] receiving-chat-msg { account who what id } { + gaim::debug -info "tcl signal" "receiving-chat-msg [gaim::account username $account] $id $who \"$what\"" + return 0 +} + +gaim::signal connect [gaim::conversation handle] receiving-im-msg { account who what flags } { + gaim::debug -info "tcl signal" "receiving-im-msg [gaim::account username $account] $flags $who \"$what\"" + return 0 +} + gaim::signal connect [gaim::conversation handle] received-chat-msg { account who what id } { gaim::debug -info "tcl signal" "received-chat-msg [gaim::account username $account] $id $who \"$what\"" - return 0 } gaim::signal connect [gaim::conversation handle] received-im-msg { account who what flags } { gaim::debug -info "tcl signal" "received-im-msg [gaim::account username $account] $flags $who \"$what\"" - return 0 } gaim::signal connect [gaim::conversation handle] sending-chat-msg { account what id } { Index: src/conversation.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/conversation.c,v retrieving revision 1.602 diff -u -p -u -r1.602 conversation.c --- src/conversation.c 19 May 2004 04:44:36 -0000 1.602 +++ src/conversation.c 21 May 2004 11:57:19 -0000 @@ -2714,7 +2714,7 @@ gaim_conversations_init(void) gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_STRING)); - gaim_signal_register(handle, "received-im-msg", + gaim_signal_register(handle, "receiving-im-msg", gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER, gaim_value_new(GAIM_TYPE_BOOLEAN), 4, gaim_value_new(GAIM_TYPE_SUBTYPE, @@ -2723,6 +2723,15 @@ gaim_conversations_init(void) gaim_value_new_outgoing(GAIM_TYPE_STRING), gaim_value_new_outgoing(GAIM_TYPE_UINT)); + gaim_signal_register(handle, "received-im-msg", + gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT, + NULL, 4, + gaim_value_new(GAIM_TYPE_SUBTYPE, + GAIM_SUBTYPE_ACCOUNT), + gaim_value_new(GAIM_TYPE_STRING), + gaim_value_new(GAIM_TYPE_STRING), + gaim_value_new(GAIM_TYPE_UINT)); + gaim_signal_register(handle, "writing-chat-msg", gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER, gaim_value_new(GAIM_TYPE_BOOLEAN), 3, @@ -2773,7 +2782,7 @@ gaim_conversations_init(void) gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_UINT)); - gaim_signal_register(handle, "received-chat-msg", + gaim_signal_register(handle, "receiving-chat-msg", gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER, gaim_value_new(GAIM_TYPE_BOOLEAN), 4, gaim_value_new(GAIM_TYPE_SUBTYPE, @@ -2783,6 +2792,16 @@ gaim_conversations_init(void) gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_CONVERSATION)); + gaim_signal_register(handle, "received-chat-msg", + gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER, + NULL, 4, + gaim_value_new(GAIM_TYPE_SUBTYPE, + GAIM_SUBTYPE_ACCOUNT), + gaim_value_new(GAIM_TYPE_STRING), + gaim_value_new(GAIM_TYPE_STRING), + gaim_value_new(GAIM_TYPE_SUBTYPE, + GAIM_SUBTYPE_CONVERSATION)); + gaim_signal_register(handle, "conversation-switching", gaim_marshal_VOID__POINTER_POINTER, NULL, 2, gaim_value_new(GAIM_TYPE_SUBTYPE, Index: src/server.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/server.c,v retrieving revision 1.410 diff -u -p -u -r1.410 server.c --- src/server.c 16 May 2004 07:19:50 -0000 1.410 +++ src/server.c 21 May 2004 11:57:19 -0000 @@ -827,7 +827,7 @@ void serv_got_im(GaimConnection *gc, con plugin_return = GPOINTER_TO_INT( gaim_signal_emit_return_1(gaim_conversations_get_handle(), - "received-im-msg", gc->account, + "receiving-im-msg", gc->account, &angel, &buffy, &imflags)); if (!buffy || !angel || plugin_return) { @@ -837,10 +837,13 @@ void serv_got_im(GaimConnection *gc, con g_free(angel); return; } - name = angel; + name = angel; message = buffy; + gaim_signal_emit(gaim_conversations_get_handle(), "received-im-msg", gc->account, + name, message, imflags); + /* Make sure URLs are clickable */ buffy = gaim_markup_linkify(message); g_free(message); @@ -1485,7 +1488,7 @@ void serv_got_chat_in(GaimConnection *g, plugin_return = GPOINTER_TO_INT( gaim_signal_emit_return_1(gaim_conversations_get_handle(), - "received-chat-msg", g->account, + "receiving-chat-msg", g->account, &angel, &buffy, conv)); if (!buffy || !angel || plugin_return) { @@ -1498,6 +1501,9 @@ void serv_got_chat_in(GaimConnection *g, who = angel; message = buffy; + gaim_signal_emit(gaim_conversations_get_handle(), "received-chat-msg", g->account, + who, message, conv); + /* Make sure URLs are clickable */ buf = gaim_markup_linkify(message);