2008-02-04 12:55:13 -05:00
|
|
|
#ifndef RS_P3MSG_INTERFACE_H
|
|
|
|
#define RS_P3MSG_INTERFACE_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* libretroshare/src/rsserver: p3msgs.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".
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-08-06 05:40:23 -04:00
|
|
|
#include "retroshare/rsmsgs.h"
|
2008-02-04 12:55:13 -05:00
|
|
|
|
|
|
|
class p3MsgService;
|
|
|
|
class p3ChatService;
|
|
|
|
|
2009-05-05 09:18:53 -04:00
|
|
|
class RsChatMsgItem;
|
2008-06-24 00:22:42 -04:00
|
|
|
|
2010-04-27 07:44:06 -04:00
|
|
|
//! provides retroshares chatservice and messaging service
|
|
|
|
/*!
|
|
|
|
* Provides rs with the ability to send/receive messages, immediate status,
|
|
|
|
* custom status, avatar and
|
|
|
|
* chats (public(group) and private) to peers
|
|
|
|
*/
|
2008-02-04 12:55:13 -05:00
|
|
|
class p3Msgs: public RsMsgs
|
|
|
|
{
|
2009-01-30 14:52:47 -05:00
|
|
|
public:
|
2008-02-04 12:55:13 -05:00
|
|
|
|
2010-01-13 16:01:06 -05:00
|
|
|
p3Msgs(p3MsgService *p3m, p3ChatService *p3c)
|
|
|
|
:mMsgSrv(p3m), mChatSrv(p3c) { return; }
|
2009-01-30 14:52:47 -05:00
|
|
|
virtual ~p3Msgs() { return; }
|
2008-02-04 12:55:13 -05:00
|
|
|
|
2009-01-30 14:52:47 -05:00
|
|
|
/****************************************/
|
|
|
|
/* Message Items */
|
2008-02-04 12:55:13 -05:00
|
|
|
|
2010-04-27 07:44:06 -04:00
|
|
|
/*!
|
|
|
|
* @param msgList ref to list summarising client's msgs
|
|
|
|
*/
|
2009-01-30 14:52:47 -05:00
|
|
|
virtual bool getMessageSummaries(std::list<MsgInfoSummary> &msgList);
|
2010-11-02 17:11:11 -04:00
|
|
|
virtual bool getMessage(const std::string &mId, MessageInfo &msg);
|
2010-05-28 10:42:54 -04:00
|
|
|
virtual void getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox, unsigned int *pnTrashbox);
|
2008-02-04 12:55:13 -05:00
|
|
|
|
2010-05-25 05:32:14 -04:00
|
|
|
virtual bool MessageSend(MessageInfo &info);
|
2010-11-02 17:11:11 -04:00
|
|
|
virtual bool MessageToDraft(MessageInfo &info, const std::string &msgParentId);
|
|
|
|
virtual bool MessageToTrash(const std::string &mid, bool bTrash);
|
|
|
|
virtual bool MessageDelete(const std::string &mid);
|
2011-05-23 19:45:31 -04:00
|
|
|
virtual bool MessageRead(const std::string &mid, bool unreadByUser);
|
2010-11-02 17:11:11 -04:00
|
|
|
virtual bool MessageReplied(const std::string &mid, bool replied);
|
|
|
|
virtual bool MessageForwarded(const std::string &mid, bool forwarded);
|
2011-05-23 19:45:31 -04:00
|
|
|
virtual bool MessageStar(const std::string &mid, bool star);
|
2010-11-02 17:11:11 -04:00
|
|
|
virtual bool getMsgParentId(const std::string &msgId, std::string &msgParentId);
|
2008-02-04 12:55:13 -05:00
|
|
|
|
2010-08-22 18:12:26 -04:00
|
|
|
virtual bool getMessageTagTypes(MsgTagType& tags);
|
|
|
|
virtual bool setMessageTagType(uint32_t tagId, std::string& text, uint32_t rgb_color);
|
|
|
|
virtual bool removeMessageTagType(uint32_t tagId);
|
2010-08-19 17:47:26 -04:00
|
|
|
|
2010-11-02 17:11:11 -04:00
|
|
|
virtual bool getMessageTag(const std::string &msgId, MsgTagInfo& info);
|
2010-08-22 18:12:26 -04:00
|
|
|
/* set == false && tagId == 0 --> remove all */
|
2010-11-02 17:11:11 -04:00
|
|
|
virtual bool setMessageTag(const std::string &msgId, uint32_t tagId, bool set);
|
2010-08-22 18:12:26 -04:00
|
|
|
|
|
|
|
virtual bool resetMessageStandardTagTypes(MsgTagType& tags);
|
2010-08-19 17:47:26 -04:00
|
|
|
|
2010-04-27 07:44:06 -04:00
|
|
|
/*!
|
|
|
|
* gets avatar from peer, image data in jpeg format
|
|
|
|
*/
|
2011-09-29 05:20:09 -04:00
|
|
|
virtual void getAvatarData(const std::string& pid,unsigned char *& data,int& size);
|
2010-04-27 07:44:06 -04:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* sets clients avatar, image data should be in jpeg format
|
|
|
|
*/
|
2009-01-30 14:52:47 -05:00
|
|
|
virtual void setOwnAvatarData(const unsigned char *data,int size);
|
2010-04-27 07:44:06 -04:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* retrieve clients avatar, image data in jpeg format
|
|
|
|
*/
|
2009-01-30 14:52:47 -05:00
|
|
|
virtual void getOwnAvatarData(unsigned char *& data,int& size);
|
2008-02-04 12:55:13 -05:00
|
|
|
|
2010-04-27 07:44:06 -04:00
|
|
|
/*!
|
|
|
|
* sets clients custom status (e.g. "i'm tired")
|
|
|
|
*/
|
2009-10-04 18:27:42 -04:00
|
|
|
virtual void setCustomStateString(const std::string& status_string) ;
|
2010-04-27 07:44:06 -04:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* retrieves client's custom status
|
|
|
|
*/
|
2009-09-29 16:37:20 -04:00
|
|
|
virtual std::string getCustomStateString() ;
|
2010-04-27 07:44:06 -04:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* retrieves peer's custom status
|
|
|
|
*/
|
2009-10-04 18:27:42 -04:00
|
|
|
virtual std::string getCustomStateString(const std::string& peer_id) ;
|
2009-09-29 16:37:20 -04:00
|
|
|
|
|
|
|
|
2010-04-27 07:44:06 -04:00
|
|
|
/*!
|
2010-09-01 13:56:15 -04:00
|
|
|
* public chat sent to all peers
|
|
|
|
*/
|
2011-09-29 05:20:09 -04:00
|
|
|
virtual bool sendPublicChat(const std::wstring& msg);
|
2010-09-01 13:56:15 -04:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* chat is sent to specifc peer
|
|
|
|
* @param id peer to send chat msg to
|
|
|
|
*/
|
2011-09-29 05:20:09 -04:00
|
|
|
virtual bool sendPrivateChat(const std::string& id, const std::wstring& msg);
|
2010-09-01 13:56:15 -04:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* returns the count of messages in public or private queue
|
|
|
|
* @param public or private queue
|
2010-04-27 07:44:06 -04:00
|
|
|
*/
|
2010-09-20 20:08:06 -04:00
|
|
|
virtual int getPublicChatQueueCount();
|
2010-04-27 07:44:06 -04:00
|
|
|
|
|
|
|
/*!
|
2010-09-01 13:56:15 -04:00
|
|
|
* @param chats ref to list of received public chats is stored here
|
2010-04-27 07:44:06 -04:00
|
|
|
*/
|
2010-09-01 13:56:15 -04:00
|
|
|
virtual bool getPublicChatQueue(std::list<ChatInfo> &chats);
|
2010-04-27 07:44:06 -04:00
|
|
|
|
2010-09-20 20:08:06 -04:00
|
|
|
/*!
|
|
|
|
* returns the count of messages in private queue
|
|
|
|
* @param public or private queue
|
|
|
|
*/
|
|
|
|
virtual int getPrivateChatQueueCount(bool incoming);
|
|
|
|
|
2010-09-01 13:56:15 -04:00
|
|
|
/*!
|
|
|
|
* @param id's of available private chat messages
|
|
|
|
*/
|
2010-09-20 20:08:06 -04:00
|
|
|
virtual bool getPrivateChatQueueIds(bool incoming, std::list<std::string> &ids);
|
2010-09-01 13:56:15 -04:00
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* @param chats ref to list of received private chats is stored here
|
|
|
|
*/
|
2011-09-29 05:20:09 -04:00
|
|
|
virtual bool getPrivateChatQueue(bool incoming, const std::string& id, std::list<ChatInfo> &chats);
|
2010-09-20 20:08:06 -04:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* @param clear private chat queue
|
|
|
|
*/
|
2011-09-29 05:20:09 -04:00
|
|
|
virtual bool clearPrivateChatQueue(bool incoming, const std::string& id);
|
2010-09-20 20:08:06 -04:00
|
|
|
|
2010-04-27 07:44:06 -04:00
|
|
|
/*!
|
|
|
|
* sends immediate status string to a specific peer, e.g. in a private chat
|
|
|
|
* @param peer_id peer to send status string to
|
|
|
|
* @param status_string immediate status to send
|
|
|
|
*/
|
2011-09-29 05:20:09 -04:00
|
|
|
virtual void sendStatusString(const std::string& peer_id, const std::string& status_string) ;
|
2010-04-27 07:44:06 -04:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* sends immediate status to all peers
|
|
|
|
* @param status_string immediate status to send
|
|
|
|
*/
|
2009-09-29 16:37:20 -04:00
|
|
|
virtual void sendGroupChatStatusString(const std::string& status_string) ;
|
2008-02-04 12:55:13 -05:00
|
|
|
|
2009-01-30 14:52:47 -05:00
|
|
|
/****************************************/
|
2008-02-04 12:55:13 -05:00
|
|
|
|
2011-11-23 17:10:37 -05:00
|
|
|
virtual bool sendLobbyChat(const std::wstring&, const ChatLobbyId&) ;
|
|
|
|
virtual void getChatLobbyList(std::list<ChatLobbyInfo, std::allocator<ChatLobbyInfo> >&) ;
|
|
|
|
virtual void invitePeerToLobby(const ChatLobbyId&, const std::string&) ;
|
2011-11-27 16:04:10 -05:00
|
|
|
virtual void unsubscribeChatLobby(const ChatLobbyId& lobby_id) ;
|
|
|
|
virtual bool setNickNameForChatLobby(const ChatLobbyId& lobby_id,const std::string&) ;
|
|
|
|
virtual bool getNickNameForChatLobby(const ChatLobbyId&,std::string& nick) ;
|
2011-11-27 16:46:49 -05:00
|
|
|
virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const std::list<std::string>& invited_friends) ;
|
2008-02-04 12:55:13 -05:00
|
|
|
|
2009-01-30 14:52:47 -05:00
|
|
|
private:
|
2008-02-04 12:55:13 -05:00
|
|
|
|
2009-01-30 14:52:47 -05:00
|
|
|
p3MsgService *mMsgSrv;
|
|
|
|
p3ChatService *mChatSrv;
|
2008-02-04 12:55:13 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|