Finish up capabilities for now.

This commit is contained in:
Jordan Bancino 2023-04-25 22:11:34 +00:00
parent e1367d5bff
commit 96ca9a725d
2 changed files with 9 additions and 1 deletions

View file

@ -55,7 +55,7 @@ Milestone: v0.3.0
[ ] Attach device id to user object
[ ] Use UserAuthenticate()
[~] 9: User Data
[ ] 5: Capabilities negotiation
[x] 5: Capabilities negotiation
[ ] 10: Security (Rate Limiting)
Milestone: v0.4.0

View file

@ -34,18 +34,26 @@ ROUTE_IMPL(RouteCapabilities, path, argp)
{
HashMap *response;
HashMap *capabilities;
HashMap *roomVersions;
(void) path;
(void) argp;
response = HashMapCreate();
capabilities = HashMapCreate();
roomVersions = HashMapCreate();
JsonSet(capabilities, JsonValueBoolean(1), 2, "m.change_password", "enabled");
JsonSet(capabilities, JsonValueBoolean(1), 2, "m.set_displayname", "enabled");
JsonSet(capabilities, JsonValueBoolean(1), 2, "m.set_avatar_url", "enabled");
JsonSet(capabilities, JsonValueBoolean(0), 2, "m.3pid_changes", "enabled");
/* TODO: When more room versions are implemented, add them to roomVersions */
HashMapSet(roomVersions, "1", JsonValueString("unstable"));
JsonSet(capabilities, JsonValueString("1"), 2, "m.room_versions", "default");
JsonSet(capabilities, JsonValueObject(roomVersions), 2, "m.room_versions", "available");
HashMapSet(response, "capabilities", JsonValueObject(capabilities));
return response;
}