mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 21:25:11 +00:00
[ADD] Add a few basic MUC commands
This commit is contained in:
parent
d4371ac30b
commit
7f7ab41afa
5 changed files with 70 additions and 14 deletions
|
|
@ -21,12 +21,6 @@ AdminsCallback(XMPPCommandManager *m, char *from, XMLElement *form, XMLElement *
|
|||
XMLElement *title;
|
||||
XMLElement *reported, *item, *field, *value, *txt;
|
||||
|
||||
if (!ParseeIsAdmin(data, trimmed))
|
||||
{
|
||||
SetNote("error", "User is not authorised to execute command.");
|
||||
Free(trimmed);
|
||||
return;
|
||||
}
|
||||
Free(trimmed);
|
||||
x = XMLCreateTag("x");
|
||||
title = XMLCreateTag("title");
|
||||
|
|
|
|||
49
src/XMPPCommands/MUCInformation.c
Normal file
49
src/XMPPCommands/MUCInformation.c
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#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
|
||||
MUCInformationID(XMPPCommandManager *m, char *from, XMLElement *form, XMLElement *out)
|
||||
{
|
||||
ParseeData *data = XMPPGetManagerCookie(m);
|
||||
char *muc = ParseeTrimJID(from);
|
||||
char *chat_id = ParseeGetFromMUCID(data, muc);
|
||||
char *room_id = ParseeGetRoomID(data, chat_id);
|
||||
char *msg = StrConcat(5,
|
||||
"The MUC ", muc, " is bridged to ", room_id, "."
|
||||
);
|
||||
|
||||
SetNote("info", msg);
|
||||
|
||||
Free(muc);
|
||||
Free(msg);
|
||||
Free(room_id);
|
||||
Free(chat_id);
|
||||
(void) form;
|
||||
}
|
||||
void
|
||||
MUCInformationCID(XMPPCommandManager *m, char *from, XMLElement *form, XMLElement *out)
|
||||
{
|
||||
ParseeData *data = XMPPGetManagerCookie(m);
|
||||
char *muc = ParseeTrimJID(from);
|
||||
char *chat_id = ParseeGetFromMUCID(data, muc);
|
||||
char *msg = StrConcat(5,
|
||||
"The MUC ", muc, "'s internal ID is ", chat_id, "."
|
||||
);
|
||||
|
||||
SetNote("info", msg);
|
||||
|
||||
Free(muc);
|
||||
Free(msg);
|
||||
Free(chat_id);
|
||||
(void) form;
|
||||
}
|
||||
|
|
@ -26,13 +26,6 @@ StatusCallback(XMPPCommandManager *m, char *from, XMLElement *form, XMLElement *
|
|||
XMLElement *x;
|
||||
XMLElement *title, *txt;
|
||||
|
||||
if (!ParseeIsAdmin(data, trimmed))
|
||||
{
|
||||
SetNote("error", "User is not authorised to execute command.");
|
||||
|
||||
Free(trimmed);
|
||||
return;
|
||||
}
|
||||
Free(trimmed);
|
||||
x = XMLCreateTag("x");
|
||||
title = XMLCreateTag("title");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue