Move user_is_protected() and user_is_registered() into user.h/.c
This commit is contained in:
parent
1dbf2640d2
commit
6853e92f89
43
src/inf.c
43
src/inf.c
@ -39,8 +39,6 @@ static void remove_server_restricted_flags(struct adc_message* cmd)
|
|||||||
adc_msg_remove_named_argument(cmd, ADC_INF_FLAG_REFERER);
|
adc_msg_remove_named_argument(cmd, ADC_INF_FLAG_REFERER);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int user_is_protected(struct user* user);
|
|
||||||
|
|
||||||
static int set_feature_cast_supports(struct user* u, struct adc_message* cmd)
|
static int set_feature_cast_supports(struct user* u, struct adc_message* cmd)
|
||||||
{
|
{
|
||||||
char *it, *tmp;
|
char *it, *tmp;
|
||||||
@ -584,47 +582,6 @@ static int set_credentials(struct hub_info* hub, struct user* user, struct adc_m
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines if a user is to be let into the hub even if the hub is "full".
|
|
||||||
*/
|
|
||||||
static int user_is_protected(struct user* user)
|
|
||||||
{
|
|
||||||
switch (user->credentials)
|
|
||||||
{
|
|
||||||
case cred_bot:
|
|
||||||
case cred_operator:
|
|
||||||
case cred_super:
|
|
||||||
case cred_admin:
|
|
||||||
case cred_link:
|
|
||||||
return 1;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns 1 if a user is registered.
|
|
||||||
* Only registered users will be let in if the hub is configured for registered
|
|
||||||
* users only.
|
|
||||||
*/
|
|
||||||
static int user_is_registered(struct user* user)
|
|
||||||
{
|
|
||||||
switch (user->credentials)
|
|
||||||
{
|
|
||||||
case cred_bot:
|
|
||||||
case cred_user:
|
|
||||||
case cred_operator:
|
|
||||||
case cred_super:
|
|
||||||
case cred_admin:
|
|
||||||
case cred_link:
|
|
||||||
return 1;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int check_is_hub_full(struct hub_info* hub, struct user* user)
|
static int check_is_hub_full(struct hub_info* hub, struct user* user)
|
||||||
{
|
{
|
||||||
|
37
src/user.c
37
src/user.c
@ -299,6 +299,43 @@ int user_is_disconnecting(struct user* user)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int user_is_protected(struct user* user)
|
||||||
|
{
|
||||||
|
switch (user->credentials)
|
||||||
|
{
|
||||||
|
case cred_bot:
|
||||||
|
case cred_operator:
|
||||||
|
case cred_super:
|
||||||
|
case cred_admin:
|
||||||
|
case cred_link:
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns 1 if a user is registered.
|
||||||
|
* Only registered users will be let in if the hub is configured for registered
|
||||||
|
* users only.
|
||||||
|
*/
|
||||||
|
int user_is_registered(struct user* user)
|
||||||
|
{
|
||||||
|
switch (user->credentials)
|
||||||
|
{
|
||||||
|
case cred_bot:
|
||||||
|
case cred_user:
|
||||||
|
case cred_operator:
|
||||||
|
case cred_super:
|
||||||
|
case cred_admin:
|
||||||
|
case cred_link:
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
11
src/user.h
11
src/user.h
@ -200,6 +200,17 @@ extern int user_is_connecting(struct user* user);
|
|||||||
*/
|
*/
|
||||||
extern int user_is_disconnecting(struct user* user);
|
extern int user_is_disconnecting(struct user* user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns 1 if a user is protected, which includes users
|
||||||
|
* having any form of elevated privileges.
|
||||||
|
*/
|
||||||
|
extern int user_is_protected(struct user* user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns 1 if a user is registered, with or without privileges.
|
||||||
|
*/
|
||||||
|
extern int user_is_registered(struct user* user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User supports the protocol extension as given in fourcc.
|
* User supports the protocol extension as given in fourcc.
|
||||||
* This is usually set while the user is connecting, but can
|
* This is usually set while the user is connecting, but can
|
||||||
|
Loading…
Reference in New Issue
Block a user