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);
|
|
|
|
virtual bool getMessage(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);
|
|
|
|
virtual bool MessageToDraft(MessageInfo &info);
|
2010-05-28 10:42:54 -04:00
|
|
|
virtual bool MessageToTrash(std::string mid, bool bTrash);
|
2009-01-30 14:52:47 -05:00
|
|
|
virtual bool MessageDelete(std::string mid);
|
2010-08-22 18:12:26 -04:00
|
|
|
virtual bool MessageRead(std::string mid, bool bUnreadByUser);
|
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-08-22 18:12:26 -04:00
|
|
|
virtual bool getMessageTag(std::string msgId, MsgTagInfo& info);
|
|
|
|
/* set == false && tagId == 0 --> remove all */
|
|
|
|
virtual bool setMessageTag(std::string msgId, uint32_t tagId, bool set);
|
|
|
|
|
|
|
|
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
|
|
|
|
*/
|
2009-01-30 14:52:47 -05:00
|
|
|
virtual void getAvatarData(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
|
|
|
|
|
|
|
|
2009-01-30 14:52:47 -05:00
|
|
|
/****************************************/
|
|
|
|
/* Chat */
|
2010-04-27 07:44:06 -04:00
|
|
|
/*!
|
2010-08-31 13:13:52 -04:00
|
|
|
* sends chat (public and private)
|
|
|
|
* @param ci chat info
|
2010-04-27 07:44:06 -04:00
|
|
|
*/
|
2009-01-30 14:52:47 -05:00
|
|
|
virtual bool ChatSend(ChatInfo &ci);
|
2010-04-27 07:44:06 -04:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* @param chats ref to list of received chats is stored here
|
|
|
|
*/
|
2009-01-30 14:52:47 -05:00
|
|
|
virtual bool getNewChat(std::list<ChatInfo> &chats);
|
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
|
|
|
|
*/
|
2009-05-05 09:18:53 -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
|
|
|
|
|
|
|
|
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
|