plugins/gaiminc.c

changeset 94
0c6ba3d3fa90
parent 92
b2cc29da946e
child 96
2b8586ab9456
equal deleted inserted replaced
93:a62ef5a64629 94:0c6ba3d3fa90
1 #define GAIM_PLUGINS
2
1 #include <gtk/gtk.h> 3 #include <gtk/gtk.h>
2 #include <time.h> 4 #include <time.h>
3 #include <stdio.h> 5 #include <stdio.h>
4 #include <fcntl.h> 6 #include <fcntl.h>
7 #include <string.h>
5 #include "gaim.h" 8 #include "gaim.h"
6 9
7 void gaim_plugin_init() { 10 void echo_hi(void *m) {
11 /* this doesn't do much, just lets you know who we are :) */
12 show_about(NULL, NULL);
8 } 13 }
9 14
10 void write_to_conv(struct conversation *c, char *what, int flags) { 15 void reverse(char **who, char **message, void *m) {
11 printf("this got called\n"); 16 /* this will drive you insane. whenever you receive a message,
17 * the text of the message (HTML and all) will be reversed. */
18 int i, l;
19 char tmp;
20 l = strlen(*message);
21
22 if (!strcmp(*who, current_user->username))
23 return;
24
25 for (i = 0; i < l/2; i++) {
26 tmp = (*message)[i];
27 (*message)[i] = (*message)[l - i - 1];
28 (*message)[l - i - 1] = tmp;
29 }
12 } 30 }
31
32 void bud(char *who, void *m) {
33 /* whenever someone comes online, it sends them a message. if i
34 * cared more, i'd make it so it popped up on your screen too */
35 serv_send_im(who, "Hello!", 0);
36 }
37
38 void gaim_plugin_init(void *handle) {
39 /* this is for doing something fun when we sign on */
40 gaim_signal_connect(handle, event_signon, echo_hi, NULL);
41
42 /* this is for doing something fun when we get a message */
43 gaim_signal_connect(handle, event_im_recv, reverse, NULL);
44
45 /* this is for doing something fun when a buddy comes online */
46 gaim_signal_connect(handle, event_buddy_signon, bud, NULL);
47 }

mercurial