From bc88a11b2a64ee389f1eb29eb30487fc5f22a475 Mon Sep 17 00:00:00 2001 From: Gabor X Toth <*@tg-x.net> Date: Wed, 27 Jan 2016 20:45:38 +0000 Subject: [PATCH] social api: some missing bits --- src/include/gnunet_social_service.h | 15 +++++++++++++++ src/social/social_api.c | 5 +++-- src/social/test_social.c | 8 ++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/include/gnunet_social_service.h b/src/include/gnunet_social_service.h index 26b335fac..b8b452dfa 100644 --- a/src/include/gnunet_social_service.h +++ b/src/include/gnunet_social_service.h @@ -814,12 +814,15 @@ GNUNET_SOCIAL_host_leave (struct GNUNET_SOCIAL_Host *hst, * #GNUNET_OK on success, or * #GNUNET_SYSERR on error, e.g. could not connect to the service, or * could not resolve GNS name. + * @param place_pub_key + * Public key of place. * @param max_message_id * Last message ID sent to the place. * Or 0 if no messages have been sent to the place yet. */ typedef void (*GNUNET_SOCIAL_GuestEnterCallback) (void *cls, int result, + const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key, uint64_t max_message_id); @@ -1068,6 +1071,18 @@ GNUNET_SOCIAL_guest_get_place (struct GNUNET_SOCIAL_Guest *guest); struct GNUNET_SOCIAL_HistoryRequest; +/** + * Get the public key of a place. + * + * @param plc + * Place. + * + * @return Public key of the place. + */ +const struct GNUNET_CRYPTO_EddsaPublicKey * +GNUNET_SOCIAL_place_get_pub_key (const struct GNUNET_SOCIAL_Place *plc); + + /** * Set message processing @a flags for a @a method_prefix. * diff --git a/src/social/social_api.c b/src/social/social_api.c index bcd263d03..0eafc852a 100644 --- a/src/social/social_api.c +++ b/src/social/social_api.c @@ -871,7 +871,8 @@ guest_recv_enter_ack (void *cls, cres = (struct GNUNET_PSYC_CountersResultMessage *) msg; int32_t result = ntohl (cres->result_code); if (NULL != gst->enter_cb) - gst->enter_cb (gst->cb_cls, result, GNUNET_ntohll (cres->max_message_id)); + gst->enter_cb (gst->cb_cls, result, &gst->plc.pub_key, + GNUNET_ntohll (cres->max_message_id)); } @@ -1962,7 +1963,7 @@ GNUNET_SOCIAL_guest_get_place (struct GNUNET_SOCIAL_Guest *gst) * @return Public key of the place. */ const struct GNUNET_CRYPTO_EddsaPublicKey * -GNUNET_SOCIAL_place_get_key (struct GNUNET_SOCIAL_Place *plc) +GNUNET_SOCIAL_place_get_pub_key (const struct GNUNET_SOCIAL_Place *plc) { return &plc->pub_key; } diff --git a/src/social/test_social.c b/src/social/test_social.c index 2e9b270b6..2606e7fe8 100644 --- a/src/social/test_social.c +++ b/src/social/test_social.c @@ -382,7 +382,9 @@ host_reconnected (void *cls, int result, static void -guest_reconnected (void *cls, int result, uint64_t max_message_id) +guest_reconnected (void *cls, int result, + const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key, + uint64_t max_message_id) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test #%u: Guest reconnected to place: %d\n", @@ -1098,7 +1100,9 @@ host_answer_door (void *cls, static void -guest_recv_local_enter (void *cls, int result, uint64_t max_message_id) +guest_recv_local_enter (void *cls, int result, + const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key, + uint64_t max_message_id) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test #%u: Guest entered to local place: %d\n", -- 2.25.1