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

Escape strings passed to terminal-notifier

This commit is contained in:
James Booth 2014-05-24 22:31:42 +01:00
parent b36fbe413a
commit 60b59d984a

View File

@ -212,9 +212,12 @@ _notify(const char * const message, int timeout,
Shell_NotifyIcon(NIM_MODIFY, &nid); Shell_NotifyIcon(NIM_MODIFY, &nid);
#endif #endif
#ifdef HAVE_OSXNOTIFY #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 \"");
g_string_append(notify_command, message);
g_string_append(notify_command, "'"); char *escaped = str_replace(message, "\"", "\\\"");
g_string_append(notify_command, escaped);
g_string_append(notify_command, "\"");
free(escaped);
char *term_name = getenv("TERM_PROGRAM"); char *term_name = getenv("TERM_PROGRAM");
char *app_id = NULL; char *app_id = NULL;