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"
|
2014-03-29 10:18:05 -04:00
|
|
|
#include "retroshare/rsgxsifacetypes.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
|
|
|
|
*/
|
2015-03-22 00:45:01 -04:00
|
|
|
virtual bool getMessageSummaries(std::list<Rs::Msgs::MsgInfoSummary> &msgList);
|
|
|
|
virtual bool getMessage(const std::string &mId, Rs::Msgs::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
|
|
|
|
2015-03-22 00:45:01 -04:00
|
|
|
virtual bool MessageSend(Rs::Msgs::MessageInfo &info);
|
2013-10-03 17:41:34 -04:00
|
|
|
virtual bool SystemMessage(const std::string &title, const std::string &message, uint32_t systemFlag);
|
2015-03-22 00:45:01 -04:00
|
|
|
virtual bool MessageToDraft(Rs::Msgs::MessageInfo &info, const std::string &msgParentId);
|
2010-11-02 17:11:11 -04:00
|
|
|
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);
|
2013-09-24 16:19:21 -04:00
|
|
|
virtual bool MessageLoadEmbeddedImages(const std::string &mid, bool load);
|
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
|
|
|
|
2015-03-22 00:45:01 -04:00
|
|
|
virtual bool getMessageTagTypes(Rs::Msgs::MsgTagType& tags);
|
2010-08-22 18:12:26 -04:00
|
|
|
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
|
|
|
|
2015-03-22 00:45:01 -04:00
|
|
|
virtual bool getMessageTag(const std::string &msgId, Rs::Msgs::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
|
|
|
|
2015-03-22 00:45:01 -04:00
|
|
|
virtual bool resetMessageStandardTagTypes(Rs::Msgs::MsgTagType& tags);
|
2010-08-19 17:47:26 -04:00
|
|
|
|
2013-07-31 12:34:34 -04:00
|
|
|
virtual void enableDistantMessaging(bool b) ;
|
|
|
|
virtual bool distantMessagingEnabled() ;
|
|
|
|
|
2010-04-27 07:44:06 -04:00
|
|
|
/*!
|
|
|
|
* gets avatar from peer, image data in jpeg format
|
|
|
|
*/
|
2014-03-17 16:56:06 -04:00
|
|
|
virtual void getAvatarData(const RsPeerId& 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
|
|
|
|
*/
|
2014-03-17 16:56:06 -04:00
|
|
|
virtual std::string getCustomStateString(const RsPeerId& peer_id) ;
|
2009-09-29 16:37:20 -04:00
|
|
|
|
|
|
|
|
2010-04-27 07:44:06 -04:00
|
|
|
/*!
|
2014-12-29 16:41:05 -05:00
|
|
|
* Send a chat message.
|
|
|
|
* @param destination where to send the chat message
|
|
|
|
* @param msg the message
|
|
|
|
* @see ChatId
|
2010-09-01 13:56:15 -04:00
|
|
|
*/
|
2014-12-29 16:41:05 -05:00
|
|
|
virtual bool sendChat(ChatId destination, std::string msg) ;
|
2010-09-20 20:08:06 -04:00
|
|
|
|
2014-07-06 07:33:04 -04:00
|
|
|
/*!
|
|
|
|
* Return the max message size for security forwarding
|
|
|
|
*/
|
2014-12-16 05:39:56 -05:00
|
|
|
virtual uint32_t getMaxMessageSecuritySize(int type);
|
2014-07-06 07:33:04 -04:00
|
|
|
|
2010-04-27 07:44:06 -04:00
|
|
|
/*!
|
|
|
|
* sends immediate status string to a specific peer, e.g. in a private chat
|
2014-12-29 16:41:05 -05:00
|
|
|
* @param chat_id chat id to send status string to
|
2010-04-27 07:44:06 -04:00
|
|
|
* @param status_string immediate status to send
|
|
|
|
*/
|
2014-12-29 16:41:05 -05:00
|
|
|
virtual void sendStatusString(const ChatId& chat_id, 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
|
|
|
|
2015-03-06 16:13:23 -05:00
|
|
|
virtual bool joinVisibleChatLobby(const ChatLobbyId& id, const RsGxsId &own_id) ;
|
2012-12-04 16:36:05 -05:00
|
|
|
virtual void getListOfNearbyChatLobbies(std::vector<VisibleChatLobbyRecord>& public_lobbies) ;
|
2014-03-17 16:56:06 -04:00
|
|
|
virtual bool getVirtualPeerId(const ChatLobbyId& id,RsPeerId& vpid) ;
|
|
|
|
virtual bool isLobbyId(const RsPeerId& virtual_peer_id,ChatLobbyId& lobby_id) ;
|
2015-03-06 16:13:23 -05:00
|
|
|
virtual void getChatLobbyList(std::list<ChatLobbyId>& cl_list) ;
|
|
|
|
virtual bool getChatLobbyInfo(const ChatLobbyId& id,ChatLobbyInfo& info) ;
|
|
|
|
virtual void invitePeerToLobby(const ChatLobbyId&, const RsPeerId&) ;
|
|
|
|
virtual bool acceptLobbyInvite(const ChatLobbyId& id, const RsGxsId &gxs_id) ;
|
2012-01-07 14:52:58 -05:00
|
|
|
virtual void denyLobbyInvite(const ChatLobbyId& id) ;
|
|
|
|
virtual void getPendingChatLobbyInvites(std::list<ChatLobbyInvite>& invites) ;
|
|
|
|
virtual void unsubscribeChatLobby(const ChatLobbyId& lobby_id) ;
|
2015-03-06 16:13:23 -05:00
|
|
|
virtual bool setIdentityForChatLobby(const ChatLobbyId& lobby_id,const RsGxsId&) ;
|
|
|
|
virtual bool getIdentityForChatLobby(const ChatLobbyId&,RsGxsId& nick) ;
|
|
|
|
virtual bool setDefaultIdentityForChatLobby(const RsGxsId&) ;
|
2015-05-17 06:13:32 -04:00
|
|
|
virtual void getDefaultIdentityForChatLobby(RsGxsId& nick) ;
|
2013-06-29 12:15:33 -04:00
|
|
|
virtual void setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const bool autoSubscribe);
|
|
|
|
virtual bool getLobbyAutoSubscribe(const ChatLobbyId& lobby_id);
|
2015-04-17 17:36:22 -04:00
|
|
|
virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic,const std::set<RsPeerId>& invited_friends,ChatLobbyFlags privacy_type) ;
|
2008-02-04 12:55:13 -05:00
|
|
|
|
2014-11-18 10:55:31 -05:00
|
|
|
virtual bool initiateDistantChatConnexion(const RsGxsId& to_gxs_id,const RsGxsId& from_gxs_id,uint32_t& error_code) ;
|
2015-02-08 16:06:36 -05:00
|
|
|
virtual bool getDistantChatStatus(const RsGxsId& gxs_id,uint32_t& status, RsGxsId *from_gxs_id=NULL) ;
|
2014-11-16 17:46:18 -05:00
|
|
|
virtual bool closeDistantChatConnexion(const RsGxsId &pid) ;
|
2013-04-10 17:21:52 -04: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
|