mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-26 14:03:27 +01:00
Convert deprecated uppercase enums to camelcase
This commit is contained in:
parent
94d22a8853
commit
0fea930c24
@ -73,7 +73,7 @@ char *api_get_nick(void)
|
|||||||
return (char *) name;
|
return (char *) name;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_USER_STATUS api_get_status(void)
|
Tox_User_Status api_get_status(void)
|
||||||
{
|
{
|
||||||
return tox_self_get_status(user_tox);
|
return tox_self_get_status(user_tox);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
void api_display(const char *const msg);
|
void api_display(const char *const msg);
|
||||||
FriendsList api_get_friendslist(void);
|
FriendsList api_get_friendslist(void);
|
||||||
char *api_get_nick(void);
|
char *api_get_nick(void);
|
||||||
TOX_USER_STATUS api_get_status(void);
|
Tox_User_Status api_get_status(void);
|
||||||
char *api_get_status_message(void);
|
char *api_get_status_message(void);
|
||||||
void api_send(const char *msg);
|
void api_send(const char *msg);
|
||||||
void api_execute(const char *input, int mode);
|
void api_execute(const char *input, int mode);
|
||||||
|
@ -115,7 +115,7 @@ static void print_err(ToxWindow *self, const char *error_str)
|
|||||||
|
|
||||||
ToxAV *init_audio(ToxWindow *self, Tox *tox)
|
ToxAV *init_audio(ToxWindow *self, Tox *tox)
|
||||||
{
|
{
|
||||||
TOXAV_ERR_NEW error;
|
Toxav_Err_New error;
|
||||||
CallControl.audio_errors = ae_None;
|
CallControl.audio_errors = ae_None;
|
||||||
CallControl.prompt = self;
|
CallControl.prompt = self;
|
||||||
CallControl.pending_call = false;
|
CallControl.pending_call = false;
|
||||||
@ -172,7 +172,7 @@ void terminate_audio(void)
|
|||||||
|
|
||||||
void read_device_callback(const int16_t *captured, uint32_t size, void *data)
|
void read_device_callback(const int16_t *captured, uint32_t size, void *data)
|
||||||
{
|
{
|
||||||
TOXAV_ERR_SEND_FRAME error;
|
Toxav_Err_Send_Frame error;
|
||||||
uint32_t friend_number = *((uint32_t *)data); /* TODO: Or pass an array of call_idx's */
|
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) * \
|
int64_t sample_count = ((int64_t) CallControl.audio_sample_rate) * \
|
||||||
((int64_t) CallControl.audio_frame_duration) / 1000;
|
((int64_t) CallControl.audio_frame_duration) / 1000;
|
||||||
@ -235,7 +235,7 @@ int start_transmission(ToxWindow *self, Call *call)
|
|||||||
int stop_transmission(Call *call, uint32_t friend_number)
|
int stop_transmission(Call *call, uint32_t friend_number)
|
||||||
{
|
{
|
||||||
if (call->ttas) {
|
if (call->ttas) {
|
||||||
TOXAV_ERR_CALL_CONTROL error = TOXAV_ERR_CALL_CONTROL_OK;
|
Toxav_Err_Call_Control error = TOXAV_ERR_CALL_CONTROL_OK;
|
||||||
|
|
||||||
if (CallControl.call_state > TOXAV_FRIEND_CALL_STATE_FINISHED) {
|
if (CallControl.call_state > TOXAV_FRIEND_CALL_STATE_FINISHED) {
|
||||||
toxav_call_control(CallControl.av, friend_number, TOXAV_CALL_CONTROL_CANCEL, &error);
|
toxav_call_control(CallControl.av, friend_number, TOXAV_CALL_CONTROL_CANCEL, &error);
|
||||||
@ -480,7 +480,7 @@ void callback_call_ended(uint32_t friend_number)
|
|||||||
*/
|
*/
|
||||||
void cmd_call(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
void cmd_call(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||||
{
|
{
|
||||||
TOXAV_ERR_CALL error;
|
Toxav_Err_Call error;
|
||||||
const char *error_str;
|
const char *error_str;
|
||||||
|
|
||||||
if (argc != 0) {
|
if (argc != 0) {
|
||||||
@ -531,7 +531,7 @@ on_error:
|
|||||||
|
|
||||||
void cmd_answer(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
void cmd_answer(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||||
{
|
{
|
||||||
TOXAV_ERR_ANSWER error;
|
Toxav_Err_Answer error;
|
||||||
const char *error_str;
|
const char *error_str;
|
||||||
|
|
||||||
if (argc != 0) {
|
if (argc != 0) {
|
||||||
@ -906,7 +906,7 @@ void cmd_bitrate(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)
|
|||||||
|
|
||||||
const uint32_t bitrate = strtol(argv[1], NULL, 10);
|
const uint32_t bitrate = strtol(argv[1], NULL, 10);
|
||||||
|
|
||||||
TOXAV_ERR_BIT_RATE_SET error;
|
Toxav_Err_Bit_Rate_Set error;
|
||||||
audio_bit_rate_status_cb(CallControl.av, self->num, bitrate, &error);
|
audio_bit_rate_status_cb(CallControl.av, self->num, bitrate, &error);
|
||||||
|
|
||||||
if (error != TOXAV_ERR_BIT_RATE_SET_OK) {
|
if (error != TOXAV_ERR_BIT_RATE_SET_OK) {
|
||||||
|
@ -52,7 +52,7 @@ static void avatar_clear(void)
|
|||||||
*/
|
*/
|
||||||
int avatar_send(Tox *m, uint32_t friendnum)
|
int avatar_send(Tox *m, uint32_t friendnum)
|
||||||
{
|
{
|
||||||
TOX_ERR_FILE_SEND err;
|
Tox_Err_File_Send err;
|
||||||
uint32_t filenum = tox_file_send(m, friendnum, TOX_FILE_KIND_AVATAR, (size_t) Avatar.size,
|
uint32_t filenum = tox_file_send(m, friendnum, TOX_FILE_KIND_AVATAR, (size_t) Avatar.size,
|
||||||
NULL, (uint8_t *) Avatar.name, Avatar.name_len, &err);
|
NULL, (uint8_t *) Avatar.name, Avatar.name_len, &err);
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ void avatar_unset(Tox *m)
|
|||||||
avatar_send_all(m);
|
avatar_send_all(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_avatar_file_control(Tox *m, struct FileTransfer *ft, TOX_FILE_CONTROL control)
|
void on_avatar_file_control(Tox *m, struct FileTransfer *ft, Tox_File_Control control)
|
||||||
{
|
{
|
||||||
switch (control) {
|
switch (control) {
|
||||||
case TOX_FILE_CONTROL_RESUME:
|
case TOX_FILE_CONTROL_RESUME:
|
||||||
@ -204,7 +204,7 @@ void on_avatar_chunk_request(Tox *m, struct FileTransfer *ft, uint64_t position,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_ERR_FILE_SEND_CHUNK err;
|
Tox_Err_File_Send_Chunk err;
|
||||||
tox_file_send_chunk(m, ft->friendnum, ft->filenum, position, send_data, send_length, &err);
|
tox_file_send_chunk(m, ft->friendnum, ft->filenum, position, send_data, send_length, &err);
|
||||||
|
|
||||||
if (err != TOX_ERR_FILE_SEND_CHUNK_OK) {
|
if (err != TOX_ERR_FILE_SEND_CHUNK_OK) {
|
||||||
|
@ -47,6 +47,6 @@ int avatar_set(Tox *m, const char *path, size_t length);
|
|||||||
void avatar_unset(Tox *m);
|
void avatar_unset(Tox *m);
|
||||||
|
|
||||||
void on_avatar_chunk_request(Tox *m, struct FileTransfer *ft, uint64_t position, size_t length);
|
void on_avatar_chunk_request(Tox *m, struct FileTransfer *ft, uint64_t position, size_t length);
|
||||||
void on_avatar_file_control(Tox *m, struct FileTransfer *ft, TOX_FILE_CONTROL control);
|
void on_avatar_file_control(Tox *m, struct FileTransfer *ft, Tox_File_Control control);
|
||||||
|
|
||||||
#endif /* AVATARS_H */
|
#endif /* AVATARS_H */
|
||||||
|
@ -560,7 +560,7 @@ static void DHT_bootstrap(Tox *m)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_ERR_BOOTSTRAP err;
|
Tox_Err_Bootstrap err;
|
||||||
tox_bootstrap(m, addr, node->port, (uint8_t *) node->key, &err);
|
tox_bootstrap(m, addr, node->port, (uint8_t *) node->key, &err);
|
||||||
|
|
||||||
if (err != TOX_ERR_BOOTSTRAP_OK) {
|
if (err != TOX_ERR_BOOTSTRAP_OK) {
|
||||||
|
16
src/chat.c
16
src/chat.c
@ -206,7 +206,7 @@ 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)
|
static void chat_onMessage(ToxWindow *self, Tox *m, uint32_t num, Tox_Message_Type type, const char *msg, size_t len)
|
||||||
{
|
{
|
||||||
if (self->num != num) {
|
if (self->num != num) {
|
||||||
return;
|
return;
|
||||||
@ -232,7 +232,7 @@ static void chat_onMessage(ToxWindow *self, Tox *m, uint32_t num, TOX_MESSAGE_TY
|
|||||||
static void chat_pause_file_transfers(Tox *m, uint32_t friendnum);
|
static void chat_pause_file_transfers(Tox *m, uint32_t friendnum);
|
||||||
static void chat_resume_file_senders(ToxWindow *self, Tox *m, uint32_t fnum);
|
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)
|
static void chat_onConnectionChange(ToxWindow *self, Tox *m, uint32_t num, Tox_Connection connection_status)
|
||||||
{
|
{
|
||||||
if (self->num != num) {
|
if (self->num != num) {
|
||||||
return;
|
return;
|
||||||
@ -248,7 +248,7 @@ static void chat_onConnectionChange(ToxWindow *self, Tox *m, uint32_t num, TOX_C
|
|||||||
char nick[TOX_MAX_NAME_LENGTH];
|
char nick[TOX_MAX_NAME_LENGTH];
|
||||||
get_nick_truncate(m, nick, num);
|
get_nick_truncate(m, nick, num);
|
||||||
|
|
||||||
TOX_CONNECTION prev_status = statusbar->connection;
|
Tox_Connection prev_status = statusbar->connection;
|
||||||
statusbar->connection = connection_status;
|
statusbar->connection = connection_status;
|
||||||
|
|
||||||
if (user_settings->show_connection_msg == SHOW_WELCOME_MSG_OFF) {
|
if (user_settings->show_connection_msg == SHOW_WELCOME_MSG_OFF) {
|
||||||
@ -300,7 +300,7 @@ static void chat_onNickChange(ToxWindow *self, Tox *m, uint32_t num, const char
|
|||||||
set_window_title(self, statusbar->nick, length);
|
set_window_title(self, statusbar->nick, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chat_onStatusChange(ToxWindow *self, Tox *m, uint32_t num, TOX_USER_STATUS status)
|
static void chat_onStatusChange(ToxWindow *self, Tox *m, uint32_t num, Tox_User_Status status)
|
||||||
{
|
{
|
||||||
if (self->num != num) {
|
if (self->num != num) {
|
||||||
return;
|
return;
|
||||||
@ -357,7 +357,7 @@ static void chat_resume_file_senders(ToxWindow *self, Tox *m, uint32_t friendnum
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_ERR_FILE_SEND err;
|
Tox_Err_File_Send err;
|
||||||
ft->filenum = tox_file_send(m, friendnum, TOX_FILE_KIND_DATA, ft->file_size, ft->file_id,
|
ft->filenum = tox_file_send(m, friendnum, TOX_FILE_KIND_DATA, ft->file_size, ft->file_id,
|
||||||
(uint8_t *) ft->file_name, strlen(ft->file_name), &err);
|
(uint8_t *) ft->file_name, strlen(ft->file_name), &err);
|
||||||
|
|
||||||
@ -421,7 +421,7 @@ static void chat_onFileChunkRequest(ToxWindow *self, Tox *m, uint32_t friendnum,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_ERR_FILE_SEND_CHUNK err;
|
Tox_Err_File_Send_Chunk err;
|
||||||
tox_file_send_chunk(m, ft->friendnum, ft->filenum, position, send_data, send_length, &err);
|
tox_file_send_chunk(m, ft->friendnum, ft->filenum, position, send_data, send_length, &err);
|
||||||
|
|
||||||
if (err != TOX_ERR_FILE_SEND_CHUNK_OK) {
|
if (err != TOX_ERR_FILE_SEND_CHUNK_OK) {
|
||||||
@ -476,7 +476,7 @@ static void chat_onFileRecvChunk(ToxWindow *self, Tox *m, uint32_t friendnum, ui
|
|||||||
ft->last_keep_alive = get_unix_time();
|
ft->last_keep_alive = get_unix_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chat_onFileControl(ToxWindow *self, Tox *m, uint32_t friendnum, uint32_t filenum, TOX_FILE_CONTROL control)
|
static void chat_onFileControl(ToxWindow *self, Tox *m, uint32_t friendnum, uint32_t filenum, Tox_File_Control control)
|
||||||
{
|
{
|
||||||
if (friendnum != self->num) {
|
if (friendnum != self->num) {
|
||||||
return;
|
return;
|
||||||
@ -1117,7 +1117,7 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
|||||||
/* Draw name, status and note in statusbar */
|
/* Draw name, status and note in statusbar */
|
||||||
if (statusbar->connection != TOX_CONNECTION_NONE) {
|
if (statusbar->connection != TOX_CONNECTION_NONE) {
|
||||||
int colour = MAGENTA;
|
int colour = MAGENTA;
|
||||||
TOX_USER_STATUS status = statusbar->status;
|
Tox_User_Status status = statusbar->status;
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case TOX_USER_STATUS_NONE:
|
case TOX_USER_STATUS_NONE:
|
||||||
|
@ -92,7 +92,7 @@ void cmd_groupinvite(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*a
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_ERR_CONFERENCE_INVITE err;
|
Tox_Err_Conference_Invite err;
|
||||||
|
|
||||||
if (!tox_conference_invite(m, self->num, groupnum, &err)) {
|
if (!tox_conference_invite(m, self->num, groupnum, &err)) {
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to invite contact to group (error %d)", err);
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to invite contact to group (error %d)", err);
|
||||||
@ -123,7 +123,7 @@ void cmd_join_group(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*ar
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_ERR_CONFERENCE_JOIN err;
|
Tox_Err_Conference_Join err;
|
||||||
|
|
||||||
uint32_t groupnum = tox_conference_join(m, self->num, (const uint8_t *) groupkey, length, &err);
|
uint32_t groupnum = tox_conference_join(m, self->num, (const uint8_t *) groupkey, length, &err);
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ void cmd_savefile(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_ERR_FILE_CONTROL err;
|
Tox_Err_File_Control err;
|
||||||
tox_file_control(m, self->num, ft->filenum, TOX_FILE_CONTROL_RESUME, &err);
|
tox_file_control(m, self->num, ft->filenum, TOX_FILE_CONTROL_RESUME, &err);
|
||||||
|
|
||||||
if (err != TOX_ERR_FILE_CONTROL_OK) {
|
if (err != TOX_ERR_FILE_CONTROL_OK) {
|
||||||
@ -259,7 +259,7 @@ void cmd_sendfile(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv
|
|||||||
char file_name[TOX_MAX_FILENAME_LENGTH];
|
char file_name[TOX_MAX_FILENAME_LENGTH];
|
||||||
size_t namelen = get_file_name(file_name, sizeof(file_name), path);
|
size_t namelen = get_file_name(file_name, sizeof(file_name), path);
|
||||||
|
|
||||||
TOX_ERR_FILE_SEND err;
|
Tox_Err_File_Send err;
|
||||||
uint32_t filenum = tox_file_send(m, self->num, TOX_FILE_KIND_DATA, (uint64_t) filesize, NULL,
|
uint32_t filenum = tox_file_send(m, self->num, TOX_FILE_KIND_DATA, (uint64_t) filesize, NULL,
|
||||||
(uint8_t *) file_name, namelen, &err);
|
(uint8_t *) file_name, namelen, &err);
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ void close_file_transfer(ToxWindow *self, Tox *m, struct FileTransfer *ft, int C
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (CTRL >= 0) {
|
if (CTRL >= 0) {
|
||||||
tox_file_control(m, ft->friendnum, ft->filenum, (TOX_FILE_CONTROL) CTRL, NULL);
|
tox_file_control(m, ft->friendnum, ft->filenum, (Tox_File_Control) CTRL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message && self) {
|
if (message && self) {
|
||||||
|
@ -341,7 +341,7 @@ static void update_friend_last_online(uint32_t num, time_t timestamp)
|
|||||||
&Friends.list[num].last_online.tm);
|
&Friends.list[num].last_online.tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void friendlist_onMessage(ToxWindow *self, Tox *m, uint32_t num, TOX_MESSAGE_TYPE type, const char *str,
|
static void friendlist_onMessage(ToxWindow *self, Tox *m, uint32_t num, Tox_Message_Type type, const char *str,
|
||||||
size_t length)
|
size_t length)
|
||||||
{
|
{
|
||||||
if (num >= Friends.max_idx) {
|
if (num >= Friends.max_idx) {
|
||||||
@ -368,7 +368,7 @@ static void friendlist_onMessage(ToxWindow *self, Tox *m, uint32_t num, TOX_MESS
|
|||||||
sound_notify(prompt, notif_error, NT_WNDALERT_1, NULL);
|
sound_notify(prompt, notif_error, NT_WNDALERT_1, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void friendlist_onConnectionChange(ToxWindow *self, Tox *m, uint32_t num, TOX_CONNECTION connection_status)
|
static void friendlist_onConnectionChange(ToxWindow *self, Tox *m, uint32_t num, Tox_Connection connection_status)
|
||||||
{
|
{
|
||||||
if (num >= Friends.max_idx) {
|
if (num >= Friends.max_idx) {
|
||||||
return;
|
return;
|
||||||
@ -417,7 +417,7 @@ static void friendlist_onNickChange(ToxWindow *self, Tox *m, uint32_t num, const
|
|||||||
sort_friendlist_index();
|
sort_friendlist_index();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void friendlist_onStatusChange(ToxWindow *self, Tox *m, uint32_t num, TOX_USER_STATUS status)
|
static void friendlist_onStatusChange(ToxWindow *self, Tox *m, uint32_t num, Tox_User_Status status)
|
||||||
{
|
{
|
||||||
if (num >= Friends.max_idx) {
|
if (num >= Friends.max_idx) {
|
||||||
return;
|
return;
|
||||||
@ -457,14 +457,14 @@ void friendlist_onFriendAdded(ToxWindow *self, Tox *m, uint32_t num, bool sort)
|
|||||||
Friends.list[i].status = TOX_USER_STATUS_NONE;
|
Friends.list[i].status = TOX_USER_STATUS_NONE;
|
||||||
Friends.list[i].logging_on = (bool) user_settings->autolog == AUTOLOG_ON;
|
Friends.list[i].logging_on = (bool) user_settings->autolog == AUTOLOG_ON;
|
||||||
|
|
||||||
TOX_ERR_FRIEND_GET_PUBLIC_KEY pkerr;
|
Tox_Err_Friend_Get_Public_Key pkerr;
|
||||||
tox_friend_get_public_key(m, num, (uint8_t *) Friends.list[i].pub_key, &pkerr);
|
tox_friend_get_public_key(m, num, (uint8_t *) Friends.list[i].pub_key, &pkerr);
|
||||||
|
|
||||||
if (pkerr != TOX_ERR_FRIEND_GET_PUBLIC_KEY_OK) {
|
if (pkerr != TOX_ERR_FRIEND_GET_PUBLIC_KEY_OK) {
|
||||||
fprintf(stderr, "tox_friend_get_public_key failed (error %d)\n", pkerr);
|
fprintf(stderr, "tox_friend_get_public_key failed (error %d)\n", pkerr);
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_ERR_FRIEND_GET_LAST_ONLINE loerr;
|
Tox_Err_Friend_Get_Last_Online loerr;
|
||||||
time_t t = tox_friend_get_last_online(m, num, &loerr);
|
time_t t = tox_friend_get_last_online(m, num, &loerr);
|
||||||
|
|
||||||
if (loerr != TOX_ERR_FRIEND_GET_LAST_ONLINE_OK) {
|
if (loerr != TOX_ERR_FRIEND_GET_LAST_ONLINE_OK) {
|
||||||
@ -600,7 +600,7 @@ static void select_friend(ToxWindow *self, wint_t key, int *selected, int num)
|
|||||||
|
|
||||||
static void delete_friend(Tox *m, uint32_t f_num)
|
static void delete_friend(Tox *m, uint32_t f_num)
|
||||||
{
|
{
|
||||||
TOX_ERR_FRIEND_DELETE err;
|
Tox_Err_Friend_Delete err;
|
||||||
|
|
||||||
if (tox_friend_delete(m, f_num, &err) != true) {
|
if (tox_friend_delete(m, f_num, &err) != true) {
|
||||||
fprintf(stderr, "tox_friend_delete failed with error %d\n", err);
|
fprintf(stderr, "tox_friend_delete failed with error %d\n", err);
|
||||||
@ -780,7 +780,7 @@ static void unblock_friend(Tox *m, uint32_t bnum)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_ERR_FRIEND_ADD err;
|
Tox_Err_Friend_Add err;
|
||||||
uint32_t friendnum = tox_friend_add_norequest(m, (uint8_t *) Blocked.list[bnum].pub_key, &err);
|
uint32_t friendnum = tox_friend_add_norequest(m, (uint8_t *) Blocked.list[bnum].pub_key, &err);
|
||||||
|
|
||||||
if (err != TOX_ERR_FRIEND_ADD_OK) {
|
if (err != TOX_ERR_FRIEND_ADD_OK) {
|
||||||
@ -1035,8 +1035,8 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_lock(&Winthread.lock);
|
pthread_mutex_lock(&Winthread.lock);
|
||||||
TOX_CONNECTION connection_status = Friends.list[f].connection_status;
|
Tox_Connection connection_status = Friends.list[f].connection_status;
|
||||||
TOX_USER_STATUS status = Friends.list[f].status;
|
Tox_User_Status status = Friends.list[f].status;
|
||||||
pthread_mutex_unlock(&Winthread.lock);
|
pthread_mutex_unlock(&Winthread.lock);
|
||||||
|
|
||||||
if (connection_status != TOX_CONNECTION_NONE) {
|
if (connection_status != TOX_CONNECTION_NONE) {
|
||||||
@ -1226,13 +1226,13 @@ static void friendlist_onAV(ToxWindow *self, ToxAV *av, uint32_t friend_number,
|
|||||||
#endif /* AUDIO */
|
#endif /* AUDIO */
|
||||||
|
|
||||||
/* Returns a friend's status */
|
/* Returns a friend's status */
|
||||||
TOX_USER_STATUS get_friend_status(uint32_t friendnumber)
|
Tox_User_Status get_friend_status(uint32_t friendnumber)
|
||||||
{
|
{
|
||||||
return Friends.list[friendnumber].status;
|
return Friends.list[friendnumber].status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns a friend's connection status */
|
/* Returns a friend's connection status */
|
||||||
TOX_CONNECTION get_friend_connection_status(uint32_t friendnumber)
|
Tox_Connection get_friend_connection_status(uint32_t friendnumber)
|
||||||
{
|
{
|
||||||
return Friends.list[friendnumber].connection_status;
|
return Friends.list[friendnumber].connection_status;
|
||||||
}
|
}
|
||||||
|
@ -51,10 +51,10 @@ typedef struct {
|
|||||||
uint32_t num;
|
uint32_t num;
|
||||||
int chatwin;
|
int chatwin;
|
||||||
bool active;
|
bool active;
|
||||||
TOX_CONNECTION connection_status;
|
Tox_Connection connection_status;
|
||||||
bool is_typing;
|
bool is_typing;
|
||||||
bool logging_on; /* saves preference for friend irrespective of global settings */
|
bool logging_on; /* saves preference for friend irrespective of global settings */
|
||||||
TOX_USER_STATUS status;
|
Tox_User_Status status;
|
||||||
|
|
||||||
struct LastOnline last_online;
|
struct LastOnline last_online;
|
||||||
struct GroupChatInvite group_invite;
|
struct GroupChatInvite group_invite;
|
||||||
@ -87,8 +87,8 @@ int get_friendnum(uint8_t *name);
|
|||||||
int load_blocklist(char *data);
|
int load_blocklist(char *data);
|
||||||
void kill_friendlist(void);
|
void kill_friendlist(void);
|
||||||
void friendlist_onFriendAdded(ToxWindow *self, Tox *m, uint32_t num, bool sort);
|
void friendlist_onFriendAdded(ToxWindow *self, Tox *m, uint32_t num, bool sort);
|
||||||
TOX_USER_STATUS get_friend_status(uint32_t friendnumber);
|
Tox_User_Status get_friend_status(uint32_t friendnumber);
|
||||||
TOX_CONNECTION get_friend_connection_status(uint32_t friendnumber);
|
Tox_Connection get_friend_connection_status(uint32_t friendnumber);
|
||||||
|
|
||||||
/* sorts friendlist_index first by connection status then alphabetically */
|
/* sorts friendlist_index first by connection status then alphabetically */
|
||||||
void sort_friendlist_index(void);
|
void sort_friendlist_index(void);
|
||||||
|
@ -62,7 +62,7 @@ void cmd_accept(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_ERR_FRIEND_ADD err;
|
Tox_Err_Friend_Add err;
|
||||||
uint32_t friendnum = tox_friend_add_norequest(m, FrndRequests.request[req].key, &err);
|
uint32_t friendnum = tox_friend_add_norequest(m, FrndRequests.request[req].key, &err);
|
||||||
|
|
||||||
if (err != TOX_ERR_FRIEND_ADD_OK) {
|
if (err != TOX_ERR_FRIEND_ADD_OK) {
|
||||||
@ -92,7 +92,7 @@ void cmd_add_helper(ToxWindow *self, Tox *m, const char *id_bin, const char *msg
|
|||||||
{
|
{
|
||||||
const char *errmsg;
|
const char *errmsg;
|
||||||
|
|
||||||
TOX_ERR_FRIEND_ADD err;
|
Tox_Err_Friend_Add err;
|
||||||
uint32_t f_num = tox_friend_add(m, (const uint8_t *) id_bin, (const uint8_t *) msg, strlen(msg), &err);
|
uint32_t f_num = tox_friend_add(m, (const uint8_t *) id_bin, (const uint8_t *) msg, strlen(msg), &err);
|
||||||
|
|
||||||
switch (err) {
|
switch (err) {
|
||||||
@ -267,7 +267,7 @@ void cmd_connect(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_ERR_BOOTSTRAP err;
|
Tox_Err_Bootstrap err;
|
||||||
tox_bootstrap(m, ip, port, (uint8_t *) key_binary, &err);
|
tox_bootstrap(m, ip, port, (uint8_t *) key_binary, &err);
|
||||||
tox_add_tcp_relay(m, ip, port, (uint8_t *) key_binary, &err);
|
tox_add_tcp_relay(m, ip, port, (uint8_t *) key_binary, &err);
|
||||||
|
|
||||||
@ -350,7 +350,7 @@ void cmd_groupchat(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_ERR_CONFERENCE_NEW err;
|
Tox_Err_Conference_New err;
|
||||||
|
|
||||||
uint32_t groupnum = tox_conference_new(m, &err);
|
uint32_t groupnum = tox_conference_new(m, &err);
|
||||||
|
|
||||||
@ -632,7 +632,7 @@ void cmd_status(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char *status_str = argv[1];
|
const char *status_str = argv[1];
|
||||||
TOX_USER_STATUS status;
|
Tox_User_Status status;
|
||||||
|
|
||||||
if (!strcasecmp(status_str, "online")) {
|
if (!strcasecmp(status_str, "online")) {
|
||||||
status = TOX_USER_STATUS_NONE;
|
status = TOX_USER_STATUS_NONE;
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
void cmd_set_title(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
void cmd_set_title(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||||
{
|
{
|
||||||
TOX_ERR_CONFERENCE_TITLE err;
|
Tox_Err_Conference_Title err;
|
||||||
char title[MAX_STR_SIZE];
|
char title[MAX_STR_SIZE];
|
||||||
|
|
||||||
if (argc < 1) {
|
if (argc < 1) {
|
||||||
|
@ -223,7 +223,7 @@ void redraw_groupchat_win(ToxWindow *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, uint32_t groupnum, uint32_t peernum,
|
static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, uint32_t groupnum, uint32_t peernum,
|
||||||
TOX_MESSAGE_TYPE type, const char *msg, size_t len)
|
Tox_Message_Type type, const char *msg, size_t len)
|
||||||
{
|
{
|
||||||
if (self->num != groupnum) {
|
if (self->num != groupnum) {
|
||||||
return;
|
return;
|
||||||
@ -366,7 +366,7 @@ static void update_peer_list(Tox *m, uint32_t groupnum, uint32_t num_peers)
|
|||||||
for (i = 0; i < num_peers; ++i) {
|
for (i = 0; i < num_peers; ++i) {
|
||||||
GroupPeer *peer = &chat->peer_list[i];
|
GroupPeer *peer = &chat->peer_list[i];
|
||||||
|
|
||||||
TOX_ERR_CONFERENCE_PEER_QUERY err;
|
Tox_Err_Conference_Peer_Query err;
|
||||||
size_t length = tox_conference_peer_get_name_size(m, groupnum, i, &err);
|
size_t length = tox_conference_peer_get_name_size(m, groupnum, i, &err);
|
||||||
|
|
||||||
if (err != TOX_ERR_CONFERENCE_PEER_QUERY_OK || length >= TOX_MAX_NAME_LENGTH) {
|
if (err != TOX_ERR_CONFERENCE_PEER_QUERY_OK || length >= TOX_MAX_NAME_LENGTH) {
|
||||||
@ -399,7 +399,7 @@ static void groupchat_onGroupNameListChange(ToxWindow *self, Tox *m, uint32_t gr
|
|||||||
}
|
}
|
||||||
|
|
||||||
GroupChat *chat = &groupchats[groupnum];
|
GroupChat *chat = &groupchats[groupnum];
|
||||||
TOX_ERR_CONFERENCE_PEER_QUERY err;
|
Tox_Err_Conference_Peer_Query err;
|
||||||
|
|
||||||
uint32_t num_peers = tox_conference_peer_count(m, groupnum, &err);
|
uint32_t num_peers = tox_conference_peer_count(m, groupnum, &err);
|
||||||
uint32_t old_num = chat->num_peers;
|
uint32_t old_num = chat->num_peers;
|
||||||
@ -458,7 +458,7 @@ static void send_group_action(ToxWindow *self, ChatContext *ctx, Tox *m, char *a
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_ERR_CONFERENCE_SEND_MESSAGE err;
|
Tox_Err_Conference_Send_Message err;
|
||||||
|
|
||||||
if (!tox_conference_send_message(m, self->num, TOX_MESSAGE_TYPE_ACTION, (uint8_t *) action, strlen(action), &err)) {
|
if (!tox_conference_send_message(m, self->num, TOX_MESSAGE_TYPE_ACTION, (uint8_t *) action, strlen(action), &err)) {
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, RED, " * Failed to send action (error %d)", err);
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, RED, " * Failed to send action (error %d)", err);
|
||||||
@ -567,7 +567,7 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
|||||||
execute(ctx->history, self, m, line, GROUPCHAT_COMMAND_MODE);
|
execute(ctx->history, self, m, line, GROUPCHAT_COMMAND_MODE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TOX_ERR_CONFERENCE_SEND_MESSAGE err;
|
Tox_Err_Conference_Send_Message err;
|
||||||
|
|
||||||
if (!tox_conference_send_message(m, self->num, TOX_MESSAGE_TYPE_NORMAL, (uint8_t *) line, strlen(line), &err)) {
|
if (!tox_conference_send_message(m, self->num, TOX_MESSAGE_TYPE_NORMAL, (uint8_t *) line, strlen(line), &err)) {
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, RED, " * Failed to send message (error %d)", err);
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, RED, " * Failed to send message (error %d)", err);
|
||||||
|
@ -151,7 +151,7 @@ void cqueue_try_send(ToxWindow *self, Tox *m)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_MESSAGE_TYPE type = msg->type == OUT_MSG ? TOX_MESSAGE_TYPE_NORMAL : TOX_MESSAGE_TYPE_ACTION;
|
Tox_Message_Type type = msg->type == OUT_MSG ? TOX_MESSAGE_TYPE_NORMAL : TOX_MESSAGE_TYPE_ACTION;
|
||||||
msg->receipt = tox_friend_send_message(m, self->num, type, (uint8_t *) msg->message, msg->len, NULL);
|
msg->receipt = tox_friend_send_message(m, self->num, type, (uint8_t *) msg->message, msg->len, NULL);
|
||||||
msg->last_send_try = get_unix_time();
|
msg->last_send_try = get_unix_time();
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ void str_to_lower(char *str)
|
|||||||
Returns nick len */
|
Returns nick len */
|
||||||
size_t get_nick_truncate(Tox *m, char *buf, uint32_t friendnum)
|
size_t get_nick_truncate(Tox *m, char *buf, uint32_t friendnum)
|
||||||
{
|
{
|
||||||
TOX_ERR_FRIEND_QUERY err;
|
Tox_Err_Friend_Query err;
|
||||||
size_t len = tox_friend_get_name_size(m, friendnum, &err);
|
size_t len = tox_friend_get_name_size(m, friendnum, &err);
|
||||||
|
|
||||||
if (err != TOX_ERR_FRIEND_QUERY_OK) {
|
if (err != TOX_ERR_FRIEND_QUERY_OK) {
|
||||||
@ -373,7 +373,7 @@ on_error:
|
|||||||
/* same as get_nick_truncate but for groupchats */
|
/* same as get_nick_truncate but for groupchats */
|
||||||
int get_group_nick_truncate(Tox *m, char *buf, uint32_t peernum, uint32_t groupnum)
|
int get_group_nick_truncate(Tox *m, char *buf, uint32_t peernum, uint32_t groupnum)
|
||||||
{
|
{
|
||||||
TOX_ERR_CONFERENCE_PEER_QUERY err;
|
Tox_Err_Conference_Peer_Query err;
|
||||||
size_t len = tox_conference_peer_get_name_size(m, groupnum, peernum, &err);
|
size_t len = tox_conference_peer_get_name_size(m, groupnum, peernum, &err);
|
||||||
|
|
||||||
if (err != TOX_ERR_CONFERENCE_PEER_QUERY_OK) {
|
if (err != TOX_ERR_CONFERENCE_PEER_QUERY_OK) {
|
||||||
|
@ -144,8 +144,9 @@ void bgrxtoyuv420(uint8_t *plane_y, uint8_t *plane_u, uint8_t *plane_v, uint8_t
|
|||||||
device_names[i] = video_input_name;
|
device_names[i] = video_input_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( i <= 0 )
|
if (i <= 0) {
|
||||||
return nil;
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
*size = i;
|
*size = i;
|
||||||
|
|
||||||
@ -174,7 +175,7 @@ void bgrxtoyuv420(uint8_t *plane_y, uint8_t *plane_u, uint8_t *plane_v, uint8_t
|
|||||||
NSError *error = NULL;
|
NSError *error = NULL;
|
||||||
AVCaptureInput *input = [[AVCaptureDeviceInput alloc] initWithDevice: device error: &error];
|
AVCaptureInput *input = [[AVCaptureDeviceInput alloc] initWithDevice: device error: &error];
|
||||||
|
|
||||||
if ( error != NULL ) {
|
if (error != NULL) {
|
||||||
[input release];
|
[input release];
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -193,7 +194,7 @@ void bgrxtoyuv420(uint8_t *plane_y, uint8_t *plane_u, uint8_t *plane_v, uint8_t
|
|||||||
AVCaptureInputPort *port = [input.ports objectAtIndex: 0];
|
AVCaptureInputPort *port = [input.ports objectAtIndex: 0];
|
||||||
CMFormatDescriptionRef format_description = port.formatDescription;
|
CMFormatDescriptionRef format_description = port.formatDescription;
|
||||||
|
|
||||||
if ( format_description ) {
|
if (format_description) {
|
||||||
CMVideoDimensions dimensions = CMVideoFormatDescriptionGetDimensions(format_description);
|
CMVideoDimensions dimensions = CMVideoFormatDescriptionGetDimensions(format_description);
|
||||||
*width = dimensions.width;
|
*width = dimensions.width;
|
||||||
*height = dimensions.height;
|
*height = dimensions.height;
|
||||||
@ -303,8 +304,9 @@ int osx_video_init(char **device_names, int *size)
|
|||||||
{
|
{
|
||||||
_OSXVideo = [[OSXVideo alloc] initWithDeviceNames: device_names AmtDevices: size];
|
_OSXVideo = [[OSXVideo alloc] initWithDeviceNames: device_names AmtDevices: size];
|
||||||
|
|
||||||
if ( _OSXVideo == nil )
|
if (_OSXVideo == nil) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -317,8 +319,9 @@ void osx_video_release()
|
|||||||
|
|
||||||
int osx_video_open_device(uint32_t selection, uint16_t *width, uint16_t *height)
|
int osx_video_open_device(uint32_t selection, uint16_t *width, uint16_t *height)
|
||||||
{
|
{
|
||||||
if ( _OSXVideo == nil )
|
if (_OSXVideo == nil) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return [_OSXVideo openVideoDeviceIndex: selection Width: width Height: height];
|
return [_OSXVideo openVideoDeviceIndex: selection Width: width Height: height];
|
||||||
}
|
}
|
||||||
@ -330,8 +333,9 @@ void osx_video_close_device(uint32_t device_idx)
|
|||||||
|
|
||||||
int osx_video_read_device(uint8_t *y, uint8_t *u, uint8_t *v, uint16_t *width, uint16_t *height)
|
int osx_video_read_device(uint8_t *y, uint8_t *u, uint8_t *v, uint16_t *width, uint16_t *height)
|
||||||
{
|
{
|
||||||
if ( _OSXVideo == nil )
|
if (_OSXVideo == nil) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return [_OSXVideo getVideoFrameY: y U: u V: v Width: width Height: height];
|
return [_OSXVideo getVideoFrameY: y U: u V: v Width: width Height: height];
|
||||||
}
|
}
|
||||||
|
16
src/prompt.c
16
src/prompt.c
@ -137,7 +137,7 @@ void kill_prompt_window(ToxWindow *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* callback: Updates own connection status in prompt statusbar */
|
/* callback: Updates own connection status in prompt statusbar */
|
||||||
void on_self_connection_status(Tox *m, TOX_CONNECTION connection_status, void *userdata)
|
void on_self_connection_status(Tox *m, Tox_Connection connection_status, void *userdata)
|
||||||
{
|
{
|
||||||
StatusBar *statusbar = prompt->stb;
|
StatusBar *statusbar = prompt->stb;
|
||||||
statusbar->connection = connection_status;
|
statusbar->connection = connection_status;
|
||||||
@ -159,7 +159,7 @@ void prompt_update_statusmessage(ToxWindow *prompt, Tox *m, const char *statusms
|
|||||||
size_t len = strlen(statusbar->statusmsg);
|
size_t len = strlen(statusbar->statusmsg);
|
||||||
statusbar->statusmsg_len = len;
|
statusbar->statusmsg_len = len;
|
||||||
|
|
||||||
TOX_ERR_SET_INFO err;
|
Tox_Err_Set_Info err;
|
||||||
tox_self_set_status_message(m, (const uint8_t *) statusmsg, len, &err);
|
tox_self_set_status_message(m, (const uint8_t *) statusmsg, len, &err);
|
||||||
|
|
||||||
if (err != TOX_ERR_SET_INFO_OK) {
|
if (err != TOX_ERR_SET_INFO_OK) {
|
||||||
@ -168,14 +168,14 @@ void prompt_update_statusmessage(ToxWindow *prompt, Tox *m, const char *statusms
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Updates own status in prompt statusbar */
|
/* Updates own status in prompt statusbar */
|
||||||
void prompt_update_status(ToxWindow *prompt, TOX_USER_STATUS status)
|
void prompt_update_status(ToxWindow *prompt, Tox_User_Status status)
|
||||||
{
|
{
|
||||||
StatusBar *statusbar = prompt->stb;
|
StatusBar *statusbar = prompt->stb;
|
||||||
statusbar->status = status;
|
statusbar->status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns our own connection status */
|
/* Returns our own connection status */
|
||||||
TOX_CONNECTION prompt_selfConnectionStatus(void)
|
Tox_Connection prompt_selfConnectionStatus(void)
|
||||||
{
|
{
|
||||||
StatusBar *statusbar = prompt->stb;
|
StatusBar *statusbar = prompt->stb;
|
||||||
return statusbar->connection;
|
return statusbar->connection;
|
||||||
@ -332,7 +332,7 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
|
|||||||
wmove(statusbar->topline, 0, 0);
|
wmove(statusbar->topline, 0, 0);
|
||||||
|
|
||||||
pthread_mutex_lock(&Winthread.lock);
|
pthread_mutex_lock(&Winthread.lock);
|
||||||
TOX_CONNECTION connection = statusbar->connection;
|
Tox_Connection connection = statusbar->connection;
|
||||||
pthread_mutex_unlock(&Winthread.lock);
|
pthread_mutex_unlock(&Winthread.lock);
|
||||||
|
|
||||||
if (connection != TOX_CONNECTION_NONE) {
|
if (connection != TOX_CONNECTION_NONE) {
|
||||||
@ -340,7 +340,7 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
|
|||||||
const char *status_text = "ERROR";
|
const char *status_text = "ERROR";
|
||||||
|
|
||||||
pthread_mutex_lock(&Winthread.lock);
|
pthread_mutex_lock(&Winthread.lock);
|
||||||
TOX_USER_STATUS status = statusbar->status;
|
Tox_User_Status status = statusbar->status;
|
||||||
pthread_mutex_unlock(&Winthread.lock);
|
pthread_mutex_unlock(&Winthread.lock);
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@ -426,7 +426,7 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void prompt_onConnectionChange(ToxWindow *self, Tox *m, uint32_t friendnum, TOX_CONNECTION connection_status)
|
static void prompt_onConnectionChange(ToxWindow *self, Tox *m, uint32_t friendnum, Tox_Connection connection_status)
|
||||||
{
|
{
|
||||||
ChatContext *ctx = self->chatwin;
|
ChatContext *ctx = self->chatwin;
|
||||||
|
|
||||||
@ -519,7 +519,7 @@ void prompt_init_statusbar(ToxWindow *self, Tox *m, bool first_time_run)
|
|||||||
size_t s_len = tox_self_get_status_message_size(m);
|
size_t s_len = tox_self_get_status_message_size(m);
|
||||||
tox_self_get_status_message(m, (uint8_t *) statusmsg);
|
tox_self_get_status_message(m, (uint8_t *) statusmsg);
|
||||||
|
|
||||||
TOX_USER_STATUS status = tox_self_get_status(m);
|
Tox_User_Status status = tox_self_get_status(m);
|
||||||
|
|
||||||
nick[n_len] = '\0';
|
nick[n_len] = '\0';
|
||||||
statusmsg[s_len] = '\0';
|
statusmsg[s_len] = '\0';
|
||||||
|
@ -48,14 +48,14 @@ void prep_prompt_win(void);
|
|||||||
void prompt_init_statusbar(ToxWindow *self, Tox *m, bool first_time_run);
|
void prompt_init_statusbar(ToxWindow *self, Tox *m, bool first_time_run);
|
||||||
void prompt_update_nick(ToxWindow *prompt, const char *nick);
|
void prompt_update_nick(ToxWindow *prompt, const char *nick);
|
||||||
void prompt_update_statusmessage(ToxWindow *prompt, Tox *m, const char *statusmsg);
|
void prompt_update_statusmessage(ToxWindow *prompt, Tox *m, const char *statusmsg);
|
||||||
void prompt_update_status(ToxWindow *prompt, TOX_USER_STATUS status);
|
void prompt_update_status(ToxWindow *prompt, Tox_User_Status status);
|
||||||
void prompt_update_connectionstatus(ToxWindow *prompt, bool is_connected);
|
void prompt_update_connectionstatus(ToxWindow *prompt, bool is_connected);
|
||||||
void kill_prompt_window(ToxWindow *self);
|
void kill_prompt_window(ToxWindow *self);
|
||||||
|
|
||||||
/* callback: Updates own connection status in prompt statusbar */
|
/* callback: Updates own connection status in prompt statusbar */
|
||||||
void on_self_connection_status(Tox *m, TOX_CONNECTION connection_status, void *userdata);
|
void on_self_connection_status(Tox *m, Tox_Connection connection_status, void *userdata);
|
||||||
|
|
||||||
/* Returns our own connection status */
|
/* Returns our own connection status */
|
||||||
TOX_CONNECTION prompt_selfConnectionStatus(void);
|
Tox_Connection prompt_selfConnectionStatus(void);
|
||||||
|
|
||||||
#endif /* end of include guard: PROMPT_H */
|
#endif /* end of include guard: PROMPT_H */
|
||||||
|
@ -69,7 +69,7 @@ static char buffer [BUFFER_SIZE];
|
|||||||
static bool auto_away_active = false;
|
static bool auto_away_active = false;
|
||||||
|
|
||||||
static mplex_status mplex = MPLEX_NONE;
|
static mplex_status mplex = MPLEX_NONE;
|
||||||
static TOX_USER_STATUS prev_status = TOX_USER_STATUS_NONE;
|
static Tox_User_Status prev_status = TOX_USER_STATUS_NONE;
|
||||||
static char prev_note [TOX_MAX_STATUS_MESSAGE_LENGTH] = "";
|
static char prev_note [TOX_MAX_STATUS_MESSAGE_LENGTH] = "";
|
||||||
|
|
||||||
/* mutex for access to status data, for sync between:
|
/* mutex for access to status data, for sync between:
|
||||||
@ -359,7 +359,7 @@ static int mplex_is_detached(void)
|
|||||||
|
|
||||||
static void mplex_timer_handler(Tox *m)
|
static void mplex_timer_handler(Tox *m)
|
||||||
{
|
{
|
||||||
TOX_USER_STATUS current_status, new_status;
|
Tox_User_Status current_status, new_status;
|
||||||
const char *new_note;
|
const char *new_note;
|
||||||
|
|
||||||
if (mplex == MPLEX_NONE) {
|
if (mplex == MPLEX_NONE) {
|
||||||
|
10
src/toxic.c
10
src/toxic.c
@ -337,8 +337,8 @@ static void load_groups(ToxWindow *prompt, Tox *m)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_ERR_CONFERENCE_GET_TYPE err;
|
Tox_Err_Conference_Get_Type err;
|
||||||
TOX_CONFERENCE_TYPE type = tox_conference_get_type(m, groupnum, &err);
|
Tox_Conference_Type type = tox_conference_get_type(m, groupnum, &err);
|
||||||
|
|
||||||
if (err != TOX_ERR_CONFERENCE_GET_TYPE_OK) {
|
if (err != TOX_ERR_CONFERENCE_GET_TYPE_OK) {
|
||||||
tox_conference_delete(m, groupnum, NULL);
|
tox_conference_delete(m, groupnum, NULL);
|
||||||
@ -646,7 +646,7 @@ static void init_tox_options(struct Tox_Options *tox_opts)
|
|||||||
/* Returns a new Tox object on success.
|
/* Returns a new Tox object on success.
|
||||||
* If object fails to initialize the toxic process will terminate.
|
* If object fails to initialize the toxic process will terminate.
|
||||||
*/
|
*/
|
||||||
static Tox *load_tox(char *data_path, struct Tox_Options *tox_opts, TOX_ERR_NEW *new_err)
|
static Tox *load_tox(char *data_path, struct Tox_Options *tox_opts, Tox_Err_New *new_err)
|
||||||
{
|
{
|
||||||
Tox *m = NULL;
|
Tox *m = NULL;
|
||||||
|
|
||||||
@ -783,7 +783,7 @@ static Tox *load_tox(char *data_path, struct Tox_Options *tox_opts, TOX_ERR_NEW
|
|||||||
|
|
||||||
static Tox *load_toxic(char *data_path)
|
static Tox *load_toxic(char *data_path)
|
||||||
{
|
{
|
||||||
TOX_ERR_OPTIONS_NEW options_new_err;
|
Tox_Err_Options_New options_new_err;
|
||||||
struct Tox_Options *tox_opts = tox_options_new(&options_new_err);
|
struct Tox_Options *tox_opts = tox_options_new(&options_new_err);
|
||||||
|
|
||||||
if (!tox_opts) {
|
if (!tox_opts) {
|
||||||
@ -792,7 +792,7 @@ static Tox *load_toxic(char *data_path)
|
|||||||
|
|
||||||
init_tox_options(tox_opts);
|
init_tox_options(tox_opts);
|
||||||
|
|
||||||
TOX_ERR_NEW new_err;
|
Tox_Err_New new_err;
|
||||||
Tox *m = load_tox(data_path, tox_opts, &new_err);
|
Tox *m = load_tox(data_path, tox_opts, &new_err);
|
||||||
|
|
||||||
if (new_err == TOX_ERR_NEW_PORT_ALLOC && tox_options_get_ipv6_enabled(tox_opts)) {
|
if (new_err == TOX_ERR_NEW_PORT_ALLOC && tox_options_get_ipv6_enabled(tox_opts)) {
|
||||||
|
12
src/toxic.h
12
src/toxic.h
@ -106,16 +106,16 @@ int store_data(Tox *m, const char *path);
|
|||||||
|
|
||||||
/* callbacks */
|
/* callbacks */
|
||||||
void on_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, size_t length, void *userdata);
|
void on_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, size_t length, void *userdata);
|
||||||
void on_friend_connection_status(Tox *m, uint32_t friendnumber, TOX_CONNECTION status, void *userdata);
|
void on_friend_connection_status(Tox *m, uint32_t friendnumber, Tox_Connection status, void *userdata);
|
||||||
void on_friend_message(Tox *m, uint32_t friendnumber, TOX_MESSAGE_TYPE type, const uint8_t *string, size_t length,
|
void on_friend_message(Tox *m, uint32_t friendnumber, Tox_Message_Type type, const uint8_t *string, size_t length,
|
||||||
void *userdata);
|
void *userdata);
|
||||||
void on_friend_name(Tox *m, uint32_t friendnumber, const uint8_t *string, size_t length, void *userdata);
|
void on_friend_name(Tox *m, uint32_t friendnumber, const uint8_t *string, size_t length, void *userdata);
|
||||||
void on_friend_status(Tox *m, uint32_t friendnumber, TOX_USER_STATUS status, void *userdata);
|
void on_friend_status(Tox *m, uint32_t friendnumber, Tox_User_Status status, void *userdata);
|
||||||
void on_friend_status_message(Tox *m, uint32_t friendnumber, const uint8_t *string, size_t length, void *userdata);
|
void on_friend_status_message(Tox *m, uint32_t friendnumber, const uint8_t *string, size_t length, void *userdata);
|
||||||
void on_friend_added(Tox *m, uint32_t friendnumber, bool sort);
|
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,
|
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);
|
const uint8_t *message, size_t length, void *userdata);
|
||||||
void on_conference_invite(Tox *m, uint32_t friendnumber, TOX_CONFERENCE_TYPE type, const uint8_t *group_pub_key,
|
void on_conference_invite(Tox *m, uint32_t friendnumber, Tox_Conference_Type type, const uint8_t *group_pub_key,
|
||||||
size_t length, void *userdata);
|
size_t length, void *userdata);
|
||||||
void on_conference_peer_list_changed(Tox *m, uint32_t groupnumber, void *userdata);
|
void on_conference_peer_list_changed(Tox *m, uint32_t groupnumber, void *userdata);
|
||||||
void on_conference_peer_name(Tox *m, uint32_t groupnumber, uint32_t peernumber, const uint8_t *name,
|
void on_conference_peer_name(Tox *m, uint32_t groupnumber, uint32_t peernumber, const uint8_t *name,
|
||||||
@ -126,7 +126,7 @@ void on_file_chunk_request(Tox *m, uint32_t friendnumber, uint32_t filenumber, u
|
|||||||
void *userdata);
|
void *userdata);
|
||||||
void on_file_recv_chunk(Tox *m, uint32_t friendnumber, uint32_t filenumber, uint64_t position, const uint8_t *data,
|
void on_file_recv_chunk(Tox *m, uint32_t friendnumber, uint32_t filenumber, uint64_t position, const uint8_t *data,
|
||||||
size_t length, void *userdata);
|
size_t length, void *userdata);
|
||||||
void on_file_recv_control(Tox *m, uint32_t friendnumber, uint32_t filenumber, TOX_FILE_CONTROL control,
|
void on_file_recv_control(Tox *m, uint32_t friendnumber, uint32_t filenumber, Tox_File_Control control,
|
||||||
void *userdata);
|
void *userdata);
|
||||||
void on_file_recv(Tox *m, uint32_t friendnumber, uint32_t filenumber, uint32_t kind, uint64_t file_size,
|
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);
|
const uint8_t *filename, size_t filename_length, void *userdata);
|
||||||
|
@ -102,7 +102,7 @@ void read_video_device_callback(int16_t width, int16_t height, const uint8_t *y,
|
|||||||
{
|
{
|
||||||
uint32_t friend_number = *((uint32_t *)data); /* TODO: Or pass an array of call_idx's */
|
uint32_t friend_number = *((uint32_t *)data); /* TODO: Or pass an array of call_idx's */
|
||||||
Call *this_call = &CallControl.calls[friend_number];
|
Call *this_call = &CallControl.calls[friend_number];
|
||||||
TOXAV_ERR_SEND_FRAME error;
|
Toxav_Err_Send_Frame error;
|
||||||
|
|
||||||
/* Drop frame if video sending is disabled */
|
/* Drop frame if video sending is disabled */
|
||||||
if (CallControl.video_bit_rate == 0 || this_call->vin_idx == -1) {
|
if (CallControl.video_bit_rate == 0 || this_call->vin_idx == -1) {
|
||||||
@ -216,7 +216,7 @@ void callback_video_starting(uint32_t friend_number)
|
|||||||
ToxWindow *windows = CallControl.prompt;
|
ToxWindow *windows = CallControl.prompt;
|
||||||
Call *this_call = &CallControl.calls[friend_number];
|
Call *this_call = &CallControl.calls[friend_number];
|
||||||
|
|
||||||
TOXAV_ERR_CALL_CONTROL error = TOXAV_ERR_CALL_CONTROL_OK;
|
Toxav_Err_Call_Control error = TOXAV_ERR_CALL_CONTROL_OK;
|
||||||
toxav_call_control(CallControl.av, friend_number, TOXAV_CALL_CONTROL_SHOW_VIDEO, &error);
|
toxav_call_control(CallControl.av, friend_number, TOXAV_CALL_CONTROL_SHOW_VIDEO, &error);
|
||||||
|
|
||||||
if (error == TOXAV_ERR_CALL_CONTROL_OK) {
|
if (error == TOXAV_ERR_CALL_CONTROL_OK) {
|
||||||
|
@ -62,7 +62,7 @@ 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)
|
void on_friend_connection_status(Tox *m, uint32_t friendnumber, Tox_Connection connection_status, void *userdata)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ 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 on_friend_message(Tox *m, uint32_t friendnumber, Tox_Message_Type type, const uint8_t *string, size_t length,
|
||||||
void *userdata)
|
void *userdata)
|
||||||
{
|
{
|
||||||
char msg[MAX_STR_SIZE + 1];
|
char msg[MAX_STR_SIZE + 1];
|
||||||
@ -135,7 +135,7 @@ 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)
|
void on_friend_status(Tox *m, uint32_t friendnumber, Tox_User_Status status, void *userdata)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ void on_friend_added(Tox *m, uint32_t friendnumber, bool sort)
|
|||||||
store_data(m, DATA_FILE);
|
store_data(m, DATA_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_conference_message(Tox *m, uint32_t groupnumber, uint32_t peernumber, TOX_MESSAGE_TYPE type,
|
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)
|
const uint8_t *message, size_t length, void *userdata)
|
||||||
{
|
{
|
||||||
char msg[MAX_STR_SIZE + 1];
|
char msg[MAX_STR_SIZE + 1];
|
||||||
@ -174,7 +174,7 @@ 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,
|
void on_conference_invite(Tox *m, uint32_t friendnumber, Tox_Conference_Type type, const uint8_t *group_pub_key,
|
||||||
size_t length, void *userdata)
|
size_t length, void *userdata)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -269,7 +269,7 @@ 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 on_file_recv_control(Tox *m, uint32_t friendnumber, uint32_t filenumber, Tox_File_Control control,
|
||||||
void *userdata)
|
void *userdata)
|
||||||
{
|
{
|
||||||
struct FileTransfer *ft = get_file_transfer_struct(friendnumber, filenumber);
|
struct FileTransfer *ft = get_file_transfer_struct(friendnumber, filenumber);
|
||||||
|
@ -116,19 +116,19 @@ struct ToxWindow {
|
|||||||
/* toxcore */
|
/* toxcore */
|
||||||
void(*onFriendRequest)(ToxWindow *, Tox *, const char *, const char *, size_t);
|
void(*onFriendRequest)(ToxWindow *, Tox *, const char *, const char *, size_t);
|
||||||
void(*onFriendAdded)(ToxWindow *, Tox *, uint32_t, bool);
|
void(*onFriendAdded)(ToxWindow *, Tox *, uint32_t, bool);
|
||||||
void(*onConnectionChange)(ToxWindow *, Tox *, uint32_t, TOX_CONNECTION);
|
void(*onConnectionChange)(ToxWindow *, Tox *, uint32_t, Tox_Connection);
|
||||||
void(*onMessage)(ToxWindow *, Tox *, uint32_t, TOX_MESSAGE_TYPE, const char *, size_t);
|
void(*onMessage)(ToxWindow *, Tox *, uint32_t, Tox_Message_Type, const char *, size_t);
|
||||||
void(*onNickChange)(ToxWindow *, Tox *, uint32_t, const char *, size_t);
|
void(*onNickChange)(ToxWindow *, Tox *, uint32_t, const char *, size_t);
|
||||||
void(*onStatusChange)(ToxWindow *, Tox *, uint32_t, TOX_USER_STATUS);
|
void(*onStatusChange)(ToxWindow *, Tox *, uint32_t, Tox_User_Status);
|
||||||
void(*onStatusMessageChange)(ToxWindow *, uint32_t, const char *, size_t);
|
void(*onStatusMessageChange)(ToxWindow *, uint32_t, const char *, size_t);
|
||||||
void(*onGroupMessage)(ToxWindow *, Tox *, uint32_t, uint32_t, TOX_MESSAGE_TYPE, const char *, size_t);
|
void(*onGroupMessage)(ToxWindow *, Tox *, uint32_t, uint32_t, Tox_Message_Type, const char *, size_t);
|
||||||
void(*onGroupInvite)(ToxWindow *, Tox *, int32_t, uint8_t, const char *, uint16_t);
|
void(*onGroupInvite)(ToxWindow *, Tox *, int32_t, uint8_t, const char *, uint16_t);
|
||||||
void(*onGroupNameListChange)(ToxWindow *, Tox *, uint32_t);
|
void(*onGroupNameListChange)(ToxWindow *, Tox *, uint32_t);
|
||||||
void(*onGroupPeerNameChange)(ToxWindow *, Tox *, uint32_t, uint32_t, const char *, size_t);
|
void(*onGroupPeerNameChange)(ToxWindow *, Tox *, uint32_t, uint32_t, const char *, size_t);
|
||||||
void(*onGroupTitleChange)(ToxWindow *, Tox *, uint32_t, uint32_t, const char *, size_t);
|
void(*onGroupTitleChange)(ToxWindow *, Tox *, uint32_t, uint32_t, const char *, size_t);
|
||||||
void(*onFileChunkRequest)(ToxWindow *, Tox *, uint32_t, uint32_t, uint64_t, size_t);
|
void(*onFileChunkRequest)(ToxWindow *, Tox *, uint32_t, uint32_t, uint64_t, size_t);
|
||||||
void(*onFileRecvChunk)(ToxWindow *, Tox *, uint32_t, uint32_t, uint64_t, const char *, size_t);
|
void(*onFileRecvChunk)(ToxWindow *, Tox *, uint32_t, uint32_t, uint64_t, const char *, size_t);
|
||||||
void(*onFileControl)(ToxWindow *, Tox *, uint32_t, uint32_t, TOX_FILE_CONTROL);
|
void(*onFileControl)(ToxWindow *, Tox *, uint32_t, uint32_t, Tox_File_Control);
|
||||||
void(*onFileRecv)(ToxWindow *, Tox *, uint32_t, uint32_t, uint64_t, const char *, size_t);
|
void(*onFileRecv)(ToxWindow *, Tox *, uint32_t, uint32_t, uint64_t, const char *, size_t);
|
||||||
void(*onTypingChange)(ToxWindow *, Tox *, uint32_t, bool);
|
void(*onTypingChange)(ToxWindow *, Tox *, uint32_t, bool);
|
||||||
void(*onReadReceipt)(ToxWindow *, Tox *, uint32_t, uint32_t);
|
void(*onReadReceipt)(ToxWindow *, Tox *, uint32_t, uint32_t);
|
||||||
@ -187,8 +187,8 @@ struct StatusBar {
|
|||||||
size_t statusmsg_len;
|
size_t statusmsg_len;
|
||||||
char nick[TOXIC_MAX_NAME_LENGTH + 1];
|
char nick[TOXIC_MAX_NAME_LENGTH + 1];
|
||||||
size_t nick_len;
|
size_t nick_len;
|
||||||
TOX_USER_STATUS status;
|
Tox_User_Status status;
|
||||||
TOX_CONNECTION connection;
|
Tox_Connection connection;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef AUDIO
|
#ifdef AUDIO
|
||||||
|
Loading…
Reference in New Issue
Block a user