Age | Commit message (Collapse) | Author |
|
Instead of being defined independently, JoinState now uses values from
the Membership enumeration (former MemberEventContent::MembershipType)
that was moved to quotient_common.h for that purpose. Both enumerations
gained a Q_FLAG_NS decoration and operator<< overrides that strip
"Quotient::" prefix when dumping member/join state values to the log -
obviating toCString(JoinState) along the way. Quotient::MembershipType
alias is deprecated from now.
|
|
Closes #481.
|
|
In the normal case there is always a room that is associated with an
user. So it is in most of the cases, possible to load the metadata
(display name and avatar url) with the help of the room.
In some cases, it is not possible. For example, when opening an user
matrix link pointing to an user and not to a room. In this case, we need
to load the metadata independly of the room, since the user is not
linked to a room.
|
|
Not possible previously
|
|
This is needed for a few cases like the account list in NeoChat or the
account switcher. In this cases we don't have a room binded to the user
and can't fetch the real display name and avatar.
|
|
After going through all the files and the history of commits on them
it was clear that some copyright statements are obsolete (the code has
been overwritten since) and some are missing. This commit tries best to
remedy that, along with adding SPDX tags where they were still not used.
Also, a minimal SPDX convention is documented for further contributions.
Closes #426.
|
|
|
|
(cherry picked from commit 0a2acd750a4155969092be674ed3dd9a71b2354f)
|
|
MemberEventContent: displayname and avatarUrl are now Omittables;
CS API doesn't guarantee their presence (see also
https://github.com/matrix-org/matrix-doc/issues/1375) but Quotient
used to assume they are always there, causing #412.
RoomMemberEvent: displayname() -> newDisplayName() and
avatarUrl() -> newAvatarUrl(), to emphasise the actual semantics (and
also the changed interface). The old signatures still work but are
deprecated.
Instead of roomMembername() (with weird camel-casing), three new
methods in addition to safeMemberName() are introduced to Room:
- memberName() - produces the "best known" display name for a
given member; User::name() uses it to avoid the pitfall of #412.
- disambiguatedMemberName() - this is what roomMembername() used to be;
not recommended for direct use when UI is concerned.
- safeMemberName() - remains as is, with the fix to the documentation
that used to mislead that the function returns HTML-escaped content
(it didn't, and doesn't).
- htmlSafeMemberName() - does what safeMemberName() claimed to do.
Respectively, memberNames() is deprecated in favor of safeMemberNames()
and htmlSafeMemberNames(). The corresponding Q_PROPERTY uses
safeMemberNames() now.
Similar to memberName(), Room has got memberAvatarUrl() to spare
User class from diving into Room state to find the member avatar URL.
Closes #412.
|
|
The current mechanism relied on a complicated and fragile machinery
around setNameForRoom() and setAvatarForRoom() that maintained the
"most used" entity for a given user along with "other" ones. Given that
per-room avatars are pretty rare in Matrix, it's also been inefficient
as kitsune-benchmark-set_ForRoom branch shows. The new mechanism stores
the "default" (as per user profile) name and avatar and maintains
a singleton map of avatar objects across all users. Per-user profile
only (normally) exists for the local user so there's yet another
inefficiency that will be fixed further down the road by introducing
a separate user profile class.
|
|
|
|
|
|
User::updateName() usually operates on a specific room; setting an
object name from an arbitrary (whichever came last at any point in time)
room member event for a given user does not look like a good idea.
And having it in User::updateAvatar() seems to be a copy-paste fallout.
|
|
|
|
Users are always parented to their Connection; there's no need to store
a pointer to the connection on top of the one already stored by QObject.
|
|
Bridge postfixes stopped being a thing long ago; since then, bridged()
has nothing but an empty string, and rawName() coincides with name().
|
|
Closes #354.
|
|
Hopefully manages cases like #347 in a better way.
|
|
|
|
|
|
|
|
Also: refactoring to streamline state events submission.
|
|
A few places in the library dealt with state events without any notion
of state_key inside events, including StateEvent[Base] and relevant
functions in Room. A number of workarounds have been made; e.g.,
Room::setMemberState() accepted userId as a separate parameter, ignoring
the state key inside the RoomMemberEvent already passed to it, and
Room::setLocalAliases() had a bug in the initial version where the
function still tried to pass aliases in an event with an empty state
key. This commit fixes this shortcoming: StateEventBase now gets
stateKey as one more parameter, Room::Private::getCurrentState()
respects stateKey and returns properly constructed stub events, and
Room::setMemberState() gives way to a more generic Room::setState() that
works uniformly with whatever state event you pass to it.
|
|
|
|
# Conflicts:
# CMakeLists.txt
# lib/avatar.cpp
# lib/connection.cpp
# lib/connection.h
# lib/connectiondata.cpp
# lib/csapi/account-data.cpp
# lib/csapi/account-data.h
# lib/csapi/capabilities.cpp
# lib/csapi/capabilities.h
# lib/csapi/content-repo.cpp
# lib/csapi/create_room.cpp
# lib/csapi/filter.cpp
# lib/csapi/joining.cpp
# lib/csapi/keys.cpp
# lib/csapi/list_joined_rooms.cpp
# lib/csapi/notifications.cpp
# lib/csapi/openid.cpp
# lib/csapi/presence.cpp
# lib/csapi/pushrules.cpp
# lib/csapi/registration.cpp
# lib/csapi/room_upgrades.cpp
# lib/csapi/room_upgrades.h
# lib/csapi/search.cpp
# lib/csapi/users.cpp
# lib/csapi/versions.cpp
# lib/csapi/whoami.cpp
# lib/csapi/{{base}}.cpp.mustache
# lib/events/accountdataevents.h
# lib/events/eventcontent.h
# lib/events/roommemberevent.cpp
# lib/events/stateevent.cpp
# lib/jobs/basejob.cpp
# lib/jobs/basejob.h
# lib/networkaccessmanager.cpp
# lib/networksettings.cpp
# lib/room.cpp
# lib/room.h
# lib/settings.cpp
# lib/settings.h
# lib/syncdata.cpp
# lib/user.cpp
# lib/user.h
# lib/util.cpp
|
|
|
|
|
|
Provide a colour code for the user
|
|
Contributes to #296
|
|
|
|
This caused the library to erroneously believe that users with no
representation in other rooms have no display name even if that display
name is provided for the given room.
|
|
oldStateEvent
memberJoinState() just happens to return the not-yet-updated state,
making its use around state changes very sensitive to moving things
around. The event's own prevContent is unsigned, therefore untrusted.
|
|
Continuation of work on #545.
|
|
|
|
|
|
nameForRoom() is O(n) in this context (n - number of names of a given
user).
|
|
|
|
Speeds up lookup of user(s) in a direct chat room.
Also: "The other one's" avatar is used to set the avatar of direct
chats only, not any room with 2 participants.
|
|
|
|
Closes #215.
|
|
|
|
The template part (not exposed in the auto-generated class) goes to Room::Private::requestSetState(). Also, Room::setMemberState() to interface with User class.
|
|
1. Updates in this commit (see further) allow to generate and build
GetRoomEventsJob from message_pagination.yaml; this job completely
preempts RoomMessagesJob.
2. EventsBatch<> is no more a thing; there's EventsArray<> to replace it
but it's loaded from a JSON array rather than an event batch (a JSON
array inside another JSON object). SyncJob that used it extensively has
been moved to "conventional" containers (Events, RoomEvents and the
newly introduced StateEvents). RoomMessagesJob that also used
EventsBatch<> is decommissioned (see above).
3. RoomEventsRange is now an alias for Range<RoomEvents>, defined in
util.h (otherwise almost the same).
4. Connection::getMessages() is no more. Use Room::getPreviousContent()
and Connection::callApi<GetRooMEventsJob>() instead.
5. Moving things around in Room, since SyncJob now supplies state events
in more specific StateEvents, rather than RoomEvents.
|
|
|
|
Also, add an assert to Connection::user() to make sure it doesn't create users with invalid ids. Closes #201.
|
|
This new function allows to get the username along with its bridge
(basically, undoing the change applied by processEvent for cases when it
is undesirable).
|
|
Closes #197.
|
|
Many thanks to clang-tidy and clazy authors for the tools, and to Qt Creator developers for making them easily available in the IDE.
|
|
It's been long overdue to separate them from the rest of the stuff (docs etc.). Also, this allows installing to a directory within the checked out git tree (say, ./install/, similar to ./build/).
|