Mercurial > pidgin.yaz
view plugins/statenotify.c @ 8986:8cf32769ba1b
[gaim-migrate @ 9761]
" This patch adds a Plugin Actions menu item after the
Account Actions menu. The Plugin Actions menu is
populated from the added 'actions' slot in
GaimPluginInfo. As a demonstration, the Idle Maker
plugin has been converted to no longer require GTK code
and the Preferences interface just to perform its
actions. Instead, it uses a Plugin Action to spawn a
Fields Request.
There's also a minor fix for consistency in the menu
building for buddy actions. The pre-existing method for
instructing a menu list to display a separator was to
insert a NULL rather than a proto_buddy_menu into the
GList of actions. The code for the buddy menus was
instead checking for a proto_buddy_menu with a '-'
label. This has been fixed, and it now correctly uses
NULL to indicate a separator."
"Date: 2004-05-16 02:25
Sender: taliesein
Logged In: YES
user_id=77326
I need to add a callback to this patch to watch for
loading/unloading of plugins (to determine when to rebuild
the menu). Since the appropriate way to handle Plugin
Actions is still mildly up for debate, I'm holding of on
correcting the patch until I know for sure whether I should
fix this patch, or scrap it and write a new one using a
different method."
"Date: 2004-05-18 12:26
Sender: taliesein
Logged In: YES
user_id=77326
I've completed changes to this patch to also add plugin load
and unload signals (it looks like plugin.c actually had
pre-signal callbacks in place, but they were never used or
converted to signals)
This patch now will correctly update the Plugin Action menu
as plugins load and unload."
I'm not entirely sure i like the ui of a plugins actions menu, but i think
that having some way for plugins to add actions on an account is a good
thing, and i'm not sure that every viable action fits under the accounts
actions menu. we may want to merge the two (the existing accounts actions
and this plugins actions), but both times it came up in #gaim no one seemed
to want to comment, and on one commented to the gaim-devel post either.
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Thu, 20 May 2004 05:11:44 +0000 |
parents | d7b8eb1f0a18 |
children | 294ae6548d4e |
line wrap: on
line source
#include "internal.h" #include "blist.h" #include "conversation.h" #include "debug.h" #include "signals.h" static void write_status(GaimBuddy *buddy, const char *message) { GaimConversation *conv; const char *who; char buf[256]; conv = gaim_find_conversation_with_account(buddy->name, buddy->account); if (conv == NULL) return; who = gaim_get_buddy_alias(buddy); g_snprintf(buf, sizeof(buf), message, who); gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); } static void buddy_away_cb(GaimBuddy *buddy, void *data) { write_status(buddy, _("%s has gone away.")); } static void buddy_unaway_cb(GaimBuddy *buddy, void *data) { write_status(buddy, _("%s is no longer away.")); } static void buddy_idle_cb(GaimBuddy *buddy, void *data) { write_status(buddy, _("%s has become idle.")); } static void buddy_unidle_cb(GaimBuddy *buddy, void *data) { write_status(buddy, _("%s is no longer idle.")); } static gboolean plugin_load(GaimPlugin *plugin) { void *blist_handle = gaim_blist_get_handle(); gaim_signal_connect(blist_handle, "buddy-away", plugin, GAIM_CALLBACK(buddy_away_cb), NULL); gaim_signal_connect(blist_handle, "buddy-back", plugin, GAIM_CALLBACK(buddy_unaway_cb), NULL); gaim_signal_connect(blist_handle, "buddy-idle", plugin, GAIM_CALLBACK(buddy_idle_cb), NULL); gaim_signal_connect(blist_handle, "buddy-unidle", plugin, GAIM_CALLBACK(buddy_unidle_cb), NULL); return TRUE; } static GaimPluginInfo info = { GAIM_PLUGIN_API_VERSION, /**< api_version */ GAIM_PLUGIN_STANDARD, /**< type */ NULL, /**< ui_requirement */ 0, /**< flags */ NULL, /**< dependencies */ GAIM_PRIORITY_DEFAULT, /**< priority */ NULL, /**< id */ N_("Buddy State Notification"), /**< name */ VERSION, /**< version */ /** summary */ N_("Notifies in a conversation window when a buddy goes or returns from " "away or idle."), /** description */ N_("Notifies in a conversation window when a buddy goes or returns from " "away or idle."), "Christian Hammond <chipx86@gnupdate.org>", /**< author */ GAIM_WEBSITE, /**< homepage */ plugin_load, /**< load */ NULL, /**< unload */ NULL, /**< destroy */ NULL, /**< ui_info */ NULL /**< extra_info */ }; static void init_plugin(GaimPlugin *plugin) { } GAIM_INIT_PLUGIN(statenotify, init_plugin, info)