mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-11-27 02:56:30 -05:00
merged upstream/master
This commit is contained in:
commit
6419b03a2a
131 changed files with 6081 additions and 1473 deletions
|
|
@ -46,19 +46,17 @@ extern std::shared_ptr<RsBroadcastDiscovery> rsBroadcastDiscovery;
|
|||
|
||||
struct RsBroadcastDiscoveryResult : RsSerializable
|
||||
{
|
||||
PGPFingerprintType mPgpFingerprint;
|
||||
RsPeerId mSslId;
|
||||
std::string mProfileName;
|
||||
RsUrl locator;
|
||||
RsUrl mLocator;
|
||||
|
||||
/// @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx) override
|
||||
{
|
||||
RS_SERIAL_PROCESS(mPgpFingerprint);
|
||||
RS_SERIAL_PROCESS(mSslId);
|
||||
RS_SERIAL_PROCESS(mProfileName);
|
||||
RS_SERIAL_PROCESS(locator);
|
||||
RS_SERIAL_PROCESS(mLocator);
|
||||
}
|
||||
|
||||
RsBroadcastDiscoveryResult() = default;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class RsEvents;
|
|||
* TODO: this should become std::weak_ptr once we have a reasonable services
|
||||
* management.
|
||||
*/
|
||||
extern std::shared_ptr<RsEvents> rsEvents;
|
||||
extern RsEvents* rsEvents;
|
||||
|
||||
/**
|
||||
* @brief Events types.
|
||||
|
|
@ -116,21 +116,20 @@ public:
|
|||
* @return False on error, true otherwise.
|
||||
*/
|
||||
virtual bool postEvent(
|
||||
std::unique_ptr<RsEvent> event,
|
||||
std::shared_ptr<const RsEvent> event,
|
||||
std::string& errorMessage = RS_DEFAULT_STORAGE_PARAM(std::string)
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* @brief Send event directly to handlers. Blocking API
|
||||
* The handlers get exectuded on the caller thread, ensuring the function
|
||||
* returns only after the event has been handled.
|
||||
* The handlers get exectuded on the caller thread.
|
||||
* @param[in] event
|
||||
* @param[out] errorMessage Optional storage for error messsage, meaningful
|
||||
* only on failure.
|
||||
* @return False on error, true otherwise.
|
||||
*/
|
||||
virtual bool sendEvent(
|
||||
const RsEvent& event,
|
||||
std::shared_ptr<const RsEvent> event,
|
||||
std::string& errorMessage = RS_DEFAULT_STORAGE_PARAM(std::string)
|
||||
) = 0;
|
||||
|
||||
|
|
@ -155,7 +154,7 @@ public:
|
|||
* @return False on error, true otherwise.
|
||||
*/
|
||||
virtual bool registerEventsHandler(
|
||||
std::function<void(const RsEvent&)> multiCallback,
|
||||
std::function<void(std::shared_ptr<const RsEvent>)> multiCallback,
|
||||
RsEventsHandlerId_t& hId = RS_DEFAULT_STORAGE_PARAM(RsEventsHandlerId_t, 0)
|
||||
) = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
* *
|
||||
* libretroshare: retroshare core library *
|
||||
* *
|
||||
* Copyright 2008-2008 by Robert Fernie <retroshare@lunamutt.com> *
|
||||
* Copyright (C) 2008 Robert Fernie <retroshare@lunamutt.com> *
|
||||
* Copyright (C) 2018-2019 Gioacchino Mazzurco <gio@eigenlab.org> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
|
|
@ -208,7 +209,7 @@ public:
|
|||
virtual ~RsFiles() {}
|
||||
|
||||
/**
|
||||
* Provides file data for the gui, media streaming or rpc clients.
|
||||
* @brief Provides file data for the gui, media streaming or rpc clients.
|
||||
* It may return unverified chunks. This allows streaming without having to
|
||||
* wait for hashes or completion of the file.
|
||||
* This function returns an unspecified amount of bytes. Either as much data
|
||||
|
|
@ -224,7 +225,7 @@ public:
|
|||
* @param[in] offset where the desired block starts
|
||||
* @param[inout] requested_size size of pre-allocated data. Will be updated
|
||||
* by the function.
|
||||
* @param data pre-allocated memory chunk of size 'requested_size' by the
|
||||
* @param[out] data pre-allocated memory chunk of size 'requested_size' by the
|
||||
* client
|
||||
* @return Returns false in case
|
||||
* - the files is not available on the local node
|
||||
|
|
@ -422,22 +423,47 @@ public:
|
|||
* @brief Get details about the upload with given hash
|
||||
* @jsonapi{development}
|
||||
* @param[in] hash file identifier
|
||||
* @param[in] peer_id peer identifier
|
||||
* @param[in] peerId peer identifier
|
||||
* @param[out] map storage for chunk info
|
||||
* @return true if file found, false otherwise
|
||||
*/
|
||||
virtual bool FileUploadChunksDetails(
|
||||
const RsFileHash& hash, const RsPeerId& peer_id,
|
||||
const RsFileHash& hash, const RsPeerId& peerId,
|
||||
CompressedChunkMap& map ) = 0;
|
||||
|
||||
/***
|
||||
* Extra List Access
|
||||
***/
|
||||
//virtual bool ExtraFileAdd(std::string fname, std::string hash, uint64_t size, uint32_t period, TransferRequestFlags flags) = 0;
|
||||
virtual bool ExtraFileRemove(const RsFileHash& hash) = 0;
|
||||
virtual bool ExtraFileHash(std::string localpath, uint32_t period, TransferRequestFlags flags) = 0;
|
||||
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0;
|
||||
virtual bool ExtraFileMove(std::string fname, const RsFileHash& hash, uint64_t size, std::string destpath) = 0;
|
||||
/**
|
||||
* @brief Remove file from extra fila shared list
|
||||
* @jsonapi{development}
|
||||
* @param[in] hash hash of the file to remove
|
||||
* @return return false on error, true otherwise
|
||||
*/
|
||||
virtual bool ExtraFileRemove(const RsFileHash& hash) = 0;
|
||||
|
||||
/**
|
||||
* @brief Add file to extra shared file list
|
||||
* @jsonapi{development}
|
||||
* @param[in] localpath path of the file
|
||||
* @param[in] period how much time the file will be kept in extra list in
|
||||
* seconds
|
||||
* @param[in] flags sharing policy flags ex: RS_FILE_REQ_ANONYMOUS_ROUTING
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool ExtraFileHash(
|
||||
std::string localpath, rstime_t period, TransferRequestFlags flags
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get extra file information
|
||||
* @jsonapi{development}
|
||||
* @param[in] localpath path of the file
|
||||
* @param[out] info storage for the file information
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0;
|
||||
|
||||
virtual bool ExtraFileMove(
|
||||
std::string fname, const RsFileHash& hash, uint64_t size,
|
||||
std::string destpath ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Request directory details, subsequent multiple call may be used to
|
||||
|
|
|
|||
|
|
@ -1,6 +1,37 @@
|
|||
/*******************************************************************************
|
||||
* libretroshare/src/retroshare: rsflags.h *
|
||||
* *
|
||||
* libretroshare: retroshare core library *
|
||||
* *
|
||||
* Copyright 2012-2019 by Retroshare Team <contact@retroshare.cc> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
/* G10h4ck: TODO we should redefine flags in a way that the flag declaration and
|
||||
* the flags values (bit fields) would be strongly logically linked.
|
||||
* A possible way is to take an enum class containing the names of each
|
||||
* bitfield and corresponding value as template parameter, this way would also
|
||||
* avoid the need of dumb template parameter that is used only to make the
|
||||
* types incompatible but that doesn't help finding what are the possible values
|
||||
* for a kind of flag. Another appealing approach seems the first one described
|
||||
* here https://softwareengineering.stackexchange.com/questions/194412/using-scoped-enums-for-bit-flags-in-c
|
||||
* a few simple macros could be used instead of the template class */
|
||||
|
||||
// This class provides a representation for flags that can be combined with bitwise
|
||||
// operations. However, because the class is templated with an id, it's not possible to
|
||||
|
|
|
|||
|
|
@ -142,10 +142,13 @@ public:
|
|||
* posted
|
||||
* @param[in] threadId Id of the post (that is a thread) in the channel
|
||||
* where the comment is placed
|
||||
* @param[in] comment UTF-8 string containing the comment itself
|
||||
* @param[in] authorId Id of the author of the comment
|
||||
* @param[in] parentId Id of the parent of the comment that is either a
|
||||
* channel post Id or the Id of another comment.
|
||||
* @param[in] authorId Id of the author of the comment
|
||||
* @param[in] comment UTF-8 string containing the comment itself
|
||||
* @param[in] origCommentId If this is supposed to replace an already
|
||||
* existent comment, the id of the old post.
|
||||
* If left blank a new post will be created.
|
||||
* @param[out] commentMessageId Optional storage for the id of the comment
|
||||
* that was created, meaningful only on success.
|
||||
* @param[out] errorMessage Optional storage for error message, meaningful
|
||||
|
|
@ -155,9 +158,10 @@ public:
|
|||
virtual bool createCommentV2(
|
||||
const RsGxsGroupId& channelId,
|
||||
const RsGxsMessageId& threadId,
|
||||
const RsGxsMessageId& parentId,
|
||||
const RsGxsId& authorId,
|
||||
const std::string& comment,
|
||||
const RsGxsId& authorId,
|
||||
const RsGxsMessageId& parentId = RsGxsMessageId(),
|
||||
const RsGxsMessageId& origCommentId = RsGxsMessageId(),
|
||||
RsGxsMessageId& commentMessageId = RS_DEFAULT_STORAGE_PARAM(RsGxsMessageId),
|
||||
std::string& errorMessage = RS_DEFAULT_STORAGE_PARAM(std::string)
|
||||
) = 0;
|
||||
|
|
|
|||
|
|
@ -142,19 +142,6 @@ struct RsGxsComment : RsSerializable
|
|||
RS_SERIAL_PROCESS(mOwnVote);
|
||||
RS_SERIAL_PROCESS(mVotes);
|
||||
}
|
||||
|
||||
const std::ostream &print(std::ostream &out, std::string indent = "", std::string varName = "") const {
|
||||
out << indent << varName << " of RsGxsComment Values ###################" << std::endl;
|
||||
mMeta.print(out, indent + " ", "mMeta");
|
||||
out << indent << " mComment: " << mComment << std::endl;
|
||||
out << indent << " mUpVotes: " << mUpVotes << std::endl;
|
||||
out << indent << " mDownVotes: " << mDownVotes << std::endl;
|
||||
out << indent << " mScore: " << mScore << std::endl;
|
||||
out << indent << " mOwnVote: " << mOwnVote << std::endl;
|
||||
out << indent << " mVotes.size(): " << mVotes.size() << std::endl;
|
||||
out << indent << "######################################################" << std::endl;
|
||||
return out;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,12 +52,11 @@ namespace GXS_SERV {
|
|||
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_MASK = 0x0000ff00;
|
||||
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_NONE = 0x00000000;
|
||||
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_GPG = 0x00000100; // Anti-spam feature. Allows to ask higher reputation to anonymous IDs
|
||||
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_REQUIRED = 0x00000200; // unused
|
||||
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_REQUIRED = 0x00000200;
|
||||
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN = 0x00000400; // ???
|
||||
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES = 0x00000800; // not used anymore
|
||||
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN = 0x00001000; // Anti-spam feature. Allows to ask higher reputation to unknown IDs and anonymous IDs
|
||||
|
||||
// These are *not used*
|
||||
static const uint32_t FLAG_GROUP_SIGN_PUBLISH_MASK = 0x000000ff;
|
||||
static const uint32_t FLAG_GROUP_SIGN_PUBLISH_ENCRYPTED = 0x00000001;
|
||||
static const uint32_t FLAG_GROUP_SIGN_PUBLISH_ALLSIGNED = 0x00000002; // unused
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
* *
|
||||
* libretroshare: retroshare core library *
|
||||
* *
|
||||
* Copyright (C) 2012 by Robert Fernie <retroshare@lunamutt.com> *
|
||||
* Copyright (C) 2018 Gioacchino Mazzurco <gio@eigenlab.org> *
|
||||
* Copyright (C) 2012-2014 Robert Fernie <retroshare@lunamutt.com> *
|
||||
* Copyright (C) 2018-2019 Gioacchino Mazzurco <gio@eigenlab.org> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
|
|
@ -30,9 +30,9 @@
|
|||
#include "retroshare/rsgxsifacehelper.h"
|
||||
#include "serialiser/rstlvidset.h"
|
||||
#include "serialiser/rsserializable.h"
|
||||
#include "retroshare/rsgxscircles.h"
|
||||
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsGxsForums;
|
||||
|
||||
/**
|
||||
|
|
@ -43,8 +43,10 @@ extern RsGxsForums* rsGxsForums;
|
|||
|
||||
|
||||
/** Forum Service message flags, to be used in RsMsgMetaData::mMsgFlags
|
||||
* Gxs imposes to use the first two bytes (lower bytes) of mMsgFlags for
|
||||
* Gxs imposes to use the first two bytes (lower bytes) of mMsgFlags for
|
||||
* private forum flags, the upper bytes being used for internal GXS stuff.
|
||||
* @todo mixing service level flags and GXS level flag into the same member is
|
||||
* prone to confusion, use separated members for those things
|
||||
*/
|
||||
static const uint32_t RS_GXS_FORUM_MSG_FLAGS_MASK = 0x0000000f;
|
||||
static const uint32_t RS_GXS_FORUM_MSG_FLAGS_MODERATED = 0x00000001;
|
||||
|
|
@ -54,46 +56,52 @@ static const uint32_t RS_GXS_FORUM_MSG_FLAGS_MODERATED = 0x00000001;
|
|||
|
||||
struct RsGxsForumGroup : RsSerializable
|
||||
{
|
||||
virtual ~RsGxsForumGroup() {}
|
||||
|
||||
/** Forum GXS metadata */
|
||||
RsGroupMetaData mMeta;
|
||||
|
||||
/** @brief Forum desciption */
|
||||
std::string mDescription;
|
||||
|
||||
/* What's below is optional, and handled by the serialiser
|
||||
* TODO: run away from TLV old serializables as those types are opaque to
|
||||
* JSON API! */
|
||||
/** @brief List of forum moderators ids
|
||||
* @todo run away from TLV old serializables as those types are opaque to
|
||||
* JSON API! */
|
||||
RsTlvGxsIdSet mAdminList;
|
||||
|
||||
/** @brief List of forum pinned posts, those are usually displayed on top
|
||||
* @todo run away from TLV old serializables as those types are opaque to
|
||||
* JSON API! */
|
||||
RsTlvGxsMsgIdSet mPinnedPosts;
|
||||
|
||||
/// @see RsSerializable
|
||||
virtual void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx )
|
||||
{
|
||||
RS_SERIAL_PROCESS(mMeta);
|
||||
RS_SERIAL_PROCESS(mDescription);
|
||||
RS_SERIAL_PROCESS(mAdminList);
|
||||
RS_SERIAL_PROCESS(mPinnedPosts);
|
||||
}
|
||||
virtual void serial_process(
|
||||
RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx ) override;
|
||||
|
||||
// utility functions
|
||||
~RsGxsForumGroup() override;
|
||||
|
||||
bool canEditPosts(const RsGxsId& id) const { return mAdminList.ids.find(id) != mAdminList.ids.end() || id == mMeta.mAuthorId; }
|
||||
/* G10h4ck: We should avoid actual methods in this contexts as they are
|
||||
* invisible to JSON API */
|
||||
bool canEditPosts(const RsGxsId& id) const;
|
||||
};
|
||||
|
||||
struct RsGxsForumMsg : RsSerializable
|
||||
{
|
||||
virtual ~RsGxsForumMsg() {}
|
||||
|
||||
/** @brief Forum post GXS metadata */
|
||||
RsMsgMetaData mMeta;
|
||||
|
||||
/** @brief Forum post content */
|
||||
std::string mMsg;
|
||||
|
||||
/// @see RsSerializable
|
||||
virtual void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx )
|
||||
virtual void serial_process(
|
||||
RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx ) override
|
||||
{
|
||||
RS_SERIAL_PROCESS(mMeta);
|
||||
RS_SERIAL_PROCESS(mMsg);
|
||||
}
|
||||
|
||||
~RsGxsForumMsg() override;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -101,23 +109,67 @@ class RsGxsForums: public RsGxsIfaceHelper
|
|||
{
|
||||
public:
|
||||
explicit RsGxsForums(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {}
|
||||
virtual ~RsGxsForums() {}
|
||||
virtual ~RsGxsForums();
|
||||
|
||||
/**
|
||||
* @brief Create forum. Blocking API.
|
||||
* @brief Create forum.
|
||||
* @jsonapi{development}
|
||||
* @param[inout] forum Forum data (name, description...)
|
||||
* @return false on error, true otherwise
|
||||
* @param[in] name Name of the forum
|
||||
* @param[in] description Optional description of the forum
|
||||
* @param[in] authorId Optional id of the froum owner author
|
||||
* @param[in] moderatorsIds Optional list of forum moderators
|
||||
* @param[in] circleType Optional visibility rule, default public.
|
||||
* @param[in] circleId If the forum is not public specify the id of
|
||||
* the circle who can see the forum. Depending on
|
||||
* the value you pass for circleType this should
|
||||
* be a circle if EXTERNAL is passed, a local
|
||||
* friends group id if NODES_GROUP is passed,
|
||||
* empty otherwise.
|
||||
* @param[out] forumId Optional storage for the id of the created
|
||||
* forum, meaningful only if creations succeeds.
|
||||
* @param[out] errorMessage Optional storage for error messsage, meaningful
|
||||
* only if creation fail.
|
||||
* @return False on error, true otherwise.
|
||||
*/
|
||||
virtual bool createForum(RsGxsForumGroup& forum) = 0;
|
||||
virtual bool createForumV2(
|
||||
const std::string& name, const std::string& description,
|
||||
const RsGxsId& authorId = RsGxsId(),
|
||||
const std::set<RsGxsId>& moderatorsIds = std::set<RsGxsId>(),
|
||||
RsGxsCircleType circleType = RsGxsCircleType::PUBLIC,
|
||||
const RsGxsCircleId& circleId = RsGxsCircleId(),
|
||||
RsGxsGroupId& forumId = RS_DEFAULT_STORAGE_PARAM(RsGxsGroupId),
|
||||
std::string& errorMessage = RS_DEFAULT_STORAGE_PARAM(std::string)
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* @brief Create forum message. Blocking API.
|
||||
* @brief Create a post on the given forum.
|
||||
* @jsonapi{development}
|
||||
* @param[inout] message
|
||||
* @param[in] forumId Id of the forum in which the post is to be
|
||||
* submitted
|
||||
* @param[in] title UTF-8 string containing the title of the post
|
||||
* @param[in] mBody UTF-8 string containing the text of the post
|
||||
* @param[in] authorId Id of the author of the comment
|
||||
* @param[in] parentId Optional Id of the parent post if this post is a
|
||||
* reply to another post, empty otherwise.
|
||||
* @param[in] origPostId If this is supposed to replace an already
|
||||
* existent post, the id of the old post.
|
||||
* If left blank a new post will be created.
|
||||
* @param[out] postMsgId Optional storage for the id of the created,
|
||||
* meaningful only on success.
|
||||
* @param[out] errorMessage Optional storage for error message, meaningful
|
||||
* only on failure.
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool createMessage(RsGxsForumMsg& message) = 0;
|
||||
virtual bool createPost(
|
||||
const RsGxsGroupId& forumId,
|
||||
const std::string& title,
|
||||
const std::string& mBody,
|
||||
const RsGxsId& authorId,
|
||||
const RsGxsMessageId& parentId = RsGxsMessageId(),
|
||||
const RsGxsMessageId& origPostId = RsGxsMessageId(),
|
||||
RsGxsMessageId& postMsgId = RS_DEFAULT_STORAGE_PARAM(RsGxsMessageId),
|
||||
std::string& errorMessage = RS_DEFAULT_STORAGE_PARAM(std::string)
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* @brief Edit forum details.
|
||||
|
|
@ -167,7 +219,7 @@ public:
|
|||
*/
|
||||
virtual bool getForumContent(
|
||||
const RsGxsGroupId& forumId,
|
||||
std::set<RsGxsMessageId>& msgsIds,
|
||||
const std::set<RsGxsMessageId>& msgsIds,
|
||||
std::vector<RsGxsForumMsg>& msgs) = 0;
|
||||
|
||||
/**
|
||||
|
|
@ -189,6 +241,26 @@ public:
|
|||
virtual bool subscribeToForum( const RsGxsGroupId& forumId,
|
||||
bool subscribe ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Create forum. Blocking API.
|
||||
* @jsonapi{development}
|
||||
* @param[inout] forum Forum data (name, description...)
|
||||
* @return false on error, true otherwise
|
||||
* @deprecated @see createForumV2
|
||||
*/
|
||||
RS_DEPRECATED_FOR(createForumV2)
|
||||
virtual bool createForum(RsGxsForumGroup& forum) = 0;
|
||||
|
||||
/**
|
||||
* @brief Create forum message. Blocking API.
|
||||
* @jsonapi{development}
|
||||
* @param[inout] message
|
||||
* @return false on error, true otherwise
|
||||
* @deprecated @see createPost
|
||||
*/
|
||||
RS_DEPRECATED_FOR(createPost)
|
||||
virtual bool createMessage(RsGxsForumMsg& message) = 0;
|
||||
|
||||
/* Specific Service Data */
|
||||
RS_DEPRECATED_FOR("getForumsSummaries, getForumsInfo")
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsForumGroup> &groups) = 0;
|
||||
|
|
@ -203,4 +275,3 @@ public:
|
|||
RS_DEPRECATED_FOR(editForum)
|
||||
virtual bool updateGroup(uint32_t &token, RsGxsForumGroup &group) = 0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ struct RsGxsChanges : RsEvent
|
|||
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx) override
|
||||
{
|
||||
RsEvent::serial_process(j,ctx);
|
||||
RS_SERIAL_PROCESS(mServiceType);
|
||||
RS_SERIAL_PROCESS(mMsgs);
|
||||
RS_SERIAL_PROCESS(mMsgsMeta);
|
||||
|
|
@ -99,7 +100,7 @@ struct RsGxsChanges : RsEvent
|
|||
RS_SERIAL_PROCESS(mDistantSearchReqs);
|
||||
}
|
||||
|
||||
RsTokenService* mService; // Weak pointer, not serialized
|
||||
RsTokenService* mService; /// Weak pointer, not serialized
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -140,14 +140,20 @@ struct RsMsgMetaData : RsSerializable
|
|||
std::string mMsgName;
|
||||
rstime_t mPublishTs;
|
||||
|
||||
/// the lower 16 bits for service, upper 16 bits for GXS
|
||||
uint32_t mMsgFlags;
|
||||
/** the lower 16 bits for service, upper 16 bits for GXS
|
||||
* @todo mixing service level flags and GXS level flag into the same member
|
||||
* is prone to confusion, use separated members for those things, this could
|
||||
* be done without breaking network retro-compatibility */
|
||||
uint32_t mMsgFlags;
|
||||
|
||||
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
||||
// normally READ / UNREAD flags. LOCAL Data.
|
||||
|
||||
/// the first 16 bits for service, last 16 for GXS
|
||||
uint32_t mMsgStatus;
|
||||
/** the first 16 bits for service, last 16 for GXS
|
||||
* @todo mixing service level flags and GXS level flag into the same member
|
||||
* is prone to confusion, use separated members for those things, this could
|
||||
* be done without breaking network retro-compatibility */
|
||||
uint32_t mMsgStatus;
|
||||
|
||||
rstime_t mChildTs;
|
||||
std::string mServiceString; // Service Specific Free-Form extra storage.
|
||||
|
|
@ -169,25 +175,6 @@ struct RsMsgMetaData : RsSerializable
|
|||
RS_SERIAL_PROCESS(mChildTs);
|
||||
RS_SERIAL_PROCESS(mServiceString);
|
||||
}
|
||||
|
||||
const std::ostream &print(std::ostream &out, std::string indent = "", std::string varName = "") const {
|
||||
out
|
||||
<< indent << varName << " of RsMsgMetaData Values ###################" << std::endl
|
||||
<< indent << " mGroupId: " << mGroupId.toStdString() << std::endl
|
||||
<< indent << " mMsgId: " << mMsgId.toStdString() << std::endl
|
||||
<< indent << " mThreadId: " << mThreadId.toStdString() << std::endl
|
||||
<< indent << " mParentId: " << mParentId.toStdString() << std::endl
|
||||
<< indent << " mOrigMsgId: " << mOrigMsgId.toStdString() << std::endl
|
||||
<< indent << " mAuthorId: " << mAuthorId.toStdString() << std::endl
|
||||
<< indent << " mMsgName: " << mMsgName << std::endl
|
||||
<< indent << " mPublishTs: " << mPublishTs << std::endl
|
||||
<< indent << " mMsgFlags: " << std::hex << mMsgFlags << std::dec << std::endl
|
||||
<< indent << " mMsgStatus: " << std::hex << mMsgStatus << std::dec << std::endl
|
||||
<< indent << " mChildTs: " << mChildTs << std::endl
|
||||
<< indent << " mServiceString: " << mServiceString << std::endl
|
||||
<< indent << "######################################################" << std::endl;
|
||||
return out;
|
||||
}
|
||||
};
|
||||
|
||||
class GxsGroupStatistic
|
||||
|
|
|
|||
|
|
@ -1,3 +1,23 @@
|
|||
/*******************************************************************************
|
||||
* libretroshare/src/retroshare: rsgxstrans.h *
|
||||
* *
|
||||
* libretroshare: retroshare core library *
|
||||
* *
|
||||
* Copyright (C) 2016-2019 Gioacchino Mazzurco <gio@eigenlab.org> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version 3 as *
|
||||
* published by the Free Software Foundation. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include "retroshare/rstokenservice.h"
|
||||
|
|
@ -41,7 +61,8 @@ enum class GxsTransSendStatus : uint8_t
|
|||
/// Records with status >= RECEIPT_RECEIVED get deleted
|
||||
RECEIPT_RECEIVED = 0x0a,
|
||||
FAILED_RECEIPT_SIGNATURE = 0xf0,
|
||||
FAILED_ENCRYPTION = 0xf1
|
||||
FAILED_ENCRYPTION = 0xf1,
|
||||
FAILED_TIMED_OUT = 0xf2
|
||||
};
|
||||
|
||||
typedef uint64_t RsGxsTransId;
|
||||
|
|
@ -79,6 +100,7 @@ struct RsGxsTransOutgoingRecord
|
|||
RsGxsGroupId group_id ;
|
||||
};
|
||||
|
||||
/// RetroShare GxsTrans asyncronous redundant small mail trasport on top of GXS
|
||||
class RsGxsTrans: public RsGxsIfaceHelper
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -244,14 +244,22 @@ struct RsIdentityUsage : RsSerializable
|
|||
CIRCLE_MEMBERSHIP_CHECK = 0x13
|
||||
} ;
|
||||
|
||||
RS_DEPRECATED
|
||||
RsIdentityUsage( uint16_t service, const RsIdentityUsage::UsageCode& code,
|
||||
const RsGxsGroupId& gid = RsGxsGroupId(),
|
||||
const RsGxsMessageId& mid = RsGxsMessageId(),
|
||||
uint64_t additional_id=0,
|
||||
const std::string& comment = std::string() );
|
||||
|
||||
RsIdentityUsage( RsServiceType service,
|
||||
RsIdentityUsage::UsageCode code,
|
||||
const RsGxsGroupId& gid = RsGxsGroupId(),
|
||||
const RsGxsMessageId& mid = RsGxsMessageId(),
|
||||
uint64_t additional_id=0,
|
||||
const std::string& comment = std::string() );
|
||||
|
||||
/// Id of the service using that identity, as understood by rsServiceControl
|
||||
uint16_t mServiceId;
|
||||
RsServiceType mServiceId;
|
||||
|
||||
/** Specific code to use. Will allow forming the correct translated message
|
||||
* in the GUI if necessary. */
|
||||
|
|
@ -380,6 +388,7 @@ struct RsIdentity : RsGxsIfaceHelper
|
|||
|
||||
/**
|
||||
* @brief Get identity details, from the cache
|
||||
* @jsonapi{development}
|
||||
* @param[in] id Id of the identity
|
||||
* @param[out] details Storage for the identity details
|
||||
* @return false on error, true otherwise
|
||||
|
|
@ -400,7 +409,7 @@ struct RsIdentity : RsGxsIfaceHelper
|
|||
* @param[out] ids storage for the ids
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool getOwnSignedIds(std::vector<RsGxsId> ids) = 0;
|
||||
virtual bool getOwnSignedIds(std::vector<RsGxsId>& ids) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get own pseudonimous (unsigned) ids
|
||||
|
|
@ -408,7 +417,7 @@ struct RsIdentity : RsGxsIfaceHelper
|
|||
* @param[out] ids storage for the ids
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool getOwnPseudonimousIds(std::vector<RsGxsId> ids) = 0;
|
||||
virtual bool getOwnPseudonimousIds(std::vector<RsGxsId>& ids) = 0;
|
||||
|
||||
/**
|
||||
* @brief Check if an id is own
|
||||
|
|
@ -468,6 +477,7 @@ struct RsIdentity : RsGxsIfaceHelper
|
|||
|
||||
/**
|
||||
* @brief Set/unset identity as contact
|
||||
* @jsonapi{development}
|
||||
* @param[in] id Id of the identity
|
||||
* @param[in] isContact true to set, false to unset
|
||||
* @return false on error, true otherwise
|
||||
|
|
@ -503,6 +513,14 @@ struct RsIdentity : RsGxsIfaceHelper
|
|||
*/
|
||||
virtual void setDeleteBannedNodesThreshold(uint32_t days) = 0;
|
||||
|
||||
/**
|
||||
* @brief request details of a not yet known identity to the network
|
||||
* @jsonapi{development}
|
||||
* @param[in] id id of the identity to request
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool requestIdentity(const RsGxsId& id) = 0;
|
||||
|
||||
|
||||
RS_DEPRECATED
|
||||
virtual bool getGroupSerializedData(
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
/*******************************************************************************
|
||||
* libretroshare/src/retroshare: rsinit.h *
|
||||
* *
|
||||
* libretroshare: retroshare core library *
|
||||
* *
|
||||
* Copyright 2004-2006 by Robert Fernie <retroshare@lunamutt.com> *
|
||||
* Copyright (C) 2004-2014 Robert Fernie <retroshare@lunamutt.com> *
|
||||
* Copyright (C) 2016-2019 Gioacchino Mazzurco <gio@altermundi.net> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
|
|
@ -19,8 +18,10 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#ifndef RETROSHARE_INIT_INTERFACE_H
|
||||
#define RETROSHARE_INIT_INTERFACE_H
|
||||
#pragma once
|
||||
|
||||
/// RetroShare initialization and login API
|
||||
|
||||
|
||||
// Initialize ok, result >= 0
|
||||
#define RS_INIT_OK 0 // Initialize ok
|
||||
|
|
@ -30,13 +31,6 @@
|
|||
#define RS_INIT_BASE_DIR_ERROR -2 // AuthGPG::InitAuth failed
|
||||
#define RS_INIT_NO_KEYRING -3 // Keyring is empty. Need to import it.
|
||||
|
||||
|
||||
/****
|
||||
* #define RS_USE_PGPSSL 1
|
||||
***/
|
||||
|
||||
#define RS_USE_PGPSSL 1
|
||||
|
||||
#include <stdint.h>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
|
@ -340,5 +334,3 @@ struct RsLoginHelper
|
|||
*/
|
||||
bool isLoggedIn();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -470,6 +470,8 @@ public:
|
|||
std::map<RsGxsId, rstime_t> gxs_ids ; // list of non direct friend who participate. Used to display only.
|
||||
rstime_t last_activity ; // last recorded activity. Useful for removing dead lobbies.
|
||||
|
||||
virtual void clear() { gxs_ids.clear(); lobby_id = 0; lobby_name.clear(); lobby_topic.clear(); participating_friends.clear(); }
|
||||
|
||||
// RsSerializable interface
|
||||
public:
|
||||
void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext &ctx) {
|
||||
|
|
@ -831,6 +833,13 @@ virtual void getOwnAvatarData(unsigned char *& data,int& size) = 0 ;
|
|||
*/
|
||||
virtual void unsubscribeChatLobby(const ChatLobbyId &lobby_id) = 0;
|
||||
|
||||
/**
|
||||
* @brief sendLobbyStatusPeerLeaving notify friend nodes that we're leaving a subscribed lobby
|
||||
* @jsonapi{development}
|
||||
* @param[in] lobby_id lobby to leave
|
||||
*/
|
||||
virtual void sendLobbyStatusPeerLeaving(const ChatLobbyId& lobby_id) = 0;
|
||||
|
||||
/**
|
||||
* @brief setIdentityForChatLobby set the chat identit
|
||||
* @jsonapi{development}
|
||||
|
|
|
|||
|
|
@ -212,6 +212,8 @@ public:
|
|||
NotifyClient() {}
|
||||
virtual ~NotifyClient() {}
|
||||
|
||||
virtual void notifyPeerConnected (const std::string& /* peer_id */) {}
|
||||
virtual void notifyPeerDisconnected (const std::string& /* peer_id */) {}
|
||||
virtual void notifyListPreChange (int /* list */, int /* type */) {}
|
||||
virtual void notifyListChange (int /* list */, int /* type */) {}
|
||||
virtual void notifyErrorMsg (int /* list */, int /* sev */, std::string /* msg */) {}
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ struct RsPeerDetails : RsSerializable
|
|||
|
||||
RsPgpId issuer;
|
||||
|
||||
PGPFingerprintType fpr; /* pgp fingerprint */
|
||||
RsPgpFingerprint fpr; /* pgp fingerprint */
|
||||
std::string authcode; // TODO: 2015/12/31 (cyril) what is this used for ?????
|
||||
std::list<RsPgpId> gpgSigners;
|
||||
|
||||
|
|
@ -499,9 +499,9 @@ public:
|
|||
virtual RsPgpId getGPGId(const RsPeerId& sslId) = 0;
|
||||
virtual bool isKeySupported(const RsPgpId& gpg_ids) = 0;
|
||||
virtual bool getGPGAcceptedList(std::list<RsPgpId> &gpg_ids) = 0;
|
||||
virtual bool getGPGSignedList(std::list<RsPgpId> &gpg_ids) = 0;//friends that we accpet to connect with but we don't want to sign their gpg key
|
||||
virtual bool getGPGValidList(std::list<RsPgpId> &gpg_ids) = 0;
|
||||
virtual bool getGPGAllList(std::list<RsPgpId> &gpg_ids) = 0;
|
||||
virtual bool getGPGSignedList(std::list<RsPgpId> &gpg_ids) = 0;// keys signed by our own PGP key.
|
||||
virtual bool getGPGValidList(std::list<RsPgpId> &gpg_ids) = 0;// all PGP keys without filtering
|
||||
virtual bool getGPGAllList(std::list<RsPgpId> &gpg_ids) = 0;// all PGP keys as well
|
||||
virtual bool getAssociatedSSLIds(const RsPgpId& gpg_id, std::list<RsPeerId>& ids) = 0;
|
||||
virtual bool gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen, std::string reason = "") = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue