mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 17:13:02 +01:00
Improve readability of defines
This commit is contained in:
parent
f90a774470
commit
63cc23401a
@ -39,4 +39,4 @@ int help_max_width(void);
|
|||||||
void draw_handler_help(WINDOW *win);
|
void draw_handler_help(WINDOW *win);
|
||||||
void invoke_autoruns(WINDOW *w, ToxWindow *self);
|
void invoke_autoruns(WINDOW *w, ToxWindow *self);
|
||||||
|
|
||||||
#endif /* #define API_H */
|
#endif /* API_H */
|
||||||
|
@ -54,8 +54,8 @@
|
|||||||
/* compatibility with older versions of OpenAL */
|
/* compatibility with older versions of OpenAL */
|
||||||
#ifndef ALC_ALL_DEVICES_SPECIFIER
|
#ifndef ALC_ALL_DEVICES_SPECIFIER
|
||||||
#include <AL/alext.h>
|
#include <AL/alext.h>
|
||||||
#endif
|
#endif /* ALC_ALL_DEVICES_SPECIFIER */
|
||||||
#endif
|
#endif /* __APPLE__ */
|
||||||
|
|
||||||
extern FriendsList Friends;
|
extern FriendsList Friends;
|
||||||
struct CallControl CallControl;
|
struct CallControl CallControl;
|
||||||
@ -997,4 +997,4 @@ void del_friend_AV(uint32_t index)
|
|||||||
CallControl.max_calls = index;
|
CallControl.max_calls = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* AUDIO */
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <sys/dir.h>
|
#include <sys/dir.h>
|
||||||
#else
|
#else
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#endif /* ifdef __APPLE__ */
|
#endif /* __APPLE__ */
|
||||||
|
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include "toxic.h"
|
#include "toxic.h"
|
||||||
|
@ -39,4 +39,4 @@ int complete_line(ToxWindow *self, const void *list, size_t n_items, size_t size
|
|||||||
return diff between old len and new len of ctx->line, -1 if no matches or > 1 match */
|
return diff between old len and new len of ctx->line, -1 if no matches or > 1 match */
|
||||||
int dir_match(ToxWindow *self, Tox *m, const wchar_t *line, const wchar_t *cmd);
|
int dir_match(ToxWindow *self, Tox *m, const wchar_t *line, const wchar_t *cmd);
|
||||||
|
|
||||||
#endif /* #define AUTOCOMPLETE_H */
|
#endif /* AUTOCOMPLETE_H */
|
||||||
|
@ -49,4 +49,4 @@ void cmd_video(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE
|
|||||||
void cmd_ccur_video_device(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]);
|
void cmd_ccur_video_device(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]);
|
||||||
#endif /* VIDEO */
|
#endif /* VIDEO */
|
||||||
|
|
||||||
#endif /* #define CHAT_COMMANDS_H */
|
#endif /* CHAT_COMMANDS_H */
|
||||||
|
@ -53,4 +53,4 @@ void get_home_dir(char *home, int size);
|
|||||||
*/
|
*/
|
||||||
int create_user_config_dirs(char *path);
|
int create_user_config_dirs(char *path);
|
||||||
|
|
||||||
#endif /* #define CONFIGDIR_H */
|
#endif /* CONFIGDIR_H */
|
||||||
|
@ -36,4 +36,4 @@ enum {
|
|||||||
|
|
||||||
void execute(WINDOW *w, ToxWindow *self, Tox *m, const char *input, int mode);
|
void execute(WINDOW *w, ToxWindow *self, Tox *m, const char *input, int mode);
|
||||||
|
|
||||||
#endif /* #define EXECUTE_H */
|
#endif /* EXECUTE_H */
|
||||||
|
@ -108,4 +108,4 @@ void kill_all_file_transfers_friend(Tox *m, uint32_t friendnum);
|
|||||||
|
|
||||||
void kill_all_file_transfers(Tox *m);
|
void kill_all_file_transfers(Tox *m);
|
||||||
|
|
||||||
#endif /* #define FILE_TRANSFERS_H */
|
#endif /* FILE_TRANSFERS_H */
|
||||||
|
@ -60,6 +60,6 @@ void cmd_change_video_device(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv
|
|||||||
|
|
||||||
#ifdef PYTHON
|
#ifdef PYTHON
|
||||||
void cmd_run(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]);
|
void cmd_run(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]);
|
||||||
#endif
|
#endif /* PYTHON */
|
||||||
|
|
||||||
#endif /* #define GLOBAL_COMMANDS_H */
|
#endif /* GLOBAL_COMMANDS_H */
|
||||||
|
@ -63,4 +63,4 @@ void redraw_groupchat_win(ToxWindow *self);
|
|||||||
|
|
||||||
ToxWindow new_group_chat(Tox *m, uint32_t groupnum);
|
ToxWindow new_group_chat(Tox *m, uint32_t groupnum);
|
||||||
|
|
||||||
#endif /* #define GROUPCHAT_H */
|
#endif /* GROUPCHAT_H */
|
||||||
|
@ -326,7 +326,7 @@ static void help_draw_plugin(ToxWindow *self)
|
|||||||
box(win, ACS_VLINE, ACS_HLINE);
|
box(win, ACS_VLINE, ACS_HLINE);
|
||||||
wnoutrefresh(win);
|
wnoutrefresh(win);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* PYTHON */
|
||||||
|
|
||||||
static void help_draw_contacts(ToxWindow *self)
|
static void help_draw_contacts(ToxWindow *self)
|
||||||
{
|
{
|
||||||
@ -396,7 +396,7 @@ void help_onKey(ToxWindow *self, wint_t key)
|
|||||||
help_init_window(self, 4 + num_registered_handlers(), help_max_width());
|
help_init_window(self, 4 + num_registered_handlers(), help_max_width());
|
||||||
self->help->type = HELP_PLUGIN;
|
self->help->type = HELP_PLUGIN;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif /* PYTHON */
|
||||||
|
|
||||||
case 'f':
|
case 'f':
|
||||||
help_init_window(self, 10, 80);
|
help_init_window(self, 10, 80);
|
||||||
|
@ -42,4 +42,4 @@ void help_onDraw(ToxWindow *self);
|
|||||||
void help_init_menu(ToxWindow *self);
|
void help_init_menu(ToxWindow *self);
|
||||||
void help_onKey(ToxWindow *self, wint_t key);
|
void help_onKey(ToxWindow *self, wint_t key);
|
||||||
|
|
||||||
#endif /* #define HELP_H */
|
#endif /* HELP_H */
|
||||||
|
@ -30,4 +30,4 @@ void input_new_char(ToxWindow *self, wint_t key, int x, int y, int mx_x, int mx_
|
|||||||
return true if key matches a function, false otherwise */
|
return true if key matches a function, false otherwise */
|
||||||
bool input_handle(ToxWindow *self, wint_t key, int x, int y, int mx_x, int mx_y);
|
bool input_handle(ToxWindow *self, wint_t key, int x, int y, int mx_x, int mx_y);
|
||||||
|
|
||||||
#endif /* #define INPUT_H */
|
#endif /* INPUT_H */
|
||||||
|
@ -100,4 +100,4 @@ void line_info_reset_start(ToxWindow *self, struct history *hst);
|
|||||||
void line_info_init(struct history *hst);
|
void line_info_init(struct history *hst);
|
||||||
bool line_info_onKey(ToxWindow *self, wint_t key); /* returns true if key is a match */
|
bool line_info_onKey(ToxWindow *self, wint_t key); /* returns true if key is a match */
|
||||||
|
|
||||||
#endif /* #define LINE_INFO_H */
|
#endif /* LINE_INFO_H */
|
||||||
|
@ -56,4 +56,4 @@ void load_chat_history(ToxWindow *self, struct chatlog *log);
|
|||||||
Returns 0 on success or if no log exists, -1 on failure. */
|
Returns 0 on success or if no log exists, -1 on failure. */
|
||||||
int rename_logfile(char *src, char *dest, const char *selfkey, const char *otherkey, int winnum);
|
int rename_logfile(char *src, char *dest, const char *selfkey, const char *otherkey, int winnum);
|
||||||
|
|
||||||
#endif /* #define LOG_H */
|
#endif /* LOG_H */
|
||||||
|
@ -48,4 +48,4 @@ void cqueue_try_send(ToxWindow *self, Tox *m);
|
|||||||
/* removes message with matching receipt from queue, writes to log and updates line to show the message was received. */
|
/* removes message with matching receipt from queue, writes to log and updates line to show the message was received. */
|
||||||
void cqueue_remove(ToxWindow *self, Tox *m, uint32_t receipt);
|
void cqueue_remove(ToxWindow *self, Tox *m, uint32_t receipt);
|
||||||
|
|
||||||
#endif /* #define MESSAGE_QUEUE_H */
|
#endif /* MESSAGE_QUEUE_H */
|
||||||
|
@ -170,4 +170,4 @@ bool is_ip4_address(const char *address);
|
|||||||
*/
|
*/
|
||||||
bool is_ip6_address(const char *address);
|
bool is_ip6_address(const char *address);
|
||||||
|
|
||||||
#endif /* #define MISC_TOOLS_H */
|
#endif /* MISC_TOOLS_H */
|
||||||
|
42
src/notify.c
42
src/notify.c
@ -47,12 +47,12 @@
|
|||||||
/* compatibility with older versions of OpenAL */
|
/* compatibility with older versions of OpenAL */
|
||||||
#ifndef ALC_ALL_DEVICES_SPECIFIER
|
#ifndef ALC_ALL_DEVICES_SPECIFIER
|
||||||
#include <AL/alext.h>
|
#include <AL/alext.h>
|
||||||
#endif
|
#endif /* ALC_ALL_DEVICES_SPECIFIER */
|
||||||
#endif
|
#endif /* __APPLE__ */
|
||||||
#ifdef SOUND_NOTIFY
|
#ifdef SOUND_NOTIFY
|
||||||
#include <AL/alut.h> /* freealut packet */
|
#include <AL/alut.h> /* freealut packet */
|
||||||
#endif
|
#endif /* SOUND_NOTIFY */
|
||||||
#endif /* AUDIO */
|
#endif /* defined(AUDIO) || defined(SOUND_NOTIFY) */
|
||||||
|
|
||||||
#ifdef BOX_NOTIFY
|
#ifdef BOX_NOTIFY
|
||||||
#include <libnotify/notify.h>
|
#include <libnotify/notify.h>
|
||||||
@ -84,7 +84,7 @@ static struct _ActiveNotifications {
|
|||||||
uint32_t source;
|
uint32_t source;
|
||||||
uint32_t buffer;
|
uint32_t buffer;
|
||||||
bool looping;
|
bool looping;
|
||||||
#endif
|
#endif /* SOUND_NOTIFY */
|
||||||
bool active;
|
bool active;
|
||||||
int *id_indicator;
|
int *id_indicator;
|
||||||
#ifdef BOX_NOTIFY
|
#ifdef BOX_NOTIFY
|
||||||
@ -93,7 +93,7 @@ static struct _ActiveNotifications {
|
|||||||
char title[64];
|
char title[64];
|
||||||
size_t size;
|
size_t size;
|
||||||
time_t n_timeout;
|
time_t n_timeout;
|
||||||
#endif
|
#endif /* BOX_NOTIFY */
|
||||||
} actives[ACTIVE_NOTIFS_MAX];
|
} actives[ACTIVE_NOTIFS_MAX];
|
||||||
/**********************************************************************************/
|
/**********************************************************************************/
|
||||||
/**********************************************************************************/
|
/**********************************************************************************/
|
||||||
@ -203,7 +203,7 @@ void graceful_clear(void)
|
|||||||
actives[i].box = NULL;
|
actives[i].box = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* BOX_NOTIFY */
|
||||||
|
|
||||||
if (actives[i].id_indicator) {
|
if (actives[i].id_indicator) {
|
||||||
*actives[i].id_indicator = -1; /* reset indicator value */
|
*actives[i].id_indicator = -1; /* reset indicator value */
|
||||||
@ -293,7 +293,7 @@ void *do_playing(void *_p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* BOX_NOTIFY */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* device is opened and no activity in under DEVICE_COOLDOWN time, close device*/
|
/* device is opened and no activity in under DEVICE_COOLDOWN time, close device*/
|
||||||
@ -388,7 +388,7 @@ void graceful_clear(void)
|
|||||||
|
|
||||||
control_unlock();
|
control_unlock();
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* SOUND_NOTIFY */
|
||||||
|
|
||||||
/**********************************************************************************/
|
/**********************************************************************************/
|
||||||
/**********************************************************************************/
|
/**********************************************************************************/
|
||||||
@ -420,7 +420,7 @@ int init_notify(int login_cooldown, int notification_timeout)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* defined(SOUND_NOTIFY) || defined(BOX_NOTIFY) */
|
||||||
Control.cooldown = time(NULL) + login_cooldown;
|
Control.cooldown = time(NULL) + login_cooldown;
|
||||||
|
|
||||||
|
|
||||||
@ -445,7 +445,7 @@ void terminate_notify(void)
|
|||||||
control_unlock();
|
control_unlock();
|
||||||
|
|
||||||
graceful_clear();
|
graceful_clear();
|
||||||
#endif
|
#endif /* defined(SOUND_NOTIFY) || defined(BOX_NOTIFY) */
|
||||||
|
|
||||||
#ifdef SOUND_NOTIFY
|
#ifdef SOUND_NOTIFY
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -534,20 +534,20 @@ void stop_sound(int id)
|
|||||||
notify_notification_close(actives[id].box, &ignore);
|
notify_notification_close(actives[id].box, &ignore);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* BOX_NOTIFY */
|
||||||
|
|
||||||
if (actives[id].id_indicator) {
|
if (actives[id].id_indicator) {
|
||||||
*actives[id].id_indicator = -1;
|
*actives[id].id_indicator = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// alSourcei(actives[id].source, AL_LOOPING, false);
|
// alSourcei(actives[id].source, AL_LOOPING, false);
|
||||||
alSourceStop(actives[id].source);
|
alSourceStop(actives[id].source);
|
||||||
alDeleteSources(1, &actives[id].source);
|
alDeleteSources(1, &actives[id].source);
|
||||||
alDeleteBuffers(1, &actives[id].buffer);
|
alDeleteBuffers(1, &actives[id].buffer);
|
||||||
memset(&actives[id], 0, sizeof(struct _ActiveNotifications));
|
memset(&actives[id], 0, sizeof(struct _ActiveNotifications));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* SOUND_NOTIFY */
|
||||||
|
|
||||||
static int m_play_sound(Notification notif, uint64_t flags)
|
static int m_play_sound(Notification notif, uint64_t flags)
|
||||||
{
|
{
|
||||||
@ -563,12 +563,6 @@ static int m_play_sound(Notification notif, uint64_t flags)
|
|||||||
#endif /* SOUND_NOTIFY */
|
#endif /* SOUND_NOTIFY */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOX_NOTIFY
|
|
||||||
void m_notify_action(NotifyNotification *box, char *action, void *data)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int sound_notify(ToxWindow *self, Notification notif, uint64_t flags, int *id_indicator)
|
int sound_notify(ToxWindow *self, Notification notif, uint64_t flags, int *id_indicator)
|
||||||
{
|
{
|
||||||
tab_notify(self, flags);
|
tab_notify(self, flags);
|
||||||
@ -597,7 +591,7 @@ int sound_notify(ToxWindow *self, Notification notif, uint64_t flags, int *id_in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* defined(BOX_NOTIFY) && !defined(SOUND_NOTIFY) */
|
||||||
|
|
||||||
if (id_indicator && id != -1) {
|
if (id_indicator && id != -1) {
|
||||||
actives[id].id_indicator = id_indicator;
|
actives[id].id_indicator = id_indicator;
|
||||||
@ -779,7 +773,7 @@ int box_notify2(ToxWindow *self, Notification notif, uint64_t flags, int id, con
|
|||||||
return id;
|
return id;
|
||||||
#else
|
#else
|
||||||
return sound_notify2(self, notif, flags, id);
|
return sound_notify2(self, notif, flags, id);
|
||||||
#endif
|
#endif /* BOX_NOTIFY */
|
||||||
}
|
}
|
||||||
|
|
||||||
int box_silent_notify(ToxWindow *self, uint64_t flags, int *id_indicator, const char *title, const char *format, ...)
|
int box_silent_notify(ToxWindow *self, uint64_t flags, int *id_indicator, const char *title, const char *format, ...)
|
||||||
@ -837,7 +831,7 @@ int box_silent_notify(ToxWindow *self, uint64_t flags, int *id_indicator, const
|
|||||||
return id;
|
return id;
|
||||||
#else
|
#else
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif /* BOX_NOTIFY */
|
||||||
}
|
}
|
||||||
|
|
||||||
int box_silent_notify2(ToxWindow *self, uint64_t flags, int id, const char *format, ...)
|
int box_silent_notify2(ToxWindow *self, uint64_t flags, int id, const char *format, ...)
|
||||||
@ -888,5 +882,5 @@ int box_silent_notify2(ToxWindow *self, uint64_t flags, int id, const char *form
|
|||||||
return id;
|
return id;
|
||||||
#else
|
#else
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif /* BOX_NOTIFY */
|
||||||
}
|
}
|
||||||
|
@ -36,4 +36,4 @@ int python_num_registered_handlers(void);
|
|||||||
int python_help_max_width(void);
|
int python_help_max_width(void);
|
||||||
void python_draw_handler_help(WINDOW *win);
|
void python_draw_handler_help(WINDOW *win);
|
||||||
|
|
||||||
#endif /* #define PYTHON_API_H */
|
#endif /* PYTHON_API_H */
|
||||||
|
@ -125,4 +125,5 @@ enum settings_values {
|
|||||||
#define MPLEX_AWAY_NOTE "Detached from screen"
|
#define MPLEX_AWAY_NOTE "Detached from screen"
|
||||||
|
|
||||||
int settings_load(struct user_settings *s, const char *patharg);
|
int settings_load(struct user_settings *s, const char *patharg);
|
||||||
#endif /* #define SETTINGS_H */
|
|
||||||
|
#endif /* SETTINGS_H */
|
||||||
|
@ -24,12 +24,12 @@
|
|||||||
#define TERM_MPLEX_H
|
#define TERM_MPLEX_H
|
||||||
|
|
||||||
/* Checks if Toxic runs inside a terminal multiplexer (GNU screen or tmux). If
|
/* Checks if Toxic runs inside a terminal multiplexer (GNU screen or tmux). If
|
||||||
yes, it initializes a timer which periodically checks the attached/detached
|
* yes, it initializes a timer which periodically checks the attached/detached
|
||||||
state of the terminal and updates away status accordingly.
|
* state of the terminal and updates away status accordingly.
|
||||||
*/
|
*/
|
||||||
int init_mplex_away_timer(Tox *m);
|
int init_mplex_away_timer(Tox *m);
|
||||||
|
|
||||||
void lock_status(void);
|
void lock_status(void);
|
||||||
void unlock_status(void);
|
void unlock_status(void);
|
||||||
|
|
||||||
#endif /* #define TERM_MPLEX_H */
|
#endif /* TERM_MPLEX_H */
|
||||||
|
@ -1273,7 +1273,7 @@ int main(int argc, char **argv)
|
|||||||
queue_init_message("X failed to initialize");
|
queue_init_message("X failed to initialize");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* X11 */
|
||||||
|
|
||||||
Tox *m = load_toxic(DATA_FILE);
|
Tox *m = load_toxic(DATA_FILE);
|
||||||
|
|
||||||
|
@ -133,4 +133,4 @@ void on_file_recv(Tox *m, uint32_t friendnumber, uint32_t filenumber, uint32_t k
|
|||||||
void on_friend_typing(Tox *m, uint32_t friendnumber, bool is_typing, void *userdata);
|
void on_friend_typing(Tox *m, uint32_t friendnumber, bool is_typing, void *userdata);
|
||||||
void on_friend_read_receipt(Tox *m, uint32_t friendnumber, uint32_t receipt, void *userdata);
|
void on_friend_read_receipt(Tox *m, uint32_t friendnumber, uint32_t receipt, void *userdata);
|
||||||
|
|
||||||
#endif /* #define TOXIC_H */
|
#endif /* TOXIC_H */
|
||||||
|
@ -70,4 +70,4 @@ void fetch_hist_item(ChatContext *ctx, int key_dir);
|
|||||||
void strsubst(char *str, char old, char new);
|
void strsubst(char *str, char old, char new);
|
||||||
void wstrsubst(wchar_t *str, wchar_t old, wchar_t new);
|
void wstrsubst(wchar_t *str, wchar_t old, wchar_t new);
|
||||||
|
|
||||||
#endif /* #define TOXIC_STRINGS_H */
|
#endif /* TOXIC_STRINGS_H */
|
||||||
|
@ -447,4 +447,4 @@ void stop_video_stream(ToxWindow *self)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* VIDEO */
|
||||||
|
@ -41,8 +41,8 @@
|
|||||||
#include <sys/videoio.h>
|
#include <sys/videoio.h>
|
||||||
#else
|
#else
|
||||||
#include <linux/videodev2.h>
|
#include <linux/videodev2.h>
|
||||||
#endif
|
#endif /* defined(__OpenBSD__) || defined(__NetBSD__) */
|
||||||
#endif
|
#endif /* __OSX__ */
|
||||||
|
|
||||||
#include "line_info.h"
|
#include "line_info.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
@ -266,4 +266,4 @@ ToxWindow *get_active_window(void);
|
|||||||
call at least once per second */
|
call at least once per second */
|
||||||
void refresh_inactive_windows(void);
|
void refresh_inactive_windows(void);
|
||||||
|
|
||||||
#endif /* #define WINDOWS_H */
|
#endif /* WINDOWS_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user