GNUNET_SOCIAL_AppEgoCallback ego_cb;
GNUNET_SOCIAL_AppHostPlaceCallback host_cb;
GNUNET_SOCIAL_AppGuestPlaceCallback guest_cb;
+ GNUNET_SOCIAL_AppConnectedCallback connected_cb;
void *cb_cls;
-
- /**
- * Is this place in the process of disconnecting from the service?
- * #GNUNET_YES or #GNUNET_NO
- */
- uint8_t is_disconnecting;
};
* Does this place belong to a host (#GNUNET_YES) or guest (#GNUNET_NO)?
*/
uint8_t is_host;
-
- /**
- * Is this place in the process of disconnecting from the service?
- * #GNUNET_YES or #GNUNET_NO
- */
- uint8_t is_disconnecting;
};
}
+static void
+app_recv_ego_end (void *cls,
+ struct GNUNET_CLIENT_MANAGER_Connection *client,
+ const struct GNUNET_MessageHeader *msg)
+{
+ struct GNUNET_SOCIAL_App *
+ app = GNUNET_CLIENT_MANAGER_get_user_context_ (client, sizeof (*app));
+}
+
+
static void
app_recv_place (void *cls,
struct GNUNET_CLIENT_MANAGER_Connection *client,
struct GNUNET_SOCIAL_HostConnection *hconn = GNUNET_malloc (sizeof (*hconn));
hconn->app = app;
hconn->plc_msg = *pmsg;
- app->host_cb (app->cb_cls, hconn, ego, &pmsg->place_pub_key, pmsg->place_state);
+ if (NULL != app->host_cb)
+ app->host_cb (app->cb_cls, hconn, ego, &pmsg->place_pub_key, pmsg->place_state);
}
else
{
struct GNUNET_SOCIAL_GuestConnection *gconn = GNUNET_malloc (sizeof (*gconn));
gconn->app = app;
gconn->plc_msg = *pmsg;
- app->guest_cb (app->cb_cls, gconn, ego, &pmsg->place_pub_key, pmsg->place_state);
+ if (NULL != app->guest_cb)
+ app->guest_cb (app->cb_cls, gconn, ego, &pmsg->place_pub_key, pmsg->place_state);
}
}
+static void
+app_recv_place_end (void *cls,
+ struct GNUNET_CLIENT_MANAGER_Connection *client,
+ const struct GNUNET_MessageHeader *msg)
+{
+ struct GNUNET_SOCIAL_App *
+ app = GNUNET_CLIENT_MANAGER_get_user_context_ (client, sizeof (*app));
+
+ if (NULL != app->connected_cb)
+ app->connected_cb (app->cb_cls);
+}
+
+
static struct GNUNET_CLIENT_MANAGER_MessageHandler host_handlers[] =
{
{ host_recv_enter_ack, NULL,
GNUNET_MESSAGE_TYPE_SOCIAL_APP_EGO,
sizeof (struct AppEgoMessage), GNUNET_YES },
+ { app_recv_ego_end, NULL,
+ GNUNET_MESSAGE_TYPE_SOCIAL_APP_EGO_END,
+ sizeof (struct GNUNET_MessageHeader), GNUNET_NO },
+
{ app_recv_place, NULL,
GNUNET_MESSAGE_TYPE_SOCIAL_APP_PLACE,
sizeof (struct AppPlaceMessage), GNUNET_NO },
+ { app_recv_place_end, NULL,
+ GNUNET_MESSAGE_TYPE_SOCIAL_APP_PLACE_END,
+ sizeof (struct GNUNET_MessageHeader), GNUNET_NO },
+
{ app_recv_result, NULL,
GNUNET_MESSAGE_TYPE_PSYC_RESULT_CODE,
sizeof (struct GNUNET_OperationResultMessage), GNUNET_YES },
GNUNET_ContinuationCallback disconnect_cb,
void *disconnect_cls)
{
- plc->is_disconnecting = GNUNET_YES;
plc->disconnect_cb = disconnect_cb;
plc->disconnect_cls = disconnect_cls;
/**
* Stop hosting the home.
*
- * Sends a _notice_place_closed announcement to the home.
+ * Sends a _notice_place_closing announcement to the home.
* Invalidates host handle.
*
* @param hst
GNUNET_ContinuationCallback disconnect_cb,
void *cls)
{
- GNUNET_SOCIAL_host_announce (hst, "_notice_place_closed", env, NULL, NULL,
+ GNUNET_SOCIAL_host_announce (hst, "_notice_place_closing", env, NULL, NULL,
GNUNET_SOCIAL_ANNOUNCE_NONE);
place_leave (&hst->plc);
GNUNET_SOCIAL_host_disconnect (hst, disconnect_cb, cls);
GNUNET_SOCIAL_AppEgoCallback ego_cb,
GNUNET_SOCIAL_AppHostPlaceCallback host_cb,
GNUNET_SOCIAL_AppGuestPlaceCallback guest_cb,
+ GNUNET_SOCIAL_AppConnectedCallback connected_cb,
void *cls)
{
uint16_t app_id_size = strnlen (id, GNUNET_SOCIAL_APP_MAX_ID_SIZE);
app->ego_cb = ego_cb;
app->host_cb = host_cb;
app->guest_cb = guest_cb;
+ app->connected_cb = connected_cb;
app->cb_cls = cls;
app->egos = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_NO);
app->client = GNUNET_CLIENT_MANAGER_connect (cfg, "social",