[MOD/WIP] Use actual router

This commit is contained in:
LDA 2024-06-29 02:12:01 +02:00
commit 0ee79cc586
7 changed files with 183 additions and 87 deletions

28
src/Commands/SetPL.c Normal file
View file

@ -0,0 +1,28 @@
#include <Routes.h>
#include <AS.h>
#include <stdlib.h>
CommandHead(CmdSetPL, cmd, argp)
{
ParseeCmdArg *args = argp;
ParseeData *data = args->data;
char *user = HashMapGet(cmd->arguments, "user");
char *room = HashMapGet(cmd->arguments, "room");
char *pl_str = HashMapGet(cmd->arguments, "pl");
long pl = strtol(pl_str, NULL, 10);
HashMap *map;
if (!user || !pl_str)
{
return;
}
map = ASGetPL(data->config, room);
JsonValueFree(JsonSet(
map, JsonValueInteger(pl),
2, "users", user
));
ASSetPL(data->config, room, map);
}