mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
Fixed up the retroshare message system.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@331 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
07a458367b
commit
8527a5e53f
17 changed files with 947 additions and 609 deletions
|
@ -98,24 +98,20 @@ virtual void unlockData() = 0;
|
|||
const PersonInfo *getPerson(std::string id);
|
||||
const DirInfo *getDirectory(std::string id, std::string path);
|
||||
|
||||
const std::list<MessageInfo> &getMessages()
|
||||
{ return mMessageList; }
|
||||
|
||||
const std::map<RsChanId, ChannelInfo> &getChannels()
|
||||
{ return mChannelMap; }
|
||||
|
||||
const std::map<RsChanId, ChannelInfo> &getOurChannels()
|
||||
{ return mChannelOwnMap; }
|
||||
|
||||
const MessageInfo *getMessage(std::string cId, std::string mId);
|
||||
const MessageInfo *getChannelMsg(std::string chId, std::string mId);
|
||||
//const MessageInfo *getChannelMsg(std::string chId, std::string mId);
|
||||
|
||||
std::list<ChatInfo> getChatNew()
|
||||
{
|
||||
std::list<ChatInfo> newList = mChatList;
|
||||
mChatList.clear();
|
||||
return newList;
|
||||
}
|
||||
//std::list<ChatInfo> getChatNew()
|
||||
// {
|
||||
// std::list<ChatInfo> newList = mChatList;
|
||||
// mChatList.clear();
|
||||
// return newList;
|
||||
// }
|
||||
|
||||
const std::list<FileInfo> &getRecommendList()
|
||||
{ return mRecommendList; }
|
||||
|
@ -162,10 +158,10 @@ void fillLists(); /* create some dummy data to display */
|
|||
std::list<PersonInfo> mRemoteDirList;
|
||||
std::list<PersonInfo> mLocalDirList;
|
||||
std::list<FileTransferInfo> mTransferList;
|
||||
std::list<MessageInfo> mMessageList;
|
||||
//std::list<MessageInfo> mMessageList;
|
||||
std::map<RsChanId, ChannelInfo> mChannelMap;
|
||||
std::map<RsChanId, ChannelInfo> mChannelOwnMap;
|
||||
std::list<ChatInfo> mChatList;
|
||||
//std::list<ChatInfo> mChatList;
|
||||
std::list<FileInfo> mRecommendList;
|
||||
|
||||
bool mChanged[NumOfFlags];
|
||||
|
@ -218,9 +214,9 @@ virtual int FileSetBandwidthTotals(float outkB, float inkB) = 0;
|
|||
|
||||
/****************************************/
|
||||
/* Message Items */
|
||||
virtual int MessageSend(MessageInfo &info) = 0;
|
||||
virtual int MessageDelete(std::string mid) = 0;
|
||||
virtual int MessageRead(std::string mid) = 0;
|
||||
//virtual int MessageSend(MessageInfo &info) = 0;
|
||||
//virtual int MessageDelete(std::string mid) = 0;
|
||||
//virtual int MessageRead(std::string mid) = 0;
|
||||
|
||||
/* Channel Items */
|
||||
virtual int ChannelCreateNew(ChannelInfo &info) = 0;
|
||||
|
@ -228,7 +224,7 @@ virtual int ChannelSendMsg(ChannelInfo &info) = 0;
|
|||
|
||||
/****************************************/
|
||||
/* Chat */
|
||||
virtual int ChatSend(ChatInfo &ci) = 0;
|
||||
//virtual int ChatSend(ChatInfo &ci) = 0;
|
||||
|
||||
/****************************************/
|
||||
|
||||
|
@ -244,6 +240,9 @@ virtual int ClearInBroadcast() = 0;
|
|||
virtual int ClearInSubscribe() = 0;
|
||||
virtual int ClearInRecommend() = 0;
|
||||
|
||||
virtual bool IsInChat(std::string id) = 0; /* friend : chat msgs */
|
||||
virtual bool IsInMsg(std::string id) = 0; /* friend : msg recpts*/
|
||||
|
||||
/****************************************/
|
||||
/* RsIface Networking */
|
||||
//virtual int NetworkDHTActive(bool active) = 0;
|
||||
|
|
138
libretroshare/src/rsiface/rsmsgs.h
Normal file
138
libretroshare/src/rsiface/rsmsgs.h
Normal file
|
@ -0,0 +1,138 @@
|
|||
#ifndef RS_MSG_GUI_INTERFACE_H
|
||||
#define RS_MSG_GUI_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/rsiface: rsmsgs.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"
|
||||
|
||||
/********************** For Messages and Channels *****************/
|
||||
|
||||
#define RS_MSG_BOXMASK 0x000f /* Mask for determining Box */
|
||||
|
||||
#define RS_MSG_OUTGOING 0x0001 /* !Inbox */
|
||||
#define RS_MSG_PENDING 0x0002 /* OutBox */
|
||||
#define RS_MSG_DRAFT 0x0004 /* Draft */
|
||||
|
||||
/* ORs of above */
|
||||
#define RS_MSG_INBOX 0x00 /* Inbox */
|
||||
#define RS_MSG_SENTBOX 0x01 /* Sentbox */
|
||||
#define RS_MSG_OUTBOX 0x03 /* Outbox */
|
||||
#define RS_MSG_DRAFTBOX 0x05 /* Draftbox */
|
||||
|
||||
#define RS_MSG_NEW 0x0010
|
||||
|
||||
class MessageInfo
|
||||
{
|
||||
public:
|
||||
MessageInfo() {}
|
||||
std::string msgId;
|
||||
std::string srcId;
|
||||
|
||||
unsigned int msgflags;
|
||||
|
||||
std::list<std::string> msgto;
|
||||
std::list<std::string> msgcc;
|
||||
std::list<std::string> msgbcc;
|
||||
|
||||
std::wstring title;
|
||||
std::wstring msg;
|
||||
|
||||
std::wstring attach_title;
|
||||
std::wstring attach_comment;
|
||||
std::list<FileInfo> files;
|
||||
int size; /* total of files */
|
||||
int count; /* file count */
|
||||
|
||||
int ts;
|
||||
};
|
||||
|
||||
class MsgInfoSummary
|
||||
{
|
||||
public:
|
||||
MsgInfoSummary() {}
|
||||
|
||||
std::string msgId;
|
||||
std::string srcId;
|
||||
|
||||
uint32_t msgflags;
|
||||
|
||||
std::wstring title;
|
||||
int count; /* file count */
|
||||
time_t ts;
|
||||
|
||||
};
|
||||
|
||||
#define RS_CHAT_PUBLIC 0x0001
|
||||
#define RS_CHAT_PRIVATE 0x0002
|
||||
|
||||
class ChatInfo
|
||||
{
|
||||
public:
|
||||
std::string rsid;
|
||||
unsigned int chatflags;
|
||||
std::string name;
|
||||
std::wstring msg;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const MessageInfo &info);
|
||||
std::ostream &operator<<(std::ostream &out, const ChatInfo &info);
|
||||
|
||||
class RsMsgs;
|
||||
extern RsMsgs *rsMsgs;
|
||||
|
||||
class RsMsgs
|
||||
{
|
||||
public:
|
||||
|
||||
RsMsgs() { return; }
|
||||
virtual ~RsMsgs() { return; }
|
||||
|
||||
/****************************************/
|
||||
/* Message Items */
|
||||
|
||||
virtual bool getMessageSummaries(std::list<MsgInfoSummary> &msgList) = 0;
|
||||
virtual bool getMessage(std::string mId, MessageInfo &msg) = 0;
|
||||
|
||||
virtual bool MessageSend(MessageInfo &info) = 0;
|
||||
virtual bool MessageDelete(std::string mid) = 0;
|
||||
virtual bool MessageRead(std::string mid) = 0;
|
||||
|
||||
/****************************************/
|
||||
/* Chat */
|
||||
virtual bool ChatSend(ChatInfo &ci) = 0;
|
||||
virtual bool getNewChat(std::list<ChatInfo> &chats) = 0;
|
||||
|
||||
/****************************************/
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -32,25 +32,6 @@
|
|||
#include <string>
|
||||
|
||||
|
||||
#if 0
|
||||
#define RSCERTIDLEN 16
|
||||
|
||||
class RsCertId
|
||||
{
|
||||
public:
|
||||
RsCertId();
|
||||
RsCertId(std::string idstr);
|
||||
|
||||
bool operator<(const RsCertId &ref) const;
|
||||
bool operator==(const RsCertId &ref) const;
|
||||
bool operator!=(const RsCertId &ref) const;
|
||||
char data[RSCERTIDLEN];
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsCertId &id);
|
||||
|
||||
#endif
|
||||
|
||||
typedef std::string RsCertId;
|
||||
typedef std::string RsChanId;
|
||||
typedef std::string RsMsgId;
|
||||
|
@ -157,48 +138,6 @@ class FileTransferInfo: public FileInfo
|
|||
int downloadStatus; /* 0 = Err, 1 = Ok, 2 = Done */
|
||||
};
|
||||
|
||||
|
||||
/********************** For Messages and Channels *****************/
|
||||
|
||||
#define RS_MSG_BOXMASK 0x000f /* Mask for determining Box */
|
||||
|
||||
#define RS_MSG_OUTGOING 0x0001 /* !Inbox */
|
||||
#define RS_MSG_PENDING 0x0002 /* OutBox */
|
||||
#define RS_MSG_DRAFT 0x0004 /* Draft */
|
||||
|
||||
/* ORs of above */
|
||||
#define RS_MSG_INBOX 0x00 /* Inbox */
|
||||
#define RS_MSG_SENTBOX 0x01 /* Sentbox */
|
||||
#define RS_MSG_OUTBOX 0x03 /* Outbox */
|
||||
#define RS_MSG_DRAFTBOX 0x05 /* Draftbox */
|
||||
|
||||
#define RS_MSG_NEW 0x0010
|
||||
|
||||
class MessageInfo: public BaseInfo
|
||||
{
|
||||
public:
|
||||
MessageInfo() {}
|
||||
RsMsgId msgId;
|
||||
|
||||
unsigned int msgflags;
|
||||
std::string srcname;
|
||||
|
||||
std::list<PersonInfo> msgto;
|
||||
std::list<PersonInfo> msgcc;
|
||||
std::list<PersonInfo> msgbcc;
|
||||
|
||||
std::wstring title;
|
||||
std::wstring msg;
|
||||
|
||||
std::wstring attach_title;
|
||||
std::wstring attach_comment;
|
||||
std::list<FileInfo> files;
|
||||
int size; /* total of files */
|
||||
int count; /* file count */
|
||||
|
||||
int ts;
|
||||
};
|
||||
|
||||
class ChannelInfo: public BaseInfo
|
||||
{
|
||||
public:
|
||||
|
@ -206,7 +145,7 @@ class ChannelInfo: public BaseInfo
|
|||
RsChanId chanId;
|
||||
bool publisher;
|
||||
std::string chanName;
|
||||
std::list<MessageInfo> msglist;
|
||||
//std::list<MessageInfo> msglist;
|
||||
|
||||
/* details */
|
||||
int mode;
|
||||
|
@ -219,18 +158,6 @@ class ChannelInfo: public BaseInfo
|
|||
int count; /* msg count */
|
||||
};
|
||||
|
||||
#define RS_CHAT_PUBLIC 0x0001
|
||||
#define RS_CHAT_PRIVATE 0x0002
|
||||
|
||||
class ChatInfo: public BaseInfo
|
||||
{
|
||||
public:
|
||||
std::string rsid;
|
||||
unsigned int chatflags;
|
||||
std::string name;
|
||||
std::wstring msg;
|
||||
};
|
||||
|
||||
/* matched to the uPnP states */
|
||||
#define UPNP_STATE_UNINITIALISED 0
|
||||
#define UPNP_STATE_UNAVAILABILE 1
|
||||
|
@ -303,9 +230,7 @@ class SearchRequest
|
|||
};
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const MessageInfo &info);
|
||||
std::ostream &operator<<(std::ostream &out, const ChannelInfo &info);
|
||||
std::ostream &operator<<(std::ostream &out, const ChatInfo &info);
|
||||
std::ostream &operator<<(std::ostream &out, const PersonInfo &info);
|
||||
std::ostream &print(std::ostream &out, const DirInfo &info, int indentLvl);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue