annotate plugins/gaiminc.c @ 6400:588e88bcdac5

[gaim-migrate @ 6905] Oscar should no longer try to add you to the block list while adding you to the block list. That made no sense, but trust me, it's caused me a lot of headaches. I WANT OFF MY BLOCK LIST! committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 06 Aug 2003 23:45:10 +0000
parents 8f94cce8faa5
children 70d5122bc3ff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5255
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
1 //#include <gtk/gtk.h>
91
308d0896d979 [gaim-migrate @ 101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 #include <time.h>
308d0896d979 [gaim-migrate @ 101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 #include <stdio.h>
308d0896d979 [gaim-migrate @ 101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 #include <fcntl.h>
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
5 #include <string.h>
91
308d0896d979 [gaim-migrate @ 101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 #include "gaim.h"
308d0896d979 [gaim-migrate @ 101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7
5255
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
8 #define GAIMINC_PLUGIN_ID "core-gaiminc"
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
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
308d0896d979 [gaim-migrate @ 101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
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
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
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
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
43 /*
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
44 * EXPORTED FUNCTIONS
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
45 */
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
46
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
47 static gboolean
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
48 plugin_load(GaimPlugin *plugin)
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
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
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
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
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
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
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
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
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
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
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
62 static GaimPluginInfo info =
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
63 {
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
64 2, /**< api_version */
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
65 GAIM_PLUGIN_STANDARD, /**< type */
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
66 NULL, /**< ui_requirement */
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
67 0, /**< flags */
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
68 NULL, /**< dependencies */
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
69 GAIM_PRIORITY_DEFAULT, /**< priority */
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
70
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
71 GAIMINC_PLUGIN_ID, /**< id */
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
72 N_("Gaim Demonstration Plugin"), /**< name */
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
73 VERSION, /**< version */
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
74 /** summary */
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
75 N_("An example plugin that does stuff - see the description."),
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
76 /** description */
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
77 N_("This is a really cool plugin that does a lot of stuff:\n"
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
78 "- It tells you who wrote the program when you log in\n"
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
79 "- It reverses all incoming text\n"
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
80 "- It sends a message to people on your list immediately"
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
81 " when they sign on"),
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
82 "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6063
diff changeset
83 GAIM_WEBSITE, /**< homepage */
5255
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
84
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
85 plugin_load, /**< load */
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
86 NULL, /**< unload */
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
87 NULL, /**< destroy */
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
88
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
89 NULL, /**< ui_info */
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
90 NULL /**< extra_info */
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
91 };
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
92
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
93 static void
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5255
diff changeset
94 init_plugin(GaimPlugin *plugin)
5255
c0baa01cdeda [gaim-migrate @ 5627]
Luke Schierer <lschiere@pidgin.im>
parents: 5205
diff changeset
95 {
3551
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
96 }
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
97
6063
5239a3b4ab33 [gaim-migrate @ 6513]
Nathan Walp <nwalp@pidgin.im>
parents: 5920
diff changeset
98 GAIM_INIT_PLUGIN(gaiminc, init_plugin, info)