Improvements to chat lobbies:

- added generic methods and items for bouncing generic objects through lobbies
	- added handling of peer typing status
	- proper handling of peer join/leave lobby
	- added sub item ids to lobby messages to allow proper message splitting
	- made 2 different message splitting methods for normal chat vs. lobbies. In v0.6, we'll have to handle all messages the same way.
	- added parent id to RsChatLobbyMsgItem, to allow threaded chat.
	- added possibility to make a lobby public/private (not yet fully working)
	- added items for requesting/exchanging list of public lobbies at friends' (not yet fully working)
	- major cleaning of p3chatservice.cc

Next move:
	- gui for listing friend public lobbies, joining them, etc.
	- load/save of persistent lobbies.
	- autoremove of inactive lobbies

Warning: lobby message items of this version are incompatible with previous versions. It won't crash, but
messages will not pass through.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4755 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-01-06 22:17:08 +00:00
parent e430612714
commit e9d6940b09
20 changed files with 965 additions and 296 deletions

View file

@ -186,6 +186,7 @@ class NotifyBase
virtual void notifyListChange(int list, int type) { (void) list; (void) type; return; }
virtual void notifyErrorMsg(int list, int sev, std::string msg) { (void) list; (void) sev; (void) msg; return; }
virtual void notifyChatStatus(const std::string& /* peer_id */, const std::string& /* status_string */ ,bool /* is_private */) {}
virtual void notifyChatLobbyEvent(uint64_t /* lobby id */,uint32_t /* event type */,const std::string& /* nickname */,const std::string& /* any string */) {}
virtual void notifyCustomState(const std::string& /* peer_id */, const std::string& /* status_string */) {}
virtual void notifyHashingInfo(uint32_t type, const std::string& fileinfo) { (void) type; (void)fileinfo; }
virtual void notifyTurtleSearchResult(uint32_t /* search_id */ ,const std::list<TurtleFileInfo>& files) { (void)files; }

View file

@ -55,6 +55,11 @@
#define RS_MSG_FORWARDED 0x0100 /* Message is forwarded */
#define RS_MSG_STAR 0x0200 /* Message is marked with a star */
#define RS_CHAT_LOBBY_EVENT_PEER_LEFT 0x01
#define RS_CHAT_LOBBY_EVENT_PEER_STATUS 0x02
#define RS_CHAT_LOBBY_EVENT_PEER_JOINED 0x03
#define RS_CHAT_LOBBY_EVENT_PEER_CHANGE_NICKNAME 0x04
#define RS_MSGTAGTYPE_IMPORTANT 1
#define RS_MSGTAGTYPE_WORK 2
#define RS_MSGTAGTYPE_PERSONAL 3
@ -62,6 +67,9 @@
#define RS_MSGTAGTYPE_LATER 5
#define RS_MSGTAGTYPE_USER 100
#define RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC 1 /* lobby is visible by friends. Friends can connect.*/
#define RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE 2 /* lobby invisible by friends. Peers on invitation only .*/
typedef uint64_t ChatLobbyId ;
typedef uint64_t ChatLobbyMsgId ;
typedef std::string ChatLobbyNickName ;
@ -148,15 +156,21 @@ class ChatLobbyInvite
std::string peer_id ;
std::string lobby_name ;
};
class ChatLobbyInfo
class PublicChatLobbyRecord
{
public:
ChatLobbyId lobby_id ; // unique id of the lobby
std::string nick_name ; // nickname to use for this lobby
std::string lobby_name ; // name to use for this lobby
std::set<std::string> participating_friends ; // list of direct friend who participate. Used to broadcast sent messages.
};
class ChatLobbyInfo: public PublicChatLobbyRecord
{
public:
std::string nick_name ; // nickname to use for this lobby
uint32_t lobby_privacy_level ; // see RS_CHAT_LOBBY_
std::set<std::string> nick_names ; // list of non direct friend who participate. Used to display only.
time_t last_activity ; // last recorded activity. Useful for removing dead lobbies.
};
std::ostream &operator<<(std::ostream &out, const MessageInfo &info);
@ -240,7 +254,7 @@ virtual bool setNickNameForChatLobby(const ChatLobbyId& lobby_id,const std::stri
virtual bool getNickNameForChatLobby(const ChatLobbyId& lobby_id,std::string& nick) = 0 ;
virtual bool setDefaultNickNameForChatLobby(const std::string& nick) = 0;
virtual bool getDefaultNickNameForChatLobby(std::string& nick) = 0 ;
virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const std::list<std::string>& invited_friends) = 0 ;
virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const std::list<std::string>& invited_friends,uint32_t lobby_privacy_type) = 0 ;
/****************************************/