mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added register_timed to plugins api
This commit is contained in:
parent
9e6a6f224f
commit
13bef17c0b
@ -20,7 +20,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "plugins/command.h"
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -37,6 +36,7 @@
|
|||||||
#include "jid.h"
|
#include "jid.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "muc.h"
|
#include "muc.h"
|
||||||
|
#include "plugins/plugins.h"
|
||||||
#include "profanity.h"
|
#include "profanity.h"
|
||||||
#include "tools/autocomplete.h"
|
#include "tools/autocomplete.h"
|
||||||
#include "tools/parser.h"
|
#include "tools/parser.h"
|
||||||
@ -1107,7 +1107,7 @@ cmd_execute(const char * const command, const char * const inp)
|
|||||||
g_strfreev(args);
|
g_strfreev(args);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} else if (plugin_command_run(command)) {
|
} else if (plugins_command_run(command)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
return cmd_execute_default(inp);
|
return cmd_execute_default(inp);
|
||||||
|
@ -70,6 +70,19 @@ api_register_command(PyObject *self, PyObject *args)
|
|||||||
return Py_BuildValue("");
|
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*
|
static PyObject*
|
||||||
api_notify(PyObject *self, PyObject *args)
|
api_notify(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
@ -89,6 +102,7 @@ api_notify(PyObject *self, PyObject *args)
|
|||||||
static PyMethodDef apiMethods[] = {
|
static PyMethodDef apiMethods[] = {
|
||||||
{ "cons_show", api_cons_show, METH_VARARGS, "Print a line to the console." },
|
{ "cons_show", api_cons_show, METH_VARARGS, "Print a line to the console." },
|
||||||
{ "register_command", api_register_command, METH_VARARGS, "Register a command." },
|
{ "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." },
|
{ "notify", api_notify, METH_VARARGS, "Send desktop notification." },
|
||||||
{ NULL, NULL, 0, NULL }
|
{ NULL, NULL, 0, NULL }
|
||||||
};
|
};
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "command/command.h"
|
#include "command/command.h"
|
||||||
#include "plugins/command.h"
|
#include "plugins/command.h"
|
||||||
|
#include "plugins/plugins.h"
|
||||||
#include "tools/autocomplete.h"
|
#include "tools/autocomplete.h"
|
||||||
|
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
@ -38,7 +39,7 @@ add_command(PluginCommand *command)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
plugin_command_run(const char * const cmd)
|
plugins_command_run(const char * const cmd)
|
||||||
{
|
{
|
||||||
GSList *p_command = p_commands;
|
GSList *p_command = p_commands;
|
||||||
|
|
||||||
|
@ -38,6 +38,5 @@ typedef struct p_command {
|
|||||||
} PluginCommand;
|
} PluginCommand;
|
||||||
|
|
||||||
void add_command(PluginCommand *command);
|
void add_command(PluginCommand *command);
|
||||||
gboolean plugin_command_run(const char * const cmd);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -26,5 +26,6 @@
|
|||||||
void plugins_init(void);
|
void plugins_init(void);
|
||||||
void plugins_on_connect(void);
|
void plugins_on_connect(void);
|
||||||
void plugins_shutdown(void);
|
void plugins_shutdown(void);
|
||||||
|
gboolean plugins_command_run(const char * const cmd);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
#include "profanity.h"
|
#include "profanity.h"
|
||||||
|
|
||||||
#include "plugins/plugins.h"
|
|
||||||
#include "chat_session.h"
|
#include "chat_session.h"
|
||||||
#include "config/accounts.h"
|
#include "config/accounts.h"
|
||||||
#include "config/preferences.h"
|
#include "config/preferences.h"
|
||||||
@ -41,6 +40,7 @@
|
|||||||
#include "contact.h"
|
#include "contact.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "muc.h"
|
#include "muc.h"
|
||||||
|
#include "plugins/plugins.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "ui/notifier.h"
|
#include "ui/notifier.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user