Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
Add basic implementation for the presence endpoints.
Browse files Browse the repository at this point in the history
# State:
- Add Endpoints
- Fix migrations of table filters
- Add only existing users (presence_list)
- Support presence in sync with `since`
- Support sync `set_presence`
- Change some sync response types to event_type collections
- Add config for custom presence timeout
- Clean up `RoomMembership` by moving a user existence test to `User`
- Update Status.md
- Update `ruma-events` to 0.3.0
- Add check before getting `status` endpoint. (Alice and Bob must be in a same Room.)
- Add check before updating `list` endpoint. (Alice and Bob must be in a same Room.)
- Sending a `m.presence` event again after changing `avatar_url` or `displayname`
# Fixes
- #39 
- #40 
- #41
- #42
  • Loading branch information
Jan Jansen committed Jan 16, 2017
1 parent 72f177d commit b7c200f
Show file tree
Hide file tree
Showing 21 changed files with 1,452 additions and 170 deletions.
7 changes: 4 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ r2d2 = "0.7.1"
r2d2-diesel = "0.9.0"
rand = "0.3.15"
router = "0.4.0"
ruma-events = "0.2.0"
ruma-events = "0.3.0"
rustc-serialize = "0.3.21"
serde = "0.8.21"
serde_derive = "0.8.21"
serde_json = "0.8.4"
serde_yaml = "0.5.0"
time = "0.1"
toml = "0.2.1"
unicase = "1.4.0"
url = "1.2.4"
Expand Down
14 changes: 7 additions & 7 deletions STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,22 +296,22 @@ Legend:
<th align="left" colspan="3">Presence</th>
</tr>
<tr>
<td align="center">:no_entry_sign:</td>
<td align="center">:construction:</td>
<td><a href="https://github.com/ruma/ruma/issues/39">#39</a></td>
<td>PUT /presence/:user_id/status</td>
</tr>
<tr>
<td align="center">:no_entry_sign:</td>
<td align="center">:construction:</td>
<td><a href="https://github.com/ruma/ruma/issues/40">#40</a></td>
<td>GET /presence/:user_id/status</td>
</tr>
<tr>
<td align="center">:no_entry_sign:</td>
<td align="center">:construction:</td>
<td><a href="https://github.com/ruma/ruma/issues/41">#41</a></td>
<td>POST /presence/list/:user_id</td>
</tr>
<tr>
<td align="center">:no_entry_sign:</td>
<td align="center">:construction:</td>
<td><a href="https://github.com/ruma/ruma/issues/42">#42</a></td>
<td>GET /presence/list/:user_id</td>
</tr>
Expand Down Expand Up @@ -417,17 +417,17 @@ Legend:
<th align="left" colspan="3">Room tagging</th>
</tr>
<tr>
<td align="center">:no_entry_sign:</td>
<td align="center">:white_check_mark:</td>
<td><a href="https://github.com/ruma/ruma/issues/59">#59</a></td>
<td>PUT /user/:user_id/rooms/:room_id/tags/:tag</td>
</tr>
<tr>
<td align="center">:no_entry_sign:</td>
<td align="center">:white_check_mark:</td>
<td><a href="https://github.com/ruma/ruma/issues/60">#60</a></td>
<td>DELETE /user/:user_id/rooms/:room_id/tags/:tag</td>
</tr>
<tr>
<td align="center">:no_entry_sign:</td>
<td align="center">:white_check_mark:</td>
<td><a href="https://github.com/ruma/ruma/issues/61">#61</a></td>
<td>GET /user/:user_id/rooms/:room_id/tags</td>
</tr>
Expand Down
4 changes: 4 additions & 0 deletions migrations/001_prerelease/down.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ DROP TABLE room_memberships;
DROP TABLE rooms;
DROP TABLE users;
DROP TABLE room_tags;
DROP TABLE filters;
DROP TABLE presence_status;
DROP TABLE presence_list;
DROP TABLE presence_events;
14 changes: 14 additions & 0 deletions migrations/001_prerelease/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,17 @@ CREATE TABLE filters (
content TEXT NOT NULL,
UNIQUE (id, user_id)
);

CREATE TABLE presence_status (
user_id TEXT PRIMARY KEY,
event_id TEXT NOT NULL,
presence TEXT NOT NULL,
status_msg TEXT,
updated_at TIMESTAMP NOT NULL DEFAULT now()
);

CREATE TABLE presence_list (
user_id TEXT NOT NULL,
observed_user_id TEXT NOT NULL,
PRIMARY KEY (user_id, observed_user_id)
);
2 changes: 2 additions & 0 deletions src/api/r0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub use self::join::{InviteToRoom, JoinRoom, JoinRoomWithIdOrAlias, LeaveRoom};
pub use self::login::Login;
pub use self::logout::Logout;
pub use self::members::Members;
pub use self::presence::{GetPresenceList, GetPresenceStatus, PostPresenceList, PutPresenceStatus};
pub use self::profile::{Profile, GetAvatarUrl, PutAvatarUrl, GetDisplayName, PutDisplayName};
pub use self::registration::Register;
pub use self::room_creation::CreateRoom;
Expand All @@ -28,6 +29,7 @@ mod join;
mod login;
mod logout;
mod members;
mod presence;
mod profile;
mod registration;
mod room_creation;
Expand Down
Loading

0 comments on commit b7c200f

Please sign in to comment.