Mercurial > pidgin
diff plugins/gaiminc.c @ 94:9f6ce50ffb78
[gaim-migrate @ 104]
Woohoo, the landing of the plugins. Nearly everything necessary is here. The
only thing missing is that you can't load a plugin without signing on first
(at least, not without some trickery).
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sun, 09 Apr 2000 11:18:25 +0000 |
parents | f3c6cf79f651 |
children | 247f540ea6e1 |
line wrap: on
line diff
--- a/plugins/gaiminc.c Sun Apr 09 08:25:15 2000 +0000 +++ b/plugins/gaiminc.c Sun Apr 09 11:18:25 2000 +0000 @@ -1,12 +1,47 @@ +#define GAIM_PLUGINS + #include <gtk/gtk.h> #include <time.h> #include <stdio.h> #include <fcntl.h> +#include <string.h> #include "gaim.h" -void gaim_plugin_init() { +void echo_hi(void *m) { + /* this doesn't do much, just lets you know who we are :) */ + show_about(NULL, NULL); } -void write_to_conv(struct conversation *c, char *what, int flags) { - printf("this got called\n"); +void reverse(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; + char tmp; + l = strlen(*message); + + if (!strcmp(*who, current_user->username)) + return; + + for (i = 0; i < l/2; i++) { + tmp = (*message)[i]; + (*message)[i] = (*message)[l - i - 1]; + (*message)[l - i - 1] = tmp; + } } + +void bud(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(who, "Hello!", 0); +} + +void gaim_plugin_init(void *handle) { + /* this is for doing something fun when we sign on */ + gaim_signal_connect(handle, event_signon, echo_hi, NULL); + + /* this is for doing something fun when we get a message */ + gaim_signal_connect(handle, event_im_recv, reverse, NULL); + + /* this is for doing something fun when a buddy comes online */ + gaim_signal_connect(handle, event_buddy_signon, bud, NULL); +}