diff options
author | irungentoo <irungentoo@gmail.com> | 2014-11-13 14:12:00 -0500 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-11-13 14:12:00 -0500 |
commit | 5e2ba94f6115b0e7f3aa3839c1e4c0c1d991826d (patch) | |
tree | a397d6cf9781dec518d52197c720b2c8733e9fc3 /toxcore/group.h | |
parent | 2f93ba3a62706f87e0186ecbeeb59400d5a2b71e (diff) | |
parent | 4e40978b90b1056223a88a3489018fb1de8c4981 (diff) |
Merge branch 'titles' of https://github.com/dubslow/toxcore
Diffstat (limited to 'toxcore/group.h')
-rw-r--r-- | toxcore/group.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/toxcore/group.h b/toxcore/group.h index 46af35e3..775f14eb 100644 --- a/toxcore/group.h +++ b/toxcore/group.h | |||
@@ -60,7 +60,7 @@ typedef struct { | |||
60 | 60 | ||
61 | #define DESIRED_CLOSE_CONNECTIONS 4 | 61 | #define DESIRED_CLOSE_CONNECTIONS 4 |
62 | #define MAX_GROUP_CONNECTIONS 16 | 62 | #define MAX_GROUP_CONNECTIONS 16 |
63 | #define GROUP_IDENTIFIER_LENGTH (1 + crypto_box_KEYBYTES) /* crypto_box_KEYBYTES so we can use new_symmetric_key(...) to fill it */ | 63 | #define GROUP_IDENTIFIER_LENGTH (1 + crypto_box_KEYBYTES) /* type + crypto_box_KEYBYTES so we can use new_symmetric_key(...) to fill it */ |
64 | 64 | ||
65 | enum { | 65 | enum { |
66 | GROUPCHAT_CLOSE_NONE, | 66 | GROUPCHAT_CLOSE_NONE, |
@@ -91,6 +91,9 @@ typedef struct { | |||
91 | 91 | ||
92 | uint8_t identifier[GROUP_IDENTIFIER_LENGTH]; | 92 | uint8_t identifier[GROUP_IDENTIFIER_LENGTH]; |
93 | 93 | ||
94 | uint8_t title[MAX_NAME_LENGTH]; | ||
95 | uint8_t title_len; | ||
96 | |||
94 | uint32_t message_number; | 97 | uint32_t message_number; |
95 | uint16_t lossy_message_number; | 98 | uint16_t lossy_message_number; |
96 | uint16_t peer_number; | 99 | uint16_t peer_number; |
@@ -121,6 +124,8 @@ typedef struct { | |||
121 | void *action_callback_userdata; | 124 | void *action_callback_userdata; |
122 | void (*peer_namelistchange)(Messenger *m, int, int, uint8_t, void *); | 125 | void (*peer_namelistchange)(Messenger *m, int, int, uint8_t, void *); |
123 | void *group_namelistchange_userdata; | 126 | void *group_namelistchange_userdata; |
127 | void (*title_callback)(Messenger *m, int, int, const uint8_t *, uint8_t, void *); | ||
128 | void *title_callback_userdata; | ||
124 | 129 | ||
125 | struct { | 130 | struct { |
126 | int (*function)(void *, int, int, void *, const uint8_t *, uint16_t); | 131 | int (*function)(void *, int, int, void *, const uint8_t *, uint16_t); |
@@ -150,6 +155,14 @@ void g_callback_group_message(Group_Chats *g_c, void (*function)(Messenger *m, i | |||
150 | void g_callback_group_action(Group_Chats *g_c, void (*function)(Messenger *m, int, int, const uint8_t *, uint16_t, | 155 | void g_callback_group_action(Group_Chats *g_c, void (*function)(Messenger *m, int, int, const uint8_t *, uint16_t, |
151 | void *), void *userdata); | 156 | void *), void *userdata); |
152 | 157 | ||
158 | /* Set callback function for title changes. | ||
159 | * | ||
160 | * Function(Group_Chats *g_c, int groupnumber, int friendgroupnumber, uint8_t * title, uint8_t length, void *userdata) | ||
161 | * if friendgroupnumber == -1, then author is unknown (e.g. initial joining the group) | ||
162 | */ | ||
163 | void g_callback_group_title(Group_Chats *g_c, void (*function)(Messenger *m, int, int, const uint8_t *, uint8_t, | ||
164 | void *), void *userdata); | ||
165 | |||
153 | /* Set callback function for peer name list changes. | 166 | /* Set callback function for peer name list changes. |
154 | * | 167 | * |
155 | * It gets called every time the name list changes(new peer/name, deleted peer) | 168 | * It gets called every time the name list changes(new peer/name, deleted peer) |
@@ -214,6 +227,12 @@ int group_message_send(const Group_Chats *g_c, int groupnumber, const uint8_t *m | |||
214 | */ | 227 | */ |
215 | int group_action_send(const Group_Chats *g_c, int groupnumber, const uint8_t *action, uint16_t length); | 228 | int group_action_send(const Group_Chats *g_c, int groupnumber, const uint8_t *action, uint16_t length); |
216 | 229 | ||
230 | /* set the group's title, limited to MAX_NAME_LENGTH | ||
231 | * return 0 on success | ||
232 | * return -1 on failure | ||
233 | */ | ||
234 | int group_title_send(const Group_Chats *g_c, int groupnumber, const uint8_t *title, uint8_t title_len); | ||
235 | |||
217 | /* Return the number of peers in the group chat on success. | 236 | /* Return the number of peers in the group chat on success. |
218 | * return -1 on failure | 237 | * return -1 on failure |
219 | */ | 238 | */ |