diff --git a/src/util/credentials.c b/src/util/credentials.c index f4a2820..ee72627 100644 --- a/src/util/credentials.c +++ b/src/util/credentials.c @@ -19,6 +19,25 @@ #include "uhub.h" +/** + * Returns 1 if a user is unrestricted. + * Unrestricted users override the limits of flood and can send messages in + * the name of other users. + * This is useful for amongst other external chatrooms. + */ +int auth_cred_is_unrestricted(enum auth_credentials cred) +{ + switch (cred) + { + case auth_cred_ubot: + case auth_cred_opubot: + return 1; + default: + break; + } + return 0; +} + int auth_cred_is_protected(enum auth_credentials cred) { switch (cred) diff --git a/src/util/credentials.h b/src/util/credentials.h index 7fdbe43..540b96e 100644 --- a/src/util/credentials.h +++ b/src/util/credentials.h @@ -35,6 +35,12 @@ enum auth_credentials auth_cred_admin, /**<<< "User is identified as a hub administrator/owner" */ }; +/** + * Returns 1 if the credentials means that a user is unrestricted. + * Returns 0 otherwise. + */ +int auth_cred_is_unrestricted(enum auth_credentials cred); + /** * Returns 1 if the credentials means that a user is protected. * Returns 0 otherwise.