1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-12-22 17:13:25 +01:00

Improve readability of defines

This commit is contained in:
jfreegman 2018-10-08 13:39:04 -04:00
parent f90a774470
commit 63cc23401a
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
34 changed files with 69 additions and 74 deletions

View File

@ -39,4 +39,4 @@ int help_max_width(void);
void draw_handler_help(WINDOW *win);
void invoke_autoruns(WINDOW *w, ToxWindow *self);
#endif /* #define API_H */
#endif /* API_H */

View File

@ -54,8 +54,8 @@
/* compatibility with older versions of OpenAL */
#ifndef ALC_ALL_DEVICES_SPECIFIER
#include <AL/alext.h>
#endif
#endif
#endif /* ALC_ALL_DEVICES_SPECIFIER */
#endif /* __APPLE__ */
extern FriendsList Friends;
struct CallControl CallControl;
@ -997,4 +997,4 @@ void del_friend_AV(uint32_t index)
CallControl.max_calls = index;
}
#endif
#endif /* AUDIO */

View File

@ -38,8 +38,8 @@
/* compatibility with older versions of OpenAL */
#ifndef ALC_ALL_DEVICES_SPECIFIER
#include <AL/alext.h>
#endif /* ALC_ALL_DEVICES_SPECIFIER */
#endif /* __APPLE__ */
#endif /* ALC_ALL_DEVICES_SPECIFIER */
#endif /* __APPLE__ */
#include <stdbool.h>
#include <string.h>

View File

@ -29,7 +29,7 @@
#include <sys/dir.h>
#else
#include <dirent.h>
#endif /* ifdef __APPLE__ */
#endif /* __APPLE__ */
#include "windows.h"
#include "toxic.h"

View File

@ -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 */
int dir_match(ToxWindow *self, Tox *m, const wchar_t *line, const wchar_t *cmd);
#endif /* #define AUTOCOMPLETE_H */
#endif /* AUTOCOMPLETE_H */

View File

@ -39,4 +39,4 @@ void do_tox_connection(Tox *m);
*/
int load_DHT_nodeslist(void);
#endif /* BOOTSTRAP_H */
#endif /* BOOTSTRAP_H */

View File

@ -51,8 +51,8 @@
#include "audio_call.h"
#ifdef VIDEO
#include "video_call.h"
#endif /* VIDEO */
#endif /* AUDIO */
#endif /* VIDEO */
#endif /* AUDIO */
extern char *DATA_FILE;
extern FriendsList Friends;
@ -63,7 +63,7 @@ extern struct user_settings *user_settings;
#ifdef AUDIO
static void init_infobox(ToxWindow *self);
static void kill_infobox(ToxWindow *self);
#endif /* AUDIO */
#endif /* AUDIO */
#ifdef AUDIO
#define AC_NUM_CHAT_COMMANDS_AUDIO 9
@ -150,9 +150,9 @@ void kill_chat_window(ToxWindow *self, Tox *m)
#ifdef AUDIO
#ifdef VIDEO
stop_video_stream(self);
#endif /* VIDEO */
#endif /* VIDEO */
stop_current_call(self);
#endif /* AUDIO */
#endif /* AUDIO */
kill_all_file_transfers_friend(m, self->num);
log_disable(ctx->log);

View File

@ -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]);
#endif /* VIDEO */
#endif /* #define CHAT_COMMANDS_H */
#endif /* CHAT_COMMANDS_H */

View File

@ -53,4 +53,4 @@ void get_home_dir(char *home, int size);
*/
int create_user_config_dirs(char *path);
#endif /* #define CONFIGDIR_H */
#endif /* CONFIGDIR_H */

View File

@ -52,4 +52,4 @@ int set_curl_proxy(CURL *c_handle, const char *proxy_address, uint16_t port, uin
*/
size_t curl_cb_write_data(void *data, size_t size, size_t nmemb, void *user_pointer);
#endif /* CURL_UTIL_H */
#endif /* CURL_UTIL_H */

View File

@ -36,4 +36,4 @@ enum {
void execute(WINDOW *w, ToxWindow *self, Tox *m, const char *input, int mode);
#endif /* #define EXECUTE_H */
#endif /* EXECUTE_H */

View File

@ -108,4 +108,4 @@ void kill_all_file_transfers_friend(Tox *m, uint32_t friendnum);
void kill_all_file_transfers(Tox *m);
#endif /* #define FILE_TRANSFERS_H */
#endif /* FILE_TRANSFERS_H */

View File

@ -60,6 +60,6 @@ void cmd_change_video_device(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv
#ifdef PYTHON
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 */

View File

@ -28,4 +28,4 @@
void cmd_set_title(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]);
#endif /* GROUP_COMMANDS_H */
#endif /* GROUP_COMMANDS_H */

View File

@ -41,9 +41,9 @@
/* compatibility with older versions of OpenAL */
#ifndef ALC_ALL_DEVICES_SPECIFIER
#include <AL/alext.h>
#endif /* ALC_ALL_DEVICES_SPECIFIER */
#endif /* __APPLE__ */
#endif /* AUDIO */
#endif /* ALC_ALL_DEVICES_SPECIFIER */
#endif /* __APPLE__ */
#endif /* AUDIO */
#include "windows.h"
#include "toxic.h"

View File

@ -63,4 +63,4 @@ void redraw_groupchat_win(ToxWindow *self);
ToxWindow new_group_chat(Tox *m, uint32_t groupnum);
#endif /* #define GROUPCHAT_H */
#endif /* GROUPCHAT_H */

View File

@ -326,7 +326,7 @@ static void help_draw_plugin(ToxWindow *self)
box(win, ACS_VLINE, ACS_HLINE);
wnoutrefresh(win);
}
#endif
#endif /* PYTHON */
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());
self->help->type = HELP_PLUGIN;
break;
#endif
#endif /* PYTHON */
case 'f':
help_init_window(self, 10, 80);

View File

@ -42,4 +42,4 @@ void help_onDraw(ToxWindow *self);
void help_init_menu(ToxWindow *self);
void help_onKey(ToxWindow *self, wint_t key);
#endif /* #define HELP_H */
#endif /* HELP_H */

View File

@ -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 */
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 */

View File

@ -100,4 +100,4 @@ void line_info_reset_start(ToxWindow *self, 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 */
#endif /* #define LINE_INFO_H */
#endif /* LINE_INFO_H */

View File

@ -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. */
int rename_logfile(char *src, char *dest, const char *selfkey, const char *otherkey, int winnum);
#endif /* #define LOG_H */
#endif /* LOG_H */

View File

@ -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. */
void cqueue_remove(ToxWindow *self, Tox *m, uint32_t receipt);
#endif /* #define MESSAGE_QUEUE_H */
#endif /* MESSAGE_QUEUE_H */

View File

@ -170,4 +170,4 @@ bool is_ip4_address(const char *address);
*/
bool is_ip6_address(const char *address);
#endif /* #define MISC_TOOLS_H */
#endif /* MISC_TOOLS_H */

View File

@ -47,12 +47,12 @@
/* compatibility with older versions of OpenAL */
#ifndef ALC_ALL_DEVICES_SPECIFIER
#include <AL/alext.h>
#endif
#endif
#endif /* ALC_ALL_DEVICES_SPECIFIER */
#endif /* __APPLE__ */
#ifdef SOUND_NOTIFY
#include <AL/alut.h> /* freealut packet */
#endif
#endif /* AUDIO */
#endif /* SOUND_NOTIFY */
#endif /* defined(AUDIO) || defined(SOUND_NOTIFY) */
#ifdef BOX_NOTIFY
#include <libnotify/notify.h>
@ -84,7 +84,7 @@ static struct _ActiveNotifications {
uint32_t source;
uint32_t buffer;
bool looping;
#endif
#endif /* SOUND_NOTIFY */
bool active;
int *id_indicator;
#ifdef BOX_NOTIFY
@ -93,7 +93,7 @@ static struct _ActiveNotifications {
char title[64];
size_t size;
time_t n_timeout;
#endif
#endif /* BOX_NOTIFY */
} actives[ACTIVE_NOTIFS_MAX];
/**********************************************************************************/
/**********************************************************************************/
@ -203,7 +203,7 @@ void graceful_clear(void)
actives[i].box = NULL;
}
#endif
#endif /* BOX_NOTIFY */
if (actives[i].id_indicator) {
*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*/
@ -388,7 +388,7 @@ void graceful_clear(void)
control_unlock();
}
#endif
#endif /* SOUND_NOTIFY */
/**********************************************************************************/
/**********************************************************************************/
@ -420,7 +420,7 @@ int init_notify(int login_cooldown, int notification_timeout)
return -1;
}
#endif
#endif /* defined(SOUND_NOTIFY) || defined(BOX_NOTIFY) */
Control.cooldown = time(NULL) + login_cooldown;
@ -445,7 +445,7 @@ void terminate_notify(void)
control_unlock();
graceful_clear();
#endif
#endif /* defined(SOUND_NOTIFY) || defined(BOX_NOTIFY) */
#ifdef SOUND_NOTIFY
int i = 0;
@ -534,20 +534,20 @@ void stop_sound(int id)
notify_notification_close(actives[id].box, &ignore);
}
#endif
#endif /* BOX_NOTIFY */
if (actives[id].id_indicator) {
*actives[id].id_indicator = -1;
}
// alSourcei(actives[id].source, AL_LOOPING, false);
// alSourcei(actives[id].source, AL_LOOPING, false);
alSourceStop(actives[id].source);
alDeleteSources(1, &actives[id].source);
alDeleteBuffers(1, &actives[id].buffer);
memset(&actives[id], 0, sizeof(struct _ActiveNotifications));
}
}
#endif
#endif /* SOUND_NOTIFY */
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 */
}
#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)
{
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) {
actives[id].id_indicator = id_indicator;
@ -695,7 +689,7 @@ int box_notify(ToxWindow *self, Notification notif, uint64_t flags, int *id_indi
return -1;
}
#endif /* SOUND_NOTIFY */
#endif /* SOUND_NOTIFY */
snprintf(actives[id].title, sizeof(actives[id].title), "%s", title);
@ -725,7 +719,7 @@ int box_notify(ToxWindow *self, Notification notif, uint64_t flags, int *id_indi
return id;
#else
return sound_notify(self, notif, flags, id_indicator);
#endif /* BOX_NOTIFY */
#endif /* BOX_NOTIFY */
}
int box_notify2(ToxWindow *self, Notification notif, uint64_t flags, int id, const char *format, ...)
@ -779,7 +773,7 @@ int box_notify2(ToxWindow *self, Notification notif, uint64_t flags, int id, con
return id;
#else
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, ...)
@ -837,7 +831,7 @@ int box_silent_notify(ToxWindow *self, uint64_t flags, int *id_indicator, const
return id;
#else
return -1;
#endif
#endif /* BOX_NOTIFY */
}
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;
#else
return -1;
#endif
#endif /* BOX_NOTIFY */
}

View File

@ -36,4 +36,4 @@ int python_num_registered_handlers(void);
int python_help_max_width(void);
void python_draw_handler_help(WINDOW *win);
#endif /* #define PYTHON_API_H */
#endif /* PYTHON_API_H */

View File

@ -125,4 +125,5 @@ enum settings_values {
#define MPLEX_AWAY_NOTE "Detached from screen"
int settings_load(struct user_settings *s, const char *patharg);
#endif /* #define SETTINGS_H */
#endif /* SETTINGS_H */

View File

@ -24,12 +24,12 @@
#define TERM_MPLEX_H
/* Checks if Toxic runs inside a terminal multiplexer (GNU screen or tmux). If
yes, it initializes a timer which periodically checks the attached/detached
state of the terminal and updates away status accordingly.
* yes, it initializes a timer which periodically checks the attached/detached
* state of the terminal and updates away status accordingly.
*/
int init_mplex_away_timer(Tox *m);
void lock_status(void);
void unlock_status(void);
#endif /* #define TERM_MPLEX_H */
#endif /* TERM_MPLEX_H */

View File

@ -900,7 +900,7 @@ void *thread_av(void *data)
usleep(toxav_iteration_interval(av) * 1000);
}
}
#endif /* AUDIO */
#endif /* AUDIO */
static void print_usage(void)
{
@ -1273,7 +1273,7 @@ int main(int argc, char **argv)
queue_init_message("X failed to initialize");
}
#endif
#endif /* X11 */
Tox *m = load_toxic(DATA_FILE);

View 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_read_receipt(Tox *m, uint32_t friendnumber, uint32_t receipt, void *userdata);
#endif /* #define TOXIC_H */
#endif /* TOXIC_H */

View File

@ -70,4 +70,4 @@ void fetch_hist_item(ChatContext *ctx, int key_dir);
void strsubst(char *str, char old, char new);
void wstrsubst(wchar_t *str, wchar_t old, wchar_t new);
#endif /* #define TOXIC_STRINGS_H */
#endif /* TOXIC_STRINGS_H */

View File

@ -447,4 +447,4 @@ void stop_video_stream(ToxWindow *self)
}
}
#endif
#endif /* VIDEO */

View File

@ -41,8 +41,8 @@
#include <sys/videoio.h>
#else
#include <linux/videodev2.h>
#endif
#endif
#endif /* defined(__OpenBSD__) || defined(__NetBSD__) */
#endif /* __OSX__ */
#include "line_info.h"
#include "settings.h"

View File

@ -487,7 +487,7 @@ void on_window_resize(void)
w->chatwin->infobox.win = newwin(INFOBOX_HEIGHT, INFOBOX_WIDTH + 1, 1, x2 - INFOBOX_WIDTH);
}
#endif /* AUDIO */
#endif /* AUDIO */
scrollok(w->chatwin->history, 0);
}

View File

@ -266,4 +266,4 @@ ToxWindow *get_active_window(void);
call at least once per second */
void refresh_inactive_windows(void);
#endif /* #define WINDOWS_H */
#endif /* WINDOWS_H */