From RetroShare
Jump to: navigation, search

Avatar exchange (csoler)

I've implemented a protocol for exchanging avatar images in private chat. Because this still needs to stay compatible (transparent) to peers that do not handle avatars yet, the protocol is a bit more complex than it should be ultimately:

  1. A warns B that he has an avatar, probably because A has loaded it from disc during conversation. The warning is send in the next available msg to B as a flag.
  2. B reads the flag and asks A to send its avatar. For this B sends an empty msg with RS_FLAG_REQUESTS_AVATAR set.
  3. A receives an empty msg with RS_FLAG_REQUESTS_AVATAR set. So A sends a msg containing the avatar with the RS_CFLAGS
  4. B receives the avatar and stores it for peer A.

If B doesn't handle avatars, he won't see the RS_CHAT_FLAG_AVATAR_AVAILABLE flag in the first msg, so he won't do anything in 2, and messages continue normally.

Avatars are stored in jpeg format in wstrings in p3charservice. See the .h for more info.

All this is implemented in svn=960.

To do

  • ask in the config for a filename for the avatar, and save the avatar somewhere in the config. When starting chat for the first time, read the avatar file,and send it to p3chatservice who is already centralizing avatars. In v960, one needs to re-load an avatar when restarting RS. However, the avatar is automatically shared between all chat windows.
Personal tools

External websites