diff options
Diffstat (limited to 'src/messenger/messenger_api_room.c')
-rwxr-xr-x[-rw-r--r--] | src/messenger/messenger_api_room.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/messenger/messenger_api_room.c b/src/messenger/messenger_api_room.c index df141ca12..5b7edee60 100644..100755 --- a/src/messenger/messenger_api_room.c +++ b/src/messenger/messenger_api_room.c | |||
@@ -106,7 +106,7 @@ get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_H | |||
106 | return (entry? entry->sender : NULL); | 106 | return (entry? entry->sender : NULL); |
107 | } | 107 | } |
108 | 108 | ||
109 | static void | 109 | static struct GNUNET_MESSENGER_Contact* |
110 | handle_join_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, | 110 | handle_join_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, |
111 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 111 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
112 | { | 112 | { |
@@ -124,6 +124,8 @@ handle_join_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER | |||
124 | (GNUNET_OK == GNUNET_CONTAINER_multishortmap_put(room->members, &(message->header.sender_id), sender, | 124 | (GNUNET_OK == GNUNET_CONTAINER_multishortmap_put(room->members, &(message->header.sender_id), sender, |
125 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE))) | 125 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE))) |
126 | increase_contact_rc(sender); | 126 | increase_contact_rc(sender); |
127 | |||
128 | return sender; | ||
127 | } | 129 | } |
128 | 130 | ||
129 | static void | 131 | static void |
@@ -140,7 +142,7 @@ handle_leave_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGE | |||
140 | struct GNUNET_MESSENGER_ContactStore *store = get_handle_contact_store(room->handle); | 142 | struct GNUNET_MESSENGER_ContactStore *store = get_handle_contact_store(room->handle); |
141 | 143 | ||
142 | if (GNUNET_YES == decrease_contact_rc(sender)) | 144 | if (GNUNET_YES == decrease_contact_rc(sender)) |
143 | remove_store_contact(store, sender, &context); | 145 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "A contact does not share any room with you anymore!\n"); |
144 | } | 146 | } |
145 | 147 | ||
146 | static void | 148 | static void |
@@ -216,17 +218,17 @@ handle_delete_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENG | |||
216 | } | 218 | } |
217 | } | 219 | } |
218 | 220 | ||
219 | void | 221 | struct GNUNET_MESSENGER_Contact* |
220 | handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, | 222 | handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, |
221 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 223 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
222 | { | 224 | { |
223 | if (GNUNET_NO != GNUNET_CONTAINER_multihashmap_contains (room->messages, hash)) | 225 | if (GNUNET_NO != GNUNET_CONTAINER_multihashmap_contains (room->messages, hash)) |
224 | return; | 226 | return sender; |
225 | 227 | ||
226 | switch (message->header.kind) | 228 | switch (message->header.kind) |
227 | { | 229 | { |
228 | case GNUNET_MESSENGER_KIND_JOIN: | 230 | case GNUNET_MESSENGER_KIND_JOIN: |
229 | handle_join_message (room, sender, message, hash); | 231 | sender = handle_join_message (room, sender, message, hash); |
230 | break; | 232 | break; |
231 | case GNUNET_MESSENGER_KIND_LEAVE: | 233 | case GNUNET_MESSENGER_KIND_LEAVE: |
232 | handle_leave_message (room, sender, message, hash); | 234 | handle_leave_message (room, sender, message, hash); |
@@ -253,7 +255,7 @@ handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER | |||
253 | struct GNUNET_MESSENGER_RoomMessageEntry *entry = GNUNET_new(struct GNUNET_MESSENGER_RoomMessageEntry); | 255 | struct GNUNET_MESSENGER_RoomMessageEntry *entry = GNUNET_new(struct GNUNET_MESSENGER_RoomMessageEntry); |
254 | 256 | ||
255 | if (!entry) | 257 | if (!entry) |
256 | return; | 258 | return sender; |
257 | 259 | ||
258 | entry->sender = sender; | 260 | entry->sender = sender; |
259 | entry->message = copy_message (message); | 261 | entry->message = copy_message (message); |
@@ -264,6 +266,8 @@ handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER | |||
264 | destroy_message (entry->message); | 266 | destroy_message (entry->message); |
265 | GNUNET_free(entry); | 267 | GNUNET_free(entry); |
266 | } | 268 | } |
269 | |||
270 | return sender; | ||
267 | } | 271 | } |
268 | 272 | ||
269 | struct GNUNET_MESSENGER_MemberCall | 273 | struct GNUNET_MESSENGER_MemberCall |