mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 23:05:10 +00:00
46 lines
1 KiB
C
46 lines
1 KiB
C
#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);
|
|
}
|