+ * Obtain 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)
+{
+ return &plc->pub_key;
+}
+
+
+/**
+ * Set message processing @a flags for a @a method_prefix.
+ *
+ * @param plc
+ * Place.
+ * @param method_prefix
+ * Method prefix @a flags apply to.
+ * @param flags
+ * The flags that apply to a matching @a method_prefix.
+ */
+void
+GNUNET_SOCIAL_place_msg_proc_set (struct GNUNET_SOCIAL_Place *plc,
+ const char *method_prefix,
+ enum GNUNET_SOCIAL_MsgProcFlags flags)
+{
+ GNUNET_assert (NULL != method_prefix);
+ struct MsgProcRequest *mpreq;
+ uint16_t method_size = strnlen (method_prefix,
+ GNUNET_MAX_MESSAGE_SIZE
+ - sizeof (*mpreq)) + 1;
+ GNUNET_assert ('\0' == method_prefix[method_size - 1]);
+
+ struct GNUNET_MQ_Envelope *
+ env = GNUNET_MQ_msg_extra (mpreq, method_size,
+ GNUNET_MESSAGE_TYPE_SOCIAL_MSG_PROC_SET);
+ mpreq->flags = htonl (flags);
+ GNUNET_memcpy (&mpreq[1], method_prefix, method_size);
+
+ GNUNET_MQ_send (plc->mq, env);
+}
+
+
+/**
+ * Clear all message processing flags previously set for this place.
+ */
+void
+GNUNET_SOCIAL_place_msg_proc_clear (struct GNUNET_SOCIAL_Place *plc)
+{
+ struct GNUNET_MessageHeader *req;
+ struct GNUNET_MQ_Envelope *
+ env = GNUNET_MQ_msg (req, GNUNET_MESSAGE_TYPE_SOCIAL_MSG_PROC_CLEAR);
+
+ GNUNET_MQ_send (plc->mq, env);
+}
+
+
+static struct GNUNET_SOCIAL_HistoryRequest *
+place_history_replay (struct GNUNET_SOCIAL_Place *plc,
+ uint64_t start_message_id,
+ uint64_t end_message_id,
+ uint64_t message_limit,
+ const char *method_prefix,
+ uint32_t flags,
+ struct GNUNET_PSYC_Slicer *slicer,
+ GNUNET_ResultCallback result_cb,
+ void *cls)
+{
+ struct GNUNET_PSYC_HistoryRequestMessage *req;
+ struct GNUNET_SOCIAL_HistoryRequest *hist = GNUNET_malloc (sizeof (*hist));
+ hist->plc = plc;
+ hist->slicer = slicer;
+ hist->result_cb = result_cb;
+ hist->cls = cls;
+ hist->op_id = GNUNET_OP_add (plc->op, op_recv_history_result, hist, NULL);
+
+ GNUNET_assert (NULL != method_prefix);
+ uint16_t method_size = strnlen (method_prefix,
+ GNUNET_MAX_MESSAGE_SIZE
+ - sizeof (*req)) + 1;
+ GNUNET_assert ('\0' == method_prefix[method_size - 1]);
+
+ struct GNUNET_MQ_Envelope *
+ env = GNUNET_MQ_msg_extra (req, method_size,
+ GNUNET_MESSAGE_TYPE_PSYC_HISTORY_REPLAY);
+ req->start_message_id = GNUNET_htonll (start_message_id);
+ req->end_message_id = GNUNET_htonll (end_message_id);
+ req->message_limit = GNUNET_htonll (message_limit);
+ req->flags = htonl (flags);
+ req->op_id = GNUNET_htonll (hist->op_id);
+ GNUNET_memcpy (&req[1], method_prefix, method_size);
+
+ GNUNET_MQ_send (plc->mq, env);
+ return hist;
+}
+
+
+/**
+ * Learn about the history of a place.
+ *
+ * Messages are returned through the @a slicer function
+ * and have the #GNUNET_PSYC_MESSAGE_HISTORIC flag set.
+ *
+ * @param place
+ * Place we want to learn more about.
+ * @param start_message_id
+ * First historic message we are interested in.
+ * @param end_message_id
+ * Last historic message we are interested in (inclusive).
+ * @param method_prefix
+ * Only retrieve messages with this method prefix.
+ * @param flags
+ * OR'ed GNUNET_PSYC_HistoryReplayFlags
+ * @param slicer
+ * Slicer to use for retrieved messages.
+ * Can be the same as the slicer of the place.
+ * @param result_cb
+ * Function called after all messages retrieved.
+ * NULL if not needed.
+ * @param cls Closure for @a result_cb.