1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00

Use single quotes for terminal notifier notifications to avoid variable expansion

This commit is contained in:
James Booth 2015-02-14 16:20:15 +00:00
parent 9951da0c8f
commit c9a6e10c26

View File

@ -243,10 +243,9 @@ _notify(const char * const message, int timeout,
Shell_NotifyIcon(NIM_MODIFY, &nid);
#endif
#ifdef HAVE_OSXNOTIFY
GString *notify_command = g_string_new("terminal-notifier -title \"Profanity\" -message \"");
GString *notify_command = g_string_new("terminal-notifier -title \"Profanity\" -message '");
char *escaped_double = str_replace(message, "\"", "\\\"");
char *escaped_single = str_replace(escaped_double, "`", "\\`");
char *escaped_single = str_replace(message, "'", "'\\''");
if (escaped_single[0] == '<') {
g_string_append(notify_command, "\\<");
@ -264,8 +263,7 @@ _notify(const char * const message, int timeout,
g_string_append(notify_command, escaped_single);
}
g_string_append(notify_command, "\"");
free(escaped_double);
g_string_append(notify_command, "'");
free(escaped_single);
char *term_name = getenv("TERM_PROGRAM");
@ -288,4 +286,4 @@ _notify(const char * const message, int timeout,
g_string_free(notify_command, TRUE);
#endif
}
}