Mercurial > pidgin.yaz
annotate plugins/gaiminc.c @ 5295:399390d74514
[gaim-migrate @ 5667]
(17:45:56) deryni: http://deryni.perlmonk.org/idle_timer.diff <- turns off the 30 second update timer when 'show idle times' is off (it shouldn't affect anything else)
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sun, 04 May 2003 21:47:33 +0000 |
parents | c0baa01cdeda |
children | 7d385de2f9cd |
rev | line source |
---|---|
5255 | 1 //#include <gtk/gtk.h> |
91 | 2 #include <time.h> |
3 #include <stdio.h> | |
4 #include <fcntl.h> | |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
5 #include <string.h> |
91 | 6 #include "gaim.h" |
7 | |
5255 | 8 #define GAIMINC_PLUGIN_ID "core-gaiminc" |
9 | |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
10 void echo_hi(void *m) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
11 /* this doesn't do much, just lets you know who we are :) */ |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
12 show_about(NULL, NULL); |
91 | 13 } |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
91
diff
changeset
|
14 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
99
diff
changeset
|
15 void reverse(struct gaim_connection *gc, char **who, char **message, void *m) { |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
16 /* this will drive you insane. whenever you receive a message, |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
17 * the text of the message (HTML and all) will be reversed. */ |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
18 int i, l; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
19 char tmp; |
99
f810fc7d423f
[gaim-migrate @ 109]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
20 |
f810fc7d423f
[gaim-migrate @ 109]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
21 /* this check is necessary in case bad plugins do bad things */ |
f810fc7d423f
[gaim-migrate @ 109]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
22 if (message == NULL || *message == NULL) |
f810fc7d423f
[gaim-migrate @ 109]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
23 return; |
f810fc7d423f
[gaim-migrate @ 109]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
24 |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
25 l = strlen(*message); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
26 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
99
diff
changeset
|
27 if (!strcmp(*who, gc->username)) |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
28 return; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
29 |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
30 for (i = 0; i < l/2; i++) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
31 tmp = (*message)[i]; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
32 (*message)[i] = (*message)[l - i - 1]; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
33 (*message)[l - i - 1] = tmp; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
34 } |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
91
diff
changeset
|
35 } |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
36 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
99
diff
changeset
|
37 void bud(struct gaim_connection *gc, char *who, void *m) { |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
38 /* whenever someone comes online, it sends them a message. if i |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
39 * cared more, i'd make it so it popped up on your screen too */ |
5255 | 40 serv_send_im(gc, who, "Hello!", -1, 0); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
41 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
42 |
5255 | 43 /* |
44 * EXPORTED FUNCTIONS | |
45 */ | |
46 | |
47 static gboolean | |
48 plugin_load(GaimPlugin *plugin) | |
49 { | |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
50 /* this is for doing something fun when we sign on */ |
5255 | 51 gaim_signal_connect(plugin, event_signon, echo_hi, NULL); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
52 |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
53 /* this is for doing something fun when we get a message */ |
5255 | 54 gaim_signal_connect(plugin, event_im_recv, reverse, NULL); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
55 |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
56 /* this is for doing something fun when a buddy comes online */ |
5255 | 57 gaim_signal_connect(plugin, event_buddy_signon, bud, NULL); |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
99
diff
changeset
|
58 |
5255 | 59 return TRUE; |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
60 } |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
61 |
5255 | 62 static GaimPluginInfo info = |
63 { | |
64 2, /**< api_version */ | |
65 GAIM_PLUGIN_STANDARD, /**< type */ | |
66 NULL, /**< ui_requirement */ | |
67 0, /**< flags */ | |
68 NULL, /**< dependencies */ | |
69 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
70 | |
71 GAIMINC_PLUGIN_ID, /**< id */ | |
72 N_("Gaim Demonstration Plugin"), /**< name */ | |
73 VERSION, /**< version */ | |
74 /** summary */ | |
75 N_("An example plugin that does stuff - see the description."), | |
76 /** description */ | |
77 N_("This is a really cool plugin that does a lot of stuff:\n" | |
78 "- It tells you who wrote the program when you log in\n" | |
79 "- It reverses all incoming text\n" | |
80 "- It sends a message to people on your list immediately" | |
81 " when they sign on"), | |
82 "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */ | |
83 WEBSITE, /**< homepage */ | |
84 | |
85 plugin_load, /**< load */ | |
86 NULL, /**< unload */ | |
87 NULL, /**< destroy */ | |
88 | |
89 NULL, /**< ui_info */ | |
90 NULL /**< extra_info */ | |
91 }; | |
92 | |
93 static void | |
94 __init_plugin(GaimPlugin *plugin) | |
95 { | |
3551 | 96 } |
97 | |
5255 | 98 GAIM_INIT_PLUGIN(gaiminc, __init_plugin, info); |