[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

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:
LDA 2024-06-08 18:37:54 +02:00
parent 88610a3238
commit bb3d15f2c9

View file

@ -1815,6 +1815,33 @@ RoomAddEventV1(Room *room, PduV1 pdu)
/* TODO: Store DAG relationships, somehow. /* TODO: Store DAG relationships, somehow.
* Also keep track of PDU depth. */ * 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; return true;
} }
HashMap * HashMap *
@ -2015,6 +2042,7 @@ RoomSendInvite(User *sender, bool direct, char *user, Room *room)
} }
ConfigLock(room->db, &conf); ConfigLock(room->db, &conf);
senderID = UserIdParse(UserGetName(sender), conf.serverName); senderID = UserIdParse(UserGetName(sender), conf.serverName);
senderID->sigil = '@';
senderStr = ParserRecomposeCommonID(*senderID); senderStr = ParserRecomposeCommonID(*senderID);
UserIdFree(senderID); UserIdFree(senderID);