annotate plugins/gaiminc.c @ 4145:b658b502b096

[gaim-migrate @ 4363] gtk1.2 code in anything except the buddy list window is a bug. this patch from David Brigada (jsi): " This patch changes the mechanism in which Gaim changes the colors on tabs for typing notification, new message notification, etc.. The previous mechanism was causing the font to change (possible mix of gtk1.2 and gtk2.0 code). Instead of loading the label's preferences with gtk_widget_get_modifier_style(), changing the color (with a -> edit), and then saving the label's preferences with gtk_widget_modify_style(), it changes the color with gtk_widget_modify_fg(). This fixes the font problem on my computer. The GTK 2.0 API docs seem to suggest the use of gtk_widget_modify_fg() over gtk_widget_modify_style() when necessary." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Thu, 26 Dec 2002 15:40:23 +0000
parents cd938f18f3f8
children fefad67de2c7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
1 #define GAIM_PLUGINS
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
2
91
308d0896d979 [gaim-migrate @ 101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 #include <gtk/gtk.h>
308d0896d979 [gaim-migrate @ 101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 #include <time.h>
308d0896d979 [gaim-migrate @ 101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 #include <stdio.h>
308d0896d979 [gaim-migrate @ 101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 #include <fcntl.h>
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
7 #include <string.h>
91
308d0896d979 [gaim-migrate @ 101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 #include "gaim.h"
308d0896d979 [gaim-migrate @ 101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
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 */
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 99
diff changeset
40 serv_send_im(gc, who, "Hello!", 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
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 99
diff changeset
43 char *gaim_plugin_init(GModule *handle) {
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
44 /* this is for doing something fun when we sign on */
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
45 gaim_signal_connect(handle, event_signon, echo_hi, NULL);
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
46
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
47 /* this is for doing something fun when we get a message */
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
48 gaim_signal_connect(handle, event_im_recv, reverse, NULL);
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
49
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
50 /* this is for doing something fun when a buddy comes online */
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
51 gaim_signal_connect(handle, event_buddy_signon, bud, NULL);
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 99
diff changeset
52
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 99
diff changeset
53 return NULL;
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
54 }
96
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
55
3551
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
56 struct gaim_plugin_description desc;
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
57 struct gaim_plugin_description *gaim_plugin_desc() {
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
58 desc.api_version = PLUGIN_API_VERSION;
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
59 desc.name = g_strdup("Demonstration");
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
60 desc.version = g_strdup(VERSION);
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
61 desc.description = g_strdup(
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
62 "This is a really cool plugin that does a lot of stuff:\n"
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
63 "- It tells you who wrote the program when you log in\n"
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
64 "- It reverses all incoming text\n"
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
65 "- It sends a message to people on your list immediately"
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
66 " when they sign on";);
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
67 desc.authors = g_strdup("Eric Warmehoven &lt;eric@warmenhoven.org>");
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
68 desc.url = g_strdup(WEBSITE);
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
69 return &desc;
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
70 }
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
71
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 1047
diff changeset
72
96
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
73 char *name() {
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
74 return "Gaim Demonstration Plugin";
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
75 }
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
76
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
77 char *description() {
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
78 return "This is a really cool plugin that does a lot of stuff:\n"
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
79 "- It tells you who wrote the program when you log in\n"
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
80 "- It reverses all incoming text\n"
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
81 "- It sends a message to people on your list immediately"
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
82 " when they sign on";
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
83 }