From 13bef17c0bf4260ce91851f33e9aa7b4cd980155 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 4 Aug 2013 17:50:35 +0100 Subject: [PATCH] Added register_timed to plugins api --- src/command/command.c | 4 ++-- src/plugins/api.c | 14 ++++++++++++++ src/plugins/command.c | 3 ++- src/plugins/command.h | 1 - src/plugins/plugins.h | 1 + src/profanity.c | 2 +- 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/command/command.c b/src/command/command.c index 3ed18651..6f647716 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -20,7 +20,6 @@ * */ -#include "plugins/command.h" #include #include #include @@ -37,6 +36,7 @@ #include "jid.h" #include "log.h" #include "muc.h" +#include "plugins/plugins.h" #include "profanity.h" #include "tools/autocomplete.h" #include "tools/parser.h" @@ -1107,7 +1107,7 @@ cmd_execute(const char * const command, const char * const inp) g_strfreev(args); return result; } - } else if (plugin_command_run(command)) { + } else if (plugins_command_run(command)) { return TRUE; } else { return cmd_execute_default(inp); diff --git a/src/plugins/api.c b/src/plugins/api.c index e7af8b57..01e510c7 100644 --- a/src/plugins/api.c +++ b/src/plugins/api.c @@ -70,6 +70,19 @@ api_register_command(PyObject *self, PyObject *args) return Py_BuildValue(""); } +static PyObject * +api_register_timed(PyObject *self, PyObject *args) +{ + PyObject *p_callback = NULL; + int interval_ms = 0; + + if (!PyArg_ParseTuple(args, "Oi", &p_callback, &interval_ms)) { + return NULL; + } + + return Py_BuildValue(""); +} + static PyObject* api_notify(PyObject *self, PyObject *args) { @@ -89,6 +102,7 @@ api_notify(PyObject *self, PyObject *args) static PyMethodDef apiMethods[] = { { "cons_show", api_cons_show, METH_VARARGS, "Print a line to the console." }, { "register_command", api_register_command, METH_VARARGS, "Register a command." }, + { "register_timed", api_register_timed, METH_VARARGS, "Register a timed function." }, { "notify", api_notify, METH_VARARGS, "Send desktop notification." }, { NULL, NULL, 0, NULL } }; diff --git a/src/plugins/command.c b/src/plugins/command.c index a93d06f3..ab253a4d 100644 --- a/src/plugins/command.c +++ b/src/plugins/command.c @@ -22,6 +22,7 @@ #include "command/command.h" #include "plugins/command.h" +#include "plugins/plugins.h" #include "tools/autocomplete.h" #include "ui/ui.h" @@ -38,7 +39,7 @@ add_command(PluginCommand *command) } gboolean -plugin_command_run(const char * const cmd) +plugins_command_run(const char * const cmd) { GSList *p_command = p_commands; diff --git a/src/plugins/command.h b/src/plugins/command.h index 6d4f1941..4a4e6b53 100644 --- a/src/plugins/command.h +++ b/src/plugins/command.h @@ -38,6 +38,5 @@ typedef struct p_command { } PluginCommand; void add_command(PluginCommand *command); -gboolean plugin_command_run(const char * const cmd); #endif diff --git a/src/plugins/plugins.h b/src/plugins/plugins.h index 11a1791b..2ecd22b5 100644 --- a/src/plugins/plugins.h +++ b/src/plugins/plugins.h @@ -26,5 +26,6 @@ void plugins_init(void); void plugins_on_connect(void); void plugins_shutdown(void); +gboolean plugins_command_run(const char * const cmd); #endif diff --git a/src/profanity.c b/src/profanity.c index a688f68c..fd86d05d 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -31,7 +31,6 @@ #include "profanity.h" -#include "plugins/plugins.h" #include "chat_session.h" #include "config/accounts.h" #include "config/preferences.h" @@ -41,6 +40,7 @@ #include "contact.h" #include "log.h" #include "muc.h" +#include "plugins/plugins.h" #include "resource.h" #include "ui/notifier.h" #include "ui/ui.h"