Track joined rooms
FossilOrigin-Name: 366f90be1acd4208fc680860c86914588ebfe465fd603095edc0648965a9b892
This commit is contained in:
parent
28b47e985c
commit
c0c1dc06b6
2 changed files with 30 additions and 1 deletions
|
@ -423,6 +423,9 @@ validateHomeserver(OFURL *homeserver)
|
||||||
|
|
||||||
- (void)processRoomsSync: (OFDictionary<OFString *, id> *)rooms
|
- (void)processRoomsSync: (OFDictionary<OFString *, id> *)rooms
|
||||||
{
|
{
|
||||||
|
[self processJoinedRooms: rooms[@"join"]];
|
||||||
|
[self processInvitedRooms: rooms[@"invite"]];
|
||||||
|
[self processLeftRooms: rooms[@"leave"]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)processPresenceSync: (OFDictionary<OFString *, id> *)presence
|
- (void)processPresenceSync: (OFDictionary<OFString *, id> *)presence
|
||||||
|
@ -436,4 +439,30 @@ validateHomeserver(OFURL *homeserver)
|
||||||
- (void)processToDeviceSync: (OFDictionary<OFString *, id> *)toDevice
|
- (void)processToDeviceSync: (OFDictionary<OFString *, id> *)toDevice
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)processJoinedRooms: (OFDictionary<OFString *, id> *)rooms
|
||||||
|
{
|
||||||
|
if (rooms == nil)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (OFString *roomID in rooms)
|
||||||
|
[_storage addJoinedRoom: roomID
|
||||||
|
forUser: _userID];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)processInvitedRooms: (OFDictionary<OFString *, id> *)rooms
|
||||||
|
{
|
||||||
|
if (rooms == nil)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)processLeftRooms: (OFDictionary<OFString *, id> *)rooms
|
||||||
|
{
|
||||||
|
if (rooms == nil)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (OFString *roomID in rooms)
|
||||||
|
[_storage removeJoinedRoom: roomID
|
||||||
|
forUser: _userID];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
@"SELECT next_batch FROM next_batch\n"
|
@"SELECT next_batch FROM next_batch\n"
|
||||||
@"WHERE device_id=$device_id"] retain];
|
@"WHERE device_id=$device_id"] retain];
|
||||||
_joinedRoomsAddStatement = [[_conn prepareStatement:
|
_joinedRoomsAddStatement = [[_conn prepareStatement:
|
||||||
@"INSERT INTO joined_rooms (\n"
|
@"INSERT OR REPLACE INTO joined_rooms (\n"
|
||||||
@" user_id, room_id\n"
|
@" user_id, room_id\n"
|
||||||
@") VALUES (\n"
|
@") VALUES (\n"
|
||||||
@" $user_id, $room_id\n"
|
@" $user_id, $room_id\n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue