Adopt the "change occurred" API change from isotoxin-groupchat.

The logic and behaviour remain the same, but PEER_EXIT and PEER_JOIN are
merged into LIST_CHANGED. This allows clients to take a first step to
adapt to the API change without us having to actually submit the full
change, yet.
This commit is contained in:
iphydf 2018-02-08 12:50:38 +00:00
parent 0fbdb03f40
commit a940f26293
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
4 changed files with 9 additions and 17 deletions

View File

@ -455,7 +455,7 @@ static int addpeer(Group_Chats *g_c, int groupnumber, const uint8_t *real_pk, co
add_to_closest(g_c, groupnumber, real_pk, temp_pk); add_to_closest(g_c, groupnumber, real_pk, temp_pk);
if (do_gc_callback && g_c->group_namelistchange) { if (do_gc_callback && g_c->group_namelistchange) {
g_c->group_namelistchange(g_c->m, groupnumber, g->numpeers - 1, CHAT_CHANGE_PEER_ADD, userdata); g_c->group_namelistchange(g_c->m, groupnumber, g->numpeers - 1, CHAT_CHANGE_OCCURRED, userdata);
} }
if (g->peer_on_join) { if (g->peer_on_join) {
@ -543,7 +543,7 @@ static int delpeer(Group_Chats *g_c, int groupnumber, int peer_index, void *user
} }
if (g_c->group_namelistchange) { if (g_c->group_namelistchange) {
g_c->group_namelistchange(g_c->m, groupnumber, peer_index, CHAT_CHANGE_PEER_DEL, userdata); g_c->group_namelistchange(g_c->m, groupnumber, peer_index, CHAT_CHANGE_OCCURRED, userdata);
} }
if (g->peer_on_leave) { if (g->peer_on_leave) {

View File

@ -156,8 +156,7 @@ void g_callback_group_title(Group_Chats *g_c, void (*function)(Messenger *m, uin
* Function(Group_Chats *g_c, int groupnumber, int peernumber, TOX_CHAT_CHANGE change, void *userdata) * Function(Group_Chats *g_c, int groupnumber, int peernumber, TOX_CHAT_CHANGE change, void *userdata)
*/ */
enum { enum {
CHAT_CHANGE_PEER_ADD, CHAT_CHANGE_OCCURRED,
CHAT_CHANGE_PEER_DEL,
CHAT_CHANGE_PEER_NAME, CHAT_CHANGE_PEER_NAME,
}; };
void g_callback_group_namelistchange(Group_Chats *g_c, void (*function)(Messenger *m, int, int, uint8_t, void *)); void g_callback_group_namelistchange(Group_Chats *g_c, void (*function)(Messenger *m, int, int, uint8_t, void *));

View File

@ -2110,13 +2110,10 @@ namespace conference {
*/ */
enum class STATE_CHANGE { enum class STATE_CHANGE {
/** /**
* A peer has joined the conference. * Some changes to list have occurred. Rebuild of list required.
* peer_number is undefined (always 0 for api compatibility)
*/ */
PEER_JOIN, LIST_CHANGED,
/**
* A peer has exited the conference.
*/
PEER_EXIT,
/** /**
* A peer has changed their name. * A peer has changed their name.
*/ */

View File

@ -2393,14 +2393,10 @@ void tox_callback_conference_title(Tox *tox, tox_conference_title_cb *callback);
typedef enum TOX_CONFERENCE_STATE_CHANGE { typedef enum TOX_CONFERENCE_STATE_CHANGE {
/** /**
* A peer has joined the conference. * Some changes to list have occurred. Rebuild of list required.
* peer_number is undefined (always 0 for api compatibility)
*/ */
TOX_CONFERENCE_STATE_CHANGE_PEER_JOIN, TOX_CONFERENCE_STATE_CHANGE_LIST_CHANGED,
/**
* A peer has exited the conference.
*/
TOX_CONFERENCE_STATE_CHANGE_PEER_EXIT,
/** /**
* A peer has changed their name. * A peer has changed their name.