Mercurial > pidgin.yaz
changeset 10104:60db14d54914
[gaim-migrate @ 11131]
"This patch that makes received-im-msg and
received-chat-msg signals correspond with each other.
My motivation was to add flags to received-chat-msg,
but I also added conv to received-im-msg to make the
signals match each other."
-- Nathan Fredrickson (noif)
I also updated the receiving-im-msg and receiving-chat-msg signals to match.
Now I can finally reject patch 909745 with "this should be a plugin", which
I've wanted to be able to say for a while. Yay :)
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sat, 16 Oct 2004 15:07:22 +0000 |
parents | a9521c791afe |
children | e94f5975a4df |
files | doc/conversation-signals.dox plugins/ChangeLog.API plugins/docklet/docklet.c plugins/gaiminc.c plugins/notify.c plugins/signals-test.c plugins/tcl/signal-test.tcl plugins/timestamp.c src/conversation.c src/prpl.h src/server.c src/signals.c src/signals.h |
diffstat | 13 files changed, 90 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/conversation-signals.dox Sat Oct 16 01:05:40 2004 +0000 +++ b/doc/conversation-signals.dox Sat Oct 16 15:07:22 2004 +0000 @@ -124,7 +124,7 @@ @signaldef receiving-im-msg @signalproto gboolean (*receiving_im_msg)(GaimAccount *account, char **sender, - char **message, int *flags); + char **message, GaimConversation *conv, int *flags); @endsignalproto @signaldesc Emitted when an IM is received. The callback can replace the name of the @@ -137,20 +137,22 @@ @param account The account the message was received on. @param sender A pointer to the username of the sender. @param message A pointer to the message that was sent. - @param flags The message flags. + @param conv The IM conversation. + @param flags A pointer to the IM message flags. @endsignaldef @signaldef received-im-msg @signalproto -void (*received_im_msg)(GaimAccount *account, char *sender, - char *message, int flags); +void (*received_im_msg)(GaimAccount *account, char *sender, char *message, + GaimConversation *conv, 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. + @param conv The IM conversation. + @param flags The IM message flags. @endsignaldef @signaldef writing-chat-msg @@ -241,11 +243,11 @@ @signaldef receiving-chat-msg @signalproto gboolean (*receiving_chat_msg)(GaimAccount *account, char **sender, - char **message, GaimConversation *conv); + char **message, GaimConversation *conv, int *flags); @endsignalproto @signaldesc Emitted when a chat message is received. The callback can replace the - name of the sender or the messageby modifying the pointer to the + name of the sender, the message, or the flags by modifying the pointer to the strings. This can also be used to cancel displaying a message by returning @c TRUE. @note @@ -255,12 +257,13 @@ @param sender A pointer to the username of the sender. @param message A pointer to the message that was sent. @param conv The chat conversation. + @param flags A pointer to the chat message flags @endsignaldef @signaldef received-chat-msg @signalproto -void (*received_chat_msg)(GaimAccount *account, char *sender, - char *message, GaimConversation *conv); +void (*received_chat_msg)(GaimAccount *account, char *sender, char *message, + GaimConversation *conv, int flags); @endsignalproto @signaldesc Emitted after a chat message is received. @@ -268,6 +271,7 @@ @param sender The username of the sender. @param message The message that was sent. @param conv The chat conversation. + @param flags The chat message flags. @endsignaldef @signaldef conversation-switching
--- a/plugins/ChangeLog.API Sat Oct 16 01:05:40 2004 +0000 +++ b/plugins/ChangeLog.API Sat Oct 16 15:07:22 2004 +0000 @@ -9,6 +9,12 @@ * Changed: gtk_imhtml_toolbar now descends from GtkHBox making it easier to add your own widgets to it + Signals: + * Changed: "received-im-msg and "received-chat-msg" to match, both + now pass a conversation pointer and flags + * Changed: "receiving-im-msg" and "receving-chat-msg" to match, both + now pass a conversation pointer and a pointer to the flags. + version 1.0.0 (09/17/2004): * Added: get_chat_name to the GaimPluginProtocolInfo struct * Changed: gaim_blist_update_buddy_presence(), presence changed to
--- a/plugins/docklet/docklet.c Sat Oct 16 01:05:40 2004 +0000 +++ b/plugins/docklet/docklet.c Sat Oct 16 15:07:22 2004 +0000 @@ -426,8 +426,8 @@ } 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, + GaimConversation *conv, 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.
--- a/plugins/gaiminc.c Sat Oct 16 01:05:40 2004 +0000 +++ b/plugins/gaiminc.c Sat Oct 16 15:07:22 2004 +0000 @@ -20,7 +20,8 @@ } static gboolean -reverse(GaimAccount *account, char **who, char **message, int *flags) +reverse(GaimAccount *account, char **who, char **message, + GaimConversation *conv, int *flags) { /* this will drive you insane. whenever you receive a message, * the text of the message (HTML and all) will be reversed. */
--- a/plugins/notify.c Sat Oct 16 01:05:40 2004 +0000 +++ b/plugins/notify.c Sat Oct 16 15:07:22 2004 +0000 @@ -213,10 +213,8 @@ static gboolean im_recv_im(GaimAccount *account, char *sender, char *message, - int *flags) + GaimConversation *conv, int *flags) { - GaimConversation *conv = gaim_find_conversation_with_account(sender, account); - notify(conv, TRUE); return FALSE; @@ -224,7 +222,7 @@ static gboolean chat_recv_im(GaimAccount *account, char *sender, char *message, - GaimConversation *conv) + GaimConversation *conv, int *flags) { notify(conv, TRUE);
--- a/plugins/signals-test.c Sat Oct 16 01:05:40 2004 +0000 +++ b/plugins/signals-test.c Sat Oct 16 15:07:22 2004 +0000 @@ -216,22 +216,22 @@ static gboolean receiving_im_msg_cb(GaimAccount *account, char **sender, char **buffer, - int *flags, void *data) + GaimConversation *conv, int *flags, void *data) { - gaim_debug_misc("signals test", "receiving-im-msg (%s, %s, %s, %d)\n", + gaim_debug_misc("signals test", "receiving-im-msg (%s, %s, %s, %s, %d)\n", gaim_account_get_username(account), *sender, *buffer, - *flags); + gaim_conversation_get_name(conv), *flags); return FALSE; } static void received_im_msg_cb(GaimAccount *account, char *sender, char *buffer, - int flags, void *data) + GaimConversation *conv, int flags, void *data) { - gaim_debug_misc("signals test", "received-im-msg (%s, %s, %s, %d)\n", + gaim_debug_misc("signals test", "received-im-msg (%s, %s, %s, %s, %d)\n", gaim_account_get_username(account), sender, buffer, - flags); + gaim_conversation_get_name(conv), flags); } static gboolean @@ -286,24 +286,24 @@ static gboolean receiving_chat_msg_cb(GaimAccount *account, char **sender, char **buffer, - GaimConversation *chat, void *data) + GaimConversation *chat, int *flags, void *data) { gaim_debug_misc("signals test", - "receiving-chat-msg (%s, %s, %s, %s)\n", + "receiving-chat-msg (%s, %s, %s, %s, %d)\n", gaim_account_get_username(account), *sender, *buffer, - gaim_conversation_get_name(chat)); + gaim_conversation_get_name(chat), *flags); return FALSE; } static void received_chat_msg_cb(GaimAccount *account, char *sender, char *buffer, - GaimConversation *chat, void *data) + GaimConversation *chat, int flags, void *data) { gaim_debug_misc("signals test", - "received-chat-msg (%s, %s, %s, %s)\n", + "received-chat-msg (%s, %s, %s, %s, %d)\n", gaim_account_get_username(account), sender, buffer, - gaim_conversation_get_name(chat)); + gaim_conversation_get_name(chat), flags); } static void
--- a/plugins/tcl/signal-test.tcl Sat Oct 16 01:05:40 2004 +0000 +++ b/plugins/tcl/signal-test.tcl Sat Oct 16 15:07:22 2004 +0000 @@ -46,22 +46,22 @@ 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\"" +gaim::signal connect [gaim::conversation handle] receiving-chat-msg { account who what id flags } { + gaim::debug -info "tcl signal" "receiving-chat-msg [gaim::account username $account] $id $flags $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\"" +gaim::signal connect [gaim::conversation handle] receiving-im-msg { account who what id flags } { + gaim::debug -info "tcl signal" "receiving-im-msg [gaim::account username $account] $id $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\"" +gaim::signal connect [gaim::conversation handle] received-chat-msg { account who what id flags } { + gaim::debug -info "tcl signal" "received-chat-msg [gaim::account username $account] $id $flags $who \"$what\"" } -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\"" +gaim::signal connect [gaim::conversation handle] received-im-msg { account who what id flags } { + gaim::debug -info "tcl signal" "received-im-msg [gaim::account username $account] $id $flags $who \"$what\"" } gaim::signal connect [gaim::conversation handle] sending-chat-msg { account what id } {
--- a/plugins/timestamp.c Sat Oct 16 01:05:40 2004 +0000 +++ b/plugins/timestamp.c Sat Oct 16 15:07:22 2004 +0000 @@ -93,14 +93,11 @@ static gboolean timestamp_receiving_msg(GaimAccount *account, char **sender, char **buffer, - int *flags, void *data) + GaimConversation *conv, int *flags, void *data) { - GaimConversation* conv; - - conv = gaim_find_conversation_with_account(*sender, account); - if (conv != NULL) - return timestamp_displaying_conv_msg(account, conv, buffer, data); - return FALSE; + g_return_val_if_fail(conv != NULL, FALSE); + + return timestamp_displaying_conv_msg(account, conv, buffer, data); }
--- a/src/conversation.c Sat Oct 16 01:05:40 2004 +0000 +++ b/src/conversation.c Sat Oct 16 15:07:22 2004 +0000 @@ -2793,21 +2793,25 @@ gaim_value_new(GAIM_TYPE_STRING)); gaim_signal_register(handle, "receiving-im-msg", - gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER, - gaim_value_new(GAIM_TYPE_BOOLEAN), 4, + gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, + gaim_value_new(GAIM_TYPE_BOOLEAN), 5, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_ACCOUNT), gaim_value_new_outgoing(GAIM_TYPE_STRING), gaim_value_new_outgoing(GAIM_TYPE_STRING), + gaim_value_new(GAIM_TYPE_SUBTYPE, + GAIM_SUBTYPE_CONVERSATION), gaim_value_new_outgoing(GAIM_TYPE_UINT)); gaim_signal_register(handle, "received-im-msg", - gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT, - NULL, 4, + gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, + NULL, 5, 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_value_new(GAIM_TYPE_UINT)); gaim_signal_register(handle, "writing-chat-msg", @@ -2861,24 +2865,26 @@ gaim_value_new(GAIM_TYPE_UINT)); gaim_signal_register(handle, "receiving-chat-msg", - gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER, - gaim_value_new(GAIM_TYPE_BOOLEAN), 4, + gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, + gaim_value_new(GAIM_TYPE_BOOLEAN), 5, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_ACCOUNT), gaim_value_new_outgoing(GAIM_TYPE_STRING), gaim_value_new_outgoing(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_SUBTYPE, - GAIM_SUBTYPE_CONVERSATION)); + GAIM_SUBTYPE_CONVERSATION), + gaim_value_new_outgoing(GAIM_TYPE_UINT)); gaim_signal_register(handle, "received-chat-msg", - gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER, - NULL, 4, + gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, + NULL, 5, 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_SUBTYPE_CONVERSATION), + gaim_value_new(GAIM_TYPE_UINT)); gaim_signal_register(handle, "conversation-switching", gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
--- a/src/prpl.h Sat Oct 16 01:05:40 2004 +0000 +++ b/src/prpl.h Sat Oct 16 15:07:22 2004 +0000 @@ -47,8 +47,8 @@ typedef enum { GAIM_CONV_CHAT_WHISPER = 0x0001, /**< Whispered message.*/ - GAIM_CONV_CHAT_DELAYED = 0x0002 /**< Delayed message. */ - + GAIM_CONV_CHAT_DELAYED = 0x0002, /**< Delayed message. */ + GAIM_CONV_CHAT_ALERT = 0x0004 /**< Alert message. */ } GaimConvChatFlags; typedef enum {
--- a/src/server.c Sat Oct 16 01:05:40 2004 +0000 +++ b/src/server.c Sat Oct 16 15:07:22 2004 +0000 @@ -807,7 +807,7 @@ plugin_return = GPOINTER_TO_INT( gaim_signal_emit_return_1(gaim_conversations_get_handle(), "receiving-im-msg", gc->account, - &angel, &buffy, &imflags)); + &angel, &buffy, cnv, &imflags)); if (!buffy || !angel || plugin_return) { if (buffy) @@ -821,7 +821,7 @@ message = buffy; gaim_signal_emit(gaim_conversations_get_handle(), "received-im-msg", gc->account, - name, message, imflags); + name, message, cnv, imflags); /* Make sure URLs are clickable */ buffy = gaim_markup_linkify(message); @@ -1277,7 +1277,7 @@ plugin_return = GPOINTER_TO_INT( gaim_signal_emit_return_1(gaim_conversations_get_handle(), "receiving-chat-msg", g->account, - &angel, &buffy, conv)); + &angel, &buffy, conv, &chatflags)); if (!buffy || !angel || plugin_return) { if (buffy) @@ -1290,7 +1290,7 @@ message = buffy; gaim_signal_emit(gaim_conversations_get_handle(), "received-chat-msg", g->account, - who, message, conv); + who, message, conv, chatflags); /* Make sure URLs are clickable */ buf = gaim_markup_linkify(message); @@ -1299,6 +1299,8 @@ msgflags |= GAIM_MESSAGE_WHISPER; if (chatflags & GAIM_CONV_CHAT_DELAYED) msgflags |= GAIM_MESSAGE_DELAYED; + if (chatflags & GAIM_CONV_CHAT_ALERT) + msgflags |= GAIM_MESSAGE_NICK; gaim_conv_chat_write(chat, who, buf, msgflags, mtime);
--- a/src/signals.c Sat Oct 16 01:05:40 2004 +0000 +++ b/src/signals.c Sat Oct 16 15:07:22 2004 +0000 @@ -686,6 +686,21 @@ } void +gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT(GaimCallback cb, + va_list args, + void *data, + void **return_val) +{ + void *arg1 = va_arg(args, void *); + void *arg2 = va_arg(args, void *); + void *arg3 = va_arg(args, void *); + void *arg4 = va_arg(args, void *); + guint arg5 = va_arg(args, guint); + + ((void (*)(void *, void *, void *, void *, guint, void *))cb)(arg1, arg2, arg3, arg4, arg5, data); +} + +void gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT(GaimCallback cb, va_list args, void *data,
--- a/src/signals.h Sat Oct 16 01:05:40 2004 +0000 +++ b/src/signals.h Sat Oct 16 15:07:22 2004 +0000 @@ -237,6 +237,8 @@ GaimCallback cb, va_list args, void *data, void **return_val); void gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT( GaimCallback cb, va_list args, void *data, void **return_val); +void gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT( + GaimCallback cb, va_list args, void *data, void **return_val); void gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT( GaimCallback cb, va_list args, void *data, void **return_val);