mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-14 02:15:10 +00:00
[ADD] No-fly, forms
This commit is contained in:
parent
a880769c48
commit
df394172ec
11 changed files with 338 additions and 52 deletions
46
src/XMPPCommands/AddNofly.c
Normal file
46
src/XMPPCommands/AddNofly.c
Normal 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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue