Mercurial > pidgin.yaz
diff plugins/gaiminc.c @ 6485:70d5122bc3ff
[gaim-migrate @ 6999]
Removed the old event system and replaced it with a much better signal
system. There will most likely be some bugs in this, but it seems to be
working for now. Plugins can now generate their own signals, and other
plugins can find those plugins and connect to them. This could give
plugins a form of IPC. It's also useful for other things. It's rather
flexible, except for the damn marshalling, but there's no way around that
that I or the glib people can see.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Mon, 18 Aug 2003 01:03:43 +0000 |
parents | 8f94cce8faa5 |
children | 083d1e4a9c78 |
line wrap: on
line diff
--- a/plugins/gaiminc.c Sun Aug 17 17:55:46 2003 +0000 +++ b/plugins/gaiminc.c Mon Aug 18 01:03:43 2003 +0000 @@ -7,12 +7,16 @@ #define GAIMINC_PLUGIN_ID "core-gaiminc" -void echo_hi(void *m) { +static void +echo_hi(void *m) +{ /* this doesn't do much, just lets you know who we are :) */ show_about(NULL, NULL); } -void reverse(struct gaim_connection *gc, char **who, char **message, void *m) { +static void +reverse(struct gaim_connection *gc, char **who, char **message, void *m) +{ /* this will drive you insane. whenever you receive a message, * the text of the message (HTML and all) will be reversed. */ int i, l; @@ -34,7 +38,9 @@ } } -void bud(struct gaim_connection *gc, char *who, void *m) { +static void +bud(struct gaim_connection *gc, char *who, void *m) +{ /* whenever someone comes online, it sends them a message. if i * cared more, i'd make it so it popped up on your screen too */ serv_send_im(gc, who, "Hello!", -1, 0); @@ -48,13 +54,16 @@ plugin_load(GaimPlugin *plugin) { /* this is for doing something fun when we sign on */ - gaim_signal_connect(plugin, event_signon, echo_hi, NULL); + gaim_signal_connect(gaim_connections_get_handle(), "signed-on", + plugin, GAIM_CALLBACK(echo_hi), NULL); /* this is for doing something fun when we get a message */ - gaim_signal_connect(plugin, event_im_recv, reverse, NULL); + gaim_signal_connect(gaim_conversations_get_handle(), "received-im", + plugin, GAIM_CALLBACK(reverse), NULL); /* this is for doing something fun when a buddy comes online */ - gaim_signal_connect(plugin, event_buddy_signon, bud, NULL); + gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-on", + plugin, GAIM_CALLBACK(bud), NULL); return TRUE; } @@ -80,10 +89,10 @@ "- It sends a message to people on your list immediately" " when they sign on"), "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */ - GAIM_WEBSITE, /**< homepage */ + GAIM_WEBSITE, /**< homepage */ plugin_load, /**< load */ - NULL, /**< unload */ + NULL, /**< unload */ NULL, /**< destroy */ NULL, /**< ui_info */