mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 22:45:12 +00:00
[MOD/ADD] Use glob-like system for admins.
This commit is contained in:
parent
0fc0fdd6f4
commit
95aaa0dbc9
10 changed files with 154 additions and 13 deletions
|
|
@ -19,6 +19,7 @@
|
|||
if (!prop) \
|
||||
{ \
|
||||
ReplyBasic("Field `" #prop "` REQUIRED."); \
|
||||
goto end; \
|
||||
}
|
||||
|
||||
#define BotDestroy() Free(profile)
|
||||
|
|
|
|||
10
src/include/Glob.h
Normal file
10
src/include/Glob.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef PARSEE_GLOB_H
|
||||
#define PARSEE_GLOB_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/* Verifies if a string matches a rule, as specified in
|
||||
* https://spec.matrix.org/v1.11/appendices/#glob-style-matching. */
|
||||
extern bool GlobMatches(char *rule, char *string);
|
||||
|
||||
#endif
|
||||
|
|
@ -35,10 +35,6 @@ typedef struct ParseeConfig {
|
|||
|
||||
/* ------- DB -------- */
|
||||
char *db_path;
|
||||
|
||||
/* ------- ADMIN ------- */
|
||||
char *jabber_admin;
|
||||
char *matrix_admin;
|
||||
} ParseeConfig;
|
||||
|
||||
typedef struct ParseeData {
|
||||
|
|
@ -217,4 +213,8 @@ extern bool ParseeManageBan(ParseeData *, char *user, char *room);
|
|||
|
||||
/* Same as ParseeVerifyStanza, but DMs */
|
||||
extern bool ParseeVerifyDMStanza(ParseeData *data, char *room_id, char *id);
|
||||
|
||||
|
||||
/* Checks if any user is an admin */
|
||||
extern bool ParseeIsAdmin(ParseeData *data, char *user);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ typedef struct ParseeCmdArg {
|
|||
) \
|
||||
X_COMMAND( \
|
||||
"plumb-muc", CmdPlumb, \
|
||||
"Plumbs an existing Matrix room to a MUC." \
|
||||
"Plumbs an existing Matrix room to a MUC. " \
|
||||
"You'll need to give the Parsee bot enough " \
|
||||
"privileges, however. " \
|
||||
) \
|
||||
|
|
@ -50,6 +50,10 @@ typedef struct ParseeCmdArg {
|
|||
"help", CmdHelp, \
|
||||
"Shows the command list" \
|
||||
) \
|
||||
X_COMMAND( \
|
||||
"adminify", CmdAdmin, \
|
||||
"Adminifies a Matrix glob pattern." \
|
||||
) \
|
||||
X_COMMAND( \
|
||||
"stats", CmdStats, \
|
||||
"Shows some Parsee statistics." \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue