mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 02:43:01 +01:00
API update
This commit is contained in:
parent
8bea44a44c
commit
50a37495f8
28
src/chat.c
28
src/chat.c
@ -110,7 +110,7 @@ void kill_chat_window(ToxWindow *self)
|
||||
free(statusbar);
|
||||
}
|
||||
|
||||
static void chat_onMessage(ToxWindow *self, Tox *m, int num, uint8_t *msg, uint16_t len)
|
||||
static void chat_onMessage(ToxWindow *self, Tox *m, int32_t num, uint8_t *msg, uint16_t len)
|
||||
{
|
||||
if (self->num != num)
|
||||
return;
|
||||
@ -137,7 +137,7 @@ static void chat_onMessage(ToxWindow *self, Tox *m, int num, uint8_t *msg, uint1
|
||||
alert_window(self, WINDOW_ALERT_1, true);
|
||||
}
|
||||
|
||||
static void chat_onConnectionChange(ToxWindow *self, Tox *m, int num, uint8_t status)
|
||||
static void chat_onConnectionChange(ToxWindow *self, Tox *m, int32_t num, uint8_t status)
|
||||
{
|
||||
if (self->num != num)
|
||||
return;
|
||||
@ -153,7 +153,7 @@ static void chat_onConnectionChange(ToxWindow *self, Tox *m, int num, uint8_t st
|
||||
}
|
||||
}
|
||||
|
||||
static void chat_onTypingChange(ToxWindow *self, Tox *m, int num, int is_typing)
|
||||
static void chat_onTypingChange(ToxWindow *self, Tox *m, int32_t num, int is_typing)
|
||||
{
|
||||
if (self->num != num)
|
||||
return;
|
||||
@ -161,7 +161,7 @@ static void chat_onTypingChange(ToxWindow *self, Tox *m, int num, int is_typing)
|
||||
friends[num].is_typing = is_typing;
|
||||
}
|
||||
|
||||
static void chat_onAction(ToxWindow *self, Tox *m, int num, uint8_t *action, uint16_t len)
|
||||
static void chat_onAction(ToxWindow *self, Tox *m, int32_t num, uint8_t *action, uint16_t len)
|
||||
{
|
||||
if (self->num != num)
|
||||
return;
|
||||
@ -181,7 +181,7 @@ static void chat_onAction(ToxWindow *self, Tox *m, int num, uint8_t *action, uin
|
||||
alert_window(self, WINDOW_ALERT_1, true);
|
||||
}
|
||||
|
||||
static void chat_onNickChange(ToxWindow *self, Tox *m, int num, uint8_t *nick, uint16_t len)
|
||||
static void chat_onNickChange(ToxWindow *self, Tox *m, int32_t num, uint8_t *nick, uint16_t len)
|
||||
{
|
||||
if (self->num != num)
|
||||
return;
|
||||
@ -191,7 +191,7 @@ static void chat_onNickChange(ToxWindow *self, Tox *m, int num, uint8_t *nick, u
|
||||
memcpy(self->name, nick, len);
|
||||
}
|
||||
|
||||
static void chat_onStatusChange(ToxWindow *self, Tox *m, int num, TOX_USERSTATUS status)
|
||||
static void chat_onStatusChange(ToxWindow *self, Tox *m, int32_t num, uint8_t status)
|
||||
{
|
||||
if (self->num != num)
|
||||
return;
|
||||
@ -200,7 +200,7 @@ static void chat_onStatusChange(ToxWindow *self, Tox *m, int num, TOX_USERSTATUS
|
||||
statusbar->status = status;
|
||||
}
|
||||
|
||||
static void chat_onStatusMessageChange(ToxWindow *self, int num, uint8_t *status, uint16_t len)
|
||||
static void chat_onStatusMessageChange(ToxWindow *self, int32_t num, uint8_t *status, uint16_t len)
|
||||
{
|
||||
if (self->num != num)
|
||||
return;
|
||||
@ -210,7 +210,7 @@ static void chat_onStatusMessageChange(ToxWindow *self, int num, uint8_t *status
|
||||
memcpy(statusbar->statusmsg, status, len);
|
||||
}
|
||||
|
||||
static void chat_onFileSendRequest(ToxWindow *self, Tox *m, int num, uint8_t filenum,
|
||||
static void chat_onFileSendRequest(ToxWindow *self, Tox *m, int32_t num, uint8_t filenum,
|
||||
uint64_t filesize, uint8_t *pathname, uint16_t path_len)
|
||||
{
|
||||
if (self->num != num)
|
||||
@ -264,7 +264,7 @@ static void chat_close_file_receiver(int num, uint8_t filenum)
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
static void chat_onFileControl(ToxWindow *self, Tox *m, int num, uint8_t receive_send,
|
||||
static void chat_onFileControl(ToxWindow *self, Tox *m, int32_t num, uint8_t receive_send,
|
||||
uint8_t filenum, uint8_t control_type, uint8_t *data, uint16_t length)
|
||||
{
|
||||
if (self->num != num)
|
||||
@ -302,7 +302,7 @@ static void chat_onFileControl(ToxWindow *self, Tox *m, int num, uint8_t receive
|
||||
alert_window(self, WINDOW_ALERT_2, true);
|
||||
}
|
||||
|
||||
static void chat_onFileData(ToxWindow *self, Tox *m, int num, uint8_t filenum, uint8_t *data,
|
||||
static void chat_onFileData(ToxWindow *self, Tox *m, int32_t num, uint8_t filenum, uint8_t *data,
|
||||
uint16_t length)
|
||||
{
|
||||
if (self->num != num)
|
||||
@ -320,7 +320,7 @@ static void chat_onFileData(ToxWindow *self, Tox *m, int num, uint8_t filenum, u
|
||||
}
|
||||
}
|
||||
|
||||
static void chat_onGroupInvite(ToxWindow *self, Tox *m, int friendnumber, uint8_t *group_pub_key)
|
||||
static void chat_onGroupInvite(ToxWindow *self, Tox *m, int32_t friendnumber, uint8_t *group_pub_key)
|
||||
{
|
||||
if (self->num != friendnumber)
|
||||
return;
|
||||
@ -472,7 +472,7 @@ static void send_action(ToxWindow *self, ChatContext *ctx, Tox *m, uint8_t *acti
|
||||
}
|
||||
|
||||
uint8_t selfname[TOX_MAX_NAME_LENGTH];
|
||||
tox_get_self_name(m, selfname, TOX_MAX_NAME_LENGTH);
|
||||
tox_get_self_name(m, selfname);
|
||||
|
||||
print_time(ctx->history);
|
||||
wattron(ctx->history, COLOR_PAIR(YELLOW));
|
||||
@ -656,7 +656,7 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key)
|
||||
}
|
||||
} else if (!string_is_empty(line)) {
|
||||
uint8_t selfname[TOX_MAX_NAME_LENGTH];
|
||||
tox_get_self_name(m, selfname, TOX_MAX_NAME_LENGTH);
|
||||
tox_get_self_name(m, selfname);
|
||||
|
||||
print_time(ctx->history);
|
||||
wattron(ctx->history, COLOR_PAIR(GREEN));
|
||||
@ -717,7 +717,7 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
||||
const char *status_text = "Unknown";
|
||||
int colour = WHITE;
|
||||
|
||||
TOX_USERSTATUS status = statusbar->status;
|
||||
uint8_t status = statusbar->status;
|
||||
|
||||
switch (status) {
|
||||
case TOX_USERSTATUS_NONE:
|
||||
|
@ -219,7 +219,7 @@ void cmd_sendfile(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv
|
||||
file_senders[i].active = true;
|
||||
file_senders[i].toxwin = self;
|
||||
file_senders[i].file = file_to_send;
|
||||
file_senders[i].filenum = (uint8_t) filenum;
|
||||
file_senders[i].filenum = filenum;
|
||||
file_senders[i].friendnum = self->num;
|
||||
file_senders[i].timestamp = get_unix_time();
|
||||
file_senders[i].piecelen = fread(file_senders[i].nextpiece, 1,
|
||||
|
@ -68,8 +68,8 @@ void do_file_senders(Tox *m)
|
||||
continue;
|
||||
|
||||
uint8_t *pathname = file_senders[i].pathname;
|
||||
uint8_t filenum = file_senders[i].filenum;
|
||||
int friendnum = file_senders[i].friendnum;
|
||||
int filenum = file_senders[i].filenum;
|
||||
int32_t friendnum = file_senders[i].friendnum;
|
||||
FILE *fp = file_senders[i].file;
|
||||
uint64_t current_time = get_unix_time();
|
||||
|
||||
|
@ -82,7 +82,7 @@ void sort_friendlist_index(void)
|
||||
qsort(friendlist_index, num_friends, sizeof(int), index_name_cmp);
|
||||
}
|
||||
|
||||
static void update_friend_last_online(int num, uint64_t timestamp)
|
||||
static void update_friend_last_online(int32_t num, uint64_t timestamp)
|
||||
{
|
||||
friends[num].last_online.last_on = timestamp;
|
||||
friends[num].last_online.tm = *localtime(×tamp);
|
||||
@ -90,7 +90,7 @@ static void update_friend_last_online(int num, uint64_t timestamp)
|
||||
&friends[num].last_online.tm);
|
||||
}
|
||||
|
||||
static void friendlist_onMessage(ToxWindow *self, Tox *m, int num, uint8_t *str, uint16_t len)
|
||||
static void friendlist_onMessage(ToxWindow *self, Tox *m, int32_t num, uint8_t *str, uint16_t len)
|
||||
{
|
||||
if (num >= max_friends_index)
|
||||
return;
|
||||
@ -114,7 +114,7 @@ static void friendlist_onMessage(ToxWindow *self, Tox *m, int num, uint8_t *str,
|
||||
}
|
||||
}
|
||||
|
||||
static void friendlist_onConnectionChange(ToxWindow *self, Tox *m, int num, uint8_t status)
|
||||
static void friendlist_onConnectionChange(ToxWindow *self, Tox *m, int32_t num, uint8_t status)
|
||||
{
|
||||
if (num >= max_friends_index)
|
||||
return;
|
||||
@ -125,7 +125,7 @@ static void friendlist_onConnectionChange(ToxWindow *self, Tox *m, int num, uint
|
||||
sort_friendlist_index();
|
||||
}
|
||||
|
||||
static void friendlist_onNickChange(ToxWindow *self, Tox *m, int num, uint8_t *str, uint16_t len)
|
||||
static void friendlist_onNickChange(ToxWindow *self, Tox *m, int32_t num, uint8_t *str, uint16_t len)
|
||||
{
|
||||
if (len > TOX_MAX_NAME_LENGTH || num >= max_friends_index)
|
||||
return;
|
||||
@ -137,7 +137,7 @@ static void friendlist_onNickChange(ToxWindow *self, Tox *m, int num, uint8_t *s
|
||||
sort_friendlist_index();
|
||||
}
|
||||
|
||||
static void friendlist_onStatusChange(ToxWindow *self, Tox *m, int num, TOX_USERSTATUS status)
|
||||
static void friendlist_onStatusChange(ToxWindow *self, Tox *m, int32_t num, uint8_t status)
|
||||
{
|
||||
if (num >= max_friends_index)
|
||||
return;
|
||||
@ -145,7 +145,7 @@ static void friendlist_onStatusChange(ToxWindow *self, Tox *m, int num, TOX_USER
|
||||
friends[num].status = status;
|
||||
}
|
||||
|
||||
static void friendlist_onStatusMessageChange(ToxWindow *self, int num, uint8_t *str, uint16_t len)
|
||||
static void friendlist_onStatusMessageChange(ToxWindow *self, int32_t num, uint8_t *str, uint16_t len)
|
||||
{
|
||||
if (len > TOX_MAX_STATUSMESSAGE_LENGTH || num >= max_friends_index)
|
||||
return;
|
||||
@ -154,7 +154,7 @@ static void friendlist_onStatusMessageChange(ToxWindow *self, int num, uint8_t *
|
||||
friends[num].statusmsg_len = len;
|
||||
}
|
||||
|
||||
void friendlist_onFriendAdded(ToxWindow *self, Tox *m, int num, bool sort)
|
||||
void friendlist_onFriendAdded(ToxWindow *self, Tox *m, int32_t num, bool sort)
|
||||
{
|
||||
if (max_friends_index < 0 || max_friends_index >= MAX_FRIENDS_NUM)
|
||||
return;
|
||||
@ -193,7 +193,7 @@ void friendlist_onFriendAdded(ToxWindow *self, Tox *m, int num, bool sort)
|
||||
}
|
||||
}
|
||||
|
||||
static void friendlist_onFileSendRequest(ToxWindow *self, Tox *m, int num, uint8_t filenum,
|
||||
static void friendlist_onFileSendRequest(ToxWindow *self, Tox *m, int32_t num, uint8_t filenum,
|
||||
uint64_t filesize, uint8_t *filename, uint16_t filename_len)
|
||||
{
|
||||
if (num >= max_friends_index)
|
||||
@ -219,7 +219,7 @@ static void friendlist_onFileSendRequest(ToxWindow *self, Tox *m, int num, uint8
|
||||
}
|
||||
}
|
||||
|
||||
static void friendlist_onGroupInvite(ToxWindow *self, Tox *m, int num, uint8_t *group_pub_key)
|
||||
static void friendlist_onGroupInvite(ToxWindow *self, Tox *m, int32_t num, uint8_t *group_pub_key)
|
||||
{
|
||||
if (num >= max_friends_index)
|
||||
return;
|
||||
@ -252,7 +252,7 @@ static void select_friend(ToxWindow *self, Tox *m, wint_t key)
|
||||
}
|
||||
}
|
||||
|
||||
static void delete_friend(Tox *m, int f_num)
|
||||
static void delete_friend(Tox *m, int32_t f_num)
|
||||
{
|
||||
tox_del_friend(m, f_num);
|
||||
memset(&friends[f_num], 0, sizeof(ToxicFriend));
|
||||
@ -276,7 +276,7 @@ static void delete_friend(Tox *m, int f_num)
|
||||
}
|
||||
|
||||
/* activates delete friend popup */
|
||||
static void del_friend_activate(ToxWindow *self, Tox *m, int f_num)
|
||||
static void del_friend_activate(ToxWindow *self, Tox *m, int32_t f_num)
|
||||
{
|
||||
int x2, y2;
|
||||
getmaxyx(self->window, y2, x2);
|
||||
@ -415,7 +415,7 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
|
||||
}
|
||||
|
||||
if (friends[f].online) {
|
||||
TOX_USERSTATUS status = friends[f].status;
|
||||
uint8_t status = friends[f].status;
|
||||
int colour = WHITE;
|
||||
|
||||
switch (status) {
|
||||
@ -514,7 +514,7 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
|
||||
draw_popup(self, m);
|
||||
}
|
||||
|
||||
void disable_chatwin(int f_num)
|
||||
void disable_chatwin(int32_t f_num)
|
||||
{
|
||||
friends[f_num].chatwin = -1;
|
||||
}
|
||||
|
@ -41,13 +41,13 @@ typedef struct {
|
||||
uint16_t statusmsg_len;
|
||||
uint8_t pending_groupchat[TOX_CLIENT_ID_SIZE];
|
||||
uint8_t pub_key[TOX_CLIENT_ID_SIZE];
|
||||
int num;
|
||||
int32_t num;
|
||||
int chatwin;
|
||||
bool active;
|
||||
bool online;
|
||||
bool is_typing;
|
||||
bool logging_on; /* saves preference for friend irrespective of chat windows */
|
||||
TOX_USERSTATUS status;
|
||||
uint8_t status;
|
||||
struct LastOnline last_online;
|
||||
struct FileReceiver file_receiver;
|
||||
} ToxicFriend;
|
||||
|
@ -103,7 +103,7 @@ void cmd_add(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX
|
||||
snprintf(msg, sizeof(msg), "%s", temp);
|
||||
} else {
|
||||
uint8_t selfname[TOX_MAX_NAME_LENGTH];
|
||||
tox_get_self_name(m, selfname, TOX_MAX_NAME_LENGTH);
|
||||
tox_get_self_name(m, selfname);
|
||||
snprintf(msg, sizeof(msg), "Hello, my name is %s. Care to Tox?", selfname);
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, int
|
||||
bool beep = false;
|
||||
|
||||
uint8_t selfnick[TOX_MAX_NAME_LENGTH] = {'\0'};
|
||||
tox_get_self_name(m, selfnick, TOX_MAX_NAME_LENGTH);
|
||||
tox_get_self_name(m, selfnick);
|
||||
int nick_clr = strcmp(nick, selfnick) == 0 ? GREEN : CYAN;
|
||||
|
||||
bool nick_match = strcasestr(msg, selfnick) && strncmp(selfnick, nick, TOXIC_MAX_NAME_LENGTH);
|
||||
@ -187,7 +187,7 @@ static void groupchat_onGroupAction(ToxWindow *self, Tox *m, int groupnum, int p
|
||||
bool beep = false;
|
||||
|
||||
uint8_t selfnick[TOX_MAX_NAME_LENGTH] = {'\0'};
|
||||
tox_get_self_name(m, selfnick, TOX_MAX_NAME_LENGTH);
|
||||
tox_get_self_name(m, selfnick);
|
||||
|
||||
bool nick_match = strcasestr(action, selfnick);
|
||||
|
||||
@ -330,14 +330,6 @@ static void send_group_action(ToxWindow *self, ChatContext *ctx, Tox *m, uint8_t
|
||||
return;
|
||||
}
|
||||
|
||||
/* uint8_t selfname[TOX_MAX_NAME_LENGTH];
|
||||
tox_get_self_name(m, selfname, TOX_MAX_NAME_LENGTH);
|
||||
|
||||
print_time(ctx->history);
|
||||
wattron(ctx->history, COLOR_PAIR(YELLOW));
|
||||
wprintw(ctx->history, "* %s %s\n", selfname, action);
|
||||
wattroff(ctx->history, COLOR_PAIR(YELLOW)); */
|
||||
|
||||
if (tox_group_action_send(m, self->num, action, strlen(action) + 1) == -1) {
|
||||
wattron(ctx->history, COLOR_PAIR(RED));
|
||||
wprintw(ctx->history, " * Failed to send action\n");
|
||||
|
@ -300,7 +300,7 @@ static void do_connection(Tox *m, ToxWindow *prompt)
|
||||
|
||||
static void load_friendlist(Tox *m)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
uint32_t numfriends = tox_count_friendlist(m);
|
||||
|
||||
for (i = 0; i < numfriends; ++i)
|
||||
|
10
src/prompt.c
10
src/prompt.c
@ -100,7 +100,7 @@ void prompt_update_statusmessage(ToxWindow *prompt, uint8_t *statusmsg, uint16_t
|
||||
}
|
||||
|
||||
/* Updates own status in prompt statusbar */
|
||||
void prompt_update_status(ToxWindow *prompt, TOX_USERSTATUS status)
|
||||
void prompt_update_status(ToxWindow *prompt, uint8_t status)
|
||||
{
|
||||
StatusBar *statusbar = prompt->stb;
|
||||
statusbar->status = status;
|
||||
@ -389,7 +389,7 @@ static void prompt_onInit(ToxWindow *self, Tox *m)
|
||||
wclrtoeol(self->window);
|
||||
}
|
||||
|
||||
static void prompt_onConnectionChange(ToxWindow *self, Tox *m, int friendnum , uint8_t status)
|
||||
static void prompt_onConnectionChange(ToxWindow *self, Tox *m, int32_t friendnum , uint8_t status)
|
||||
{
|
||||
if (friendnum < 0)
|
||||
return;
|
||||
@ -434,7 +434,7 @@ static void prompt_onConnectionChange(ToxWindow *self, Tox *m, int friendnum , u
|
||||
}
|
||||
}
|
||||
|
||||
static void prompt_onFriendRequest(ToxWindow *self, uint8_t *key, uint8_t *data, uint16_t length)
|
||||
static void prompt_onFriendRequest(ToxWindow *self, Tox *m, uint8_t *key, uint8_t *data, uint16_t length)
|
||||
{
|
||||
/* make sure message data is null-terminated */
|
||||
data[length - 1] = 0;
|
||||
@ -476,9 +476,9 @@ void prompt_init_statusbar(ToxWindow *self, Tox *m)
|
||||
uint8_t statusmsg[MAX_STR_SIZE];
|
||||
|
||||
pthread_mutex_lock(&Winthread.lock);
|
||||
tox_get_self_name(m, nick, TOX_MAX_NAME_LENGTH);
|
||||
tox_get_self_name(m, nick);
|
||||
tox_get_self_status_message(m, statusmsg, MAX_STR_SIZE);
|
||||
TOX_USERSTATUS status = tox_get_self_user_status(m);
|
||||
uint8_t status = tox_get_self_user_status(m);
|
||||
pthread_mutex_unlock(&Winthread.lock);
|
||||
|
||||
snprintf(statusbar->nick, sizeof(statusbar->nick), "%s", nick);
|
||||
|
@ -37,7 +37,7 @@ void prep_prompt_win(void);
|
||||
void prompt_init_statusbar(ToxWindow *self, Tox *m);
|
||||
void prompt_update_nick(ToxWindow *prompt, uint8_t *nick, uint16_t len);
|
||||
void prompt_update_statusmessage(ToxWindow *prompt, uint8_t *statusmsg, uint16_t len);
|
||||
void prompt_update_status(ToxWindow *prompt, TOX_USERSTATUS status);
|
||||
void prompt_update_status(ToxWindow *prompt, uint8_t status);
|
||||
void prompt_update_connectionstatus(ToxWindow *prompt, bool is_connected);
|
||||
|
||||
#endif /* end of include guard: PROMPT_H_UZYGWFFL */
|
||||
|
@ -93,22 +93,22 @@ struct ToxWindow {
|
||||
void(*onKey)(ToxWindow *, Tox *, wint_t);
|
||||
void(*onDraw)(ToxWindow *, Tox *);
|
||||
void(*onInit)(ToxWindow *, Tox *);
|
||||
void(*onFriendRequest)(ToxWindow *, uint8_t *, uint8_t *, uint16_t);
|
||||
void(*onFriendAdded)(ToxWindow *, Tox *, int, bool);
|
||||
void(*onConnectionChange)(ToxWindow *, Tox *, int, uint8_t);
|
||||
void(*onMessage)(ToxWindow *, Tox *, int, uint8_t *, uint16_t);
|
||||
void(*onNickChange)(ToxWindow *, Tox *, int, uint8_t *, uint16_t);
|
||||
void(*onStatusChange)(ToxWindow *, Tox *, int, TOX_USERSTATUS);
|
||||
void(*onStatusMessageChange)(ToxWindow *, int, uint8_t *, uint16_t);
|
||||
void(*onAction)(ToxWindow *, Tox *, int, uint8_t *, uint16_t);
|
||||
void(*onFriendRequest)(ToxWindow *, Tox *, uint8_t *, uint8_t *, uint16_t);
|
||||
void(*onFriendAdded)(ToxWindow *, Tox *, int32_t, bool);
|
||||
void(*onConnectionChange)(ToxWindow *, Tox *, int32_t, uint8_t);
|
||||
void(*onMessage)(ToxWindow *, Tox *, int32_t, uint8_t *, uint16_t);
|
||||
void(*onNickChange)(ToxWindow *, Tox *, int32_t, uint8_t *, uint16_t);
|
||||
void(*onStatusChange)(ToxWindow *, Tox *, int32_t, uint8_t);
|
||||
void(*onStatusMessageChange)(ToxWindow *, int32_t, uint8_t *, uint16_t);
|
||||
void(*onAction)(ToxWindow *, Tox *, int32_t, uint8_t *, uint16_t);
|
||||
void(*onGroupMessage)(ToxWindow *, Tox *, int, int, uint8_t *, uint16_t);
|
||||
void(*onGroupAction)(ToxWindow *, Tox *, int, int, uint8_t *, uint16_t);
|
||||
void(*onGroupInvite)(ToxWindow *, Tox *, int, uint8_t *);
|
||||
void(*onGroupInvite)(ToxWindow *, Tox *, int32_t, uint8_t *);
|
||||
void(*onGroupNamelistChange)(ToxWindow *, Tox*, int, int, uint8_t);
|
||||
void(*onFileSendRequest)(ToxWindow *, Tox *, int, uint8_t, uint64_t, uint8_t *, uint16_t);
|
||||
void(*onFileControl)(ToxWindow *, Tox *, int, uint8_t, uint8_t, uint8_t, uint8_t *, uint16_t);
|
||||
void(*onFileData)(ToxWindow *, Tox *, int, uint8_t, uint8_t *, uint16_t);
|
||||
void(*onTypingChange)(ToxWindow *, Tox *, int, int);
|
||||
void(*onFileSendRequest)(ToxWindow *, Tox *, int32_t, uint8_t, uint64_t, uint8_t *, uint16_t);
|
||||
void(*onFileControl)(ToxWindow *, Tox *, int32_t, uint8_t, uint8_t, uint8_t, uint8_t *, uint16_t);
|
||||
void(*onFileData)(ToxWindow *, Tox *, int32_t, uint8_t, uint8_t *, uint16_t);
|
||||
void(*onTypingChange)(ToxWindow *, Tox *, int32_t, int);
|
||||
|
||||
#ifdef _SUPPORT_AUDIO
|
||||
|
||||
@ -127,7 +127,7 @@ struct ToxWindow {
|
||||
#endif /* _SUPPORT_AUDIO */
|
||||
|
||||
char name[TOX_MAX_NAME_LENGTH];
|
||||
int num;
|
||||
int32_t num; /* corresponds to friendnumber in chat windows */
|
||||
bool active;
|
||||
int x;
|
||||
|
||||
@ -155,7 +155,7 @@ struct StatusBar {
|
||||
uint16_t statusmsg_len;
|
||||
uint8_t nick[TOX_MAX_NAME_LENGTH];
|
||||
uint16_t nick_len;
|
||||
TOX_USERSTATUS status;
|
||||
uint8_t status;
|
||||
bool is_online;
|
||||
};
|
||||
|
||||
@ -216,9 +216,9 @@ struct PromptBuf {
|
||||
typedef struct {
|
||||
FILE *file;
|
||||
ToxWindow *toxwin;
|
||||
int friendnum;
|
||||
int32_t friendnum;
|
||||
bool active;
|
||||
uint8_t filenum;
|
||||
int filenum;
|
||||
uint8_t nextpiece[FILE_PIECE_SIZE];
|
||||
uint16_t piecelen;
|
||||
uint8_t pathname[MAX_STR_SIZE];
|
||||
@ -238,22 +238,22 @@ struct _Winthread {
|
||||
pthread_mutex_t lock;
|
||||
};
|
||||
|
||||
void on_request(uint8_t *public_key, uint8_t *data, uint16_t length, void *userdata);
|
||||
void on_connectionchange(Tox *m, int friendnumber, uint8_t status, void *userdata);
|
||||
void on_message(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata);
|
||||
void on_action(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata);
|
||||
void on_nickchange(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata);
|
||||
void on_statuschange(Tox *m, int friendnumber, TOX_USERSTATUS status, void *userdata);
|
||||
void on_statusmessagechange(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata);
|
||||
void on_friendadded(Tox *m, int friendnumber, bool sort);
|
||||
void on_request(Tox *m, uint8_t *public_key, uint8_t *data, uint16_t length, void *userdata);
|
||||
void on_connectionchange(Tox *m, int32_t friendnumber, uint8_t status, void *userdata);
|
||||
void on_message(Tox *m, int32_t friendnumber, uint8_t *string, uint16_t length, void *userdata);
|
||||
void on_action(Tox *m, int32_t friendnumber, uint8_t *string, uint16_t length, void *userdata);
|
||||
void on_nickchange(Tox *m, int32_t friendnumber, uint8_t *string, uint16_t length, void *userdata);
|
||||
void on_statuschange(Tox *m, int32_t friendnumber, uint8_t status, void *userdata);
|
||||
void on_statusmessagechange(Tox *m, int32_t friendnumber, uint8_t *string, uint16_t length, void *userdata);
|
||||
void on_friendadded(Tox *m, int32_t friendnumber, bool sort);
|
||||
void on_groupmessage(Tox *m, int groupnumber, int peernumber, uint8_t *message, uint16_t length, void *userdata);
|
||||
void on_groupaction(Tox *m, int groupnumber, int peernumber, uint8_t *action, uint16_t length, void *userdata);
|
||||
void on_groupinvite(Tox *m, int friendnumber, uint8_t *group_pub_key, void *userdata);
|
||||
void on_groupinvite(Tox *m, int32_t friendnumber, uint8_t *group_pub_key, void *userdata);
|
||||
void on_group_namelistchange(Tox *m, int groupnumber, int peernumber, uint8_t change, void *userdata);
|
||||
void on_file_sendrequest(Tox *m, int friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *pathname, uint16_t pathname_length, void *userdata);
|
||||
void on_file_control(Tox *m, int friendnumber, uint8_t receive_send, uint8_t filenumber, uint8_t control_type, uint8_t *data, uint16_t length, void *userdata);
|
||||
void on_file_data(Tox *m, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata);
|
||||
void on_typing_change(Tox *m, int friendnumber, int is_typing, void *userdata);
|
||||
void on_file_sendrequest(Tox *m, int32_t friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *pathname, uint16_t pathname_length, void *userdata);
|
||||
void on_file_control(Tox *m, int32_t friendnumber, uint8_t receive_send, uint8_t filenumber, uint8_t control_type, uint8_t *data, uint16_t length, void *userdata);
|
||||
void on_file_data(Tox *m, int32_t friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata);
|
||||
void on_typing_change(Tox *m, int32_t friendnumber, int is_typing, void *userdata);
|
||||
|
||||
ToxWindow *init_windows(Tox *m);
|
||||
void draw_active_window(Tox *m);
|
||||
|
@ -43,17 +43,17 @@ extern ToxWindow *prompt;
|
||||
static int num_active_windows;
|
||||
|
||||
/* CALLBACKS START */
|
||||
void on_request(uint8_t *public_key, uint8_t *data, uint16_t length, void *userdata)
|
||||
void on_request(Tox *m, uint8_t *public_key, uint8_t *data, uint16_t length, void *userdata)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
|
||||
if (windows[i].onFriendRequest != NULL)
|
||||
windows[i].onFriendRequest(&windows[i], public_key, data, length);
|
||||
windows[i].onFriendRequest(&windows[i], m, public_key, data, length);
|
||||
}
|
||||
}
|
||||
|
||||
void on_connectionchange(Tox *m, int friendnumber, uint8_t status, void *userdata)
|
||||
void on_connectionchange(Tox *m, int32_t friendnumber, uint8_t status, void *userdata)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -63,7 +63,7 @@ void on_connectionchange(Tox *m, int friendnumber, uint8_t status, void *userdat
|
||||
}
|
||||
}
|
||||
|
||||
void on_typing_change(Tox *m, int friendnumber, int is_typing, void *userdata)
|
||||
void on_typing_change(Tox *m, int32_t friendnumber, int is_typing, void *userdata)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -73,7 +73,7 @@ void on_typing_change(Tox *m, int friendnumber, int is_typing, void *userdata)
|
||||
}
|
||||
}
|
||||
|
||||
void on_message(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
||||
void on_message(Tox *m, int32_t friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -83,7 +83,7 @@ void on_message(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void
|
||||
}
|
||||
}
|
||||
|
||||
void on_action(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
||||
void on_action(Tox *m, int32_t friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -93,7 +93,7 @@ void on_action(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void
|
||||
}
|
||||
}
|
||||
|
||||
void on_nickchange(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
||||
void on_nickchange(Tox *m, int32_t friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
||||
{
|
||||
if (friendnumber < 0 || friendnumber > MAX_FRIENDS_NUM)
|
||||
return;
|
||||
@ -109,7 +109,7 @@ void on_nickchange(Tox *m, int friendnumber, uint8_t *string, uint16_t length, v
|
||||
wprintw(prompt->window, "\nCould not store Tox data\n");
|
||||
}
|
||||
|
||||
void on_statusmessagechange(Tox *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
||||
void on_statusmessagechange(Tox *m, int32_t friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -119,7 +119,7 @@ void on_statusmessagechange(Tox *m, int friendnumber, uint8_t *string, uint16_t
|
||||
}
|
||||
}
|
||||
|
||||
void on_statuschange(Tox *m, int friendnumber, TOX_USERSTATUS status, void *userdata)
|
||||
void on_statuschange(Tox *m, int32_t friendnumber, uint8_t status, void *userdata)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -129,7 +129,7 @@ void on_statuschange(Tox *m, int friendnumber, TOX_USERSTATUS status, void *user
|
||||
}
|
||||
}
|
||||
|
||||
void on_friendadded(Tox *m, int friendnumber, bool sort)
|
||||
void on_friendadded(Tox *m, int32_t friendnumber, bool sort)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -164,7 +164,7 @@ void on_groupaction(Tox *m, int groupnumber, int peernumber, uint8_t *action, ui
|
||||
}
|
||||
}
|
||||
|
||||
void on_groupinvite(Tox *m, int friendnumber, uint8_t *group_pub_key, void *userdata)
|
||||
void on_groupinvite(Tox *m, int32_t friendnumber, uint8_t *group_pub_key, void *userdata)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -184,7 +184,7 @@ void on_group_namelistchange(Tox *m, int groupnumber, int peernumber, uint8_t ch
|
||||
}
|
||||
}
|
||||
|
||||
void on_file_sendrequest(Tox *m, int friendnumber, uint8_t filenumber, uint64_t filesize,
|
||||
void on_file_sendrequest(Tox *m, int32_t friendnumber, uint8_t filenumber, uint64_t filesize,
|
||||
uint8_t *filename, uint16_t filename_length, void *userdata)
|
||||
{
|
||||
int i;
|
||||
@ -196,7 +196,7 @@ void on_file_sendrequest(Tox *m, int friendnumber, uint8_t filenumber, uint64_t
|
||||
}
|
||||
}
|
||||
|
||||
void on_file_control (Tox *m, int friendnumber, uint8_t receive_send, uint8_t filenumber,
|
||||
void on_file_control (Tox *m, int32_t friendnumber, uint8_t receive_send, uint8_t filenumber,
|
||||
uint8_t control_type, uint8_t *data, uint16_t length, void *userdata)
|
||||
{
|
||||
int i;
|
||||
@ -208,7 +208,7 @@ void on_file_control (Tox *m, int friendnumber, uint8_t receive_send, uint8_t fi
|
||||
}
|
||||
}
|
||||
|
||||
void on_file_data(Tox *m, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length,
|
||||
void on_file_data(Tox *m, int32_t friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length,
|
||||
void *userdata)
|
||||
{
|
||||
int i;
|
||||
|
Loading…
Reference in New Issue
Block a user