1
0
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:
James Booth 2013-08-18 00:26:14 +01:00
parent eead7ea7e3
commit eadb90dc43
6 changed files with 12 additions and 12 deletions

View File

@ -14,7 +14,7 @@ def prof_init(version, status):
"the last received URL will be used.", "the last received URL will be used.",
cmd_browser) cmd_browser)
def prof_on_message(jid, message): def prof_on_message_received(jid, message):
global lastlink global lastlink
links = re.findall(r'(https?://\S+)', message) links = re.findall(r'(https?://\S+)', message)
if (len(links) > 0): if (len(links) > 0):

View File

@ -88,12 +88,12 @@ plugins_on_connect(void)
} }
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; GSList *curr = plugins;
while (curr != NULL) { while (curr != NULL) {
ProfPlugin *plugin = curr->data; ProfPlugin *plugin = curr->data;
plugin->on_message_func(plugin, jid, message); plugin->on_message_received_func(plugin, jid, message);
curr = g_slist_next(curr); curr = g_slist_next(curr);
} }
} }

View File

@ -35,14 +35,14 @@ typedef struct prof_plugin_t {
const char * const status); const char * const status);
void (*on_start_func)(struct prof_plugin_t* plugin); void (*on_start_func)(struct prof_plugin_t* plugin);
void (*on_connect_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); const char * const jid, const char * const message);
} ProfPlugin; } ProfPlugin;
void plugins_init(void); void plugins_init(void);
void plugins_on_start(void); void plugins_on_start(void);
void plugins_on_connect(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); void plugins_shutdown(void);
gboolean plugins_run_command(const char * const cmd); gboolean plugins_run_command(const char * const cmd);
void plugins_run_timed(void); void plugins_run_timed(void);

View File

@ -59,7 +59,7 @@ python_plugin_create(const char * const filename)
plugin->init_func = python_init_hook; plugin->init_func = python_init_hook;
plugin->on_start_func = python_on_start_hook; plugin->on_start_func = python_on_start_hook;
plugin->on_connect_func = python_on_connect_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); g_free(module_name);
return plugin; return plugin;
} else { } else {
@ -121,14 +121,14 @@ python_on_connect_hook(ProfPlugin *plugin)
} }
void 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_args = Py_BuildValue("ss", jid, message);
PyObject *p_function; PyObject *p_function;
PyObject *p_module = plugin->module; PyObject *p_module = plugin->module;
if (PyObject_HasAttrString(p_module, "prof_on_message")) { if (PyObject_HasAttrString(p_module, "prof_on_message_received")) {
p_function = PyObject_GetAttrString(p_module, "prof_on_message"); p_function = PyObject_GetAttrString(p_module, "prof_on_message_received");
python_check_error(); python_check_error();
if (p_function && PyCallable_Check(p_function)) { if (p_function && PyCallable_Check(p_function)) {
PyObject_CallObject(p_function, p_args); PyObject_CallObject(p_function, p_args);

View File

@ -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_init_hook(ProfPlugin *plugin, const char * const version, const char * const status);
void python_on_start_hook(ProfPlugin *plugin); void python_on_start_hook(ProfPlugin *plugin);
void python_on_connect_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); void python_check_error(void);

View File

@ -119,7 +119,7 @@ prof_handle_incoming_message(char *from, char *message, gboolean priv)
ui_incoming_msg(from, message, NULL, priv); ui_incoming_msg(from, message, NULL, priv);
ui_current_page_off(); ui_current_page_off();
plugins_on_message(from, message); plugins_on_message_received(from, message);
if (prefs_get_boolean(PREF_CHLOG) && !priv) { if (prefs_get_boolean(PREF_CHLOG) && !priv) {
Jid *from_jid = jid_create(from); 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_incoming_msg(from, message, &tv_stamp, priv);
ui_current_page_off(); ui_current_page_off();
plugins_on_message(from, message); plugins_on_message_received(from, message);
if (prefs_get_boolean(PREF_CHLOG) && !priv) { if (prefs_get_boolean(PREF_CHLOG) && !priv) {
Jid *from_jid = jid_create(from); Jid *from_jid = jid_create(from);