mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Renamed hook on_message -> on_message_received
This commit is contained in:
parent
eead7ea7e3
commit
eadb90dc43
@ -14,7 +14,7 @@ def prof_init(version, status):
|
||||
"the last received URL will be used.",
|
||||
cmd_browser)
|
||||
|
||||
def prof_on_message(jid, message):
|
||||
def prof_on_message_received(jid, message):
|
||||
global lastlink
|
||||
links = re.findall(r'(https?://\S+)', message)
|
||||
if (len(links) > 0):
|
||||
|
@ -88,12 +88,12 @@ plugins_on_connect(void)
|
||||
}
|
||||
|
||||
void
|
||||
plugins_on_message(const char * const jid, const char * const message)
|
||||
plugins_on_message_received(const char * const jid, const char * const message)
|
||||
{
|
||||
GSList *curr = plugins;
|
||||
while (curr != NULL) {
|
||||
ProfPlugin *plugin = curr->data;
|
||||
plugin->on_message_func(plugin, jid, message);
|
||||
plugin->on_message_received_func(plugin, jid, message);
|
||||
curr = g_slist_next(curr);
|
||||
}
|
||||
}
|
||||
|
@ -35,14 +35,14 @@ typedef struct prof_plugin_t {
|
||||
const char * const status);
|
||||
void (*on_start_func)(struct prof_plugin_t* plugin);
|
||||
void (*on_connect_func)(struct prof_plugin_t* plugin);
|
||||
void (*on_message_func)(struct prof_plugin_t* plugin,
|
||||
void (*on_message_received_func)(struct prof_plugin_t* plugin,
|
||||
const char * const jid, const char * const message);
|
||||
} ProfPlugin;
|
||||
|
||||
void plugins_init(void);
|
||||
void plugins_on_start(void);
|
||||
void plugins_on_connect(void);
|
||||
void plugins_on_message(const char * const jid, const char * const message);
|
||||
void plugins_on_message_received(const char * const jid, const char * const message);
|
||||
void plugins_shutdown(void);
|
||||
gboolean plugins_run_command(const char * const cmd);
|
||||
void plugins_run_timed(void);
|
||||
|
@ -59,7 +59,7 @@ python_plugin_create(const char * const filename)
|
||||
plugin->init_func = python_init_hook;
|
||||
plugin->on_start_func = python_on_start_hook;
|
||||
plugin->on_connect_func = python_on_connect_hook;
|
||||
plugin->on_message_func = python_on_message_hook;
|
||||
plugin->on_message_received_func = python_on_message_received_hook;
|
||||
g_free(module_name);
|
||||
return plugin;
|
||||
} else {
|
||||
@ -121,14 +121,14 @@ python_on_connect_hook(ProfPlugin *plugin)
|
||||
}
|
||||
|
||||
void
|
||||
python_on_message_hook(ProfPlugin *plugin, const char * const jid, const char * const message)
|
||||
python_on_message_received_hook(ProfPlugin *plugin, const char * const jid, const char * const message)
|
||||
{
|
||||
PyObject *p_args = Py_BuildValue("ss", jid, message);
|
||||
PyObject *p_function;
|
||||
|
||||
PyObject *p_module = plugin->module;
|
||||
if (PyObject_HasAttrString(p_module, "prof_on_message")) {
|
||||
p_function = PyObject_GetAttrString(p_module, "prof_on_message");
|
||||
if (PyObject_HasAttrString(p_module, "prof_on_message_received")) {
|
||||
p_function = PyObject_GetAttrString(p_module, "prof_on_message_received");
|
||||
python_check_error();
|
||||
if (p_function && PyCallable_Check(p_function)) {
|
||||
PyObject_CallObject(p_function, p_args);
|
||||
|
@ -30,7 +30,7 @@ ProfPlugin* python_plugin_create(const char * const filename);
|
||||
void python_init_hook(ProfPlugin *plugin, const char * const version, const char * const status);
|
||||
void python_on_start_hook(ProfPlugin *plugin);
|
||||
void python_on_connect_hook(ProfPlugin *plugin);
|
||||
void python_on_message_hook(ProfPlugin *plugin, const char * const jid, const char * const message);
|
||||
void python_on_message_received_hook(ProfPlugin *plugin, const char * const jid, const char * const message);
|
||||
|
||||
void python_check_error(void);
|
||||
|
||||
|
@ -119,7 +119,7 @@ prof_handle_incoming_message(char *from, char *message, gboolean priv)
|
||||
ui_incoming_msg(from, message, NULL, priv);
|
||||
ui_current_page_off();
|
||||
|
||||
plugins_on_message(from, message);
|
||||
plugins_on_message_received(from, message);
|
||||
|
||||
if (prefs_get_boolean(PREF_CHLOG) && !priv) {
|
||||
Jid *from_jid = jid_create(from);
|
||||
@ -138,7 +138,7 @@ prof_handle_delayed_message(char *from, char *message, GTimeVal tv_stamp,
|
||||
ui_incoming_msg(from, message, &tv_stamp, priv);
|
||||
ui_current_page_off();
|
||||
|
||||
plugins_on_message(from, message);
|
||||
plugins_on_message_received(from, message);
|
||||
|
||||
if (prefs_get_boolean(PREF_CHLOG) && !priv) {
|
||||
Jid *from_jid = jid_create(from);
|
||||
|
Loading…
Reference in New Issue
Block a user