execute_purple_plugin_action
This commit is contained in:
parent
bde0e7c3eb
commit
0d46e7f53e
3 changed files with 28 additions and 20 deletions
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -21,10 +21,13 @@
|
|||
#pragma once
|
||||
|
||||
#include "purple.h"
|
||||
#include <string>
|
||||
|
||||
#ifndef WIN32
|
||||
void spectrum_sigchld_handler(int sig);
|
||||
#endif
|
||||
|
||||
int create_socket(char *host, int portno);
|
||||
GHashTable *spectrum_ui_get_info(void);
|
||||
GHashTable *spectrum_ui_get_info(void);
|
||||
|
||||
void execute_purple_plugin_action(PurpleConnection *gc, const std::string &name);
|
||||
|
|
Loading…
Add table
Reference in a new issue