-
Notifications
You must be signed in to change notification settings - Fork 60
Implement presence #903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Implement presence #903
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I didn't realise it would be so easy to add this.
But should we also change (or even expose for clients) the sync filter to let the presence events in?
namespace Quotient | ||
{ | ||
|
||
class QUOTIENT_API PresenceEvent : public Quotient::Event { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class QUOTIENT_API PresenceEvent : public Quotient::Event { | |
class QUOTIENT_API PresenceEvent : public Event { |
// To be implemented | ||
for (const auto &event : presenceData) { | ||
auto presenceEvent = eventCast<const PresenceEvent>(event); | ||
auto sender = presenceEvent->fullJson()[u"sender"_s].toString(); // TODO ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto sender = presenceEvent->fullJson()[u"sender"_s].toString(); // TODO ? | |
auto sender = presenceEvent->senderId(); |
Calling it senderId()
to align with RoomEvent
.
QUO_EVENT(PresenceEvent, "m.presence") | ||
|
||
using Event::Event; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QString senderId() const { return fullJson()[SenderKey].toString(); } |
presentUsers.removeAll(sender); | ||
} | ||
} | ||
Q_EMIT q->presenceChanged(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q_EMIT q->presenceChanged(); | |
emit q->presenceChanged(); |
FWIW, this is still very much a draft, in large parts because i still need to figure out what the various fields in the presence event actually mean; the spec is very unclear here. I also want to change the implementation to store the latest presence event for each user instead and just use that to figure out whether the user is online |
No description provided.