forked from Telodendria/Telodendria
[MOD/FIX] Update user list at the lowest level
Some checks are pending
Compile Telodendria / Compile Telodendria (x86, alpine-v3.19) (push) Waiting to run
Compile Telodendria / Compile Telodendria (x86, debian-v12.4) (push) Waiting to run
Compile Telodendria / Compile Telodendria (x86, freebsd-v14.0) (push) Waiting to run
Compile Telodendria / Compile Telodendria (x86, netbsd-v9.3) (push) Waiting to run
Compile Telodendria / Compile Telodendria (x86_64, alpine-v3.19) (push) Waiting to run
Compile Telodendria / Compile Telodendria (x86_64, debian-v12.4) (push) Waiting to run
Compile Telodendria / Compile Telodendria (x86_64, freebsd-v14.0) (push) Waiting to run
Compile Telodendria / Compile Telodendria (x86_64, netbsd-v9.3) (push) Waiting to run
Compile Telodendria / Compile Telodendria (x86_64, openbsd-v7.4) (push) Waiting to run
Some checks are pending
Compile Telodendria / Compile Telodendria (x86, alpine-v3.19) (push) Waiting to run
Compile Telodendria / Compile Telodendria (x86, debian-v12.4) (push) Waiting to run
Compile Telodendria / Compile Telodendria (x86, freebsd-v14.0) (push) Waiting to run
Compile Telodendria / Compile Telodendria (x86, netbsd-v9.3) (push) Waiting to run
Compile Telodendria / Compile Telodendria (x86_64, alpine-v3.19) (push) Waiting to run
Compile Telodendria / Compile Telodendria (x86_64, debian-v12.4) (push) Waiting to run
Compile Telodendria / Compile Telodendria (x86_64, freebsd-v14.0) (push) Waiting to run
Compile Telodendria / Compile Telodendria (x86_64, netbsd-v9.3) (push) Waiting to run
Compile Telodendria / Compile Telodendria (x86_64, openbsd-v7.4) (push) Waiting to run
I'll need to start defining a `diffs' system for sync. I have a decent idea on how that could go(with 1 level of batching), but I'll need to consider it some.
This commit is contained in:
parent
88610a3238
commit
bb3d15f2c9
1 changed files with 29 additions and 1 deletions
30
src/Room.c
30
src/Room.c
|
@ -279,7 +279,7 @@ RoomPopulate(Room *room, User *user, RoomCreateRequest *req, ServerPart s)
|
|||
for (i = 0; i < ArraySize(req->invite); i++)
|
||||
{
|
||||
char *user_id = ArrayGet(req->invite, i);
|
||||
|
||||
|
||||
if (!user_id || !ValidCommonID(user_id, '@'))
|
||||
{
|
||||
/* TODO: Raise error. */
|
||||
|
@ -1815,6 +1815,33 @@ RoomAddEventV1(Room *room, PduV1 pdu)
|
|||
/* TODO: Store DAG relationships, somehow.
|
||||
* Also keep track of PDU depth. */
|
||||
|
||||
if (StrEquals(pdu.type, "m.room.member"))
|
||||
{
|
||||
CommonID *id = UserIdParse(pdu.state_key, NULL);
|
||||
User *user = UserLock(room->db, id->local);
|
||||
char *membership = JsonValueAsString(
|
||||
HashMapGet(pdu.content, "membership")
|
||||
);
|
||||
|
||||
if (StrEquals(membership, "join") && user)
|
||||
{
|
||||
UserAddJoin(user, room->id);
|
||||
}
|
||||
else if (StrEquals(membership, "invite") && user)
|
||||
{
|
||||
UserAddInvite(user, room->id);
|
||||
}
|
||||
else if ((StrEquals(membership, "leave") && user) ||
|
||||
StrEquals(membership, "ban"))
|
||||
{
|
||||
UserRemoveInvite(user, room->id);
|
||||
UserRemoveJoin(user, room->id);
|
||||
}
|
||||
|
||||
UserIdFree(id);
|
||||
UserUnlock(user);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
HashMap *
|
||||
|
@ -2015,6 +2042,7 @@ RoomSendInvite(User *sender, bool direct, char *user, Room *room)
|
|||
}
|
||||
ConfigLock(room->db, &conf);
|
||||
senderID = UserIdParse(UserGetName(sender), conf.serverName);
|
||||
senderID->sigil = '@';
|
||||
senderStr = ParserRecomposeCommonID(*senderID);
|
||||
UserIdFree(senderID);
|
||||
|
||||
|
|
Loading…
Reference in a new issue