From c15f201d7004eed588d25666b688b4a3b4e6a5a5 Mon Sep 17 00:00:00 2001 From: klondike Date: Fri, 4 Apr 2014 05:06:14 +0200 Subject: [PATCH] Add auth_cred_is_unrestricted --- src/util/credentials.c | 19 +++++++++++++++++++ src/util/credentials.h | 6 ++++++ 2 files changed, 25 insertions(+) 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.