diff --git a/XEPS-TBD.TXT b/XEPS-TBD.TXT index d8ae43c..bd8107c 100644 --- a/XEPS-TBD.TXT +++ b/XEPS-TBD.TXT @@ -45,3 +45,7 @@ Not XEPs, but ideas that _needs_ to be added: - "GIVE THE PUPPETS APPROPRIATE PLS/ROLES" - Hydro/t4d "also it [Bifrost] doesn't respect voice either" - https://www.youtube.com/watch?v=InL414iDZmY + + +------------------------- MSC LAND ------------------------- +- MSC2346: Bridged metadata is useful, at least for other bridges. diff --git a/src/Parsee/Data.c b/src/Parsee/Data.c index 3241981..6ae39de 100644 --- a/src/Parsee/Data.c +++ b/src/Parsee/Data.c @@ -9,6 +9,7 @@ #include #include +#include #include ParseeData * @@ -758,11 +759,11 @@ end: } void -ParseeGlobalBan(ParseeData *data, char *user, char *reason) +ParseeGlobalBan(ParseeData *data, char *glob, char *reason) { DbRef *ref; HashMap *j, *obj; - if (!data || !user) + if (!data || !glob) { return; } @@ -781,7 +782,7 @@ ParseeGlobalBan(ParseeData *data, char *user, char *reason) HashMapSet(obj, "reason", JsonValueString(reason)); } HashMapSet(obj, "date", JsonValueInteger(UtilTsMillis())); - JsonValueFree(HashMapSet(j, user, JsonValueObject(obj))); + JsonValueFree(HashMapSet(j, glob, JsonValueObject(obj))); DbUnlock(data->db, ref); } @@ -790,7 +791,9 @@ ParseeManageBan(ParseeData *data, char *user, char *room) { DbRef *ref; HashMap *j; - bool banned; + char *key; + JsonValue *val; + bool banned = false , matches = false; if (!data || !user) { return false; @@ -798,13 +801,26 @@ ParseeManageBan(ParseeData *data, char *user, char *room) ref = DbLock(data->db, 1, "global_bans"); j = DbJson(ref); - banned = !!HashMapGet(j, user); - DbUnlock(data->db, ref); - - if (banned && room) + while (HashMapIterate(j, &key, (void **) &val)) { - 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; }