From 6d4fa404167e5b52600b0de5497878b083e45131 Mon Sep 17 00:00:00 2001 From: drbob Date: Wed, 18 Jan 2012 00:13:27 +0000 Subject: [PATCH] Added acadeeb - A bibiography / reference paper system. Added wire - decentralised twitter clone. Tweaks to other definitions. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@4809 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/gxs/db_acadeeb.h | 82 ++++++++++++++++++++++++++++ libretroshare/src/gxs/db_gmxp.h | 88 +++++++++++++++++++++++++++++- libretroshare/src/gxs/db_gxp.h | 14 +++-- libretroshare/src/gxs/db_wire.h | 50 +++++++++++++++++ 4 files changed, 227 insertions(+), 7 deletions(-) create mode 100644 libretroshare/src/gxs/db_acadeeb.h create mode 100644 libretroshare/src/gxs/db_wire.h diff --git a/libretroshare/src/gxs/db_acadeeb.h b/libretroshare/src/gxs/db_acadeeb.h new file mode 100644 index 000000000..7cbc7d185 --- /dev/null +++ b/libretroshare/src/gxs/db_acadeeb.h @@ -0,0 +1,82 @@ +/* + * libretroshare/src/gxp: gxp_apps.h + * + * General Exchange Protocol interface for RetroShare. + * + * 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". + * + */ + +#ifndef RS_ACADEE_H +#define RS_ACADEE_H + +/******* + * Stores a Bibliography of Academic Articles, with links to allow you to access the actual article. + * The data fields, should contain enough information to + * - extract full biblio (bibtex or ris formats). + * - read abstract. + * - review / rating of the article + * - references to similar papers, and bibliography. + * - keywords, and the like. + * + * It will be possible to have multiple identical / similar / different descriptions of the same article. + * The class will have to handle this: sorting and matching as best it can. + * + ****/ + +class gxp::Paper +{ + /* fields from ris */ + std::string reftype; + std::string journal; + std::string title; + std::string issuetitle; + uint32_t volume; + uint32_t issue; + std::string publisher; + std::string serialnumber; + std::string url; + std::list authors; + time_t date; + uint32_t startpage; + uint32_t endpage; + std::string language; + + std::string abstract; + + // KeyWords <- go into hashtags (parent class) + //References & Similar Papers <- go into links (parent class) +}; + + +class rsAcadee: public rsGmxp +{ + public: + + /* we want to access the */ + + + + +}; + + +#endif /* RS_GXP_H */ + + diff --git a/libretroshare/src/gxs/db_gmxp.h b/libretroshare/src/gxs/db_gmxp.h index 88c42e45e..293afd808 100644 --- a/libretroshare/src/gxs/db_gmxp.h +++ b/libretroshare/src/gxs/db_gmxp.h @@ -50,14 +50,49 @@ *****/ +/****** + * NOTES: + * 1) Based on Forum/Channel Groups. + * 2) Will likely need to extend to handle info for other services. + * 3) Perhaps a more generalised class like gxmp::msg would be best with extra data. + * + */ + +class gxmp::group +{ + gxp::id grpId; + uint32_t grpType; /* FORUM, CHANNEL, TWITTER, etc */ + + uint32_t timestamp; + uint32_t grpFlags; + std::string grpName; + std::string grpDesc; + std::string grpCategory; + + RsTlvImage grpPixmap; + + gpp::permissions grpPermissions; + + gxip::keyref adminKey; + gxip::keyrefset publishKeys; + + gxip::signature adminSignature; +}; + + /****** * NOTES: * 1) This represents the base of the Unpacked Msgs, it will be overloaded by all classes * that want to use the service. It is difficult to go from gxmp::msg => gxmp::signedmsg * so data should be stored in the signedmsg format. * 2) All services will fundamentally use data types derived from this. - * 3) This packet is only serialised once at post time, typically it is deserialised be all nodes. + * 3) This packet is only serialised once at post time, typically it is deserialised by all nodes. */ +class gmxp::link +{ + uint32_t linktype; + gxp::id msgId; +} class gmxp::msg { @@ -70,15 +105,23 @@ class gmxp::msg gxp::id origMsgId; /* if a replacement msg, otherwise == msgId */ gxp::id replacingMsgId; /* if a replacement msg, otherwise == NULL (for ordering) */ - uint32_t type; /* FORUM, CHANNEL, EVENT, COMMENT, VOTE, etc */ + uint32_t msgtype; /* FORUM, CHANNEL, EVENT, COMMENT, VOTE, etc */ uint32_t flags; /* Is this needed? */ uint32_t timestamp; + // New extensions - put these in the generic message, so we can handle search / linking for all services. + std::list hashtags; + std::list linked; + gpp::permissions msgPermissions; - gxip::signset signatures; + gxip::signset signatures; // should this be a set, or a singleton? }; +class gmxp::group: public gxp::group +{ + ??? +}; /****** @@ -93,6 +136,45 @@ class gmxp::msg */ +/* General Interface class which is extended by specific versions. + * + * This provides most of the generic search, and access functions. + * As we are going to end up with diamond style double inheritance. + * This function needs to be pure virtual.. so there is no disambiugation issues. + */ + +class rsGmxp +{ + /* create content */ + std::string createGroup(std::wstring name, std::wstring desc, uint32_t flags, unsigned char *pngImageData, uint32_t imageSize); + std::string publishMsg(RsDistribMsg *msg, bool personalSign); + + /* indicate interest in info */ + bool subscribeToGroup(const std::string &grpId, bool subscribe); + + /* search messages (TO DEFINE) */ + + /* extract messages (From p3Distrib Existing Methods) */ + + bool getAllGroupList(std::list &grpids); + bool getSubscribedGroupList(std::list &grpids); + bool getPublishGroupList(std::list &grpids); + void getPopularGroupList(uint32_t popMin, uint32_t popMax, std::list &grpids); + + bool getAllMsgList(const std::string& grpId, std::list &msgIds); + bool getParentMsgList(const std::string& grpId, + const std::string& pId, std::list &msgIds); + bool getTimePeriodMsgList(const std::string& grpId, uint32_t timeMin, + uint32_t timeMax, std::list &msgIds); + + GroupInfo *locked_getGroupInfo(const std::string& grpId); + RsDistribMsg *locked_getGroupMsg(const std::string& grpId, const std::string& msgId); + + void getGrpListPubKeyAvailable(std::list& grpList); + +}; + + class p3gmxp { p3gmxp(int serviceType, serialiser *); diff --git a/libretroshare/src/gxs/db_gxp.h b/libretroshare/src/gxs/db_gxp.h index 12a9f4bd1..d6c2aa933 100644 --- a/libretroshare/src/gxs/db_gxp.h +++ b/libretroshare/src/gxs/db_gxp.h @@ -138,7 +138,7 @@ class gxmp::group * */ -class gxmp::signedmsg +class gxp::signedmsg { gxp::id groupId; /* high level groupings, e.g. specific forum, channel, or twitter user, etc. */ gxp::id msgId; /* unique msgId within that group, normally signature of the message */ @@ -154,16 +154,22 @@ class gxmp::signedmsg class gdp::interface { + /* query for available groups & messages */ + int listgroups(std::list &grpIds); + /* response from listmsgs: -1 = invalid parameters, 0 = incomplete list, 1 = all known msgs */ + int listmsgs(const gdp::id grpId, std::list &msgIds, const time_t from, const time_t to, const int maxmsgs); - /* very basic interface */ - - /* response from requestMsg: YES (available immediately, RETRIEVING (known to exist), IN_REQUEST (might exist), NOT_AVAILABLE (still might exist) + /* response from requestMsg: YES (available immediately), RETRIEVING (known to exist), + * IN_REQUEST (might exist), NOT_AVAILABLE (still might exist) * NB: NOT_AVAILABLE could mean that it will be retrievable later when other peers come online, or possibilly we are not allowed it. */ + int requestMsg(gdp::id groupId, gdp::id msgId, double &delay); int getMsg(gdp::id groupId, gdp::id msgId, gdp::message &msg); int storeMsg(const gdp::message &msg); + /* search interface, is it here? or next level up */ + }; diff --git a/libretroshare/src/gxs/db_wire.h b/libretroshare/src/gxs/db_wire.h new file mode 100644 index 000000000..cac3f2747 --- /dev/null +++ b/libretroshare/src/gxs/db_wire.h @@ -0,0 +1,50 @@ + +#include "gxp_service.h" + +class db_wire +{ + /* external interface for accessing the info */ + + /** Note this could get very busy with a large number of tweeters. + * need some other method of getting data + */ + + getTweeters(std::list &tweeterIds); + { + getGroups(); + } + + getTweetRange(GxpTimeStamp, GxpTimeStamp, std::list &tweetIds); + { + getTimeRange(); + } + + getTweetRangeSource(GxpTimeStamp, GxpTimeStamp, std::string tweeterId, std::list &tweetIds); + { + getGroupTimeRange(); + } + + getTweet(std::string id, TweetData &tweet); + { + StackLock(); + + RsGxpItem *getMsg_locked(id); + + // translate message into TweetData. + + } + + // Default + getProfile(std::string id, TweetData &tweet); + + /* returns a search code, which is used to id later delivery */ + int searchTweets(GxpSearchCondition cond, std::list); + + /* returns a search code, which is used to id later delivery */ + int fetchPendingSearchResults(int searchId, std::list); + + int cancelSearch(int searchId, std::list); + +}; + +