mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-26 15:03:27 +01:00
core api const-correctness update
This commit is contained in:
parent
9696acc8bd
commit
10d0e99d72
38
src/chat.c
38
src/chat.c
@ -128,13 +128,11 @@ void kill_chat_window(ToxWindow *self, Tox *m)
|
|||||||
free(statusbar);
|
free(statusbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chat_onMessage(ToxWindow *self, Tox *m, int32_t num, uint8_t *msg, uint16_t len)
|
static void chat_onMessage(ToxWindow *self, Tox *m, int32_t num, const uint8_t *msg, uint16_t len)
|
||||||
{
|
{
|
||||||
if (self->num != num)
|
if (self->num != num)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
msg[len] = '\0';
|
|
||||||
|
|
||||||
ChatContext *ctx = self->chatwin;
|
ChatContext *ctx = self->chatwin;
|
||||||
|
|
||||||
uint8_t nick[TOX_MAX_NAME_LENGTH];
|
uint8_t nick[TOX_MAX_NAME_LENGTH];
|
||||||
@ -176,14 +174,11 @@ static void chat_onTypingChange(ToxWindow *self, Tox *m, int32_t num, uint8_t is
|
|||||||
friends[num].is_typing = is_typing;
|
friends[num].is_typing = is_typing;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chat_onAction(ToxWindow *self, Tox *m, int32_t num, uint8_t *action, uint16_t len)
|
static void chat_onAction(ToxWindow *self, Tox *m, int32_t num, const uint8_t *action, uint16_t len)
|
||||||
{
|
{
|
||||||
if (self->num != num)
|
if (self->num != num)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
action[len] = '\0';
|
|
||||||
|
|
||||||
ChatContext *ctx = self->chatwin;
|
ChatContext *ctx = self->chatwin;
|
||||||
|
|
||||||
uint8_t nick[TOX_MAX_NAME_LENGTH];
|
uint8_t nick[TOX_MAX_NAME_LENGTH];
|
||||||
@ -200,14 +195,12 @@ static void chat_onAction(ToxWindow *self, Tox *m, int32_t num, uint8_t *action,
|
|||||||
alert_window(self, WINDOW_ALERT_1, true);
|
alert_window(self, WINDOW_ALERT_1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chat_onNickChange(ToxWindow *self, Tox *m, int32_t num, uint8_t *nick, uint16_t len)
|
static void chat_onNickChange(ToxWindow *self, Tox *m, int32_t num, const uint8_t *nick, uint16_t len)
|
||||||
{
|
{
|
||||||
if (self->num != num)
|
if (self->num != num)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
len = MIN(len, TOXIC_MAX_NAME_LENGTH - 1);
|
snprintf(self->name, sizeof(self->name), "%s", nick);
|
||||||
nick[len] = '\0';
|
|
||||||
strcpy(self->name, nick);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chat_onStatusChange(ToxWindow *self, Tox *m, int32_t num, uint8_t status)
|
static void chat_onStatusChange(ToxWindow *self, Tox *m, int32_t num, uint8_t status)
|
||||||
@ -219,22 +212,19 @@ static void chat_onStatusChange(ToxWindow *self, Tox *m, int32_t num, uint8_t st
|
|||||||
statusbar->status = status;
|
statusbar->status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chat_onStatusMessageChange(ToxWindow *self, int32_t num, uint8_t *status, uint16_t len)
|
static void chat_onStatusMessageChange(ToxWindow *self, int32_t num, const uint8_t *status, uint16_t len)
|
||||||
{
|
{
|
||||||
if (self->num != num)
|
if (self->num != num)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
StatusBar *statusbar = self->stb;
|
StatusBar *statusbar = self->stb;
|
||||||
|
|
||||||
status[len] = '\0';
|
|
||||||
snprintf(statusbar->statusmsg, sizeof(statusbar->statusmsg), "%s", status);
|
snprintf(statusbar->statusmsg, sizeof(statusbar->statusmsg), "%s", status);
|
||||||
len = strlen(statusbar->statusmsg);
|
statusbar->statusmsg_len = strlen(statusbar->statusmsg);
|
||||||
statusbar->statusmsg_len = len;
|
|
||||||
statusbar->statusmsg[len] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chat_onFileSendRequest(ToxWindow *self, Tox *m, int32_t 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)
|
uint64_t filesize, const uint8_t *pathname, uint16_t path_len)
|
||||||
{
|
{
|
||||||
if (self->num != num)
|
if (self->num != num)
|
||||||
return;
|
return;
|
||||||
@ -242,9 +232,6 @@ static void chat_onFileSendRequest(ToxWindow *self, Tox *m, int32_t num, uint8_t
|
|||||||
uint8_t msg[MAX_STR_SIZE * 2];
|
uint8_t msg[MAX_STR_SIZE * 2];
|
||||||
uint8_t *errmsg;
|
uint8_t *errmsg;
|
||||||
|
|
||||||
pathname[path_len] = '\0';
|
|
||||||
|
|
||||||
|
|
||||||
/* holds the filename appended to the user specified path */
|
/* holds the filename appended to the user specified path */
|
||||||
uint8_t filename_path[MAX_STR_SIZE] = {0};
|
uint8_t filename_path[MAX_STR_SIZE] = {0};
|
||||||
|
|
||||||
@ -328,7 +315,7 @@ static void chat_close_file_receiver(int32_t num, uint8_t filenum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void chat_onFileControl(ToxWindow *self, Tox *m, int32_t 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)
|
uint8_t filenum, uint8_t control_type, const uint8_t *data, uint16_t length)
|
||||||
{
|
{
|
||||||
if (self->num != num)
|
if (self->num != num)
|
||||||
return;
|
return;
|
||||||
@ -378,7 +365,7 @@ static void chat_onFileControl(ToxWindow *self, Tox *m, int32_t num, uint8_t rec
|
|||||||
alert_window(self, WINDOW_ALERT_2, true);
|
alert_window(self, WINDOW_ALERT_2, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chat_onFileData(ToxWindow *self, Tox *m, int32_t num, uint8_t filenum, uint8_t *data,
|
static void chat_onFileData(ToxWindow *self, Tox *m, int32_t num, uint8_t filenum, const uint8_t *data,
|
||||||
uint16_t length)
|
uint16_t length)
|
||||||
{
|
{
|
||||||
if (self->num != num)
|
if (self->num != num)
|
||||||
@ -410,7 +397,7 @@ static void chat_onFileData(ToxWindow *self, Tox *m, int32_t num, uint8_t filenu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chat_onGroupInvite(ToxWindow *self, Tox *m, int32_t friendnumber, uint8_t *group_pub_key)
|
static void chat_onGroupInvite(ToxWindow *self, Tox *m, int32_t friendnumber, const uint8_t *group_pub_key)
|
||||||
{
|
{
|
||||||
if (self->num != friendnumber)
|
if (self->num != friendnumber)
|
||||||
return;
|
return;
|
||||||
@ -804,12 +791,11 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
|||||||
uint8_t statusmsg[TOX_MAX_STATUSMESSAGE_LENGTH] = {'\0'};
|
uint8_t statusmsg[TOX_MAX_STATUSMESSAGE_LENGTH] = {'\0'};
|
||||||
|
|
||||||
pthread_mutex_lock(&Winthread.lock);
|
pthread_mutex_lock(&Winthread.lock);
|
||||||
uint16_t s_len = tox_get_status_message(m, self->num, statusmsg, TOX_MAX_STATUSMESSAGE_LENGTH);
|
tox_get_status_message(m, self->num, statusmsg, TOX_MAX_STATUSMESSAGE_LENGTH);
|
||||||
pthread_mutex_unlock(&Winthread.lock);
|
pthread_mutex_unlock(&Winthread.lock);
|
||||||
statusmsg[s_len] = '\0';
|
|
||||||
|
|
||||||
snprintf(statusbar->statusmsg, sizeof(statusbar->statusmsg), "%s", statusmsg);
|
snprintf(statusbar->statusmsg, sizeof(statusbar->statusmsg), "%s", statusmsg);
|
||||||
statusbar->statusmsg_len = s_len;
|
statusbar->statusmsg_len = strlen(statusbar->statusmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
self->x = x2;
|
self->x = x2;
|
||||||
|
@ -96,7 +96,7 @@ static void update_friend_last_online(int32_t num, uint64_t timestamp)
|
|||||||
&friends[num].last_online.tm);
|
&friends[num].last_online.tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void friendlist_onMessage(ToxWindow *self, Tox *m, int32_t num, uint8_t *str, uint16_t len)
|
static void friendlist_onMessage(ToxWindow *self, Tox *m, int32_t num, const uint8_t *str, uint16_t len)
|
||||||
{
|
{
|
||||||
if (num >= max_friends_index)
|
if (num >= max_friends_index)
|
||||||
return;
|
return;
|
||||||
@ -105,8 +105,6 @@ static void friendlist_onMessage(ToxWindow *self, Tox *m, int32_t num, uint8_t *
|
|||||||
if (get_num_active_windows() < MAX_WINDOWS_NUM) {
|
if (get_num_active_windows() < MAX_WINDOWS_NUM) {
|
||||||
friends[num].chatwin = add_window(m, new_chat(m, friends[num].num));
|
friends[num].chatwin = add_window(m, new_chat(m, friends[num].num));
|
||||||
} else {
|
} else {
|
||||||
str[len] = '\0';
|
|
||||||
|
|
||||||
uint8_t nick[TOX_MAX_NAME_LENGTH] = {'\0'};
|
uint8_t nick[TOX_MAX_NAME_LENGTH] = {'\0'};
|
||||||
int n_len = tox_get_name(m, num, nick);
|
int n_len = tox_get_name(m, num, nick);
|
||||||
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH - 1);
|
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH - 1);
|
||||||
@ -135,16 +133,13 @@ static void friendlist_onConnectionChange(ToxWindow *self, Tox *m, int32_t num,
|
|||||||
sort_friendlist_index();
|
sort_friendlist_index();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void friendlist_onNickChange(ToxWindow *self, Tox *m, int32_t num, uint8_t *str, uint16_t len)
|
static void friendlist_onNickChange(ToxWindow *self, Tox *m, int32_t num, const uint8_t *nick, uint16_t len)
|
||||||
{
|
{
|
||||||
if (len > TOX_MAX_NAME_LENGTH || num >= max_friends_index)
|
if (len > TOX_MAX_NAME_LENGTH || num >= max_friends_index)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
len = MIN(len, TOXIC_MAX_NAME_LENGTH - 1);
|
snprintf(friends[num].name, sizeof(friends[num].name), "%s", nick);
|
||||||
|
friends[num].namelength = strlen(friends[num].name);
|
||||||
str[len] = '\0';
|
|
||||||
strcpy(friends[num].name, str);
|
|
||||||
friends[num].namelength = len;
|
|
||||||
sort_friendlist_index();
|
sort_friendlist_index();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,16 +151,13 @@ static void friendlist_onStatusChange(ToxWindow *self, Tox *m, int32_t num, uint
|
|||||||
friends[num].status = status;
|
friends[num].status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void friendlist_onStatusMessageChange(ToxWindow *self, int32_t num, uint8_t *str, uint16_t len)
|
static void friendlist_onStatusMessageChange(ToxWindow *self, int32_t num, const uint8_t *status, uint16_t len)
|
||||||
{
|
{
|
||||||
if (len > TOX_MAX_STATUSMESSAGE_LENGTH || num >= max_friends_index)
|
if (len > TOX_MAX_STATUSMESSAGE_LENGTH || num >= max_friends_index)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
str[len] = '\0';
|
snprintf(friends[num].statusmsg, sizeof(friends[num].statusmsg), "%s", status);
|
||||||
snprintf(friends[num].statusmsg, sizeof(friends[num].statusmsg), "%s", str);
|
friends[num].statusmsg_len = strlen(friends[num].statusmsg);
|
||||||
len = strlen(friends[num].statusmsg);
|
|
||||||
friends[num].statusmsg_len = len;
|
|
||||||
friends[num].statusmsg[len] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void friendlist_onFriendAdded(ToxWindow *self, Tox *m, int32_t num, bool sort)
|
void friendlist_onFriendAdded(ToxWindow *self, Tox *m, int32_t num, bool sort)
|
||||||
@ -209,7 +201,7 @@ void friendlist_onFriendAdded(ToxWindow *self, Tox *m, int32_t num, bool sort)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void friendlist_onFileSendRequest(ToxWindow *self, Tox *m, int32_t 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)
|
uint64_t filesize, const uint8_t *filename, uint16_t filename_len)
|
||||||
{
|
{
|
||||||
if (num >= max_friends_index)
|
if (num >= max_friends_index)
|
||||||
return;
|
return;
|
||||||
@ -234,7 +226,7 @@ static void friendlist_onFileSendRequest(ToxWindow *self, Tox *m, int32_t num, u
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void friendlist_onGroupInvite(ToxWindow *self, Tox *m, int32_t num, uint8_t *group_pub_key)
|
static void friendlist_onGroupInvite(ToxWindow *self, Tox *m, int32_t num, const uint8_t *group_pub_key)
|
||||||
{
|
{
|
||||||
if (num >= max_friends_index)
|
if (num >= max_friends_index)
|
||||||
return;
|
return;
|
||||||
@ -472,13 +464,11 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
|
|||||||
uint8_t statusmsg[TOX_MAX_STATUSMESSAGE_LENGTH] = {'\0'};
|
uint8_t statusmsg[TOX_MAX_STATUSMESSAGE_LENGTH] = {'\0'};
|
||||||
|
|
||||||
pthread_mutex_lock(&Winthread.lock);
|
pthread_mutex_lock(&Winthread.lock);
|
||||||
uint16_t s_len = tox_get_status_message(m, friends[f].num, statusmsg,
|
tox_get_status_message(m, friends[f].num, statusmsg, TOX_MAX_STATUSMESSAGE_LENGTH);
|
||||||
TOX_MAX_STATUSMESSAGE_LENGTH);
|
|
||||||
pthread_mutex_unlock(&Winthread.lock);
|
pthread_mutex_unlock(&Winthread.lock);
|
||||||
|
|
||||||
friends[f].statusmsg_len = s_len;
|
|
||||||
friends[f].statusmsg[s_len] = '\0';
|
|
||||||
snprintf(friends[f].statusmsg, sizeof(friends[f].statusmsg), "%s", statusmsg);
|
snprintf(friends[f].statusmsg, sizeof(friends[f].statusmsg), "%s", statusmsg);
|
||||||
|
friends[f].statusmsg_len = strlen(friends[f].statusmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Truncate note if it doesn't fit on one line */
|
/* Truncate note if it doesn't fit on one line */
|
||||||
|
@ -166,13 +166,11 @@ static void print_groupchat_help(ToxWindow *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, int peernum,
|
static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, int peernum,
|
||||||
uint8_t *msg, uint16_t len)
|
const uint8_t *msg, uint16_t len)
|
||||||
{
|
{
|
||||||
if (self->num != groupnum)
|
if (self->num != groupnum)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
msg[len] = '\0';
|
|
||||||
|
|
||||||
ChatContext *ctx = self->chatwin;
|
ChatContext *ctx = self->chatwin;
|
||||||
|
|
||||||
uint8_t nick[TOX_MAX_NAME_LENGTH] = {'\0'};
|
uint8_t nick[TOX_MAX_NAME_LENGTH] = {'\0'};
|
||||||
@ -208,14 +206,12 @@ static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, int
|
|||||||
write_to_log(msg, nick, ctx->log, false);
|
write_to_log(msg, nick, ctx->log, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void groupchat_onGroupAction(ToxWindow *self, Tox *m, int groupnum, int peernum, uint8_t *action,
|
static void groupchat_onGroupAction(ToxWindow *self, Tox *m, int groupnum, int peernum, const uint8_t *action,
|
||||||
uint16_t len)
|
uint16_t len)
|
||||||
{
|
{
|
||||||
if (self->num != groupnum)
|
if (self->num != groupnum)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
action[len] = '\0';
|
|
||||||
|
|
||||||
ChatContext *ctx = self->chatwin;
|
ChatContext *ctx = self->chatwin;
|
||||||
|
|
||||||
/* check if message contains own name and alert appropriately */
|
/* check if message contains own name and alert appropriately */
|
||||||
|
@ -121,7 +121,7 @@ static struct line_info *line_info_ret_queue(struct history *hst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* creates new line_info line and puts it in the queue */
|
/* creates new line_info line and puts it in the queue */
|
||||||
void line_info_add(ToxWindow *self, uint8_t *tmstmp, uint8_t *name1, uint8_t *name2, uint8_t *msg,
|
void line_info_add(ToxWindow *self, uint8_t *tmstmp, uint8_t *name1, uint8_t *name2, const uint8_t *msg,
|
||||||
uint8_t type, uint8_t bold, uint8_t colour)
|
uint8_t type, uint8_t bold, uint8_t colour)
|
||||||
{
|
{
|
||||||
struct history *hst = self->chatwin->hst;
|
struct history *hst = self->chatwin->hst;
|
||||||
|
@ -68,7 +68,7 @@ struct history {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* creates new line_info line and puts it in the queue */
|
/* creates new line_info line and puts it in the queue */
|
||||||
void line_info_add(ToxWindow *self, uint8_t *tmstmp, uint8_t *name1, uint8_t *name2, uint8_t *msg,
|
void line_info_add(ToxWindow *self, uint8_t *tmstmp, uint8_t *name1, uint8_t *name2, const uint8_t *msg,
|
||||||
uint8_t type, uint8_t bold, uint8_t colour);
|
uint8_t type, uint8_t bold, uint8_t colour);
|
||||||
|
|
||||||
/* Prints a section of history starting at line_start */
|
/* Prints a section of history starting at line_start */
|
||||||
|
@ -194,20 +194,23 @@ int valid_nick(uint8_t *nick)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* gets base file name from path or original file name if no path is supplied */
|
/* gets base file name from path or original file name if no path is supplied */
|
||||||
void get_file_name(uint8_t *namebuf, uint8_t *pathname)
|
void get_file_name(uint8_t *namebuf, const uint8_t *pathname)
|
||||||
{
|
{
|
||||||
int idx = strlen(pathname) - 1;
|
int idx = strlen(pathname) - 1;
|
||||||
|
|
||||||
while (idx >= 0 && pathname[idx] == '/')
|
uint8_t tmpname[MAX_STR_SIZE];
|
||||||
pathname[idx--] = '\0';
|
snprintf(tmpname, sizeof(tmpname), "%s", pathname);
|
||||||
|
|
||||||
uint8_t *filename = strrchr(pathname, '/');
|
while (idx >= 0 && pathname[idx] == '/')
|
||||||
|
tmpname[idx--] = '\0';
|
||||||
|
|
||||||
|
uint8_t *filename = strrchr(tmpname, '/');
|
||||||
|
|
||||||
if (filename != NULL) {
|
if (filename != NULL) {
|
||||||
if (!strlen(++filename))
|
if (!strlen(++filename))
|
||||||
filename = pathname;
|
filename = tmpname;
|
||||||
} else {
|
} else {
|
||||||
filename = pathname;
|
filename = tmpname;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(namebuf, MAX_STR_SIZE, "%s", filename);
|
snprintf(namebuf, MAX_STR_SIZE, "%s", filename);
|
||||||
|
@ -80,7 +80,7 @@ int qsort_strcasecmp_hlpr(const void *nick1, const void *nick2);
|
|||||||
int valid_nick(uint8_t *nick);
|
int valid_nick(uint8_t *nick);
|
||||||
|
|
||||||
/* gets base file name from path or original file name if no path is supplied */
|
/* gets base file name from path or original file name if no path is supplied */
|
||||||
void get_file_name(uint8_t *namebuf, uint8_t *pathname);
|
void get_file_name(uint8_t *namebuf, const uint8_t *pathname);
|
||||||
|
|
||||||
/* converts str to all lowercase */
|
/* converts str to all lowercase */
|
||||||
void str_to_lower(uint8_t *str);
|
void str_to_lower(uint8_t *str);
|
||||||
|
20
src/toxic.h
20
src/toxic.h
@ -77,21 +77,21 @@ int store_data(Tox *m, char *path);
|
|||||||
|
|
||||||
void on_request(Tox *m, const uint8_t *public_key, const uint8_t *data, uint16_t length, void *userdata);
|
void on_request(Tox *m, const uint8_t *public_key, const uint8_t *data, uint16_t length, void *userdata);
|
||||||
void on_connectionchange(Tox *m, int32_t friendnumber, uint8_t status, 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_message(Tox *m, int32_t friendnumber, const 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_action(Tox *m, int32_t friendnumber, const 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_nickchange(Tox *m, int32_t friendnumber, const uint8_t *string, uint16_t length, void *userdata);
|
||||||
void on_statuschange(Tox *m, int32_t friendnumber, uint8_t status, 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_statusmessagechange(Tox *m, int32_t friendnumber, const uint8_t *string, uint16_t length, void *userdata);
|
||||||
void on_friendadded(Tox *m, int32_t friendnumber, bool sort);
|
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_groupmessage(Tox *m, int groupnumber, int peernumber, const 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_groupaction(Tox *m, int groupnumber, int peernumber, const uint8_t *action, uint16_t length, void *userdata);
|
||||||
void on_groupinvite(Tox *m, int32_t friendnumber, uint8_t *group_pub_key, void *userdata);
|
void on_groupinvite(Tox *m, int32_t friendnumber, const uint8_t *group_pub_key, void *userdata);
|
||||||
void on_group_namelistchange(Tox *m, int groupnumber, int peernumber, uint8_t change, void *userdata);
|
void on_group_namelistchange(Tox *m, int groupnumber, int peernumber, uint8_t change, void *userdata);
|
||||||
void on_file_sendrequest(Tox *m, int32_t friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *pathname,
|
void on_file_sendrequest(Tox *m, int32_t friendnumber, uint8_t filenumber, uint64_t filesize, const uint8_t *pathname,
|
||||||
uint16_t pathname_length, void *userdata);
|
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,
|
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);
|
const 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_file_data(Tox *m, int32_t friendnumber, uint8_t filenumber, const uint8_t *data, uint16_t length, void *userdata);
|
||||||
void on_typing_change(Tox *m, int32_t friendnumber, uint8_t is_typing, void *userdata);
|
void on_typing_change(Tox *m, int32_t friendnumber, uint8_t is_typing, void *userdata);
|
||||||
|
|
||||||
#endif /* #define _toxic_h */
|
#endif /* #define _toxic_h */
|
||||||
|
@ -73,7 +73,7 @@ void on_typing_change(Tox *m, int32_t friendnumber, uint8_t is_typing, void *use
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_message(Tox *m, int32_t friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
void on_message(Tox *m, int32_t friendnumber, const uint8_t *string, uint16_t length, void *userdata)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ void on_message(Tox *m, int32_t friendnumber, uint8_t *string, uint16_t length,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_action(Tox *m, int32_t friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
void on_action(Tox *m, int32_t friendnumber, const uint8_t *string, uint16_t length, void *userdata)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ void on_action(Tox *m, int32_t friendnumber, uint8_t *string, uint16_t length, v
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_nickchange(Tox *m, int32_t friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
void on_nickchange(Tox *m, int32_t friendnumber, const uint8_t *string, uint16_t length, void *userdata)
|
||||||
{
|
{
|
||||||
if (friendnumber < 0 || friendnumber > MAX_FRIENDS_NUM)
|
if (friendnumber < 0 || friendnumber > MAX_FRIENDS_NUM)
|
||||||
return;
|
return;
|
||||||
@ -109,7 +109,7 @@ void on_nickchange(Tox *m, int32_t friendnumber, uint8_t *string, uint16_t lengt
|
|||||||
wprintw(prompt->window, "\nCould not store Tox data\n");
|
wprintw(prompt->window, "\nCould not store Tox data\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_statusmessagechange(Tox *m, int32_t friendnumber, uint8_t *string, uint16_t length, void *userdata)
|
void on_statusmessagechange(Tox *m, int32_t friendnumber, const uint8_t *string, uint16_t length, void *userdata)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ void on_friendadded(Tox *m, int32_t friendnumber, bool sort)
|
|||||||
wprintw(prompt->window, "\nCould not store Tox data\n");
|
wprintw(prompt->window, "\nCould not store Tox data\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_groupmessage(Tox *m, int groupnumber, int peernumber, uint8_t *message, uint16_t length,
|
void on_groupmessage(Tox *m, int groupnumber, int peernumber, const uint8_t *message, uint16_t length,
|
||||||
void *userdata)
|
void *userdata)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -153,7 +153,7 @@ void on_groupmessage(Tox *m, int groupnumber, int peernumber, uint8_t *message,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_groupaction(Tox *m, int groupnumber, int peernumber, uint8_t *action, uint16_t length,
|
void on_groupaction(Tox *m, int groupnumber, int peernumber, const uint8_t *action, uint16_t length,
|
||||||
void *userdata)
|
void *userdata)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -164,7 +164,7 @@ void on_groupaction(Tox *m, int groupnumber, int peernumber, uint8_t *action, ui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_groupinvite(Tox *m, int32_t friendnumber, uint8_t *group_pub_key, void *userdata)
|
void on_groupinvite(Tox *m, int32_t friendnumber, const uint8_t *group_pub_key, void *userdata)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ void on_group_namelistchange(Tox *m, int groupnumber, int peernumber, uint8_t ch
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_file_sendrequest(Tox *m, int32_t 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)
|
const uint8_t *filename, uint16_t filename_length, void *userdata)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ void on_file_sendrequest(Tox *m, int32_t friendnumber, uint8_t filenumber, uint6
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_file_control (Tox *m, int32_t 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)
|
uint8_t control_type, const uint8_t *data, uint16_t length, void *userdata)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ void on_file_control (Tox *m, int32_t friendnumber, uint8_t receive_send, uint8_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_file_data(Tox *m, int32_t friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length,
|
void on_file_data(Tox *m, int32_t friendnumber, uint8_t filenumber, const uint8_t *data, uint16_t length,
|
||||||
void *userdata)
|
void *userdata)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -330,7 +330,6 @@ void on_window_resize(void)
|
|||||||
|
|
||||||
delwin(w->window);
|
delwin(w->window);
|
||||||
w->window = newwin(y2, x2, 0, 0);
|
w->window = newwin(y2, x2, 0, 0);
|
||||||
w->x = x2;
|
|
||||||
|
|
||||||
if (windows[i].is_friendlist)
|
if (windows[i].is_friendlist)
|
||||||
continue;
|
continue;
|
||||||
|
@ -80,18 +80,18 @@ struct ToxWindow {
|
|||||||
void(*onFriendRequest)(ToxWindow *, Tox *, const uint8_t *, const uint8_t *, uint16_t);
|
void(*onFriendRequest)(ToxWindow *, Tox *, const uint8_t *, const uint8_t *, uint16_t);
|
||||||
void(*onFriendAdded)(ToxWindow *, Tox *, int32_t, bool);
|
void(*onFriendAdded)(ToxWindow *, Tox *, int32_t, bool);
|
||||||
void(*onConnectionChange)(ToxWindow *, Tox *, int32_t, uint8_t);
|
void(*onConnectionChange)(ToxWindow *, Tox *, int32_t, uint8_t);
|
||||||
void(*onMessage)(ToxWindow *, Tox *, int32_t, uint8_t *, uint16_t);
|
void(*onMessage)(ToxWindow *, Tox *, int32_t, const uint8_t *, uint16_t);
|
||||||
void(*onNickChange)(ToxWindow *, Tox *, int32_t, uint8_t *, uint16_t);
|
void(*onNickChange)(ToxWindow *, Tox *, int32_t, const uint8_t *, uint16_t);
|
||||||
void(*onStatusChange)(ToxWindow *, Tox *, int32_t, uint8_t);
|
void(*onStatusChange)(ToxWindow *, Tox *, int32_t, uint8_t);
|
||||||
void(*onStatusMessageChange)(ToxWindow *, int32_t, uint8_t *, uint16_t);
|
void(*onStatusMessageChange)(ToxWindow *, int32_t, const uint8_t *, uint16_t);
|
||||||
void(*onAction)(ToxWindow *, Tox *, int32_t, uint8_t *, uint16_t);
|
void(*onAction)(ToxWindow *, Tox *, int32_t, const uint8_t *, uint16_t);
|
||||||
void(*onGroupMessage)(ToxWindow *, Tox *, int, int, uint8_t *, uint16_t);
|
void(*onGroupMessage)(ToxWindow *, Tox *, int, int, const uint8_t *, uint16_t);
|
||||||
void(*onGroupAction)(ToxWindow *, Tox *, int, int, uint8_t *, uint16_t);
|
void(*onGroupAction)(ToxWindow *, Tox *, int, int, const uint8_t *, uint16_t);
|
||||||
void(*onGroupInvite)(ToxWindow *, Tox *, int32_t, uint8_t *);
|
void(*onGroupInvite)(ToxWindow *, Tox *, int32_t, const uint8_t *);
|
||||||
void(*onGroupNamelistChange)(ToxWindow *, Tox *, int, int, uint8_t);
|
void(*onGroupNamelistChange)(ToxWindow *, Tox *, int, int, uint8_t);
|
||||||
void(*onFileSendRequest)(ToxWindow *, Tox *, int32_t, uint8_t, uint64_t, uint8_t *, uint16_t);
|
void(*onFileSendRequest)(ToxWindow *, Tox *, int32_t, uint8_t, uint64_t, const uint8_t *, uint16_t);
|
||||||
void(*onFileControl)(ToxWindow *, Tox *, int32_t, uint8_t, uint8_t, uint8_t, uint8_t *, uint16_t);
|
void(*onFileControl)(ToxWindow *, Tox *, int32_t, uint8_t, uint8_t, uint8_t, const uint8_t *, uint16_t);
|
||||||
void(*onFileData)(ToxWindow *, Tox *, int32_t, uint8_t, uint8_t *, uint16_t);
|
void(*onFileData)(ToxWindow *, Tox *, int32_t, uint8_t, const uint8_t *, uint16_t);
|
||||||
void(*onTypingChange)(ToxWindow *, Tox *, int32_t, uint8_t);
|
void(*onTypingChange)(ToxWindow *, Tox *, int32_t, uint8_t);
|
||||||
|
|
||||||
#ifdef _SUPPORT_AUDIO
|
#ifdef _SUPPORT_AUDIO
|
||||||
|
Loading…
Reference in New Issue
Block a user