more of the same

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/ammorais_branch@1346 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
ammorais 2009-07-09 22:17:34 +00:00
parent df7bd25a1c
commit bc49f5b754
7 changed files with 420 additions and 12 deletions

View file

@ -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;

View file

@ -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 <list>
#include <iostream>
#include <string>
#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<FileInfo> 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<std::string> &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<ChannelInfo> &chanList) = 0;
virtual bool getChannelMsgList(std::string cId, std::list<ChannelMsgSummary> &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 */

View file

@ -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,6 +146,7 @@ class NameExpression: public StringExpression
{
public:
NameExpression(enum StringOperator op, std::list<std::string> &t, bool ic);
bool eval(FileEntry *file);
};
@ -152,18 +154,21 @@ class PathExpression: public StringExpression
{
public:
PathExpression(enum StringOperator op, std::list<std::string> &t, bool ic);
bool eval(FileEntry *file);
};
class ExtExpression: public StringExpression {
public:
ExtExpression(enum StringOperator op, std::list<std::string> &t, bool ic);
bool eval(FileEntry *file);
};
class HashExpression: public StringExpression {
public:
HashExpression(enum StringOperator op, std::list<std::string> &t);
bool eval(FileEntry *file);
};
@ -177,6 +182,7 @@ class DateExpression: public RelExpression<int>
public:
DateExpression(enum RelOperator op, int v);
DateExpression(enum RelOperator op, int lv, int hv);
bool eval(FileEntry *file);
};

View file

@ -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;
}

View file

@ -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 <list>
#include <iostream>
#include <string>
#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<std::string> &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<ForumInfo> &forumList) = 0;
virtual bool getForumThreadList(std::string fId, std::list<ThreadInfoSummary> &msgs) = 0;
virtual bool getForumThreadMsgList(std::string fId, std::string pId, std::list<ThreadInfoSummary> &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

View file

@ -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

View file

@ -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 <iostream>
#include <string>
#include <list>
#include <map>
#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<long int, std::wstring> > &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*/