mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge branch 'master' into osx-functional
This commit is contained in:
commit
a0abed1ff0
@ -39,6 +39,7 @@
|
||||
#include <glib.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "event/server_events.h"
|
||||
#include "plugins/callbacks.h"
|
||||
#include "plugins/autocompleters.h"
|
||||
#include "plugins/themes.h"
|
||||
@ -368,3 +369,12 @@ api_settings_set_int(const char *const group, const char *const key, int value)
|
||||
{
|
||||
plugin_settings_set_int(group, key, value);
|
||||
}
|
||||
|
||||
void
|
||||
api_incoming_message(const char *const barejid, const char *const resource, const char *const message)
|
||||
{
|
||||
sv_ev_incoming_message((char*)barejid, (char*)resource, (char*)message, NULL, NULL);
|
||||
|
||||
// TODO handle all states
|
||||
sv_ev_activity((char*)barejid, (char*)resource, FALSE);
|
||||
}
|
||||
|
@ -79,4 +79,6 @@ void api_settings_set_string(const char *const group, const char *const key, con
|
||||
int api_settings_get_int(const char *const group, const char *const key, int def);
|
||||
void api_settings_set_int(const char *const group, const char *const key, int value);
|
||||
|
||||
void api_incoming_message(const char *const barejid, const char *const resource, const char *const message);
|
||||
|
||||
#endif
|
||||
|
@ -230,6 +230,12 @@ c_api_settings_set_int(char *group, char *key, int value)
|
||||
api_settings_set_int(group, key, value);
|
||||
}
|
||||
|
||||
static void
|
||||
c_api_incoming_message(char *barejid, char *resource, char *message)
|
||||
{
|
||||
api_incoming_message(barejid, resource, message);
|
||||
}
|
||||
|
||||
void
|
||||
c_command_callback(PluginCommand *command, gchar **args)
|
||||
{
|
||||
@ -285,4 +291,5 @@ c_api_init(void)
|
||||
prof_settings_set_string = c_api_settings_set_string;
|
||||
prof_settings_get_int = c_api_settings_get_int;
|
||||
prof_settings_set_int = c_api_settings_set_int;
|
||||
prof_incoming_message = c_api_incoming_message;
|
||||
}
|
||||
|
@ -77,3 +77,5 @@ char* (*prof_settings_get_string)(char *group, char *key, char *def) = NULL;
|
||||
void (*prof_settings_set_string)(char *group, char *key, char *value) = NULL;
|
||||
int (*prof_settings_get_int)(char *group, char *key, int def) = NULL;
|
||||
void (*prof_settings_set_int)(char *group, char *key, int value) = NULL;
|
||||
|
||||
void (*prof_incoming_message)(char *barejid, char *resource, char *message) = NULL;
|
||||
|
@ -78,4 +78,6 @@ void (*prof_settings_set_string)(char *group, char *key, char *value);
|
||||
int (*prof_settings_get_int)(char *group, char *key, int def);
|
||||
void (*prof_settings_set_int)(char *group, char *key, int value);
|
||||
|
||||
void (*prof_incoming_message)(char *barejid, char *resource, char *message);
|
||||
|
||||
#endif
|
||||
|
@ -571,6 +571,24 @@ python_api_settings_set_int(PyObject *self, PyObject *args)
|
||||
return Py_BuildValue("");
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
python_api_incoming_message(PyObject *self, PyObject *args)
|
||||
{
|
||||
char *barejid = NULL;
|
||||
char *resource = NULL;
|
||||
char *message = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "sss", &barejid, &resource, &message)) {
|
||||
return Py_BuildValue("");
|
||||
}
|
||||
|
||||
allow_python_threads();
|
||||
api_incoming_message(barejid, resource, message);
|
||||
disable_python_threads();
|
||||
|
||||
return Py_BuildValue("");
|
||||
}
|
||||
|
||||
void
|
||||
python_command_callback(PluginCommand *command, gchar **args)
|
||||
{
|
||||
@ -661,12 +679,13 @@ static PyMethodDef apiMethods[] = {
|
||||
{ "win_show", python_api_win_show, METH_VARARGS, "Show text in the window." },
|
||||
{ "win_show_themed", python_api_win_show_themed, METH_VARARGS, "Show themed text in the window." },
|
||||
{ "send_stanza", python_api_send_stanza, METH_VARARGS, "Send an XMPP stanza." },
|
||||
{ "settings_get_boolean", python_api_settings_get_boolean, METH_VARARGS, "Get a boolean setting" },
|
||||
{ "settings_set_boolean", python_api_settings_set_boolean, METH_VARARGS, "Set a boolean setting" },
|
||||
{ "settings_get_string", python_api_settings_get_string, METH_VARARGS, "Get a string setting" },
|
||||
{ "settings_set_string", python_api_settings_set_string, METH_VARARGS, "Set a string setting" },
|
||||
{ "settings_get_int", python_api_settings_get_int, METH_VARARGS, "Get a integer setting" },
|
||||
{ "settings_set_int", python_api_settings_set_int, METH_VARARGS, "Set a integer setting" },
|
||||
{ "settings_get_boolean", python_api_settings_get_boolean, METH_VARARGS, "Get a boolean setting." },
|
||||
{ "settings_set_boolean", python_api_settings_set_boolean, METH_VARARGS, "Set a boolean setting." },
|
||||
{ "settings_get_string", python_api_settings_get_string, METH_VARARGS, "Get a string setting." },
|
||||
{ "settings_set_string", python_api_settings_set_string, METH_VARARGS, "Set a string setting." },
|
||||
{ "settings_get_int", python_api_settings_get_int, METH_VARARGS, "Get a integer setting." },
|
||||
{ "settings_set_int", python_api_settings_set_int, METH_VARARGS, "Set a integer setting." },
|
||||
{ "incoming_message", python_api_incoming_message, METH_VARARGS, "Show an incoming message." },
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user