diff --git a/src/event/server_events.c b/src/event/server_events.c index 49f8fa64..40cc1240 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -1427,19 +1427,19 @@ sv_ev_bookmark_autojoin(Bookmark *bookmark) } static void -_clean_incoming_message(ProfMessage *message) +_cut(ProfMessage *message, const char *cut) { - 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); + if (strstr(message->plain, cut)) { + char **split = g_strsplit(message->plain, cut, -1); free(message->plain); message->plain = g_strjoinv("", split); g_strfreev(split); } } + +static void +_clean_incoming_message(ProfMessage *message) +{ + _cut(message, "\u200E"); + _cut(message, "\u200F"); +}