2014-07-21 03:25:21 +02:00
|
|
|
/* notify.h
|
2015-03-26 03:56:45 +01:00
|
|
|
*
|
2014-07-21 03:25:21 +02:00
|
|
|
*
|
|
|
|
* Copyright (C) 2014 Toxic All Rights Reserved.
|
|
|
|
*
|
|
|
|
* This file is part of Toxic.
|
|
|
|
*
|
|
|
|
* Toxic is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Toxic is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Toxic. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2014-09-23 03:24:45 +02:00
|
|
|
#ifndef NOTIFY_H
|
|
|
|
#define NOTIFY_H
|
2014-07-21 03:25:21 +02:00
|
|
|
|
2019-03-27 06:38:15 +01:00
|
|
|
#include <stdint.h>
|
2014-07-21 03:25:21 +02:00
|
|
|
#include "windows.h"
|
|
|
|
|
2016-09-25 03:07:04 +02:00
|
|
|
typedef enum _Notification {
|
2014-07-21 03:25:21 +02:00
|
|
|
silent = -1,
|
2015-03-26 03:56:45 +01:00
|
|
|
notif_error,
|
2014-07-21 03:25:21 +02:00
|
|
|
self_log_in,
|
|
|
|
self_log_out,
|
|
|
|
user_log_in,
|
|
|
|
user_log_out,
|
|
|
|
call_incoming,
|
|
|
|
call_outgoing,
|
|
|
|
generic_message,
|
|
|
|
transfer_pending,
|
|
|
|
transfer_completed,
|
|
|
|
} Notification;
|
|
|
|
|
|
|
|
typedef enum _Flags {
|
|
|
|
NT_NOFOCUS = 1 << 0, /* Notify when focus is not on this terminal. NOTE: only works with x11,
|
|
|
|
* if no x11 present this flag is ignored
|
|
|
|
*/
|
|
|
|
NT_BEEP = 1 << 1, /* Play native sound instead: \a */
|
|
|
|
NT_LOOP = 1 << 2, /* Loop sound. If this setting active, notify() will return id of the sound
|
|
|
|
* so it could be stopped. It will return 0 if error or NT_NATIVE flag is set and play \a instead
|
|
|
|
*/
|
2015-03-26 03:56:45 +01:00
|
|
|
NT_RESTOL = 1 << 3, /* Respect tolerance. Usually used to stop flood at toxic startup
|
2014-07-21 03:25:21 +02:00
|
|
|
* Only works if login_cooldown is true when calling init_notify()
|
|
|
|
*/
|
|
|
|
NT_NOTIFWND = 1 << 4, /* Pop notify window. NOTE: only works(/WILL WORK) if libnotify is present */
|
|
|
|
NT_WNDALERT_0 = 1 << 5, /* Alert toxic */
|
|
|
|
NT_WNDALERT_1 = 1 << 6, /* Alert toxic */
|
|
|
|
NT_WNDALERT_2 = 1 << 7, /* Alert toxic */
|
2015-03-26 03:56:45 +01:00
|
|
|
|
2014-07-21 03:25:21 +02:00
|
|
|
NT_ALWAYS = 1 << 8, /* Force sound to play */
|
|
|
|
} Flags;
|
|
|
|
|
2014-07-27 01:49:59 +02:00
|
|
|
int init_notify(int login_cooldown, int notification_timeout);
|
2018-09-14 01:47:47 +02:00
|
|
|
void terminate_notify(void);
|
2014-07-21 03:25:21 +02:00
|
|
|
|
2020-11-10 23:20:40 +01:00
|
|
|
/* Kills all notifications for `id`. This must be called before freeing a ToxWindow. */
|
|
|
|
void kill_notifs(int id);
|
|
|
|
|
2016-09-25 03:07:04 +02:00
|
|
|
int sound_notify(ToxWindow *self, Notification notif, uint64_t flags, int *id_indicator);
|
|
|
|
int sound_notify2(ToxWindow *self, Notification notif, uint64_t flags, int id);
|
2014-07-28 01:35:40 +02:00
|
|
|
|
2014-08-02 00:37:02 +02:00
|
|
|
void stop_sound(int id);
|
|
|
|
|
2016-09-25 03:07:04 +02:00
|
|
|
int box_notify(ToxWindow *self, Notification notif, uint64_t flags, int *id_indicator, const char *title,
|
|
|
|
const char *format, ...);
|
|
|
|
int box_notify2(ToxWindow *self, Notification notif, uint64_t flags, int id, const char *format, ...);
|
|
|
|
int box_silent_notify(ToxWindow *self, uint64_t flags, int *id_indicator, const char *title, const char *format, ...);
|
|
|
|
int box_silent_notify2(ToxWindow *self, uint64_t flags, int id, const char *format, ...);
|
2014-07-21 03:25:21 +02:00
|
|
|
|
2014-09-23 03:24:45 +02:00
|
|
|
#ifdef SOUND_NOTIFY
|
2021-12-12 17:30:27 +01:00
|
|
|
bool set_sound(Notification sound, const char *value);
|
2014-09-23 03:24:45 +02:00
|
|
|
#endif /* SOUND_NOTIFY */
|
2014-07-21 03:25:21 +02:00
|
|
|
|
2014-09-23 03:24:45 +02:00
|
|
|
#endif /* NOTIFY_H */
|