Revert API change of plugins_pre_chat_message_display()
In order to keep the C plugins API stable, we have to revert this part of
the changes done in 16ed7cc187.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
@@ -515,15 +515,15 @@ plugins_on_disconnect(const char* const account_name, const char* const fulljid)
|
||||
}
|
||||
|
||||
char*
|
||||
plugins_pre_chat_message_display(const char* const barejid, const char* const resource, char* message)
|
||||
plugins_pre_chat_message_display(const char* const barejid, const char* const resource, const char* message)
|
||||
{
|
||||
GList* values = g_hash_table_get_values(plugins);
|
||||
if (!values) {
|
||||
return message;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char* new_message = NULL;
|
||||
char* curr_message = message;
|
||||
char* curr_message = strdup(message);
|
||||
|
||||
GList* curr = values;
|
||||
while (curr) {
|
||||
|
||||
@@ -132,7 +132,7 @@ void plugins_on_start(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* const resource, 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);
|
||||
|
||||
@@ -307,9 +307,9 @@ chatwin_incoming_msg(ProfChatWin* chatwin, ProfMessage* message, gboolean win_cr
|
||||
}
|
||||
|
||||
char* old_plain = message->plain;
|
||||
|
||||
auto_char char* new_plain = plugins_pre_chat_message_display(message->from_jid->barejid, message->from_jid->resourcepart, strdup(message->plain));
|
||||
message->plain = new_plain;
|
||||
auto_char char* new_plain = plugins_pre_chat_message_display(message->from_jid->barejid, message->from_jid->resourcepart, message->plain);
|
||||
if (new_plain)
|
||||
message->plain = new_plain;
|
||||
|
||||
gboolean show_message = true;
|
||||
|
||||
@@ -414,7 +414,8 @@ chatwin_outgoing_msg(ProfChatWin* chatwin, const char* const message, char* id,
|
||||
auto_char char* enc_char = get_enc_char(enc_mode, chatwin->outgoing_char);
|
||||
|
||||
const Jid* myjid = connection_get_jid();
|
||||
auto_char char* display_message = plugins_pre_chat_message_display(myjid->barejid, myjid->resourcepart, strdup(message));
|
||||
auto_char char* plugin_message = plugins_pre_chat_message_display(myjid->barejid, myjid->resourcepart, message);
|
||||
const char* display_message = plugin_message ?: message;
|
||||
|
||||
if (request_receipt && id) {
|
||||
win_print_outgoing_with_receipt((ProfWin*)chatwin, enc_char, "me", display_message, id, replace_id);
|
||||
@@ -565,8 +566,12 @@ _chatwin_history(ProfChatWin* chatwin, const char* const contact_barejid)
|
||||
|
||||
while (curr) {
|
||||
ProfMessage* msg = curr->data;
|
||||
msg->plain = plugins_pre_chat_message_display(msg->from_jid->barejid, msg->from_jid->resourcepart, msg->plain);
|
||||
char* old_plain = msg->plain;
|
||||
auto_char char* plugin_msg = plugins_pre_chat_message_display(msg->from_jid->barejid, msg->from_jid->resourcepart, msg->plain);
|
||||
if (plugin_msg)
|
||||
msg->plain = plugin_msg;
|
||||
win_print_history((ProfWin*)chatwin, msg);
|
||||
msg->plain = old_plain;
|
||||
curr = g_slist_next(curr);
|
||||
}
|
||||
chatwin->history_shown = TRUE;
|
||||
@@ -591,12 +596,16 @@ chatwin_db_history(ProfChatWin* chatwin, const char* start_time, char* end_time,
|
||||
|
||||
while (curr) {
|
||||
ProfMessage* msg = curr->data;
|
||||
msg->plain = plugins_pre_chat_message_display(msg->from_jid->barejid, msg->from_jid->resourcepart, msg->plain);
|
||||
char* old_plain = msg->plain;
|
||||
auto_char char* plugin_msg = plugins_pre_chat_message_display(msg->from_jid->barejid, msg->from_jid->resourcepart, msg->plain);
|
||||
if (plugin_msg)
|
||||
msg->plain = plugin_msg;
|
||||
if (flip) {
|
||||
win_print_old_history((ProfWin*)chatwin, msg);
|
||||
} else {
|
||||
win_print_history((ProfWin*)chatwin, msg);
|
||||
}
|
||||
msg->plain = old_plain;
|
||||
curr = g_slist_next(curr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user