1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-12-23 12:23:26 +01:00

core API update

This commit is contained in:
Jfreegman 2014-11-11 18:30:23 -05:00
parent adb36a39bb
commit 43f45d67a4
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
6 changed files with 19 additions and 18 deletions

View File

@ -561,11 +561,21 @@ static void chat_onFileData(ToxWindow *self, Tox *m, int32_t num, uint8_t filenu
Friends.list[num].file_receiver[filenum].bytes_recv += length;
}
static void chat_onGroupInvite(ToxWindow *self, Tox *m, int32_t friendnumber, const char *group_pub_key, uint16_t length)
static void chat_onGroupInvite(ToxWindow *self, Tox *m, int32_t friendnumber, uint8_t type, const char *group_pub_key,
uint16_t length)
{
if (self->num != friendnumber)
return;
char name[TOX_MAX_NAME_LENGTH];
get_nick_truncate(m, name, friendnumber);
/* Temporary until audio groups are implemented */
if (type == TOX_GROUPCHAT_TYPE_AV) {
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Audio group invite by %s failed: Feature is not available");
return;
}
if (Friends.list[friendnumber].group_invite.key != NULL)
free(Friends.list[friendnumber].group_invite.key);
@ -579,9 +589,6 @@ static void chat_onGroupInvite(ToxWindow *self, Tox *m, int32_t friendnumber, co
Friends.list[friendnumber].group_invite.pending = true;
Friends.list[friendnumber].group_invite.length = length;
char name[TOX_MAX_NAME_LENGTH];
get_nick_truncate(m, name, friendnumber);
sound_notify(self, generic_message, NT_WNDALERT_2, NULL);
if (self->active_box != -1)

View File

@ -483,7 +483,8 @@ static void friendlist_onFileSendRequest(ToxWindow *self, Tox *m, int32_t num, u
}
}
static void friendlist_onGroupInvite(ToxWindow *self, Tox *m, int32_t num, const char *group_pub_key, uint16_t length)
static void friendlist_onGroupInvite(ToxWindow *self, Tox *m, int32_t num, uint8_t type, const char *group_pub_key,
uint16_t length)
{
if (num >= Friends.max_idx)
return;

View File

@ -314,15 +314,7 @@ static Tox *init_tox(void)
tox_callback_file_data(m, on_file_data, NULL);
tox_callback_read_receipt(m, on_read_receipt, NULL);
#ifdef __linux__
tox_set_name(m, (uint8_t *) "Cool dude", strlen("Cool dude"));
#elif defined(__FreeBSD__)
tox_set_name(m, (uint8_t *) "Nerd", strlen("Nerd"));
#elif defined(__APPLE__)
tox_set_name(m, (uint8_t *) "Hipster", strlen("Hipster")); /* This used to users of other Unixes are hipsters */
#else
tox_set_name(m, (uint8_t *) "Registered Minix user #4", strlen("Registered Minix user #4"));
#endif
tox_set_name(m, (uint8_t *) "Toxic User", strlen("Toxic User"));
return m;
}

View File

@ -105,7 +105,7 @@ void on_statusmessagechange(Tox *m, int32_t friendnumber, const uint8_t *string,
void on_friendadded(Tox *m, int32_t friendnumber, bool sort);
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, const uint8_t *action, uint16_t length, void *userdata);
void on_groupinvite(Tox *m, int32_t friendnumber, const uint8_t *group_pub_key, uint16_t length, void *userdata);
void on_groupinvite(Tox *m, int32_t friendnumber, uint8_t type, const uint8_t *group_pub_key, uint16_t length, 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, const uint8_t *pathname,
uint16_t pathname_length, void *userdata);

View File

@ -188,13 +188,14 @@ void on_groupaction(Tox *m, int groupnumber, int peernumber, const uint8_t *acti
}
}
void on_groupinvite(Tox *m, int32_t friendnumber, const uint8_t *group_pub_key, uint16_t length, void *userdata)
void on_groupinvite(Tox *m, int32_t friendnumber, uint8_t type, const uint8_t *group_pub_key, uint16_t length,
void *userdata)
{
int i;
for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
if (windows[i].onGroupInvite != NULL)
windows[i].onGroupInvite(&windows[i], m, friendnumber, (const char *) group_pub_key, length);
windows[i].onGroupInvite(&windows[i], m, friendnumber, type, (char *) group_pub_key, length);
}
}

View File

@ -115,7 +115,7 @@ struct ToxWindow {
void(*onAction)(ToxWindow *, Tox *, int32_t, const char *, uint16_t);
void(*onGroupMessage)(ToxWindow *, Tox *, int, int, const char *, uint16_t);
void(*onGroupAction)(ToxWindow *, Tox *, int, int, const char *, uint16_t);
void(*onGroupInvite)(ToxWindow *, Tox *, int32_t, const char *, uint16_t);
void(*onGroupInvite)(ToxWindow *, Tox *, int32_t, uint8_t, const char *, uint16_t);
void(*onGroupNamelistChange)(ToxWindow *, Tox *, int, int, uint8_t);
void(*onFileSendRequest)(ToxWindow *, Tox *, int32_t, uint8_t, uint64_t, const char *, uint16_t);
void(*onFileControl)(ToxWindow *, Tox *, int32_t, uint8_t, uint8_t, uint8_t, const char *, uint16_t);