From 1c0f911f4d1c8195965178b38add631f8182e20f Mon Sep 17 00:00:00 2001 From: iphydf Date: Mon, 26 Feb 2018 21:20:16 +0000 Subject: [PATCH] Remove deprecated conference namelist change callback. --- auto_tests/monolith_test.cpp | 2 +- toxcore/group.c | 24 --------------------- toxcore/group.h | 13 ------------ toxcore/tox.api.h | 32 ---------------------------- toxcore/tox.c | 7 ------ toxcore/tox.h | 41 ------------------------------------ 6 files changed, 1 insertion(+), 118 deletions(-) diff --git a/auto_tests/monolith_test.cpp b/auto_tests/monolith_test.cpp index 60bafeb5128..50c599959d5 100644 --- a/auto_tests/monolith_test.cpp +++ b/auto_tests/monolith_test.cpp @@ -227,7 +227,7 @@ int main(int argc, char *argv[]) CHECK_SIZE(Friend_Requests, 1080); // toxcore/group CHECK_SIZE(Group_c, 728); - CHECK_SIZE(Group_Chats, 2128); + CHECK_SIZE(Group_Chats, 2120); CHECK_SIZE(Group_Peer, 480); // toxcore/list CHECK_SIZE(BS_LIST, 32); diff --git a/toxcore/group.c b/toxcore/group.c index 698aad6591c..a6572107b65 100644 --- a/toxcore/group.c +++ b/toxcore/group.c @@ -455,10 +455,6 @@ static int addpeer(Group_Chats *g_c, uint32_t groupnumber, const uint8_t *real_p add_to_closest(g_c, groupnumber, real_pk, temp_pk); - if (do_gc_callback && g_c->group_namelistchange) { - g_c->group_namelistchange(g_c->m, groupnumber, g->numpeers - 1, CHAT_CHANGE_PEER_ADD, userdata); - } - if (do_gc_callback && g_c->peer_list_changed_callback) { g_c->peer_list_changed_callback(g_c->m, groupnumber, userdata); } @@ -547,10 +543,6 @@ static int delpeer(Group_Chats *g_c, uint32_t groupnumber, int peer_index, void g->group = temp; } - if (g_c->group_namelistchange) { - g_c->group_namelistchange(g_c->m, groupnumber, peer_index, CHAT_CHANGE_PEER_DEL, userdata); - } - if (g_c->peer_list_changed_callback) { g_c->peer_list_changed_callback(g_c->m, groupnumber, userdata); } @@ -597,10 +589,6 @@ static int setnick(Group_Chats *g_c, uint32_t groupnumber, int peer_index, const g->group[peer_index].nick_len = nick_len; - if (do_gc_callback && g_c->group_namelistchange) { - g_c->group_namelistchange(g_c->m, groupnumber, peer_index, CHAT_CHANGE_PEER_NAME, userdata); - } - if (do_gc_callback && g_c->peer_name_callback) { g_c->peer_name_callback(g_c->m, groupnumber, peer_index, nick, nick_len, userdata); } @@ -1176,18 +1164,6 @@ void g_callback_peer_list_changed(Group_Chats *g_c, void (*function)(Messenger * g_c->peer_list_changed_callback = function; } -// TODO(sudden6): function signatures in comments are incorrect -/* Set callback function for peer name list changes. - * - * It gets called every time the name list changes(new peer/name, deleted peer) - * Function(Group_Chats *g_c, int groupnumber, int peernumber, TOX_CHAT_CHANGE change, void *userdata) - */ -void g_callback_group_namelistchange(Group_Chats *g_c, void (*function)(Messenger *, uint32_t, uint32_t, int, - void *)) -{ - g_c->group_namelistchange = function; -} - // TODO(sudden6): function signatures are incorrect /* Set callback function for title changes. * diff --git a/toxcore/group.h b/toxcore/group.h index 9bed8477356..a81dac39db3 100644 --- a/toxcore/group.h +++ b/toxcore/group.h @@ -119,7 +119,6 @@ typedef struct { void (*message_callback)(Messenger *m, uint32_t, uint32_t, int, const uint8_t *, size_t, void *); void (*peer_name_callback)(Messenger *m, uint32_t, uint32_t, const uint8_t *, size_t, void *); void (*peer_list_changed_callback)(Messenger *m, uint32_t, void *); - void (*group_namelistchange)(Messenger *m, uint32_t, uint32_t, int, void *); void (*title_callback)(Messenger *m, uint32_t, uint32_t, const uint8_t *, size_t, void *); struct { @@ -167,18 +166,6 @@ void g_callback_peer_name(Group_Chats *g_c, void (*function)(Messenger *m, uint3 */ void g_callback_peer_list_changed(Group_Chats *g_c, void (*function)(Messenger *m, uint32_t, void *)); -/* Set callback function for peer name list changes. - * - * It gets called every time the name list changes(new peer/name, deleted peer) - * Function(Group_Chats *g_c, uint32_t groupnumber, uint32_t peernumber, TOX_CHAT_CHANGE change, void *userdata) - */ -enum { - CHAT_CHANGE_PEER_ADD, - CHAT_CHANGE_PEER_DEL, - CHAT_CHANGE_PEER_NAME, -}; -void g_callback_group_namelistchange(Group_Chats *g_c, void (*function)(Messenger *m, uint32_t, uint32_t, int, void *)); - /* Creates a new groupchat and puts it in the chats array. * * type is one of GROUPCHAT_TYPE_* diff --git a/toxcore/tox.api.h b/toxcore/tox.api.h index fc5d5593453..59af69b9c34 100644 --- a/toxcore/tox.api.h +++ b/toxcore/tox.api.h @@ -2158,38 +2158,6 @@ namespace conference { } - /** - * Peer list state change types. - */ - enum class STATE_CHANGE { - /** - * A peer has joined the conference. - */ - PEER_JOIN, - /** - * A peer has exited the conference. - */ - PEER_EXIT, - /** - * A peer has changed their name. - */ - PEER_NAME_CHANGE, - } - - /** - * This event is triggered when the peer list changes (name change, peer join, peer exit). - * - * @deprecated Use the `${event peer.name}` and `${event peer.list_changed}` events, instead. - */ - event namelist_change const { - /** - * @param conference_number The conference number of the conference the title change is intended for. - * @param peer_number The ID of the peer who changed the title. - * @param change The type of change (one of $STATE_CHANGE). - */ - typedef void(uint32_t conference_number, uint32_t peer_number, STATE_CHANGE change); - } - /** * Creates a new conference. diff --git a/toxcore/tox.c b/toxcore/tox.c index caaaedba382..3db2bd35f3b 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c @@ -1116,13 +1116,6 @@ void tox_callback_conference_peer_list_changed(Tox *tox, tox_conference_peer_lis g_callback_peer_list_changed((Group_Chats *)m->conferences_object, callback); } -void tox_callback_conference_namelist_change(Tox *tox, tox_conference_namelist_change_cb *callback) -{ - Messenger *m = tox; - g_callback_group_namelistchange((Group_Chats *)m->conferences_object, - (void (*)(struct Messenger *, uint32_t, uint32_t, int, void *))callback); -} - uint32_t tox_conference_new(Tox *tox, TOX_ERR_CONFERENCE_NEW *error) { Messenger *m = tox; diff --git a/toxcore/tox.h b/toxcore/tox.h index cf5b2c28a76..41a0994ed66 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h @@ -2443,47 +2443,6 @@ typedef void tox_conference_peer_list_changed_cb(Tox *tox, uint32_t conference_n */ void tox_callback_conference_peer_list_changed(Tox *tox, tox_conference_peer_list_changed_cb *callback); -/** - * Peer list state change types. - */ -typedef enum TOX_CONFERENCE_STATE_CHANGE { - - /** - * A peer has joined the conference. - */ - TOX_CONFERENCE_STATE_CHANGE_PEER_JOIN, - - /** - * A peer has exited the conference. - */ - TOX_CONFERENCE_STATE_CHANGE_PEER_EXIT, - - /** - * A peer has changed their name. - */ - TOX_CONFERENCE_STATE_CHANGE_PEER_NAME_CHANGE, - -} TOX_CONFERENCE_STATE_CHANGE; - - -/** - * @param conference_number The conference number of the conference the title change is intended for. - * @param peer_number The ID of the peer who changed the title. - * @param change The type of change (one of TOX_CONFERENCE_STATE_CHANGE). - */ -typedef void tox_conference_namelist_change_cb(Tox *tox, uint32_t conference_number, uint32_t peer_number, - TOX_CONFERENCE_STATE_CHANGE change, void *user_data); - - -/** - * Set the callback for the `conference_namelist_change` event. Pass NULL to unset. - * - * This event is triggered when the peer list changes (name change, peer join, peer exit). - * - * @deprecated Use the `conference_peer_name` and `conference_peer_list_changed` events, instead. - */ -void tox_callback_conference_namelist_change(Tox *tox, tox_conference_namelist_change_cb *callback); - typedef enum TOX_ERR_CONFERENCE_NEW { /**