Add rsChats/getAvatar and rsChats/getOwnAvatar to the JSON API - #350
Open
jolavillette wants to merge 1 commit into
Open
Add rsChats/getAvatar and rsChats/getOwnAvatar to the JSON API#350jolavillette wants to merge 1 commit into
jolavillette wants to merge 1 commit into
Conversation
Contributor
|
@G10h4ck review? |
jolavillette
force-pushed
the
feature/jsonapi-chat-avatar
branch
5 times, most recently
from
August 3, 2026 15:20
15ba816 to
45d75b2
Compare
jolavillette
force-pushed
the
feature/jsonapi-chat-avatar
branch
from
August 4, 2026 18:29
45d75b2 to
178ebd9
Compare
Add rsChats/getAvatar and rsChats/getOwnAvatar to the JSON API.
Both return the avatar as a RsGxsImage, which is the container already
used to carry identity avatars over the JSON API. Its serial_process()
goes through RsTypeSerializer::RawMemoryWrapper, so the base64 wrapping
of the binary payload is produced by the serialization layer itself
rather than by the service, and the resulting representation
({"mData": {"base64": "..."}}) is the same one API clients already
handle for identity avatars.
The existing getAvatarData() is left untouched: it hands out a raw
malloc'ed buffer and an int size, which is neither serializable nor
usable from the JSON API, and the GUI still relies on it. Its
"create bookkeeping entry then ask the peer, at most once a minute"
part is factored out into locked_requestAvatar() and shared with the
new getAvatar(), and its out parameters are now explicitly cleared when
no avatar is available.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
jolavillette
force-pushed
the
feature/jsonapi-chat-avatar
branch
from
August 6, 2026 23:16
178ebd9 to
5e600a5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add rsChats/getAvatar and rsChats/getOwnAvatar to the JSON API.
Supersedes #341 and #321, which encoded base64 by hand inside
p3ChatService.
Both methods return the avatar as an RsGxsImage, the container already
used to carry identity avatars over the JSON API. Its serial_process()
goes through RsTypeSerializer::RawMemoryWrapper, so the base64 wrapping
of the binary payload is produced by the serialization layer itself
rather than by the service, as requested in #1977. The resulting
representation is the one API clients already handle for identity
avatars:
When the avatar of a peer is not known yet, getAvatar() returns false
and asks the peer for it, so a later call may succeed.
The existing getAvatarData() is kept as is for its existing callers: it
hands out a raw malloc'ed buffer and an int size, which is neither
serializable nor usable from the JSON API, and the GUI still relies on
it. Its "create bookkeeping entry then ask the peer, at most once a
minute" part is factored out into locked_requestAvatar() and shared
with the new getAvatar(), and its out parameters are now explicitly
cleared when no avatar is available.