diff --git a/libretroshare/src/_rsiface/rschannels.cc b/libretroshare/src/_rsiface/rschannels.cc new file mode 100644 index 000000000..5889b93ff --- /dev/null +++ b/libretroshare/src/_rsiface/rschannels.cc @@ -0,0 +1,39 @@ +#include "rschannels.h" + +std::ostream &operator<<(std::ostream &out, const ChannelInfo &info) +{ + std::string name(info.channelName.begin(), info.channelName.end()); + std::string desc(info.channelDesc.begin(), info.channelDesc.end()); + + out << "ChannelInfo:"; + out << std::endl; + out << "ChannelId: " << info.channelId << std::endl; + out << "ChannelName: " << name << std::endl; + out << "ChannelDesc: " << desc << std::endl; + out << "ChannelFlags: " << info.channelFlags << std::endl; + out << "Pop: " << info.pop << std::endl; + out << "LastPost: " << info.lastPost << std::endl; + + return out; +} + +std::ostream &operator<<(std::ostream &out, const ChannelMsgSummary &info) +{ + out << "ChannelMsgSummary:"; + out << std::endl; + out << "ChannelId: " << info.channelId << std::endl; + + return out; +} + +std::ostream &operator<<(std::ostream &out, const ChannelMsgInfo &info) +{ + out << "ChannelMsgInfo:"; + out << std::endl; + out << "ChannelId: " << info.channelId << std::endl; + + return out; +} + + +RsChannels *rsChannels = NULL; diff --git a/libretroshare/src/_rsiface/rschannels.h b/libretroshare/src/_rsiface/rschannels.h new file mode 100644 index 000000000..703948c9d --- /dev/null +++ b/libretroshare/src/_rsiface/rschannels.h @@ -0,0 +1,120 @@ +#ifndef RSCHANNELS_H +#define RSCHANNELS_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 +#include +#include + +#include "rsiface/rstypes.h" +#include "rsiface/rsdistrib.h" /* For FLAGS */ + +class ChannelInfo +{ + public: + ChannelInfo() {} + std::string channelId; + std::wstring channelName; + std::wstring channelDesc; + + uint32_t channelFlags; + uint32_t pop; + + time_t lastPost; +}; + +class ChannelMsgInfo +{ + public: + ChannelMsgInfo() {} + std::string channelId; + std::string msgId; + + unsigned int msgflags; + + std::wstring subject; + std::wstring msg; + time_t ts; + + std::list files; + uint32_t count; + uint64_t size; +}; + + +class ChannelMsgSummary +{ + public: + ChannelMsgSummary() {} + std::string channelId; + std::string msgId; + + uint32_t msgflags; + + std::wstring subject; + std::wstring msg; + uint32_t count; /* file count */ + time_t ts; + +}; + +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; + +class RsChannels +{ + public: + + RsChannels() { return; } +virtual ~RsChannels() { return; } + +/****************************************/ + +virtual bool channelsChanged(std::list &chanIds) = 0; + + +virtual std::string createChannel(std::wstring chanName, std::wstring chanDesc, uint32_t chanFlags) = 0; + +virtual bool getChannelInfo(std::string cId, ChannelInfo &ci) = 0; +virtual bool getChannelList(std::list &chanList) = 0; +virtual bool getChannelMsgList(std::string cId, std::list &msgs) = 0; +virtual bool getChannelMessage(std::string cId, std::string mId, ChannelMsgInfo &msg) = 0; + +virtual bool ChannelMessageSend(ChannelMsgInfo &info) = 0; + +virtual bool channelSubscribe(std::string cId, bool subscribe) = 0; +/****************************************/ + +}; + + +#endif /* RSCHANNELS_H */ diff --git a/libretroshare/src/_rsiface/rsexpr.h b/libretroshare/src/_rsiface/rsexpr.h index ea5436aa9..1683aaced 100644 --- a/libretroshare/src/_rsiface/rsexpr.h +++ b/libretroshare/src/_rsiface/rsexpr.h @@ -131,7 +131,8 @@ Binary Predicate for Case Insensitive search /*TODOS: *Factor locales in the comparison */ -struct CompareCharIC : public std::binary_function< char , char , bool> +struct CompareCharIC : + public std::binary_function< char , char , bool> { bool operator () ( char ch1 , char ch2 ) const; }; @@ -145,26 +146,30 @@ class NameExpression: public StringExpression { public: NameExpression(enum StringOperator op, std::list &t, bool ic); + bool eval(FileEntry *file); }; class PathExpression: public StringExpression { public: - PathExpression(enum StringOperator op, std::list &t, bool ic); - bool eval(FileEntry *file); + PathExpression(enum StringOperator op, std::list &t, bool ic); + + bool eval(FileEntry *file); }; class ExtExpression: public StringExpression { public: - ExtExpression(enum StringOperator op, std::list &t, bool ic); - bool eval(FileEntry *file); + ExtExpression(enum StringOperator op, std::list &t, bool ic); + + bool eval(FileEntry *file); }; class HashExpression: public StringExpression { public: - HashExpression(enum StringOperator op, std::list &t); - bool eval(FileEntry *file); + HashExpression(enum StringOperator op, std::list &t); + + bool eval(FileEntry *file); }; /****************************************************************************************** @@ -177,6 +182,7 @@ class DateExpression: public RelExpression public: DateExpression(enum RelOperator op, int v); DateExpression(enum RelOperator op, int lv, int hv); + bool eval(FileEntry *file); }; @@ -191,10 +197,10 @@ public: class PopExpression: public RelExpression { public: - PopExpression(enum RelOperator op, int v); - PopExpression(enum RelOperator op, int lv, int hv); + PopExpression(enum RelOperator op, int v); + PopExpression(enum RelOperator op, int lv, int hv); - bool eval(FileEntry *file); + bool eval(FileEntry *file); }; #endif /* RS_EXPRESSIONS_H */ diff --git a/libretroshare/src/_rsiface/rsforums.cc b/libretroshare/src/_rsiface/rsforums.cc new file mode 100644 index 000000000..f665d553c --- /dev/null +++ b/libretroshare/src/_rsiface/rsforums.cc @@ -0,0 +1,39 @@ +#include "rsforums.h" + +std::ostream &operator<<(std::ostream &out, const ForumInfo &info) +{ + std::string name(info.forumName.begin(), info.forumName.end()); + std::string desc(info.forumDesc.begin(), info.forumDesc.end()); + + out << "ForumInfo:"; + out << std::endl; + out << "ForumId: " << info.forumId << std::endl; + out << "ForumName: " << name << std::endl; + out << "ForumDesc: " << desc << std::endl; + out << "ForumFlags: " << info.forumFlags << std::endl; + out << "Pop: " << info.pop << std::endl; + out << "LastPost: " << info.lastPost << std::endl; + + return out; +} + +std::ostream &operator<<(std::ostream &out, const ForumMsgInfo &info) +{ + out << "ForumMsgInfo:"; + out << std::endl; + //out << "ForumId: " << forumId << std::endl; + //out << "ThreadId: " << threadId << std::endl; + + return out; +} + + +std::ostream &operator<<(std::ostream &out, const ThreadInfoSummary &info) +{ + out << "ThreadInfoSummary:"; + out << std::endl; + //out << "ForumId: " << forumId << std::endl; + //out << "ThreadId: " << threadId << std::endl; + + return out; +} diff --git a/libretroshare/src/_rsiface/rsforums.h b/libretroshare/src/_rsiface/rsforums.h new file mode 100644 index 000000000..9004529e0 --- /dev/null +++ b/libretroshare/src/_rsiface/rsforums.h @@ -0,0 +1,125 @@ +#ifndef RSFORUMS_H +#define RSFORUMS_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 +#include +#include + +#include "rsiface/rstypes.h" +#include "rsiface/rsdistrib.h" /* For FLAGS */ + +#define RS_FORUMMSG_NEW 0x0010 + + +class ForumInfo +{ + public: + ForumInfo() {} + 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() {} + 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; +}; + + +class ThreadInfoSummary +{ + public: + ThreadInfoSummary() {} + 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; + +}; + +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 +{ +public: + + RsForums() { return; } + virtual ~RsForums() { return; } + +/****************************************/ + + virtual bool forumsChanged(std::list &forumIds) = 0; + + + virtual std::string createForum(std::wstring forumName, std::wstring forumDesc, uint32_t forumFlags) = 0; + + virtual bool getForumInfo(std::string fId, ForumInfo &fi) = 0; + virtual bool getForumList(std::list &forumList) = 0; + virtual bool getForumThreadList(std::string fId, std::list &msgs) = 0; + virtual bool getForumThreadMsgList(std::string fId, std::string pId, std::list &msgs) = 0; + virtual bool getForumMessage(std::string fId, std::string mId, ForumMsgInfo &msg) = 0; + virtual bool ForumMessageSend(ForumMsgInfo &info) = 0; + virtual bool forumSubscribe(std::string fId, bool subscribe) = 0; +/****************************************/ + +}; + +extern RsForums *rsForums; + + +#endif diff --git a/libretroshare/src/_rsiface/rsiface.pri b/libretroshare/src/_rsiface/rsiface.pri index f874fd75e..f64f6f0db 100644 --- a/libretroshare/src/_rsiface/rsiface.pri +++ b/libretroshare/src/_rsiface/rsiface.pri @@ -7,7 +7,9 @@ SOURCES = $$PWP/rsinit.cc \ $$PWP/notifybase.cc \ $$PWP/rsifacereal.cc \ $$PWP/rstypes.cc \ - rsexpr.cc + $$PWP/rsexpr.cc \ + $$PWP/rsforums.cc \ + $$PWP/rschannels.cc HEADERS = $$PWP/rsinit.h \ $$PWP/rsiface.h \ $$PWP/rscontrol.h \ @@ -16,4 +18,7 @@ HEADERS = $$PWP/rsinit.h \ $$PWP/rstypes.h \ $$PWP/rsfiles.h \ $$PWP/rsexpr.h \ - $$PWP/rsgame.h + $$PWP/rsgame.h \ + $$PWP/rsforums.h \ + $$PWP/rsqblog.h \ + $$PWP/rschannels.h diff --git a/libretroshare/src/_rsiface/rsqblog.h b/libretroshare/src/_rsiface/rsqblog.h new file mode 100644 index 000000000..0c282ac86 --- /dev/null +++ b/libretroshare/src/_rsiface/rsqblog.h @@ -0,0 +1,74 @@ +#ifndef RSQBLOG_H +#define RSQBLOG_H + +/* + * libretroshare/src/rsiface: rsQblog.h + * + * RetroShare C++ Interface. + * + * Copyright 2007-2008 by Chris Evi-Parker, 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 + #include + #include + #include + + #include "rstypes.h" + + +/* delcare interaface for everyone o use */ +class RsQblog; +extern RsQblog *rsQblog; + + /*! allows gui to interface with the rsQblogs service */ +class RsQblog +{ +public: + RsQblog() { return; } + virtual ~RsQblog() { return; } + + /** + * send blog info, will send to a data structure for transmission + * @param msg The msg the usr wants to send + */ + virtual bool sendBlog(const std::wstring &msg) = 0; + + /** + * retrieve blog of a usr + * @param blogs contains the blog msgs of usr along with time posted for sorting + */ + virtual bool getBlogs(std::map< std::string, std::multimap > &blogs) = 0; + + /** + * Stuff DrBob Added for Profile View! + */ + + /** + * get users Latest Blog Post. + * @param id the usr whose idetails you want to get. + * @param ts Timestamp of the Blog Post. + * @param post the actual Blog Post. + */ + virtual bool getPeerLatestBlog(std::string id, uint32_t &ts, std::wstring &post) = 0; + + }; + +#endif /*RSQBLOG_H*/