From 0d46e7f53ec6781201e2e381fa2ce9908ba38ebe Mon Sep 17 00:00:00 2001 From: HanzZ Date: Tue, 3 Apr 2012 20:38:25 +0200 Subject: [PATCH] execute_purple_plugin_action --- backends/libpurple/main.cpp | 21 ++------------------- backends/libpurple/utils.cpp | 22 ++++++++++++++++++++++ backends/libpurple/utils.h | 5 ++++- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/backends/libpurple/main.cpp b/backends/libpurple/main.cpp index dcd5f63a..8320ea28 100644 --- a/backends/libpurple/main.cpp +++ b/backends/libpurple/main.cpp @@ -1448,25 +1448,8 @@ static void signed_on(PurpleConnection *gc, gpointer unused) { malloc_trim(0); #endif - PurplePlugin *plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? gc->prpl : NULL; - if (plugin && PURPLE_PLUGIN_HAS_ACTIONS(plugin)) { - PurplePluginAction *action = NULL; - GList *actions, *l; - - actions = PURPLE_PLUGIN_ACTIONS(plugin, gc); - - for (l = actions; l != NULL; l = l->next) { - if (l->data) { - action = (PurplePluginAction *) l->data; - action->plugin = plugin; - action->context = gc; - if ((std::string) action->label == "Download buddylist from Server") { - action->callback(action); - } - purple_plugin_action_free(action); - } - } - } + // For prpl-gg + execute_purple_plugin_action(gc, "Download buddylist from Server"); } static void printDebug(PurpleDebugLevel level, const char *category, const char *arg_s) { diff --git a/backends/libpurple/utils.cpp b/backends/libpurple/utils.cpp index 417ad67d..76759798 100644 --- a/backends/libpurple/utils.cpp +++ b/backends/libpurple/utils.cpp @@ -49,6 +49,28 @@ static GHashTable *ui_info = NULL; +void execute_purple_plugin_action(PurpleConnection *gc, const std::string &name) { + PurplePlugin *plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? gc->prpl : NULL; + if (plugin && PURPLE_PLUGIN_HAS_ACTIONS(plugin)) { + PurplePluginAction *action = NULL; + GList *actions, *l; + + actions = PURPLE_PLUGIN_ACTIONS(plugin, gc); + + for (l = actions; l != NULL; l = l->next) { + if (l->data) { + action = (PurplePluginAction *) l->data; + action->plugin = plugin; + action->context = gc; + if ((std::string) action->label == name) { + action->callback(action); + } + purple_plugin_action_free(action); + } + } + } +} + GHashTable *spectrum_ui_get_info(void) { if(NULL == ui_info) { diff --git a/backends/libpurple/utils.h b/backends/libpurple/utils.h index 2055b6c1..72d513a4 100644 --- a/backends/libpurple/utils.h +++ b/backends/libpurple/utils.h @@ -21,10 +21,13 @@ #pragma once #include "purple.h" +#include #ifndef WIN32 void spectrum_sigchld_handler(int sig); #endif int create_socket(char *host, int portno); -GHashTable *spectrum_ui_get_info(void); \ No newline at end of file +GHashTable *spectrum_ui_get_info(void); + +void execute_purple_plugin_action(PurpleConnection *gc, const std::string &name);