diff options
Diffstat (limited to 'src/gnunet_chat_lib.c')
-rw-r--r-- | src/gnunet_chat_lib.c | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c index 35de7dc..0fe9c57 100644 --- a/src/gnunet_chat_lib.c +++ b/src/gnunet_chat_lib.c | |||
@@ -869,6 +869,47 @@ GNUNET_CHAT_group_iterate_contacts (const struct GNUNET_CHAT_Group *group, | |||
869 | } | 869 | } |
870 | 870 | ||
871 | 871 | ||
872 | void | ||
873 | GNUNET_CHAT_member_set_user_pointer (struct GNUNET_CHAT_Group *group, | ||
874 | const struct GNUNET_CHAT_Contact *member, | ||
875 | void *user_pointer) | ||
876 | { | ||
877 | GNUNET_CHAT_VERSION_ASSERT(); | ||
878 | |||
879 | if ((!group) || (!(group->context)) || (!member)) | ||
880 | return; | ||
881 | |||
882 | struct GNUNET_ShortHashCode hash; | ||
883 | util_shorthash_from_member(member->member, &hash); | ||
884 | |||
885 | GNUNET_CONTAINER_multishortmap_put( | ||
886 | group->context->member_pointers, | ||
887 | &hash, | ||
888 | user_pointer, | ||
889 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE | ||
890 | ); | ||
891 | } | ||
892 | |||
893 | |||
894 | void* | ||
895 | GNUNET_CHAT_member_get_user_pointer (const struct GNUNET_CHAT_Group *group, | ||
896 | const struct GNUNET_CHAT_Contact *member) | ||
897 | { | ||
898 | GNUNET_CHAT_VERSION_ASSERT(); | ||
899 | |||
900 | if ((!group) || (!(group->context)) || (!member)) | ||
901 | return NULL; | ||
902 | |||
903 | struct GNUNET_ShortHashCode hash; | ||
904 | util_shorthash_from_member(member->member, &hash); | ||
905 | |||
906 | return GNUNET_CONTAINER_multishortmap_get( | ||
907 | group->context->member_pointers, | ||
908 | &hash | ||
909 | ); | ||
910 | } | ||
911 | |||
912 | |||
872 | struct GNUNET_CHAT_Context* | 913 | struct GNUNET_CHAT_Context* |
873 | GNUNET_CHAT_group_get_context (struct GNUNET_CHAT_Group *group) | 914 | GNUNET_CHAT_group_get_context (struct GNUNET_CHAT_Group *group) |
874 | { | 915 | { |
@@ -1260,47 +1301,6 @@ GNUNET_CHAT_context_iterate_files (struct GNUNET_CHAT_Context *context, | |||
1260 | } | 1301 | } |
1261 | 1302 | ||
1262 | 1303 | ||
1263 | void | ||
1264 | GNUNET_CHAT_member_set_user_pointer (struct GNUNET_CHAT_Context *context, | ||
1265 | const struct GNUNET_CHAT_Contact *member, | ||
1266 | void *user_pointer) | ||
1267 | { | ||
1268 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1269 | |||
1270 | if ((!context) || (!member)) | ||
1271 | return; | ||
1272 | |||
1273 | struct GNUNET_ShortHashCode hash; | ||
1274 | util_shorthash_from_member(member->member, &hash); | ||
1275 | |||
1276 | GNUNET_CONTAINER_multishortmap_put( | ||
1277 | context->member_pointers, | ||
1278 | &hash, | ||
1279 | user_pointer, | ||
1280 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE | ||
1281 | ); | ||
1282 | } | ||
1283 | |||
1284 | |||
1285 | void* | ||
1286 | GNUNET_CHAT_member_get_user_pointer (const struct GNUNET_CHAT_Context *context, | ||
1287 | const struct GNUNET_CHAT_Contact *member) | ||
1288 | { | ||
1289 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1290 | |||
1291 | if ((!context) || (!member)) | ||
1292 | return NULL; | ||
1293 | |||
1294 | struct GNUNET_ShortHashCode hash; | ||
1295 | util_shorthash_from_member(member->member, &hash); | ||
1296 | |||
1297 | return GNUNET_CONTAINER_multishortmap_get( | ||
1298 | context->member_pointers, | ||
1299 | &hash | ||
1300 | ); | ||
1301 | } | ||
1302 | |||
1303 | |||
1304 | enum GNUNET_CHAT_MessageKind | 1304 | enum GNUNET_CHAT_MessageKind |
1305 | GNUNET_CHAT_message_get_kind (const struct GNUNET_CHAT_Message *message) | 1305 | GNUNET_CHAT_message_get_kind (const struct GNUNET_CHAT_Message *message) |
1306 | { | 1306 | { |