mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 03:03:02 +01:00
fix a few notification issues
This commit is contained in:
parent
ac01d6d316
commit
a047cead05
@ -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') {
|
||||
|
@ -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();
|
||||
|
@ -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 */
|
||||
|
||||
|
11
src/prompt.c
11
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);
|
||||
notify(self, user_log_in, NT_WNDALERT_2 | NT_NOTIFWND | NT_RESTOL);
|
||||
|
||||
#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 */
|
||||
}
|
||||
}
|
||||
|
||||
|
10
src/toxic.c
10
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,10 +631,16 @@ 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...";
|
||||
|
Loading…
Reference in New Issue
Block a user