Merging branches/v0.6-initdev into trunk.

These split at 6672 -> 7075, so quite a bit merge.
libretroshare compiles - but untested.
retroshare-gui needs GenCertDialog.ui and IdEditDialog.ui to be properly merged. (compile errors).
some plugins will be broken.
retroshare-nogui is untested.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7078 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2014-02-01 14:16:15 +00:00
commit c0738eec7f
407 changed files with 23716 additions and 50779 deletions

View file

@ -1,154 +0,0 @@
#ifndef RS_BLOG_GUI_INTERFACE_H
#define RS_BLOG_GUI_INTERFACE_H
/*
* libretroshare/src/rsiface: rsblogs.h
*
* RetroShare C++ Interface.
*
* Copyright 2008 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include <list>
#include <iostream>
#include <string>
#include "rstypes.h"
#include "rsdistrib.h" /* For FLAGS */
class BlogInfo
{
public:
BlogInfo() {}
std::string blogId;
std::wstring blogName;
std::wstring blogDesc;
uint32_t blogFlags;
uint32_t pop;
unsigned char* pngChanImage;
uint32_t pngImageLen;
time_t lastPost;
};
class BlogMsgInfo
{
public:
BlogMsgInfo() {}
std::string blogId;
std::string msgId;
/// this has a value if replying to another msg
std::string msgIdReply;
unsigned int msgflags;
std::wstring subject;
std::wstring msg;
time_t ts;
std::list<FileInfo> files;
uint32_t count;
uint64_t size;
};
class BlogMsgSummary
{
public:
BlogMsgSummary() {}
std::string blogId;
std::string msgId;
uint32_t msgflags;
std::wstring subject;
std::wstring msg;
std::string msgIdReply;
uint32_t count; /* file count */
time_t ts;
};
std::ostream &operator<<(std::ostream &out, const BlogInfo &info);
std::ostream &operator<<(std::ostream &out, const BlogMsgSummary &info);
std::ostream &operator<<(std::ostream &out, const BlogMsgInfo &info);
class RsBlogs;
extern RsBlogs *rsBlogs;
class RsBlogs
{
public:
RsBlogs() { return; }
virtual ~RsBlogs() { return; }
/****************************************/
/*!
* Checks if the group a blod id belongs to has changed
*/
virtual bool blogsChanged(std::list<std::string> &blogIds) = 0;
virtual std::string createBlog(std::wstring blogName, std::wstring blogDesc, uint32_t blogFlags,
unsigned char* pngImageData, uint32_t imageSize) = 0;
virtual bool getBlogInfo(std::string cId, BlogInfo &ci) = 0;
virtual bool getBlogList(std::list<BlogInfo> &chanList) = 0;
virtual bool getBlogMsgList(std::string cId, std::list<BlogMsgSummary> &msgs) = 0;
/*!
* Retrieves a specific blog Msg based on group Id and message Id
*/
virtual bool getBlogMessage(std::string cId, std::string mId, BlogMsgInfo &msg) = 0;
/*!
* Can send blog message to user
* @param info the message
*/
virtual bool BlogMessageSend(BlogMsgInfo &info) = 0;
/*!
* Allows user to subscribe to a blog via group ID
* @param cId group id
* @param subscribe determine subscription based on value
*/
virtual bool blogSubscribe(std::string cId, bool subscribe) = 0;
/*!
* Commenting on other user's blogs, ensure field info has a valid info.msgIdReply has valid msg id, this
* points to which message the blog reply is replying to
*/
virtual bool BlogMessageReply(BlogMsgInfo &info) = 0;
/*!
*
*/
virtual bool isReply(BlogMsgInfo &info) = 0;
/****************************************/
};
#endif

View file

@ -1,283 +0,0 @@
#ifndef RS_CHANNEL_GUI_INTERFACE_H
#define RS_CHANNEL_GUI_INTERFACE_H
/*
* libretroshare/src/rsiface: rschannels.h
*
* RetroShare C++ Interface.
*
* Copyright 2008 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include <list>
#include <iostream>
#include <string>
#include "rstypes.h"
#include "rsdistrib.h" /* For FLAGS */
#define CHANNEL_MSG_STATUS_MASK 0x000f
#define CHANNEL_MSG_STATUS_READ 0x0001
#define CHANNEL_MSG_STATUS_UNREAD_BY_USER 0x0002
#define CHANNEL_MSG_STATUS_DOWLOADED 0x0004
//! Stores information for a give channel id
/*!
* Stores all information for a given channel id
*/
class ChannelInfo
{
public:
ChannelInfo() : autoDownload(false), pngChanImage(NULL), pngImageLen(0)
{}
std::string channelId;
std::wstring channelName;
std::wstring channelDesc;
uint32_t channelFlags;
uint32_t pop; /// popularity
bool autoDownload;
unsigned char* pngChanImage;
uint32_t pngImageLen;
time_t lastPost;
std::string destination_directory ;
};
//! for storing a channel msgs thumbnail picture
class ChannelMsgThumbnail
{
public:
ChannelMsgThumbnail() : image_thumbnail(NULL), im_thumbnail_size(0) {}
unsigned char* image_thumbnail;
int im_thumbnail_size;
};
//! Stores information on a message within a channel
class ChannelMsgInfo
{
public:
ChannelMsgInfo () : count(0), size(0) {}
std::string channelId;
std::string msgId;
unsigned int msgflags;
std::wstring subject;
std::wstring msg;
time_t ts; /// time stamp
std::list<FileInfo> files;
uint32_t count; /// file count
uint64_t size; /// size of all files
ChannelMsgThumbnail thumbnail;
};
//! gives a more brief account of a channel message than channelMsgInfo
class ChannelMsgSummary
{
public:
ChannelMsgSummary() : count(0) {}
std::string channelId;
std::string msgId;
uint32_t msgflags;
std::wstring subject;
std::wstring msg;
uint32_t count; /// file count
time_t ts; /// time stamp
};
std::ostream &operator<<(std::ostream &out, const ChannelInfo &info);
std::ostream &operator<<(std::ostream &out, const ChannelMsgSummary &info);
std::ostream &operator<<(std::ostream &out, const ChannelMsgInfo &info);
class RsChannels;
extern RsChannels *rsChannels;
/*!
* retroshare interface to the channels distributed group service
* Channels user to create feeds similar to RSS feed where you can share files
* with other users, when you subscribe to a channel you immediately begin downloading
* the file shared on that channel. Channel feeds are shared anonymously
*/
class RsChannels
{
public:
RsChannels() { return; }
virtual ~RsChannels() { return; }
/****************************************/
/*!
* returns a list of channel id that have changed (i.e. received new message, chan descr update)
* @param chanIds this is populated with channel ids that have changed
*/
virtual bool channelsChanged(std::list<std::string> &chanIds) = 0;
/*!
* @param chanName name of the channel
* @param chanDesc a short description for the created channel
* @param chanFlags admin details on created channel group see rsdistrib.h for flags types
* @param pngImageData point at image data in PNG format
* @param imageSize size of the image data
*/
virtual std::string createChannel(std::wstring chanName, std::wstring chanDesc, uint32_t chanFlags,
unsigned char* pngImageData, uint32_t imageSize) = 0;
/*!
* retrieve channel information
* @param cId channel id
* @param ci channel info is store here
*/
virtual bool getChannelInfo(const std::string &cId, ChannelInfo &ci) = 0;
/*!
* @param chanList populated channelinfo for all channels
*/
virtual bool getChannelList(std::list<ChannelInfo> &chanList) = 0;
/*!
* get a message summary list for a given channel id
* @param cId channel id user wants messages for
* @param msgs summary of messages for the given cId
*/
virtual bool getChannelMsgList(const std::string &cId, std::list<ChannelMsgSummary> &msgs) = 0;
/*!
* retrieve more comprehensive message info given channel id and message id
*/
virtual bool getChannelMessage(const std::string &cId, const std::string &mId, ChannelMsgInfo &msg) = 0;
/*!
* set message status
* @param cId channel id
* @param mId message id
* @param status status to set
* @param statusMask bitmask to modify
*/
virtual bool setMessageStatus(const std::string& cId,const std::string& mId, const uint32_t status, const uint32_t statusMask) = 0;
/*!
* set message status
* @param cId channel id
* @param mId message id
* @param status status
*/
virtual bool getMessageStatus(const std::string& cId, const std::string& mId, uint32_t& status) = 0;
/*!
* count the new and unread messages
* @param cId channel id
* @param newCount count of new messages
* @param unreadCount count of unread messages
*/
virtual bool getMessageCount(const std::string &cId, unsigned int &newCount, unsigned int &unreadCount) = 0;
/*!
* send message contain in message info to the id indicated within it (make sure you set the channel id of the message info)
* @param info message to be sent
*/
virtual bool ChannelMessageSend(ChannelMsgInfo &info) = 0;
/*!
* @param cId the channel id
* @param subscribe set to true if you want to subscribe and to false to unsubscribe
* @param set true to allow autodownload of new content and false otherwise, ignored when second param is false
*/
virtual bool channelSubscribe(const std::string &cId, bool subscribe, bool autoDl) = 0;
/*!
* This hashes a file which is not already shared by client or his peers,
* The file is copied into the channels directory if its not too large (> 100mb)
* @param path This is full path to file
* @param channel Id
*/
virtual bool channelExtraFileHash(const std::string &path, const std::string &chId, FileInfo& fInfo) = 0;
/*!
* This removes hashed extra files, and also removes channels directory copy if it exists
* @param chId channel id
*/
virtual bool channelExtraFileRemove(const std::string &hash, const std::string &chId) = 0;
/*!
* Restores channel private keys for channel in the event keys stored in configuration files are lost
* @param chId channel id to restore keys for
*/
virtual bool channelRestoreKeys(const std::string &chId) = 0;
/*!
* shares keys with peers
*@param chId the channel for which private publish keys will be shared
*@param peers peers in this list will be sent keys
*
*/
virtual bool channelShareKeys(const std::string &chId, std::list<std::string>& peers) = 0;
/****************************************/
/*!
* allows peers to change information for the channel:
* can only change channel image, descriptions and name
*
*/
virtual bool channelEditInfo(const std::string &chId, ChannelInfo &ci) = 0;
/*!
* get list of channels for which private publish key is available
* @param grpIds list of channels for which private publish key is available
*/
virtual void getPubKeysAvailableGrpIds(std::list<std::string>& chanIds) = 0;
/*!
* set the channel so that it does not auto download any more
* @param chId the channel id to set for
* @param set to true to enable auto dl and false to disable
*/
virtual bool channelSetAutoDl(const std::string& chId, bool autoDl) = 0;
// sets the defautl destination directory for files downloaded in this channel.
// Default is "" which means Downloads/
virtual bool channelSetDestinationDirectory(const std::string& cid,const std::string& dir) = 0 ;
/*!
* get what autoDl is set to for the given channel id
* @param chId id of channel to get autoDl status for
* @param autoDl
* @return false if channel cannot be found
*/
virtual bool channelGetAutoDl(const std::string& chId, bool& autoDl) = 0;
};
#endif

View file

@ -42,9 +42,9 @@ class RsDisc
RsDisc() { return; }
virtual ~RsDisc() { return; }
virtual bool getDiscFriends(std::string id, std::list<std::string>& friends) = 0;
virtual bool getDiscGPGFriends(std::string id, std::list<std::string>& gpg_friends) = 0;
virtual bool getDiscVersions(std::map<std::string, std::string> &versions) = 0;
virtual bool getDiscFriends(const std::string &id, std::list<std::string>& friends) = 0;
virtual bool getDiscPgpFriends(const std::string &pgpid, std::list<std::string>& gpg_friends) = 0;
virtual bool getPeerVersion(const std::string &id, std::string &versions) = 0;
virtual bool getWaitingDiscCount(unsigned int *sendCount, unsigned int *recvCount) = 0;
};

View file

@ -1,56 +0,0 @@
#ifndef RS_DISTRIB_GUI_INTERFACE_H
#define RS_DISTRIB_GUI_INTERFACE_H
/*
* libretroshare/src/rsiface: rsdistrib.h
*
* RetroShare C++ Interface.
*
* Copyright 2007-2008 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#define RS_DISTRIB_PRIVACY_MASK 0x0000000f /* who can publish & view */
#define RS_DISTRIB_AUTHEN_MASK 0x000000f0 /* how to publish */
#define RS_DISTRIB_LISTEN_MASK 0x00000f00 /* distribution flags */
#define RS_DISTRIB_UPDATE_MASK 0x0000f000 /* if sending a group info update */
#define RS_DISTRIB_MISC_MASK 0x00ff0000 /* if sending a group info update */
#define RS_DISTRIB_PUBLIC 0x00000001 /* anyone can publish */
#define RS_DISTRIB_PRIVATE 0x00000002 /* anyone with key can publish */
#define RS_DISTRIB_ENCRYPTED 0x00000004 /* need publish key to view */
#define RS_DISTRIB_AUTHEN_REQ 0x00000010 /* you must sign messages */
#define RS_DISTRIB_AUTHEN_ANON 0x00000020 /* you can send anonymous messages */
#define RS_DISTRIB_ADMIN 0x00000100
#define RS_DISTRIB_PUBLISH 0x00000200
#define RS_DISTRIB_SUBSCRIBED 0x00000400
#define RS_DISTRIB_UPDATE 0x00001000
/* don't know if this should go with the above flags, as it message specific, and not a group settings.
* As it is currently not stored any configuration, it can be changed.
*/
#define RS_DISTRIB_MISSING_MSG 0x00010000
#endif

View file

@ -1,167 +0,0 @@
#ifndef RS_FORUM_GUI_INTERFACE_H
#define RS_FORUM_GUI_INTERFACE_H
/*
* libretroshare/src/rsiface: rsforums.h
*
* RetroShare C++ Interface.
*
* Copyright 2007-2008 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include <list>
#include <iostream>
#include <string>
#include "rstypes.h"
#include "rsdistrib.h" /* For FLAGS */
#define FORUM_MSG_STATUS_MASK 0x000f
#define FORUM_MSG_STATUS_READ 0x0001
#define FORUM_MSG_STATUS_UNREAD_BY_USER 0x0002
#define FORUM_MSG_STATUS_LOAD_EMBEDDED_IMAGES 0x0004
class ForumInfo
{
public:
ForumInfo()
{
forumFlags = 0 ;
subscribeFlags = 0 ;
pop = 0 ;
lastPost = 0 ;
}
std::string forumId;
std::wstring forumName;
std::wstring forumDesc;
uint32_t forumFlags;
uint32_t subscribeFlags;
uint32_t pop;
time_t lastPost;
};
class ForumMsgInfo
{
public:
ForumMsgInfo()
{
msgflags = 0 ;
ts = childTS = status = 0 ;
}
std::string forumId;
std::string threadId;
std::string parentId;
std::string msgId;
std::string srcId; /* if Authenticated -> signed here */
unsigned int msgflags;
std::wstring title;
std::wstring msg;
time_t ts;
time_t childTS;
uint32_t status;
};
class ThreadInfoSummary
{
public:
ThreadInfoSummary()
{
msgflags = 0 ;
count = 0 ;
ts = childTS = 0 ;
}
std::string forumId;
std::string threadId;
std::string parentId;
std::string msgId;
uint32_t msgflags;
std::wstring title;
std::wstring msg;
int count; /* file count */
time_t ts;
time_t childTS;
};
std::ostream &operator<<(std::ostream &out, const ForumInfo &info);
std::ostream &operator<<(std::ostream &out, const ThreadInfoSummary &info);
std::ostream &operator<<(std::ostream &out, const ForumMsgInfo &info);
class RsForums;
extern RsForums *rsForums;
class RsForums
{
public:
RsForums() { return; }
virtual ~RsForums() { return; }
/****************************************/
virtual bool forumsChanged(std::list<std::string> &forumIds) = 0;
virtual std::string createForum(const std::wstring &forumName, const std::wstring &forumDesc, uint32_t forumFlags) = 0;
virtual bool getForumInfo(const std::string &fId, ForumInfo &fi) = 0;
/*!
* allows peers to change information for the forum:
* can only change name and descriptions
*
*/
virtual bool setForumInfo(const std::string &fId, ForumInfo &fi) = 0;
virtual bool getForumList(std::list<ForumInfo> &forumList) = 0;
virtual bool getForumThreadList(const std::string &fId, std::list<ThreadInfoSummary> &msgs) = 0;
virtual bool getForumThreadMsgList(const std::string &fId, const std::string &pId, std::list<ThreadInfoSummary> &msgs) = 0;
virtual bool getForumMessage(const std::string &fId, const std::string &mId, ForumMsgInfo &msg) = 0;
virtual bool setMessageStatus(const std::string& fId,const std::string& mId, const uint32_t status, const uint32_t statusMask) = 0;
virtual bool getMessageStatus(const std::string& fId, const std::string& mId, uint32_t& status) = 0;
virtual bool ForumMessageSend(ForumMsgInfo &info) = 0;
virtual bool forumRestoreKeys(const std::string& fId) = 0;
virtual bool forumSubscribe(const std::string &fId, bool subscribe) = 0;
/*!
* shares keys with peers
*@param fId the forum for which private publish keys will be shared
*@param peers list of peers to be sent keys
*
*/
virtual bool forumShareKeys(std::string fId, std::list<std::string>& peers) = 0;
virtual bool getMessageCount(const std::string &fId, unsigned int &newCount, unsigned int &unreadCount) = 0;
/****************************************/
};
#endif

View file

@ -1,113 +0,0 @@
#ifndef RS_GAME_GUI_INTERFACE_H
#define RS_GAME_GUI_INTERFACE_H
/*
* libretroshare/src/rsiface: rsgame.h
*
* RetroShare C++ Interface.
*
* Copyright 2007-2008 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include "rstypes.h"
class RsGameLauncher;
/* declare single RsIface for everyone to use! */
extern RsGameLauncher *rsGameLauncher;
#include <map>
#include <string>
#include <inttypes.h>
class RsGameInfo
{
public:
std::string gameId;
std::string serverId;
std::string gameType;
std::wstring gameName;
std::string serverName;
std::string status;
uint16_t numPlayers;
};
class RsGamePeer
{
public:
std::string id;
bool invite;
bool interested;
bool play;
};
class RsGameDetail
{
public:
std::string gameId;
std::string gameType;
std::wstring gameName;
bool areServer; /* are we the server? */
std::string serverId; /* if not, who is? */
std::string serverName;
std::string status;
uint16_t numPlayers;
std::map<std::string, RsGamePeer> gamers;
};
class RsGameLauncher
{
public:
/* server commands */
virtual std::string createGame(uint32_t gameType, std::wstring name) = 0;
virtual bool deleteGame(std::string gameId) = 0;
virtual bool inviteGame(std::string gameId) = 0;
virtual bool playGame(std::string gameId) = 0;
//virtual bool quitGame(std::string gameId) = 0;
virtual bool invitePeer(std::string gameId, std::string peerId) = 0;
virtual bool uninvitePeer(std::string gameId, std::string peerId) = 0;
virtual bool confirmPeer(std::string gameId, std::string peerId,
int16_t pos = -1) = 0;
virtual bool unconfirmPeer(std::string gameId, std::string peerId) = 0;
/* client commands */
virtual bool interestedPeer(std::string gameId) = 0;
virtual bool uninterestedPeer(std::string gameId) = 0;
/* get details */
virtual bool getGameList(std::list<RsGameInfo> &gameList) = 0;
virtual bool getGameDetail(std::string gameId, RsGameDetail &detail) = 0;
};
#endif

View file

@ -84,6 +84,14 @@ virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgI
virtual bool createGroup(uint32_t &token, RsGxsForumGroup &group) = 0;
virtual bool createMsg(uint32_t &token, RsGxsForumMsg &msg) = 0;
/*!
* To update forum group with new information
* @param token the token used to check completion status of update
* @param group group to be updated, groupId element must be set or will be rejected
* @return false groupId not set, true if set and accepted (still check token for completion)
*/
virtual bool updateGroup(uint32_t &token, RsGxsGroupUpdateMeta&, RsGxsForumGroup &group) = 0;
};

View file

@ -46,8 +46,9 @@ public:
mGroupStatus = 0;
mCircleType = 0;
mAuthenFlags = 0;
//mPublishTs = 0;
mPublishTs = 0;
}
void operator =(const RsGxsGrpMetaData& rGxsMeta);
@ -64,6 +65,7 @@ public:
std::string mCircleId;
uint32_t mCircleType;
uint32_t mAuthenFlags;
std::string mParentGrpId;
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
@ -128,7 +130,6 @@ public:
class GxsGroupStatistic
{
public:
/// number of message
RsGxsGroupId mGrpId;
uint32_t mNumMsgs;
@ -147,4 +148,56 @@ public:
uint32_t mSizeStore;
};
class UpdateItem
{
public:
virtual ~UpdateItem() { }
};
class StringUpdateItem : public UpdateItem
{
public:
StringUpdateItem(const std::string update) : mUpdate(update) {}
const std::string& getUpdate() const { return mUpdate; }
private:
std::string mUpdate;
};
class RsGxsGroupUpdateMeta
{
public:
// expand as support is added for other utypes
enum UpdateType { DESCRIPTION, NAME };
RsGxsGroupUpdateMeta(const std::string& groupId) : mGroupId(groupId) {}
typedef std::map<UpdateType, std::string> GxsMetaUpdate;
/*!
* Only one item of a utype can exist
* @param utype the type of meta update
* @param item update item containing the change value
*/
void setMetaUpdate(UpdateType utype, const std::string& update)
{
mUpdates[utype] = update;
}
/*!
* @param utype update type to remove
* @return false if update did not exist, true if update successfully removed
*/
bool removeUpdateType(UpdateType utype){ return mUpdates.erase(utype) == 1; }
const GxsMetaUpdate* getUpdates() const { return &mUpdates; }
const std::string& getGroupId() const { return mGroupId; }
private:
GxsMetaUpdate mUpdates;
std::string mGroupId;
};
#endif /* RSGXSIFACETYPES_H_ */

View file

@ -55,6 +55,8 @@ extern RsIdentity *rsIdentity;
#define RSID_RELATION_OTHER 0x0008
#define RSID_RELATION_UNKNOWN 0x0010
#define RSRECOGN_MAX_TAGINFO 5
std::string rsIdTypeToString(uint32_t idtype);
class RsGxsIdGroup
@ -82,6 +84,9 @@ class RsGxsIdGroup
std::string mPgpIdHash;
std::string mPgpIdSign; // Need a signature as proof - otherwise anyone could add others Hashes.
// Recognition Strings. MAX# defined above.
std::list<std::string> mRecognTags;
// Not Serialised - for GUI's benefit.
bool mPgpKnown;
std::string mPgpId;
@ -163,6 +168,36 @@ class RsIdOpinion
typedef std::string RsGxsId; // TMP. =>
class RsRecognTag
{
public:
RsRecognTag(uint16_t tc, uint16_t tt, bool v)
:tag_class(tc), tag_type(tt), valid(v) { return; }
uint16_t tag_class;
uint16_t tag_type;
bool valid;
};
class RsRecognTagDetails
{
public:
RsRecognTagDetails()
:valid_from(0), valid_to(0), tag_class(0), tag_type(0),
is_valid(false), is_pending(false) { return; }
time_t valid_from;
time_t valid_to;
uint16_t tag_class;
uint16_t tag_type;
std::string signer;
bool is_valid;
bool is_pending;
};
class RsIdentityDetails
{
public:
@ -181,6 +216,9 @@ class RsIdentityDetails
bool mPgpKnown;
std::string mPgpId;
// Recogn details.
std::list<RsRecognTag> mRecognTags;
// reputation details.
double mOpinion;
double mReputation;
@ -230,6 +268,13 @@ virtual bool getOwnIds(std::list<RsGxsId> &ownIds) = 0;
virtual bool submitOpinion(uint32_t& token, RsIdOpinion &opinion) = 0;
virtual bool createIdentity(uint32_t& token, RsIdentityParameters &params) = 0;
virtual bool updateIdentity(uint32_t& token, RsGxsIdGroup &group) = 0;
virtual bool parseRecognTag(const RsGxsId &id, const std::string &nickname,
const std::string &tag, RsRecognTagDetails &details) = 0;
virtual bool getRecognTagRequest(const RsGxsId &id, const std::string &comment,
uint16_t tag_class, uint16_t tag_type, std::string &tag) = 0;
// Specific RsIdentity Functions....
/* Specific Service Data */
/* We expose these initially for testing / GUI purposes.

View file

@ -72,65 +72,31 @@ class RsInit
static bool isPortable();
static bool isWindowsXP();
/*!
* Account Details (Combined GPG+SSL Setup)
*/
static bool getPreferedAccountId(std::string &id);
static bool getPGPEngineFileName(std::string &fileName);
static bool getAccountIds(std::list<std::string> &ids);
static bool getAccountDetails(const std::string &id, std::string &gpgId, std::string &gpgName, std::string &gpgEmail, std::string &sslName);
static bool ValidateCertificate(std::string &userName) ;
static bool exportIdentity(const std::string& fname,const std::string& pgp_id) ;
static bool importIdentity(const std::string& fname,std::string& imported_pgp_id,std::string& import_error) ;
/*!
* Generating GPGme Account
*/
static bool collectEntropy(uint32_t bytes) ;
static int GetPGPLogins(std::list<std::string> &pgpIds);
static int GetPGPLoginDetails(const std::string& id, std::string &name, std::string &email);
static bool GeneratePGPCertificate(const std::string&, const std::string& email, const std::string& passwd, std::string &pgpId, std::string &errString);
// copies existing gnupg keyrings to the new place of the OpenPGP-SDK version. Returns true on success.
static bool copyGnuPGKeyrings() ;
/*!
* Login GGP
* Setup Hidden Location;
*/
static bool SelectGPGAccount(const std::string& gpgId);
static bool LoadGPGPassword(const std::string& passwd);
static bool SetHiddenLocation(const std::string& hiddenaddress, uint16_t port);
static bool LoadPassword(const std::string& passwd) ;
/*!
* Create SSL Certificates
*/
static bool GenerateSSLCertificate(const std::string& name, const std::string& org, const std::string& loc, const std::string& country, const std::string& passwd, std::string &sslId, std::string &errString);
/*!
* intialises directories for passwords and ssl keys
*/
static bool LoadPassword(const std::string& id, const std::string& passwd) ;
/*!
* Final Certificate load. This can be called if:
* a) InitRetroshare() returns RS_INIT_HAVE_ACCOUNT -> autoLoad/password Set.
* b) SelectGPGAccount() && LoadPassword()
* b) or LoadPassword()
*
* This wrapper is used to lock the profile first before
* finalising the login
* This uses the preferredId from RsAccounts.
* This wrapper also locks the profile before finalising the login
*/
static int LockAndLoadCertificates(bool autoLoginNT, std::string& lockFilePath);
/*!
* Post Login Options
*/
static std::string RsConfigDirectory();
static std::string RsConfigKeysDirectory();
static std::string RsPGPDirectory();
static std::string RsProfileConfigDirectory();
static bool getStartMinimised() ;
static std::string getRetroShareLink();
@ -139,26 +105,15 @@ class RsInit
static void setAutoLogin(bool autoLogin);
static bool RsClearAutoLogin() ;
/* used for static install data */
static std::string getRetroshareDataDirectory();
static std::map<std::string,std::vector<std::string> > unsupported_keys ;
private:
/* PreLogin */
static std::string getHomePath() ;
static bool setupBaseDir();
/* Account Details */
static bool get_configinit(const std::string& dir, std::string &id);
static bool create_configinit(const std::string& dir, const std::string& id);
static bool setupAccount(const std::string& accountdir);
#if 0
/* Auto Login */
static bool RsStoreAutoLogin() ;
static bool RsTryAutoLogin() ;
#endif
// THESE CAN BE REMOVED FROM THE CLASS TOO.
/* Lock/unlock profile directory */
static int LockConfigDirectory(const std::string& accountDir, std::string& lockFilePath);
static void UnlockConfigDirectory();
@ -168,4 +123,43 @@ class RsInit
};
/* Seperate Class for dealing with Accounts */
namespace RsAccounts
{
// Directories.
std::string ConfigDirectory(); // aka Base Directory. (normally ~/.retroshare)
std::string DataDirectory();
std::string PGPDirectory();
std::string AccountDirectory();
// PGP Accounts.
int GetPGPLogins(std::list<std::string> &pgpIds);
int GetPGPLoginDetails(const std::string& id, std::string &name, std::string &email);
bool GeneratePGPCertificate(const std::string&, const std::string& email, const std::string& passwd, std::string &pgpId, std::string &errString);
// PGP Support Functions.
bool ExportIdentity(const std::string& fname,const std::string& pgp_id) ;
bool ImportIdentity(const std::string& fname,std::string& imported_pgp_id,std::string& import_error) ;
void GetUnsupportedKeys(std::map<std::string,std::vector<std::string> > &unsupported_keys);
bool CopyGnuPGKeyrings() ;
// Rs Accounts
bool SelectAccount(const std::string &id);
bool GetPreferredAccountId(std::string &id);
bool GetAccountIds(std::list<std::string> &ids);
bool GetAccountDetails(const std::string &id,
std::string &gpgId, std::string &gpgName,
std::string &gpgEmail, std::string &location);
bool GenerateSSLCertificate(const std::string& name, const std::string& org, const std::string& loc, const std::string& country, const bool ishiddenloc, const std::string& passwd, std::string &sslId, std::string &errString);
};
#endif

View file

@ -100,11 +100,11 @@ class MessageInfo
std::list<std::string> msgcc;
std::list<std::string> msgbcc;
std::wstring title;
std::wstring msg;
std::string title;
std::string msg;
std::wstring attach_title;
std::wstring attach_comment;
std::string attach_title;
std::string attach_comment;
std::list<FileInfo> files;
std::map<std::string,std::string> encryption_keys ; // for concerned ids only the public pgp key id to encrypt the message with.
int size; /* total of files */
@ -123,7 +123,7 @@ class MsgInfoSummary
uint32_t msgflags;
std::wstring title;
std::string title;
int count; /* file count */
time_t ts;
@ -175,7 +175,7 @@ class ChatInfo
unsigned int chatflags;
uint32_t sendTime;
uint32_t recvTime;
std::wstring msg;
std::string msg;
};
class ChatLobbyInvite
@ -260,7 +260,7 @@ virtual void getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, un
virtual bool decryptMessage(const std::string& mId) = 0 ;
virtual bool MessageSend(MessageInfo &info) = 0;
virtual bool SystemMessage(const std::wstring &title, const std::wstring &message, uint32_t systemFlag) = 0;
virtual bool SystemMessage(const std::string &title, const std::string &message, uint32_t systemFlag) = 0;
virtual bool MessageToDraft(MessageInfo &info, const std::string &msgParentId) = 0;
virtual bool MessageToTrash(const std::string &mid, bool bTrash) = 0;
virtual bool getMsgParentId(const std::string &msgId, std::string &msgParentId) = 0;
@ -295,8 +295,8 @@ virtual bool getDistantMessageHash(const std::string& pgp_id, std::string& hash)
/****************************************/
/* Chat */
/****************************************/
virtual bool sendPublicChat(const std::wstring& msg) = 0;
virtual bool sendPrivateChat(const std::string& id, const std::wstring& msg) = 0;
virtual bool sendPublicChat(const std::string& msg) = 0;
virtual bool sendPrivateChat(const std::string& id, const std::string& msg) = 0;
virtual int getPublicChatQueueCount() = 0;
virtual bool getPublicChatQueue(std::list<ChatInfo> &chats) = 0;
virtual int getPrivateChatQueueCount(bool incoming) = 0;

View file

@ -63,9 +63,6 @@ const uint32_t RS_CHAT_TABBED_WINDOW = 0x0008;
const uint32_t RS_CHAT_BLINK = 0x0010;
const uint32_t RS_FEED_TYPE_PEER = 0x0010;
const uint32_t RS_FEED_TYPE_CHAN = 0x0020;
const uint32_t RS_FEED_TYPE_FORUM = 0x0040;
const uint32_t RS_FEED_TYPE_BLOG = 0x0080;
const uint32_t RS_FEED_TYPE_CHAT = 0x0100;
const uint32_t RS_FEED_TYPE_MSG = 0x0200;
const uint32_t RS_FEED_TYPE_FILES = 0x0400;
@ -85,18 +82,6 @@ const uint32_t RS_FEED_ITEM_SEC_BAD_CERTIFICATE = RS_FEED_TYPE_SECURITY | 0
const uint32_t RS_FEED_ITEM_SEC_INTERNAL_ERROR = RS_FEED_TYPE_SECURITY | 0x0007;
const uint32_t RS_FEED_ITEM_SEC_MISSING_CERTIFICATE = RS_FEED_TYPE_SECURITY | 0x0008;
const uint32_t RS_FEED_ITEM_CHAN_NEW = RS_FEED_TYPE_CHAN | 0x0001;
const uint32_t RS_FEED_ITEM_CHAN_UPDATE = RS_FEED_TYPE_CHAN | 0x0002;
const uint32_t RS_FEED_ITEM_CHAN_MSG = RS_FEED_TYPE_CHAN | 0x0003;
const uint32_t RS_FEED_ITEM_FORUM_NEW = RS_FEED_TYPE_FORUM | 0x0001;
const uint32_t RS_FEED_ITEM_FORUM_UPDATE = RS_FEED_TYPE_FORUM | 0x0002;
const uint32_t RS_FEED_ITEM_FORUM_MSG = RS_FEED_TYPE_FORUM | 0x0003;
const uint32_t RS_FEED_ITEM_BLOG_NEW = RS_FEED_TYPE_BLOG | 0x0001;
const uint32_t RS_FEED_ITEM_BLOG_UPDATE = RS_FEED_TYPE_BLOG | 0x0002;
const uint32_t RS_FEED_ITEM_BLOG_MSG = RS_FEED_TYPE_BLOG | 0x0003;
const uint32_t RS_FEED_ITEM_CHAT_NEW = RS_FEED_TYPE_CHAT | 0x0001;
const uint32_t RS_FEED_ITEM_MESSAGE = RS_FEED_TYPE_MSG | 0x0001;
const uint32_t RS_FEED_ITEM_FILES_NEW = RS_FEED_TYPE_FILES | 0x0001;

View file

@ -54,11 +54,17 @@ const uint32_t RS_TRUST_LVL_ULTIMATE = 5;
const uint32_t RS_NETMODE_UDP = 0x0001;
const uint32_t RS_NETMODE_UPNP = 0x0002;
const uint32_t RS_NETMODE_EXT = 0x0003;
const uint32_t RS_NETMODE_UNREACHABLE = 0x0004;
const uint32_t RS_NETMODE_HIDDEN = 0x0004;
const uint32_t RS_NETMODE_UNREACHABLE = 0x0005;
/* Visibility */
const uint32_t RS_VS_DHT_ON = 0x0001;
const uint32_t RS_VS_DISC_ON = 0x0002;
const uint32_t RS_VS_DISC_OFF = 0x0000;
const uint32_t RS_VS_DISC_MINIMAL = 0x0001;
const uint32_t RS_VS_DISC_FULL = 0x0002;
const uint32_t RS_VS_DHT_OFF = 0x0000;
const uint32_t RS_VS_DHT_PASSIVE = 0x0001;
const uint32_t RS_VS_DHT_FULL = 0x0002;
/* State */
const uint32_t RS_PEER_STATE_FRIEND = 0x0001;
@ -79,12 +85,12 @@ const ServicePermissionFlags RS_SERVICE_PERM_ALL = RS_SERVICE_PERM_TURTL
/* Connect state */
const uint32_t RS_PEER_CONNECTSTATE_OFFLINE = 0;
const uint32_t RS_PEER_CONNECTSTATE_TRYING_TUNNEL = 1;
const uint32_t RS_PEER_CONNECTSTATE_TRYING_TCP = 2;
const uint32_t RS_PEER_CONNECTSTATE_TRYING_UDP = 3;
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TCP = 4;
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UDP = 5;
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TUNNEL = 6;
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN = 7;
/* Error codes for certificate cleaning and cert parsing. Numbers should not overlap. */
@ -106,6 +112,7 @@ const uint32_t CERTIFICATE_PARSING_ERROR_INVALID_CHECKSUM_SECTION = 0x15 ;
const uint32_t CERTIFICATE_PARSING_ERROR_CHECKSUM_ERROR = 0x16 ;
const uint32_t CERTIFICATE_PARSING_ERROR_UNKNOWN_SECTION_PTAG = 0x17 ;
const uint32_t CERTIFICATE_PARSING_ERROR_MISSING_CHECKSUM = 0x18 ;
const uint32_t CERTIFICATE_PARSING_ERROR_WRONG_VERSION = 0x19 ;
const uint32_t PGP_KEYRING_REMOVAL_ERROR_NO_ERROR = 0x20 ;
const uint32_t PGP_KEYRING_REMOVAL_ERROR_CANT_REMOVE_SECRET_KEYS = 0x21 ;
@ -129,7 +136,6 @@ const uint32_t RS_NET_CONN_TRANS_UDP_PROXY = 0x00000040;
const uint32_t RS_NET_CONN_TRANS_UDP_RELAY = 0x00000080;
const uint32_t RS_NET_CONN_TRANS_OTHER_MASK = 0x00000f00;
const uint32_t RS_NET_CONN_TRANS_TUNNEL = 0x00000100;
const uint32_t RS_NET_CONN_TRANS_UNKNOWN = 0x00001000;
@ -207,8 +213,15 @@ class RsPeerDetails
/* Network details (only valid if friend) */
uint32_t state;
std::string connectAddr ; // current address if connected.
uint16_t connectPort ;
std::string connectAddr ; // current address if connected.
uint16_t connectPort ;
// Hidden Node details.
bool isHiddenNode;
std::string hiddenNodeAddress;
uint16_t hiddenNodePort;
// Filled in for Standard Node.
std::string localAddr;
uint16_t localPort;
std::string extAddr;
@ -217,7 +230,9 @@ class RsPeerDetails
std::list<std::string> ipAddressList;
uint32_t netMode;
uint32_t visState;
/* vis State */
uint16_t vs_disc;
uint16_t vs_dht;
/* basic stats */
uint32_t lastConnect; /* how long ago */
@ -313,22 +328,27 @@ class RsPeers
/* Network Stuff */
virtual bool connectAttempt(const std::string &ssl_id) = 0;
virtual bool setLocation(const std::string &ssl_id, const std::string &location) = 0;//location is shown in the gui to differentiate ssl certs
virtual bool setHiddenNode(const std::string &id, const std::string &hidden_node_address) = 0;
virtual bool setHiddenNode(const std::string &id, const std::string &address, uint16_t port) = 0;
virtual bool setLocalAddress(const std::string &ssl_id, const std::string &addr, uint16_t port) = 0;
virtual bool setExtAddress( const std::string &ssl_id, const std::string &addr, uint16_t port) = 0;
virtual bool setDynDNS(const std::string &id, const std::string &addr) = 0;
virtual bool setNetworkMode(const std::string &ssl_id, uint32_t netMode) = 0;
virtual bool setVisState(const std::string &ssl_id, uint32_t vis) = 0;
virtual bool setVisState(const std::string &ssl_id, uint16_t vs_disc, uint16_t vs_dht) = 0;
virtual bool getProxyServer(std::string &addr, uint16_t &port) = 0;
virtual bool setProxyServer(const std::string &addr, const uint16_t port) = 0;
virtual void getIPServersList(std::list<std::string>& ip_servers) = 0;
virtual void allowServerIPDetermination(bool) = 0;
virtual void allowTunnelConnection(bool) = 0;
virtual bool getAllowServerIPDetermination() = 0 ;
virtual bool getAllowTunnelConnection() = 0 ;
/* Auth Stuff */
virtual std::string GetRetroshareInvite(const std::string& ssl_id,bool include_signatures,bool old_format = false) = 0;
virtual std::string GetRetroshareInvite(const std::string& ssl_id,bool include_signatures) = 0;
virtual bool GetPGPBase64StringAndCheckSum(const std::string& gpg_id,std::string& gpg_base64_string,std::string& gpg_base64_checksum) = 0 ;
virtual std::string GetRetroshareInvite(bool include_signatures,bool old_format = false) = 0;
virtual std::string GetRetroshareInvite(bool include_signatures) = 0;
virtual bool hasExportMinimal() = 0 ;
// Add keys to the keyring

View file

@ -42,7 +42,7 @@ class RsTurtle ;
class RsDht ;
class RsDisc ;
class RsMsgs ;
class RsForums;
//class RsForums;
class RsNotify;
class p3LinkMgr ;
class MainPage ;
@ -100,7 +100,7 @@ public:
RsTurtle *mTurtle;
RsDisc *mDisc;
RsDht *mDht;
RsForums *mForums;
//RsForums *mForums;
RsNotify *mNotify;
};

View file

@ -82,7 +82,6 @@ class RsPosted : public RsGxsIfaceHelper, public RsGxsCommentService
virtual ~RsPosted() { return; }
/* Specific Service Data */
virtual bool getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &groups) = 0;
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts) = 0;
virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsPostedPost> &posts) = 0;

View file

@ -0,0 +1,63 @@
#ifndef RETROSHARE_RTT_INTERFACE_H
#define RETROSHARE_RTT_INTERFACE_H
/*
* libretroshare/src/retroshare: rsvoip.h
*
* RetroShare C++ Interface.
*
* Copyright 2011-2011 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include <inttypes.h>
#include <string>
#include <list>
/* The Main Interface Class - for information about your Peers */
class RsRtt;
extern RsRtt *rsRtt;
class RsRttPongResult
{
public:
RsRttPongResult()
:mTS(0), mRTT(0), mOffset(0) { return; }
RsRttPongResult(double ts, double rtt, double offset)
:mTS(ts), mRTT(rtt), mOffset(offset) { return; }
double mTS;
double mRTT;
double mOffset;
};
class RsRtt
{
public:
RsRtt() { return; }
virtual ~RsRtt() { return; }
virtual uint32_t getPongResults(std::string id, int n, std::list<RsRttPongResult> &results) = 0;
};
#endif

View file

@ -73,6 +73,8 @@ class Sha1CheckSum
bool operator==(const Sha1CheckSum& s) const ;
bool operator<(const Sha1CheckSum& s) const ;
friend std::ostream& operator<<(std::ostream& out,const Sha1CheckSum& sum) { return out << sum.toStdString() ; }
// private:
uint32_t fourbytes[5] ;
};