mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 05:43:03 +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;
|
ctx->start = wlen < x2 ? 0 : wlen - x2 + 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
notify(self, error, 0);
|
beep();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (key == '\n') {
|
} else if (key == '\n') {
|
||||||
|
@ -129,7 +129,6 @@ static void friendlist_onConnectionChange(ToxWindow *self, Tox *m, int32_t num,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
friends[num].online = status;
|
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());
|
update_friend_last_online(num, get_unix_time());
|
||||||
store_data(m, DATA_FILE);
|
store_data(m, DATA_FILE);
|
||||||
sort_friendlist_index();
|
sort_friendlist_index();
|
||||||
|
@ -301,7 +301,9 @@ static int m_play_sound(Notification notif, uint64_t flags)
|
|||||||
#ifdef _SOUND_NOTIFY
|
#ifdef _SOUND_NOTIFY
|
||||||
return play_notify_sound(notif, flags);
|
return play_notify_sound(notif, flags);
|
||||||
#else
|
#else
|
||||||
|
if (notif != silent)
|
||||||
beep();
|
beep();
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
#endif /* _SOUND_NOTIFY */
|
#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";
|
msg = "has come online";
|
||||||
line_info_add(self, timefrmt, nick, NULL, msg, CONNECTION, 0, GREEN);
|
line_info_add(self, timefrmt, nick, NULL, msg, CONNECTION, 0, GREEN);
|
||||||
write_to_log(msg, nick, ctx->log, true);
|
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 {
|
} else {
|
||||||
msg = "has gone offline";
|
msg = "has gone offline";
|
||||||
line_info_add(self, timefrmt, nick, NULL, msg, CONNECTION, 0, RED);
|
line_info_add(self, timefrmt, nick, NULL, msg, CONNECTION, 0, RED);
|
||||||
write_to_log(msg, nick, ctx->log, true);
|
write_to_log(msg, nick, ctx->log, true);
|
||||||
|
|
||||||
|
#ifdef _SOUND_NOTIFY
|
||||||
notify(self, user_log_out, NT_WNDALERT_2 | NT_NOTIFWND | NT_RESTOL);
|
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(DATA_FILE);
|
||||||
free(user_settings_);
|
free(user_settings_);
|
||||||
|
|
||||||
|
#ifdef _SOUND_NOTIFY
|
||||||
notify(NULL, self_log_out, NT_ALWAYS);
|
notify(NULL, self_log_out, NT_ALWAYS);
|
||||||
|
#endif /* _SOUND_NOTIFY */
|
||||||
terminate_notify();
|
terminate_notify();
|
||||||
#ifdef _AUDIO
|
#ifdef _AUDIO
|
||||||
terminate_audio();
|
terminate_audio();
|
||||||
@ -619,8 +621,6 @@ int main(int argc, char *argv[])
|
|||||||
if (pthread_create(&Winthread.tid, NULL, thread_winref, (void *) m) != 0)
|
if (pthread_create(&Winthread.tid, NULL, thread_winref, (void *) m) != 0)
|
||||||
exit_toxic_err("failed in main", FATALERR_THREAD_CREATE);
|
exit_toxic_err("failed in main", FATALERR_THREAD_CREATE);
|
||||||
|
|
||||||
char *msg;
|
|
||||||
|
|
||||||
#ifdef _AUDIO
|
#ifdef _AUDIO
|
||||||
|
|
||||||
av = init_audio(prompt, m);
|
av = init_audio(prompt, m);
|
||||||
@ -631,10 +631,16 @@ int main(int argc, char *argv[])
|
|||||||
#elif _SOUND_NOTIFY
|
#elif _SOUND_NOTIFY
|
||||||
if ( init_devices() == de_InternalError )
|
if ( init_devices() == de_InternalError )
|
||||||
line_info_add(prompt, NULL, NULL, NULL, "Failed to init devices", SYS_MSG, 0, 0);
|
line_info_add(prompt, NULL, NULL, NULL, "Failed to init devices", SYS_MSG, 0, 0);
|
||||||
|
|
||||||
#endif /* _AUDIO */
|
#endif /* _AUDIO */
|
||||||
|
|
||||||
init_notify(60);
|
init_notify(60);
|
||||||
|
|
||||||
|
#ifdef _SOUND_NOTIFY
|
||||||
notify(prompt, self_log_in, 0);
|
notify(prompt, self_log_in, 0);
|
||||||
|
#endif /* _SOUND_NOTIFY */
|
||||||
|
|
||||||
|
char *msg;
|
||||||
|
|
||||||
if (config_err) {
|
if (config_err) {
|
||||||
msg = "Unable to determine configuration directory. Defaulting to 'data' for a keyfile...";
|
msg = "Unable to determine configuration directory. Defaulting to 'data' for a keyfile...";
|
||||||
|
Loading…
Reference in New Issue
Block a user