aboutsummaryrefslogtreecommitdiff
path: root/lib/user.cpp
AgeCommit message (Collapse)Author
2019-07-09Merge branch 'master' into use-clang-formatKitsune Ral
2019-07-08Room: Set roomId and sender on pending eventsKitsune Ral
Also: refactoring to streamline state events submission.
2019-07-06Be stricter on usage of stateKeyKitsune Ral
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.
2019-06-29Merge remote-tracking branch 'remotes/origin/master' into use-clang-formatKitsune Ral
2019-06-24Merge branch 'master' into clang-formatKitsune Ral
# 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
2019-05-23Move out the logic of the hue calculation to utilsAlexey Andreyev
2019-05-14User::Private::makeHueF: Fix trying to use the moved valueKitsune Ral
2019-05-14Merge pull request #298 from a-andreyev/aa13q-fancy-colorsKitsune Ral
Provide a colour code for the user
2019-05-14Provide a colour code for the userAlexey Andreyev
Contributes to #296
2019-04-06Clean up on clang-tidy/clazy analysisKitsune Ral
2019-03-31User::nameForRoom(): null hint is not a hintKitsune Ral
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.
2019-03-30Room::processStateEvent, User: take the previous membership state from ↵Kitsune Ral
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.
2019-03-24User: strip RLO/LRO markers on renaming as wellKitsune Ral
Continuation of work on #545.
2019-03-02style: apply .clang-format to all .cpp and .h filesMarc Deop
2018-11-17User::isIgnored()Kitsune Ral
2018-11-03User::displayname(): avoid calling nameForRoom twiceKitsune Ral
nameForRoom() is O(n) in this context (n - number of names of a given user).
2018-09-16Remove default avatar.Black Hat
2018-08-11Reverse direct chats mapKitsune Ral
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.
2018-08-11Connection::*DirectChat(): add overloads accepting User*Kitsune Ral
2018-07-04Support ignoring usersKitsune Ral
Closes #215.
2018-05-04New home for the generated code - lib/csapiKitsune Ral
2018-05-04Preempt job/setroomstatejob.* with jobs/generated/room_state.*Kitsune Ral
The template part (not exposed in the auto-generated class) goes to Room::Private::requestSetState(). Also, Room::setMemberState() to interface with User class.
2018-05-03GetRoomEventsJob (replaces RoomMessagesJob) + refactoringKitsune Ral
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.
2018-05-01User::processEvent: add constKitsune Ral
2018-04-27Fix broken User::displayName() logicKitsune Ral
Also, add an assert to Connection::user() to make sure it doesn't create users with invalid ids. Closes #201.
2018-04-27User::rawName(); bonus, bring order to doc commentsKitsune Ral
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).
2018-04-27User::processEvent: fix bridge postfix not being strippedKitsune Ral
Closes #197.
2018-04-02Fixes according to results of static analysisKitsune Ral
Many thanks to clang-tidy and clazy authors for the tools, and to Qt Creator developers for making them easily available in the IDE.
2018-03-31Move source files to a separate folderKitsune Ral
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/).