- Added chat lobby privacy type to lobby invite => lobby type is propagated correctly to friends

that are invited.
- added auto-clean of nicknames
- added auto-clean of public lobby records.

Warning: this commit breaks one small bit of compatibility:
 * direct invitations from new versions will pass accross versions (private lobbies will need the new version)
 * but people can still join public lobbies accross versions.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4801 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-01-14 21:09:04 +00:00
parent 79998dd70c
commit 036bd64811
5 changed files with 83 additions and 21 deletions

View file

@ -307,7 +307,8 @@ uint32_t RsChatLobbyInviteItem::serial_size()
{
uint32_t s = 8; /* header */
s += 8; // lobby_id
s += GetTlvStringSize(lobby_name) ; // lobby name
s += GetTlvStringSize(lobby_name) ; // lobby_name
s += 4; // lobby_privacy_level
return s;
}
@ -589,6 +590,7 @@ bool RsChatLobbyInviteItem::serialise(void *data, uint32_t& pktsize)
ok &= setRawUInt64(data, tlvsize, &offset, lobby_id);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, lobby_name);
ok &= setRawUInt32(data, tlvsize, &offset, lobby_privacy_level);
if (offset != tlvsize)
{
@ -893,6 +895,7 @@ RsChatLobbyInviteItem::RsChatLobbyInviteItem(void *data,uint32_t /*size*/)
/* get mandatory parts first */
ok &= getRawUInt64(data, rssize, &offset, &lobby_id);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_NAME, lobby_name);
ok &= getRawUInt32(data, rssize, &offset, &lobby_privacy_level);
#ifdef CHAT_DEBUG
std::cerr << "Building new chat msg item." << std::endl ;
@ -913,7 +916,7 @@ RsPrivateChatMsgConfigItem::RsPrivateChatMsgConfigItem(void *data,uint32_t /*siz
/* get mandatory parts first */
uint32_t version = 0;
ok &= getRawUInt32(data, rssize, &offset, &version);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_PEERID, configPeerId);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_PEERID, configPeerId);
ok &= getRawUInt32(data, rssize, &offset, &chatFlags);
ok &= getRawUInt32(data, rssize, &offset, &configFlags);
ok &= getRawUInt32(data, rssize, &offset, &sendTime);

View file

@ -51,8 +51,8 @@ const uint32_t RS_CHATMSG_CONFIGFLAG_INCOMING = 0x0001;
const uint8_t RS_PKT_SUBTYPE_CHAT_AVATAR = 0x03 ;
const uint8_t RS_PKT_SUBTYPE_CHAT_STATUS = 0x04 ;
const uint8_t RS_PKT_SUBTYPE_PRIVATECHATMSG_CONFIG = 0x05 ;
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_MSG_DEPRECATED= 0x06 ; // don't use !
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE = 0x07 ;
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_MSG_DEPRECATED= 0x06 ; // don't use ! Deprecated
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE_DEPREC = 0x07 ; // don't use ! Deprecated
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_ACCEPT = 0x08 ;
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_CHALLENGE = 0x09 ;
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_UNSUBSCRIBE = 0x0A ;
@ -60,6 +60,7 @@ const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_EVENT = 0x0B ;
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_MSG = 0x0C ;
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_REQUEST = 0x0D ;
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_LIST = 0x0E ;
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE = 0x0F ;
// for defining tags themselves and msg tags
const uint8_t RS_PKT_SUBTYPE_MSG_TAG_TYPE = 0x03;
@ -239,6 +240,7 @@ class RsChatLobbyInviteItem: public RsChatItem
ChatLobbyId lobby_id ;
std::string lobby_name ;
uint32_t lobby_privacy_level ;
virtual bool serialise(void *data,uint32_t& size) ; // Isn't it better that items can serialize themselves ?
virtual uint32_t serial_size() ; // deserialise is handled using a constructor