Mercurial > pidgin
changeset 6020:3b6f48766acb
[gaim-migrate @ 6470]
Yeah, this *should* work. But maybe it won't. I sure as hell ain't testin it.
That's what we pay you for you. This is a plugin event that gets triggered when
the user switches tabs in a window. Used in conjunction with GTK signals, you
should be able to get a good idea of when a conversation has taken focus.
Maybe now the notify plugin can be fixed.
While doing this, I noticed that a lot of the plugin documentation stuff is
woefully outdated. Someone who wants to get involved with a non-coding project
is welcome to send a patch.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sat, 05 Jul 2003 03:09:43 +0000 |
parents | 272c761c52e3 |
children | d2d5d1984b09 |
files | plugins/SIGNALS plugins/events.c src/conversation.c src/event.c src/event.h |
diffstat | 5 files changed, 59 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/SIGNALS Sat Jul 05 01:49:07 2003 +0000 +++ b/plugins/SIGNALS Sat Jul 05 03:09:43 2003 +0000 @@ -30,6 +30,7 @@ event_got_typing, event_del_conversation, event_connecting, + event_switch_conversation, }; To add a signal handler, call the fuction gaim_signal_connect with the @@ -357,3 +358,14 @@ counter decremented. 'u' is the account being connected. + +event_conversation_switch: + GaimConversation *c + + This is called when a new conversation has become the active conversation + in its GaimWindow. + + Using this in conjuction with GTK's focus-in-event will allow you to trigger + callbacks anytime a conversation receives focus. + + 'c' is the conversation that has just received focus.
--- a/plugins/events.c Sat Jul 05 01:49:07 2003 +0000 +++ b/plugins/events.c Sat Jul 05 03:09:43 2003 +0000 @@ -9,21 +9,28 @@ */ #define EVENTTEST_PLUGIN_ID "core-eventtest" -#include "gaim.h" + +#include <stdio.h> -static void evt_signon(struct gaim_connection *gc, void *data) +#include "gtkplugin.h" +#include "connection.h" +#include "conversation.h" +#include "internal.h" + +static void evt_signon(GaimConnection *gc, void *data) { printf("event_signon\n"); } -static void evt_signoff(struct gaim_connection *gc, void *data) +static void evt_signoff(GaimConnection *gc, void *data) { printf("event_signoff\n"); } -static void evt_away(struct gaim_connection *gc, char *state, char *message, void *data) +static void evt_away(GaimConnection *gc, char *state, char *message, void *data) { - printf("event_away: %s %s %s\n", gc->username, state, message); + printf("event_away: %s %s %s\n", gaim_account_get_username(gaim_connection_get_account(gc)), + state, message); } static void evt_back(void *data) @@ -31,42 +38,42 @@ printf("event_back\n"); } -static void evt_im_recv(struct gaim_connection *gc, char **who, char **what, guint *flags, void *data) +static void evt_im_recv(GaimConnection *gc, char **who, char **what, guint *flags, void *data) { printf("event_im_recv: %s %s\n", *who, *what); } -static void evt_im_send(struct gaim_connection *gc, char *who, char **what, void *data) +static void evt_im_send(GaimConnection *gc, char *who, char **what, void *data) { printf("event_im_send: %s %s\n", who, *what); } -static void evt_buddy_signon(struct gaim_connection *gc, char *who, void *data) +static void evt_buddy_signon(GaimConnection *gc, char *who, void *data) { printf("event_buddy_signon: %s\n", who); } -static void evt_buddy_signoff(struct gaim_connection *gc, char *who, void *data) +static void evt_buddy_signoff(GaimConnection *gc, char *who, void *data) { printf("event_buddy_signoff: %s\n", who); } -static void evt_buddy_away(struct gaim_connection *gc, char *who, void *data) +static void evt_buddy_away(GaimConnection *gc, char *who, void *data) { printf("event_buddy_away: %s\n", who); } -static void evt_buddy_back(struct gaim_connection *gc, char *who, void *data) +static void evt_buddy_back(GaimConnection *gc, char *who, void *data) { printf("event_buddy_back: %s\n", who); } -static void evt_buddy_idle(struct gaim_connection *gc, char *who, void *data) +static void evt_buddy_idle(GaimConnection *gc, char *who, void *data) { printf("event_buddy_idle: %s\n", who); } -static void evt_buddy_unidle(struct gaim_connection *gc, char *who, void *data) +static void evt_buddy_unidle(GaimConnection *gc, char *who, void *data) { printf("event_buddy_unidle: %s\n", who); } @@ -76,42 +83,42 @@ printf("event_blist_update\n"); } -static void evt_chat_invited(struct gaim_connection *gc, char *who, char *room, char *message, void *data) +static void evt_chat_invited(GaimConnection *gc, char *who, char *room, char *message, void *data) { printf("event_chat_invited: %s %s %s\n", who, room, message); } -static void evt_chat_join(struct gaim_connection *gc, int id, void *data) +static void evt_chat_join(GaimConnection *gc, int id, void *data) { printf("event_chat_join: %d\n", id); } -static void evt_chat_leave(struct gaim_connection *gc, int id, void *data) +static void evt_chat_leave(GaimConnection *gc, int id, void *data) { printf("event_chat_leave: %d\n", id); } -static void evt_chat_buddy_join(struct gaim_connection *gc, int id, char *who, void *data) +static void evt_chat_buddy_join(GaimConnection *gc, int id, char *who, void *data) { printf("event_chat_buddy_join: %d %s\n", id, who); } -static void evt_chat_buddy_leave(struct gaim_connection *gc, int id, char *who, void *data) +static void evt_chat_buddy_leave(GaimConnection *gc, int id, char *who, void *data) { printf("event_chat_buddy_leave: %d %s\n", id, who); } -static void evt_chat_recv(struct gaim_connection *gc, int id, char *who, char *text, void *data) +static void evt_chat_recv(GaimConnection *gc, int id, char *who, char *text, void *data) { printf("event_chat_recv: %d %s %s\n", id, who, text); } -static void evt_chat_send(struct gaim_connection *gc, int id, char **what, void *data) +static void evt_chat_send(GaimConnection *gc, int id, char **what, void *data) { printf("event_chat_send: %d %s\n", id, *what); } -static void evt_warned(struct gaim_connection *gc, char *who, int level, void *data) +static void evt_warned(GaimConnection *gc, char *who, int level, void *data) { printf("event_warned: %s %d\n", who, level); } @@ -131,7 +138,7 @@ printf("event_new_conversation: %s\n", who); } -static void evt_set_info(struct gaim_connection *gc, char *info, void *data) +static void evt_set_info(GaimConnection *gc, char *info, void *data) { printf("event_set_info: %s\n", info); } @@ -141,36 +148,40 @@ printf("event_draw_menu: %s\n", name); } -static void evt_im_displayed_sent(struct gaim_connection *gc, char *who, char **what, void *data) +static void evt_im_displayed_sent(GaimConnection *gc, char *who, char **what, void *data) { printf("event_im_displayed_sent: %s %s\n", who, *what); } -static void evt_im_displayed_rcvd(struct gaim_connection *gc, char *who, char *what, guint32 flags, time_t time, void *data) +static void evt_im_displayed_rcvd(GaimConnection *gc, char *who, char *what, guint32 flags, time_t time, void *data) { printf("event_im_displayed_rcvd: %s %s %u %u\n", who, what, flags, time); } -static void evt_chat_send_invite(struct gaim_connection *gc, int id, char *who, char **msg, void *data) +static void evt_chat_send_invite(GaimConnection *gc, int id, char *who, char **msg, void *data) { printf("event_chat_send_invite: %d %s %s\n", id, who, *msg); } -static evt_got_typing(struct gaim_connection *gc, char *who, void *data) +static void evt_got_typing(GaimConnection *gc, char *who, void *data) { printf("event_got_typing: %s\n", who); } -static evt_del_conversation(GaimConversation *c, void *data) +static void evt_del_conversation(GaimConversation *c, void *data) { printf("event_del_conversation\n"); } -static evt_connecting(struct gaim_account *u, void *data) +static void evt_connecting(GaimAccount *u, void *data) { printf("event_connecting\n"); } +static void evt_change(GaimConversation *c) +{ + printf("event_conversation_switch\n"); +} /* * EXPORTED FUNCTIONS @@ -208,7 +219,7 @@ gaim_signal_connect(plugin, event_got_typing, evt_got_typing, NULL); gaim_signal_connect(plugin, event_del_conversation, evt_del_conversation, NULL); gaim_signal_connect(plugin, event_connecting, evt_connecting, NULL); - + gaim_signal_connect(plugin, event_conversation_switch, evt_change, NULL); return TRUE; }
--- a/src/conversation.c Sat Jul 05 01:49:07 2003 +0000 +++ b/src/conversation.c Sat Jul 05 03:09:43 2003 +0000 @@ -744,6 +744,7 @@ gaim_window_switch_conversation(GaimWindow *win, unsigned int index) { GaimWindowUiOps *ops; + GaimConversation *conv; g_return_if_fail(win != NULL); g_return_if_fail(index >= 0 && @@ -754,8 +755,10 @@ if (ops != NULL && ops->switch_conversation != NULL) ops->switch_conversation(win, index); - gaim_conversation_set_unseen( - gaim_window_get_conversation_at(win, index), 0); + conv = gaim_window_get_conversation_at(win, index); + gaim_conversation_set_unseen(conv, 0); + gaim_event_broadcast(event_conversation_switch, conv); + } GaimConversation *