- ported commit from v0.4.x to integrate new RsAvatarItem code

- suppressed compatibility with old avatar transmition code
- added code for storing and sending a custom status string (for e.g. saying "I'm not here now") in p3ChatService
- added code for sending group chat status messages "peer is typing". Not fully functionnal yet.

Warnings: 
- this commit breaks the compatibility for avatar transmission
- the new avatar transmission is not fully working yet




git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1696 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2009-09-29 20:37:20 +00:00
parent dfee01d4d4
commit 396058c665
15 changed files with 388 additions and 112 deletions

View file

@ -39,8 +39,11 @@ const uint32_t RS_CHAT_FLAG_PRIVATE = 0x0001;
const uint32_t RS_CHAT_FLAG_REQUESTS_AVATAR = 0x0002;
const uint32_t RS_CHAT_FLAG_CONTAINS_AVATAR = 0x0004;
const uint32_t RS_CHAT_FLAG_AVATAR_AVAILABLE = 0x0008;
const uint32_t RS_CHAT_FLAG_CUSTOM_STATE = 0x0010; // used for transmitting peer status string
const uint32_t RS_CHAT_FLAG_PUBLIC = 0x0020;
const uint8_t RS_PKT_SUBTYPE_CHAT_STATUS = 0x02 ; // default is 0x01
const uint8_t RS_PKT_SUBTYPE_CHAT_AVATAR = 0x03 ; // default is 0x01
const uint8_t RS_PKT_SUBTYPE_CHAT_STATUS = 0x04 ; // default is 0x01
class RsChatItem: public RsItem
{
@ -90,9 +93,29 @@ class RsChatStatusItem: public RsChatItem
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
uint32_t flags ;
std::string status_string;
};
// This class contains avatar images in Qt format.
//
class RsChatAvatarItem: public RsChatItem
{
public:
RsChatAvatarItem() :RsChatItem(RS_PKT_SUBTYPE_CHAT_AVATAR) {}
RsChatAvatarItem(void *data,uint32_t size) ; // deserialization
virtual ~RsChatAvatarItem() ;
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
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
uint32_t image_size ; // size of data in bytes
unsigned char *image_data ; // image
};
class RsChatSerialiser: public RsSerialType
{
public: