aboutsummaryrefslogtreecommitdiff
path: root/room.h
AgeCommit message (Collapse)Author
2018-03-05Room: addTag() and removeTag()Kitsune Ral
Slightly changed TagRecord constructors to match.
2018-03-05ReadMarkerEvent; TagEvent remade with less boilerplate codeKitsune Ral
tagevent.h -> accountdataevents.h now has a macro to define more simplistic events along the lines of simplestateevents.h but inheriting from Event instead. TagEvent and ReadMarkerEvent(m.fully_read) are defined using this macro. ReadMarkerEvent is also wired through event.* (but not further yet).
2018-03-01Fix tags saving/restoring (finally)Kitsune Ral
Closes #134.
2018-02-27Room: Save tags in the cache; isFavourite() and isLowPriority()Kitsune Ral
2018-02-26Room and Connection: support room tagsKitsune Ral
Closes #134.
2018-02-24User/Room: signal that a user/member is about to change the nameKitsune Ral
Enables to address QMatrixClient/Quaternion#284. Also fixes a gibberish condition in Room::Private::renameMember() that led to improper warnings and a too early return.
2018-02-23Room: user() and memberJoinState(); code cleanupKitsune Ral
Room::user() came instead of Room::Private::member() and memberJoinState() came instead of Private::hasMember.
2018-02-03Room: urlToDownload() and urlToThumbnail()Kitsune Ral
Closes #168.
2018-02-01Room::fileNameToDownload: get a sensible initial name for the file pickerKitsune Ral
Works (at least, should work) with both Qt Widgets and QML.
2018-01-30Room: setName(), setCanonicalAlias()Kitsune Ral
2018-01-25Room, User: expose avatarMediaId(); declare User for the metatype systemKitsune Ral
To make it easy to use User objects and fetch room and user avatars from QML. Closes #155.
2018-01-25Room, User: const-tighten up the code, set QObject namesKitsune Ral
To make debugging (including QML debugging) more convenient.
2018-01-25Expose avatar URLs of Room and User as Q_PROPERTYKitsune Ral
This is needed for QML integration. Closes #155.
2018-01-20Room: store the first displayed event as well; Room::*DisplayedMarker() methodsKitsune Ral
2018-01-18Room: add properties for shown (room/event), message and members countKitsune Ral
Closes #151.
2018-01-18Move links pretty-printing code from Quaternion to libKitsune Ral
This code is useful for all clients, and extensions to pretty-printing can be later added either via making prettyPrint() virtual or even by providing a registry of additional "text transformers" or even "event content renderers" applied to visualise the event.
2018-01-14RoomEvent-aware file up/downloads along with status trackingKitsune Ral
Closes #121; closes #122.
2017-12-28Switch from QPixmap to QImage; add convenience avatar() overloads to Room ↵Kitsune Ral
and User The switch is necessary because MediaThumbnailJob is supposed to return something that can be worked on in non-GUI threads (as is the case of QML image providers), and QPixmap is not supposed for usage out of the main thread.
2017-12-25Room: Remove C++14 code from the header fileKitsune Ral
This will provide some backwards-compatibility to clients that are not ready to move _their_ code to C++14 (at least, it will allow them to not add C++14 requirement to their makefiles as of yet).
2017-12-25Now really switching to the new toolchain: C++14, GCC/Clang 5, Qt 5.6Kitsune Ral
Also a bit of code tightening with some C++14 (but not only) things.
2017-12-14Move all internal event pointers to std::unique_ptr<>Kitsune Ral
This causes the following changes along the way: - Owning<> template is decommissioned. - event.h has been rearranged, and Event/RoomEvent::fromJson static methods have been replaced with an external makeEvent<> function template. A side effect of that is that one cannot use a factory with a type other than the one it's defined for (i.e. you cannot call makeEvent<TypingEvent>) but that feature has been out of use for long anyway. - Room::doAddNewMessageEvents() and Room::doAddHistoricalMessageEvents() have been removed, giving place to Room::onAddNewTimelineEvents() and Room::onAddHistoricalTimelineEvents(). The most important difference is that all code that must be executed now resides in addNewMessageEvents() (it moved from Room to Room::Private) and classes inheriting from Room are not obliged to call the overridden function from the overriding function (they can do it but those functions have empty bodies in Room). This was a long overdue change, and owning pointers simply mandated it. Room::onAddNewTimelineEvents/onAddHistoricalTimelineEvents should not do anything with the passed range in terms of ownership, it's just a way to allow the derived class to update his data in due course. - Room::Private::dropDuplicateEvents() and Room::Private::insertEvents(), notably, have been updated to work with owning pointers. insertEvents() move()s pointers to the timeline, while dropDuplicateEvents uses remove_if instead of stable_partition and doesn't explicitly delete event objects. Also, a bugfix: Event accidentally had not virtual destructor for quite a long time. According to the standard, deleting an object through a pointer to a base class without a virtual destructor leads to UB. So the fact that libqmatrixclient clients even worked all these months is mere coincidence and compiler authors good will :-D
2017-12-14Room::markMessagesAsRead(): Move private overload to pimplKitsune Ral
2017-12-10Enable sending requests for redaction to the serverKitsune Ral
Closes #118
2017-12-10Process incoming redactionsKitsune Ral
This only applies to new messages; historical redaction events are just skipped because historical events are already redacted on the server side. Closes #117.
2017-12-10Elaborate a deprecation commentKitsune Ral
2017-11-02Room: Move away internal methods to not mislead client authorsKitsune Ral
2017-10-30Room::timelineSize() convenience methodKitsune Ral
2017-10-27Support m.room.avatar eventsKitsune Ral
The events are detected in /sync output, and avatars for rooms are loaded from respective URLs. Clients can use Room::avatar() method to request a pixmap of a certain size, and react to avatarChanged() in order to update the UI when new pixmaps/avatars arrive. avatarChanged() signal is overloaded with two tasks - the first firing merely indicates that a new avatar is available (without actual pixmap yet available) while the second firing means that an actual pixmap has arrived (all this is entirely transparent for clients, they just should update their pixmaps from Room::avatar() every time when Room::avatarChanged() is emitted).
2017-10-14Leaving a room now uses a generated Job fileKitsune Ral
2017-10-14Cleanup around Room (potentially breaks API compatibility, beware)Kitsune Ral
Notably: * API for SendEventJob and SetRoomStateJob has been altered to accept references, not pointers. * Methods on Room that invoke requests to the server, have lost const, because they may be reflecting the changed state on the fly, within themselves
2017-10-13Support banning and unbanningKitsune Ral
Closes #38. Also rearranged #includes
2017-10-02Room::id(): return crefKitsune Ral
A cref is still faster than incrementing a refcounter in QString, and all the other COW stuff, and room id is not supposed to change ever.
2017-09-21jobs: SetRoomStateJob (with or without state key); setting room topicKitsune Ral
2017-09-21Merge branch 'master' into kitsune-invite-kickKitsune Ral
2017-09-19Merge branch 'master' into cache-state-to-jsonKitsune Ral
2017-09-09Kicking, inviting, exposing rooms in Invite stateKitsune Ral
Kicking and inviting use generated job classes. Rooms in Invite state are stored separately in the hash from those in Join/Leave state because The Spec says so. For clients, this means that the same room may appear twice in the rooms map if it's been left and then the user was again invited to it. The code in Quaternion that properly processes this will arrive shortly.
2017-09-05Room: memberCount(); slight optimization and reformattingKitsune Ral
2017-09-03More fixesRoman Plášil
2017-08-19Room::localUser() facility methodKitsune Ral
2017-08-16WIP saving intermediate state to JSONRoman Plášil
2017-06-27Enable sending RoomMessageEventsKitsune Ral
1. PostMessageJob is now SendEventJob, which reflects two things: first, it's a PUT instead of a POST (POST for /send is not supported by the latest spec anyway), so that we could enable tracking transaction ids for local echo in the near future; second, it's no more just about messages, the job can support sending any room events (topic changes etc.). 2. Room::postMessage() now uses the new RoomMessageEvent API to send m.room.message events.
2017-06-07Make markAllMessagesAsRead() Q_INVOKABLERoman Plášil
2017-06-02Add Room::memberNames() for nick completion in QMLRoman Plášil
2017-05-22Refactored EventsKitsune Ral
The biggest change is we have no pimpls in Event objects anymore - because it's two new's instead of one per Event, and we have thousands and even more of Events created during initial sync. The other big change is introduction of RoomEvent, so that now the structure of events almost precisely reflects the CS API spec. The refactoring made UnknownEvent unnecessary as a separate class; a respective base class (either RoomEvent or Event) is used for this purpose now. All the other changes are consequences of these (mostly of RoomEvent introduction).
2017-05-13More code cleanup and tweaks; fine-tuning logs; performance improvementsKitsune Ral
After adding some profiling it became clear that to recalculate the room name and emit namesChanged() upon each member event is a waste, especially when there are thousands of those coming at initial sync (*cough* Matrix HQ room). So the room name is recalculated only once and unconditionally (in most cases this will boil down to checking whether name/canonicalAlias changed after processing the events batch), and namesChanged is only emitted once per batch, if any name or alias changed.
2017-05-09LeaveRoomJob now accepts a roomId, not a Room object; Room::leaveRoom() ↵Kitsune Ral
introduced; Connection and Room cleanup Helps to better encapsulate Room
2017-05-09Allow to get a Connection object of the RoomKitsune Ral
It's just natural, after all, Connection is a parent of Room. But seriously, this will be needed when we have rooms from different Connections living next to each other.
2017-05-09Code cleanup and tweaking (partially driven by clang-tidy)Kitsune Ral
Mainly it's about const-ification (in particular, passing const-refs instead of values) and deleting unneeded declarations/#includes. Since the changes alter the external interface, this is submitted as a PR for peer review. One of unneeded declarations/definitions is a virtual destructor in BaseJob descendants. Since a job object should be deleted through QObject::deleteLater() anyway (and it's the only correct way of disposing of the object), all deletions will call the stack of destructors through virtual QObject::~QObject(). Therefore even BaseJob could get on with a non-virtual destructor but for the sake of clarity BaseJob::~BaseJob() is still declared virtual.
2017-04-18Added markAllMessagesAsRead()Kitsune Ral
2017-04-14Enable PostMessageJob to send rich text messagesKitsune Ral