Mercurial > pidgin
changeset 5255:c0baa01cdeda
[gaim-migrate @ 5627]
Paul A (darkrain) writes:
" This patch updates the events.c, filectl.c, gaiminc.c,
and mailchk.c plugins to the new api as well as
updating mailchk.c to the new buddy list code.
events.so, gaiminc.so, and mailchk.so all load and
function properly on my computer.
filectl doesn't even compile, but then, it has been a
while since it did actually compile. I didn't even bother
to update a few of the other plugins, since they're
completely out of date. Perhaps one of the developers
needs to go through and prune out a bunch of the
plugins that are not kept up to date.
Out of date plugins:
chatlist.c - superceded by faceprint's recent commit to
cvs.
filectl.c - doesn't support multiple accounts for IMs and
away messages.
raw.c - does anyone use this? it doesn't compile, but it
looks like an easy fix. "
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Mon, 28 Apr 2003 18:45:38 +0000 |
parents | d1e1ca490894 |
children | 1d1c45d9b7fc |
files | plugins/events.c plugins/filectl.c plugins/gaiminc.c plugins/mailchk.c |
diffstat | 4 files changed, 250 insertions(+), 158 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/events.c Mon Apr 28 16:21:03 2003 +0000 +++ b/plugins/events.c Mon Apr 28 18:45:38 2003 +0000 @@ -1,4 +1,4 @@ -/* tester.c +/* events.c * * test every callback, print to stdout * @@ -8,7 +8,7 @@ * */ -#define GAIM_PLUGINS +#define EVENTTEST_PLUGIN_ID "core-eventtest" #include "gaim.h" static void evt_signon(struct gaim_connection *gc, void *data) @@ -148,7 +148,7 @@ static void evt_im_displayed_rcvd(struct gaim_connection *gc, char *who, char *what, guint32 flags, time_t time, void *data) { - printf("event_im_displayed_rcvd: %s %s %s %s\n", who, what, flags, time); + printf("event_im_displayed_rcvd: %s %s %u %u\n", who, what, flags, time); } static void evt_chat_send_invite(struct gaim_connection *gc, int id, char *who, char **msg, void *data) @@ -161,7 +161,7 @@ printf("event_got_typing: %s\n", who); } -static evt_del_conversation(struct conversation *c, void *data) +static evt_del_conversation(struct gaim_conversation *c, void *data) { printf("event_del_conversation\n"); } @@ -171,57 +171,77 @@ printf("event_connecting\n"); } -char *gaim_plugin_init(GModule *h) + +/* + * EXPORTED FUNCTIONS + */ + +static gboolean +plugin_load(GaimPlugin *plugin) { - gaim_signal_connect(h, event_signon, evt_signon, NULL); - gaim_signal_connect(h, event_signoff, evt_signoff, NULL); - gaim_signal_connect(h, event_away, evt_away, NULL); - gaim_signal_connect(h, event_back, evt_back, NULL); - gaim_signal_connect(h, event_im_recv, evt_im_recv, NULL); - gaim_signal_connect(h, event_im_send, evt_im_send, NULL); - gaim_signal_connect(h, event_buddy_signon, evt_buddy_signon, NULL); - gaim_signal_connect(h, event_buddy_signoff, evt_buddy_signoff, NULL); - gaim_signal_connect(h, event_buddy_away, evt_buddy_away, NULL); - gaim_signal_connect(h, event_buddy_back, evt_buddy_back, NULL); - gaim_signal_connect(h, event_chat_invited, evt_chat_invited, NULL); - gaim_signal_connect(h, event_chat_join, evt_chat_join, NULL); - gaim_signal_connect(h, event_chat_leave, evt_chat_leave, NULL); - gaim_signal_connect(h, event_chat_buddy_join, evt_chat_buddy_join, NULL); - gaim_signal_connect(h, event_chat_buddy_leave, evt_chat_buddy_leave, NULL); - gaim_signal_connect(h, event_chat_recv, evt_chat_recv, NULL); - gaim_signal_connect(h, event_chat_send, evt_chat_send, NULL); - gaim_signal_connect(h, event_warned, evt_warned, NULL); - gaim_signal_connect(h, event_error, evt_error, NULL); - gaim_signal_connect(h, event_quit, evt_quit, NULL); - gaim_signal_connect(h, event_new_conversation, evt_new_conversation, NULL); - gaim_signal_connect(h, event_set_info, evt_set_info, NULL); - gaim_signal_connect(h, event_draw_menu, evt_draw_menu, NULL); - gaim_signal_connect(h, event_im_displayed_sent, evt_im_displayed_sent, NULL); - gaim_signal_connect(h, event_im_displayed_rcvd, evt_im_displayed_rcvd, NULL); - gaim_signal_connect(h, event_chat_send_invite, evt_chat_send_invite, NULL); - gaim_signal_connect(h, event_got_typing, evt_got_typing, NULL); - gaim_signal_connect(h, event_del_conversation, evt_del_conversation, NULL); - gaim_signal_connect(h, event_connecting, evt_connecting, NULL); - return NULL; + gaim_signal_connect(plugin, event_signon, evt_signon, NULL); + gaim_signal_connect(plugin, event_signoff, evt_signoff, NULL); + gaim_signal_connect(plugin, event_away, evt_away, NULL); + gaim_signal_connect(plugin, event_back, evt_back, NULL); + gaim_signal_connect(plugin, event_im_recv, evt_im_recv, NULL); + gaim_signal_connect(plugin, event_im_send, evt_im_send, NULL); + gaim_signal_connect(plugin, event_buddy_signon, evt_buddy_signon, NULL); + gaim_signal_connect(plugin, event_buddy_signoff, evt_buddy_signoff, NULL); + gaim_signal_connect(plugin, event_buddy_away, evt_buddy_away, NULL); + gaim_signal_connect(plugin, event_buddy_back, evt_buddy_back, NULL); + gaim_signal_connect(plugin, event_chat_invited, evt_chat_invited, NULL); + gaim_signal_connect(plugin, event_chat_join, evt_chat_join, NULL); + gaim_signal_connect(plugin, event_chat_leave, evt_chat_leave, NULL); + gaim_signal_connect(plugin, event_chat_buddy_join, evt_chat_buddy_join, NULL); + gaim_signal_connect(plugin, event_chat_buddy_leave, evt_chat_buddy_leave, NULL); + gaim_signal_connect(plugin, event_chat_recv, evt_chat_recv, NULL); + gaim_signal_connect(plugin, event_chat_send, evt_chat_send, NULL); + gaim_signal_connect(plugin, event_warned, evt_warned, NULL); + gaim_signal_connect(plugin, event_error, evt_error, NULL); + gaim_signal_connect(plugin, event_quit, evt_quit, NULL); + gaim_signal_connect(plugin, event_new_conversation, evt_new_conversation, NULL); + gaim_signal_connect(plugin, event_set_info, evt_set_info, NULL); + gaim_signal_connect(plugin, event_draw_menu, evt_draw_menu, NULL); + gaim_signal_connect(plugin, event_im_displayed_sent, evt_im_displayed_sent, NULL); + gaim_signal_connect(plugin, event_im_displayed_rcvd, evt_im_displayed_rcvd, NULL); + gaim_signal_connect(plugin, event_chat_send_invite, evt_chat_send_invite, NULL); + gaim_signal_connect(plugin, event_got_typing, evt_got_typing, NULL); + gaim_signal_connect(plugin, event_del_conversation, evt_del_conversation, NULL); + gaim_signal_connect(plugin, event_connecting, evt_connecting, NULL); + + return TRUE; } -struct gaim_plugin_description desc; -struct gaim_plugin_description *gaim_plugin_desc() { - desc.api_version = GAIM_PLUGIN_API_VERSION; - desc.name = g_strdup("Event Tester"); - desc.version = g_strdup(VERSION); - desc.description = g_strdup("Test to see that all plugin events are working properly."); - desc.authors = g_strdup("Eric Warmehoven <eric@warmenhoven.org>"); - desc.url = g_strdup(WEBSITE); - return &desc; +static GaimPluginInfo info = +{ + 2, /**< api_version */ + GAIM_PLUGIN_STANDARD, /**< type */ + NULL, /**< ui_requirement */ + 0, /**< flags */ + NULL, /**< dependencies */ + GAIM_PRIORITY_DEFAULT, /**< priority */ + + EVENTTEST_PLUGIN_ID, /**< id */ + N_("Event Test"), /**< name */ + VERSION, /**< version */ + /** summary */ + N_("Test to see that all events are working properly."), + /** description */ + N_("Test to see that all events are working properly."), + "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */ + WEBSITE, /**< homepage */ + + plugin_load, /**< load */ + NULL, /**< unload */ + NULL, /**< destroy */ + + NULL, /**< ui_info */ + NULL /**< extra_info */ +}; + +static void +__init_plugin(GaimPlugin *plugin) +{ } -char *name() -{ - return "Event Test"; -} - -char *description() -{ - return "Test to see that all events are working properly."; -} +GAIM_INIT_PLUGIN(eventtester, __init_plugin, info);
--- a/plugins/filectl.c Mon Apr 28 16:21:03 2003 +0000 +++ b/plugins/filectl.c Mon Apr 28 18:45:38 2003 +0000 @@ -9,7 +9,7 @@ #include <string.h> #include <ctype.h> -static void *handle; +#define FILECTL_PLUGIN_ID "core-filectl" static int check; static time_t mtime; @@ -107,36 +107,6 @@ mtime = finfo.st_mtime; } -char *gaim_plugin_init(GModule *h) { - handle = h; - init_file(); - check = g_timeout_add(5000, check_file, NULL); - return NULL; -} - -void gaim_plugin_remove() { - g_source_remove(check); -} - -struct gaim_plugin_description desc; -struct gaim_plugin_description *gaim_plugin_desc() { - desc.api_version = GAIM_PLUGIN_API_VERSION; - desc.name = g_strdup("Gaim File Control"); - desc.version = g_strdup(VERSION); - desc.description = g_strdup("Allows you to control Gaim by entering commands in aa file."); - desc.authors = g_strdup("Eric Warmehoven <eric@warmenhoven.org>"); - desc.url = g_strdup(WEBSITE); - return &desc; -} - -char *name() { - return "Gaim File Control"; -} - -char *description() { - return "Allows you to control gaim by entering commands in a file."; -} - /* check to see if the size of the file is > 0. if so, run commands */ void init_file() { /* most of this was taken from Bash v2.04 by the FSF */ @@ -199,3 +169,57 @@ free(arr); return val; } +/* + * EXPORTED FUNCTIONS + */ + +static gboolean +plugin_load(GaimPlugin *plugin) +{ + init_file(); + check = g_timeout_add(5000, check_file, NULL); + + return TRUE; +} + +static gboolean +plugin_unload(GaimPlugin *plugin) +{ + g_source_remove(check); + + return TRUE; +} + +static GaimPluginInfo info = +{ + 2, /**< api_version */ + GAIM_PLUGIN_STANDARD, /**< type */ + NULL, /**< ui_requirement */ + 0, /**< flags */ + NULL, /**< dependencies */ + GAIM_PRIORITY_DEFAULT, /**< priority */ + + FILECTL_PLUGIN_ID, /**< id */ + N_("Gaim File Control"), /**< name */ + VERSION, /**< version */ + /** summary */ + N_("Allows you to control Gaim by entering commands in a file."), + /** description */ + N_("Allows you to control Gaim by entering commands in a file."), + "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */ + WEBSITE, /**< homepage */ + + plugin_load, /**< load */ + plugin_unload, /**< unload */ + NULL, /**< destroy */ + + NULL, /**< ui_info */ + NULL /**< extra_info */ +}; + +static void +__init_plugin(GaimPlugin *plugin) +{ +} + +GAIM_INIT_PLUGIN(filectl, __init_plugin, info);
--- a/plugins/gaiminc.c Mon Apr 28 16:21:03 2003 +0000 +++ b/plugins/gaiminc.c Mon Apr 28 18:45:38 2003 +0000 @@ -1,12 +1,12 @@ -#define GAIM_PLUGINS - -#include <gtk/gtk.h> +//#include <gtk/gtk.h> #include <time.h> #include <stdio.h> #include <fcntl.h> #include <string.h> #include "gaim.h" +#define GAIMINC_PLUGIN_ID "core-gaiminc" + void echo_hi(void *m) { /* this doesn't do much, just lets you know who we are :) */ show_about(NULL, NULL); @@ -37,47 +37,62 @@ void bud(struct gaim_connection *gc, char *who, void *m) { /* whenever someone comes online, it sends them a message. if i * cared more, i'd make it so it popped up on your screen too */ - serv_send_im(gc, who, "Hello!", 0); + serv_send_im(gc, who, "Hello!", -1, 0); } -char *gaim_plugin_init(GModule *handle) { +/* + * EXPORTED FUNCTIONS + */ + +static gboolean +plugin_load(GaimPlugin *plugin) +{ /* this is for doing something fun when we sign on */ - gaim_signal_connect(handle, event_signon, echo_hi, NULL); + gaim_signal_connect(plugin, event_signon, echo_hi, NULL); /* this is for doing something fun when we get a message */ - gaim_signal_connect(handle, event_im_recv, reverse, NULL); + gaim_signal_connect(plugin, event_im_recv, reverse, NULL); /* this is for doing something fun when a buddy comes online */ - gaim_signal_connect(handle, event_buddy_signon, bud, NULL); + gaim_signal_connect(plugin, event_buddy_signon, bud, NULL); - return NULL; + return TRUE; } -struct gaim_plugin_description desc; -struct gaim_plugin_description *gaim_plugin_desc() { - desc.api_version = GAIM_PLUGIN_API_VERSION; - desc.name = g_strdup("Demonstration"); - desc.version = g_strdup(VERSION); - desc.description = g_strdup( - "This is a really cool plugin that does a lot of stuff:\n" - "- It tells you who wrote the program when you log in\n" - "- It reverses all incoming text\n" - "- It sends a message to people on your list immediately" - " when they sign on";); - desc.authors = g_strdup("Eric Warmehoven <eric@warmenhoven.org>"); - desc.url = g_strdup(WEBSITE); - return &desc; +static GaimPluginInfo info = +{ + 2, /**< api_version */ + GAIM_PLUGIN_STANDARD, /**< type */ + NULL, /**< ui_requirement */ + 0, /**< flags */ + NULL, /**< dependencies */ + GAIM_PRIORITY_DEFAULT, /**< priority */ + + GAIMINC_PLUGIN_ID, /**< id */ + N_("Gaim Demonstration Plugin"), /**< name */ + VERSION, /**< version */ + /** summary */ + N_("An example plugin that does stuff - see the description."), + /** description */ + N_("This is a really cool plugin that does a lot of stuff:\n" + "- It tells you who wrote the program when you log in\n" + "- It reverses all incoming text\n" + "- It sends a message to people on your list immediately" + " when they sign on"), + "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */ + WEBSITE, /**< homepage */ + + plugin_load, /**< load */ + NULL, /**< unload */ + NULL, /**< destroy */ + + NULL, /**< ui_info */ + NULL /**< extra_info */ +}; + +static void +__init_plugin(GaimPlugin *plugin) +{ } - -char *name() { - return "Gaim Demonstration Plugin"; -} - -char *description() { - return "This is a really cool plugin that does a lot of stuff:\n" - "- It tells you who wrote the program when you log in\n" - "- It reverses all incoming text\n" - "- It sends a message to people on your list immediately" - " when they sign on"; -} +GAIM_INIT_PLUGIN(gaiminc, __init_plugin, info);
--- a/plugins/mailchk.c Mon Apr 28 16:21:03 2003 +0000 +++ b/plugins/mailchk.c Mon Apr 28 18:45:38 2003 +0000 @@ -1,10 +1,13 @@ #include "gaim.h" +#include "gtkplugin.h" +#include "blist.h" +#include "gtkblist.h" #include "sound.h" #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> -#define MAILCHK_PLUGIN_ID "core-mailchk" +#define MAILCHK_PLUGIN_ID "gtk-mailchk" #define ANY_MAIL 0x01 #define UNREAD_MAIL 0x02 @@ -41,7 +44,7 @@ return ret; } -static void maildes() +static void destroy_cb() { mail = NULL; } @@ -49,22 +52,23 @@ static gboolean check_timeout(gpointer data) { gint count = check_mail(); - + struct gaim_buddy_list *list = gaim_get_blist(); if (count == -1) return FALSE; - if (!blist) + if (!list || !GAIM_GTK_BLIST(list)) return TRUE; if (!mail) { /* guess we better build it then :P */ - GList *tmp = gtk_container_get_children(GTK_CONTAINER(blist)); - GtkWidget *vbox2 = (GtkWidget *)tmp->data; + //GList *tmp = gtk_container_get_children(GTK_CONTAINER(GAIM_GTK_BLIST(list))); + //GtkWidget *vbox2 = (GtkWidget *)tmp->data; + GtkWidget *vbox = (GtkWidget *)(GAIM_GTK_BLIST(list)->vbox); mail = gtk_label_new("No mail messages."); - gtk_box_pack_start(GTK_BOX(vbox2), mail, FALSE, FALSE, 0); - gtk_box_reorder_child(GTK_BOX(vbox2), mail, 1); - g_signal_connect(GTK_OBJECT(mail), "destroy", G_CALLBACK(maildes), NULL); + gtk_box_pack_start(GTK_BOX(vbox), mail, FALSE, FALSE, 0); + gtk_box_reorder_child(GTK_BOX(vbox), mail, 1); + g_signal_connect(GTK_OBJECT(mail), "destroy", G_CALLBACK(destroy_cb), NULL); gtk_widget_show(mail); } @@ -81,32 +85,46 @@ return TRUE; } -static void mail_signon(struct gaim_connection *gc) +static void signon_cb(struct gaim_connection *gc) { - if (blist && !timer) + struct gaim_buddy_list *list = gaim_get_blist(); + if (list && GAIM_GTK_BLIST(list) && !timer) timer = g_timeout_add(2000, check_timeout, NULL); } -static void mail_signoff(struct gaim_connection *gc) +static void signoff_cb(struct gaim_connection *gc) { - if (!blist && timer) { + struct gaim_buddy_list *list = gaim_get_blist(); + if ((!list || !GAIM_GTK_BLIST(list)) && timer) { g_source_remove(timer); timer = 0; } } -char *gaim_plugin_init(GModule *m) +/* + * EXPORTED FUNCTIONS + */ + +static gboolean +plugin_load(GaimPlugin *plugin) { - if (!check_timeout(NULL)) - return "Could not read $MAIL or /var/spool/mail/$USER"; - if (blist) + struct gaim_buddy_list *list = gaim_get_blist(); + if (!check_timeout(NULL)) { + gaim_debug(GAIM_DEBUG_WARNING, "mailchk", "Could not read $MAIL or /var/spool/mail/$USER"); + return FALSE; + } + + if (list && GAIM_GTK_BLIST(list)) timer = g_timeout_add(2000, check_timeout, NULL); - gaim_signal_connect(m, event_signon, mail_signon, NULL); - gaim_signal_connect(m, event_signoff, mail_signoff, NULL); - return NULL; + + gaim_signal_connect(plugin, event_signon, signon_cb, NULL); + gaim_signal_connect(plugin, event_signoff, signoff_cb, NULL); + + return TRUE; } -void gaim_plugin_remove() +static gboolean +plugin_unload(GaimPlugin *plugin) { if (timer) g_source_remove(timer); @@ -114,25 +132,40 @@ if (mail) gtk_widget_destroy(mail); mail = NULL; + + return TRUE; } -struct gaim_plugin_description desc; -struct gaim_plugin_description *gaim_plugin_desc() { - desc.api_version = GAIM_PLUGIN_API_VERSION; - desc.name = g_strdup("Mail Checker"); - desc.version = g_strdup(VERSION); - desc.description = g_strdup("Checks for new local mail."); - desc.authors = g_strdup("Eric Warmehoven <eric@warmenhoven.org>"); - desc.url = g_strdup(WEBSITE); - return &desc; +static GaimPluginInfo info = +{ + 2, /**< api_version */ + GAIM_PLUGIN_STANDARD, /**< type */ + GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ + 0, /**< flags */ + NULL, /**< dependencies */ + GAIM_PRIORITY_DEFAULT, /**< priority */ + + MAILCHK_PLUGIN_ID, /**< id */ + N_("Mail Checker"), /**< name */ + VERSION, /**< version */ + /** summary */ + N_("Checks for new local mail."), + /** description */ + N_("Checks for new local mail."), + "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */ + WEBSITE, /**< homepage */ + + plugin_load, /**< load */ + plugin_unload, /**< unload */ + NULL, /**< destroy */ + + NULL, /**< ui_info */ + NULL /**< extra_info */ +}; + +static void +__init_plugin(GaimPlugin *plugin) +{ } -char *name() -{ - return "Mail Check"; -} - -char *description() -{ - return "Checks for new local mail"; -} +GAIM_INIT_PLUGIN(mailchk, __init_plugin, info);