mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 15:35:11 +00:00
[MOD] Make no-fly follow globs
Just that.
This commit is contained in:
parent
033274a0e3
commit
5da9743cb1
2 changed files with 30 additions and 10 deletions
|
|
@ -45,3 +45,7 @@ Not XEPs, but ideas that _needs_ to be added:
|
||||||
- "GIVE THE PUPPETS APPROPRIATE PLS/ROLES" - Hydro/t4d
|
- "GIVE THE PUPPETS APPROPRIATE PLS/ROLES" - Hydro/t4d
|
||||||
"also it [Bifrost] doesn't respect voice either"
|
"also it [Bifrost] doesn't respect voice either"
|
||||||
- https://www.youtube.com/watch?v=InL414iDZmY
|
- https://www.youtube.com/watch?v=InL414iDZmY
|
||||||
|
|
||||||
|
|
||||||
|
------------------------- MSC LAND -------------------------
|
||||||
|
- MSC2346: Bridged metadata is useful, at least for other bridges.
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <Routes.h>
|
#include <Routes.h>
|
||||||
|
#include <Glob.h>
|
||||||
#include <AS.h>
|
#include <AS.h>
|
||||||
|
|
||||||
ParseeData *
|
ParseeData *
|
||||||
|
|
@ -758,11 +759,11 @@ end:
|
||||||
|
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
ParseeGlobalBan(ParseeData *data, char *user, char *reason)
|
ParseeGlobalBan(ParseeData *data, char *glob, char *reason)
|
||||||
{
|
{
|
||||||
DbRef *ref;
|
DbRef *ref;
|
||||||
HashMap *j, *obj;
|
HashMap *j, *obj;
|
||||||
if (!data || !user)
|
if (!data || !glob)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -781,7 +782,7 @@ ParseeGlobalBan(ParseeData *data, char *user, char *reason)
|
||||||
HashMapSet(obj, "reason", JsonValueString(reason));
|
HashMapSet(obj, "reason", JsonValueString(reason));
|
||||||
}
|
}
|
||||||
HashMapSet(obj, "date", JsonValueInteger(UtilTsMillis()));
|
HashMapSet(obj, "date", JsonValueInteger(UtilTsMillis()));
|
||||||
JsonValueFree(HashMapSet(j, user, JsonValueObject(obj)));
|
JsonValueFree(HashMapSet(j, glob, JsonValueObject(obj)));
|
||||||
|
|
||||||
DbUnlock(data->db, ref);
|
DbUnlock(data->db, ref);
|
||||||
}
|
}
|
||||||
|
|
@ -790,7 +791,9 @@ ParseeManageBan(ParseeData *data, char *user, char *room)
|
||||||
{
|
{
|
||||||
DbRef *ref;
|
DbRef *ref;
|
||||||
HashMap *j;
|
HashMap *j;
|
||||||
bool banned;
|
char *key;
|
||||||
|
JsonValue *val;
|
||||||
|
bool banned = false , matches = false;
|
||||||
if (!data || !user)
|
if (!data || !user)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -798,13 +801,26 @@ ParseeManageBan(ParseeData *data, char *user, char *room)
|
||||||
|
|
||||||
ref = DbLock(data->db, 1, "global_bans");
|
ref = DbLock(data->db, 1, "global_bans");
|
||||||
j = DbJson(ref);
|
j = DbJson(ref);
|
||||||
banned = !!HashMapGet(j, user);
|
while (HashMapIterate(j, &key, (void **) &val))
|
||||||
DbUnlock(data->db, ref);
|
|
||||||
|
|
||||||
if (banned && room)
|
|
||||||
{
|
{
|
||||||
ASBan(data->config, room, user);
|
HashMap *obj = JsonValueAsObject(val);
|
||||||
|
if (matches)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (GlobMatches(key, user))
|
||||||
|
{
|
||||||
|
banned = true;
|
||||||
|
matches = true;
|
||||||
|
if (room)
|
||||||
|
{
|
||||||
|
/* TODO: Use the object to set the reason */
|
||||||
|
ASBan(data->config, room, user);
|
||||||
|
(void) obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
DbUnlock(data->db, ref);
|
||||||
|
|
||||||
return banned;
|
return banned;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue