1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'issue/1220-remove-rtl'

This commit is contained in:
Michael Vetter 2019-11-13 09:39:29 +01:00
commit ccb4d919b1

View File

@ -68,6 +68,8 @@
#include "ui/ui.h" #include "ui/ui.h"
static void _clean_incoming_message(ProfMessage *message);
void void
sv_ev_login_account_success(char *account_name, gboolean secured) sv_ev_login_account_success(char *account_name, gboolean secured)
{ {
@ -326,6 +328,7 @@ sv_ev_room_message(ProfMessage *message)
GList *triggers = prefs_message_get_triggers(message->plain); GList *triggers = prefs_message_get_triggers(message->plain);
_clean_incoming_message(message);
mucwin_incoming_msg(mucwin, message, mentions, triggers); mucwin_incoming_msg(mucwin, message, mentions, triggers);
g_slist_free(mentions); g_slist_free(mentions);
@ -397,6 +400,8 @@ sv_ev_incoming_private_message(ProfMessage *message)
ProfWin *window = wins_new_private(message->jid->fulljid); ProfWin *window = wins_new_private(message->jid->fulljid);
privatewin = (ProfPrivateWin*)window; privatewin = (ProfPrivateWin*)window;
} }
_clean_incoming_message(message);
privwin_incoming_msg(privatewin, message); privwin_incoming_msg(privatewin, message);
chat_log_msg_in(message); chat_log_msg_in(message);
@ -418,6 +423,8 @@ sv_ev_delayed_private_message(ProfMessage *message)
ProfWin *window = wins_new_private(message->jid->fulljid); ProfWin *window = wins_new_private(message->jid->fulljid);
privatewin = (ProfPrivateWin*)window; privatewin = (ProfPrivateWin*)window;
} }
_clean_incoming_message(message);
privwin_incoming_msg(privatewin, message); privwin_incoming_msg(privatewin, message);
chat_log_msg_in(message); chat_log_msg_in(message);
@ -529,6 +536,7 @@ _sv_ev_incoming_pgp(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message
message->plain = p_gpg_decrypt(message->encrypted); message->plain = p_gpg_decrypt(message->encrypted);
if (message->plain) { if (message->plain) {
message->enc = PROF_MSG_ENC_PGP; message->enc = PROF_MSG_ENC_PGP;
_clean_incoming_message(message);
chatwin_incoming_msg(chatwin, message, new_win); chatwin_incoming_msg(chatwin, message, new_win);
if (logit) { if (logit) {
chat_log_pgp_msg_in(message); chat_log_pgp_msg_in(message);
@ -543,6 +551,7 @@ _sv_ev_incoming_pgp(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message
} }
message->enc = PROF_MSG_ENC_PLAIN; message->enc = PROF_MSG_ENC_PLAIN;
message->plain = strdup(message->body); message->plain = strdup(message->body);
_clean_incoming_message(message);
chatwin_incoming_msg(chatwin, message, new_win); chatwin_incoming_msg(chatwin, message, new_win);
chat_log_msg_in(message); chat_log_msg_in(message);
chatwin->pgp_recv = FALSE; chatwin->pgp_recv = FALSE;
@ -564,6 +573,7 @@ _sv_ev_incoming_otr(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message
message->enc = PROF_MSG_ENC_PLAIN; message->enc = PROF_MSG_ENC_PLAIN;
} }
_clean_incoming_message(message);
chatwin_incoming_msg(chatwin, message, new_win); chatwin_incoming_msg(chatwin, message, new_win);
chat_log_otr_msg_in(message); chat_log_otr_msg_in(message);
@ -578,6 +588,7 @@ _sv_ev_incoming_otr(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message
static void static void
_sv_ev_incoming_omemo(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message, gboolean logit) _sv_ev_incoming_omemo(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message, gboolean logit)
{ {
_clean_incoming_message(message);
chatwin_incoming_msg(chatwin, message, new_win); chatwin_incoming_msg(chatwin, message, new_win);
if (logit) { if (logit) {
chat_log_omemo_msg_in(message); chat_log_omemo_msg_in(message);
@ -592,6 +603,7 @@ _sv_ev_incoming_plain(ProfChatWin *chatwin, gboolean new_win, ProfMessage *messa
if (message->body) { if (message->body) {
message->enc = PROF_MSG_ENC_PLAIN; message->enc = PROF_MSG_ENC_PLAIN;
message->plain = strdup(message->body); message->plain = strdup(message->body);
_clean_incoming_message(message);
chatwin_incoming_msg(chatwin, message, new_win); chatwin_incoming_msg(chatwin, message, new_win);
if (logit) { if (logit) {
chat_log_msg_in(message); chat_log_msg_in(message);
@ -1412,3 +1424,21 @@ sv_ev_bookmark_autojoin(Bookmark *bookmark)
free(nick); free(nick);
} }
static void
_clean_incoming_message(ProfMessage *message)
{
if (strstr(message->plain, "\u200E")) {
char **split = g_strsplit(message->plain, "\u200E", -1);
free(message->plain);
message->plain = g_strjoinv("", split);
g_strfreev(split);
}
if (strstr(message->plain, "\u200F")) {
char **split = g_strsplit(message->plain, "\u200F", -1);
free(message->plain);
message->plain = g_strjoinv("", split);
g_strfreev(split);
}
}