Override part one.

This commit is contained in:
JD Horelick 2010-02-25 16:01:03 -05:00
parent afe430eebb
commit 13a467bb98
7 changed files with 21 additions and 6 deletions

View File

@ -429,6 +429,9 @@ struct ListClient
#define UMODE_OPER 0x1000 /* Operator */
#define UMODE_ADMIN 0x2000 /* Admin on server */
#define UMODE_SSLCLIENT 0x4000 /* using SSL */
#define UMODE_OVERRIDE 0x20000 /* able to override */
#define IsOverride(x) ((x)->umodes & UMODE_OVERRIDE)
/* overflow flags */
/* EARLIER FLAGS ARE IN s_newconf.h */

View File

@ -97,7 +97,7 @@ m_kick(struct Client *client_p, struct Client *source_p, int parc, const char *p
return 0;
}
if(!is_chanop(msptr))
if(!is_chanop(msptr) && !IsOverride(source_p))
{
if(MyConnect(source_p))
{

View File

@ -361,7 +361,7 @@ build_target_list(int p_or_n, const char *command, struct Client *client_p,
msptr = find_channel_membership(chptr, source_p);
if(!IsServer(source_p) && !IsService(source_p) && !is_chanop_voiced(msptr))
if(!IsServer(source_p) && !IsService(source_p) && !is_chanop_voiced(msptr) && !IsOverride(source_p))
{
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
get_id(&me, source_p),

View File

@ -114,7 +114,7 @@ m_topic(struct Client *client_p, struct Client *source_p, int parc, const char *
return 0;
}
if((chptr->mode.mode & MODE_TOPICLIMIT) == 0 || is_chanop(msptr))
if((chptr->mode.mode & MODE_TOPICLIMIT) == 0 || is_chanop(msptr) || IsOverride(source_p))
{
char topic_info[USERHOST_REPLYLEN];

View File

@ -725,6 +725,9 @@ can_join(struct Client *source_p, struct Channel *chptr, char *key)
s_assert(source_p->localClient != NULL);
if(IsOverride(source_p))
return 0;
rb_sprintf(src_host, "%s!%s@%s", source_p->name, source_p->username, source_p->host);
rb_sprintf(src_iphost, "%s!%s@%s", source_p->name, source_p->username, source_p->sockhost);
if(source_p->localClient->mangledhost != NULL)
@ -847,6 +850,9 @@ can_send(struct Channel *chptr, struct Client *source_p, struct membership *mspt
if(is_chanop_voiced(msptr))
return CAN_SEND_OPV;
if(IsOverride(source_p))
return CAN_SEND_NONOP;
if(chptr->mode.mode & MODE_MODERATED)
return CAN_SEND_NO;
@ -879,7 +885,7 @@ find_bannickchange_channel(struct Client *client_p)
char src_host[NICKLEN + USERLEN + HOSTLEN + 6];
char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6];
if (!MyClient(client_p))
if (!MyClient(client_p) || IsOverride(client_p))
return NULL;
rb_sprintf(src_host, "%s!%s@%s", client_p->name, client_p->username, client_p->host);

View File

@ -175,7 +175,7 @@ find_cflag_slot(void)
static int
get_channel_access(struct Client *source_p, struct membership *msptr)
{
if(!MyClient(source_p) || is_chanop(msptr))
if(!MyClient(source_p) || is_chanop(msptr) || IsOverride(source_p))
return CHFL_CHANOP;
return CHFL_PEON;

View File

@ -109,7 +109,7 @@ int user_modes[256] = {
0, /* m */
0, /* n */
UMODE_OPER, /* o */
0, /* p */
UMODE_OVERRIDE, /* p */
0, /* q */
0, /* r */
UMODE_SERVNOTICE, /* s */
@ -1138,6 +1138,12 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, const char
source_p->umodes &= ~UMODE_ADMIN;
}
if(MyConnect(source_p) && (source_p->umodes & UMODE_OVERRIDE) && (!IsOperOverride(source_p)))
{
sendto_one_notice(source_p, ":*** You need oper and the override flag for +p");
source_p->umodes &= ~UMODE_OVERRIDE;
}
/* let modules providing usermodes know that we've changed our usermode --nenolod */
hdata.client = source_p;
hdata.oldumodes = setflags;