mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 10:03:01 +01:00
Fix unused parameter and unused result warnings
This commit is contained in:
parent
206bf407fd
commit
98cb7f58c0
@ -15,7 +15,6 @@ cc_binary(
|
||||
"-DPYTHON",
|
||||
"-DQRCODE",
|
||||
"-DVIDEO",
|
||||
"-Wno-error=unused-result",
|
||||
],
|
||||
deps = [
|
||||
"//c-toxcore",
|
||||
|
2
Makefile
2
Makefile
@ -6,7 +6,7 @@ CFG_DIR = $(BASE_DIR)/cfg
|
||||
LIBS = toxcore ncursesw libconfig libcurl
|
||||
|
||||
CFLAGS ?= -g
|
||||
CFLAGS += -std=gnu99 -pthread -Wall -Wpedantic -fstack-protector-all
|
||||
CFLAGS += -std=gnu99 -pthread -Wall -Wpedantic -Wunused -fstack-protector-all
|
||||
CFLAGS += '-DTOXICVER="$(VERSION)"' -DHAVE_WIDECHAR -D_XOPEN_SOURCE_EXTENDED -D_FILE_OFFSET_BITS=64
|
||||
CFLAGS += '-DPACKAGE_DATADIR="$(abspath $(DATADIR))"'
|
||||
CFLAGS += ${USER_CFLAGS}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "notify.h"
|
||||
#include "friendlist.h"
|
||||
#include "chat.h"
|
||||
#include "misc_tools.h"
|
||||
|
||||
#ifdef AUDIO
|
||||
|
||||
@ -174,6 +175,8 @@ void terminate_audio(void)
|
||||
|
||||
void read_device_callback(const int16_t *captured, uint32_t size, void *data)
|
||||
{
|
||||
UNUSED_VAR(size);
|
||||
|
||||
Toxav_Err_Send_Frame error;
|
||||
uint32_t friend_number = *((uint32_t *)data); /* TODO: Or pass an array of call_idx's */
|
||||
int64_t sample_count = ((int64_t) CallControl.audio_sample_rate) * \
|
||||
@ -280,6 +283,10 @@ int stop_transmission(Call *call, uint32_t friend_number)
|
||||
*/
|
||||
void on_call(ToxAV *av, uint32_t friend_number, bool audio_enabled, bool video_enabled, void *user_data)
|
||||
{
|
||||
UNUSED_VAR(av);
|
||||
UNUSED_VAR(audio_enabled);
|
||||
UNUSED_VAR(video_enabled);
|
||||
|
||||
Tox *m = (Tox *) user_data;
|
||||
CallControl.pending_call = true;
|
||||
callback_recv_invite(m, friend_number);
|
||||
@ -287,6 +294,9 @@ void on_call(ToxAV *av, uint32_t friend_number, bool audio_enabled, bool video_e
|
||||
|
||||
void on_call_state(ToxAV *av, uint32_t friend_number, uint32_t state, void *user_data)
|
||||
{
|
||||
UNUSED_VAR(av);
|
||||
UNUSED_VAR(user_data);
|
||||
|
||||
CallControl.call_state = state;
|
||||
|
||||
switch (state) {
|
||||
@ -350,6 +360,9 @@ void on_audio_receive_frame(ToxAV *av, uint32_t friend_number,
|
||||
int16_t const *pcm, size_t sample_count,
|
||||
uint8_t channels, uint32_t sampling_rate, void *user_data)
|
||||
{
|
||||
UNUSED_VAR(av);
|
||||
UNUSED_VAR(user_data);
|
||||
|
||||
write_device_callback(friend_number, pcm, sample_count, channels, sampling_rate);
|
||||
}
|
||||
|
||||
@ -457,6 +470,10 @@ void callback_call_ended(uint32_t friend_number)
|
||||
*/
|
||||
void cmd_call(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(m);
|
||||
UNUSED_VAR(argv);
|
||||
|
||||
Toxav_Err_Call error;
|
||||
const char *error_str;
|
||||
|
||||
@ -508,6 +525,10 @@ on_error:
|
||||
|
||||
void cmd_answer(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(m);
|
||||
UNUSED_VAR(argv);
|
||||
|
||||
Toxav_Err_Answer error;
|
||||
const char *error_str;
|
||||
|
||||
@ -555,6 +576,10 @@ on_error:
|
||||
|
||||
void cmd_reject(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(m);
|
||||
UNUSED_VAR(argv);
|
||||
|
||||
const char *error_str;
|
||||
|
||||
if (argc != 0) {
|
||||
@ -586,6 +611,10 @@ on_error:
|
||||
|
||||
void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(m);
|
||||
UNUSED_VAR(argv);
|
||||
|
||||
const char *error_str = NULL;
|
||||
|
||||
if (!CallControl.av) {
|
||||
@ -615,6 +644,9 @@ on_error:
|
||||
|
||||
void cmd_list_devices(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(m);
|
||||
|
||||
const char *error_str;
|
||||
|
||||
if (argc != 1) {
|
||||
@ -655,6 +687,9 @@ on_error:
|
||||
/* This changes primary device only */
|
||||
void cmd_change_device(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(m);
|
||||
|
||||
const char *error_str;
|
||||
|
||||
if (argc != 2) {
|
||||
@ -705,6 +740,9 @@ on_error:
|
||||
|
||||
void cmd_ccur_device(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(m);
|
||||
|
||||
const char *error_str;
|
||||
|
||||
if (argc != 2) {
|
||||
@ -782,6 +820,9 @@ on_error:
|
||||
|
||||
void cmd_mute(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(m);
|
||||
|
||||
const char *error_str;
|
||||
|
||||
if (argc != 1) {
|
||||
@ -835,6 +876,9 @@ on_error:
|
||||
|
||||
void cmd_sense(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(m);
|
||||
|
||||
const char *error_str;
|
||||
|
||||
if (argc != 1) {
|
||||
@ -869,6 +913,9 @@ on_error:
|
||||
|
||||
void cmd_bitrate(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(m);
|
||||
|
||||
char *error_str;
|
||||
|
||||
if (argc != 1) {
|
||||
|
@ -61,6 +61,8 @@ static void print_matches(ToxWindow *self, Tox *m, const void *list, size_t n_it
|
||||
*/
|
||||
static size_t get_str_match(ToxWindow *self, char *match, size_t match_sz, char (*matches)[MAX_STR_SIZE], int n)
|
||||
{
|
||||
UNUSED_VAR(self);
|
||||
|
||||
if (n == 1) {
|
||||
return snprintf(match, match_sz, "%s", matches[0]);
|
||||
}
|
||||
|
@ -430,6 +430,8 @@ static int extract_node(const char *line, struct Node *node)
|
||||
/* Loads the DHT nodeslist to memory from json encoded nodes file. */
|
||||
void *load_nodeslist_thread(void *data)
|
||||
{
|
||||
UNUSED_VAR(data);
|
||||
|
||||
char nodes_path[PATH_MAX];
|
||||
get_nodeslist_path(nodes_path, sizeof(nodes_path));
|
||||
|
||||
|
63
src/chat.c
63
src/chat.c
@ -172,8 +172,7 @@ void kill_chat_window(ToxWindow *self, Tox *m)
|
||||
del_window(self);
|
||||
}
|
||||
|
||||
static void recv_message_helper(ToxWindow *self, Tox *m, uint32_t num, const char *msg, size_t len,
|
||||
const char *nick, const char *timefrmt)
|
||||
static void recv_message_helper(ToxWindow *self, const char *msg, const char *nick, const char *timefrmt)
|
||||
{
|
||||
ChatContext *ctx = self->chatwin;
|
||||
|
||||
@ -189,8 +188,7 @@ static void recv_message_helper(ToxWindow *self, Tox *m, uint32_t num, const cha
|
||||
}
|
||||
}
|
||||
|
||||
static void recv_action_helper(ToxWindow *self, Tox *m, uint32_t num, const char *action, size_t len,
|
||||
const char *nick, const char *timefrmt)
|
||||
static void recv_action_helper(ToxWindow *self, const char *action, const char *nick, const char *timefrmt)
|
||||
{
|
||||
ChatContext *ctx = self->chatwin;
|
||||
|
||||
@ -208,6 +206,8 @@ static void recv_action_helper(ToxWindow *self, Tox *m, uint32_t num, const char
|
||||
|
||||
static void chat_onMessage(ToxWindow *self, Tox *m, uint32_t num, Tox_Message_Type type, const char *msg, size_t len)
|
||||
{
|
||||
UNUSED_VAR(len);
|
||||
|
||||
if (self->num != num) {
|
||||
return;
|
||||
}
|
||||
@ -219,17 +219,17 @@ static void chat_onMessage(ToxWindow *self, Tox *m, uint32_t num, Tox_Message_Ty
|
||||
get_time_str(timefrmt, sizeof(timefrmt));
|
||||
|
||||
if (type == TOX_MESSAGE_TYPE_NORMAL) {
|
||||
recv_message_helper(self, m, num, msg, len, nick, timefrmt);
|
||||
recv_message_helper(self, msg, nick, timefrmt);
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == TOX_MESSAGE_TYPE_ACTION) {
|
||||
recv_action_helper(self, m, num, msg, len, nick, timefrmt);
|
||||
recv_action_helper(self, msg, nick, timefrmt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void chat_pause_file_transfers(Tox *m, uint32_t friendnum);
|
||||
static void chat_pause_file_transfers(uint32_t friendnum);
|
||||
static void chat_resume_file_senders(ToxWindow *self, Tox *m, uint32_t fnum);
|
||||
|
||||
static void chat_onConnectionChange(ToxWindow *self, Tox *m, uint32_t num, Tox_Connection connection_status)
|
||||
@ -268,7 +268,7 @@ static void chat_onConnectionChange(ToxWindow *self, Tox *m, uint32_t num, Tox_C
|
||||
set_self_typingstatus(self, m, 0);
|
||||
}
|
||||
|
||||
chat_pause_file_transfers(m, num);
|
||||
chat_pause_file_transfers(num);
|
||||
|
||||
msg = "has gone offline";
|
||||
line_info_add(self, timefrmt, nick, NULL, DISCONNECTION, 0, RED, msg);
|
||||
@ -278,6 +278,8 @@ static void chat_onConnectionChange(ToxWindow *self, Tox *m, uint32_t num, Tox_C
|
||||
|
||||
static void chat_onTypingChange(ToxWindow *self, Tox *m, uint32_t num, bool is_typing)
|
||||
{
|
||||
UNUSED_VAR(m);
|
||||
|
||||
if (self->num != num) {
|
||||
return;
|
||||
}
|
||||
@ -287,6 +289,8 @@ static void chat_onTypingChange(ToxWindow *self, Tox *m, uint32_t num, bool is_t
|
||||
|
||||
static void chat_onNickChange(ToxWindow *self, Tox *m, uint32_t num, const char *nick, size_t length)
|
||||
{
|
||||
UNUSED_VAR(m);
|
||||
|
||||
if (self->num != num) {
|
||||
return;
|
||||
}
|
||||
@ -302,6 +306,8 @@ static void chat_onNickChange(ToxWindow *self, Tox *m, uint32_t num, const char
|
||||
|
||||
static void chat_onStatusChange(ToxWindow *self, Tox *m, uint32_t num, Tox_User_Status status)
|
||||
{
|
||||
UNUSED_VAR(m);
|
||||
|
||||
if (self->num != num) {
|
||||
return;
|
||||
}
|
||||
@ -312,6 +318,8 @@ static void chat_onStatusChange(ToxWindow *self, Tox *m, uint32_t num, Tox_User_
|
||||
|
||||
static void chat_onStatusMessageChange(ToxWindow *self, uint32_t num, const char *status, size_t length)
|
||||
{
|
||||
UNUSED_VAR(length);
|
||||
|
||||
if (self->num != num) {
|
||||
return;
|
||||
}
|
||||
@ -324,11 +332,13 @@ static void chat_onStatusMessageChange(ToxWindow *self, uint32_t num, const char
|
||||
|
||||
static void chat_onReadReceipt(ToxWindow *self, Tox *m, uint32_t num, uint32_t receipt)
|
||||
{
|
||||
UNUSED_VAR(num);
|
||||
|
||||
cqueue_remove(self, m, receipt);
|
||||
}
|
||||
|
||||
/* Stops active file transfers for this friend. Called when a friend goes offline */
|
||||
static void chat_pause_file_transfers(Tox *m, uint32_t friendnum)
|
||||
static void chat_pause_file_transfers(uint32_t friendnum)
|
||||
{
|
||||
ToxicFriend *friend = &Friends.list[friendnum];
|
||||
|
||||
@ -436,6 +446,8 @@ static void chat_onFileChunkRequest(ToxWindow *self, Tox *m, uint32_t friendnum,
|
||||
static void chat_onFileRecvChunk(ToxWindow *self, Tox *m, uint32_t friendnum, uint32_t filenum, uint64_t position,
|
||||
const char *data, size_t length)
|
||||
{
|
||||
UNUSED_VAR(position);
|
||||
|
||||
if (friendnum != self->num) {
|
||||
return;
|
||||
}
|
||||
@ -704,6 +716,9 @@ static void chat_onGroupInvite(ToxWindow *self, Tox *m, int32_t friendnumber, ui
|
||||
|
||||
void chat_onInvite(ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||
{
|
||||
UNUSED_VAR(av);
|
||||
UNUSED_VAR(state);
|
||||
|
||||
if (!self || self->num != friend_number) {
|
||||
return;
|
||||
}
|
||||
@ -726,6 +741,9 @@ void chat_onInvite(ToxWindow *self, ToxAV *av, uint32_t friend_number, int state
|
||||
|
||||
void chat_onRinging(ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||
{
|
||||
UNUSED_VAR(av);
|
||||
UNUSED_VAR(state);
|
||||
|
||||
if (!self || self->num != friend_number) {
|
||||
return;
|
||||
}
|
||||
@ -743,6 +761,9 @@ void chat_onRinging(ToxWindow *self, ToxAV *av, uint32_t friend_number, int stat
|
||||
|
||||
void chat_onStarting(ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||
{
|
||||
UNUSED_VAR(av);
|
||||
UNUSED_VAR(state);
|
||||
|
||||
if (!self || self->num != friend_number) {
|
||||
return;
|
||||
}
|
||||
@ -761,6 +782,9 @@ void chat_onStarting(ToxWindow *self, ToxAV *av, uint32_t friend_number, int sta
|
||||
|
||||
void chat_onEnding(ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||
{
|
||||
UNUSED_VAR(av);
|
||||
UNUSED_VAR(state);
|
||||
|
||||
if (!self || self->num != friend_number) {
|
||||
return;
|
||||
}
|
||||
@ -777,6 +801,9 @@ void chat_onEnding(ToxWindow *self, ToxAV *av, uint32_t friend_number, int state
|
||||
|
||||
void chat_onError(ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||
{
|
||||
UNUSED_VAR(av);
|
||||
UNUSED_VAR(state);
|
||||
|
||||
if (!self || self->num != friend_number) {
|
||||
return;
|
||||
}
|
||||
@ -791,6 +818,9 @@ void chat_onError(ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||
|
||||
void chat_onStart(ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||
{
|
||||
UNUSED_VAR(av);
|
||||
UNUSED_VAR(state);
|
||||
|
||||
if (!self || self->num != friend_number) {
|
||||
return;
|
||||
}
|
||||
@ -809,6 +839,9 @@ void chat_onStart(ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||
|
||||
void chat_onCancel(ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||
{
|
||||
UNUSED_VAR(av);
|
||||
UNUSED_VAR(state);
|
||||
|
||||
if (!self || self->num != friend_number) {
|
||||
return;
|
||||
}
|
||||
@ -824,6 +857,9 @@ void chat_onCancel(ToxWindow *self, ToxAV *av, uint32_t friend_number, int state
|
||||
|
||||
void chat_onReject(ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||
{
|
||||
UNUSED_VAR(av);
|
||||
UNUSED_VAR(state);
|
||||
|
||||
if (!self || self->num != friend_number) {
|
||||
return;
|
||||
}
|
||||
@ -838,6 +874,9 @@ void chat_onReject(ToxWindow *self, ToxAV *av, uint32_t friend_number, int state
|
||||
|
||||
void chat_onEnd(ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||
{
|
||||
UNUSED_VAR(av);
|
||||
UNUSED_VAR(state);
|
||||
|
||||
if (!self || self->num != friend_number) {
|
||||
return;
|
||||
}
|
||||
@ -986,7 +1025,7 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
}
|
||||
|
||||
if (ltr || key == '\n') { /* char is printable */
|
||||
input_new_char(self, key, x, y, x2, y2);
|
||||
input_new_char(self, key, x, x2);
|
||||
|
||||
if (ctx->line[0] != '/' && !ctx->self_is_typing && statusbar->connection != TOX_CONNECTION_NONE) {
|
||||
set_self_typingstatus(self, m, 1);
|
||||
@ -999,7 +1038,7 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
return;
|
||||
}
|
||||
|
||||
input_handle(self, key, x, y, x2, y2);
|
||||
input_handle(self, key, x, x2);
|
||||
|
||||
if (key == '\t' && ctx->len > 1 && ctx->line[0] == '/') { /* TAB key: auto-complete */
|
||||
int diff = -1;
|
||||
@ -1219,7 +1258,7 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&Winthread.lock);
|
||||
refresh_file_transfer_progress(self, m, self->num);
|
||||
refresh_file_transfer_progress(self, self->num);
|
||||
pthread_mutex_unlock(&Winthread.lock);
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,8 @@ extern FriendsList Friends;
|
||||
|
||||
void cmd_cancelfile(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
|
||||
if (argc < 2) {
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Requires type in|out and the file ID.");
|
||||
return;
|
||||
@ -80,6 +82,8 @@ void cmd_cancelfile(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*ar
|
||||
|
||||
void cmd_groupinvite(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
|
||||
if (argc < 1) {
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Group number required.");
|
||||
return;
|
||||
@ -104,6 +108,10 @@ void cmd_groupinvite(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*a
|
||||
|
||||
void cmd_join_group(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(argc);
|
||||
UNUSED_VAR(argv);
|
||||
|
||||
if (get_num_active_windows() >= MAX_WINDOWS_NUM) {
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, RED, " * Warning: Too many windows are open.");
|
||||
return;
|
||||
@ -132,7 +140,7 @@ void cmd_join_group(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*ar
|
||||
return;
|
||||
}
|
||||
|
||||
if (init_groupchat_win(prompt, m, groupnum, type, NULL, 0) == -1) {
|
||||
if (init_groupchat_win(m, groupnum, type, NULL, 0) == -1) {
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Group chat window failed to initialize.");
|
||||
tox_conference_delete(m, groupnum, NULL);
|
||||
return;
|
||||
@ -142,6 +150,8 @@ void cmd_join_group(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*ar
|
||||
|
||||
void cmd_savefile(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
|
||||
if (argc < 1) {
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "File ID required.");
|
||||
return;
|
||||
@ -218,6 +228,8 @@ on_recv_error:
|
||||
|
||||
void cmd_sendfile(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
|
||||
const char *errmsg = NULL;
|
||||
|
||||
if (argc < 1) {
|
||||
|
@ -145,7 +145,7 @@ static bool is_special_command(const char *input)
|
||||
*
|
||||
* Returns the number of arguments.
|
||||
*/
|
||||
static int parse_special_command(WINDOW *w, ToxWindow *self, const char *input, char (*args)[MAX_STR_SIZE])
|
||||
static int parse_special_command(const char *input, char (*args)[MAX_STR_SIZE])
|
||||
{
|
||||
int len = strlen(input);
|
||||
int s = char_find(0, input, ' ');
|
||||
@ -167,10 +167,10 @@ static int parse_special_command(WINDOW *w, ToxWindow *self, const char *input,
|
||||
*
|
||||
* Returns the number of arguments.
|
||||
*/
|
||||
static int parse_command(WINDOW *w, ToxWindow *self, const char *input, char (*args)[MAX_STR_SIZE])
|
||||
static int parse_command(const char *input, char (*args)[MAX_STR_SIZE])
|
||||
{
|
||||
if (is_special_command(input)) {
|
||||
return parse_special_command(w, self, input, args);
|
||||
return parse_special_command(input, args);
|
||||
}
|
||||
|
||||
char *cmd = strdup(input);
|
||||
@ -227,7 +227,7 @@ void execute(WINDOW *w, ToxWindow *self, Tox *m, const char *input, int mode)
|
||||
}
|
||||
|
||||
char args[MAX_NUM_ARGS][MAX_STR_SIZE];
|
||||
int num_args = parse_command(w, self, input, args);
|
||||
int num_args = parse_command(input, args);
|
||||
|
||||
if (num_args <= 0) {
|
||||
return;
|
||||
|
@ -87,7 +87,7 @@ void print_progress_bar(ToxWindow *self, double bps, double pct_done, uint32_t l
|
||||
line_info_set(self, line_id, full_line);
|
||||
}
|
||||
|
||||
static void refresh_progress_helper(ToxWindow *self, Tox *m, struct FileTransfer *ft)
|
||||
static void refresh_progress_helper(ToxWindow *self, struct FileTransfer *ft)
|
||||
{
|
||||
if (ft->state == FILE_TRANSFER_INACTIVE) {
|
||||
return;
|
||||
@ -107,13 +107,13 @@ static void refresh_progress_helper(ToxWindow *self, Tox *m, struct FileTransfer
|
||||
}
|
||||
|
||||
/* refreshes active file transfer status bars. */
|
||||
void refresh_file_transfer_progress(ToxWindow *self, Tox *m, uint32_t friendnum)
|
||||
void refresh_file_transfer_progress(ToxWindow *self, uint32_t friendnum)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < MAX_FILES; ++i) {
|
||||
refresh_progress_helper(self, m, &Friends.list[friendnum].file_receiver[i]);
|
||||
refresh_progress_helper(self, m, &Friends.list[friendnum].file_sender[i]);
|
||||
refresh_progress_helper(self, &Friends.list[friendnum].file_receiver[i]);
|
||||
refresh_progress_helper(self, &Friends.list[friendnum].file_sender[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ void init_progress_bar(char *progline);
|
||||
void print_progress_bar(ToxWindow *self, double pct_done, double bps, uint32_t line_id);
|
||||
|
||||
/* refreshes active file transfer status bars. */
|
||||
void refresh_file_transfer_progress(ToxWindow *self, Tox *m, uint32_t friendnum);
|
||||
void refresh_file_transfer_progress(ToxWindow *self, uint32_t friendnum);
|
||||
|
||||
/* Returns a pointer to friendnum's FileTransfer struct associated with filenum.
|
||||
* Returns NULL if filenum is invalid.
|
||||
|
@ -344,6 +344,10 @@ static void update_friend_last_online(uint32_t num, time_t timestamp)
|
||||
static void friendlist_onMessage(ToxWindow *self, Tox *m, uint32_t num, Tox_Message_Type type, const char *str,
|
||||
size_t length)
|
||||
{
|
||||
UNUSED_VAR(self);
|
||||
UNUSED_VAR(type);
|
||||
UNUSED_VAR(length);
|
||||
|
||||
if (num >= Friends.max_idx) {
|
||||
return;
|
||||
}
|
||||
@ -370,6 +374,8 @@ static void friendlist_onMessage(ToxWindow *self, Tox *m, uint32_t num, Tox_Mess
|
||||
|
||||
static void friendlist_onConnectionChange(ToxWindow *self, Tox *m, uint32_t num, Tox_Connection connection_status)
|
||||
{
|
||||
UNUSED_VAR(self);
|
||||
|
||||
if (num >= Friends.max_idx) {
|
||||
return;
|
||||
}
|
||||
@ -392,6 +398,9 @@ static void friendlist_onConnectionChange(ToxWindow *self, Tox *m, uint32_t num,
|
||||
|
||||
static void friendlist_onNickChange(ToxWindow *self, Tox *m, uint32_t num, const char *nick, size_t length)
|
||||
{
|
||||
UNUSED_VAR(self);
|
||||
UNUSED_VAR(length);
|
||||
|
||||
if (num >= Friends.max_idx) {
|
||||
return;
|
||||
}
|
||||
@ -419,6 +428,9 @@ static void friendlist_onNickChange(ToxWindow *self, Tox *m, uint32_t num, const
|
||||
|
||||
static void friendlist_onStatusChange(ToxWindow *self, Tox *m, uint32_t num, Tox_User_Status status)
|
||||
{
|
||||
UNUSED_VAR(self);
|
||||
UNUSED_VAR(m);
|
||||
|
||||
if (num >= Friends.max_idx) {
|
||||
return;
|
||||
}
|
||||
@ -428,6 +440,8 @@ static void friendlist_onStatusChange(ToxWindow *self, Tox *m, uint32_t num, Tox
|
||||
|
||||
static void friendlist_onStatusMessageChange(ToxWindow *self, uint32_t num, const char *note, size_t length)
|
||||
{
|
||||
UNUSED_VAR(self);
|
||||
|
||||
if (length > TOX_MAX_STATUS_MESSAGE_LENGTH || num >= Friends.max_idx) {
|
||||
return;
|
||||
}
|
||||
@ -438,6 +452,8 @@ static void friendlist_onStatusMessageChange(ToxWindow *self, uint32_t num, cons
|
||||
|
||||
void friendlist_onFriendAdded(ToxWindow *self, Tox *m, uint32_t num, bool sort)
|
||||
{
|
||||
UNUSED_VAR(self);
|
||||
|
||||
realloc_friends(Friends.max_idx + 1);
|
||||
memset(&Friends.list[Friends.max_idx], 0, sizeof(ToxicFriend));
|
||||
|
||||
@ -495,7 +511,7 @@ void friendlist_onFriendAdded(ToxWindow *self, Tox *m, uint32_t num, bool sort)
|
||||
}
|
||||
|
||||
/* Puts blocked friend back in friendlist. fnum is new friend number, bnum is blocked number. */
|
||||
static void friendlist_add_blocked(Tox *m, uint32_t fnum, uint32_t bnum)
|
||||
static void friendlist_add_blocked(uint32_t fnum, uint32_t bnum)
|
||||
{
|
||||
realloc_friends(Friends.max_idx + 1);
|
||||
memset(&Friends.list[Friends.max_idx], 0, sizeof(ToxicFriend));
|
||||
@ -536,6 +552,11 @@ static void friendlist_add_blocked(Tox *m, uint32_t fnum, uint32_t bnum)
|
||||
static void friendlist_onFileRecv(ToxWindow *self, Tox *m, uint32_t num, uint32_t filenum,
|
||||
uint64_t file_size, const char *filename, size_t name_length)
|
||||
{
|
||||
UNUSED_VAR(self);
|
||||
UNUSED_VAR(file_size);
|
||||
UNUSED_VAR(filename);
|
||||
UNUSED_VAR(name_length);
|
||||
|
||||
if (num >= Friends.max_idx) {
|
||||
return;
|
||||
}
|
||||
@ -563,6 +584,11 @@ static void friendlist_onFileRecv(ToxWindow *self, Tox *m, uint32_t num, uint32_
|
||||
static void friendlist_onGroupInvite(ToxWindow *self, Tox *m, int32_t num, uint8_t type, const char *group_pub_key,
|
||||
uint16_t length)
|
||||
{
|
||||
UNUSED_VAR(self);
|
||||
UNUSED_VAR(type);
|
||||
UNUSED_VAR(group_pub_key);
|
||||
UNUSED_VAR(length);
|
||||
|
||||
if (num >= Friends.max_idx) {
|
||||
return;
|
||||
}
|
||||
@ -586,7 +612,7 @@ static void friendlist_onGroupInvite(ToxWindow *self, Tox *m, int32_t num, uint8
|
||||
}
|
||||
|
||||
/* move friendlist/blocklist cursor up and down */
|
||||
static void select_friend(ToxWindow *self, wint_t key, int *selected, int num)
|
||||
static void select_friend(wint_t key, int *selected, int num)
|
||||
{
|
||||
if (num <= 0) {
|
||||
return;
|
||||
@ -656,7 +682,7 @@ static void delete_friend(Tox *m, uint32_t f_num)
|
||||
}
|
||||
|
||||
/* activates delete friend popup */
|
||||
static void del_friend_activate(ToxWindow *self, Tox *m, uint32_t f_num)
|
||||
static void del_friend_activate(uint32_t f_num)
|
||||
{
|
||||
PendingDelete.popup = newwin(3, 22 + TOXIC_MAX_NAME_LENGTH, 8, 8);
|
||||
PendingDelete.active = true;
|
||||
@ -666,7 +692,7 @@ static void del_friend_activate(ToxWindow *self, Tox *m, uint32_t f_num)
|
||||
static void delete_blocked_friend(uint32_t bnum);
|
||||
|
||||
/* deactivates delete friend popup and deletes friend if instructed */
|
||||
static void del_friend_deactivate(ToxWindow *self, Tox *m, wint_t key)
|
||||
static void del_friend_deactivate(Tox *m, wint_t key)
|
||||
{
|
||||
if (key == 'y') {
|
||||
if (blocklist_view == 0) {
|
||||
@ -791,7 +817,7 @@ static void unblock_friend(Tox *m, uint32_t bnum)
|
||||
return;
|
||||
}
|
||||
|
||||
friendlist_add_blocked(m, friendnum, bnum);
|
||||
friendlist_add_blocked(friendnum, bnum);
|
||||
delete_blocked_friend(bnum);
|
||||
sort_blocklist_index();
|
||||
sort_friendlist_index();
|
||||
@ -829,7 +855,7 @@ static void friendlist_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
/* lock screen and force decision on deletion popup */
|
||||
if (PendingDelete.active) {
|
||||
if (key == 'y' || key == 'n') {
|
||||
del_friend_deactivate(self, m, key);
|
||||
del_friend_deactivate(m, key);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -860,7 +886,7 @@ static void friendlist_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
break;
|
||||
|
||||
case KEY_DC:
|
||||
del_friend_activate(self, m, f);
|
||||
del_friend_activate(f);
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
@ -879,9 +905,9 @@ static void friendlist_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
|
||||
default:
|
||||
if (blocklist_view == 0) {
|
||||
select_friend(self, key, &Friends.num_selected, Friends.num_friends);
|
||||
select_friend(key, &Friends.num_selected, Friends.num_friends);
|
||||
} else {
|
||||
select_friend(self, key, &Blocked.num_selected, Blocked.num_blocked);
|
||||
select_friend(key, &Blocked.num_selected, Blocked.num_blocked);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -892,6 +918,8 @@ static void friendlist_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
|
||||
static void blocklist_onDraw(ToxWindow *self, Tox *m, int y2, int x2)
|
||||
{
|
||||
UNUSED_VAR(m);
|
||||
|
||||
wattron(self->window, A_BOLD);
|
||||
wprintw(self->window, " Blocked: ");
|
||||
wattroff(self->window, A_BOLD);
|
||||
@ -1199,13 +1227,12 @@ void disable_chatwin(uint32_t f_num)
|
||||
#ifdef AUDIO
|
||||
static void friendlist_onAV(ToxWindow *self, ToxAV *av, uint32_t friend_number, int state)
|
||||
{
|
||||
assert(0);
|
||||
UNUSED_VAR(self);
|
||||
|
||||
if (friend_number >= Friends.max_idx) {
|
||||
return;
|
||||
}
|
||||
|
||||
assert(0);
|
||||
Tox *m = toxav_get_tox(av);
|
||||
|
||||
if (Friends.list[friend_number].chatwin == -1) {
|
||||
|
@ -45,6 +45,8 @@ extern FriendsList Friends;
|
||||
/* command functions */
|
||||
void cmd_accept(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
|
||||
if (argc < 1) {
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Request ID required.");
|
||||
return;
|
||||
@ -142,6 +144,8 @@ void cmd_add_helper(ToxWindow *self, Tox *m, const char *id_bin, const char *msg
|
||||
|
||||
void cmd_add(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
|
||||
if (argc < 1) {
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Tox ID or address required.");
|
||||
return;
|
||||
@ -206,6 +210,8 @@ void cmd_add(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX
|
||||
|
||||
void cmd_avatar(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
|
||||
if (argc != 1 || strlen(argv[1]) < 3) {
|
||||
avatar_unset(m);
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Avatar has been unset.");
|
||||
@ -237,12 +243,18 @@ void cmd_avatar(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
||||
|
||||
void cmd_clear(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(m);
|
||||
UNUSED_VAR(argc);
|
||||
UNUSED_VAR(argv);
|
||||
|
||||
line_info_clear(self->chatwin->hst);
|
||||
force_refresh(window);
|
||||
}
|
||||
|
||||
void cmd_connect(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
|
||||
if (argc != 3) {
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Require: <ip> <port> <key>");
|
||||
return;
|
||||
@ -290,6 +302,9 @@ void cmd_connect(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)
|
||||
|
||||
void cmd_decline(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(m);
|
||||
|
||||
if (argc < 1) {
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Request ID required.");
|
||||
return;
|
||||
@ -323,6 +338,8 @@ void cmd_decline(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)
|
||||
|
||||
void cmd_groupchat(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
|
||||
if (get_num_active_windows() >= MAX_WINDOWS_NUM) {
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, RED, " * Warning: Too many windows are open.");
|
||||
return;
|
||||
@ -358,7 +375,7 @@ void cmd_groupchat(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
|
||||
return;
|
||||
}
|
||||
|
||||
if (init_groupchat_win(prompt, m, groupnum, type, NULL, 0) == -1) {
|
||||
if (init_groupchat_win(m, groupnum, type, NULL, 0) == -1) {
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Group chat window failed to initialize.");
|
||||
tox_conference_delete(m, groupnum, NULL);
|
||||
return;
|
||||
@ -369,6 +386,8 @@ void cmd_groupchat(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
|
||||
|
||||
void cmd_log(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
|
||||
const char *msg;
|
||||
struct chatlog *log = self->chatwin->log;
|
||||
|
||||
@ -421,6 +440,10 @@ void cmd_log(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX
|
||||
|
||||
void cmd_myid(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(argc);
|
||||
UNUSED_VAR(argv);
|
||||
|
||||
char id_string[TOX_ADDRESS_SIZE * 2 + 1];
|
||||
char bin_id[TOX_ADDRESS_SIZE];
|
||||
tox_self_get_address(m, (uint8_t *) bin_id);
|
||||
@ -436,6 +459,8 @@ void cmd_myid(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
|
||||
#ifdef QRCODE
|
||||
void cmd_myqr(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
|
||||
char id_string[TOX_ADDRESS_SIZE * 2 + 1];
|
||||
char bin_id[TOX_ADDRESS_SIZE];
|
||||
tox_self_get_address(m, (uint8_t *) bin_id);
|
||||
@ -495,6 +520,8 @@ void cmd_myqr(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
|
||||
|
||||
void cmd_nick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
|
||||
if (argc < 1) {
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Input required.");
|
||||
return;
|
||||
@ -520,6 +547,8 @@ void cmd_nick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
|
||||
|
||||
void cmd_note(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
|
||||
if (argc < 1) {
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Input required.");
|
||||
return;
|
||||
@ -555,16 +584,31 @@ void cmd_nospam(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
||||
|
||||
void cmd_prompt_help(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(m);
|
||||
UNUSED_VAR(argc);
|
||||
UNUSED_VAR(argv);
|
||||
|
||||
help_init_menu(self);
|
||||
}
|
||||
|
||||
void cmd_quit(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(argc);
|
||||
UNUSED_VAR(argv);
|
||||
UNUSED_VAR(self);
|
||||
|
||||
exit_toxic_success(m);
|
||||
}
|
||||
|
||||
void cmd_requests(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(m);
|
||||
UNUSED_VAR(argc);
|
||||
UNUSED_VAR(argv);
|
||||
|
||||
if (FrndRequests.num_requests == 0) {
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "No pending friend requests.");
|
||||
return;
|
||||
@ -597,6 +641,8 @@ void cmd_requests(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv
|
||||
|
||||
void cmd_status(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
|
||||
const char *errmsg;
|
||||
|
||||
lock_status();
|
||||
|
@ -30,6 +30,8 @@
|
||||
|
||||
void cmd_set_title(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
|
||||
Tox_Err_Conference_Title err;
|
||||
char title[MAX_STR_SIZE];
|
||||
|
||||
|
@ -114,6 +114,8 @@ static const char group_cmd_list[AC_NUM_GROUP_COMMANDS][MAX_CMDNAME_SIZE] = {
|
||||
#endif /* PYTHON */
|
||||
};
|
||||
|
||||
static ToxWindow *new_group_chat(uint32_t groupnum);
|
||||
|
||||
static void kill_groupchat_window(ToxWindow *self)
|
||||
{
|
||||
ChatContext *ctx = self->chatwin;
|
||||
@ -129,14 +131,14 @@ static void kill_groupchat_window(ToxWindow *self)
|
||||
del_window(self);
|
||||
}
|
||||
|
||||
int init_groupchat_win(ToxWindow *prompt, Tox *m, uint32_t groupnum, uint8_t type, const char *title,
|
||||
int init_groupchat_win(Tox *m, uint32_t groupnum, uint8_t type, const char *title,
|
||||
size_t title_length)
|
||||
{
|
||||
if (groupnum > MAX_GROUPCHAT_NUM) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ToxWindow *self = new_group_chat(m, groupnum);
|
||||
ToxWindow *self = new_group_chat(groupnum);
|
||||
|
||||
for (int i = 0; i <= max_groupchat_index; ++i) {
|
||||
if (!groupchats[i].active) {
|
||||
@ -162,7 +164,7 @@ int init_groupchat_win(ToxWindow *prompt, Tox *m, uint32_t groupnum, uint8_t typ
|
||||
return -1;
|
||||
}
|
||||
|
||||
void free_groupchat(ToxWindow *self, Tox *m, uint32_t groupnum)
|
||||
void free_groupchat(ToxWindow *self, uint32_t groupnum)
|
||||
{
|
||||
free(groupchats[groupnum].name_list);
|
||||
free(groupchats[groupnum].peer_list);
|
||||
@ -183,7 +185,7 @@ void free_groupchat(ToxWindow *self, Tox *m, uint32_t groupnum)
|
||||
static void delete_groupchat(ToxWindow *self, Tox *m, uint32_t groupnum)
|
||||
{
|
||||
tox_conference_delete(m, groupnum, NULL);
|
||||
free_groupchat(self, m, groupnum);
|
||||
free_groupchat(self, groupnum);
|
||||
}
|
||||
|
||||
/* destroys and re-creates groupchat window with or without the peerlist */
|
||||
@ -229,6 +231,8 @@ void redraw_groupchat_win(ToxWindow *self)
|
||||
static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, uint32_t groupnum, uint32_t peernum,
|
||||
Tox_Message_Type type, const char *msg, size_t len)
|
||||
{
|
||||
UNUSED_VAR(len);
|
||||
|
||||
if (self->num != groupnum) {
|
||||
return;
|
||||
}
|
||||
@ -426,6 +430,8 @@ static void groupchat_onGroupNameListChange(ToxWindow *self, Tox *m, uint32_t gr
|
||||
static void groupchat_onGroupPeerNameChange(ToxWindow *self, Tox *m, uint32_t groupnum, uint32_t peernum,
|
||||
const char *name, size_t length)
|
||||
{
|
||||
UNUSED_VAR(length);
|
||||
|
||||
if (self->num != groupnum) {
|
||||
return;
|
||||
}
|
||||
@ -496,7 +502,7 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
}
|
||||
|
||||
if (ltr || key == '\n') { /* char is printable */
|
||||
input_new_char(self, key, x, y, x2, y2);
|
||||
input_new_char(self, key, x, x2);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -504,7 +510,7 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
return;
|
||||
}
|
||||
|
||||
if (input_handle(self, key, x, y, x2, y2)) {
|
||||
if (input_handle(self, key, x, x2)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -592,6 +598,8 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
|
||||
static void groupchat_onDraw(ToxWindow *self, Tox *m)
|
||||
{
|
||||
UNUSED_VAR(m);
|
||||
|
||||
int x2, y2;
|
||||
getmaxyx(self->window, y2, x2);
|
||||
|
||||
@ -708,7 +716,7 @@ static void groupchat_onInit(ToxWindow *self, Tox *m)
|
||||
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
|
||||
}
|
||||
|
||||
ToxWindow *new_group_chat(Tox *m, uint32_t groupnum)
|
||||
static ToxWindow *new_group_chat(uint32_t groupnum)
|
||||
{
|
||||
ToxWindow *ret = calloc(1, sizeof(ToxWindow));
|
||||
|
||||
|
@ -54,14 +54,11 @@ typedef struct {
|
||||
} GroupChat;
|
||||
|
||||
/* Frees all Toxic associated data structures for a groupchat (does not call tox_conference_delete() ) */
|
||||
void free_groupchat(ToxWindow *self, Tox *m, uint32_t groupnum);
|
||||
void free_groupchat(ToxWindow *self, uint32_t groupnum);
|
||||
|
||||
int init_groupchat_win(ToxWindow *prompt, Tox *m, uint32_t groupnum, uint8_t type, const char *title,
|
||||
size_t title_length);
|
||||
int init_groupchat_win(Tox *m, uint32_t groupnum, uint8_t type, const char *title, size_t title_length);
|
||||
|
||||
/* destroys and re-creates groupchat window with or without the peerlist */
|
||||
void redraw_groupchat_win(ToxWindow *self);
|
||||
|
||||
ToxWindow *new_group_chat(Tox *m, uint32_t groupnum);
|
||||
|
||||
#endif /* GROUPCHAT_H */
|
||||
|
12
src/input.c
12
src/input.c
@ -38,7 +38,7 @@
|
||||
extern struct user_settings *user_settings;
|
||||
|
||||
/* add a char to input field and buffer */
|
||||
void input_new_char(ToxWindow *self, wint_t key, int x, int y, int mx_x, int mx_y)
|
||||
void input_new_char(ToxWindow *self, wint_t key, int x, int mx_x)
|
||||
{
|
||||
ChatContext *ctx = self->chatwin;
|
||||
|
||||
@ -94,7 +94,7 @@ static void input_delete(ToxWindow *self)
|
||||
}
|
||||
|
||||
/* delete last typed word */
|
||||
static void input_del_word(ToxWindow *self, int x, int mx_x)
|
||||
static void input_del_word(ToxWindow *self)
|
||||
{
|
||||
ChatContext *ctx = self->chatwin;
|
||||
|
||||
@ -139,7 +139,7 @@ static void input_yank(ToxWindow *self, int x, int mx_x)
|
||||
}
|
||||
|
||||
/* moves cursor/line position to end of line in input field and buffer */
|
||||
static void input_mv_end(ToxWindow *self, int y, int mx_x)
|
||||
static void input_mv_end(ToxWindow *self, int mx_x)
|
||||
{
|
||||
ChatContext *ctx = self->chatwin;
|
||||
|
||||
@ -214,7 +214,7 @@ static void input_history(ToxWindow *self, wint_t key, int mx_x)
|
||||
|
||||
/* Handles non-printable input keys that behave the same for all types of chat windows.
|
||||
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 mx_x)
|
||||
{
|
||||
bool match = true;
|
||||
|
||||
@ -241,7 +241,7 @@ bool input_handle(ToxWindow *self, wint_t key, int x, int y, int mx_x, int mx_y)
|
||||
break;
|
||||
|
||||
case T_KEY_C_W:
|
||||
input_del_word(self, x, mx_x);
|
||||
input_del_word(self);
|
||||
break;
|
||||
|
||||
case KEY_HOME:
|
||||
@ -251,7 +251,7 @@ bool input_handle(ToxWindow *self, wint_t key, int x, int y, int mx_x, int mx_y)
|
||||
|
||||
case KEY_END:
|
||||
case T_KEY_C_E:
|
||||
input_mv_end(self, y, mx_x);
|
||||
input_mv_end(self, mx_x);
|
||||
break;
|
||||
|
||||
case KEY_LEFT:
|
||||
|
@ -24,10 +24,10 @@
|
||||
#define INPUT_H
|
||||
|
||||
/* add a char to input field and buffer for given chatcontext */
|
||||
void input_new_char(ToxWindow *self, wint_t key, int x, int y, int mx_x, int mx_y);
|
||||
void input_new_char(ToxWindow *self, wint_t key, int x, int mx_x);
|
||||
|
||||
/* Handles non-printable input keys that behave the same for all types of chat windows.
|
||||
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 mx_x);
|
||||
|
||||
#endif /* INPUT_H */
|
||||
|
@ -40,6 +40,13 @@
|
||||
extern ToxWindow *prompt;
|
||||
extern struct user_settings *user_settings;
|
||||
|
||||
void clear_screen(void)
|
||||
{
|
||||
if (system("clear") != 0) {
|
||||
fprintf(stderr, "Warning: system() failed to clear screen\n");
|
||||
}
|
||||
}
|
||||
|
||||
void hst_to_net(uint8_t *num, uint16_t numbytes)
|
||||
{
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
|
@ -39,6 +39,8 @@
|
||||
#define net_to_host(x, y) hst_to_net(x, y)
|
||||
#endif
|
||||
|
||||
#define UNUSED_VAR(x) ((void) x)
|
||||
|
||||
typedef enum File_Type {
|
||||
FILE_TYPE_REGULAR,
|
||||
FILE_TYPE_DIRECTORY,
|
||||
@ -46,6 +48,8 @@ typedef enum File_Type {
|
||||
} File_Type;
|
||||
|
||||
|
||||
void clear_screen(void);
|
||||
|
||||
void hst_to_net(uint8_t *num, uint16_t numbytes);
|
||||
|
||||
/*
|
||||
|
@ -233,6 +233,8 @@ static int process_response(struct Recv_Curl_Data *recv_data)
|
||||
|
||||
void *lookup_thread_func(void *data)
|
||||
{
|
||||
UNUSED_VAR(data);
|
||||
|
||||
ToxWindow *self = t_data.self;
|
||||
|
||||
char input_domain[MAX_STR_SIZE];
|
||||
|
@ -139,6 +139,8 @@ void kill_prompt_window(ToxWindow *self)
|
||||
/* callback: Updates own connection status in prompt statusbar */
|
||||
void on_self_connection_status(Tox *m, Tox_Connection connection_status, void *userdata)
|
||||
{
|
||||
UNUSED_VAR(m);
|
||||
UNUSED_VAR(userdata);
|
||||
StatusBar *statusbar = prompt->stb;
|
||||
statusbar->connection = connection_status;
|
||||
}
|
||||
@ -233,7 +235,7 @@ static void prompt_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
}
|
||||
|
||||
if (ltr || key == '\n') { /* char is printable */
|
||||
input_new_char(self, key, x, y, x2, y2);
|
||||
input_new_char(self, key, x, x2);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -241,7 +243,7 @@ static void prompt_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
return;
|
||||
}
|
||||
|
||||
input_handle(self, key, x, y, x2, y2);
|
||||
input_handle(self, key, x, x2);
|
||||
|
||||
if (key == '\t') { /* TAB key: auto-completes command */
|
||||
if (ctx->len > 1 && ctx->line[0] == '/') {
|
||||
@ -474,6 +476,9 @@ static void prompt_onConnectionChange(ToxWindow *self, Tox *m, uint32_t friendnu
|
||||
|
||||
static void prompt_onFriendRequest(ToxWindow *self, Tox *m, const char *key, const char *data, size_t length)
|
||||
{
|
||||
UNUSED_VAR(m);
|
||||
UNUSED_VAR(length);
|
||||
|
||||
ChatContext *ctx = self->chatwin;
|
||||
|
||||
char timefrmt[TIME_STR_SIZE];
|
||||
|
38
src/toxic.c
38
src/toxic.c
@ -114,6 +114,8 @@ static time_t last_signal_time;
|
||||
|
||||
static void catch_SIGINT(int sig)
|
||||
{
|
||||
UNUSED_VAR(sig);
|
||||
|
||||
time_t cur_time = get_unix_time();
|
||||
|
||||
if (difftime(cur_time, last_signal_time) <= 1) {
|
||||
@ -125,7 +127,11 @@ static void catch_SIGINT(int sig)
|
||||
|
||||
static void catch_SIGSEGV(int sig)
|
||||
{
|
||||
freopen("/dev/tty", "w", stderr); // make sure stderr is enabled since we may have disabled it
|
||||
UNUSED_VAR(sig);
|
||||
|
||||
if (!freopen("/dev/tty", "w", stderr)) { // make sure stderr is enabled since we may have disabled it
|
||||
fprintf(stderr, "Warning: Failed to enable stderr\n");
|
||||
}
|
||||
endwin();
|
||||
fprintf(stderr, "Caught SIGSEGV: Aborting toxic session.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
@ -133,6 +139,8 @@ static void catch_SIGSEGV(int sig)
|
||||
|
||||
static void flag_window_resize(int sig)
|
||||
{
|
||||
UNUSED_VAR(sig);
|
||||
|
||||
Winthread.flag_resize = 1;
|
||||
}
|
||||
|
||||
@ -198,7 +206,11 @@ void exit_toxic_success(Tox *m)
|
||||
void exit_toxic_err(const char *errmsg, int errcode)
|
||||
{
|
||||
free_global_data();
|
||||
freopen("/dev/tty", "w", stderr);
|
||||
|
||||
if (!freopen("/dev/tty", "w", stderr)) {
|
||||
fprintf(stderr, "Warning: Failed to open stderr\n");
|
||||
}
|
||||
|
||||
endwin();
|
||||
fprintf(stderr, "Toxic session aborted with error code %d (%s)\n", errcode, errmsg);
|
||||
exit(EXIT_FAILURE);
|
||||
@ -318,7 +330,7 @@ static void load_friendlist(Tox *m)
|
||||
sort_friendlist_index();
|
||||
}
|
||||
|
||||
static void load_groups(ToxWindow *prompt, Tox *m)
|
||||
static void load_groups(Tox *m)
|
||||
{
|
||||
size_t i;
|
||||
size_t num_chats = tox_conference_get_chatlist_size(m);
|
||||
@ -360,7 +372,7 @@ static void load_groups(ToxWindow *prompt, Tox *m)
|
||||
|
||||
title[length] = 0;
|
||||
|
||||
if (init_groupchat_win(prompt, m, groupnum, type, (const char *) title, length) == -1) {
|
||||
if (init_groupchat_win(m, groupnum, type, (const char *) title, length) == -1) {
|
||||
tox_conference_delete(m, groupnum, NULL);
|
||||
continue;
|
||||
}
|
||||
@ -456,7 +468,7 @@ static void first_time_encrypt(const char *msg)
|
||||
char ch[256] = {0};
|
||||
|
||||
do {
|
||||
system("clear");
|
||||
clear_screen();
|
||||
printf("%s ", msg);
|
||||
fflush(stdout);
|
||||
|
||||
@ -515,7 +527,7 @@ static void first_time_encrypt(const char *msg)
|
||||
user_password.data_is_encrypted = true;
|
||||
}
|
||||
|
||||
system("clear");
|
||||
clear_screen();
|
||||
}
|
||||
|
||||
/* Store Tox profile data to path.
|
||||
@ -705,7 +717,7 @@ static Tox *load_tox(char *data_path, struct Tox_Options *tox_opts, Tox_Err_New
|
||||
int pweval = user_settings->password_eval[0];
|
||||
|
||||
if (!pweval) {
|
||||
system("clear"); // TODO: is this portable?
|
||||
clear_screen();
|
||||
printf("Enter password (q to quit) ");
|
||||
}
|
||||
|
||||
@ -729,7 +741,7 @@ static Tox *load_tox(char *data_path, struct Tox_Options *tox_opts, Tox_Err_New
|
||||
}
|
||||
|
||||
if (pwlen < MIN_PASSWORD_LEN) {
|
||||
system("clear");
|
||||
clear_screen();
|
||||
sleep(1);
|
||||
printf("Invalid password. Try again. ");
|
||||
pweval = 0;
|
||||
@ -753,7 +765,7 @@ static Tox *load_tox(char *data_path, struct Tox_Options *tox_opts, Tox_Err_New
|
||||
|
||||
break;
|
||||
} else if (pwerr == TOX_ERR_DECRYPTION_FAILED) {
|
||||
system("clear");
|
||||
clear_screen();
|
||||
sleep(1);
|
||||
printf("Invalid password. Try again. ");
|
||||
pweval = 0;
|
||||
@ -1220,6 +1232,8 @@ static void init_default_data_files(void)
|
||||
#ifdef X11
|
||||
void DnD_callback(const char *asdv, DropType dt)
|
||||
{
|
||||
UNUSED_VAR(asdv);
|
||||
UNUSED_VAR(dt);
|
||||
// if (dt != DT_plain)
|
||||
// return;
|
||||
|
||||
@ -1235,7 +1249,9 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Use the -b flag to enable stderr */
|
||||
if (!arg_opts.debug) {
|
||||
freopen("/dev/null", "w", stderr);
|
||||
if (!freopen("/dev/null", "w", stderr)) {
|
||||
fprintf(stderr, "Warning: failed to enable stderr\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (arg_opts.encrypt_data && arg_opts.unencrypt_data) {
|
||||
@ -1300,7 +1316,7 @@ int main(int argc, char **argv)
|
||||
|
||||
prompt = init_windows(m);
|
||||
prompt_init_statusbar(prompt, m, !datafile_exists);
|
||||
load_groups(prompt, m);
|
||||
load_groups(m);
|
||||
|
||||
/* thread for ncurses stuff */
|
||||
if (pthread_mutex_init(&Winthread.lock, NULL) != 0) {
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "global_commands.h"
|
||||
#include "line_info.h"
|
||||
#include "notify.h"
|
||||
#include "misc_tools.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <curses.h>
|
||||
@ -56,6 +57,8 @@ static void print_err(ToxWindow *self, const char *error_str)
|
||||
|
||||
ToxAV *init_video(ToxWindow *self, Tox *tox)
|
||||
{
|
||||
UNUSED_VAR(tox);
|
||||
|
||||
CallControl.video_errors = ve_None;
|
||||
|
||||
CallControl.video_enabled = true;
|
||||
@ -126,6 +129,8 @@ void write_video_device_callback(uint32_t friend_number, uint16_t width, uint16_
|
||||
int32_t ystride, int32_t ustride, int32_t vstride,
|
||||
void *user_data)
|
||||
{
|
||||
UNUSED_VAR(friend_number);
|
||||
|
||||
write_video_out(width, height, y, u, v, ystride, ustride, vstride, user_data);
|
||||
}
|
||||
|
||||
@ -185,11 +190,16 @@ void on_video_receive_frame(ToxAV *av, uint32_t friend_number,
|
||||
int32_t ystride, int32_t ustride, int32_t vstride,
|
||||
void *user_data)
|
||||
{
|
||||
UNUSED_VAR(av);
|
||||
|
||||
write_video_device_callback(friend_number, width, height, y, u, v, ystride, ustride, vstride, user_data);
|
||||
}
|
||||
|
||||
void on_video_bit_rate(ToxAV *av, uint32_t friend_number, uint32_t video_bit_rate, void *user_data)
|
||||
{
|
||||
UNUSED_VAR(av);
|
||||
UNUSED_VAR(user_data);
|
||||
|
||||
CallControl.video_bit_rate = video_bit_rate;
|
||||
toxav_video_set_bit_rate(CallControl.av, friend_number, CallControl.video_bit_rate, NULL);
|
||||
}
|
||||
@ -249,6 +259,10 @@ void callback_video_end(uint32_t friend_number)
|
||||
*/
|
||||
void cmd_video(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(m);
|
||||
UNUSED_VAR(argv);
|
||||
|
||||
const char *error_str;
|
||||
Call *this_call = &CallControl.calls[self->num];
|
||||
|
||||
@ -285,6 +299,9 @@ on_error:
|
||||
|
||||
void cmd_list_video_devices(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(m);
|
||||
|
||||
const char *error_str;
|
||||
|
||||
if (argc != 1) {
|
||||
@ -322,6 +339,9 @@ on_error:
|
||||
/* This changes primary video device only */
|
||||
void cmd_change_video_device(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(m);
|
||||
|
||||
const char *error_str;
|
||||
|
||||
if (argc != 2) {
|
||||
@ -372,6 +392,9 @@ on_error:
|
||||
|
||||
void cmd_ccur_video_device(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
{
|
||||
UNUSED_VAR(window);
|
||||
UNUSED_VAR(m);
|
||||
|
||||
const char *error_str;
|
||||
|
||||
if (argc != 2) {
|
||||
|
@ -46,6 +46,7 @@
|
||||
|
||||
#include "line_info.h"
|
||||
#include "settings.h"
|
||||
#include "misc_tools.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
@ -596,6 +597,8 @@ VideoDeviceError write_video_out(uint16_t width, uint16_t height,
|
||||
int32_t ystride, int32_t ustride, int32_t vstride,
|
||||
void *user_data)
|
||||
{
|
||||
UNUSED_VAR(user_data);
|
||||
|
||||
VideoDevice *device = video_devices_running[vdt_output][0];
|
||||
|
||||
if (!device) {
|
||||
|
@ -50,6 +50,8 @@ extern struct user_settings *user_settings;
|
||||
/* CALLBACKS START */
|
||||
void on_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, size_t length, void *userdata)
|
||||
{
|
||||
UNUSED_VAR(userdata);
|
||||
|
||||
char msg[MAX_STR_SIZE + 1];
|
||||
length = copy_tox_str(msg, sizeof(msg), (const char *) data, length);
|
||||
|
||||
@ -62,6 +64,8 @@ void on_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, s
|
||||
|
||||
void on_friend_connection_status(Tox *m, uint32_t friendnumber, Tox_Connection connection_status, void *userdata)
|
||||
{
|
||||
UNUSED_VAR(userdata);
|
||||
|
||||
for (uint8_t i = 0; i < MAX_WINDOWS_NUM; ++i) {
|
||||
if (windows[i] != NULL && windows[i]->onConnectionChange != NULL) {
|
||||
windows[i]->onConnectionChange(windows[i], m, friendnumber, connection_status);
|
||||
@ -71,6 +75,8 @@ void on_friend_connection_status(Tox *m, uint32_t friendnumber, Tox_Connection c
|
||||
|
||||
void on_friend_typing(Tox *m, uint32_t friendnumber, bool is_typing, void *userdata)
|
||||
{
|
||||
UNUSED_VAR(userdata);
|
||||
|
||||
if (user_settings->show_typing_other == SHOW_TYPING_OFF) {
|
||||
return;
|
||||
}
|
||||
@ -85,6 +91,8 @@ void on_friend_typing(Tox *m, uint32_t friendnumber, bool is_typing, void *userd
|
||||
void on_friend_message(Tox *m, uint32_t friendnumber, Tox_Message_Type type, const uint8_t *string, size_t length,
|
||||
void *userdata)
|
||||
{
|
||||
UNUSED_VAR(userdata);
|
||||
|
||||
char msg[MAX_STR_SIZE + 1];
|
||||
length = copy_tox_str(msg, sizeof(msg), (const char *) string, length);
|
||||
|
||||
@ -97,6 +105,8 @@ void on_friend_message(Tox *m, uint32_t friendnumber, Tox_Message_Type type, con
|
||||
|
||||
void on_friend_name(Tox *m, uint32_t friendnumber, const uint8_t *string, size_t length, void *userdata)
|
||||
{
|
||||
UNUSED_VAR(userdata);
|
||||
|
||||
char nick[TOXIC_MAX_NAME_LENGTH + 1];
|
||||
length = copy_tox_str(nick, sizeof(nick), (const char *) string, length);
|
||||
filter_str(nick, length);
|
||||
@ -112,6 +122,9 @@ void on_friend_name(Tox *m, uint32_t friendnumber, const uint8_t *string, size_t
|
||||
|
||||
void on_friend_status_message(Tox *m, uint32_t friendnumber, const uint8_t *string, size_t length, void *userdata)
|
||||
{
|
||||
UNUSED_VAR(userdata);
|
||||
UNUSED_VAR(m);
|
||||
|
||||
char msg[TOX_MAX_STATUS_MESSAGE_LENGTH + 1];
|
||||
length = copy_tox_str(msg, sizeof(msg), (const char *) string, length);
|
||||
filter_str(msg, length);
|
||||
@ -125,6 +138,8 @@ void on_friend_status_message(Tox *m, uint32_t friendnumber, const uint8_t *stri
|
||||
|
||||
void on_friend_status(Tox *m, uint32_t friendnumber, Tox_User_Status status, void *userdata)
|
||||
{
|
||||
UNUSED_VAR(userdata);
|
||||
|
||||
for (uint8_t i = 0; i < MAX_WINDOWS_NUM; ++i) {
|
||||
if (windows[i] != NULL && windows[i]->onStatusChange != NULL) {
|
||||
windows[i]->onStatusChange(windows[i], m, friendnumber, status);
|
||||
@ -146,6 +161,8 @@ void on_friend_added(Tox *m, uint32_t friendnumber, bool sort)
|
||||
void on_conference_message(Tox *m, uint32_t groupnumber, uint32_t peernumber, Tox_Message_Type type,
|
||||
const uint8_t *message, size_t length, void *userdata)
|
||||
{
|
||||
UNUSED_VAR(userdata);
|
||||
|
||||
char msg[MAX_STR_SIZE + 1];
|
||||
length = copy_tox_str(msg, sizeof(msg), (const char *) message, length);
|
||||
|
||||
@ -159,6 +176,8 @@ void on_conference_message(Tox *m, uint32_t groupnumber, uint32_t peernumber, To
|
||||
void on_conference_invite(Tox *m, uint32_t friendnumber, Tox_Conference_Type type, const uint8_t *group_pub_key,
|
||||
size_t length, void *userdata)
|
||||
{
|
||||
UNUSED_VAR(userdata);
|
||||
|
||||
for (uint8_t i = 0; i < MAX_WINDOWS_NUM; ++i) {
|
||||
if (windows[i] != NULL && windows[i]->onGroupInvite != NULL) {
|
||||
windows[i]->onGroupInvite(windows[i], m, friendnumber, type, (char *) group_pub_key, length);
|
||||
@ -168,6 +187,8 @@ void on_conference_invite(Tox *m, uint32_t friendnumber, Tox_Conference_Type typ
|
||||
|
||||
void on_conference_peer_list_changed(Tox *m, uint32_t groupnumber, void *userdata)
|
||||
{
|
||||
UNUSED_VAR(userdata);
|
||||
|
||||
for (uint8_t i = 0; i < MAX_WINDOWS_NUM; ++i) {
|
||||
if (windows[i] != NULL && windows[i]->onGroupNameListChange != NULL) {
|
||||
windows[i]->onGroupNameListChange(windows[i], m, groupnumber);
|
||||
@ -178,6 +199,8 @@ void on_conference_peer_list_changed(Tox *m, uint32_t groupnumber, void *userdat
|
||||
void on_conference_peer_name(Tox *m, uint32_t groupnumber, uint32_t peernumber, const uint8_t *name,
|
||||
size_t length, void *userdata)
|
||||
{
|
||||
UNUSED_VAR(userdata);
|
||||
|
||||
char nick[TOXIC_MAX_NAME_LENGTH + 1];
|
||||
length = copy_tox_str(nick, sizeof(nick), (const char *) name, length);
|
||||
filter_str(nick, length);
|
||||
@ -192,6 +215,8 @@ void on_conference_peer_name(Tox *m, uint32_t groupnumber, uint32_t peernumber,
|
||||
void on_conference_title(Tox *m, uint32_t groupnumber, uint32_t peernumber, const uint8_t *title, size_t length,
|
||||
void *userdata)
|
||||
{
|
||||
UNUSED_VAR(userdata);
|
||||
|
||||
char data[MAX_STR_SIZE + 1];
|
||||
length = copy_tox_str(data, sizeof(data), (const char *) title, length);
|
||||
|
||||
@ -205,6 +230,8 @@ void on_conference_title(Tox *m, uint32_t groupnumber, uint32_t peernumber, cons
|
||||
void on_file_chunk_request(Tox *m, uint32_t friendnumber, uint32_t filenumber, uint64_t position,
|
||||
size_t length, void *userdata)
|
||||
{
|
||||
UNUSED_VAR(userdata);
|
||||
|
||||
struct FileTransfer *ft = get_file_transfer_struct(friendnumber, filenumber);
|
||||
|
||||
if (!ft) {
|
||||
@ -224,8 +251,10 @@ void on_file_chunk_request(Tox *m, uint32_t friendnumber, uint32_t filenumber, u
|
||||
}
|
||||
|
||||
void on_file_recv_chunk(Tox *m, uint32_t friendnumber, uint32_t filenumber, uint64_t position,
|
||||
const uint8_t *data, size_t length, void *user_data)
|
||||
const uint8_t *data, size_t length, void *userdata)
|
||||
{
|
||||
UNUSED_VAR(userdata);
|
||||
|
||||
struct FileTransfer *ft = get_file_transfer_struct(friendnumber, filenumber);
|
||||
|
||||
if (!ft) {
|
||||
@ -242,6 +271,8 @@ void on_file_recv_chunk(Tox *m, uint32_t friendnumber, uint32_t filenumber, uint
|
||||
void on_file_recv_control(Tox *m, uint32_t friendnumber, uint32_t filenumber, Tox_File_Control control,
|
||||
void *userdata)
|
||||
{
|
||||
UNUSED_VAR(userdata);
|
||||
|
||||
struct FileTransfer *ft = get_file_transfer_struct(friendnumber, filenumber);
|
||||
|
||||
if (!ft) {
|
||||
@ -263,6 +294,8 @@ void on_file_recv_control(Tox *m, uint32_t friendnumber, uint32_t filenumber, To
|
||||
void on_file_recv(Tox *m, uint32_t friendnumber, uint32_t filenumber, uint32_t kind, uint64_t file_size,
|
||||
const uint8_t *filename, size_t filename_length, void *userdata)
|
||||
{
|
||||
UNUSED_VAR(userdata);
|
||||
|
||||
/* We don't care about receiving avatars */
|
||||
if (kind != TOX_FILE_KIND_DATA) {
|
||||
tox_file_control(m, friendnumber, filenumber, TOX_FILE_CONTROL_CANCEL, NULL);
|
||||
@ -279,6 +312,8 @@ void on_file_recv(Tox *m, uint32_t friendnumber, uint32_t filenumber, uint32_t k
|
||||
|
||||
void on_friend_read_receipt(Tox *m, uint32_t friendnumber, uint32_t receipt, void *userdata)
|
||||
{
|
||||
UNUSED_VAR(userdata);
|
||||
|
||||
for (uint8_t i = 0; i < MAX_WINDOWS_NUM; ++i) {
|
||||
if (windows[i] != NULL && windows[i]->onReadReceipt != NULL) {
|
||||
windows[i]->onReadReceipt(windows[i], m, friendnumber, receipt);
|
||||
@ -647,7 +682,7 @@ void kill_all_windows(Tox *m)
|
||||
if (windows[i]->is_chat) {
|
||||
kill_chat_window(windows[i], m);
|
||||
} else if (windows[i]->is_groupchat) {
|
||||
free_groupchat(windows[i], m, windows[i]->num);
|
||||
free_groupchat(windows[i], windows[i]->num);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "xtra.h"
|
||||
#include "misc_tools.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
@ -179,6 +180,8 @@ static void handle_xdnd_drop(XClientMessageEvent *e)
|
||||
|
||||
static void handle_xdnd_selection(XSelectionEvent *e)
|
||||
{
|
||||
UNUSED_VAR(e);
|
||||
|
||||
/* DnD succesfully finished, send finished and call callback */
|
||||
XEvent ev = {
|
||||
.xclient = {
|
||||
|
Loading…
Reference in New Issue
Block a user