}
-/**
- * Closure for #host_leave_cont.
- */
-struct HostLeaveContext
-{
- struct GNUNET_SOCIAL_Host *hst;
- GNUNET_ContinuationCallback disconnect_cb;
- void *disconnect_cb_cls;
-};
-
-
-/**
- * FIXME.
- */
-static void
-host_leave_cont (void *cls)
-{
- struct HostLeaveContext *hlc = cls;
-
- GNUNET_SOCIAL_host_disconnect (hlc->hst,
- hlc->disconnect_cb,
- hlc->disconnect_cb_cls);
- GNUNET_free (hlc);
-}
-
-
/**
* Stop hosting the home.
*
{
struct GNUNET_MessageHeader *msg;
struct GNUNET_MQ_Envelope *envelope;
- struct HostLeaveContext *hlc;
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"GNUNET_SOCIAL_host_leave\n");
GNUNET_SOCIAL_host_announce (hst, "_notice_place_closing", env, NULL, NULL,
GNUNET_SOCIAL_ANNOUNCE_NONE);
+ hst->plc.disconnect_cb = disconnect_cb;
+ hst->plc.disconnect_cls = cls;
envelope = GNUNET_MQ_msg (msg,
GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE);
- hlc = GNUNET_new (struct HostLeaveContext);
- hlc->hst = hst;
- hlc->disconnect_cb = disconnect_cb;
- hlc->disconnect_cb_cls = cls;
- GNUNET_MQ_notify_sent (envelope,
- &host_leave_cont,
- hlc);
GNUNET_MQ_send (hst->plc.mq,
envelope);
}
}
-/**
- * Closure for #leave_done_cont.
- */
-struct LeaveContext
-{
- struct GNUNET_SOCIAL_Guest *gst;
- GNUNET_ContinuationCallback disconnect_cb;
- void *disconnect_cb_cls;
-};
-
-
-/**
- * The leave message was transmitted, now complete the
- * disconnection process.
- *
- * @param cls a `struct LeaveContext`
- */
-static void
-leave_done_cont (void *cls)
-{
- struct LeaveContext *lc = cls;
-
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "social_api: guest's place_leave message sent!\n");
- GNUNET_SOCIAL_guest_disconnect (lc->gst,
- lc->disconnect_cb,
- lc->disconnect_cb_cls);
- GNUNET_free (lc);
-}
-
-
/**
* Leave a place temporarily or permanently.
*
{
struct GNUNET_MessageHeader *msg;
struct GNUNET_MQ_Envelope *envelope;
- struct LeaveContext *lc;
GNUNET_SOCIAL_guest_talk (gst, "_notice_place_leave", env, NULL, NULL,
GNUNET_SOCIAL_TALK_NONE);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"social_api: place_leave\n");
+ gst->plc.disconnect_cb = disconnect_cb;
+ gst->plc.disconnect_cls = cls;
envelope = GNUNET_MQ_msg (msg,
GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE);
- lc = GNUNET_new (struct LeaveContext);
- lc->gst = gst;
- lc->disconnect_cb = disconnect_cb;
- lc->disconnect_cb_cls = cls;
- GNUNET_MQ_notify_sent (envelope,
- &leave_done_cont,
- lc);
GNUNET_MQ_send (gst->plc.mq,
envelope);
}