int sound_notify(ToxWindow* self, Notification notif, uint64_t flags, int* id_indicator) { /* Consider colored notify as primary */ if (self) { if (flags & NT_WNDALERT_0) self->alert = WINDOW_ALERT_0; else if ( (flags & NT_WNDALERT_1) && (!self->alert || self->alert > WINDOW_ALERT_0) ) self->alert = WINDOW_ALERT_1; else if ( (flags & NT_WNDALERT_2) && (!self->alert || self->alert > WINDOW_ALERT_1) ) self->alert = WINDOW_ALERT_2; } if ((flags & NT_RESTOL && Control.cooldown > time(NULL)) || ((flags & NT_NOFOCUS && Control.this_window == get_focused_window_id()) )) return -1; int id = -1; control_lock(); if (self && (!self->stb || self->stb->status != TOX_USERSTATUS_BUSY) && user_settings_->alerts == ALERTS_ENABLED) id = m_play_sound(notif, flags); else if (flags & NT_ALWAYS) id = m_play_sound(notif, flags); #if defined(_BOX_NOTIFY) && !defined(_SOUND_NOTIFY) if (id == -1) { for (id = 0; id < ACTIVE_NOTIFS_MAX && actives[id].box; id ++); if ( id == ACTIVE_NOTIFS_MAX ) { control_unlock(); return -1; /* Full */ } } #endif if ( id_indicator && id != -1 ) { actives[id].id_indicator = id_indicator; *id_indicator = id; } control_unlock(); return id; }
int sound_notify(ToxWindow* self, Notification notif, uint64_t flags, int* id_indicator) { tab_notify(self, flags); if (notifications_are_disabled(flags)) return -1; int id = -1; control_lock(); if (self && (!self->stb || self->stb->status != TOX_USER_STATUS_BUSY)) id = m_play_sound(notif, flags); else if (flags & NT_ALWAYS) id = m_play_sound(notif, flags); #if defined(BOX_NOTIFY) && !defined(SOUND_NOTIFY) if (id == -1) { for (id = 0; id < ACTIVE_NOTIFS_MAX && actives[id].box; id++); if ( id == ACTIVE_NOTIFS_MAX ) { control_unlock(); return -1; /* Full */ } } #endif if ( id_indicator && id != -1 ) { actives[id].id_indicator = id_indicator; *id_indicator = id; } control_unlock(); return id; }