Mercurial > pidgin
comparison plugins/events.c @ 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 | 7d385de2f9cd |
children | 5239a3b4ab33 |
comparison
equal
deleted
inserted
replaced
6019:272c761c52e3 | 6020:3b6f48766acb |
---|---|
7 * GPL and all that jazz | 7 * GPL and all that jazz |
8 * | 8 * |
9 */ | 9 */ |
10 | 10 |
11 #define EVENTTEST_PLUGIN_ID "core-eventtest" | 11 #define EVENTTEST_PLUGIN_ID "core-eventtest" |
12 #include "gaim.h" | 12 |
13 | 13 #include <stdio.h> |
14 static void evt_signon(struct gaim_connection *gc, void *data) | 14 |
15 #include "gtkplugin.h" | |
16 #include "connection.h" | |
17 #include "conversation.h" | |
18 #include "internal.h" | |
19 | |
20 static void evt_signon(GaimConnection *gc, void *data) | |
15 { | 21 { |
16 printf("event_signon\n"); | 22 printf("event_signon\n"); |
17 } | 23 } |
18 | 24 |
19 static void evt_signoff(struct gaim_connection *gc, void *data) | 25 static void evt_signoff(GaimConnection *gc, void *data) |
20 { | 26 { |
21 printf("event_signoff\n"); | 27 printf("event_signoff\n"); |
22 } | 28 } |
23 | 29 |
24 static void evt_away(struct gaim_connection *gc, char *state, char *message, void *data) | 30 static void evt_away(GaimConnection *gc, char *state, char *message, void *data) |
25 { | 31 { |
26 printf("event_away: %s %s %s\n", gc->username, state, message); | 32 printf("event_away: %s %s %s\n", gaim_account_get_username(gaim_connection_get_account(gc)), |
33 state, message); | |
27 } | 34 } |
28 | 35 |
29 static void evt_back(void *data) | 36 static void evt_back(void *data) |
30 { | 37 { |
31 printf("event_back\n"); | 38 printf("event_back\n"); |
32 } | 39 } |
33 | 40 |
34 static void evt_im_recv(struct gaim_connection *gc, char **who, char **what, guint *flags, void *data) | 41 static void evt_im_recv(GaimConnection *gc, char **who, char **what, guint *flags, void *data) |
35 { | 42 { |
36 printf("event_im_recv: %s %s\n", *who, *what); | 43 printf("event_im_recv: %s %s\n", *who, *what); |
37 } | 44 } |
38 | 45 |
39 static void evt_im_send(struct gaim_connection *gc, char *who, char **what, void *data) | 46 static void evt_im_send(GaimConnection *gc, char *who, char **what, void *data) |
40 { | 47 { |
41 printf("event_im_send: %s %s\n", who, *what); | 48 printf("event_im_send: %s %s\n", who, *what); |
42 } | 49 } |
43 | 50 |
44 static void evt_buddy_signon(struct gaim_connection *gc, char *who, void *data) | 51 static void evt_buddy_signon(GaimConnection *gc, char *who, void *data) |
45 { | 52 { |
46 printf("event_buddy_signon: %s\n", who); | 53 printf("event_buddy_signon: %s\n", who); |
47 } | 54 } |
48 | 55 |
49 static void evt_buddy_signoff(struct gaim_connection *gc, char *who, void *data) | 56 static void evt_buddy_signoff(GaimConnection *gc, char *who, void *data) |
50 { | 57 { |
51 printf("event_buddy_signoff: %s\n", who); | 58 printf("event_buddy_signoff: %s\n", who); |
52 } | 59 } |
53 | 60 |
54 static void evt_buddy_away(struct gaim_connection *gc, char *who, void *data) | 61 static void evt_buddy_away(GaimConnection *gc, char *who, void *data) |
55 { | 62 { |
56 printf("event_buddy_away: %s\n", who); | 63 printf("event_buddy_away: %s\n", who); |
57 } | 64 } |
58 | 65 |
59 static void evt_buddy_back(struct gaim_connection *gc, char *who, void *data) | 66 static void evt_buddy_back(GaimConnection *gc, char *who, void *data) |
60 { | 67 { |
61 printf("event_buddy_back: %s\n", who); | 68 printf("event_buddy_back: %s\n", who); |
62 } | 69 } |
63 | 70 |
64 static void evt_buddy_idle(struct gaim_connection *gc, char *who, void *data) | 71 static void evt_buddy_idle(GaimConnection *gc, char *who, void *data) |
65 { | 72 { |
66 printf("event_buddy_idle: %s\n", who); | 73 printf("event_buddy_idle: %s\n", who); |
67 } | 74 } |
68 | 75 |
69 static void evt_buddy_unidle(struct gaim_connection *gc, char *who, void *data) | 76 static void evt_buddy_unidle(GaimConnection *gc, char *who, void *data) |
70 { | 77 { |
71 printf("event_buddy_unidle: %s\n", who); | 78 printf("event_buddy_unidle: %s\n", who); |
72 } | 79 } |
73 | 80 |
74 static void evt_blist_update(void *data) | 81 static void evt_blist_update(void *data) |
75 { | 82 { |
76 printf("event_blist_update\n"); | 83 printf("event_blist_update\n"); |
77 } | 84 } |
78 | 85 |
79 static void evt_chat_invited(struct gaim_connection *gc, char *who, char *room, char *message, void *data) | 86 static void evt_chat_invited(GaimConnection *gc, char *who, char *room, char *message, void *data) |
80 { | 87 { |
81 printf("event_chat_invited: %s %s %s\n", who, room, message); | 88 printf("event_chat_invited: %s %s %s\n", who, room, message); |
82 } | 89 } |
83 | 90 |
84 static void evt_chat_join(struct gaim_connection *gc, int id, void *data) | 91 static void evt_chat_join(GaimConnection *gc, int id, void *data) |
85 { | 92 { |
86 printf("event_chat_join: %d\n", id); | 93 printf("event_chat_join: %d\n", id); |
87 } | 94 } |
88 | 95 |
89 static void evt_chat_leave(struct gaim_connection *gc, int id, void *data) | 96 static void evt_chat_leave(GaimConnection *gc, int id, void *data) |
90 { | 97 { |
91 printf("event_chat_leave: %d\n", id); | 98 printf("event_chat_leave: %d\n", id); |
92 } | 99 } |
93 | 100 |
94 static void evt_chat_buddy_join(struct gaim_connection *gc, int id, char *who, void *data) | 101 static void evt_chat_buddy_join(GaimConnection *gc, int id, char *who, void *data) |
95 { | 102 { |
96 printf("event_chat_buddy_join: %d %s\n", id, who); | 103 printf("event_chat_buddy_join: %d %s\n", id, who); |
97 } | 104 } |
98 | 105 |
99 static void evt_chat_buddy_leave(struct gaim_connection *gc, int id, char *who, void *data) | 106 static void evt_chat_buddy_leave(GaimConnection *gc, int id, char *who, void *data) |
100 { | 107 { |
101 printf("event_chat_buddy_leave: %d %s\n", id, who); | 108 printf("event_chat_buddy_leave: %d %s\n", id, who); |
102 } | 109 } |
103 | 110 |
104 static void evt_chat_recv(struct gaim_connection *gc, int id, char *who, char *text, void *data) | 111 static void evt_chat_recv(GaimConnection *gc, int id, char *who, char *text, void *data) |
105 { | 112 { |
106 printf("event_chat_recv: %d %s %s\n", id, who, text); | 113 printf("event_chat_recv: %d %s %s\n", id, who, text); |
107 } | 114 } |
108 | 115 |
109 static void evt_chat_send(struct gaim_connection *gc, int id, char **what, void *data) | 116 static void evt_chat_send(GaimConnection *gc, int id, char **what, void *data) |
110 { | 117 { |
111 printf("event_chat_send: %d %s\n", id, *what); | 118 printf("event_chat_send: %d %s\n", id, *what); |
112 } | 119 } |
113 | 120 |
114 static void evt_warned(struct gaim_connection *gc, char *who, int level, void *data) | 121 static void evt_warned(GaimConnection *gc, char *who, int level, void *data) |
115 { | 122 { |
116 printf("event_warned: %s %d\n", who, level); | 123 printf("event_warned: %s %d\n", who, level); |
117 } | 124 } |
118 | 125 |
119 static void evt_error(int error, void *data) | 126 static void evt_error(int error, void *data) |
129 static void evt_new_conversation(char *who, void *data) | 136 static void evt_new_conversation(char *who, void *data) |
130 { | 137 { |
131 printf("event_new_conversation: %s\n", who); | 138 printf("event_new_conversation: %s\n", who); |
132 } | 139 } |
133 | 140 |
134 static void evt_set_info(struct gaim_connection *gc, char *info, void *data) | 141 static void evt_set_info(GaimConnection *gc, char *info, void *data) |
135 { | 142 { |
136 printf("event_set_info: %s\n", info); | 143 printf("event_set_info: %s\n", info); |
137 } | 144 } |
138 | 145 |
139 static void evt_draw_menu(GtkWidget *menu, char *name, void *data) | 146 static void evt_draw_menu(GtkWidget *menu, char *name, void *data) |
140 { | 147 { |
141 printf("event_draw_menu: %s\n", name); | 148 printf("event_draw_menu: %s\n", name); |
142 } | 149 } |
143 | 150 |
144 static void evt_im_displayed_sent(struct gaim_connection *gc, char *who, char **what, void *data) | 151 static void evt_im_displayed_sent(GaimConnection *gc, char *who, char **what, void *data) |
145 { | 152 { |
146 printf("event_im_displayed_sent: %s %s\n", who, *what); | 153 printf("event_im_displayed_sent: %s %s\n", who, *what); |
147 } | 154 } |
148 | 155 |
149 static void evt_im_displayed_rcvd(struct gaim_connection *gc, char *who, char *what, guint32 flags, time_t time, void *data) | 156 static void evt_im_displayed_rcvd(GaimConnection *gc, char *who, char *what, guint32 flags, time_t time, void *data) |
150 { | 157 { |
151 printf("event_im_displayed_rcvd: %s %s %u %u\n", who, what, flags, time); | 158 printf("event_im_displayed_rcvd: %s %s %u %u\n", who, what, flags, time); |
152 } | 159 } |
153 | 160 |
154 static void evt_chat_send_invite(struct gaim_connection *gc, int id, char *who, char **msg, void *data) | 161 static void evt_chat_send_invite(GaimConnection *gc, int id, char *who, char **msg, void *data) |
155 { | 162 { |
156 printf("event_chat_send_invite: %d %s %s\n", id, who, *msg); | 163 printf("event_chat_send_invite: %d %s %s\n", id, who, *msg); |
157 } | 164 } |
158 | 165 |
159 static evt_got_typing(struct gaim_connection *gc, char *who, void *data) | 166 static void evt_got_typing(GaimConnection *gc, char *who, void *data) |
160 { | 167 { |
161 printf("event_got_typing: %s\n", who); | 168 printf("event_got_typing: %s\n", who); |
162 } | 169 } |
163 | 170 |
164 static evt_del_conversation(GaimConversation *c, void *data) | 171 static void evt_del_conversation(GaimConversation *c, void *data) |
165 { | 172 { |
166 printf("event_del_conversation\n"); | 173 printf("event_del_conversation\n"); |
167 } | 174 } |
168 | 175 |
169 static evt_connecting(struct gaim_account *u, void *data) | 176 static void evt_connecting(GaimAccount *u, void *data) |
170 { | 177 { |
171 printf("event_connecting\n"); | 178 printf("event_connecting\n"); |
172 } | 179 } |
173 | 180 |
181 static void evt_change(GaimConversation *c) | |
182 { | |
183 printf("event_conversation_switch\n"); | |
184 } | |
174 | 185 |
175 /* | 186 /* |
176 * EXPORTED FUNCTIONS | 187 * EXPORTED FUNCTIONS |
177 */ | 188 */ |
178 | 189 |
206 gaim_signal_connect(plugin, event_im_displayed_rcvd, evt_im_displayed_rcvd, NULL); | 217 gaim_signal_connect(plugin, event_im_displayed_rcvd, evt_im_displayed_rcvd, NULL); |
207 gaim_signal_connect(plugin, event_chat_send_invite, evt_chat_send_invite, NULL); | 218 gaim_signal_connect(plugin, event_chat_send_invite, evt_chat_send_invite, NULL); |
208 gaim_signal_connect(plugin, event_got_typing, evt_got_typing, NULL); | 219 gaim_signal_connect(plugin, event_got_typing, evt_got_typing, NULL); |
209 gaim_signal_connect(plugin, event_del_conversation, evt_del_conversation, NULL); | 220 gaim_signal_connect(plugin, event_del_conversation, evt_del_conversation, NULL); |
210 gaim_signal_connect(plugin, event_connecting, evt_connecting, NULL); | 221 gaim_signal_connect(plugin, event_connecting, evt_connecting, NULL); |
211 | 222 gaim_signal_connect(plugin, event_conversation_switch, evt_change, NULL); |
212 return TRUE; | 223 return TRUE; |
213 } | 224 } |
214 | 225 |
215 static GaimPluginInfo info = | 226 static GaimPluginInfo info = |
216 { | 227 { |