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

Escape open bracket at start of OSX notification messages

fixes #391
This commit is contained in:
James Booth 2014-08-04 22:00:43 +01:00
parent f18bfc3396
commit cd9b1449b5

View File

@ -219,7 +219,23 @@ _notify(const char * const message, int timeout,
char *escaped_double = str_replace(message, "\"", "\\\"");
char *escaped_single = str_replace(escaped_double, "`", "\\`");
g_string_append(notify_command, escaped_single);
if (escaped_single[0] == '<') {
g_string_append(notify_command, "\\<");
g_string_append(notify_command, &escaped_single[1]);
} else if (escaped_single[0] == '[') {
g_string_append(notify_command, "\\[");
g_string_append(notify_command, &escaped_single[1]);
} else if (escaped_single[0] == '(') {
g_string_append(notify_command, "\\(");
g_string_append(notify_command, &escaped_single[1]);
} else if (escaped_single[0] == '{') {
g_string_append(notify_command, "\\{");
g_string_append(notify_command, &escaped_single[1]);
} else {
g_string_append(notify_command, escaped_single);
}
g_string_append(notify_command, "\"");
free(escaped_double);
free(escaped_single);