Mercurial > pidgin.yaz
annotate plugins/gaiminc.c @ 9988:d770673338f4
[gaim-migrate @ 10901]
(15:20:15) grim elite: ok.. i just got to make a big #if 0 because the
custom away messages aren't setup yet :/
(15:30:01) grim elite: ok i've got it compiling.. couple of warnings yet..
(15:34:24) grim elite:
www.reaperworld.com/code/gaim/gaim-2.0.0cvs-oscar_compiles.diff
Mark should look this over, but it seems fairly straight forward
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 08 Sep 2004 19:36:04 +0000 |
parents | a9fb4493ae22 |
children | 60db14d54914 |
rev | line source |
---|---|
7746 | 1 #include "internal.h" |
2 #include "plugin.h" | |
3 | |
4 #include "account.h" | |
5 #include "connection.h" | |
6 #include "conversation.h" | |
9954 | 7 #include "version.h" |
7746 | 8 |
9753 | 9 /* include UI for gaim_gtkdialogs_about() */ |
7746 | 10 #include "gtkplugin.h" |
9709 | 11 #include "gtkdialogs.h" |
91 | 12 |
5255 | 13 #define GAIMINC_PLUGIN_ID "core-gaiminc" |
14 | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
15 static void |
7746 | 16 echo_hi(GaimConnection *gc) |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
17 { |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
18 /* this doesn't do much, just lets you know who we are :) */ |
9753 | 19 gaim_gtkdialogs_about(NULL, NULL); |
91 | 20 } |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
91
diff
changeset
|
21 |
7746 | 22 static gboolean |
23 reverse(GaimAccount *account, char **who, char **message, int *flags) | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
24 { |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
25 /* this will drive you insane. whenever you receive a message, |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
26 * the text of the message (HTML and all) will be reversed. */ |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
27 int i, l; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
28 char tmp; |
99
f810fc7d423f
[gaim-migrate @ 109]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
29 |
f810fc7d423f
[gaim-migrate @ 109]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
30 /* this check is necessary in case bad plugins do bad things */ |
f810fc7d423f
[gaim-migrate @ 109]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
31 if (message == NULL || *message == NULL) |
7746 | 32 return FALSE; |
99
f810fc7d423f
[gaim-migrate @ 109]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
33 |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
34 l = strlen(*message); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
35 |
7746 | 36 if (!strcmp(*who, gaim_account_get_username(account))) |
37 return FALSE; | |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
38 |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
39 for (i = 0; i < l/2; i++) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
40 tmp = (*message)[i]; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
41 (*message)[i] = (*message)[l - i - 1]; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
42 (*message)[l - i - 1] = tmp; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
43 } |
7746 | 44 return FALSE; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
91
diff
changeset
|
45 } |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
46 |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
47 static void |
7746 | 48 bud(GaimBuddy *who) |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
49 { |
7746 | 50 GaimAccount *acct = who->account; |
51 GaimConversation *conv = gaim_conversation_new(GAIM_CONV_IM, acct, who->name); | |
52 | |
53 gaim_conv_im_send(GAIM_CONV_IM(conv), "Hello!"); | |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
54 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
55 |
5255 | 56 /* |
57 * EXPORTED FUNCTIONS | |
58 */ | |
59 | |
60 static gboolean | |
61 plugin_load(GaimPlugin *plugin) | |
62 { | |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
63 /* this is for doing something fun when we sign on */ |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
64 gaim_signal_connect(gaim_connections_get_handle(), "signed-on", |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
65 plugin, GAIM_CALLBACK(echo_hi), NULL); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
66 |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
67 /* this is for doing something fun when we get a message */ |
8999 | 68 gaim_signal_connect(gaim_conversations_get_handle(), "receiving-im-msg", |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
69 plugin, GAIM_CALLBACK(reverse), NULL); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
70 |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
71 /* this is for doing something fun when a buddy comes online */ |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
72 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-on", |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
73 plugin, GAIM_CALLBACK(bud), NULL); |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
99
diff
changeset
|
74 |
5255 | 75 return TRUE; |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
76 } |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
77 |
5255 | 78 static GaimPluginInfo info = |
79 { | |
9954 | 80 GAIM_PLUGIN_MAGIC, |
81 GAIM_MAJOR_VERSION, | |
82 GAIM_MINOR_VERSION, | |
5255 | 83 GAIM_PLUGIN_STANDARD, /**< type */ |
84 NULL, /**< ui_requirement */ | |
85 0, /**< flags */ | |
86 NULL, /**< dependencies */ | |
87 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
88 | |
89 GAIMINC_PLUGIN_ID, /**< id */ | |
90 N_("Gaim Demonstration Plugin"), /**< name */ | |
91 VERSION, /**< version */ | |
92 /** summary */ | |
93 N_("An example plugin that does stuff - see the description."), | |
94 /** description */ | |
95 N_("This is a really cool plugin that does a lot of stuff:\n" | |
96 "- It tells you who wrote the program when you log in\n" | |
97 "- It reverses all incoming text\n" | |
98 "- It sends a message to people on your list immediately" | |
99 " when they sign on"), | |
100 "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */ | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
101 GAIM_WEBSITE, /**< homepage */ |
5255 | 102 |
103 plugin_load, /**< load */ | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
104 NULL, /**< unload */ |
5255 | 105 NULL, /**< destroy */ |
106 | |
107 NULL, /**< ui_info */ | |
108 NULL /**< extra_info */ | |
109 }; | |
110 | |
111 static void | |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5255
diff
changeset
|
112 init_plugin(GaimPlugin *plugin) |
5255 | 113 { |
3551 | 114 } |
115 | |
6063 | 116 GAIM_INIT_PLUGIN(gaiminc, init_plugin, info) |