[ADD] No-fly, forms

This commit is contained in:
LDA 2024-07-14 11:42:30 +02:00
commit df394172ec
11 changed files with 338 additions and 52 deletions

View file

@ -0,0 +1,46 @@
#include <Cytoplasm/HashMap.h>
#include <Cytoplasm/Memory.h>
#include <Cytoplasm/Json.h>
#include <Cytoplasm/Util.h>
#include <Cytoplasm/Str.h>
#include <Cytoplasm/Log.h>
#include <XMPPFormTool.h>
#include <XMPPCommand.h>
#include <Parsee.h>
#include <XMPP.h>
#include <XML.h>
void
AddNoflyCallback(XMPPCommandManager *m, char *from, XMLElement *form, XMLElement *out)
{
ParseeData *data = XMPPGetManagerCookie(m);
char *trimmed = ParseeTrimJID(from);
char *entity = NULL, *reason = NULL;
GetFieldValue(entity, "entity", form);
GetFieldValue(reason, "reason", form);
if (!ParseeIsAdmin(data, trimmed))
{
SetNote("error", "User is not authorised to execute command.");
Free(trimmed);
return;
}
if (!reason)
{
reason = "[no reason specified]";
}
if (!entity)
{
SetNote("error", "No entity found.");
Free(trimmed);
return;
}
Free(trimmed);
SetNote("info", "User sucessfully put into no-fly.");
ParseeGlobalBan(data, entity, reason);
}