diff --git a/apidocs/c/profhooks.h b/apidocs/c/profhooks.h index 1630a66e..d0beed28 100644 --- a/apidocs/c/profhooks.h +++ b/apidocs/c/profhooks.h @@ -43,17 +43,19 @@ void prof_on_disconnect(const char * const account_name, const char * const full /** Called before a chat message is displayed @param barejid Jabber ID of the message sender +@param resource resource of the message sender @param message the received message @return the new message to display, or NULL to preserve the original message */ -char* prof_pre_chat_message_display(const char * const barejid, const char *message); +char* prof_pre_chat_message_display(const char * const barejid, const char *const resource, const char *message); /** Called after a chat message is displayed @param barejid Jabber ID of the message sender +@param resource resource of the message sender @param message the received message */ -void prof_post_chat_message_display(const char * const barejid, const char *message); +void prof_post_chat_message_display(const char * const barejid, const char *const resource, const char *message); /** Called before a chat message is sent diff --git a/apidocs/python/src/plugin.py b/apidocs/python/src/plugin.py index a9dac2cd..7e22d5e5 100644 --- a/apidocs/python/src/plugin.py +++ b/apidocs/python/src/plugin.py @@ -71,12 +71,14 @@ def prof_on_disconnect(account_name, fulljid): pass -def prof_pre_chat_message_display(barejid, message): +def prof_pre_chat_message_display(barejid, resource, message): """Called before a chat message is displayed :param barejid: Jabber ID of the message sender + :param resource: resource of the message sender :param message: the received message :type barejid: str or unicode + :type resource: str or unicode :type message: str or unicode :return: the new message to display, or ``None`` to preserve the original message :rtype: str or unicode @@ -84,12 +86,14 @@ def prof_pre_chat_message_display(barejid, message): pass -def prof_post_chat_message_display(barejid, message): +def prof_post_chat_message_display(barejid, resource, message): """Called after a chat message is displayed :param barejid: Jabber ID of the message sender + :param resource: resource of the message sender :param message: the received message :type barejid: str or unicode + :type resource: str or unicode :type message: str or unicode """ pass diff --git a/src/plugins/c_plugins.c b/src/plugins/c_plugins.c index d7de7352..688ba312 100644 --- a/src/plugins/c_plugins.c +++ b/src/plugins/c_plugins.c @@ -206,124 +206,124 @@ c_on_disconnect_hook(ProfPlugin *plugin, const char *const account_name, const c } char* -c_pre_chat_message_display_hook(ProfPlugin *plugin, const char *const jid, const char *message) +c_pre_chat_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const resource, const char *message) { void *f = NULL; - char* (*func)(const char *const __jid, const char *__message); + char* (*func)(const char *const __barejid, const char *const __resource, const char *__message); assert(plugin && plugin->module); if (NULL == (f = dlsym(plugin->module, "prof_pre_chat_message_display"))) return NULL; - func = (char* (*)(const char *const, const char *))f; - return func(jid, message); + func = (char* (*)(const char *const, const char *const, const char *))f; + return func(barejid, resource, message); } void -c_post_chat_message_display_hook(ProfPlugin *plugin, const char *const jid, const char *message) +c_post_chat_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const resource, const char *message) { void *f = NULL; - void (*func)(const char *const __jid, const char *__message); + void (*func)(const char *const __barejid, const char *const __resource, const char *__message); assert(plugin && plugin->module); if (NULL == (f = dlsym(plugin->module, "prof_post_chat_message_display"))) return; - func = (void (*)(const char *const, const char *))f; - func(jid, message); + func = (void (*)(const char *const, const char *const, const char *))f; + func(barejid, resource, message); } char* -c_pre_chat_message_send_hook(ProfPlugin *plugin, const char *const jid, const char *message) +c_pre_chat_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *message) { void *f = NULL; - char* (*func)(const char *const __jid, const char *__message); + char* (*func)(const char *const __barejid, const char *__message); assert(plugin && plugin->module); if (NULL == (f = dlsym(plugin->module, "prof_pre_chat_message_send"))) return NULL; func = (char* (*)(const char *const, const char *))f; - return func(jid, message); + return func(barejid, message); } void -c_post_chat_message_send_hook(ProfPlugin *plugin, const char *const jid, const char *message) +c_post_chat_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *message) { void *f = NULL; - void (*func)(const char *const __jid, const char *__message); + void (*func)(const char *const __barejid, const char *__message); assert(plugin && plugin->module); if (NULL == (f = dlsym(plugin->module, "prof_post_chat_message_send"))) return; func = (void (*)(const char *const, const char *))f; - func(jid, message); + func(barejid, message); } char* -c_pre_room_message_display_hook(ProfPlugin *plugin, const char *const room, const char *const nick, const char *message) +c_pre_room_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *message) { void *f = NULL; - char* (*func)(const char *const __room, const char *const __nick, const char *__message); + char* (*func)(const char *const __barejid, const char *const __nick, const char *__message); assert(plugin && plugin->module); if (NULL == (f = dlsym(plugin->module, "prof_pre_room_message_display"))) return NULL; func = (char* (*)(const char *const, const char *const, const char *))f; - return func(room, nick, message); + return func(barejid, nick, message); } void -c_post_room_message_display_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +c_post_room_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *message) { void *f = NULL; - void (*func)(const char *const __room, const char *const __nick, const char *__message); + void (*func)(const char *const __barejid, const char *const __nick, const char *__message); assert(plugin && plugin->module); if (NULL == (f = dlsym(plugin->module, "prof_post_room_message_display"))) return; func = (void (*)(const char *const, const char *const, const char *))f; - func(room, nick, message); + func(barejid, nick, message); } char* -c_pre_room_message_send_hook(ProfPlugin *plugin, const char *const room, const char *message) +c_pre_room_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *message) { void *f = NULL; - char* (*func)(const char *const __room, const char *__message); + char* (*func)(const char *const __barejid, const char *__message); assert(plugin && plugin->module); if (NULL == (f = dlsym(plugin->module, "prof_pre_room_message_send"))) return NULL; func = (char* (*)(const char *const, const char *))f; - return func(room, message); + return func(barejid, message); } void -c_post_room_message_send_hook(ProfPlugin *plugin, const char *const room, const char *message) +c_post_room_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *message) { void *f = NULL; - void (*func)(const char *const __room, const char *__message); + void (*func)(const char *const __barejid, const char *__message); assert(plugin && plugin->module); if (NULL == (f = dlsym(plugin->module, "prof_post_room_message_send"))) return; func = (void (*)(const char *const, const char *))f; - func(room, message); + func(barejid, message); } void -c_on_room_history_message_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +c_on_room_history_message_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *const message, const char *const timestamp) { void *f = NULL; - void (*func)(const char *const __room, const char *const __nick, const char *const __message, + void (*func)(const char *const __barejid, const char *const __nick, const char *const __message, const char *const __timestamp); assert(plugin && plugin->module); @@ -331,64 +331,64 @@ c_on_room_history_message_hook(ProfPlugin *plugin, const char *const room, const return; func = (void (*)(const char *const, const char *const, const char *const, const char *const))f; - func(room, nick, message, timestamp); + func(barejid, nick, message, timestamp); } char* -c_pre_priv_message_display_hook(ProfPlugin *plugin, const char *const room, const char *const nick, const char *message) +c_pre_priv_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *message) { void *f = NULL; - char* (*func)(const char *const __room, const char *const __nick, const char *__message); + char* (*func)(const char *const __barejid, const char *const __nick, const char *__message); assert(plugin && plugin->module); if (NULL == (f = dlsym(plugin->module, "prof_pre_priv_message_display"))) return NULL; func = (char* (*)(const char *const, const char *const, const char *))f; - return func(room, nick, message); + return func(barejid, nick, message); } void -c_post_priv_message_display_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +c_post_priv_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *message) { void *f = NULL; - void (*func)(const char *const __room, const char *const __nick, const char *__message); + void (*func)(const char *const __barejid, const char *const __nick, const char *__message); assert(plugin && plugin->module); if (NULL == (f = dlsym(plugin->module, "prof_post_priv_message_display"))) return; func = (void (*)(const char *const, const char *const, const char *))f; - func(room, nick, message); + func(barejid, nick, message); } char* -c_pre_priv_message_send_hook(ProfPlugin *plugin, const char *const room, const char *const nick, const char *message) +c_pre_priv_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *message) { void *f = NULL; - char* (*func)(const char *const __room, const char *const __nick, const char *__message); + char* (*func)(const char *const __barejid, const char *const __nick, const char *__message); assert(plugin && plugin->module); if (NULL == (f = dlsym(plugin->module, "prof_pre_priv_message_send"))) return NULL; func = (char* (*)(const char *const, const char *const, const char *))f; - return func(room, nick, message); + return func(barejid, nick, message); } void -c_post_priv_message_send_hook(ProfPlugin *plugin, const char *const room, const char *const nick, const char *message) +c_post_priv_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *message) { void *f = NULL; - void (*func)(const char *const __room, const char *const __nick, const char *__message); + void (*func)(const char *const __barejid, const char *const __nick, const char *__message); assert(plugin && plugin->module); if (NULL == (f = dlsym(plugin->module, "prof_post_priv_message_send"))) return; func = (void (*)(const char *const, const char *const, const char *))f; - func(room, nick, message); + func(barejid, nick, message); } char* @@ -521,17 +521,17 @@ c_on_chat_win_focus_hook(ProfPlugin *plugin, const char *const barejid) } void -c_on_room_win_focus_hook(ProfPlugin *plugin, const char *const roomjid) +c_on_room_win_focus_hook(ProfPlugin *plugin, const char *const barejid) { void *f = NULL; - void (*func)(const char *const __roomjid); + void (*func)(const char *const __barejid); assert(plugin && plugin->module); if (NULL == (f = dlsym(plugin->module, "prof_on_room_win_focus"))) return; func = (void (*)(const char *const))f; - func(roomjid); + func(barejid); } void diff --git a/src/plugins/c_plugins.h b/src/plugins/c_plugins.h index 80c3ffe7..c802d5a5 100644 --- a/src/plugins/c_plugins.h +++ b/src/plugins/c_plugins.h @@ -51,27 +51,27 @@ void c_on_unload_hook(ProfPlugin *plugin); void c_on_connect_hook(ProfPlugin *plugin, const char *const account_name, const char *const fulljid); void c_on_disconnect_hook(ProfPlugin *plugin, const char *const account_name, const char *const fulljid); -char* c_pre_chat_message_display_hook(ProfPlugin *plugin, const char *const jid, const char *message); -void c_post_chat_message_display_hook(ProfPlugin *plugin, const char *const jid, const char *message); -char* c_pre_chat_message_send_hook(ProfPlugin *plugin, const char *const jid, const char *message); -void c_post_chat_message_send_hook(ProfPlugin *plugin, const char *const jid, const char *message); +char* c_pre_chat_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const resource, const char *message); +void c_post_chat_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const resource, const char *message); +char* c_pre_chat_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *message); +void c_post_chat_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *message); -char* c_pre_room_message_display_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +char* c_pre_room_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *message); -void c_post_room_message_display_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +void c_post_room_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *message); -char* c_pre_room_message_send_hook(ProfPlugin *plugin, const char *const room, const char *message); -void c_post_room_message_send_hook(ProfPlugin *plugin, const char *const room, const char *message); -void c_on_room_history_message_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +char* c_pre_room_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *message); +void c_post_room_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *message); +void c_on_room_history_message_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *const message, const char *const timestamp); -char* c_pre_priv_message_display_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +char* c_pre_priv_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *message); -void c_post_priv_message_display_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +void c_post_priv_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *message); -char* c_pre_priv_message_send_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +char* c_pre_priv_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *const message); -void c_post_priv_message_send_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +void c_post_priv_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char * const message); char* c_on_message_stanza_send_hook(ProfPlugin *plugin, const char *const text); @@ -89,6 +89,6 @@ void c_on_contact_presence_hook(ProfPlugin *plugin, const char *const barejid, c const char *const presence, const char *const status, const int priority); void c_on_chat_win_focus_hook(ProfPlugin *plugin, const char *const barejid); -void c_on_room_win_focus_hook(ProfPlugin *plugin, const char *const roomjid); +void c_on_room_win_focus_hook(ProfPlugin *plugin, const char *const barejid); #endif diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c index 0505be6d..21dd0422 100644 --- a/src/plugins/plugins.c +++ b/src/plugins/plugins.c @@ -359,7 +359,7 @@ plugins_on_disconnect(const char * const account_name, const char * const fullji } char* -plugins_pre_chat_message_display(const char * const barejid, const char *message) +plugins_pre_chat_message_display(const char * const barejid, const char *const resource, const char *message) { char *new_message = NULL; char *curr_message = strdup(message); @@ -368,7 +368,7 @@ plugins_pre_chat_message_display(const char * const barejid, const char *message GList *curr = values; while (curr) { ProfPlugin *plugin = curr->data; - new_message = plugin->pre_chat_message_display(plugin, barejid, curr_message); + new_message = plugin->pre_chat_message_display(plugin, barejid, resource, curr_message); if (new_message) { free(curr_message); curr_message = strdup(new_message); @@ -382,13 +382,13 @@ plugins_pre_chat_message_display(const char * const barejid, const char *message } void -plugins_post_chat_message_display(const char * const barejid, const char *message) +plugins_post_chat_message_display(const char * const barejid, const char *const resource, const char *message) { GList *values = g_hash_table_get_values(plugins); GList *curr = values; while (curr) { ProfPlugin *plugin = curr->data; - plugin->post_chat_message_display(plugin, barejid, message); + plugin->post_chat_message_display(plugin, barejid, resource, message); curr = g_list_next(curr); } g_list_free(values); diff --git a/src/plugins/plugins.h b/src/plugins/plugins.h index f3ed4082..b7fdf297 100644 --- a/src/plugins/plugins.h +++ b/src/plugins/plugins.h @@ -57,27 +57,27 @@ typedef struct prof_plugin_t { void (*on_disconnect_func)(struct prof_plugin_t* plugin, const char *const account_name, const char *const fulljid); - char* (*pre_chat_message_display)(struct prof_plugin_t* plugin, const char *const jid, const char *message); - void (*post_chat_message_display)(struct prof_plugin_t* plugin, const char *const jid, const char *message); - char* (*pre_chat_message_send)(struct prof_plugin_t* plugin, const char *const jid, const char *message); - void (*post_chat_message_send)(struct prof_plugin_t* plugin, const char *const jid, const char *message); + char* (*pre_chat_message_display)(struct prof_plugin_t* plugin, const char *const barejid, const char *const resource, const char *message); + void (*post_chat_message_display)(struct prof_plugin_t* plugin, const char *const barejid, const char *const resource, const char *message); + char* (*pre_chat_message_send)(struct prof_plugin_t* plugin, const char *const barejid, const char *message); + void (*post_chat_message_send)(struct prof_plugin_t* plugin, const char *const barejid, const char *message); - char* (*pre_room_message_display)(struct prof_plugin_t* plugin, const char *const room, const char *const nick, + char* (*pre_room_message_display)(struct prof_plugin_t* plugin, const char *const barejid, const char *const nick, const char *message); - void (*post_room_message_display)(struct prof_plugin_t* plugin, const char *const room, const char *const nick, + void (*post_room_message_display)(struct prof_plugin_t* plugin, const char *const barejid, const char *const nick, const char *message); - char* (*pre_room_message_send)(struct prof_plugin_t* plugin, const char *const room, const char *message); - void (*post_room_message_send)(struct prof_plugin_t* plugin, const char *const room, const char *message); - void (*on_room_history_message)(struct prof_plugin_t* plugin, const char *const room, const char *const nick, const char *const message, + char* (*pre_room_message_send)(struct prof_plugin_t* plugin, const char *const barejid, const char *message); + void (*post_room_message_send)(struct prof_plugin_t* plugin, const char *const barejid, const char *message); + void (*on_room_history_message)(struct prof_plugin_t* plugin, const char *const barejid, const char *const nick, const char *const message, const char *const timestamp); - char* (*pre_priv_message_display)(struct prof_plugin_t* plugin, const char *const room, const char *const nick, + char* (*pre_priv_message_display)(struct prof_plugin_t* plugin, const char *const barejid, const char *const nick, const char *message); - void (*post_priv_message_display)(struct prof_plugin_t* plugin, const char *const room, const char *const nick, + void (*post_priv_message_display)(struct prof_plugin_t* plugin, const char *const barejid, const char *const nick, const char *message); - char* (*pre_priv_message_send)(struct prof_plugin_t* plugin, const char *const room, const char *const nick, + char* (*pre_priv_message_send)(struct prof_plugin_t* plugin, const char *const barejid, const char *const nick, const char *const message); - void (*post_priv_message_send)(struct prof_plugin_t* plugin, const char *const room, const char *const nick, + void (*post_priv_message_send)(struct prof_plugin_t* plugin, const char *const barejid, const char *const nick, const char *const message); char* (*on_message_stanza_send)(struct prof_plugin_t* plugin, const char *const text); @@ -95,7 +95,7 @@ typedef struct prof_plugin_t { const char *const presence, const char *const status, const int priority); void (*on_chat_win_focus)(struct prof_plugin_t* plugin, const char *const barejid); - void (*on_room_win_focus)(struct prof_plugin_t* plugin, const char *const roomjid); + void (*on_room_win_focus)(struct prof_plugin_t* plugin, const char *const barejid); } ProfPlugin; void plugins_init(void); @@ -117,8 +117,8 @@ void plugins_on_shutdown(void); void plugins_on_connect(const char *const account_name, const char *const fulljid); void plugins_on_disconnect(const char *const account_name, const char *const fulljid); -char* plugins_pre_chat_message_display(const char *const barejid, const char *message); -void plugins_post_chat_message_display(const char *const barejid, const char *message); +char* plugins_pre_chat_message_display(const char *const barejid, const char *const resource, const char *message); +void plugins_post_chat_message_display(const char *const barejid, const char *const resource, const char *message); char* plugins_pre_chat_message_send(const char *const barejid, const char *message); void plugins_post_chat_message_send(const char *const barejid, const char *message); diff --git a/src/plugins/python_plugins.c b/src/plugins/python_plugins.c index 988437f5..75bbcce5 100644 --- a/src/plugins/python_plugins.c +++ b/src/plugins/python_plugins.c @@ -277,10 +277,11 @@ python_on_disconnect_hook(ProfPlugin *plugin, const char *const account_name, co } char* -python_pre_chat_message_display_hook(ProfPlugin *plugin, const char *const jid, const char *message) +python_pre_chat_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const resource, + const char *message) { disable_python_threads(); - PyObject *p_args = Py_BuildValue("ss", jid, message); + PyObject *p_args = Py_BuildValue("sss", barejid, resource, message); PyObject *p_function; PyObject *p_module = plugin->module; @@ -304,10 +305,10 @@ python_pre_chat_message_display_hook(ProfPlugin *plugin, const char *const jid, } void -python_post_chat_message_display_hook(ProfPlugin *plugin, const char *const jid, const char *message) +python_post_chat_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const resource, const char *message) { disable_python_threads(); - PyObject *p_args = Py_BuildValue("ss", jid, message); + PyObject *p_args = Py_BuildValue("sss", barejid, resource, message); PyObject *p_function; PyObject *p_module = plugin->module; @@ -325,10 +326,10 @@ python_post_chat_message_display_hook(ProfPlugin *plugin, const char *const jid, } char* -python_pre_chat_message_send_hook(ProfPlugin *plugin, const char * const jid, const char *message) +python_pre_chat_message_send_hook(ProfPlugin *plugin, const char * const barejid, const char *message) { disable_python_threads(); - PyObject *p_args = Py_BuildValue("ss", jid, message); + PyObject *p_args = Py_BuildValue("ss", barejid, message); PyObject *p_function; PyObject *p_module = plugin->module; @@ -352,10 +353,10 @@ python_pre_chat_message_send_hook(ProfPlugin *plugin, const char * const jid, co } void -python_post_chat_message_send_hook(ProfPlugin *plugin, const char *const jid, const char *message) +python_post_chat_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *message) { disable_python_threads(); - PyObject *p_args = Py_BuildValue("ss", jid, message); + PyObject *p_args = Py_BuildValue("ss", barejid, message); PyObject *p_function; PyObject *p_module = plugin->module; @@ -373,10 +374,10 @@ python_post_chat_message_send_hook(ProfPlugin *plugin, const char *const jid, co } char* -python_pre_room_message_display_hook(ProfPlugin *plugin, const char * const room, const char * const nick, const char *message) +python_pre_room_message_display_hook(ProfPlugin *plugin, const char * const barejid, const char * const nick, const char *message) { disable_python_threads(); - PyObject *p_args = Py_BuildValue("sss", room, nick, message); + PyObject *p_args = Py_BuildValue("sss", barejid, nick, message); PyObject *p_function; PyObject *p_module = plugin->module; @@ -400,11 +401,11 @@ python_pre_room_message_display_hook(ProfPlugin *plugin, const char * const room } void -python_post_room_message_display_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +python_post_room_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *message) { disable_python_threads(); - PyObject *p_args = Py_BuildValue("sss", room, nick, message); + PyObject *p_args = Py_BuildValue("sss", barejid, nick, message); PyObject *p_function; PyObject *p_module = plugin->module; @@ -422,10 +423,10 @@ python_post_room_message_display_hook(ProfPlugin *plugin, const char *const room } char* -python_pre_room_message_send_hook(ProfPlugin *plugin, const char *const room, const char *message) +python_pre_room_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *message) { disable_python_threads(); - PyObject *p_args = Py_BuildValue("ss", room, message); + PyObject *p_args = Py_BuildValue("ss", barejid, message); PyObject *p_function; PyObject *p_module = plugin->module; @@ -449,10 +450,10 @@ python_pre_room_message_send_hook(ProfPlugin *plugin, const char *const room, co } void -python_post_room_message_send_hook(ProfPlugin *plugin, const char *const room, const char *message) +python_post_room_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *message) { disable_python_threads(); - PyObject *p_args = Py_BuildValue("ss", room, message); + PyObject *p_args = Py_BuildValue("ss", barejid, message); PyObject *p_function; PyObject *p_module = plugin->module; @@ -470,11 +471,11 @@ python_post_room_message_send_hook(ProfPlugin *plugin, const char *const room, c } void -python_on_room_history_message_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +python_on_room_history_message_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *const message, const char *const timestamp) { disable_python_threads(); - PyObject *p_args = Py_BuildValue("ssss", room, nick, message, timestamp); + PyObject *p_args = Py_BuildValue("ssss", barejid, nick, message, timestamp); PyObject *p_function; PyObject *p_module = plugin->module; @@ -492,11 +493,11 @@ python_on_room_history_message_hook(ProfPlugin *plugin, const char *const room, } char* -python_pre_priv_message_display_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +python_pre_priv_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *message) { disable_python_threads(); - PyObject *p_args = Py_BuildValue("sss", room, nick, message); + PyObject *p_args = Py_BuildValue("sss", barejid, nick, message); PyObject *p_function; PyObject *p_module = plugin->module; @@ -520,11 +521,11 @@ python_pre_priv_message_display_hook(ProfPlugin *plugin, const char *const room, } void -python_post_priv_message_display_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +python_post_priv_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *message) { disable_python_threads(); - PyObject *p_args = Py_BuildValue("sss", room, nick, message); + PyObject *p_args = Py_BuildValue("sss", barejid, nick, message); PyObject *p_function; PyObject *p_module = plugin->module; @@ -542,11 +543,11 @@ python_post_priv_message_display_hook(ProfPlugin *plugin, const char *const room } char* -python_pre_priv_message_send_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +python_pre_priv_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *const message) { disable_python_threads(); - PyObject *p_args = Py_BuildValue("sss", room, nick, message); + PyObject *p_args = Py_BuildValue("sss", barejid, nick, message); PyObject *p_function; PyObject *p_module = plugin->module; @@ -570,11 +571,11 @@ python_pre_priv_message_send_hook(ProfPlugin *plugin, const char *const room, co } void -python_post_priv_message_send_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +python_post_priv_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *const message) { disable_python_threads(); - PyObject *p_args = Py_BuildValue("sss", room, nick, message); + PyObject *p_args = Py_BuildValue("sss", barejid, nick, message); PyObject *p_function; PyObject *p_module = plugin->module; @@ -828,10 +829,10 @@ python_on_chat_win_focus_hook(ProfPlugin *plugin, const char *const barejid) } void -python_on_room_win_focus_hook(ProfPlugin *plugin, const char *const roomjid) +python_on_room_win_focus_hook(ProfPlugin *plugin, const char *const barejid) { disable_python_threads(); - PyObject *p_args = Py_BuildValue("(s)", roomjid); + PyObject *p_args = Py_BuildValue("(s)", barejid); PyObject *p_function; PyObject *p_module = plugin->module; diff --git a/src/plugins/python_plugins.h b/src/plugins/python_plugins.h index f0ac48a5..0969b700 100644 --- a/src/plugins/python_plugins.h +++ b/src/plugins/python_plugins.h @@ -53,27 +53,27 @@ void python_on_unload_hook(ProfPlugin *plugin); void python_on_connect_hook(ProfPlugin *plugin, const char *const account_name, const char *const fulljid); void python_on_disconnect_hook(ProfPlugin *plugin, const char *const account_name, const char *const fulljid); -char* python_pre_chat_message_display_hook(ProfPlugin *plugin, const char *const jid, const char *message); -void python_post_chat_message_display_hook(ProfPlugin *plugin, const char *const jid, const char *message); -char* python_pre_chat_message_send_hook(ProfPlugin *plugin, const char *const jid, const char *message); -void python_post_chat_message_send_hook(ProfPlugin *plugin, const char *const jid, const char *message); +char* python_pre_chat_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const resource, const char *message); +void python_post_chat_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const resource, const char *message); +char* python_pre_chat_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *message); +void python_post_chat_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *message); -char* python_pre_room_message_display_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +char* python_pre_room_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *message); -void python_post_room_message_display_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +void python_post_room_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *message); -char* python_pre_room_message_send_hook(ProfPlugin *plugin, const char *const room, const char *message); -void python_post_room_message_send_hook(ProfPlugin *plugin, const char *const room, const char *message); -void python_on_room_history_message_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +char* python_pre_room_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *message); +void python_post_room_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *message); +void python_on_room_history_message_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *const message, const char *const timestamp); -char* python_pre_priv_message_display_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +char* python_pre_priv_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *message); -void python_post_priv_message_display_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +void python_post_priv_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *message); -char* python_pre_priv_message_send_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +char* python_pre_priv_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *const message); -void python_post_priv_message_send_hook(ProfPlugin *plugin, const char *const room, const char *const nick, +void python_post_priv_message_send_hook(ProfPlugin *plugin, const char *const barejid, const char *const nick, const char *const message); char* python_on_message_stanza_send_hook(ProfPlugin *plugin, const char *const text); @@ -89,6 +89,6 @@ void python_on_contact_presence_hook(ProfPlugin *plugin, const char *const barej const char *const presence, const char *const status, const int priority); void python_on_chat_win_focus_hook(ProfPlugin *plugin, const char *const barejid); -void python_on_room_win_focus_hook(ProfPlugin *plugin, const char *const roomjid); +void python_on_room_win_focus_hook(ProfPlugin *plugin, const char *const barejid); #endif diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index ca428821..32d8b79c 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -235,7 +235,7 @@ chatwin_incoming_msg(ProfChatWin *chatwin, const char *const resource, const cha { assert(chatwin != NULL); - char *plugin_message = plugins_pre_chat_message_display(chatwin->barejid, message); + char *plugin_message = plugins_pre_chat_message_display(chatwin->barejid, resource, message); ProfWin *window = (ProfWin*)chatwin; int num = wins_get_num(window); @@ -287,7 +287,7 @@ chatwin_incoming_msg(ProfChatWin *chatwin, const char *const resource, const cha free(display_name); - plugins_post_chat_message_display(chatwin->barejid, plugin_message); + plugins_post_chat_message_display(chatwin->barejid, resource, plugin_message); free(plugin_message); }