| 1 /* events.c |
|
| 2 * |
|
| 3 * test every callback, print to stdout |
|
| 4 * |
|
| 5 * by EW |
|
| 6 * |
|
| 7 * GPL and all that jazz |
|
| 8 * |
|
| 9 */ |
|
| 10 |
|
| 11 #define EVENTTEST_PLUGIN_ID "core-eventtest" |
|
| 12 |
|
| 13 #include <stdio.h> |
|
| 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) |
|
| 21 { |
|
| 22 printf("event_signon\n"); |
|
| 23 } |
|
| 24 |
|
| 25 static void evt_signoff(GaimConnection *gc, void *data) |
|
| 26 { |
|
| 27 printf("event_signoff\n"); |
|
| 28 } |
|
| 29 |
|
| 30 static void evt_away(GaimConnection *gc, char *state, char *message, void *data) |
|
| 31 { |
|
| 32 printf("event_away: %s %s %s\n", gaim_account_get_username(gaim_connection_get_account(gc)), |
|
| 33 state, message); |
|
| 34 } |
|
| 35 |
|
| 36 static void evt_back(void *data) |
|
| 37 { |
|
| 38 printf("event_back\n"); |
|
| 39 } |
|
| 40 |
|
| 41 static void evt_im_recv(GaimConnection *gc, char **who, char **what, guint *flags, void *data) |
|
| 42 { |
|
| 43 printf("event_im_recv: %s %s\n", *who, *what); |
|
| 44 } |
|
| 45 |
|
| 46 static void evt_im_send(GaimConnection *gc, char *who, char **what, void *data) |
|
| 47 { |
|
| 48 printf("event_im_send: %s %s\n", who, *what); |
|
| 49 } |
|
| 50 |
|
| 51 static void evt_buddy_signon(GaimConnection *gc, char *who, void *data) |
|
| 52 { |
|
| 53 printf("event_buddy_signon: %s\n", who); |
|
| 54 } |
|
| 55 |
|
| 56 static void evt_buddy_signoff(GaimConnection *gc, char *who, void *data) |
|
| 57 { |
|
| 58 printf("event_buddy_signoff: %s\n", who); |
|
| 59 } |
|
| 60 |
|
| 61 static void evt_buddy_away(GaimConnection *gc, char *who, void *data) |
|
| 62 { |
|
| 63 printf("event_buddy_away: %s\n", who); |
|
| 64 } |
|
| 65 |
|
| 66 static void evt_buddy_back(GaimConnection *gc, char *who, void *data) |
|
| 67 { |
|
| 68 printf("event_buddy_back: %s\n", who); |
|
| 69 } |
|
| 70 |
|
| 71 static void evt_buddy_idle(GaimConnection *gc, char *who, void *data) |
|
| 72 { |
|
| 73 printf("event_buddy_idle: %s\n", who); |
|
| 74 } |
|
| 75 |
|
| 76 static void evt_buddy_unidle(GaimConnection *gc, char *who, void *data) |
|
| 77 { |
|
| 78 printf("event_buddy_unidle: %s\n", who); |
|
| 79 } |
|
| 80 |
|
| 81 static void evt_blist_update(void *data) |
|
| 82 { |
|
| 83 printf("event_blist_update\n"); |
|
| 84 } |
|
| 85 |
|
| 86 static void evt_chat_invited(GaimConnection *gc, char *who, char *room, char *message, void *data) |
|
| 87 { |
|
| 88 printf("event_chat_invited: %s %s %s\n", who, room, message); |
|
| 89 } |
|
| 90 |
|
| 91 static void evt_chat_join(GaimConnection *gc, int id, void *data) |
|
| 92 { |
|
| 93 printf("event_chat_join: %d\n", id); |
|
| 94 } |
|
| 95 |
|
| 96 static void evt_chat_leave(GaimConnection *gc, int id, void *data) |
|
| 97 { |
|
| 98 printf("event_chat_leave: %d\n", id); |
|
| 99 } |
|
| 100 |
|
| 101 static void evt_chat_buddy_join(GaimConnection *gc, int id, char *who, void *data) |
|
| 102 { |
|
| 103 printf("event_chat_buddy_join: %d %s\n", id, who); |
|
| 104 } |
|
| 105 |
|
| 106 static void evt_chat_buddy_leave(GaimConnection *gc, int id, char *who, void *data) |
|
| 107 { |
|
| 108 printf("event_chat_buddy_leave: %d %s\n", id, who); |
|
| 109 } |
|
| 110 |
|
| 111 static void evt_chat_recv(GaimConnection *gc, int id, char *who, char *text, void *data) |
|
| 112 { |
|
| 113 printf("event_chat_recv: %d %s %s\n", id, who, text); |
|
| 114 } |
|
| 115 |
|
| 116 static void evt_chat_send(GaimConnection *gc, int id, char **what, void *data) |
|
| 117 { |
|
| 118 printf("event_chat_send: %d %s\n", id, *what); |
|
| 119 } |
|
| 120 |
|
| 121 static void evt_warned(GaimConnection *gc, char *who, int level, void *data) |
|
| 122 { |
|
| 123 printf("event_warned: %s %d\n", who, level); |
|
| 124 } |
|
| 125 |
|
| 126 static void evt_error(int error, void *data) |
|
| 127 { |
|
| 128 printf("event_error: %d\n", error); |
|
| 129 } |
|
| 130 |
|
| 131 static void evt_quit(void *data) |
|
| 132 { |
|
| 133 printf("event_quit\n"); |
|
| 134 } |
|
| 135 |
|
| 136 static void evt_new_conversation(char *who, void *data) |
|
| 137 { |
|
| 138 printf("event_new_conversation: %s\n", who); |
|
| 139 } |
|
| 140 |
|
| 141 static void evt_set_info(GaimConnection *gc, char *info, void *data) |
|
| 142 { |
|
| 143 printf("event_set_info: %s\n", info); |
|
| 144 } |
|
| 145 |
|
| 146 static void evt_draw_menu(GtkWidget *menu, char *name, void *data) |
|
| 147 { |
|
| 148 printf("event_draw_menu: %s\n", name); |
|
| 149 } |
|
| 150 |
|
| 151 static void evt_im_displayed_sent(GaimConnection *gc, char *who, char **what, void *data) |
|
| 152 { |
|
| 153 printf("event_im_displayed_sent: %s %s\n", who, *what); |
|
| 154 } |
|
| 155 |
|
| 156 static void evt_im_displayed_rcvd(GaimConnection *gc, char *who, char *what, guint32 flags, time_t time, void *data) |
|
| 157 { |
|
| 158 printf("event_im_displayed_rcvd: %s %s %u %u\n", who, what, flags, time); |
|
| 159 } |
|
| 160 |
|
| 161 static void evt_chat_send_invite(GaimConnection *gc, int id, char *who, char **msg, void *data) |
|
| 162 { |
|
| 163 printf("event_chat_send_invite: %d %s %s\n", id, who, *msg); |
|
| 164 } |
|
| 165 |
|
| 166 static void evt_got_typing(GaimConnection *gc, char *who, void *data) |
|
| 167 { |
|
| 168 printf("event_got_typing: %s\n", who); |
|
| 169 } |
|
| 170 |
|
| 171 static void evt_del_conversation(GaimConversation *c, void *data) |
|
| 172 { |
|
| 173 printf("event_del_conversation\n"); |
|
| 174 } |
|
| 175 |
|
| 176 static void evt_connecting(GaimAccount *u, void *data) |
|
| 177 { |
|
| 178 printf("event_connecting\n"); |
|
| 179 } |
|
| 180 |
|
| 181 static void evt_change(GaimConversation *c) |
|
| 182 { |
|
| 183 printf("event_conversation_switch\n"); |
|
| 184 } |
|
| 185 |
|
| 186 /* |
|
| 187 * EXPORTED FUNCTIONS |
|
| 188 */ |
|
| 189 |
|
| 190 static gboolean |
|
| 191 plugin_load(GaimPlugin *plugin) |
|
| 192 { |
|
| 193 gaim_signal_connect(plugin, event_signon, evt_signon, NULL); |
|
| 194 gaim_signal_connect(plugin, event_signoff, evt_signoff, NULL); |
|
| 195 gaim_signal_connect(plugin, event_away, evt_away, NULL); |
|
| 196 gaim_signal_connect(plugin, event_back, evt_back, NULL); |
|
| 197 gaim_signal_connect(plugin, event_im_recv, evt_im_recv, NULL); |
|
| 198 gaim_signal_connect(plugin, event_im_send, evt_im_send, NULL); |
|
| 199 gaim_signal_connect(plugin, event_buddy_signon, evt_buddy_signon, NULL); |
|
| 200 gaim_signal_connect(plugin, event_buddy_signoff, evt_buddy_signoff, NULL); |
|
| 201 gaim_signal_connect(plugin, event_buddy_away, evt_buddy_away, NULL); |
|
| 202 gaim_signal_connect(plugin, event_buddy_back, evt_buddy_back, NULL); |
|
| 203 gaim_signal_connect(plugin, event_chat_invited, evt_chat_invited, NULL); |
|
| 204 gaim_signal_connect(plugin, event_chat_join, evt_chat_join, NULL); |
|
| 205 gaim_signal_connect(plugin, event_chat_leave, evt_chat_leave, NULL); |
|
| 206 gaim_signal_connect(plugin, event_chat_buddy_join, evt_chat_buddy_join, NULL); |
|
| 207 gaim_signal_connect(plugin, event_chat_buddy_leave, evt_chat_buddy_leave, NULL); |
|
| 208 gaim_signal_connect(plugin, event_chat_recv, evt_chat_recv, NULL); |
|
| 209 gaim_signal_connect(plugin, event_chat_send, evt_chat_send, NULL); |
|
| 210 gaim_signal_connect(plugin, event_warned, evt_warned, NULL); |
|
| 211 gaim_signal_connect(plugin, event_error, evt_error, NULL); |
|
| 212 gaim_signal_connect(plugin, event_quit, evt_quit, NULL); |
|
| 213 gaim_signal_connect(plugin, event_new_conversation, evt_new_conversation, NULL); |
|
| 214 gaim_signal_connect(plugin, event_set_info, evt_set_info, NULL); |
|
| 215 gaim_signal_connect(plugin, event_draw_menu, evt_draw_menu, NULL); |
|
| 216 gaim_signal_connect(plugin, event_im_displayed_sent, evt_im_displayed_sent, NULL); |
|
| 217 gaim_signal_connect(plugin, event_im_displayed_rcvd, evt_im_displayed_rcvd, NULL); |
|
| 218 gaim_signal_connect(plugin, event_chat_send_invite, evt_chat_send_invite, NULL); |
|
| 219 gaim_signal_connect(plugin, event_got_typing, evt_got_typing, NULL); |
|
| 220 gaim_signal_connect(plugin, event_del_conversation, evt_del_conversation, NULL); |
|
| 221 gaim_signal_connect(plugin, event_connecting, evt_connecting, NULL); |
|
| 222 gaim_signal_connect(plugin, event_conversation_switch, evt_change, NULL); |
|
| 223 return TRUE; |
|
| 224 } |
|
| 225 |
|
| 226 static GaimPluginInfo info = |
|
| 227 { |
|
| 228 2, /**< api_version */ |
|
| 229 GAIM_PLUGIN_STANDARD, /**< type */ |
|
| 230 NULL, /**< ui_requirement */ |
|
| 231 0, /**< flags */ |
|
| 232 NULL, /**< dependencies */ |
|
| 233 GAIM_PRIORITY_DEFAULT, /**< priority */ |
|
| 234 |
|
| 235 EVENTTEST_PLUGIN_ID, /**< id */ |
|
| 236 N_("Event Test"), /**< name */ |
|
| 237 VERSION, /**< version */ |
|
| 238 /** summary */ |
|
| 239 N_("Test to see that all events are working properly."), |
|
| 240 /** description */ |
|
| 241 N_("Test to see that all events are working properly."), |
|
| 242 "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */ |
|
| 243 GAIM_WEBSITE, /**< homepage */ |
|
| 244 |
|
| 245 plugin_load, /**< load */ |
|
| 246 NULL, /**< unload */ |
|
| 247 NULL, /**< destroy */ |
|
| 248 |
|
| 249 NULL, /**< ui_info */ |
|
| 250 NULL /**< extra_info */ |
|
| 251 }; |
|
| 252 |
|
| 253 static void |
|
| 254 init_plugin(GaimPlugin *plugin) |
|
| 255 { |
|
| 256 } |
|
| 257 |
|
| 258 GAIM_INIT_PLUGIN(eventtester, init_plugin, info) |
|