summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/Avatars.md44
-rw-r--r--testing/test_avatars.c6
-rw-r--r--toxcore/Messenger.h4
-rw-r--r--toxcore/tox.h4
4 files changed, 24 insertions, 34 deletions
diff --git a/docs/Avatars.md b/docs/Avatars.md
index bd4046d4..f0d7a1eb 100644
--- a/docs/Avatars.md
+++ b/docs/Avatars.md
@@ -88,9 +88,9 @@ in Section "Internal Protocol Description".
88 88
89 This event contain two data fields: (1) the image format and (2) the 89 This event contain two data fields: (1) the image format and (2) the
90 cryptographic hash of the actual image data. Image format may be NONE 90 cryptographic hash of the actual image data. Image format may be NONE
91 (for users who have no avatar or removed their avatars), JPEG, PNG, or 91 (for users who have no avatar or removed their avatars) or PNG. The
92 GIF. The cryptographic hash is intended to be compared with the hash o 92 cryptographic hash is intended to be compared with the hash o the
93 the currently cached avatar (if any) and check if it stills up to date. 93 currently cached avatar (if any) and check if it stills up to date.
94 94
95 - **Avatar Information Requests** are very lightweight messages sent by an 95 - **Avatar Information Requests** are very lightweight messages sent by an
96 user asking for an **avatar information notification**. They may be sent 96 user asking for an **avatar information notification**. They may be sent
@@ -134,9 +134,7 @@ complete API documentation is available in `tox.h`.
134/* Data formats for user avatar images */ 134/* Data formats for user avatar images */
135typedef enum { 135typedef enum {
136 TOX_AVATARFORMAT_NONE, 136 TOX_AVATARFORMAT_NONE,
137 TOX_AVATARFORMAT_JPEG, 137 TOX_AVATARFORMAT_PNG
138 TOX_AVATARFORMAT_PNG,
139 TOX_AVATARFORMAT_GIF
140} 138}
141TOX_AVATARFORMAT; 139TOX_AVATARFORMAT;
142 140
@@ -243,18 +241,18 @@ already downloaded by other clients can be reused.
243 241
244Given the Tox data directory described in STS Draft v0.1.0: 242Given the Tox data directory described in STS Draft v0.1.0:
245 243
246 - The user avatar is stored in a file named "avatar.ext", where "ext" is 244 - The user avatar is stored in a file named "avatar.png". As more formats
247 "jpg", "png", or "gif", according to the image format. Clients should 245 may be used in the future, another extensions are reserved and clients
248 keep just one of these files, with the data of the last avatar set by 246 should keep just one file named "avatar.*", with the data of the last
249 the user. If the user have no avatar, no such files should be kept in 247 avatar set by the user. If the user have no avatar, no such files should
250 the data directory; 248 be kept in the data directory;
251 249
252 - Friends avatars are stored in a directory called "avatars" and named 250 - Friends avatars are stored in a directory called "avatars" and named
253 as "xxxxx.ext", where "xxxxx" is the complete client id encoded as an 251 as "xxxxx.png", where "xxxxx" is the complete client id encoded as an
254 uppercase hexadecimal string and "ext" is "jpg", "png", or "gif", 252 uppercase hexadecimal string and "png" is the extension for the PNG
255 according to the image format. Clients should keep just one of these 253 avatar. As new image formats may be used in the future, clients should
256 files per friend, with the data received from the last avatar data 254 ensure no other file "xxxxx.*" exists. No file should be kept for an user
257 notification. No file should be kept for an user who have no avatar. 255 who have no avatar.
258 256
259 **To be discussed:** User keys are usually presented in Tox clients as 257 **To be discussed:** User keys are usually presented in Tox clients as
260 upper case strings, but lower case file names are more usual. 258 upper case strings, but lower case file names are more usual.
@@ -264,13 +262,13 @@ Example for Linux and other Unix systems, assuming an user called "gildor":
264 262
265 Tox data directory: /home/gildor/.config/tox/ 263 Tox data directory: /home/gildor/.config/tox/
266 Tox data file: /home/gildor/.config/tox/data 264 Tox data file: /home/gildor/.config/tox/data
267 Gildor's avatar: /home/gildor/.config/tox/avatar.jpg 265 Gildor's avatar: /home/gildor/.config/tox/avatar.png
268 Avatar data dir: /home/gildor/.config/tox/avatars/ 266 Avatar data dir: /home/gildor/.config/tox/avatars/
269 Elrond's avatar: /home/gildor/.config/tox/avatars/43656C65627269616E20646F6E277420546F782E426164206D656D6F72696573.jpg 267 Elrond's avatar: /home/gildor/.config/tox/avatars/43656C65627269616E20646F6E277420546F782E426164206D656D6F72696573.png
270 Elladan's avatar: /home/gildor/.config/tox/avatars/49486174655768656E48756D616E735468696E6B49416D4D7942726F74686572.gif 268 Elladan's avatar: /home/gildor/.config/tox/avatars/49486174655768656E48756D616E735468696E6B49416D4D7942726F74686572.png
271 Elrohir's avatar /home/gildor/.config/tox/avatars/726568746F7242794D6D41496B6E696854736E616D75486E6568576574614849.jpg 269 Elrohir's avatar /home/gildor/.config/tox/avatars/726568746F7242794D6D41496B6E696854736E616D75486E6568576574614849.png
272 Arwen's avatar: /home/gildor/.config/tox/avatars/53686520746F6F6B20476C6F7266696E64656C277320706C6163652068657265.png 270 Arwen's avatar: /home/gildor/.config/tox/avatars/53686520746F6F6B20476C6F7266696E64656C277320706C6163652068657265.png
273 Lindir's avatar: /home/gildor/.config/tox/avatars/417070735772697474656E42794D6F7274616C734C6F6F6B54686553616D652E.gif 271 Lindir's avatar: /home/gildor/.config/tox/avatars/417070735772697474656E42794D6F7274616C734C6F6F6B54686553616D652E.png
274 272
275This recommendation is partially implemented by "testing/test_avatars.c". 273This recommendation is partially implemented by "testing/test_avatars.c".
276 274
@@ -456,9 +454,7 @@ the following structure:
456Where 'format' is the image data format, one of the following: 454Where 'format' is the image data format, one of the following:
457 455
458 0 = AVATARFORMAT_NONE (no avatar set) 456 0 = AVATARFORMAT_NONE (no avatar set)
459 1 = AVATARFORMAT_JPEG 457 1 = AVATARFORMAT_PNG
460 2 = AVATARFORMAT_PNG
461 3 = AVATARFORMAT_GIF
462 458
463and 'hash' is the SHA-256 message digest of the avatar data. 459and 'hash' is the SHA-256 message digest of the avatar data.
464 460
diff --git a/testing/test_avatars.c b/testing/test_avatars.c
index 1940d369..124b67c7 100644
--- a/testing/test_avatars.c
+++ b/testing/test_avatars.c
@@ -17,8 +17,8 @@
17 * 17 *
18 * Data dir MAY have: 18 * Data dir MAY have:
19 * 19 *
20 * - A file named avatar.png, avatar.jpg, or avatar.gif. If given, the 20 * - A file named avatar.png. If given, the bot will publish it. Otherwise,
21 * bot will publish it. Otherwhise, no avatar will be set. 21 * no avatar will be set.
22 * 22 *
23 * - A directory named "avatars" with the currently cached avatars. 23 * - A directory named "avatars" with the currently cached avatars.
24 * 24 *
@@ -87,8 +87,6 @@ typedef struct {
87static const def_avatar_name_t def_avatar_names[] = { 87static const def_avatar_name_t def_avatar_names[] = {
88 /* In order of preference */ 88 /* In order of preference */
89 { TOX_AVATARFORMAT_PNG, "png", "avatar.png" }, 89 { TOX_AVATARFORMAT_PNG, "png", "avatar.png" },
90 { TOX_AVATARFORMAT_JPEG, "jpg", "avatar.jpg" },
91 { TOX_AVATARFORMAT_GIF, "gif", "avatar.gif" },
92 { TOX_AVATARFORMAT_NONE, NULL, NULL }, /* Must be the last one */ 90 { TOX_AVATARFORMAT_NONE, NULL, NULL }, /* Must be the last one */
93}; 91};
94 92
diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h
index 33d40f60..499964a7 100644
--- a/toxcore/Messenger.h
+++ b/toxcore/Messenger.h
@@ -142,9 +142,7 @@ USERSTATUS;
142 */ 142 */
143typedef enum { 143typedef enum {
144 AVATARFORMAT_NONE, 144 AVATARFORMAT_NONE,
145 AVATARFORMAT_JPEG, 145 AVATARFORMAT_PNG
146 AVATARFORMAT_PNG,
147 AVATARFORMAT_GIF
148} 146}
149AVATARFORMAT; 147AVATARFORMAT;
150 148
diff --git a/toxcore/tox.h b/toxcore/tox.h
index df348659..f4527785 100644
--- a/toxcore/tox.h
+++ b/toxcore/tox.h
@@ -75,9 +75,7 @@ TOX_USERSTATUS;
75 */ 75 */
76typedef enum { 76typedef enum {
77 TOX_AVATARFORMAT_NONE, 77 TOX_AVATARFORMAT_NONE,
78 TOX_AVATARFORMAT_JPEG, 78 TOX_AVATARFORMAT_PNG
79 TOX_AVATARFORMAT_PNG,
80 TOX_AVATARFORMAT_GIF
81} 79}
82TOX_AVATARFORMAT; 80TOX_AVATARFORMAT;
83 81