Improve Presence docstring
This commit is contained in:
parent
7af13441a0
commit
f03ac77595
1
TODO.md
1
TODO.md
|
@ -190,7 +190,6 @@
|
||||||
- Option to export-logout-login-import to fix one-time key problems
|
- Option to export-logout-login-import to fix one-time key problems
|
||||||
- Cross-signing
|
- Cross-signing
|
||||||
|
|
||||||
- Status message and presence
|
|
||||||
- Display read receipts on events (who/how many people have read an event)
|
- Display read receipts on events (who/how many people have read an event)
|
||||||
- Fully read markers
|
- Fully read markers
|
||||||
|
|
||||||
|
|
|
@ -34,35 +34,35 @@ class TypeSpecifier(AutoStrEnum):
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Presence:
|
class Presence:
|
||||||
"""Represents a single matrix user presence fields.
|
"""Represents a single matrix user's presence fields.
|
||||||
|
|
||||||
It is stored in `Backend.presences`, indexed by user ID. It must only be
|
These objects are stored in `Backend.presences`, indexed by user ID.
|
||||||
instiated when receiving a `PresenceEvent` or registering an `Account`
|
It must only be instanced when receiving a `PresenceEvent` or
|
||||||
model.
|
registering an `Account` model item.
|
||||||
|
|
||||||
When receiving a `PresenceEvent`, we get or create a `Presence` object in
|
When receiving a `PresenceEvent`, we get or create a `Presence` object in
|
||||||
`Backend.presences` for the targeted user. If the user is registered in any
|
`Backend.presences` for the targeted user. If the user is registered in any
|
||||||
room, add its `Member` object to `members`. And finally update every
|
room, add its `Member` model item to `members`. Finally, update every
|
||||||
`Member` presence fields inside `members`.
|
`Member` presence fields inside `members`.
|
||||||
|
|
||||||
When a room member is registered, we try to find a `Presence` in
|
When a room member is registered, we try to find a `Presence` in
|
||||||
`Backend.presences` for that user ID. If found, add the member to
|
`Backend.presences` for that user ID. If found, the `Member` item is added
|
||||||
`members`.
|
to `members`.
|
||||||
|
|
||||||
When an Account model is registered, we create a `Presence` in
|
When an Account model is registered, we create a `Presence` in
|
||||||
`Backend.presences` for account ID wether the server supports or not
|
`Backend.presences` for the accountu's user ID whether the server supports
|
||||||
presence (we cannot really know at this point). And assign that `Account`
|
presence or not (we cannot know yet at this point),
|
||||||
to `Account` field.
|
and assign that `Account` to the `Presence.account` field.
|
||||||
|
|
||||||
Attributes:
|
Special attributes:
|
||||||
members: A `{room_id: Member}` dict for storing room members related to
|
members: A `{room_id: Member}` dict for storing room members related to
|
||||||
this `Presence`. As each room has its own `Member`s objects, we
|
this `Presence`. As each room has its own `Member`s objects, we
|
||||||
have to keep track of their presence fields. `Member`s are indexed
|
have to keep track of their presence fields. `Member`s are indexed
|
||||||
by room ID.
|
by room ID.
|
||||||
|
|
||||||
account: `Account` related to this `Presence` (if any). Should only be
|
account: `Account` related to this `Presence`, if any. Should be
|
||||||
assigned when client starts (`MatrixClient._start()`) and
|
assigned when client starts (`MatrixClient._start()`) and
|
||||||
unassigned when client stops (`MatrixClient._start()`).
|
cleared when client stops (`MatrixClient._start()`).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class State(AutoStrEnum):
|
class State(AutoStrEnum):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user