mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Use helper function to clean incoming messages
We might want to use utf8proc or something to normalize utf8 strings later?
This commit is contained in:
parent
20dc1710e8
commit
3bb2e07c1e
@ -1427,19 +1427,19 @@ sv_ev_bookmark_autojoin(Bookmark *bookmark)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_clean_incoming_message(ProfMessage *message)
|
_cut(ProfMessage *message, const char *cut)
|
||||||
{
|
{
|
||||||
if (strstr(message->plain, "\u200E")) {
|
if (strstr(message->plain, cut)) {
|
||||||
char **split = g_strsplit(message->plain, "\u200E", -1);
|
char **split = g_strsplit(message->plain, cut, -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);
|
free(message->plain);
|
||||||
message->plain = g_strjoinv("", split);
|
message->plain = g_strjoinv("", split);
|
||||||
g_strfreev(split);
|
g_strfreev(split);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_clean_incoming_message(ProfMessage *message)
|
||||||
|
{
|
||||||
|
_cut(message, "\u200E");
|
||||||
|
_cut(message, "\u200F");
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user