plugins/gaiminc.c

changeset 5255
8aa84137a01f
parent 5205
242b8aa81328
child 5920
963bfdefee02
equal deleted inserted replaced
5254:6717daf94719 5255:8aa84137a01f
1 #define GAIM_PLUGINS 1 //#include <gtk/gtk.h>
2
3 #include <gtk/gtk.h>
4 #include <time.h> 2 #include <time.h>
5 #include <stdio.h> 3 #include <stdio.h>
6 #include <fcntl.h> 4 #include <fcntl.h>
7 #include <string.h> 5 #include <string.h>
8 #include "gaim.h" 6 #include "gaim.h"
7
8 #define GAIMINC_PLUGIN_ID "core-gaiminc"
9 9
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 }
35 } 35 }
36 36
37 void bud(struct gaim_connection *gc, 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(gc, who, "Hello!", 0); 40 serv_send_im(gc, who, "Hello!", -1, 0);
41 } 41 }
42 42
43 char *gaim_plugin_init(GModule *handle) { 43 /*
44 * EXPORTED FUNCTIONS
45 */
46
47 static gboolean
48 plugin_load(GaimPlugin *plugin)
49 {
44 /* this is for doing something fun when we sign on */ 50 /* this is for doing something fun when we sign on */
45 gaim_signal_connect(handle, event_signon, echo_hi, NULL); 51 gaim_signal_connect(plugin, event_signon, echo_hi, NULL);
46 52
47 /* this is for doing something fun when we get a message */ 53 /* this is for doing something fun when we get a message */
48 gaim_signal_connect(handle, event_im_recv, reverse, NULL); 54 gaim_signal_connect(plugin, event_im_recv, reverse, NULL);
49 55
50 /* this is for doing something fun when a buddy comes online */ 56 /* this is for doing something fun when a buddy comes online */
51 gaim_signal_connect(handle, event_buddy_signon, bud, NULL); 57 gaim_signal_connect(plugin, event_buddy_signon, bud, NULL);
52 58
53 return NULL; 59 return TRUE;
54 } 60 }
55 61
56 struct gaim_plugin_description desc; 62 static GaimPluginInfo info =
57 struct gaim_plugin_description *gaim_plugin_desc() { 63 {
58 desc.api_version = GAIM_PLUGIN_API_VERSION; 64 2, /**< api_version */
59 desc.name = g_strdup("Demonstration"); 65 GAIM_PLUGIN_STANDARD, /**< type */
60 desc.version = g_strdup(VERSION); 66 NULL, /**< ui_requirement */
61 desc.description = g_strdup( 67 0, /**< flags */
62 "This is a really cool plugin that does a lot of stuff:\n" 68 NULL, /**< dependencies */
63 "- It tells you who wrote the program when you log in\n" 69 GAIM_PRIORITY_DEFAULT, /**< priority */
64 "- It reverses all incoming text\n" 70
65 "- It sends a message to people on your list immediately" 71 GAIMINC_PLUGIN_ID, /**< id */
66 " when they sign on";); 72 N_("Gaim Demonstration Plugin"), /**< name */
67 desc.authors = g_strdup("Eric Warmehoven &lt;eric@warmenhoven.org>"); 73 VERSION, /**< version */
68 desc.url = g_strdup(WEBSITE); 74 /** summary */
69 return &desc; 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 {
70 } 96 }
71 97
72 98 GAIM_INIT_PLUGIN(gaiminc, __init_plugin, info);
73 char *name() {
74 return "Gaim Demonstration Plugin";
75 }
76
77 char *description() {
78 return "This is a really cool plugin that does a lot of stuff:\n"
79 "- It tells you who wrote the program when you log in\n"
80 "- It reverses all incoming text\n"
81 "- It sends a message to people on your list immediately"
82 " when they sign on";
83 }

mercurial