diff --git a/src/chat.c b/src/chat.c index 04d326a..ab808cd 100644 --- a/src/chat.c +++ b/src/chat.c @@ -766,7 +766,7 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr) ctx->start = wlen < x2 ? 0 : wlen - x2 + 1; } } else { - notify(self, error, 0); + beep(); } } else if (key == '\n') { diff --git a/src/friendlist.c b/src/friendlist.c index 0e0fe58..5f884c6 100644 --- a/src/friendlist.c +++ b/src/friendlist.c @@ -129,7 +129,6 @@ static void friendlist_onConnectionChange(ToxWindow *self, Tox *m, int32_t num, return; friends[num].online = status; - notify(self, status==1 ? user_log_in : user_log_out, NT_RESTOL | NT_NOTIFWND ); update_friend_last_online(num, get_unix_time()); store_data(m, DATA_FILE); sort_friendlist_index(); diff --git a/src/notify.c b/src/notify.c index f4f7a01..297cf69 100644 --- a/src/notify.c +++ b/src/notify.c @@ -300,8 +300,10 @@ static int m_play_sound(Notification notif, uint64_t flags) { #ifdef _SOUND_NOTIFY return play_notify_sound(notif, flags); - #else - beep(); +#else + if (notif != silent) + beep(); + return -1; #endif /* _SOUND_NOTIFY */ diff --git a/src/prompt.c b/src/prompt.c index a333544..7fa3d03 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -308,13 +308,22 @@ static void prompt_onConnectionChange(ToxWindow *self, Tox *m, int32_t friendnum msg = "has come online"; line_info_add(self, timefrmt, nick, NULL, msg, CONNECTION, 0, GREEN); write_to_log(msg, nick, ctx->log, true); + +#ifdef _SOUND_NOTIFY notify(self, user_log_in, NT_WNDALERT_2 | NT_NOTIFWND | NT_RESTOL); - +#else + notify(self, silent, NT_WNDALERT_2 | NT_NOTIFWND | NT_RESTOL); +#endif /* _SOUND_NOTIFY */ } else { msg = "has gone offline"; line_info_add(self, timefrmt, nick, NULL, msg, CONNECTION, 0, RED); write_to_log(msg, nick, ctx->log, true); + +#ifdef _SOUND_NOTIFY notify(self, user_log_out, NT_WNDALERT_2 | NT_NOTIFWND | NT_RESTOL); +#else + notify(self, silent, NT_WNDALERT_2 | NT_NOTIFWND | NT_RESTOL); +#endif /* _SOUND_NOTIFY */ } } diff --git a/src/toxic.c b/src/toxic.c index 68724be..ae653fb 100644 --- a/src/toxic.c +++ b/src/toxic.c @@ -101,7 +101,9 @@ void exit_toxic_success(Tox *m) free(DATA_FILE); free(user_settings_); +#ifdef _SOUND_NOTIFY notify(NULL, self_log_out, NT_ALWAYS); +#endif /* _SOUND_NOTIFY */ terminate_notify(); #ifdef _AUDIO terminate_audio(); @@ -619,8 +621,6 @@ int main(int argc, char *argv[]) if (pthread_create(&Winthread.tid, NULL, thread_winref, (void *) m) != 0) exit_toxic_err("failed in main", FATALERR_THREAD_CREATE); - char *msg; - #ifdef _AUDIO av = init_audio(prompt, m); @@ -631,11 +631,17 @@ int main(int argc, char *argv[]) #elif _SOUND_NOTIFY if ( init_devices() == de_InternalError ) line_info_add(prompt, NULL, NULL, NULL, "Failed to init devices", SYS_MSG, 0, 0); + #endif /* _AUDIO */ init_notify(60); + +#ifdef _SOUND_NOTIFY notify(prompt, self_log_in, 0); - +#endif /* _SOUND_NOTIFY */ + + char *msg; + if (config_err) { msg = "Unable to determine configuration directory. Defaulting to 'data' for a keyfile..."; line_info_add(prompt, NULL, NULL, NULL, msg, SYS_MSG, 0, 0);