summaryrefslogtreecommitdiff
path: root/toxcore/Messenger.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r--toxcore/Messenger.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index d9e085fb..dbbfa58c 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -686,9 +686,9 @@ void m_callback_group_invite(Messenger *m, void (*function)(Messenger *m, int, u
686 686
687/* Set the callback for group messages. 687/* Set the callback for group messages.
688 * 688 *
689 * Function(Messenger *m, int groupnumber, uint8_t * message, uint16_t length, void *userdata) 689 * Function(Tox *tox, int groupnumber, int friendgroupnumber, uint8_t * message, uint16_t length, void *userdata)
690 */ 690 */
691void m_callback_group_message(Messenger *m, void (*function)(Messenger *m, int, uint8_t *, uint16_t, void *), 691void m_callback_group_message(Messenger *m, void (*function)(Messenger *m, int, int, uint8_t *, uint16_t, void *),
692 void *userdata) 692 void *userdata)
693{ 693{
694 m->group_message = function; 694 m->group_message = function;
@@ -705,7 +705,7 @@ static void group_message_function(Group_Chat *chat, int peer_number, uint8_t *m
705 } 705 }
706 706
707 if (m->group_message) 707 if (m->group_message)
708 (*m->group_message)(m, i, message, length, m->group_invite_userdata); 708 (*m->group_message)(m, i, peer_number, message, length, m->group_invite_userdata);
709} 709}
710 710
711/* Creates a new groupchat and puts it in the chats array. 711/* Creates a new groupchat and puts it in the chats array.
@@ -788,6 +788,25 @@ int del_groupchat(Messenger *m, int groupnumber)
788 return 0; 788 return 0;
789} 789}
790 790
791/* Copy the name of peernumber who is in groupnumber to name.
792 * name must be at least MAX_NICK_BYTES long.
793 *
794 * return length of name if success
795 * return -1 if failure
796 */
797int m_group_peername(Messenger *m, int groupnumber, int peernumber, uint8_t *name)
798{
799 if ((unsigned int)groupnumber >= m->numchats)
800 return -1;
801
802 if (m->chats == NULL)
803 return -1;
804
805 if (m->chats[groupnumber] == NULL)
806 return -1;
807
808 return group_peername(m->chats[groupnumber], peernumber, name);
809}
791/* return 1 if that friend was invited to the group 810/* return 1 if that friend was invited to the group
792 * return 0 if the friend was not or error. 811 * return 0 if the friend was not or error.
793 */ 812 */
@@ -1593,6 +1612,7 @@ static int messenger_load_state_callback(void *outer, uint8_t *data, uint32_t le
1593 break; 1612 break;
1594 1613
1595#ifdef DEBUG 1614#ifdef DEBUG
1615
1596 default: 1616 default:
1597 fprintf(stderr, "Load state: contains unrecognized part (len %u, type %u)\n", 1617 fprintf(stderr, "Load state: contains unrecognized part (len %u, type %u)\n",
1598 length, type); 1618 length, type);