comparison plugins/gaiminc.c @ 1047:ece2d1543b20

[gaim-migrate @ 1057] Plugins now use GModule. Protocol plugins can be dynamically updated. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 01 Nov 2000 22:30:36 +0000
parents f810fc7d423f
children cd938f18f3f8
comparison
equal deleted inserted replaced
1046:4593605da0e2 1047:ece2d1543b20
10 void echo_hi(void *m) { 10 void echo_hi(void *m) {
11 /* this doesn't do much, just lets you know who we are :) */ 11 /* this doesn't do much, just lets you know who we are :) */
12 show_about(NULL, NULL); 12 show_about(NULL, NULL);
13 } 13 }
14 14
15 void reverse(char **who, char **message, void *m) { 15 void reverse(struct gaim_connection *gc, char **who, char **message, void *m) {
16 /* this will drive you insane. whenever you receive a message, 16 /* this will drive you insane. whenever you receive a message,
17 * the text of the message (HTML and all) will be reversed. */ 17 * the text of the message (HTML and all) will be reversed. */
18 int i, l; 18 int i, l;
19 char tmp; 19 char tmp;
20 20
22 if (message == NULL || *message == NULL) 22 if (message == NULL || *message == NULL)
23 return; 23 return;
24 24
25 l = strlen(*message); 25 l = strlen(*message);
26 26
27 if (!strcmp(*who, current_user->username)) 27 if (!strcmp(*who, gc->username))
28 return; 28 return;
29 29
30 for (i = 0; i < l/2; i++) { 30 for (i = 0; i < l/2; i++) {
31 tmp = (*message)[i]; 31 tmp = (*message)[i];
32 (*message)[i] = (*message)[l - i - 1]; 32 (*message)[i] = (*message)[l - i - 1];
33 (*message)[l - i - 1] = tmp; 33 (*message)[l - i - 1] = tmp;
34 } 34 }
35 } 35 }
36 36
37 void bud(char *who, void *m) { 37 void bud(struct gaim_connection *gc, char *who, void *m) {
38 /* whenever someone comes online, it sends them a message. if i 38 /* whenever someone comes online, it sends them a message. if i
39 * cared more, i'd make it so it popped up on your screen too */ 39 * cared more, i'd make it so it popped up on your screen too */
40 serv_send_im(who, "Hello!", 0); 40 serv_send_im(gc, who, "Hello!", 0);
41 } 41 }
42 42
43 void gaim_plugin_init(void *handle) { 43 char *gaim_plugin_init(GModule *handle) {
44 /* this is for doing something fun when we sign on */ 44 /* this is for doing something fun when we sign on */
45 gaim_signal_connect(handle, event_signon, echo_hi, NULL); 45 gaim_signal_connect(handle, event_signon, echo_hi, NULL);
46 46
47 /* this is for doing something fun when we get a message */ 47 /* this is for doing something fun when we get a message */
48 gaim_signal_connect(handle, event_im_recv, reverse, NULL); 48 gaim_signal_connect(handle, event_im_recv, reverse, NULL);
49 49
50 /* this is for doing something fun when a buddy comes online */ 50 /* this is for doing something fun when a buddy comes online */
51 gaim_signal_connect(handle, event_buddy_signon, bud, NULL); 51 gaim_signal_connect(handle, event_buddy_signon, bud, NULL);
52
53 return NULL;
52 } 54 }
53 55
54 char *name() { 56 char *name() {
55 return "Gaim Demonstration Plugin"; 57 return "Gaim Demonstration Plugin";
56 } 58 }