Added First Pass at a chat RPC protocol.

This still needs to be generalised further - and made future proof.
 It is based roughly on libretroshare/src/retroshare/rsmsgs.h



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5485 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-08-29 23:42:00 +00:00
parent 60e1d5e68e
commit bd1435c72b
2 changed files with 216 additions and 2 deletions

View File

@ -0,0 +1,212 @@
package rsctrl.chat;
import "core.proto";
///////////////////////////////////////////////////////////////
// Private, Group and Chat Lobby RPC.
///////////////////////////////////////////////////////////////
enum RequestMsgIds {
MsgId_RequestChatLobbies = 1;
MsgId_RequestCreateLobby = 2;
MsgId_RequestJoinOrLeaveLobby = 3;
MsgId_RequestSetLobbyNickname = 4;
MsgId_RequestRegisterEvents = 5;
MsgId_RequestSendMessage = 6;
}
enum ResponseMsgIds {
// STANDARD RESPONSES.
MsgId_ResponseChatLobbies = 1;
MsgId_ResponseRegisterEvents = 2;
MsgId_ResponseSendMessage = 6;
// EVENTS
MsgId_EventLobbyInvite = 101;
MsgId_EventChatMessage = 102;
}
///////////////////////////////////////////////////////////////
// BUILDING BLOCKS.
// This is a combination of ChatLobbyInfo & PublicChatLobbyRecord.
// Which seem very similar??
enum LobbyPrivacyLevel {
PRIVATE = 1;
PUBLIC = 2;
}
enum ChatType {
TYPE_PRIVATE = 1;
TYPE_LOBBY = 2;
TYPE_GROUP = 3;
}
message ChatLobbyInfo {
required string lobby_id = 1;
required string lobby_topic = 2;
required string lobby_name = 3;
required string lobby_nickname = 4; // empty for none set.
enum LobbyState {
JOINED = 1;
INVITED = 2;
PUBLIC = 3;
}
required LobbyPrivacyLevel privacy_level = 5;
required LobbyState lobby_state = 6;
required uint32 no_peers = 7;
required uint32 last_report_time = 8;
required uint32 last_activity = 9;
repeated string participating_friends = 10; // SSL_IDS?
repeated string nick_names = 11;
}
message ChatMessage {
required ChatType chat_type = 1;
required string chat_id = 2;
required string peer_nickname = 3;
required uint32 chatflags = 4;
required uint32 sendTime = 5;
required uint32 recvTime = 6;
required string msg = 7;
}
// RESPONSE: ResponseChatLobbies
// This is a generic Response - used often.
// lobbies, will contain a list of affected / requested Lobbies.
message ResponseChatLobbies {
required rsctrl.core.Status status = 1;
repeated ChatLobbyInfo lobbies = 2;
}
///////////////////////////////////////////////////////////////
// REQUEST: RequestChatLobbies
message RequestChatLobbies {
enum LobbyType {
ALL = 1;
NEW = 2;
INVITED = 3;
PRIVATE = 4;
PUBLIC = 5;
}
required LobbyType lobby_type = 1;
}
// RESPONSE: ResponseChatLobbies
///////////////////////////////////////////////////////////////
// REQUEST: RequestCreateLobby
message RequestCreateLobby {
required string lobby_name = 1;
required string lobby_topic = 2;
required LobbyPrivacyLevel privacy_level = 4;
repeated string invited_friends = 3; // SSL_IDS?
}
// RESPONSE: ResponseChatLobbies
///////////////////////////////////////////////////////////////
// Accept / Deny Invite, Join / Leave Lobby (these can be combined?)
// REQUEST: RequestJoinOrLeaveLobby
message RequestJoinOrLeaveLobby {
enum LobbyAction {
JOIN_OR_ACCEPT = 1;
LEAVE_OR_DENY = 2;
}
required string lobby_id = 1;
required LobbyAction action = 2;
}
// RESPONSE: ResponseChatLobbies
///////////////////////////////////////////////////////////////
// Set Nickname.
// Get is done via requesting ChatLobby Info.
// Empty lobby_ids => default id.
// REQUEST: RequestSetLobbyNickname
message RequestSetLobbyNickname {
required string nickname = 1;
repeated string lobby_ids = 2;
}
// RESPONSE: ResponseChatLobbies
///////////////////////////////////////////////////////////////
// Request Chat Events.
// This is done by registering for events.
// REQUEST: ReqestRegisterEvents
message RequestRegisterEvents {
enum RegisterAction {
REGISTER = 1;
DEREGISTER = 1;
}
required RegisterAction action = 1;
}
// RESPONSE: ResponseRegisterEvents
message ResponseRegisterEvents {
required rsctrl.core.Status status = 1;
}
// RESPONSE: EventLobbyInvite
message EventLobbyInvite {
required ChatLobbyInfo lobby = 1;
}
// RESPONSE: EventChatMessage
message EventChatMessage {
required ChatMessage msg = 1;
}
///////////////////////////////////////////////////////////////
// Send Message.
// Request Chat Events.
// This is done by registering for events.
// REQUEST: RequestSendMessage
message RequestSendMessage {
required ChatMessage msg = 2;
}
// RESPONSE: ResponseSendMessage
message ResponseSendMessage {
required rsctrl.core.Status status = 1;
}
///////////////////////////////////////////////////////////////

View File

@ -14,8 +14,10 @@ enum ExtensionId { CORE = 0; }
enum PackageId {
PEERS = 1;
SYSTEM = 2;
FILES = 3;
MSGS = 4;
// BELOW HERE IS STILL BEING DESIGNED.
//CHAT = 3;
//FILES = 4;
//MSGS = 5;
// THEORETICAL ONES.
GXS = 1000;