diff options
author | irungentoo <irungentoo@gmail.com> | 2013-12-07 19:06:41 -0500 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-12-07 19:06:41 -0500 |
commit | 1c45e5993858a4fc0e85858975e3206a657b9f94 (patch) | |
tree | c79b883aeb3cfefba7f1a2d86cbe97fda887dd4c /toxcore/Messenger.c | |
parent | d078c5e9c2f1727502bce7db1b7de7e2fc4880ce (diff) |
Added/updated some basic docs and cleaned up some things.
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r-- | toxcore/Messenger.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 32234784..2eebd772 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -720,6 +720,7 @@ static uint8_t groupnumber_not_valid(Messenger *m, int groupnumber) | |||
720 | 720 | ||
721 | if (m->chats[groupnumber] == NULL) | 721 | if (m->chats[groupnumber] == NULL) |
722 | return 1; | 722 | return 1; |
723 | |||
723 | return 0; | 724 | return 0; |
724 | } | 725 | } |
725 | 726 | ||
@@ -785,7 +786,8 @@ void m_callback_group_message(Messenger *m, void (*function)(Messenger *m, int, | |||
785 | * It gets called every time the name list changes(new peer/name, deleted peer) | 786 | * It gets called every time the name list changes(new peer/name, deleted peer) |
786 | * Function(Tox *tox, int groupnumber, void *userdata) | 787 | * Function(Tox *tox, int groupnumber, void *userdata) |
787 | */ | 788 | */ |
788 | void m_callback_group_namelistchange(Messenger *m, void (*function)(Messenger *m, int, int, uint8_t, void *), void *userdata) | 789 | void m_callback_group_namelistchange(Messenger *m, void (*function)(Messenger *m, int, int, uint8_t, void *), |
790 | void *userdata) | ||
789 | { | 791 | { |
790 | m->group_namelistchange = function; | 792 | m->group_namelistchange = function; |
791 | m->group_namelistchange_userdata = userdata; | 793 | m->group_namelistchange_userdata = userdata; |
@@ -794,10 +796,12 @@ void m_callback_group_namelistchange(Messenger *m, void (*function)(Messenger *m | |||
794 | static int get_chat_num(Messenger *m, Group_Chat *chat) | 796 | static int get_chat_num(Messenger *m, Group_Chat *chat) |
795 | { | 797 | { |
796 | uint32_t i; | 798 | uint32_t i; |
799 | |||
797 | for (i = 0; i < m->numchats; ++i) { //TODO: remove this | 800 | for (i = 0; i < m->numchats; ++i) { //TODO: remove this |
798 | if (m->chats[i] == chat) | 801 | if (m->chats[i] == chat) |
799 | return i; | 802 | return i; |
800 | } | 803 | } |
804 | |||
801 | return -1; | 805 | return -1; |
802 | } | 806 | } |
803 | 807 | ||
@@ -805,6 +809,7 @@ static void group_message_function(Group_Chat *chat, int peer_number, uint8_t *m | |||
805 | { | 809 | { |
806 | Messenger *m = userdata; | 810 | Messenger *m = userdata; |
807 | int i = get_chat_num(m, chat); | 811 | int i = get_chat_num(m, chat); |
812 | |||
808 | if (i == -1) | 813 | if (i == -1) |
809 | return; | 814 | return; |
810 | 815 | ||
@@ -816,6 +821,7 @@ static void group_namelistchange_function(Group_Chat *chat, int peer, uint8_t ch | |||
816 | { | 821 | { |
817 | Messenger *m = userdata; | 822 | Messenger *m = userdata; |
818 | int i = get_chat_num(m, chat); | 823 | int i = get_chat_num(m, chat); |
824 | |||
819 | if (i == -1) | 825 | if (i == -1) |
820 | return; | 826 | return; |
821 | 827 | ||
@@ -1528,6 +1534,7 @@ void kill_messenger(Messenger *m) | |||
1528 | * This requires the other modules to expose cleanup functions. | 1534 | * This requires the other modules to expose cleanup functions. |
1529 | */ | 1535 | */ |
1530 | uint32_t i, numchats = m->numchats; | 1536 | uint32_t i, numchats = m->numchats; |
1537 | |||
1531 | for (i = 0; i < numchats; ++i) | 1538 | for (i = 0; i < numchats; ++i) |
1532 | del_groupchat(m, i); | 1539 | del_groupchat(m, i); |
1533 | 1540 | ||