From bf2c5110dbb02eb4d60948143087382d01347c04 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Wed, 11 Sep 2019 17:43:17 +0200 Subject: [PATCH] IsPerson() -> IsUser(), MyClient() -> MyUser(), etc. This so we have a few simple concepts: Client: this can be a user, server, or something unknown yet Then the type of clients: User: this is a user, someone with a nick name. Server: this is a server Etc. --- include/struct.h | 29 ++++++------ src/aliases.c | 4 +- src/api-channelmode.c | 4 +- src/api-extban.c | 2 +- src/api-moddata.c | 2 +- src/api-usermode.c | 20 ++++---- src/bsd.c | 10 ++-- src/channel.c | 26 +++++----- src/conf.c | 2 +- src/hash.c | 14 +++--- src/ircd.c | 14 +++--- src/list.c | 4 +- src/misc.c | 14 +++--- src/modules.c | 2 +- src/modules/admin.c | 2 +- src/modules/antimixedutf8.c | 2 +- src/modules/antirandom.c | 2 +- src/modules/authprompt.c | 4 +- src/modules/away.c | 4 +- src/modules/blacklist.c | 2 +- src/modules/botmotd.c | 2 +- src/modules/cap.c | 8 ++-- src/modules/chanmodes/floodprot.c | 30 ++++++------ src/modules/chanmodes/history.c | 6 +-- src/modules/chanmodes/link.c | 8 ++-- src/modules/chanmodes/nocolor.c | 6 +-- src/modules/chanmodes/noctcp.c | 2 +- src/modules/chanmodes/noinvite.c | 4 +- src/modules/chanmodes/nokick.c | 2 +- src/modules/chanmodes/noknock.c | 2 +- src/modules/chanmodes/operonly.c | 2 +- src/modules/chanmodes/secureonly.c | 2 +- src/modules/chanmodes/stripcolor.c | 6 +-- src/modules/chghost.c | 8 ++-- src/modules/chgident.c | 4 +- src/modules/chgname.c | 2 +- src/modules/connect.c | 4 +- src/modules/dccallow.c | 4 +- src/modules/dccdeny.c | 2 +- src/modules/echo-message.c | 4 +- src/modules/extbans/inchannel.c | 2 +- src/modules/extbans/msgbypass.c | 2 +- src/modules/extbans/operclass.c | 2 +- src/modules/extbans/textban.c | 4 +- src/modules/extbans/timedban.c | 6 +-- src/modules/globops.c | 4 +- src/modules/help.c | 2 +- src/modules/invite.c | 2 +- src/modules/ircops.c | 2 +- src/modules/ison.c | 2 +- src/modules/join.c | 10 ++-- src/modules/jointhrottle.c | 8 ++-- src/modules/jumpserver.c | 2 +- src/modules/kick.c | 26 +++++----- src/modules/kill.c | 14 +++--- src/modules/knock.c | 2 +- src/modules/labeled-response.c | 4 +- src/modules/list.c | 2 +- src/modules/locops.c | 2 +- src/modules/md.c | 2 +- src/modules/message.c | 28 +++++------ src/modules/mode.c | 76 +++++++++++++++--------------- src/modules/motd.c | 2 +- src/modules/nick.c | 28 +++++------ src/modules/oper.c | 2 +- src/modules/part.c | 12 ++--- src/modules/pingpong.c | 6 +-- src/modules/quit.c | 4 +- src/modules/reputation.c | 4 +- src/modules/restrict-commands.c | 4 +- src/modules/rmtkl.c | 2 +- src/modules/sajoin.c | 2 +- src/modules/sapart.c | 2 +- src/modules/sasl.c | 6 +-- src/modules/server.c | 4 +- src/modules/sethost.c | 8 ++-- src/modules/setident.c | 4 +- src/modules/setname.c | 2 +- src/modules/silence.c | 4 +- src/modules/sinfo.c | 2 +- src/modules/sjoin.c | 2 +- src/modules/squit.c | 4 +- src/modules/staff.c | 2 +- src/modules/stats.c | 4 +- src/modules/svsjoin.c | 2 +- src/modules/svsmode.c | 10 ++-- src/modules/svsnolag.c | 2 +- src/modules/svsnoop.c | 2 +- src/modules/svspart.c | 2 +- src/modules/svssilence.c | 2 +- src/modules/svssno.c | 2 +- src/modules/svswatch.c | 2 +- src/modules/tkl.c | 18 +++---- src/modules/topic.c | 12 ++--- src/modules/trace.c | 4 +- src/modules/tsctl.c | 2 +- src/modules/undccdeny.c | 2 +- src/modules/userip.c | 2 +- src/modules/usermodes/bot.c | 2 +- src/modules/usermodes/censor.c | 2 +- src/modules/usermodes/noctcp.c | 2 +- src/modules/usermodes/nokick.c | 2 +- src/modules/usermodes/servicebot.c | 4 +- src/modules/vhost.c | 6 +-- src/modules/watch.c | 2 +- src/modules/who_old.c | 8 ++-- src/modules/whois.c | 8 ++-- src/modules/whox.c | 6 +-- src/numeric.c | 4 +- src/operclass.c | 2 +- src/parse.c | 8 ++-- src/send.c | 16 +++---- src/serv.c | 16 +++---- src/socket.c | 2 +- src/tls.c | 2 +- src/user.c | 10 ++-- src/windows/service.c | 2 +- 117 files changed, 376 insertions(+), 377 deletions(-) diff --git a/include/struct.h b/include/struct.h index 567f8f655..a8ea26beb 100644 --- a/include/struct.h +++ b/include/struct.h @@ -253,12 +253,12 @@ typedef enum ClientStatus { CLIENT_STATUS_ME = -2, /**< Client is &me (this server) */ CLIENT_STATUS_UNKNOWN = -1, /**< Client is doing a hanshake. May become a server or user later, we don't know yet */ CLIENT_STATUS_SERVER = 0, /**< Client is a server (fully authenticated) */ - CLIENT_STATUS_CLIENT = 1, /**< Client is a user (fully authenticated) */ + CLIENT_STATUS_USER = 1, /**< Client is a user (fully authenticated) */ } ClientStatus; -#define MyConnect(x) ((x)->local) /**< Is a locally connected client (server, person or user) */ -#define MyClient(x) (MyConnect(x) && IsRegisteredUser(x)) /**< Is a locally connected user/person */ -#define IsRegisteredUser(x) ((x)->status == CLIENT_STATUS_CLIENT) /**< Is a user/person that has completed the connection handshake */ +#define MyConnect(x) ((x)->local) /**< Is a locally connected client (server or user) */ +#define MyUser(x) (MyConnect(x) && IsUser(x)) /**< Is a locally connected user */ +#define IsUser(x) ((x)->status == CLIENT_STATUS_USER) /**< Is a user that has completed the connection handshake */ #define IsRegistered(x) ((x)->status >= CLIENT_STATUS_SERVER) /**< Client has completed the connection handshake (user or server) */ #define IsConnecting(x) ((x)->status == CLIENT_STATUS_CONNECTING) /**< Is an outgoing connect to another server */ #define IsHandshake(x) ((x)->status == CLIENT_STATUS_HANDSHAKE) /**< Is doing a handshake (while connecting to another server) */ @@ -280,7 +280,7 @@ typedef enum ClientStatus { #define SetMe(x) ((x)->status = CLIENT_STATUS_ME) #define SetUnknown(x) ((x)->status = CLIENT_STATUS_UNKNOWN) #define SetServer(x) ((x)->status = CLIENT_STATUS_SERVER) -#define SetClient(x) ((x)->status = CLIENT_STATUS_CLIENT) +#define SetUser(x) ((x)->status = CLIENT_STATUS_USER) #define SetLog(x) ((x)->status = CLIENT_STATUS_LOG) /* @} */ @@ -364,8 +364,7 @@ typedef enum ClientStatus { #define IsInvisible(x) ((x)->umodes & UMODE_INVISIBLE) #define IsARegNick(x) ((x)->umodes & (UMODE_REGNICK)) #define IsRegNick(x) ((x)->umodes & UMODE_REGNICK) -#define IsPerson(x) ((x)->user && IsRegisteredUser(x)) -#define SendWallops(x) (!IsMe(x) && IsPerson(x) && ((x)->umodes & UMODE_WALLOP)) +#define SendWallops(x) (!IsMe(x) && IsUser(x) && ((x)->umodes & UMODE_WALLOP)) #define IsHidden(x) ((x)->umodes & UMODE_HIDE) #define IsSetHost(x) ((x)->umodes & UMODE_SETHOST) #define IsHideOper(x) ((x)->umodes & UMODE_HIDEOPER) @@ -719,7 +718,7 @@ struct User { #ifdef LIST_DEBUG Client *bcptr; #endif - char *operlogin; /* Only used if person is/was opered, used for oper::maxlogins */ + char *operlogin; /* Only used if user is/was opered, used for oper::maxlogins */ struct { time_t nick_t; unsigned char nick_c; @@ -975,7 +974,7 @@ extern void unload_all_unused_moddata(void); #define TLSFLAG_DISABLECLIENTCERT 0x10 /** A client on this or a remote server. - * Every client (person, server, unknown,..) has this Client structure associated with it. + * Every client (user, server, unknown,..) has this Client structure associated with it. */ struct Client { struct list_head client_node; /**< For global client list (client_list) */ @@ -985,18 +984,18 @@ struct Client { struct list_head special_node; /**< For special lists (server || unknown || oper) */ ClientStatus status; /**< Client status, one of CLIENT_STATUS_* */ LocalClient *local; /**< Additional information regarding locally connected clients */ - ClientUser *user; /**< Additional information, if this client is a user/person */ + ClientUser *user; /**< Additional information, if this client is a user */ Server *serv; /**< Additional information, if this is a server */ time_t lastnick; /**< Timestamp on nick */ long flags; /**< Client flags (one or more of CLIENT_FLAG_*) */ - long umodes; /**< Client usermodes (if user/person) */ + long umodes; /**< Client usermodes (if user) */ Client *direction; /**< Direction from which this client originated. This always points to a directly connected server or &me. It is never NULL */ unsigned char hopcount; /**< Number of servers to this, 0 means local client */ - char name[HOSTLEN + 1]; /**< Unique name of the client: nickname for persons, hostname for servers */ + char name[HOSTLEN + 1]; /**< Unique name of the client: nickname for users, hostname for servers */ char ident[USERLEN + 1]; /**< Ident of the user, if available. Otherwise set to "unknown". */ - char info[REALLEN + 1]; /**< Additional client information text. For persons this is gecos/realname */ + char info[REALLEN + 1]; /**< Additional client information text. For users this is gecos/realname */ char id[IDLEN + 1]; /**< Unique ID: SID or UID */ Client *srvptr; /**< Server on where this client is connected to (can be &me) */ char *ip; /**< IP address of user or server (never NULL) */ @@ -1678,7 +1677,7 @@ struct Channel { char chname[1]; }; -/** user/channel membership struct for local clients */ +/** user/channel membership struct for users */ struct MembershipL { struct Membership *next; @@ -1687,7 +1686,7 @@ struct MembershipL ModData moddata[MODDATA_MAX_MEMBERSHIP]; /* for modules */ }; -/** user/channel membership struct for remote clients */ +/** user/channel membership struct for remote users */ struct Membership { struct Membership *next; diff --git a/src/aliases.c b/src/aliases.c index 35778bb2c..33a7411d7 100644 --- a/src/aliases.c +++ b/src/aliases.c @@ -91,7 +91,7 @@ int m_alias(Client *cptr, Client *sptr, MessageTag *mtags, int parc, char *parv[ { if (alias->spamfilter && (ret = run_spamfilter(sptr, parv[1], SPAMF_USERMSG, alias->nick, 0, NULL)) < 0) return ret; - if (MyClient(acptr)) + if (MyUser(acptr)) sendto_one(acptr, NULL, ":%s!%s@%s PRIVMSG %s :%s", sptr->name, sptr->user->username, GetHost(sptr), alias->nick, parv[1]); @@ -226,7 +226,7 @@ int m_alias(Client *cptr, Client *sptr, MessageTag *mtags, int parc, char *parv[ { if (alias->spamfilter && (ret = run_spamfilter(sptr, output, SPAMF_USERMSG, format->nick, 0, NULL)) < 0) return ret; - if (MyClient(acptr)) + if (MyUser(acptr)) sendto_one(acptr, NULL, ":%s!%s@%s PRIVMSG %s :%s", sptr->name, sptr->user->username, IsHidden(sptr) ? sptr->user->virthost : sptr->user->realhost, format->nick, output); diff --git a/src/api-channelmode.c b/src/api-channelmode.c index bcfc78e11..4a59f97b0 100644 --- a/src/api-channelmode.c +++ b/src/api-channelmode.c @@ -410,7 +410,7 @@ void cm_freeparameter_ex(void **p, char mode, char *str) int extcmode_default_requirechop(Client *cptr, Channel *chptr, char mode, char *para, int checkt, int what) { - if (IsPerson(cptr) && is_chan_op(cptr, chptr)) + if (IsUser(cptr) && is_chan_op(cptr, chptr)) return EX_ALLOW; if (checkt == EXCHK_ACCESS_ERR) /* can only be due to being halfop */ sendnumeric(cptr, ERR_NOTFORHALFOPS, mode); @@ -419,7 +419,7 @@ int extcmode_default_requirechop(Client *cptr, Channel *chptr, char mode, char * int extcmode_default_requirehalfop(Client *cptr, Channel *chptr, char mode, char *para, int checkt, int what) { - if (IsPerson(cptr) && + if (IsUser(cptr) && (is_chan_op(cptr, chptr) || is_half_op(cptr, chptr))) return EX_ALLOW; return EX_DENY; diff --git a/src/api-extban.c b/src/api-extban.c index 33d095a5a..d8fe67de0 100644 --- a/src/api-extban.c +++ b/src/api-extban.c @@ -131,7 +131,7 @@ int extban_is_ok_nuh_extban(Client* sptr, Channel* chptr, char* para, int checkt int isok; static int extban_is_ok_recursion = 0; - /* Mostly copied from clean_ban_mask - but note MyClient checks aren't needed here: extban->is_ok() according to m_mode isn't called for nonlocal. */ + /* Mostly copied from clean_ban_mask - but note MyUser checks aren't needed here: extban->is_ok() according to m_mode isn't called for nonlocal. */ if ((*mask == '~') && mask[1] && (mask[2] == ':')) { if (extban_is_ok_recursion) diff --git a/src/api-moddata.c b/src/api-moddata.c index d6ef6b095..8f51790ab 100644 --- a/src/api-moddata.c +++ b/src/api-moddata.c @@ -317,7 +317,7 @@ int moddata_client_set(Client *acptr, char *varname, char *value) /* If 'sync' field is set and the client is not in pre-registered * state then broadcast the new setting. */ - if (md->sync && (IsPerson(acptr) || IsServer(acptr) || IsMe(acptr))) + if (md->sync && (IsUser(acptr) || IsServer(acptr) || IsMe(acptr))) broadcast_md_client_cmd(NULL, &me, acptr, md->name, value); return 1; diff --git a/src/api-usermode.c b/src/api-usermode.c index 71b39eb0d..cd19aadd0 100644 --- a/src/api-usermode.c +++ b/src/api-usermode.c @@ -229,11 +229,11 @@ void UmodeDel(Umode *umode) list_for_each_entry(cptr, &client_list, client_node) { long oldumode = 0; - if (!IsPerson(cptr)) + if (!IsUser(cptr)) continue; oldumode = cptr->umodes; cptr->umodes &= ~umode->mode; - if (MyClient(cptr)) + if (MyUser(cptr)) send_umode_out(cptr, cptr, oldumode); } umode->flag = '\0'; @@ -325,7 +325,7 @@ void SnomaskDel(Snomask *sno) list_for_each_entry(cptr, &lclient_list, lclient_node) { long oldsno; - if (!cptr || !IsPerson(cptr)) + if (!cptr || !IsUser(cptr)) continue; oldsno = cptr->user->snomask; cptr->user->snomask &= ~sno->mode; @@ -356,7 +356,7 @@ int umode_allow_all(Client *sptr, int what) int umode_allow_unset(Client *sptr, int what) { - if (!MyClient(sptr)) + if (!MyUser(sptr)) return 1; if (what == MODE_DEL) return 1; @@ -365,14 +365,14 @@ int umode_allow_unset(Client *sptr, int what) int umode_allow_none(Client *sptr, int what) { - if (MyClient(sptr)) + if (MyUser(sptr)) return 0; return 1; } int umode_allow_opers(Client *sptr, int what) { - if (MyClient(sptr)) + if (MyUser(sptr)) return IsOper(sptr) ? 1 : 0; else return 1; @@ -393,11 +393,11 @@ void unload_all_unused_umodes(void) list_for_each_entry(cptr, &lclient_list, lclient_node) { long oldumode = 0; - if (!IsPerson(cptr)) + if (!IsUser(cptr)) continue; oldumode = cptr->umodes; cptr->umodes &= ~(removed_umode); - if (MyClient(cptr)) + if (MyUser(cptr)) send_umode_out(cptr, cptr, oldumode); } for (i = 0; i < UMODETABLESZ; i++) @@ -434,7 +434,7 @@ void unload_all_unused_snomasks(void) list_for_each_entry(cptr, &lclient_list, lclient_node) { long oldsno; - if (!cptr || !IsPerson(cptr)) + if (!cptr || !IsUser(cptr)) continue; oldsno = cptr->user->snomask; cptr->user->snomask &= ~(removed_sno); @@ -478,7 +478,7 @@ void remove_oper_privileges(Client *sptr, int broadcast_mode_change) remove_oper_snomasks(sptr); if (broadcast_mode_change && (sptr->umodes != oldumodes)) send_umode_out(sptr, sptr, oldumodes); - if (MyClient(sptr)) /* only do if it's our client, remote servers will send a SWHOIS cmd */ + if (MyUser(sptr)) /* only do if it's our client, remote servers will send a SWHOIS cmd */ swhois_delete(sptr, "oper", "*", &me, NULL); } diff --git a/src/bsd.c b/src/bsd.c index 43652611c..652cfc58a 100644 --- a/src/bsd.c +++ b/src/bsd.c @@ -677,7 +677,7 @@ void close_connection(Client *cptr) ircstp->is_sbr &= 0x3ff; } } - else if (IsRegisteredUser(cptr)) + else if (IsUser(cptr)) { ircstp->is_cl++; ircstp->is_cbs += cptr->local->sendB; @@ -1077,7 +1077,7 @@ static int parse_client_queued(Client *cptr) if (IsIdentLookup(cptr)) return 0; /* we delay processing of data until identd has replied */ - if (!IsPerson(cptr) && !IsServer(cptr) && (iConf.handshake_delay > 0) && + if (!IsUser(cptr) && !IsServer(cptr) && (iConf.handshake_delay > 0) && (TStime() - cptr->local->firsttime < iConf.handshake_delay)) { return 0; /* we delay processing of data until set::handshake-delay is reached */ @@ -1132,7 +1132,7 @@ int process_packet(Client *cptr, char *readbuf, int length, int killsafely) } /* excess flood check */ - if (IsPerson(cptr) && DBufLength(&cptr->local->recvQ) > get_recvq(cptr)) + if (IsUser(cptr) && DBufLength(&cptr->local->recvQ) > get_recvq(cptr)) { sendto_snomask(SNO_FLOOD, "*** Flood -- %s!%s@%s (%d) exceeds %d recvQ", @@ -1376,7 +1376,7 @@ int connect_server(ConfigItem_link *aconf, Client *by, struct hostent *hp) { int errtmp = ERRNO; report_error("Connect to host %s failed: %s", cptr); - if (by && IsPerson(by) && !MyClient(by)) + if (by && IsUser(by) && !MyUser(by)) sendnotice(by, "*** Connect to host %s failed.", cptr->name); fd_close(cptr->local->fd); --OpenFiles; @@ -1397,7 +1397,7 @@ int connect_server(ConfigItem_link *aconf, Client *by, struct hostent *hp) #endif Debug((DEBUG_ERROR, "reference count for %s (%s) is now %d", cptr->name, cptr->serv->conf->servername, cptr->serv->conf->refcount)); - if (by && IsPerson(by)) + if (by && IsUser(by)) { (void)strlcpy(cptr->serv->by, by->name, sizeof cptr->serv->by); if (cptr->serv->user) diff --git a/src/channel.c b/src/channel.c index cd2aeb5fb..756f38f6f 100644 --- a/src/channel.c +++ b/src/channel.c @@ -64,7 +64,7 @@ void del_invite(Client *, Channel *); inline int op_can_override(char* acl, Client *sptr,Channel *channel,void* extra) { #ifndef NO_OPEROVERRIDE - if (MyClient(sptr) && !(ValidatePermissionsForPath(acl,sptr,NULL,channel,extra))) + if (MyUser(sptr) && !(ValidatePermissionsForPath(acl,sptr,NULL,channel,extra))) return 0; return 1; #else @@ -312,13 +312,13 @@ int add_listmode_ex(Ban **list, Client *cptr, Channel *chptr, char *banid, char int cnt = 0, len; int do_not_add = 0; - if (MyClient(cptr)) + if (MyUser(cptr)) (void)collapse(banid); len = strlen(banid); if (!*list && ((len > MAXBANLENGTH) || (MAXBANS < 1))) { - if (MyClient(cptr)) + if (MyUser(cptr)) { /* Only send the error to local clients */ sendnumeric(cptr, ERR_BANLISTFULL, chptr->chname, banid); @@ -331,7 +331,7 @@ int add_listmode_ex(Ban **list, Client *cptr, Channel *chptr, char *banid, char /* Check MAXBANLENGTH / MAXBANS only for local clients * and 'me' (for +b's set during +f). */ - if ((MyClient(cptr) || IsMe(cptr)) && ((len > MAXBANLENGTH) || (++cnt >= MAXBANS))) + if ((MyUser(cptr) || IsMe(cptr)) && ((len > MAXBANLENGTH) || (++cnt >= MAXBANS))) { do_not_add = 1; } @@ -347,7 +347,7 @@ int add_listmode_ex(Ban **list, Client *cptr, Channel *chptr, char *banid, char /* The banlist is full and trying to add a new ban. * This is not permitted. */ - if (MyClient(cptr)) + if (MyUser(cptr)) { /* Only send the error to local clients */ sendnumeric(cptr, ERR_BANLISTFULL, chptr->chname, banid); @@ -382,7 +382,7 @@ int add_listmode(Ban **list, Client *cptr, Channel *chptr, char *banid) char *setby = cptr->name; char nuhbuf[NICKLEN+USERLEN+HOSTLEN+4]; - if (IsPerson(cptr) && (iConf.ban_setter == SETTER_NICK_USER_HOST)) + if (IsUser(cptr) && (iConf.ban_setter == SETTER_NICK_USER_HOST)) setby = make_nick_user_host_r(nuhbuf, cptr->name, cptr->user->username, GetHost(cptr)); return add_listmode_ex(list, cptr, chptr, banid, setby, TStime()); @@ -551,7 +551,7 @@ void add_user_to_channel(Channel *chptr, Client *who, int flags) chptr->members = ptr; chptr->users++; - ptr2 = make_membership(MyClient(who)); + ptr2 = make_membership(MyUser(who)); /* we should make this more efficient --stskeeps is now, as we only use it in membership */ ptr2->chptr = chptr; @@ -593,7 +593,7 @@ int remove_user_from_channel(Client *sptr, Channel *chptr) if (tmp2->chptr == chptr) { *curr2 = tmp2->next; - free_membership(tmp2, MyClient(sptr)); + free_membership(tmp2, MyUser(sptr)); break; } } @@ -610,7 +610,7 @@ int remove_user_from_channel(Client *sptr, Channel *chptr) long get_access(Client *cptr, Channel *chptr) { Membership *lp; - if (chptr && IsPerson(cptr)) + if (chptr && IsUser(cptr)) if ((lp = find_membership_link(cptr->user->channel, chptr))) return lp->flags; return 0; @@ -852,7 +852,7 @@ char *clean_ban_mask(char *mask, int what, Client *cptr) /* Extended ban? */ if ((*mask == '~') && mask[1] && (mask[2] == ':')) { - if (RESTRICT_EXTENDEDBANS && MyClient(cptr) && !ValidatePermissionsForPath("immune:restrict-extendedbans",cptr,NULL,NULL,NULL)) + if (RESTRICT_EXTENDEDBANS && MyUser(cptr) && !ValidatePermissionsForPath("immune:restrict-extendedbans",cptr,NULL,NULL,NULL)) { if (!strcmp(RESTRICT_EXTENDEDBANS, "*")) { @@ -876,7 +876,7 @@ char *clean_ban_mask(char *mask, int what, Client *cptr) * - if from a local client trying to REMOVE the extban, * allow it too (so you don't get "unremovable" extbans). */ - if (!MyClient(cptr) || (what == MODE_DEL)) + if (!MyUser(cptr) || (what == MODE_DEL)) return mask; /* allow it */ return NULL; /* reject */ } @@ -957,7 +957,7 @@ Channel *get_channel(Client *cptr, char *chname, int flag) return NULL; len = strlen(chname); - if (MyClient(cptr) && len > CHANNELLEN) + if (MyUser(cptr) && len > CHANNELLEN) { len = CHANNELLEN; *(chname + CHANNELLEN) = '\0'; @@ -974,7 +974,7 @@ Channel *get_channel(Client *cptr, char *chname, int flag) chptr->topic_nick = NULL; chptr->prevch = NULL; chptr->nextch = channel; - chptr->creationtime = MyClient(cptr) ? TStime() : 0; + chptr->creationtime = MyUser(cptr) ? TStime() : 0; channel = chptr; (void)add_to_channel_hash_table(chname, chptr); ircstats.channels++; diff --git a/src/conf.c b/src/conf.c index b048248a1..561107c4f 100644 --- a/src/conf.c +++ b/src/conf.c @@ -2904,7 +2904,7 @@ ConfigItem_tld *Find_tld(Client *cptr) { if ((tld->options & TLD_TLS) && !IsSecureConnect(cptr)) continue; - if ((tld->options & TLD_REMOTE) && MyClient(cptr)) + if ((tld->options & TLD_REMOTE) && MyUser(cptr)) continue; return tld; } diff --git a/src/hash.c b/src/hash.c index 90f1771fb..dc2fb46ac 100644 --- a/src/hash.c +++ b/src/hash.c @@ -551,7 +551,7 @@ Client *find_person(char *name, Client *cptr) c2ptr = find_client(name, cptr); - if (c2ptr && IsRegisteredUser(c2ptr) && c2ptr->user) + if (c2ptr && IsUser(c2ptr) && c2ptr->user) return c2ptr; return NULL; @@ -687,8 +687,8 @@ int hash_check_watch(Client *cptr, int reply) { sendnumeric(lp->value.cptr, reply, me.name, lp->value.cptr->name, cptr->name, - (IsPerson(cptr) ? cptr->user->username : ""), - (IsPerson(cptr) ? + (IsUser(cptr) ? cptr->user->username : ""), + (IsUser(cptr) ? (IsHidden(cptr) ? cptr->user->virthost : cptr-> user->realhost) : ""), anptr->lasttime, cptr->info); } @@ -701,15 +701,15 @@ int hash_check_watch(Client *cptr, int reply) if (reply == RPL_NOTAWAY) sendnumeric(lp->value.cptr, reply, me.name, lp->value.cptr->name, cptr->name, - (IsPerson(cptr) ? cptr->user->username : ""), - (IsPerson(cptr) ? + (IsUser(cptr) ? cptr->user->username : ""), + (IsUser(cptr) ? (IsHidden(cptr) ? cptr->user->virthost : cptr-> user->realhost) : ""), cptr->user->lastaway); else /* RPL_GONEAWAY / RPL_REAWAY */ sendnumeric(lp->value.cptr, reply, me.name, lp->value.cptr->name, cptr->name, - (IsPerson(cptr) ? cptr->user->username : ""), - (IsPerson(cptr) ? + (IsUser(cptr) ? cptr->user->username : ""), + (IsUser(cptr) ? (IsHidden(cptr) ? cptr->user->virthost : cptr-> user->realhost) : ""), cptr->user->lastaway, cptr->user->away); } diff --git a/src/ircd.c b/src/ircd.c index d66b087e8..6e7cedb07 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -337,7 +337,7 @@ int check_tkls(Client *cptr) find_shun(cptr); /* check for shunned and take action, if so */ - if (IsPerson(cptr)) + if (IsUser(cptr)) { /* Check ban realname { } */ if (!ValidatePermissionsForPath("immune",cptr,NULL,NULL,NULL) && (bconf = Find_ban(NULL, cptr->info, CONF_BAN_REALNAME))) @@ -347,7 +347,7 @@ int check_tkls(Client *cptr) /* If user is meant to be killed, take action: */ if (killflag) { - if (IsPerson(cptr)) + if (IsUser(cptr)) sendto_realops("Ban active for %s (%s)", get_client_name(cptr, FALSE), bconf->reason ? bconf->reason : "no reason"); @@ -358,13 +358,13 @@ int check_tkls(Client *cptr) bconf->reason ? bconf->reason : "no reason"); if (bconf->reason) { - if (IsPerson(cptr)) + if (IsUser(cptr)) snprintf(banbuf, sizeof(banbuf), "User has been banned (%s)", bconf->reason); else snprintf(banbuf, sizeof(banbuf), "Banned (%s)", bconf->reason); (void)exit_client(cptr, cptr, &me, NULL, banbuf); } else { - if (IsPerson(cptr)) + if (IsUser(cptr)) (void)exit_client(cptr, cptr, &me, NULL, "User has been banned"); else (void)exit_client(cptr, cptr, &me, NULL, "Banned"); @@ -372,10 +372,10 @@ int check_tkls(Client *cptr) return 0; /* stop processing this user, as (s)he is dead now. */ } - if (loop.do_bancheck_spamf_user && IsPerson(cptr) && find_spamfilter_user(cptr, SPAMFLAG_NOWARN) == FLUSH_BUFFER) + if (loop.do_bancheck_spamf_user && IsUser(cptr) && find_spamfilter_user(cptr, SPAMFLAG_NOWARN) == FLUSH_BUFFER) return 0; - if (loop.do_bancheck_spamf_away && IsPerson(cptr) && cptr->user->away != NULL && + if (loop.do_bancheck_spamf_away && IsUser(cptr) && cptr->user->away != NULL && run_spamfilter(cptr, cptr->user->away, SPAMF_AWAY, NULL, SPAMFLAG_NOWARN, NULL) == FLUSH_BUFFER) return 0; @@ -717,7 +717,7 @@ void fix_timers(void) } /* users */ - if (MyClient(acptr)) + if (MyUser(acptr)) { if (acptr->local->nextnick > TStime()) { diff --git a/src/list.c b/src/list.c index 47c82ecc4..0ade09bc2 100644 --- a/src/list.c +++ b/src/list.c @@ -300,7 +300,7 @@ void remove_client_from_list(Client *cptr) { ircstats.servers--; } - if (IsRegisteredUser(cptr)) + if (IsUser(cptr)) { if (IsInvisible(cptr)) { @@ -320,7 +320,7 @@ void remove_client_from_list(Client *cptr) ) ircstats.unknown--; - if (IsPerson(cptr)) /* Only persons can have been added before */ + if (IsUser(cptr)) /* Only persons can have been added before */ { add_history(cptr, 0); off_history(cptr); /* Remove all pointers to cptr */ diff --git a/src/misc.c b/src/misc.c index 29ab7243e..c549eb2e2 100644 --- a/src/misc.c +++ b/src/misc.c @@ -461,11 +461,11 @@ static void exit_one_client(Client *sptr, MessageTag *mtags_i, const char *comme assert(!IsMe(sptr)); - if (IsRegisteredUser(sptr)) + if (IsUser(sptr)) { MessageTag *mtags_o = NULL; - if (!MyClient(sptr)) + if (!MyUser(sptr)) RunHook3(HOOKTYPE_REMOTE_QUIT, sptr, mtags_i, comment); new_message_special(sptr, mtags_i, &mtags_o, ":%s QUIT", sptr->name); @@ -508,7 +508,7 @@ static void exit_one_client(Client *sptr, MessageTag *mtags_i, const char *comme } if (*sptr->name) del_from_client_hash_table(sptr->name, sptr); - if (IsRegisteredUser(sptr)) + if (IsUser(sptr)) hash_check_watch(sptr, RPL_LOGOFF); if (remote_rehash_client == sptr) remote_rehash_client = NULL; /* client did a /REHASH and QUIT before rehash was complete */ @@ -549,7 +549,7 @@ int exit_client(Client *cptr, Client *sptr, Client *from, MessageTag *recv_mtags sptr->local->class = NULL; } } - if (IsRegisteredUser(sptr)) + if (IsUser(sptr)) ircstats.me_clients--; if (sptr->serv && sptr->serv->conf) { @@ -582,7 +582,7 @@ int exit_client(Client *cptr, Client *sptr, Client *from, MessageTag *recv_mtags } } SetClosing(sptr); - if (IsPerson(sptr)) + if (IsUser(sptr)) { RunHook3(HOOKTYPE_LOCAL_QUIT, sptr, recv_mtags, comment); sendto_connectnotice(sptr, 1, comment); @@ -636,7 +636,7 @@ int exit_client(Client *cptr, Client *sptr, Client *from, MessageTag *recv_mtags */ close_connection(sptr); } - else if (IsPerson(sptr) && !IsULine(sptr)) + else if (IsUser(sptr) && !IsULine(sptr)) { if (sptr->srvptr != &me) sendto_fconnectnotice(sptr, 1, comment); @@ -662,7 +662,7 @@ int exit_client(Client *cptr, Client *sptr, Client *from, MessageTag *recv_mtags RunHook2(HOOKTYPE_SERVER_QUIT, sptr, recv_mtags); } - else if (IsRegisteredUser(sptr) && !IsKilled(sptr)) + else if (IsUser(sptr) && !IsKilled(sptr)) { sendto_server(cptr, PROTO_SID, 0, recv_mtags, ":%s QUIT :%s", ID(sptr), comment); sendto_server(cptr, 0, PROTO_SID, recv_mtags, ":%s QUIT :%s", sptr->name, comment); diff --git a/src/modules.c b/src/modules.c index 8900a651b..5248610c5 100644 --- a/src/modules.c +++ b/src/modules.c @@ -755,7 +755,7 @@ CMD_FUNC(m_module) if ((parc > 1) && !strcmp(parv[1], "-all")) all = 1; - if (MyClient(sptr) && !IsOper(sptr) && all) + if (MyUser(sptr) && !IsOper(sptr) && all) sptr->local->since += 7; /* Lag them up. Big list. */ if ((parc > 2) && (hunt_server(cptr, sptr, recv_mtags, ":%s MODULE %s :%s", 2, parc, parv) != HUNTED_ISME)) diff --git a/src/modules/admin.c b/src/modules/admin.c index 4930d41ae..8f0952e33 100644 --- a/src/modules/admin.c +++ b/src/modules/admin.c @@ -62,7 +62,7 @@ CMD_FUNC(m_admin) /* Users may want to get the address in case k-lined, etc. -- Barubary * Only allow remote ADMINs if registered -- Barubary */ - if (IsPerson(sptr) || IsServer(cptr)) + if (IsUser(sptr) || IsServer(cptr)) if (hunt_server(cptr, sptr, recv_mtags, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME) return 0; diff --git a/src/modules/antimixedutf8.c b/src/modules/antimixedutf8.c index 5fdbe17f5..2da4cbae8 100644 --- a/src/modules/antimixedutf8.c +++ b/src/modules/antimixedutf8.c @@ -174,7 +174,7 @@ CMD_OVERRIDE_FUNC(override_msg) { int score, ret; - if (!MyClient(sptr) || (parc < 3) || BadPtr(parv[2])) + if (!MyUser(sptr) || (parc < 3) || BadPtr(parv[2])) { /* Short circuit for: remote clients or insufficient parameters */ return CallCommandOverride(ovr, cptr, sptr, recv_mtags, parc, parv); diff --git a/src/modules/antirandom.c b/src/modules/antirandom.c index 70efaca0f..ae423f13b 100644 --- a/src/modules/antirandom.c +++ b/src/modules/antirandom.c @@ -933,7 +933,7 @@ void check_all_users(void) list_for_each_entry(acptr, &lclient_list, lclient_node) { - if (IsPerson(acptr)) + if (IsUser(acptr)) { if (is_exempt(acptr)) continue; diff --git a/src/modules/authprompt.c b/src/modules/authprompt.c index a2f8ef59e..ef1898810 100644 --- a/src/modules/authprompt.c +++ b/src/modules/authprompt.c @@ -434,7 +434,7 @@ int authprompt_place_host_ban(Client *sptr, int action, char *reason, long durat /* If it's a soft-xx action and the user is not logged in * and the user is not yet online, then we will handle this user. */ - if (IsSoftBanAction(action) && !IsLoggedIn(sptr) && !IsPerson(sptr)) + if (IsSoftBanAction(action) && !IsLoggedIn(sptr) && !IsUser(sptr)) { /* Send ban reason */ if (reason) @@ -456,7 +456,7 @@ int authprompt_find_tkline_match(Client *sptr, TKL *tkl) if (TKLIsServerBan(tkl) && (tkl->ptr.serverban->subtype & TKL_SUBTYPE_SOFT) && !IsLoggedIn(sptr) && - !IsPerson(sptr)) + !IsUser(sptr)) { /* Send ban reason */ if (tkl->ptr.serverban->reason) diff --git a/src/modules/away.c b/src/modules/away.c index 6ad4f48f2..8bd5cd3ed 100644 --- a/src/modules/away.c +++ b/src/modules/away.c @@ -101,14 +101,14 @@ CMD_FUNC(m_away) return 0; } - if (MyClient(sptr)) + if (MyUser(sptr)) { n = run_spamfilter(sptr, parv[1], SPAMF_AWAY, NULL, 0, NULL); if (n < 0) return n; } - if (MyClient(sptr) && AWAY_PERIOD && !ValidatePermissionsForPath("immune:away-flood",sptr,NULL,NULL,NULL)) + if (MyUser(sptr) && AWAY_PERIOD && !ValidatePermissionsForPath("immune:away-flood",sptr,NULL,NULL,NULL)) { if ((sptr->user->flood.away_t + AWAY_PERIOD) <= timeofday) { diff --git a/src/modules/blacklist.c b/src/modules/blacklist.c index 370b57498..434c5f298 100644 --- a/src/modules/blacklist.c +++ b/src/modules/blacklist.c @@ -730,7 +730,7 @@ void blacklist_hit(Client *acptr, Blacklist *bl, int reply) if (find_tkline_match(acptr, 1) < 0) return; /* already klined/glined. Don't send the warning from below. */ - if (IsPerson(acptr)) + if (IsUser(acptr)) snprintf(opernotice, sizeof(opernotice), "[Blacklist] IP %s (%s) matches blacklist %s (%s/reply=%d)", GetIP(acptr), acptr->name, bl->name, bl->backend->dns->name, reply); else diff --git a/src/modules/botmotd.c b/src/modules/botmotd.c index f189d684f..5db00042e 100644 --- a/src/modules/botmotd.c +++ b/src/modules/botmotd.c @@ -63,7 +63,7 @@ CMD_FUNC(m_botmotd) if (hunt_server(cptr, sptr, recv_mtags, ":%s BOTMOTD :%s", 1, parc, parv) != HUNTED_ISME) return 0; - if (!IsPerson(sptr)) + if (!IsUser(sptr)) return 0; tld = Find_tld(sptr); diff --git a/src/modules/cap.c b/src/modules/cap.c index 252cd37cf..d9bd56bbb 100644 --- a/src/modules/cap.c +++ b/src/modules/cap.c @@ -235,7 +235,7 @@ static void clicap_generate(Client *sptr, const char *subcmd, int flags) static int cap_end(Client *sptr, const char *arg) { - if (IsRegisteredUser(sptr)) + if (IsUser(sptr)) return 0; ClearCapabilityFast(sptr, CAP_IN_PROGRESS); @@ -254,7 +254,7 @@ static int cap_list(Client *sptr, const char *arg) static int cap_ls(Client *sptr, const char *arg) { - if (!IsRegisteredUser(sptr)) + if (!IsUser(sptr)) SetCapabilityFast(sptr, CAP_IN_PROGRESS); if (arg) @@ -284,7 +284,7 @@ static int cap_req(Client *sptr, const char *arg) int finished = 0, negate; int errors = 0; - if (!IsRegisteredUser(sptr)) + if (!IsUser(sptr)) SetCapabilityFast(sptr, CAP_IN_PROGRESS); if (BadPtr(arg)) @@ -398,7 +398,7 @@ CMD_FUNC(m_cap) if (DISABLE_CAP) { /* I know nothing! */ - if (IsPerson(sptr)) + if (IsUser(sptr)) sendnumeric(sptr, ERR_UNKNOWNCOMMAND, "CAP"); else sendnumeric(sptr, ERR_NOTREGISTERED); diff --git a/src/modules/chanmodes/floodprot.c b/src/modules/chanmodes/floodprot.c index 704ec42e6..38c671b92 100644 --- a/src/modules/chanmodes/floodprot.c +++ b/src/modules/chanmodes/floodprot.c @@ -304,7 +304,7 @@ int cmodef_is_ok(Client *sptr, Channel *chptr, char mode, char *param, int type, { if ((type == EXCHK_ACCESS) || (type == EXCHK_ACCESS_ERR)) { - if (IsPerson(sptr) && is_chan_op(sptr, chptr)) + if (IsUser(sptr) && is_chan_op(sptr, chptr)) return EX_ALLOW; if (type == EXCHK_ACCESS_ERR) /* can only be due to being halfop */ sendnumeric(sptr, ERR_NOTFORHALFOPS, 'f'); @@ -406,7 +406,7 @@ int cmodef_is_ok(Client *sptr, Channel *chptr, char mode, char *param, int type, (*p == 'm') || (*p == 'n') || (*p == 't') || (*p == 'r'))) { - if (MyClient(sptr) && *p && (warnings++ < 3)) + if (MyUser(sptr) && *p && (warnings++ < 3)) sendnotice(sptr, "warning: channelmode +f: floodtype '%c' unknown, ignored.", *p); continue; /* continue instead of break for forward compatability. */ } @@ -415,7 +415,7 @@ int cmodef_is_ok(Client *sptr, Channel *chptr, char mode, char *param, int type, v = atoi(x); if ((v < 1) || (v > 999)) /* out of range... */ { - if (MyClient(sptr)) + if (MyUser(sptr)) { sendnumeric(sptr, ERR_CANNOTCHANGECHANMODE, 'f', "value should be from 1-999"); @@ -425,7 +425,7 @@ int cmodef_is_ok(Client *sptr, Channel *chptr, char mode, char *param, int type, } p++; a = '\0'; - r = MyClient(sptr) ? MODEF_DEFAULT_UNSETTIME : 0; + r = MyUser(sptr) ? MODEF_DEFAULT_UNSETTIME : 0; if (*p != '\0') { if (*p == '#') @@ -439,8 +439,8 @@ int cmodef_is_ok(Client *sptr, Channel *chptr, char mode, char *param, int type, tv = atoi(p); if (tv <= 0) tv = 0; /* (ignored) */ - if (tv > (MyClient(sptr) ? MODEF_MAX_UNSETTIME : 255)) - tv = (MyClient(sptr) ? MODEF_MAX_UNSETTIME : 255); /* set to max */ + if (tv > (MyUser(sptr) ? MODEF_MAX_UNSETTIME : 255)) + tv = (MyUser(sptr) ? MODEF_MAX_UNSETTIME : 255); /* set to max */ r = (unsigned char)tv; } } @@ -510,7 +510,7 @@ int cmodef_is_ok(Client *sptr, Channel *chptr, char mode, char *param, int type, v = atoi(p2); if ((v < 1) || (v > 999)) /* 'per' out of range */ { - if (MyClient(sptr)) + if (MyUser(sptr)) sendnumeric(sptr, ERR_CANNOTCHANGECHANMODE, 'f', "time range should be 1-999"); goto invalidsyntax; @@ -734,7 +734,7 @@ char *cmodef_conv_param(char *param_in, Client *cptr) ChannelFloodProtection newf; int xxi, xyi, xzi, hascolon; char *xp; - int localclient = (!cptr || MyClient(cptr)) ? 1 : 0; + int localclient = (!cptr || MyUser(cptr)) ? 1 : 0; memset(&newf, 0, sizeof(newf)); @@ -994,11 +994,11 @@ int floodprot_join(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags * from all servers. */ if (IsFloodLimit(chptr) && - (MyClient(sptr) || sptr->srvptr->serv->flags.synced) && + (MyUser(sptr) || sptr->srvptr->serv->flags.synced) && (sptr->srvptr->serv->boottime && (TStime() - sptr->srvptr->serv->boottime >= MODEF_BOOT_DELAY)) && !IsULine(sptr) && do_floodprot(chptr, FLD_JOIN) && - MyClient(sptr)) + MyUser(sptr)) { do_floodprot_action(chptr, FLD_JOIN, "join"); } @@ -1074,7 +1074,7 @@ char *channel_modef_string(ChannelFloodProtection *x, char *retbuf) char *floodprot_pre_chanmsg(Client *sptr, Channel *chptr, MessageTag *mtags, char *text, int notice) { - if (MyClient(sptr) && (check_for_chan_flood(sptr, chptr, text) == 1)) + if (MyUser(sptr) && (check_for_chan_flood(sptr, chptr, text) == 1)) return NULL; /* don't send it */ return text; } @@ -1086,11 +1086,11 @@ int floodprot_post_chanmsg(Client *sptr, Channel *chptr, int sendflags, int pref /* HINT: don't be so stupid to reorder the items in the if's below.. you'll break things -- Syzop. */ - if (do_floodprot(chptr, FLD_MSG) && MyClient(sptr)) + if (do_floodprot(chptr, FLD_MSG) && MyUser(sptr)) do_floodprot_action(chptr, FLD_MSG, "msg/notice"); if ((text[0] == '\001') && strncmp(text+1, "ACTION ", 7) && - do_floodprot(chptr, FLD_CTCP) && MyClient(sptr)) + do_floodprot(chptr, FLD_CTCP) && MyUser(sptr)) { do_floodprot_action(chptr, FLD_CTCP, "CTCP"); } @@ -1100,7 +1100,7 @@ int floodprot_post_chanmsg(Client *sptr, Channel *chptr, int sendflags, int pref int floodprot_knock(Client *sptr, Channel *chptr, MessageTag *mtags, char *comment) { - if (IsFloodLimit(chptr) && !IsULine(sptr) && do_floodprot(chptr, FLD_KNOCK) && MyClient(sptr)) + if (IsFloodLimit(chptr) && !IsULine(sptr) && do_floodprot(chptr, FLD_KNOCK) && MyUser(sptr)) do_floodprot_action(chptr, FLD_KNOCK, "knock"); return 0; } @@ -1114,7 +1114,7 @@ Membership *mp; Channel *chptr = mp->chptr; if (chptr && IsFloodLimit(chptr) && !(mp->flags & (CHFL_CHANOP|CHFL_VOICE|CHFL_CHANOWNER|CHFL_HALFOP|CHFL_CHANADMIN)) && - do_floodprot(chptr, FLD_NICK) && MyClient(sptr)) + do_floodprot(chptr, FLD_NICK) && MyUser(sptr)) { do_floodprot_action(chptr, FLD_NICK, "nick"); } diff --git a/src/modules/chanmodes/history.c b/src/modules/chanmodes/history.c index ee2abed5f..019c07686 100644 --- a/src/modules/chanmodes/history.c +++ b/src/modules/chanmodes/history.c @@ -342,7 +342,7 @@ int history_chanmode_is_ok(Client *sptr, Channel *chptr, char mode, char *param, { if ((type == EXCHK_ACCESS) || (type == EXCHK_ACCESS_ERR)) { - if (IsPerson(sptr) && is_chan_op(sptr, chptr)) + if (IsUser(sptr) && is_chan_op(sptr, chptr)) return EX_ALLOW; if (type == EXCHK_ACCESS_ERR) /* can only be due to being halfop */ sendnumeric(sptr, ERR_NOTFORHALFOPS, 'H'); @@ -488,7 +488,7 @@ int history_chanmsg(Client *sptr, Channel *chptr, int sendflags, int prefix, cha if (prefix) return 0; - if (IsPerson(sptr)) + if (IsUser(sptr)) snprintf(source, sizeof(source), "%s!%s@%s", sptr->name, sptr->user->username, GetHost(sptr)); else strlcpy(source, sptr->name, sizeof(source)); @@ -511,7 +511,7 @@ int history_join(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, if (!HistoryEnabled(chptr)) return 0; - if (MyClient(sptr)) + if (MyUser(sptr)) { HistoryChanMode *settings = (HistoryChanMode *)GETPARASTRUCT(chptr, 'H'); history_del(chptr->chname, settings->max_lines, settings->max_time); diff --git a/src/modules/chanmodes/link.c b/src/modules/chanmodes/link.c index 358f3eacd..fa11fa9ee 100644 --- a/src/modules/chanmodes/link.c +++ b/src/modules/chanmodes/link.c @@ -111,7 +111,7 @@ int cmodeL_is_ok(Client *sptr, Channel *chptr, char mode, char *para, int type, { if ((type == EXCHK_ACCESS) || (type == EXCHK_ACCESS_ERR)) { - if (IsPerson(sptr) && is_chanowner(sptr, chptr)) + if (IsUser(sptr) && is_chanowner(sptr, chptr)) return EX_ALLOW; if (type == EXCHK_ACCESS_ERR) /* can only be due to being halfop */ sendnumeric(sptr, ERR_CHANOWNPRIVNEEDED, chptr->chname); @@ -126,7 +126,7 @@ int cmodeL_is_ok(Client *sptr, Channel *chptr, char mode, char *para, int type, return EX_DENY; /* multiple channels not permitted */ if (!IsChannelName(para)) { - if (MyClient(sptr)) + if (MyUser(sptr)) sendnumeric(sptr, ERR_NOSUCHCHANNEL, para); return EX_DENY; } @@ -138,7 +138,7 @@ int cmodeL_is_ok(Client *sptr, Channel *chptr, char mode, char *para, int type, *p = '\0'; if (find_channel(buf, NULL) == chptr) { - if (MyClient(sptr)) + if (MyUser(sptr)) sendnumeric(sptr, ERR_CANNOTCHANGECHANMODE, 'L', "a channel cannot be linked to itself"); return EX_DENY; @@ -222,7 +222,7 @@ int cmodeL_sjoin_check(Channel *chptr, void *ourx, void *theirx) int extban_link_syntax(Client *sptr, int checkt, char *reason) { - if (MyClient(sptr) && (checkt == EXBCHK_PARAM)) + if (MyUser(sptr) && (checkt == EXBCHK_PARAM)) { sendnotice(sptr, "Error when setting ban: %s", reason); sendnotice(sptr, " Syntax: +b ~f:#channel:mask"); diff --git a/src/modules/chanmodes/nocolor.c b/src/modules/chanmodes/nocolor.c index 6b44b45be..0954509a0 100644 --- a/src/modules/chanmodes/nocolor.c +++ b/src/modules/chanmodes/nocolor.c @@ -90,7 +90,7 @@ char *nocolor_prechanmsg(Client *sptr, Channel *chptr, MessageTag *mtags, char * Hook *h; int i; - if (MyClient(sptr) && IsNoColor(chptr) && IsUsingColor(text)) + if (MyUser(sptr) && IsNoColor(chptr) && IsUsingColor(text)) { for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next) { @@ -117,7 +117,7 @@ char *nocolor_prelocalpart(Client *sptr, Channel *chptr, char *comment) if (!comment) return NULL; - if (MyClient(sptr) && IsNoColor(chptr) && IsUsingColor(comment)) + if (MyUser(sptr) && IsNoColor(chptr) && IsUsingColor(comment)) return NULL; return comment; @@ -139,7 +139,7 @@ char *nocolor_prelocalquit(Client *sptr, char *comment) if (!comment) return NULL; - if (MyClient(sptr) && !BadPtr(comment) && IsUsingColor(comment) && IsAnyChannelNoColor(sptr)) + if (MyUser(sptr) && !BadPtr(comment) && IsUsingColor(comment) && IsAnyChannelNoColor(sptr)) return NULL; return comment; diff --git a/src/modules/chanmodes/noctcp.c b/src/modules/chanmodes/noctcp.c index 45049941a..0359732ea 100644 --- a/src/modules/chanmodes/noctcp.c +++ b/src/modules/chanmodes/noctcp.c @@ -80,7 +80,7 @@ static int IsACTCP(char *s) char *noctcp_prechanmsg(Client *sptr, Channel *chptr, MessageTag *mtags, char *text, int notice) { - if (MyClient(sptr) && IsNoCTCP(chptr) && IsACTCP(text)) + if (MyUser(sptr) && IsNoCTCP(chptr) && IsACTCP(text)) { if (!notice) { diff --git a/src/modules/chanmodes/noinvite.c b/src/modules/chanmodes/noinvite.c index 562177a4f..257b83d43 100644 --- a/src/modules/chanmodes/noinvite.c +++ b/src/modules/chanmodes/noinvite.c @@ -72,7 +72,7 @@ MOD_UNLOAD(noinvite) int noinvite_pre_knock(Client *sptr, Channel *chptr) { - if (MyClient(sptr) && IsNoInvite(chptr)) + if (MyUser(sptr) && IsNoInvite(chptr)) { sendnumeric(sptr, ERR_CANNOTKNOCK, chptr->chname, "The channel does not allow invites (+V)"); @@ -84,7 +84,7 @@ int noinvite_pre_knock(Client *sptr, Channel *chptr) int noinvite_pre_invite(Client *sptr, Client *acptr, Channel *chptr, int *override) { - if (MyClient(sptr) && IsNoInvite(chptr)) + if (MyUser(sptr) && IsNoInvite(chptr)) { if (ValidatePermissionsForPath("channel:override:invite:noinvite",sptr,NULL,chptr,NULL) && sptr == acptr) { diff --git a/src/modules/chanmodes/nokick.c b/src/modules/chanmodes/nokick.c index 85a836312..c0491477e 100644 --- a/src/modules/chanmodes/nokick.c +++ b/src/modules/chanmodes/nokick.c @@ -71,7 +71,7 @@ int nokick_check (Client* sptr, Client* who, Channel *chptr, char* comment, long { static char errmsg[256]; - if (MyClient(sptr) && IsNoKick(chptr)) + if (MyUser(sptr) && IsNoKick(chptr)) { ircsnprintf(errmsg, sizeof(errmsg), ":%s %d %s %s :%s", me.name, ERR_CANNOTDOCOMMAND, sptr->name, diff --git a/src/modules/chanmodes/noknock.c b/src/modules/chanmodes/noknock.c index f11f731e9..898e15053 100644 --- a/src/modules/chanmodes/noknock.c +++ b/src/modules/chanmodes/noknock.c @@ -72,7 +72,7 @@ MOD_UNLOAD(noctcp) int noknock_check (Client *sptr, Channel *chptr) { - if (MyClient(sptr) && IsNoKnock(chptr)) + if (MyUser(sptr) && IsNoKnock(chptr)) { sendnumeric(sptr, ERR_CANNOTKNOCK, chptr->chname, "No knocks are allowed! (+K)"); return HOOK_DENY; diff --git a/src/modules/chanmodes/operonly.c b/src/modules/chanmodes/operonly.c index 52e56c3c4..ee40c3299 100644 --- a/src/modules/chanmodes/operonly.c +++ b/src/modules/chanmodes/operonly.c @@ -97,7 +97,7 @@ int operonly_topic_allow (Client *sptr, Channel *chptr) int operonly_require_oper(Client *cptr, Channel *chptr, char mode, char *para, int checkt, int what) { - if (!MyClient(cptr) || ValidatePermissionsForPath("channel:operonly:set",cptr,NULL,chptr,NULL)) + if (!MyUser(cptr) || ValidatePermissionsForPath("channel:operonly:set",cptr,NULL,chptr,NULL)) return EX_ALLOW; if (checkt == EXCHK_ACCESS_ERR) diff --git a/src/modules/chanmodes/secureonly.c b/src/modules/chanmodes/secureonly.c index afcc508e0..9d5c8dfa5 100644 --- a/src/modules/chanmodes/secureonly.c +++ b/src/modules/chanmodes/secureonly.c @@ -95,7 +95,7 @@ static int secureonly_kick_insecure_users(Channel *chptr) { mb2 = member->next; cptr = member->cptr; - if (MyClient(cptr) && !IsSecureConnect(cptr) && !IsULine(cptr)) + if (MyUser(cptr) && !IsSecureConnect(cptr) && !IsULine(cptr)) { int prefix = 0; MessageTag *mtags = NULL; diff --git a/src/modules/chanmodes/stripcolor.c b/src/modules/chanmodes/stripcolor.c index 1daed4fc6..b958c6922 100644 --- a/src/modules/chanmodes/stripcolor.c +++ b/src/modules/chanmodes/stripcolor.c @@ -78,7 +78,7 @@ char *stripcolor_prechanmsg(Client *sptr, Channel *chptr, MessageTag *mtags, cha Hook *h; int i; - if (MyClient(sptr) && IsStripColor(chptr)) + if (MyUser(sptr) && IsStripColor(chptr)) { for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next) { @@ -100,7 +100,7 @@ char *stripcolor_prelocalpart(Client *sptr, Channel *chptr, char *comment) if (!comment) return NULL; - if (MyClient(sptr) && IsStripColor(chptr)) + if (MyUser(sptr) && IsStripColor(chptr)) comment = StripColors(comment); return comment; @@ -123,7 +123,7 @@ char *stripcolor_prelocalquit(Client *sptr, char *comment) if (!comment) return NULL; - if (MyClient(sptr) && !BadPtr(comment) && IsAnyChannelStripColor(sptr)) + if (MyUser(sptr) && !BadPtr(comment) && IsAnyChannelStripColor(sptr)) comment = StripColors(comment); return comment; diff --git a/src/modules/chghost.c b/src/modules/chghost.c index 6a53fa3fd..f43e3eaaf 100644 --- a/src/modules/chghost.c +++ b/src/modules/chghost.c @@ -65,7 +65,7 @@ CMD_FUNC(m_chghost) { Client *acptr; - if (MyClient(sptr) && !ValidatePermissionsForPath("client:set:host",sptr,NULL,NULL,NULL)) + if (MyUser(sptr) && !ValidatePermissionsForPath("client:set:host",sptr,NULL,NULL,NULL)) { sendnumeric(sptr, ERR_NOPRIVILEGES); return 0; @@ -108,7 +108,7 @@ CMD_FUNC(m_chghost) switch (UHOST_ALLOWED) { case UHALLOW_NEVER: - if (MyClient(sptr)) + if (MyUser(sptr)) { sendnumeric(sptr, ERR_DISABLED, "CHGHOST", "This command is disabled on this server"); @@ -118,7 +118,7 @@ CMD_FUNC(m_chghost) case UHALLOW_ALWAYS: break; case UHALLOW_NOCHANS: - if (IsPerson(acptr) && MyClient(sptr) && acptr->user->joined) + if (IsUser(acptr) && MyUser(sptr) && acptr->user->joined) { sendnotice(sptr, "*** /ChgHost can not be used while %s is on a channel", acptr->name); return 0; @@ -155,7 +155,7 @@ CMD_FUNC(m_chghost) userhost_changed(acptr); - if (MyClient(acptr)) + if (MyUser(acptr)) sendnumeric(acptr, RPL_HOSTHIDDEN, parv[2]); return 0; diff --git a/src/modules/chgident.c b/src/modules/chgident.c index aae7bcf74..4760b8f6c 100644 --- a/src/modules/chgident.c +++ b/src/modules/chgident.c @@ -109,7 +109,7 @@ CMD_FUNC(m_chgident) switch (UHOST_ALLOWED) { case UHALLOW_NEVER: - if (MyClient(sptr)) + if (MyUser(sptr)) { sendnumeric(sptr, ERR_DISABLED, "CHGIDENT", "This command is disabled on this server"); @@ -119,7 +119,7 @@ CMD_FUNC(m_chgident) case UHALLOW_ALWAYS: break; case UHALLOW_NOCHANS: - if (IsPerson(acptr) && MyClient(sptr) && acptr->user->joined) + if (IsUser(acptr) && MyUser(sptr) && acptr->user->joined) { sendnotice(sptr, "*** /ChgIdent can not be used while %s is on a channel", acptr->name); return 0; diff --git a/src/modules/chgname.c b/src/modules/chgname.c index 2e979aa8f..e01879fe3 100644 --- a/src/modules/chgname.c +++ b/src/modules/chgname.c @@ -107,7 +107,7 @@ CMD_FUNC(m_chgname) /* set the realname to make ban checking work */ ircsnprintf(acptr->info, sizeof(acptr->info), "%s", parv[2]); - if (MyClient(acptr)) + if (MyUser(acptr)) { /* only check for realname bans if the person who's name is being changed is NOT an oper */ if (!ValidatePermissionsForPath("immune:server-ban:ban-realname",acptr,NULL,NULL,NULL) && diff --git a/src/modules/connect.c b/src/modules/connect.c index 85379be74..4ed61c9e0 100644 --- a/src/modules/connect.c +++ b/src/modules/connect.c @@ -72,7 +72,7 @@ CMD_FUNC(m_connect) sendnumeric(sptr, ERR_NOPRIVILEGES); return 0; } - if (!IsServer(sptr) && MyClient(sptr) && !ValidatePermissionsForPath("route:local",sptr,NULL,NULL,NULL) && parc <= 3) + if (!IsServer(sptr) && MyUser(sptr) && !ValidatePermissionsForPath("route:local",sptr,NULL,NULL,NULL) && parc <= 3) { sendnumeric(sptr, ERR_NOPRIVILEGES); return 0; @@ -128,7 +128,7 @@ CMD_FUNC(m_connect) } /* Notify all operators about remote connect requests */ - if (!MyClient(cptr)) + if (!MyUser(cptr)) { sendto_server(&me, 0, 0, NULL, ":%s GLOBOPS :Remote CONNECT %s %s from %s", diff --git a/src/modules/dccallow.c b/src/modules/dccallow.c index e7022f334..626cf4ffd 100644 --- a/src/modules/dccallow.c +++ b/src/modules/dccallow.c @@ -82,7 +82,7 @@ CMD_FUNC(m_dccallow) NULL }; - if (!MyClient(sptr)) + if (!MyUser(sptr)) return 0; if (parc < 2) @@ -94,7 +94,7 @@ CMD_FUNC(m_dccallow) for (p = NULL, s = strtoken(&p, parv[1], ", "); s; s = strtoken(&p, NULL, ", ")) { - if (MyClient(sptr) && (++ntargets > maxtargets)) + if (MyUser(sptr) && (++ntargets > maxtargets)) { sendnumeric(sptr, ERR_TOOMANYTARGETS, s, maxtargets, "DCCALLOW"); break; diff --git a/src/modules/dccdeny.c b/src/modules/dccdeny.c index 1b0fe35e9..3e8c70b07 100644 --- a/src/modules/dccdeny.c +++ b/src/modules/dccdeny.c @@ -59,7 +59,7 @@ MOD_UNLOAD(dccdeny) */ CMD_FUNC(m_dccdeny) { - if (!MyClient(sptr)) + if (!MyUser(sptr)) return 0; if (!ValidatePermissionsForPath("server-ban:dccdeny",sptr,NULL,NULL,NULL)) diff --git a/src/modules/echo-message.c b/src/modules/echo-message.c index 6ee62b977..724519a95 100644 --- a/src/modules/echo-message.c +++ b/src/modules/echo-message.c @@ -68,7 +68,7 @@ MOD_UNLOAD(echo_message) int em_chanmsg(Client *sptr, Channel *chptr, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice) { - if (MyClient(sptr) && HasCapabilityFast(sptr, CAP_ECHO_MESSAGE)) + if (MyUser(sptr) && HasCapabilityFast(sptr, CAP_ECHO_MESSAGE)) { sendto_prefix_one(sptr, sptr, mtags, ":%s %s %s :%s", sptr->name, @@ -81,7 +81,7 @@ int em_chanmsg(Client *sptr, Channel *chptr, int sendflags, int prefix, char *ta int em_usermsg(Client *sptr, Client *to, MessageTag *mtags, char *text, int notice) { - if (MyClient(sptr) && HasCapabilityFast(sptr, CAP_ECHO_MESSAGE)) + if (MyUser(sptr) && HasCapabilityFast(sptr, CAP_ECHO_MESSAGE)) { sendto_prefix_one(sptr, sptr, mtags, ":%s %s %s :%s", sptr->name, diff --git a/src/modules/extbans/inchannel.c b/src/modules/extbans/inchannel.c index 451c08a3e..f8b0ee7d4 100644 --- a/src/modules/extbans/inchannel.c +++ b/src/modules/extbans/inchannel.c @@ -98,7 +98,7 @@ int extban_inchannel_is_ok(Client *sptr, Channel *chptr, char *para, int checkt, { char *p; - if ((checkt == EXBCHK_PARAM) && MyClient(sptr) && (what == MODE_ADD) && (strlen(para) > 3)) + if ((checkt == EXBCHK_PARAM) && MyUser(sptr) && (what == MODE_ADD) && (strlen(para) > 3)) { p = para + 3; if ((*p == '+') || (*p == '%') || (*p == '%') || diff --git a/src/modules/extbans/msgbypass.c b/src/modules/extbans/msgbypass.c index 165400bc9..a1f86ed50 100644 --- a/src/modules/extbans/msgbypass.c +++ b/src/modules/extbans/msgbypass.c @@ -160,7 +160,7 @@ char *msgbypass_extban_conv_param(char *para_in) int msgbypass_extban_syntax(Client *sptr, int checkt, char *reason) { - if (MyClient(sptr) && (checkt == EXBCHK_PARAM)) + if (MyUser(sptr) && (checkt == EXBCHK_PARAM)) { sendnotice(sptr, "Error when setting ban exception: %s", reason); sendnotice(sptr, " Syntax: +e ~m:type:mask"); diff --git a/src/modules/extbans/operclass.c b/src/modules/extbans/operclass.c index 6d2fbbc4a..be9e07077 100644 --- a/src/modules/extbans/operclass.c +++ b/src/modules/extbans/operclass.c @@ -89,7 +89,7 @@ int extban_operclass_is_banned(Client *sptr, Channel *chptr, char *banin, int ty { char *ban = banin+3; - if (MyClient(sptr) && IsOper(sptr)) + if (MyUser(sptr) && IsOper(sptr)) { char *operclass = NULL; ConfigItem_oper *oper = Find_oper(sptr->user->operlogin); diff --git a/src/modules/extbans/textban.c b/src/modules/extbans/textban.c index cbae575c2..4f570ee3d 100644 --- a/src/modules/extbans/textban.c +++ b/src/modules/extbans/textban.c @@ -261,12 +261,12 @@ int extban_modeT_is_ok(Client *sptr, Channel *chptr, char *para, int checkt, int { int n; - if ((what == MODE_ADD) && (what2 == EXBTYPE_EXCEPT) && MyClient(sptr)) + if ((what == MODE_ADD) && (what2 == EXBTYPE_EXCEPT) && MyUser(sptr)) return 0; /* except is not supported */ /* We check the # of bans in the channel, may not exceed MAX_EXTBANT_PER_CHAN */ if ((what == MODE_ADD) && (checkt == EXBCHK_PARAM) && - MyClient(sptr) && !IsOper(sptr) && + MyUser(sptr) && !IsOper(sptr) && ((n = counttextbans(chptr)) >= MAX_EXTBANT_PER_CHAN)) { /* We check the # of bans in the channel, may not exceed MAX_EXTBANT_PER_CHAN */ diff --git a/src/modules/extbans/timedban.c b/src/modules/extbans/timedban.c index 4ba5d52be..2b29b7831 100644 --- a/src/modules/extbans/timedban.c +++ b/src/modules/extbans/timedban.c @@ -214,7 +214,7 @@ char *timedban_extban_conv_param(char *para_in) int timedban_extban_syntax(Client *sptr, int checkt, char *reason) { - if (MyClient(sptr) && (checkt == EXBCHK_PARAM)) + if (MyUser(sptr) && (checkt == EXBCHK_PARAM)) { sendnotice(sptr, "Error when setting timed ban: %s", reason); sendnotice(sptr, " Syntax: +b ~t:duration:mask"); @@ -228,13 +228,13 @@ int timedban_extban_syntax(Client *sptr, int checkt, char *reason) /** Generic helper for sub-bans, used by our "is this ban ok?" function */ int generic_ban_is_ok(Client *sptr, Channel *chptr, char *mask, int checkt, int what, int what2) { - if ((mask[0] == '~') && MyClient(sptr)) + if ((mask[0] == '~') && MyUser(sptr)) { Extban *p; /* This portion is copied from clean_ban_mask() */ if (mask[1] && (mask[2] == ':') && - RESTRICT_EXTENDEDBANS && MyClient(sptr) && + RESTRICT_EXTENDEDBANS && MyUser(sptr) && !ValidatePermissionsForPath("immune:restrict-extendedbans",sptr,NULL,NULL,NULL)) { if (!strcmp(RESTRICT_EXTENDEDBANS, "*")) diff --git a/src/modules/globops.c b/src/modules/globops.c index da1c0940a..497a62aea 100644 --- a/src/modules/globops.c +++ b/src/modules/globops.c @@ -67,13 +67,13 @@ CMD_FUNC(m_globops) return 0; } - if (MyClient(sptr) && !ValidatePermissionsForPath("chat:globops",sptr,NULL,NULL,NULL)) + if (MyUser(sptr) && !ValidatePermissionsForPath("chat:globops",sptr,NULL,NULL,NULL)) { sendnumeric(sptr, ERR_NOPRIVILEGES); return 0; } - if (MyClient(sptr)) + if (MyUser(sptr)) { /* Easy */ sendto_umode_global(UMODE_OPER, "from %s: %s", sptr->name, message); diff --git a/src/modules/help.c b/src/modules/help.c index 2a5b311a8..b0b40ced0 100644 --- a/src/modules/help.c +++ b/src/modules/help.c @@ -135,7 +135,7 @@ CMD_FUNC(m_help) char *helptopic, *s; Link *tmpl; - if (!MyClient(sptr)) + if (!MyUser(sptr)) return 0; /* never remote */ helptopic = parc > 1 ? parv[1] : NULL; diff --git a/src/modules/invite.c b/src/modules/invite.c index 30a16964e..2a51db4f2 100644 --- a/src/modules/invite.c +++ b/src/modules/invite.c @@ -260,7 +260,7 @@ CMD_FUNC(m_invite) if (MyConnect(acptr)) { - if (IsPerson(sptr) + if (IsUser(sptr) && (is_chan_op(sptr, chptr) || IsULine(sptr) || ValidatePermissionsForPath("channel:override:invite:self",sptr,NULL,chptr,NULL) diff --git a/src/modules/ircops.c b/src/modules/ircops.c index a125dc7ec..23d967117 100644 --- a/src/modules/ircops.c +++ b/src/modules/ircops.c @@ -108,7 +108,7 @@ CMD_FUNC(m_ircops) list_for_each_entry(acptr, &client_list, client_node) { /* List only real IRC Operators */ - if (IsULine(acptr) || !IsPerson(acptr) || !IsOper(acptr)) + if (IsULine(acptr) || !IsUser(acptr) || !IsOper(acptr)) continue; /* Don't list +H users */ if (!IsOper(sptr) && IsHideOper(acptr)) diff --git a/src/modules/ison.c b/src/modules/ison.c index 8c332fffe..0b0180f40 100644 --- a/src/modules/ison.c +++ b/src/modules/ison.c @@ -71,7 +71,7 @@ CMD_FUNC(m_ison) char *s, *user; char *p = NULL; - if (!MyClient(sptr)) + if (!MyUser(sptr)) return 0; if (parc < 2) diff --git a/src/modules/join.c b/src/modules/join.c index e75a086dd..75d736d4f 100644 --- a/src/modules/join.c +++ b/src/modules/join.c @@ -263,7 +263,7 @@ void _join_channel(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_ me.name, (long long)chptr->creationtime, chptr->chname, chfl_to_sjoin_symbol(flags), sptr->name); - if (MyClient(sptr)) + if (MyUser(sptr)) { /* ** Make a (temporal) creationtime, if someone joins @@ -401,7 +401,7 @@ int _do_join(Client *cptr, Client *sptr, int parc, char *parv[]) for (i = 0, name = strtoken(&p, parv[1], ","); name; name = strtoken(&p, NULL, ",")) { - if (MyClient(sptr) && (++ntargets > maxtargets)) + if (MyUser(sptr) && (++ntargets > maxtargets)) { sendnumeric(sptr, ERR_TOOMANYTARGETS, name, maxtargets, "JOIN"); break; @@ -426,7 +426,7 @@ int _do_join(Client *cptr, Client *sptr, int parc, char *parv[]) } else if (!IsChannelName(name)) { - if (MyClient(sptr)) + if (MyUser(sptr)) sendnumeric(sptr, ERR_NOSUCHCHANNEL, name); continue; } @@ -805,7 +805,7 @@ void _userhost_changed(Client *sptr) for (lp = channels->chptr->members; lp; lp = lp->next) { acptr = lp->cptr; - if (MyClient(acptr) && HasCapabilityFast(acptr, CAP_CHGHOST) && + if (MyUser(acptr) && HasCapabilityFast(acptr, CAP_CHGHOST) && (acptr->local->serial != current_serial) && (sptr != acptr)) { /* FIXME: send mtag */ @@ -815,7 +815,7 @@ void _userhost_changed(Client *sptr) } } - if (MyClient(sptr)) + if (MyUser(sptr)) { /* We take the liberty of sending the CHGHOST to the impacted user as * well. This makes things easy for client coders. diff --git a/src/modules/jointhrottle.c b/src/modules/jointhrottle.c index 182d0c1de..d54e68628 100644 --- a/src/modules/jointhrottle.c +++ b/src/modules/jointhrottle.c @@ -157,7 +157,7 @@ static int isjthrottled(Client *cptr, Channel *chptr) int num = cfg.num; int t = cfg.t; - if (!MyClient(cptr)) + if (!MyUser(cptr)) return 0; /* Grab user<->chan entry.. */ @@ -183,7 +183,7 @@ static void jointhrottle_increase_usercounter(Client *cptr, Channel *chptr) int num = cfg.num; int t = cfg.t; - if (!MyClient(cptr)) + if (!MyUser(cptr)) return; /* Grab user<->chan entry.. */ @@ -230,7 +230,7 @@ JoinFlood *jointhrottle_addentry(Client *cptr, Channel *chptr) JoinFlood *e; #ifdef DEBUGMODE - if (!IsPerson(cptr)) + if (!IsUser(cptr)) abort(); for (e=moddata_client(cptr, jointhrottle_md).ptr; e; e=e->next) @@ -263,7 +263,7 @@ EVENT(jointhrottle_cleanup_structs) list_for_each_entry(acptr, &lclient_list, lclient_node) { - if (!MyClient(acptr)) + if (!MyUser(acptr)) continue; /* only (local) persons.. */ for (jf = moddata_client(acptr, jointhrottle_md).ptr; jf; jf = jf_next) diff --git a/src/modules/jumpserver.c b/src/modules/jumpserver.c index 1053dea81..f0629d8a5 100644 --- a/src/modules/jumpserver.c +++ b/src/modules/jumpserver.c @@ -85,7 +85,7 @@ static void redirect_all_clients(void) list_for_each_entry_safe(acptr, saved, &lclient_list, lclient_node) { - if (IsPerson(acptr) && !IsOper(acptr)) + if (IsUser(acptr) && !IsOper(acptr)) { do_jumpserver_exit_client(acptr); count++; diff --git a/src/modules/kick.c b/src/modules/kick.c index 91b6bba6c..50d863813 100644 --- a/src/modules/kick.c +++ b/src/modules/kick.c @@ -99,7 +99,7 @@ CMD_FUNC(m_kick) continue; } /* Store "sptr" access flags */ - if (IsPerson(sptr)) + if (IsUser(sptr)) sptr_flags = get_access(sptr, chptr); if (!IsServer(cptr) && !IsULine(sptr) && !op_can_override("channel:override:kick:no-ops",sptr,chptr,NULL) && !(sptr_flags & CHFL_ISOP) && !(sptr_flags & CHFL_HALFOP)) @@ -112,7 +112,7 @@ CMD_FUNC(m_kick) { long who_flags; - if (MyClient(sptr) && (++ntargets > maxtargets)) + if (MyUser(sptr) && (++ntargets > maxtargets)) { sendnumeric(sptr, ERR_TOOMANYTARGETS, user, maxtargets, "KICK"); break; @@ -130,7 +130,7 @@ CMD_FUNC(m_kick) /* Note for coders regarding oper override: * always let a remote kick (=from a user on another server) through or * else we will get desynched. In short this means all the denying should - * always contain a && MyClient(sptr) [or sptr!=cptr] and at the end + * always contain a && MyUser(sptr) [or sptr!=cptr] and at the end * a remote kick should always be allowed (pass through). -- Syzop */ @@ -153,10 +153,10 @@ CMD_FUNC(m_kick) if (ret == EX_ALWAYS_DENY) { - if (MyClient(sptr) && badkick) + if (MyUser(sptr) && badkick) sendto_one(sptr, NULL, "%s", badkick); /* send error, if any */ - if (MyClient(sptr)) + if (MyUser(sptr)) continue; /* reject the kick (note: we never block remote kicks) */ } @@ -175,7 +175,7 @@ CMD_FUNC(m_kick) goto attack; /* all other checks don't matter anymore (and could cause double msgs) */ } else { /* Not an oper overriding */ - if (MyClient(sptr) && badkick) + if (MyUser(sptr) && badkick) sendto_one(sptr, NULL, "%s", badkick); /* send error, if any */ continue; /* reject the kick */ @@ -225,7 +225,7 @@ CMD_FUNC(m_kick) goto attack; } - else if (!IsULine(sptr) && (who != sptr) && MyClient(sptr)) + else if (!IsULine(sptr) && (who != sptr) && MyUser(sptr)) { char errbuf[NICKLEN+25]; if (who_flags & CHFL_CHANOWNER) @@ -242,7 +242,7 @@ CMD_FUNC(m_kick) /* victim is +o, we are +h [operoverride is already taken care of 2 blocks above] */ if ((who_flags & CHFL_ISOP) && (sptr_flags & CHFL_HALFOP) - && !(sptr_flags & CHFL_ISOP) && !IsULine(sptr) && MyClient(sptr)) + && !(sptr_flags & CHFL_ISOP) && !IsULine(sptr) && MyUser(sptr)) { char errbuf[NICKLEN+30]; ircsnprintf(errbuf, sizeof(errbuf), "%s is a channel operator", who->name); @@ -253,7 +253,7 @@ CMD_FUNC(m_kick) /* victim is +h, we are +h [operoverride is already taken care of 3 blocks above] */ if ((who_flags & CHFL_HALFOP) && (sptr_flags & CHFL_HALFOP) - && !(sptr_flags & CHFL_ISOP) && MyClient(sptr)) + && !(sptr_flags & CHFL_ISOP) && MyUser(sptr)) { char errbuf[NICKLEN+15]; ircsnprintf(errbuf, sizeof(errbuf), "%s is a halfop", who->name); @@ -286,7 +286,7 @@ CMD_FUNC(m_kick) new_message_special(sptr, recv_mtags, &mtags, ":%s KICK %s %s", sptr->name, chptr->chname, who->name); /* The same message is actually sent at 5 places below (though max 4 at most) */ - if (MyClient(sptr)) + if (MyUser(sptr)) RunHook6(HOOKTYPE_LOCAL_KICK, cptr, sptr, who, chptr, mtags, comment); else RunHook6(HOOKTYPE_REMOTE_KICK, cptr, sptr, who, chptr, mtags, comment); @@ -302,7 +302,7 @@ CMD_FUNC(m_kick) ":%s KICK %s %s :%s", sptr->name, chptr->chname, who->name, comment); - if (MyClient(who)) + if (MyUser(who)) { sendto_prefix_one(who, sptr, mtags, ":%s KICK %s %s :%s", sptr->name, chptr->chname, who->name, comment); @@ -324,10 +324,10 @@ CMD_FUNC(m_kick) remove_user_from_channel(who, chptr); } } - else if (MyClient(sptr)) + else if (MyUser(sptr)) sendnumeric(sptr, ERR_USERNOTINCHANNEL, user, name); } /* loop on parv[2] */ - if (MyClient(cptr)) + if (MyUser(cptr)) break; } /* loop on parv[1] */ diff --git a/src/modules/kill.c b/src/modules/kill.c index 272dee5d9..1115f589d 100644 --- a/src/modules/kill.c +++ b/src/modules/kill.c @@ -102,14 +102,14 @@ CMD_FUNC(m_kill) if (strlen(path) > iConf.quit_length) path[iConf.quit_length] = '\0'; - if (MyClient(sptr)) + if (MyUser(sptr)) user = canonize(user); for (p = NULL, nick = strtoken(&p, user, ","); nick; nick = strtoken(&p, NULL, ",")) { MessageTag *mtags = NULL; - if (MyClient(sptr) && (++ntargets > maxtargets)) + if (MyUser(sptr) && (++ntargets > maxtargets)) { sendnumeric(sptr, ERR_TOOMANYTARGETS, nick, maxtargets, "KILL"); break; @@ -121,7 +121,7 @@ CMD_FUNC(m_kill) * In other words: we'll check the history for recently changed nicks. * We don't do this for remote KILL requests as we have UID for that. */ - if (!acptr && MyClient(sptr)) + if (!acptr && MyUser(sptr)) { acptr = get_history(nick, KILLCHASETIMELIMIT); if (acptr) @@ -134,8 +134,8 @@ CMD_FUNC(m_kill) continue; } - if ((!MyConnect(acptr) && MyClient(cptr) && !ValidatePermissionsForPath("kill:global",sptr,acptr,NULL,NULL)) - || (MyConnect(acptr) && MyClient(cptr) + if ((!MyConnect(acptr) && MyUser(cptr) && !ValidatePermissionsForPath("kill:global",sptr,acptr,NULL,NULL)) + || (MyConnect(acptr) && MyUser(cptr) && !ValidatePermissionsForPath("kill:local",sptr,acptr,NULL,NULL))) { sendnumeric(sptr, ERR_NOPRIVILEGES); @@ -143,7 +143,7 @@ CMD_FUNC(m_kill) } /* Hooks can plug-in here to reject a kill */ - if (MyClient(sptr)) + if (MyUser(sptr)) { int ret = EX_ALLOW; for (h = Hooks[HOOKTYPE_PRE_KILL]; h; h = h->next) @@ -250,7 +250,7 @@ CMD_FUNC(m_kill) ircsnprintf(buf2, sizeof(buf2), "Killed (%s)", killer); } - if (MyClient(sptr)) + if (MyUser(sptr)) RunHook3(HOOKTYPE_LOCAL_KILL, sptr, acptr, parv[2]); n = exit_client(cptr, acptr, sptr, mtags, buf2); diff --git a/src/modules/knock.c b/src/modules/knock.c index 34ccb9e82..a36659dca 100644 --- a/src/modules/knock.c +++ b/src/modules/knock.c @@ -125,7 +125,7 @@ CMD_FUNC(m_knock) if (i == HOOK_DENY) return 0; - if (MyClient(sptr) && !ValidatePermissionsForPath("immune:knock-flood",sptr,NULL,NULL,NULL)) + if (MyUser(sptr) && !ValidatePermissionsForPath("immune:knock-flood",sptr,NULL,NULL,NULL)) { if ((sptr->user->flood.knock_t + KNOCK_PERIOD) <= timeofday) { diff --git a/src/modules/labeled-response.c b/src/modules/labeled-response.c index 1072df220..56137b678 100644 --- a/src/modules/labeled-response.c +++ b/src/modules/labeled-response.c @@ -251,7 +251,7 @@ int lr_packet(Client *from, Client *to, Client *intended_to, char **msg, int *le } currentcmd.responses++; } - else if (IsServer(to) || !MyClient(to)) + else if (IsServer(to) || !MyUser(to)) { currentcmd.sent_remote = 1; } @@ -273,7 +273,7 @@ int labeled_response_mtag_is_ok(Client *acptr, char *name, char *value) * it's too much hassle to support labeled-response without * batch and the end result is quite broken too. */ - if (MyClient(acptr) && (!SupportLabel(acptr) || !SupportBatch(acptr))) + if (MyUser(acptr) && (!SupportLabel(acptr) || !SupportBatch(acptr))) return 0; /* Do some basic sanity checking for non-servers */ diff --git a/src/modules/list.c b/src/modules/list.c index a60c96fea..c2e11727b 100644 --- a/src/modules/list.c +++ b/src/modules/list.c @@ -147,7 +147,7 @@ CMD_FUNC(m_list) for (name = strtoken(&p, parv[1], ","); name && !error; name = strtoken(&p, NULL, ",")) { - if (MyClient(sptr) && (++ntargets > maxtargets)) + if (MyUser(sptr) && (++ntargets > maxtargets)) { sendnumeric(sptr, ERR_TOOMANYTARGETS, name, maxtargets, "LIST"); break; diff --git a/src/modules/locops.c b/src/modules/locops.c index 0a53b1b0c..c2c985d42 100644 --- a/src/modules/locops.c +++ b/src/modules/locops.c @@ -67,7 +67,7 @@ CMD_FUNC(m_locops) sendnumeric(sptr, ERR_NEEDMOREPARAMS, "LOCOPS"); return 0; } - if (MyClient(sptr) && !ValidatePermissionsForPath("chat:locops",sptr,NULL,NULL,NULL)) + if (MyUser(sptr) && !ValidatePermissionsForPath("chat:locops",sptr,NULL,NULL,NULL)) { sendnumeric(sptr, ERR_NOPRIVILEGES); return 0; diff --git a/src/modules/md.c b/src/modules/md.c index db31bf4b2..7bf3b2941 100644 --- a/src/modules/md.c +++ b/src/modules/md.c @@ -423,7 +423,7 @@ void _send_moddata_members(Client *srv) list_for_each_entry(acptr, &client_list, client_node) { Membership *m; - if (!IsPerson(acptr) || !acptr->user) + if (!IsUser(acptr) || !acptr->user) continue; if (acptr->direction == srv) diff --git a/src/modules/message.c b/src/modules/message.c index 9bf96368c..10f3be872 100644 --- a/src/modules/message.c +++ b/src/modules/message.c @@ -103,7 +103,7 @@ int ret; return CANPRIVMSG_CONTINUE; } - if (MyClient(sptr) && !strncasecmp(*text, "\001DCC", 4)) + if (MyUser(sptr) && !strncasecmp(*text, "\001DCC", 4)) { ret = check_dcc(sptr, acptr->name, acptr, *text); if (ret < 0) @@ -111,11 +111,11 @@ int ret; if (ret == 0) return CANPRIVMSG_CONTINUE; } - if (MyClient(acptr) && !strncasecmp(*text, "\001DCC", 4) && + if (MyUser(acptr) && !strncasecmp(*text, "\001DCC", 4) && !check_dcc_soft(sptr, acptr, *text)) return CANPRIVMSG_CONTINUE; - if (MyClient(sptr) && check_for_target_limit(sptr, acptr, acptr->name)) + if (MyUser(sptr) && check_for_target_limit(sptr, acptr, acptr->name)) return CANPRIVMSG_CONTINUE; if (!is_silenced(sptr, acptr)) @@ -127,7 +127,7 @@ int ret; sendnumeric(sptr, RPL_AWAY, acptr->name, acptr->user->away); - if (MyClient(sptr)) + if (MyUser(sptr)) { ret = run_spamfilter(sptr, *text, (notice ? SPAMF_USERNOTICE : SPAMF_USERMSG), acptr->name, 0, NULL); if (ret < 0) @@ -195,16 +195,16 @@ int m_message(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, char for (p = NULL, nick = strtoken(&p, parv[1], ","); nick; nick = strtoken(&p, NULL, ",")) { - if (MyClient(sptr) && (++ntargets > maxtargets)) + if (MyUser(sptr) && (++ntargets > maxtargets)) { sendnumeric(sptr, ERR_TOOMANYTARGETS, nick, maxtargets, cmd); break; } /* The nicks "ircd" and "irc" are special (and reserved) */ - if (!strcasecmp(nick, "ircd") && MyClient(sptr)) + if (!strcasecmp(nick, "ircd") && MyUser(sptr)) return 0; - if (!strcasecmp(nick, "irc") && MyClient(sptr)) + if (!strcasecmp(nick, "irc") && MyUser(sptr)) { /* When ban version { } is enabled the IRCd sends a CTCP VERSION request * from the "IRC" nick. So we need to handle CTCP VERSION replies to "IRC". @@ -264,7 +264,7 @@ int m_message(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, char if (prefix) { - if (MyClient(sptr) && !op_can_override("channel:override:message:prefix",sptr,chptr,NULL)) + if (MyUser(sptr) && !op_can_override("channel:override:message:prefix",sptr,chptr,NULL)) { Membership *lp = find_membership_link(sptr->user->channel, chptr); /* Check if user is allowed to send. RULES: @@ -306,7 +306,7 @@ int m_message(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, char } } - if (MyClient(sptr) && (*parv[2] == 1)) + if (MyUser(sptr) && (*parv[2] == 1)) { ret = check_dcc(sptr, chptr->chname, NULL, parv[2]); if (ret < 0) @@ -323,7 +323,7 @@ int m_message(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, char text = parv[2]; errmsg = NULL; - if (MyClient(sptr) && !IsULine(sptr)) + if (MyUser(sptr) && !IsULine(sptr)) { if (!can_send(sptr, chptr, &text, &errmsg, notice)) { @@ -347,7 +347,7 @@ int m_message(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, char text = parv[2]; - if (MyClient(sptr)) + if (MyUser(sptr)) { ret = run_spamfilter(sptr, text, notice ? SPAMF_CHANNOTICE : SPAMF_CHANMSG, chptr->chname, 0, NULL); if (ret < 0) @@ -427,7 +427,7 @@ int m_message(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, char sendto_prefix_one(acptr, sptr, mtags, ":%s %s %s :%s", CHECKPROTO(acptr->direction, PROTO_SID) ? ID(sptr) : sptr->name, newcmd, - (MyClient(acptr) ? acptr->name : nick), + (MyUser(acptr) ? acptr->name : nick), text); labeled_response_inhibit = 0; RunHook5(HOOKTYPE_USERMSG, sptr, acptr, mtags, text, notice); @@ -914,7 +914,7 @@ int _can_send(Client *cptr, Channel *chptr, char **msgtext, char **errmsg, int n int member, i = 0; Hook *h; - if (!MyClient(cptr)) + if (!MyUser(cptr)) return 1; *errmsg = NULL; @@ -992,7 +992,7 @@ int _can_send(Client *cptr, Channel *chptr, char **msgtext, char **errmsg, int n if ((!lp || !(lp->flags & (CHFL_CHANOP | CHFL_VOICE | CHFL_CHANOWNER | - CHFL_HALFOP | CHFL_CHANADMIN))) && MyClient(cptr) + CHFL_HALFOP | CHFL_CHANADMIN))) && MyUser(cptr) && is_banned(cptr, chptr, BANCHK_MSG, msgtext, errmsg)) { /* Modules can set 'errmsg', otherwise we default to this: */ diff --git a/src/modules/mode.c b/src/modules/mode.c index 3e1ed7948..d4bb57b54 100644 --- a/src/modules/mode.c +++ b/src/modules/mode.c @@ -136,7 +136,7 @@ CMD_FUNC(m_mode) return 0; } - if (IsPerson(sptr) && strstr(parv[2], "b") && BadPtr(parv[3])) + if (IsUser(sptr) && strstr(parv[2], "b") && BadPtr(parv[3])) { if (!IsMember(sptr, chptr) && !ValidatePermissionsForPath("channel:see:mode:remotebanlist",sptr,NULL,chptr,NULL)) return 0; @@ -149,7 +149,7 @@ CMD_FUNC(m_mode) return 0; } - if (IsPerson(sptr) && strstr(parv[2], "e") && BadPtr(parv[3])) + if (IsUser(sptr) && strstr(parv[2], "e") && BadPtr(parv[3])) { if (!IsMember(sptr, chptr) && !ValidatePermissionsForPath("channel:see:mode:remotebanlist",sptr,NULL,chptr,NULL)) return 0; @@ -162,7 +162,7 @@ CMD_FUNC(m_mode) return 0; } - if (IsPerson(sptr) && strstr(parv[2], "I") && BadPtr(parv[3])) + if (IsUser(sptr) && strstr(parv[2], "I") && BadPtr(parv[3])) { if (!IsMember(sptr, chptr) && !ValidatePermissionsForPath("channel:see:mode:remoteinvexlist",sptr,NULL,chptr,NULL)) return 0; @@ -173,7 +173,7 @@ CMD_FUNC(m_mode) return 0; } - if (IsPerson(sptr) && strstr(parv[2], "q") && BadPtr(parv[3])) + if (IsUser(sptr) && strstr(parv[2], "q") && BadPtr(parv[3])) { if (!IsMember(sptr, chptr) && !ValidatePermissionsForPath("channel:see:mode:remoteownerlist",sptr,NULL,chptr,NULL)) return 0; @@ -195,7 +195,7 @@ CMD_FUNC(m_mode) } } - if (IsPerson(sptr) && strstr(parv[2], "a") && BadPtr(parv[3])) + if (IsUser(sptr) && strstr(parv[2], "a") && BadPtr(parv[3])) { if (!IsMember(sptr, chptr) && !ValidatePermissionsForPath("channel:see:mode:remoteownerlist",sptr,NULL,chptr,NULL)) return 0; @@ -220,7 +220,7 @@ CMD_FUNC(m_mode) opermode = 0; #ifndef NO_OPEROVERRIDE - if (IsPerson(sptr) && !IsULine(sptr) && !is_chan_op(sptr, chptr) && + if (IsUser(sptr) && !IsULine(sptr) && !is_chan_op(sptr, chptr) && !is_half_op(sptr, chptr) && ValidatePermissionsForPath("channel:override:mode",sptr,NULL,chptr,NULL)) { sendts = 0; @@ -228,7 +228,7 @@ CMD_FUNC(m_mode) goto aftercheck; } - if (IsPerson(sptr) && !IsULine(sptr) && !is_chan_op(sptr, chptr) && + if (IsUser(sptr) && !IsULine(sptr) && !is_chan_op(sptr, chptr) && is_half_op(sptr, chptr) && ValidatePermissionsForPath("channel:override:mode",sptr,NULL,chptr,NULL)) { opermode = 2; @@ -236,7 +236,7 @@ CMD_FUNC(m_mode) } #endif - if (IsPerson(sptr) && !IsULine(sptr) && !is_chan_op(sptr, chptr) && + if (IsUser(sptr) && !IsULine(sptr) && !is_chan_op(sptr, chptr) && !is_half_op(sptr, chptr) && (cptr == sptr || !ValidatePermissionsForPath("channel:override:mode",sptr,NULL,chptr,NULL))) { @@ -276,7 +276,7 @@ CMD_FUNC(m_mode) aftercheck: /* This is to prevent excess + modes. -- Syzop */ - if (MyClient(sptr) && parv[2]) + if (MyUser(sptr) && parv[2]) { mode_cutoff(parv[2]); mode_cutoff2(sptr, chptr, &parc, parv); @@ -471,7 +471,7 @@ void _do_mode(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_mtags /* opermode for twimodesystem --sts */ #ifndef NO_OPEROVERRIDE - if ((opermode == 1) && IsPerson(sptr)) + if ((opermode == 1) && IsUser(sptr)) { if (modebuf[1]) { @@ -497,7 +497,7 @@ void _do_mode(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_mtags return; } - if (IsPerson(sptr) && samode && MyClient(sptr)) + if (IsUser(sptr) && samode && MyUser(sptr)) { if (!sajoinmode) sendto_umode_global(UMODE_OPER, "%s used SAMODE %s (%s%s%s)", @@ -754,7 +754,7 @@ int do_mode_char(Channel *chptr, long modetype, char modechar, char *param, if ((my_access & CHFL_HALFOP) && !is_xchanop(my_access) && !IsULine(cptr) && !op_can_override("channel:override:mode",cptr,chptr,&modetype) && !samode_in_progress) { - if (MyClient(cptr) && (modetype == MODE_HALFOP) && (what == MODE_DEL) && + if (MyUser(cptr) && (modetype == MODE_HALFOP) && (what == MODE_DEL) && param && (find_client(param, NULL) == cptr)) { /* halfop -h'ing him/herself */ @@ -764,7 +764,7 @@ int do_mode_char(Channel *chptr, long modetype, char modechar, char *param, /* Ugly halfop hack --sts - this allows halfops to do +b +e +v and so on */ /* (Syzop/20040413: Allow remote halfop modes */ - if ((Halfop_mode(modetype) == FALSE) && MyClient(cptr)) + if ((Halfop_mode(modetype) == FALSE) && MyUser(cptr)) { int eaten = 0; while (tab->mode != 0x0) @@ -819,7 +819,7 @@ int do_mode_char(Channel *chptr, long modetype, char modechar, char *param, REQUIRE_PARAMETER() if (!IsULine(cptr) && !IsServer(cptr) && !is_chanowner(cptr, chptr) && !samode_in_progress) { - if (MyClient(cptr) && !op_can_override("channel:override:mode",cptr,chptr,&modetype)) + if (MyUser(cptr) && !op_can_override("channel:override:mode",cptr,chptr,&modetype)) { sendnumeric(cptr, ERR_CHANOWNPRIVNEEDED, chptr->chname); break; @@ -834,7 +834,7 @@ int do_mode_char(Channel *chptr, long modetype, char modechar, char *param, if (!IsULine(cptr) && !IsServer(cptr) && !is_chanowner(cptr, chptr) && !samode_in_progress && !(param && (what == MODE_DEL) && (find_client(param, NULL) == cptr))) { - if (MyClient(cptr) && !op_can_override("channel:override:mode",cptr,chptr,&modetype)) + if (MyUser(cptr) && !op_can_override("channel:override:mode",cptr,chptr,&modetype)) { sendnumeric(cptr, ERR_CHANOWNPRIVNEEDED, chptr->chname); break; @@ -888,10 +888,10 @@ process_listmode: if (ret == EX_ALWAYS_DENY) { - if (MyClient(cptr) && badmode) + if (MyUser(cptr) && badmode) sendto_one(cptr, NULL, "%s", badmode); /* send error message, if any */ - if (MyClient(cptr)) + if (MyUser(cptr)) break; /* stop processing this mode */ } @@ -917,7 +917,7 @@ process_listmode: && !is_chanowner(cptr, chptr) && !IsServer(cptr) && !IsULine(cptr) && !opermode && !samode_in_progress && (what == MODE_DEL)) { - if (MyClient(cptr)) + if (MyUser(cptr)) { /* Need this !op_can_override() here again, even with the !opermode * check a few lines up, all due to halfops. -- Syzop @@ -944,7 +944,7 @@ process_listmode: && !is_chanowner(cptr, chptr) && !IsServer(cptr) && !opermode && !samode_in_progress && modetype != MODE_CHANOWNER && (what == MODE_DEL)) { - if (MyClient(cptr)) + if (MyUser(cptr)) { /* Need this !op_can_override() here again, even with the !opermode * check a few lines up, all due to halfops. -- Syzop @@ -1069,7 +1069,7 @@ process_listmode: if (BadPtr(tmpstr)) { /* Invalid ban. See if we can send an error about that */ - if ((param[0] == '~') && MyClient(cptr) && !bounce && (strlen(param) > 2)) + if ((param[0] == '~') && MyUser(cptr) && !bounce && (strlen(param) > 2)) { Extban *p = findmod_by_bantype(param[1]); if (p && p->is_ok) @@ -1078,7 +1078,7 @@ process_listmode: break; /* ignore ban, but eat param */ } - if ((tmpstr[0] == '~') && MyClient(cptr) && !bounce) + if ((tmpstr[0] == '~') && MyUser(cptr) && !bounce) { /* extban: check access if needed */ Extban *p = findmod_by_bantype(tmpstr[1]); @@ -1117,7 +1117,7 @@ process_listmode: tmpstr = clean_ban_mask(param, what, cptr); if (BadPtr(tmpstr)) break; /* ignore except, but eat param */ - if ((tmpstr[0] == '~') && MyClient(cptr) && !bounce && (strlen(param) > 2)) + if ((tmpstr[0] == '~') && MyUser(cptr) && !bounce && (strlen(param) > 2)) { /* extban: check access if needed */ Extban *p = findmod_by_bantype(tmpstr[1]); @@ -1156,7 +1156,7 @@ process_listmode: tmpstr = clean_ban_mask(param, what, cptr); if (BadPtr(tmpstr)) break; /* ignore except, but eat param */ - if ((tmpstr[0] == '~') && MyClient(cptr) && !bounce && (strlen(param) > 2)) + if ((tmpstr[0] == '~') && MyUser(cptr) && !bounce && (strlen(param) > 2)) { /* extban: check access if needed */ Extban *p = findmod_by_bantype(tmpstr[1]); @@ -1218,10 +1218,10 @@ int do_extmode_char(Channel *chptr, Cmode *handler, char *param, u_int what, return 0; /* Prevent remote users from setting local channel modes */ - if (handler->local && !MyClient(cptr)) + if (handler->local && !MyUser(cptr)) return paracnt; - if (MyClient(cptr)) + if (MyUser(cptr)) { x = handler->is_ok(cptr, chptr, mode, param, EXCHK_ACCESS, what); if ((x == EX_ALWAYS_DENY) || @@ -1234,7 +1234,7 @@ int do_extmode_char(Channel *chptr, Cmode *handler, char *param, u_int what, opermode = 1; /* override in progress... */ } else { /* remote user: we only need to check if we need to generate an operoverride msg */ - if (!IsULine(cptr) && IsPerson(cptr) && op_can_override("channel:override:mode:del",cptr,chptr,handler) && + if (!IsULine(cptr) && IsUser(cptr) && op_can_override("channel:override:mode:del",cptr,chptr,handler) && (handler->is_ok(cptr, chptr, mode, param, EXCHK_ACCESS, what) != EX_ALLOW)) { opermode = 1; /* override in progress... */ @@ -1324,7 +1324,7 @@ int do_extmode_char(Channel *chptr, Cmode *handler, char *param, u_int what, */ int paracount_for_chanmode_from_server(Client *acptr, u_int what, char mode) { - if (MyClient(acptr)) + if (MyUser(acptr)) return 0; /* no server, we have no idea, assume 0 paracount */ if (!acptr->serv) @@ -1418,7 +1418,7 @@ void _set_mode(Channel *chptr, Client *cptr, int parc, char *parv[], u_int *pcou checkrestr = 1; /* Set access to the status we have */ - my_access = IsPerson(cptr) ? get_access(cptr, chptr) : 0; + my_access = IsUser(cptr) ? get_access(cptr, chptr) : 0; for (curchr = parv[0]; *curchr; curchr++) { @@ -1431,7 +1431,7 @@ void _set_mode(Channel *chptr, Client *cptr, int parc, char *parv[], u_int *pcou what = MODE_DEL; break; default: - if (MyClient(cptr) && chptr->mode_lock && strchr(chptr->mode_lock, *curchr) != NULL) + if (MyUser(cptr) && chptr->mode_lock && strchr(chptr->mode_lock, *curchr) != NULL) { if (!sent_mlock_warning) { @@ -1467,7 +1467,7 @@ void _set_mode(Channel *chptr, Client *cptr, int parc, char *parv[], u_int *pcou } if (found == 0) /* Mode char unknown */ { - if (!MyClient(cptr)) + if (!MyUser(cptr)) paracount += paracount_for_chanmode_from_server(cptr, what, *curchr); else sendnumeric(cptr, ERR_UNKNOWNMODE, *curchr); @@ -1535,7 +1535,7 @@ void _set_mode(Channel *chptr, Client *cptr, int parc, char *parv[], u_int *pcou make_mode_str(chptr, oldm, oldem, oldl, *pcount, pvar, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), bounce); #ifndef NO_OPEROVERRIDE - if ((htrig == 1) && IsPerson(cptr)) + if ((htrig == 1) && IsUser(cptr)) { /* This is horrible. Just horrible. */ if (!((modebuf[0] == '+' || modebuf[0] == '-') && modebuf[1] == '\0')) @@ -1613,7 +1613,7 @@ CMD_FUNC(_m_umode) if ((sptr->user->snomask & Snomask_Table[i].mode)) oldsnomasks |= Snomask_Table[i].mode; - if (RESTRICT_USERMODES && MyClient(sptr) && !ValidatePermissionsForPath("immune:restrict-usermodes",sptr,NULL,NULL,NULL)) + if (RESTRICT_USERMODES && MyUser(sptr) && !ValidatePermissionsForPath("immune:restrict-usermodes",sptr,NULL,NULL,NULL)) chk_restrict = 1; if (MyConnect(sptr)) @@ -1684,7 +1684,7 @@ CMD_FUNC(_m_umode) * but we need to take care here too because it might cause problems * that's just asking for bugs! -- Syzop. */ - if (MyClient(sptr) && (what == MODE_ADD)) /* Someone setting himself +o? Deny it. */ + if (MyUser(sptr) && (what == MODE_ADD)) /* Someone setting himself +o? Deny it. */ break; goto def; case 't': @@ -1694,7 +1694,7 @@ CMD_FUNC(_m_umode) case UHALLOW_ALWAYS: goto def; case UHALLOW_NEVER: - if (MyClient(sptr)) + if (MyUser(sptr)) { if (!modex_err) { @@ -1706,7 +1706,7 @@ CMD_FUNC(_m_umode) } goto def; case UHALLOW_NOCHANS: - if (MyClient(sptr) && sptr->user->joined) + if (MyUser(sptr) && sptr->user->joined) { if (!modex_err) { @@ -1795,7 +1795,7 @@ CMD_FUNC(_m_umode) } } - if (MyClient(sptr) && (sptr->umodes & UMODE_SECURE) && !IsSecure(sptr)) + if (MyUser(sptr) && (sptr->umodes & UMODE_SECURE) && !IsSecure(sptr)) sptr->umodes &= ~UMODE_SECURE; /* -x translates to -xt (if applicable) */ @@ -1822,7 +1822,7 @@ CMD_FUNC(_m_umode) /* Notify */ userhost_changed(sptr); - if (MyClient(sptr)) + if (MyUser(sptr)) sendnumeric(sptr, RPL_HOSTHIDDEN, sptr->user->virthost); } @@ -1838,7 +1838,7 @@ CMD_FUNC(_m_umode) /* Notify */ userhost_changed(sptr); - if (MyClient(sptr)) + if (MyUser(sptr)) sendnumeric(sptr, RPL_HOSTHIDDEN, sptr->user->realhost); } /* diff --git a/src/modules/motd.c b/src/modules/motd.c index a59db9987..51b660360 100644 --- a/src/modules/motd.c +++ b/src/modules/motd.c @@ -69,7 +69,7 @@ CMD_FUNC(m_motd) if (hunt_server(cptr, sptr, recv_mtags, ":%s MOTD :%s", 1, parc, parv) != HUNTED_ISME) { - if (MyClient(sptr)) + if (MyUser(sptr)) sptr->local->since += 15; return 0; } diff --git a/src/modules/nick.c b/src/modules/nick.c index 0675b8ea3..119304e6f 100644 --- a/src/modules/nick.c +++ b/src/modules/nick.c @@ -384,7 +384,7 @@ CMD_FUNC(m_uid) acptrs ? acptrs->name : "unknown server"); } - if (IsServer(cptr) && IsPerson(sptr) && !ishold) /* remote user changing nick */ + if (IsServer(cptr) && IsUser(sptr) && !ishold) /* remote user changing nick */ { sendto_snomask(SNO_QLINE, "Q-Lined nick %s from %s on %s", nick, sptr->name, sptr->srvptr ? sptr->srvptr->name : ""); @@ -579,7 +579,7 @@ CMD_FUNC(m_nick) unsigned char removemoder = (sptr->umodes & UMODE_REGNICK) ? 1 : 0; Hook *h; int i = 0; - char *nickid = (IsPerson(sptr) && *sptr->id) ? sptr->id : NULL; + char *nickid = (IsUser(sptr) && *sptr->id) ? sptr->id : NULL; /* * If the user didn't specify a nickname, complain */ @@ -720,7 +720,7 @@ CMD_FUNC(m_nick) "Reserved for internal IRCd purposes"); return 0; } - if (MyClient(sptr)) /* local client changin nick afterwards.. */ + if (MyUser(sptr)) /* local client changin nick afterwards.. */ { int xx; spamfilter_build_user_string(spamfilter_user, nick, sptr); @@ -741,7 +741,7 @@ CMD_FUNC(m_nick) acptrs ? acptrs->name : "unknown server"); } - if (IsServer(cptr) && IsPerson(sptr) && !ishold) /* remote user changing nick */ + if (IsServer(cptr) && IsUser(sptr) && !ishold) /* remote user changing nick */ { sendto_snomask(SNO_QLINE, "Q-Lined nick %s from %s on %s", nick, sptr->name, sptr->srvptr ? sptr->srvptr->name : ""); @@ -792,7 +792,7 @@ CMD_FUNC(m_nick) return exit_client(cptr, sptr, &me, NULL, "Nick/Server collision"); } - if (MyClient(cptr) && !ValidatePermissionsForPath("immune:nick-flood",sptr,NULL,NULL,NULL)) + if (MyUser(cptr) && !ValidatePermissionsForPath("immune:nick-flood",sptr,NULL,NULL,NULL)) cptr->local->since += 3; /* Nick-flood prot. -Donwulff */ if (!(acptr = find_client(nick, NULL))) @@ -993,7 +993,7 @@ CMD_FUNC(m_nick) } newusr = 1; } - else if (sptr->name[0] && IsPerson(sptr)) + else if (sptr->name[0] && IsUser(sptr)) { MessageTag *mtags = NULL; @@ -1004,7 +1004,7 @@ CMD_FUNC(m_nick) ** change to occur. ** Also set 'lastnick' to current time, if changed. */ - if (MyClient(sptr)) + if (MyUser(sptr)) { for (mp = sptr->user->channel; mp; mp = mp->next) { @@ -1060,9 +1060,9 @@ CMD_FUNC(m_nick) */ if (mycmp(sptr->name, nick) || /* Next line can be removed when all upgraded --Run */ - (!MyClient(sptr) && parc > 2 + (!MyUser(sptr) && parc > 2 && atol(parv[2]) < sptr->lastnick)) - sptr->lastnick = (MyClient(sptr) + sptr->lastnick = (MyUser(sptr) || parc < 3) ? TStime() : atol(parv[2]); if (sptr->lastnick < 0) { @@ -1123,7 +1123,7 @@ CMD_FUNC(m_nick) if (update_watch && sptr->name[0]) { (void)del_from_client_hash_table(sptr->name, sptr); - if (IsPerson(sptr)) + if (IsUser(sptr)) hash_check_watch(sptr, RPL_LOGOFF); } @@ -1144,15 +1144,15 @@ CMD_FUNC(m_nick) if (IsNetInfo(cptr) && !IsULine(sptr)) sendto_fconnectnotice(sptr, 0, NULL); } - else if (IsPerson(sptr) && update_watch) + else if (IsUser(sptr) && update_watch) hash_check_watch(sptr, RPL_LOGON); - if (newusr && !MyClient(sptr) && IsPerson(sptr)) + if (newusr && !MyUser(sptr) && IsUser(sptr)) { RunHook(HOOKTYPE_REMOTE_CONNECT, sptr); } - if (removemoder && MyClient(sptr)) + if (removemoder && MyUser(sptr)) { sendto_one(sptr, NULL, ":%s MODE %s :-r", me.name, sptr->name); } @@ -1366,7 +1366,7 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char { strlcpy(user->username, username, USERLEN+1); } - SetClient(sptr); + SetUser(sptr); ircstats.clients++; if (sptr->srvptr && sptr->srvptr->serv) sptr->srvptr->serv->users++; diff --git a/src/modules/oper.c b/src/modules/oper.c index 8527afaaa..a03302714 100644 --- a/src/modules/oper.c +++ b/src/modules/oper.c @@ -85,7 +85,7 @@ CMD_FUNC(m_oper) char *name, *password; long old_umodes = sptr->umodes & ALL_UMODES; - if (!MyClient(sptr)) + if (!MyUser(sptr)) return 0; if ((parc < 2) || BadPtr(parv[1])) diff --git a/src/modules/part.c b/src/modules/part.c index 61d22a342..700f2f605 100644 --- a/src/modules/part.c +++ b/src/modules/part.c @@ -75,7 +75,7 @@ CMD_FUNC(m_part) return 0; } - if (MyClient(sptr)) + if (MyUser(sptr)) { if (IsShunned(sptr)) commentx = NULL; @@ -102,7 +102,7 @@ CMD_FUNC(m_part) { MessageTag *mtags = NULL; - if (MyClient(sptr) && (++ntargets > maxtargets)) + if (MyUser(sptr) && (++ntargets > maxtargets)) { sendnumeric(sptr, ERR_TOOMANYTARGETS, name, maxtargets, "PART"); break; @@ -127,7 +127,7 @@ CMD_FUNC(m_part) ** for a remote client (who sends back a PART), ** so check for remote client or not --Run */ - if (MyClient(sptr)) + if (MyUser(sptr)) sendnumeric(sptr, ERR_NOTONCHANNEL, name); continue; } @@ -175,7 +175,7 @@ CMD_FUNC(m_part) SEND_LOCAL, mtags, ":%s PART %s", sptr->name, chptr->chname); - if (MyClient(sptr)) + if (MyUser(sptr)) { sendto_one(sptr, mtags, ":%s!%s@%s PART %s", sptr->name, sptr->user->username, GetHost(sptr), chptr->chname); @@ -188,7 +188,7 @@ CMD_FUNC(m_part) SEND_LOCAL, mtags, ":%s PART %s %s", sptr->name, chptr->chname, comment); - if (MyClient(sptr)) + if (MyUser(sptr)) { sendto_one(sptr, mtags, ":%s!%s@%s PART %s %s", @@ -212,7 +212,7 @@ CMD_FUNC(m_part) } } - if (MyClient(sptr)) + if (MyUser(sptr)) RunHook5(HOOKTYPE_LOCAL_PART, cptr, sptr, chptr, mtags, comment); else RunHook5(HOOKTYPE_REMOTE_PART, cptr, sptr, chptr, mtags, comment); diff --git a/src/modules/pingpong.c b/src/modules/pingpong.c index 63c36ea19..cf7a5d44c 100644 --- a/src/modules/pingpong.c +++ b/src/modules/pingpong.c @@ -76,7 +76,7 @@ CMD_FUNC(m_ping) origin = parv[1]; destination = parv[2]; /* Will get NULL or pointer (parc >= 2!!) */ - if (!MyClient(sptr)) + if (!MyUser(sptr)) { /* I've no idea who invented this or what it is supposed to do.. */ acptr = find_client(origin, NULL); @@ -88,7 +88,7 @@ CMD_FUNC(m_ping) if (!BadPtr(destination) && mycmp(destination, me.name) != 0 && mycmp(destination, me.id) != 0) { - if (MyClient(sptr)) + if (MyUser(sptr)) origin = sptr->name; /* Make sure origin is not spoofed */ if ((acptr = find_server_quick(destination)) && (acptr != &me)) sendto_one(acptr, NULL, ":%s PING %s :%s", sptr->name, origin, destination); @@ -172,7 +172,7 @@ CMD_FUNC(m_pong) ClearPingWarning(cptr); /* Remote pongs for clients? uhh... */ - if (MyClient(sptr) || !IsRegistered(sptr)) + if (MyUser(sptr) || !IsRegistered(sptr)) destination = NULL; if (!BadPtr(destination) && mycmp(destination, me.name) != 0) diff --git a/src/modules/quit.c b/src/modules/quit.c index b2999eda8..c76b9a6fd 100644 --- a/src/modules/quit.c +++ b/src/modules/quit.c @@ -65,7 +65,7 @@ CMD_FUNC(m_quit) if (parv[1] && (strlen(comment) > iConf.quit_length)) comment[iConf.quit_length] = '\0'; - if (!IsServer(cptr) && IsPerson(sptr)) + if (!IsServer(cptr) && IsUser(sptr)) { int n; Hook *tmphook; @@ -89,7 +89,7 @@ CMD_FUNC(m_quit) comment = sptr->name; } - if (iConf.part_instead_of_quit_on_comment_change && MyClient(sptr)) + if (iConf.part_instead_of_quit_on_comment_change && MyUser(sptr)) { Membership *lp; char *newcomment; diff --git a/src/modules/reputation.c b/src/modules/reputation.c index af0900e97..f55b61ec5 100644 --- a/src/modules/reputation.c +++ b/src/modules/reputation.c @@ -532,7 +532,7 @@ EVENT(add_scores) list_for_each_entry(acptr, &client_list, client_node) { - if (!IsPerson(acptr)) + if (!IsUser(acptr)) continue; /* skip servers, unknowns, etc.. */ ip = acptr->ip; @@ -838,7 +838,7 @@ CMD_FUNC(reputation_server_cmd) CMD_FUNC(reputation_cmd) { - if (MyClient(sptr)) + if (MyUser(sptr)) return reputation_user_cmd(cptr, sptr, recv_mtags, parc, parv); if (IsServer(sptr)) diff --git a/src/modules/restrict-commands.c b/src/modules/restrict-commands.c index 302e7daed..4de8c8c19 100644 --- a/src/modules/restrict-commands.c +++ b/src/modules/restrict-commands.c @@ -324,7 +324,7 @@ char *rcmd_hook_wrapper(Client *sptr, char *text, int notice, char *display, cha RestrictedCommand *rcmd; // Let's allow non-local users, opers and U:Lines early =] - if (!MyClient(sptr) || !sptr->local || IsOper(sptr) || IsULine(sptr)) + if (!MyUser(sptr) || !sptr->local || IsOper(sptr) || IsULine(sptr)) return text; rcmd = find_restrictions_byconftag(conftag); @@ -350,7 +350,7 @@ CMD_OVERRIDE_FUNC(rcmd_override) { RestrictedCommand *rcmd; - if (!MyClient(sptr) || !sptr->local || IsOper(sptr) || IsULine(sptr)) + if (!MyUser(sptr) || !sptr->local || IsOper(sptr) || IsULine(sptr)) return CallCommandOverride(ovr, cptr, sptr, recv_mtags, parc, parv); rcmd = find_restrictions_bycmd(ovr->command->cmd); diff --git a/src/modules/rmtkl.c b/src/modules/rmtkl.c index 879ec8a27..c14117897 100644 --- a/src/modules/rmtkl.c +++ b/src/modules/rmtkl.c @@ -106,7 +106,7 @@ MOD_UNLOAD(rmtkl) static int dump_str(Client *sptr, char **buf) { - if (!MyClient(sptr)) + if (!MyUser(sptr)) return 0; // Using sendto_one() instead of sendnumericfmt() because the latter strips indentation and stuff ;] diff --git a/src/modules/sajoin.c b/src/modules/sajoin.c index 1848cc78b..1a90c5ea1 100644 --- a/src/modules/sajoin.c +++ b/src/modules/sajoin.c @@ -90,7 +90,7 @@ CMD_FUNC(m_sajoin) } /* If it's not for our client, then simply pass on the message... */ - if (!MyClient(acptr)) + if (!MyUser(acptr)) { sendto_one(acptr, NULL, ":%s SAJOIN %s %s", sptr->name, parv[1], parv[2]); diff --git a/src/modules/sapart.c b/src/modules/sapart.c index 46b27d3a6..c628e8552 100644 --- a/src/modules/sapart.c +++ b/src/modules/sapart.c @@ -94,7 +94,7 @@ CMD_FUNC(m_sapart) return 0; } - if (MyClient(acptr)) + if (MyUser(acptr)) { /* Now works like m_join */ *jbuf = 0; diff --git a/src/modules/sasl.c b/src/modules/sasl.c index 0355170bf..f039d19db 100644 --- a/src/modules/sasl.c +++ b/src/modules/sasl.c @@ -109,7 +109,7 @@ static const char *encode_puid(Client *client) { static char buf[HOSTLEN + 20]; - if (MyClient(client)) + if (MyUser(client)) return client->id; /* create a cookie if necessary (and in case getrandom16 returns 0, then run again) */ @@ -130,7 +130,7 @@ static const char *encode_puid(Client *client) */ CMD_FUNC(m_svslogin) { - if (!SASL_SERVER || MyClient(sptr) || (parc < 3) || !parv[3]) + if (!SASL_SERVER || MyUser(sptr) || (parc < 3) || !parv[3]) return 0; if (!strcasecmp(parv[1], me.name)) @@ -177,7 +177,7 @@ CMD_FUNC(m_svslogin) */ CMD_FUNC(m_sasl) { - if (!SASL_SERVER || MyClient(sptr) || (parc < 4) || !parv[4]) + if (!SASL_SERVER || MyUser(sptr) || (parc < 4) || !parv[4]) return 0; if (!strcasecmp(parv[1], me.name)) diff --git a/src/modules/server.c b/src/modules/server.c index d6c4d7f6c..7aa6f7391 100644 --- a/src/modules/server.c +++ b/src/modules/server.c @@ -485,7 +485,7 @@ CMD_FUNC(m_server) /* Ignore it */ - if (IsPerson(sptr)) + if (IsUser(sptr)) { sendnumeric(cptr, ERR_ALREADYREGISTRED); sendnotice(cptr, @@ -1053,7 +1053,7 @@ int m_server_synch(Client *cptr, ConfigItem_link *aconf) /* acptr->direction == acptr for acptr == cptr */ if (acptr->direction == cptr) continue; - if (IsPerson(acptr)) + if (IsUser(acptr)) { introduce_user(cptr, acptr); if (!SupportSJOIN(cptr)) diff --git a/src/modules/sethost.c b/src/modules/sethost.c index 884343c22..31bde2dca 100644 --- a/src/modules/sethost.c +++ b/src/modules/sethost.c @@ -63,7 +63,7 @@ CMD_FUNC(m_sethost) { char *vhost; - if (MyClient(sptr) && !ValidatePermissionsForPath("self:set:host",sptr,NULL,NULL,NULL)) + if (MyUser(sptr) && !ValidatePermissionsForPath("self:set:host",sptr,NULL,NULL,NULL)) { sendnumeric(sptr, ERR_NOPRIVILEGES); return 0; @@ -99,7 +99,7 @@ CMD_FUNC(m_sethost) return 0; } - if (MyClient(sptr) && !strcmp(GetHost(sptr), vhost)) + if (MyUser(sptr) && !strcmp(GetHost(sptr), vhost)) { sendnotice(sptr, "/SetHost Error: requested host is same as current host."); return 0; @@ -110,7 +110,7 @@ CMD_FUNC(m_sethost) switch (UHOST_ALLOWED) { case UHALLOW_NEVER: - if (MyClient(sptr)) + if (MyUser(sptr)) { sendnotice(sptr, "*** /SetHost is disabled"); return 0; @@ -119,7 +119,7 @@ CMD_FUNC(m_sethost) case UHALLOW_ALWAYS: break; case UHALLOW_NOCHANS: - if (MyClient(sptr) && sptr->user->joined) + if (MyUser(sptr) && sptr->user->joined) { sendnotice(sptr, "*** /SetHost can not be used while you are on a channel"); return 0; diff --git a/src/modules/setident.c b/src/modules/setident.c index caf6619dc..2b3857979 100644 --- a/src/modules/setident.c +++ b/src/modules/setident.c @@ -78,14 +78,14 @@ CMD_FUNC(m_setident) case UHALLOW_ALWAYS: break; case UHALLOW_NEVER: - if (MyClient(sptr)) + if (MyUser(sptr)) { sendnotice(sptr, "*** /SETIDENT is disabled"); return 0; } break; case UHALLOW_NOCHANS: - if (MyClient(sptr) && sptr->user->joined) + if (MyUser(sptr) && sptr->user->joined) { sendnotice(sptr, "*** /SETIDENT cannot be used while you are on a channel"); return 0; diff --git a/src/modules/setname.c b/src/modules/setname.c index fec1208a1..34377969d 100644 --- a/src/modules/setname.c +++ b/src/modules/setname.c @@ -82,7 +82,7 @@ CMD_FUNC(m_setname) return 0; } - if (MyClient(sptr)) + if (MyUser(sptr)) { /* set temp info for spamfilter check*/ strcpy(tmpinfo, sptr->info); diff --git a/src/modules/silence.c b/src/modules/silence.c index f249403fd..78801d413 100644 --- a/src/modules/silence.c +++ b/src/modules/silence.c @@ -69,7 +69,7 @@ CMD_FUNC(m_silence) acptr = sptr; - if (MyClient(sptr)) + if (MyUser(sptr)) { if (parc < 2 || *parv[1] == '\0' || (acptr = find_person(parv[1], NULL))) @@ -121,7 +121,7 @@ CMD_FUNC(m_silence) else { (void)add_silence(sptr, parv[2], 1); - if (!MyClient(acptr)) + if (!MyUser(acptr)) sendto_one(acptr, NULL, ":%s SILENCE %s :%s", sptr->name, parv[1], parv[2]); } diff --git a/src/modules/sinfo.c b/src/modules/sinfo.c index b37f1ff2b..aa2ba4959 100644 --- a/src/modules/sinfo.c +++ b/src/modules/sinfo.c @@ -161,7 +161,7 @@ CMD_FUNC(m_sinfo) { if (IsServer(sptr)) return sinfo_server(cptr, sptr, parc, parv); - else if (MyClient(sptr)) + else if (MyUser(sptr)) return sinfo_user(cptr, sptr, parc, parv); return 0; } diff --git a/src/modules/sjoin.c b/src/modules/sjoin.c index 0db1e2e53..e0d8af844 100644 --- a/src/modules/sjoin.c +++ b/src/modules/sjoin.c @@ -159,7 +159,7 @@ CMD_FUNC(m_sjoin) long modeflags; char queue_s=0, queue_c=0; /* oh this is soooooo ugly :p */ - if (IsRegisteredUser(sptr) || parc < 4 || !IsServer(sptr)) + if (IsUser(sptr) || parc < 4 || !IsServer(sptr)) return 0; if (!IsChannelName(parv[2])) diff --git a/src/modules/squit.c b/src/modules/squit.c index 7cbd454ff..a5b8bf837 100644 --- a/src/modules/squit.c +++ b/src/modules/squit.c @@ -123,7 +123,7 @@ CMD_FUNC(m_squit) sendnumeric(sptr, ERR_NOSUCHSERVER, server); return 0; } - if (MyClient(sptr) && ((!ValidatePermissionsForPath("route:global",sptr,NULL,NULL,NULL) && !MyConnect(acptr)) || + if (MyUser(sptr) && ((!ValidatePermissionsForPath("route:global",sptr,NULL,NULL,NULL) && !MyConnect(acptr)) || (!ValidatePermissionsForPath("route:local",sptr,NULL,NULL,NULL) && MyConnect(acptr)))) { sendnumeric(sptr, ERR_NOPRIVILEGES); @@ -132,7 +132,7 @@ CMD_FUNC(m_squit) /* ** Notify all opers, if my local link is remotely squitted */ - if (MyConnect(acptr) && !MyClient(cptr)) + if (MyConnect(acptr) && !MyUser(cptr)) { sendto_umode_global(UMODE_OPER, "Received SQUIT %s from %s (%s)", acptr->name, get_client_name(sptr, FALSE), comment); diff --git a/src/modules/staff.c b/src/modules/staff.c index 49447208f..e9db6b08b 100644 --- a/src/modules/staff.c +++ b/src/modules/staff.c @@ -367,7 +367,7 @@ CMD_FUNC(m_staff) MOTDFile *temp; MOTDLine *aLine; - if (!IsPerson(sptr)) + if (!IsUser(sptr)) return -1; if (hunt_server(cptr, sptr, recv_mtags, ":%s STAFF", 1, parc, parv) != HUNTED_ISME) diff --git a/src/modules/stats.c b/src/modules/stats.c index 7b8e14d44..4a18a4357 100644 --- a/src/modules/stats.c +++ b/src/modules/stats.c @@ -623,7 +623,7 @@ int stats_traffic(Client *sptr, char *para) sp->is_sbr &= 0x3ff; } } - else if (IsRegisteredUser(acptr)) + else if (IsUser(acptr)) { sp->is_cbs += acptr->local->sendB; sp->is_cbr += acptr->local->receiveB; @@ -1250,7 +1250,7 @@ int stats_linkinfoint(Client *sptr, char *para, int all) else para = me.name; sendnumericfmt(sptr, RPL_STATSLINKINFO, "%s", Sformat); - if (!MyClient(sptr)) + if (!MyUser(sptr)) { remote = 1; wilds = 0; diff --git a/src/modules/svsjoin.c b/src/modules/svsjoin.c index aaeb34a69..1d0d954ce 100644 --- a/src/modules/svsjoin.c +++ b/src/modules/svsjoin.c @@ -69,7 +69,7 @@ CMD_FUNC(m_svsjoin) if ((parc < 3) || !(acptr = find_person(parv[1], NULL))) return 0; - if (MyClient(acptr)) + if (MyUser(acptr)) { parv[0] = acptr->name; parv[1] = parv[2]; diff --git a/src/modules/svsmode.c b/src/modules/svsmode.c index 8d47c816a..7e6814003 100644 --- a/src/modules/svsmode.c +++ b/src/modules/svsmode.c @@ -360,7 +360,7 @@ int do_svsmode(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, cha case 'o': if ((what == MODE_ADD) && !(acptr->umodes & UMODE_OPER)) { - if (!IsOper(acptr) && MyClient(acptr)) + if (!IsOper(acptr) && MyUser(acptr)) list_add(&acptr->special_node, &oper_list); ircstats.operators++; @@ -375,7 +375,7 @@ int do_svsmode(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, cha ircstats.operators--; } - if (MyClient(acptr) && !list_empty(&acptr->special_node)) + if (MyUser(acptr) && !list_empty(&acptr->special_node)) list_del(&acptr->special_node); /* User is no longer oper (after the goto below, anyway)... @@ -448,7 +448,7 @@ int do_svsmode(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, cha * in which case we would have needlessly announced it. Ok I didn't test it but that's * the idea behind it :P. -- Syzop */ - if (MyClient(acptr) && !strcasecmp(acptr->user->virthost, acptr->user->cloakedhost)) + if (MyUser(acptr) && !strcasecmp(acptr->user->virthost, acptr->user->cloakedhost)) sendto_server(NULL, PROTO_VHP, 0, NULL, ":%s SETHOST :%s", acptr->name, acptr->user->virthost); } @@ -469,7 +469,7 @@ int do_svsmode(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, cha /* Make the change effective: */ safestrdup(acptr->user->virthost, acptr->user->cloakedhost); /* And broadcast the change to VHP servers */ - if (MyClient(acptr)) + if (MyUser(acptr)) sendto_server(NULL, PROTO_VHP, 0, NULL, ":%s SETHOST :%s", acptr->name, acptr->user->virthost); } @@ -516,7 +516,7 @@ int do_svsmode(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, cha { char buf[BUFSIZE]; send_umode(NULL, acptr, setflags, ALL_UMODES, buf); - if (MyClient(acptr) && buf[0] && buf[1]) + if (MyUser(acptr) && buf[0] && buf[1]) sendto_one(acptr, NULL, ":%s MODE %s :%s", sptr->name, acptr->name, buf); } diff --git a/src/modules/svsnolag.c b/src/modules/svsnolag.c index 7a1a0cb98..fdf7e1e87 100644 --- a/src/modules/svsnolag.c +++ b/src/modules/svsnolag.c @@ -68,7 +68,7 @@ int do_svsnolag(Client *cptr, Client *sptr, int parc, char *parv[], int show_cha if (!(acptr = find_person(parv[2], NULL))) return 0; - if (!MyClient(acptr)) + if (!MyUser(acptr)) { sendto_one(acptr, NULL, ":%s %s %s %s", sptr->name, cmd, parv[1], parv[2]); return 0; diff --git a/src/modules/svsnoop.c b/src/modules/svsnoop.c index bacd27fc9..5367bce59 100644 --- a/src/modules/svsnoop.c +++ b/src/modules/svsnoop.c @@ -70,7 +70,7 @@ CMD_FUNC(m_svsnoop) sendto_ops("This server has been placed in NOOP mode"); list_for_each_entry(acptr, &client_list, client_node) { - if (MyClient(acptr) && IsOper(acptr)) + if (MyUser(acptr) && IsOper(acptr)) { if (IsOper(acptr)) { diff --git a/src/modules/svspart.c b/src/modules/svspart.c index 670c43d45..22659c10d 100644 --- a/src/modules/svspart.c +++ b/src/modules/svspart.c @@ -69,7 +69,7 @@ CMD_FUNC(m_svspart) if (parc < 3 || !(acptr = find_person(parv[1], NULL))) return 0; - if (MyClient(acptr)) + if (MyUser(acptr)) { parv[0] = acptr->name; parv[1] = parv[2]; diff --git a/src/modules/svssilence.c b/src/modules/svssilence.c index f539cfc40..b74d72f6a 100644 --- a/src/modules/svssilence.c +++ b/src/modules/svssilence.c @@ -76,7 +76,7 @@ CMD_FUNC(m_svssilence) sendto_server(sptr, 0, 0, NULL, ":%s SVSSILENCE %s :%s", sptr->name, parv[1], parv[2]); - mine = MyClient(acptr) ? 1 : 0; + mine = MyUser(acptr) ? 1 : 0; for (p = strtok(parv[2], " "); p; p = strtok(NULL, " ")) { diff --git a/src/modules/svssno.c b/src/modules/svssno.c index 395564c69..6cae3ff52 100644 --- a/src/modules/svssno.c +++ b/src/modules/svssno.c @@ -86,7 +86,7 @@ int do_svssno(Client *cptr, Client *sptr, int parc, char *parv[], int show_chan return 0; } - if (MyClient(acptr)) + if (MyUser(acptr)) { if (parc == 2) acptr->user->snomask = 0; diff --git a/src/modules/svswatch.c b/src/modules/svswatch.c index 3e62ac004..9c2d5e4b5 100644 --- a/src/modules/svswatch.c +++ b/src/modules/svswatch.c @@ -67,7 +67,7 @@ CMD_FUNC(m_svswatch) if (parc < 3 || BadPtr(parv[2]) || !(acptr = find_person(parv[1], NULL))) return 0; - if (MyClient(acptr)) + if (MyUser(acptr)) { parv[0] = acptr->name; parv[1] = parv[2]; diff --git a/src/modules/tkl.c b/src/modules/tkl.c index 76e47ac2c..002c449b6 100644 --- a/src/modules/tkl.c +++ b/src/modules/tkl.c @@ -948,7 +948,7 @@ CMD_FUNC(m_tempshun) char *name; int remove = 0; - if (MyClient(sptr) && (!ValidatePermissionsForPath("server-ban:shun:temporary",sptr,NULL,NULL,NULL))) + if (MyUser(sptr) && (!ValidatePermissionsForPath("server-ban:shun:temporary",sptr,NULL,NULL,NULL))) { sendnumeric(sptr, ERR_NOPRIVILEGES); return 0; @@ -973,7 +973,7 @@ CMD_FUNC(m_tempshun) sendnumeric(sptr, ERR_NOSUCHNICK, name); return 0; } - if (!MyClient(acptr)) + if (!MyUser(acptr)) { sendto_one(acptr->direction, NULL, ":%s TEMPSHUN %s :%s", sptr->name, parv[1], comment); @@ -2407,7 +2407,7 @@ void _tkl_check_local_remove_shun(TKL *tmp) for (i = 0; i <= 5; i++) { list_for_each_entry(acptr, &lclient_list, lclient_node) - if (MyClient(acptr) && IsShunned(acptr)) + if (MyUser(acptr) && IsShunned(acptr)) { chost = acptr->local->sockhost; cname = acptr->user->username; @@ -2815,7 +2815,7 @@ int spamfilter_check_users(TKL *tkl) list_for_each_entry_reverse(acptr, &lclient_list, lclient_node) { - if (MyClient(acptr)) + if (MyUser(acptr)) { spamfilter_build_user_string(spamfilter_user, acptr->name, acptr); if (!unreal_match(tkl->ptr.spamfilter->match, spamfilter_user)) @@ -2849,7 +2849,7 @@ int spamfilter_check_all_users(Client *from, TKL *tkl) list_for_each_entry(acptr, &client_list, client_node) { - if (IsPerson(acptr)) + if (IsUser(acptr)) { spamfilter_build_user_string(spamfilter_user, acptr->name, acptr); if (!unreal_match(tkl->ptr.spamfilter->match, spamfilter_user)) @@ -4309,7 +4309,7 @@ int _run_spamfilter(Client *sptr, char *str_in, int target, char *destination, i else str = (char *)StripControlCodes(str_in); - /* (note: using sptr->user check here instead of IsPerson() + /* (note: using sptr->user check here instead of IsUser() * due to SPAMF_USER where user isn't marked as client/person yet. */ if (!sptr->user || ValidatePermissionsForPath("immune:server-ban:spamfilter",sptr,NULL,NULL,NULL) || IsULine(sptr)) @@ -4469,7 +4469,7 @@ int _run_spamfilter(Client *sptr, char *str_in, int target, char *destination, i /* There's a race condition for SPAMF_USER, so 'rettk' is used for SPAMF_USER * when a user is currently connecting and filters are checked: */ - if (!IsRegisteredUser(sptr)) + if (!IsUser(sptr)) { if (rettkl) *rettkl = tkl; @@ -4570,7 +4570,7 @@ int _match_user(char *rmask, Client *acptr, int options) /**** Check visible host ****/ if (options & MATCH_CHECK_VISIBLE_HOST) { - char *hostname = acptr->user ? GetHost(acptr) : (MyClient(acptr) ? acptr->local->sockhost : NULL); + char *hostname = acptr->user ? GetHost(acptr) : (MyUser(acptr) ? acptr->local->sockhost : NULL); if (hostname && match_simple(hmask, hostname)) return 1; /* MATCH: visible host */ } @@ -4648,7 +4648,7 @@ int _match_user(char *rmask, Client *acptr, int options) /**** Check real host ****/ if (options & MATCH_CHECK_REAL_HOST) { - char *hostname = acptr->user ? acptr->user->realhost : (MyClient(acptr) ? acptr->local->sockhost : NULL); + char *hostname = acptr->user ? acptr->user->realhost : (MyUser(acptr) ? acptr->local->sockhost : NULL); if (hostname && match_simple(hmask, hostname)) return 1; /* MATCH: hostname match */ } diff --git a/src/modules/topic.c b/src/modules/topic.c index 80fe857ad..38519bec5 100644 --- a/src/modules/topic.c +++ b/src/modules/topic.c @@ -189,7 +189,7 @@ CMD_FUNC(m_topic) } /* Topic change. Either locally (check permissions!) or remote, check permissions: */ - if (IsPerson(sptr)) + if (IsUser(sptr)) { char *newtopic = NULL; @@ -197,7 +197,7 @@ CMD_FUNC(m_topic) if ((chptr->mode.mode & MODE_TOPICLIMIT) && !is_skochanop(sptr, chptr) && !IsULine(sptr) && !IsServer(sptr)) { - if (MyClient(sptr) && !ValidatePermissionsForPath("channel:override:topic", sptr, NULL, chptr, NULL)) + if (MyUser(sptr) && !ValidatePermissionsForPath("channel:override:topic", sptr, NULL, chptr, NULL)) { sendnumeric(sptr, ERR_CHANOPRIVSNEEDED, chptr->chname); return 0; @@ -212,7 +212,7 @@ CMD_FUNC(m_topic) { char buf[512]; - if (MyClient(sptr) && !ValidatePermissionsForPath("channel:override:topic", sptr, NULL, chptr, NULL)) + if (MyUser(sptr) && !ValidatePermissionsForPath("channel:override:topic", sptr, NULL, chptr, NULL)) { ircsnprintf(buf, sizeof(buf), "You cannot change the topic on %s while being banned", chptr->chname); sendnumeric(sptr, ERR_CANNOTDOCOMMAND, "TOPIC", buf); @@ -220,7 +220,7 @@ CMD_FUNC(m_topic) } topicoverride(sptr, chptr, topic); } - if (MyClient(sptr) && newtopic) + if (MyUser(sptr) && newtopic) topic = newtopic; /* process is_banned() changes of topic (eg: text replacement), but only for local clients */ /* -t, +m, and not +vhoaq */ @@ -228,7 +228,7 @@ CMD_FUNC(m_topic) { char buf[512]; - if (MyClient(sptr) && ValidatePermissionsForPath("channel:override:topic", sptr, NULL, chptr, NULL)) + if (MyUser(sptr) && ValidatePermissionsForPath("channel:override:topic", sptr, NULL, chptr, NULL)) { topicoverride(sptr, chptr, topic); } else { @@ -240,7 +240,7 @@ CMD_FUNC(m_topic) } /* For local users, run spamfilters and hooks.. */ - if (MyClient(sptr)) + if (MyUser(sptr)) { Hook *tmphook; int n; diff --git a/src/modules/trace.c b/src/modules/trace.c index b996cf06d..f3a8aea48 100644 --- a/src/modules/trace.c +++ b/src/modules/trace.c @@ -126,7 +126,7 @@ CMD_FUNC(m_trace) { if (acptr->direction->local->fd < 0) continue; - if (IsPerson(acptr)) + if (IsUser(acptr)) link_u[acptr->direction->local->fd]++; else if (IsServer(acptr)) link_s[acptr->direction->local->fd]++; @@ -169,7 +169,7 @@ CMD_FUNC(m_trace) cnt++; break; - case CLIENT_STATUS_CLIENT: + case CLIENT_STATUS_USER: /* Only opers see users if there is a wildcard * but anyone can see all the opers. */ diff --git a/src/modules/tsctl.c b/src/modules/tsctl.c index a6be4fe52..8c6fb2f58 100644 --- a/src/modules/tsctl.c +++ b/src/modules/tsctl.c @@ -56,7 +56,7 @@ CMD_FUNC(m_tsctl) return 0; } - if (MyClient(sptr) && (!parv[1] || strcasecmp(parv[1], "alltime"))) + if (MyUser(sptr) && (!parv[1] || strcasecmp(parv[1], "alltime"))) { sendnotice(sptr, "/TSCTL now shows the time on all servers. You can now longer MODIFY the time."); parv[1] = "alltime"; diff --git a/src/modules/undccdeny.c b/src/modules/undccdeny.c index 81a3735b8..91a3694b2 100644 --- a/src/modules/undccdeny.c +++ b/src/modules/undccdeny.c @@ -58,7 +58,7 @@ MOD_UNLOAD(undccdeny) CMD_FUNC(m_undccdeny) { ConfigItem_deny_dcc *p; - if (!MyClient(sptr)) + if (!MyUser(sptr)) return 0; if (!ValidatePermissionsForPath("server-ban:dccdeny",sptr,NULL,NULL,NULL)) diff --git a/src/modules/userip.c b/src/modules/userip.c index 211b0cfe7..2d401bde2 100644 --- a/src/modules/userip.c +++ b/src/modules/userip.c @@ -70,7 +70,7 @@ CMD_FUNC(m_userip) char response[5][NICKLEN * 2 + CHANNELLEN + USERLEN + HOSTLEN + 30]; int i; /* loop counter */ - if (!MyClient(sptr)) + if (!MyUser(sptr)) return -1; if (parc < 2) diff --git a/src/modules/usermodes/bot.c b/src/modules/usermodes/bot.c index fe94a35d6..183f582f1 100644 --- a/src/modules/usermodes/bot.c +++ b/src/modules/usermodes/bot.c @@ -84,7 +84,7 @@ int bot_who_status(Client *sptr, Client *acptr, Channel *chptr, Member *cm, char int bot_umode_change(Client *sptr, long oldmode, long newmode) { - if ((newmode & UMODE_BOT) && !(oldmode & UMODE_BOT) && MyClient(sptr)) + if ((newmode & UMODE_BOT) && !(oldmode & UMODE_BOT) && MyUser(sptr)) { /* now +B */ char *parv[2]; diff --git a/src/modules/usermodes/censor.c b/src/modules/usermodes/censor.c index 52e5b19b9..4abc15660 100644 --- a/src/modules/usermodes/censor.c +++ b/src/modules/usermodes/censor.c @@ -241,7 +241,7 @@ char *censor_pre_usermsg(Client *sptr, Client *target, char *text, int notice) { int blocked; - if (MyClient(sptr) && IsCensored(target)) + if (MyUser(sptr) && IsCensored(target)) { text = stripbadwords_message(text, &blocked); if (blocked) diff --git a/src/modules/usermodes/noctcp.c b/src/modules/usermodes/noctcp.c index 1253ce445..199d9104f 100644 --- a/src/modules/usermodes/noctcp.c +++ b/src/modules/usermodes/noctcp.c @@ -76,7 +76,7 @@ static int IsACTCP(char *s) char *noctcp_preusermsg(Client *sptr, Client *acptr, char *text, int notice) { - if (MyClient(sptr) && !notice && IsNoCTCP(acptr) && !IsOper(sptr) && IsACTCP(text)) + if (MyUser(sptr) && !notice && IsNoCTCP(acptr) && !IsOper(sptr) && IsACTCP(text)) { sendnumeric(sptr, ERR_NOCTCP, acptr->name); return NULL; diff --git a/src/modules/usermodes/nokick.c b/src/modules/usermodes/nokick.c index 6edf3d855..e261da4b2 100644 --- a/src/modules/usermodes/nokick.c +++ b/src/modules/usermodes/nokick.c @@ -68,7 +68,7 @@ int nokick_can_kick(Client *sptr, Client *target, Channel *chptr, char *comment, { static char errmsg[NICKLEN+256]; - if (IsNokick(target) && !IsULine(sptr) && MyClient(sptr) && !ValidatePermissionsForPath("channel:override:kick:nokick",sptr,target,chptr,NULL)) + if (IsNokick(target) && !IsULine(sptr) && MyUser(sptr) && !ValidatePermissionsForPath("channel:override:kick:nokick",sptr,target,chptr,NULL)) { ircsnprintf(errmsg, sizeof(errmsg), ":%s %d %s %s :%s", me.name, ERR_CANNOTDOCOMMAND, sptr->name, "KICK", diff --git a/src/modules/usermodes/servicebot.c b/src/modules/usermodes/servicebot.c index 63a2871a5..b81150584 100644 --- a/src/modules/usermodes/servicebot.c +++ b/src/modules/usermodes/servicebot.c @@ -79,7 +79,7 @@ int servicebot_can_kick(Client *sptr, Client *target, Channel *chptr, char *comm { static char errmsg[NICKLEN+256]; - if (MyClient(sptr) && !IsULine(sptr) && IsServiceBot(target)) + if (MyUser(sptr) && !IsULine(sptr) && IsServiceBot(target)) { char errmsg2[NICKLEN+32]; snprintf(errmsg2, sizeof(errmsg2), "%s is a Service Bot", target->name); @@ -100,7 +100,7 @@ int servicebot_mode_deop(Client *sptr, Client *target, Channel *chptr, { static char errmsg[NICKLEN+256]; - if (IsServiceBot(target) && MyClient(sptr) && !ValidatePermissionsForPath("services:servicebot:deop",sptr,target,chptr,NULL) && (what == MODE_DEL)) + if (IsServiceBot(target) && MyUser(sptr) && !ValidatePermissionsForPath("services:servicebot:deop",sptr,target,chptr,NULL) && (what == MODE_DEL)) { snprintf(errmsg, sizeof(errmsg), ":%s %d %s %c :%s is a Service Bot", me.name, ERR_CANNOTCHANGECHANMODE, sptr->name, (char)modechar, target->name); diff --git a/src/modules/vhost.c b/src/modules/vhost.c index dd6d1560a..88e34c3c4 100644 --- a/src/modules/vhost.c +++ b/src/modules/vhost.c @@ -62,7 +62,7 @@ CMD_FUNC(m_vhost) int i; char olduser[USERLEN+1]; - if (!MyClient(sptr)) + if (!MyUser(sptr)) return 0; if ((parc < 2) || BadPtr(parv[1])) @@ -116,7 +116,7 @@ CMD_FUNC(m_vhost) switch (UHOST_ALLOWED) { case UHALLOW_NEVER: - if (MyClient(sptr)) + if (MyUser(sptr)) { sendnotice(sptr, "*** /vhost is disabled"); return 0; @@ -125,7 +125,7 @@ CMD_FUNC(m_vhost) case UHALLOW_ALWAYS: break; case UHALLOW_NOCHANS: - if (MyClient(sptr) && sptr->user->joined) + if (MyUser(sptr) && sptr->user->joined) { sendnotice(sptr, "*** /vhost can not be used while you are on a channel"); return 0; diff --git a/src/modules/watch.c b/src/modules/watch.c index 9e9b5d2ca..0d961d65d 100644 --- a/src/modules/watch.c +++ b/src/modules/watch.c @@ -99,7 +99,7 @@ CMD_FUNC(m_watch) int awaynotify = 0; int did_l=0, did_s=0; - if (!MyClient(sptr)) + if (!MyUser(sptr)) return 0; if (parc < 2) diff --git a/src/modules/who_old.c b/src/modules/who_old.c index be66809eb..283466e98 100644 --- a/src/modules/who_old.c +++ b/src/modules/who_old.c @@ -122,7 +122,7 @@ CMD_FUNC(m_who) char star[] = "*"; int i = 0; - if (!MyClient(sptr)) + if (!MyUser(sptr)) return 0; who_flags = 0; @@ -395,7 +395,7 @@ Hook *h; char has_common_chan = 0; do { /* can only see people */ - if (!IsPerson(acptr)) + if (!IsUser(acptr)) return WHO_CANTSEE; /* can only see opers if thats what they want */ @@ -486,7 +486,7 @@ char has_common_chan = 0; { int port; - if (!MyClient(acptr)) + if (!MyUser(acptr)) return WHO_CANTSEE; port = acptr->local->listener->port; @@ -694,7 +694,7 @@ int oper = IsOper(sptr); char *channel; int flg; - if (!IsPerson(acptr)) + if (!IsUser(acptr)) continue; if (!oper) { /* non-opers can only search on nick here */ diff --git a/src/modules/whois.c b/src/modules/whois.c index 9e7d6e9c2..94b206944 100644 --- a/src/modules/whois.c +++ b/src/modules/whois.c @@ -91,7 +91,7 @@ CMD_FUNC(m_whois) { unsigned char invis, showchannel, member, wilds, hideoper; /* <- these are all boolean-alike */ - if (MyClient(sptr) && (++ntargets > maxtargets)) + if (MyUser(sptr) && (++ntargets > maxtargets)) { sendnumeric(sptr, ERR_TOOMANYTARGETS, nick, maxtargets, "WHOIS"); break; @@ -118,7 +118,7 @@ CMD_FUNC(m_whois) * the target user(s) are on; */ - if (!IsPerson(acptr)) + if (!IsUser(acptr)) continue; name = (!*acptr->name) ? "?" : acptr->name; @@ -235,7 +235,7 @@ CMD_FUNC(m_whois) } access = get_access(acptr, chptr); - if (!MyClient(sptr) || !HasCapability(sptr, "multi-prefix")) + if (!MyUser(sptr) || !HasCapability(sptr, "multi-prefix")) { #ifdef PREFIX_AQ if (access & CHFL_CHANOWNER) @@ -295,7 +295,7 @@ CMD_FUNC(m_whois) strlcat(buf, "a Local IRC Operator", sizeof buf); if (buf[0]) { - if (IsOper(sptr) && MyClient(acptr)) + if (IsOper(sptr) && MyUser(acptr)) { char *operclass = "???"; ConfigItem_oper *oper = Find_oper(acptr->user->operlogin); diff --git a/src/modules/whox.c b/src/modules/whox.c index 2e8e9e7d4..1b4249fd3 100644 --- a/src/modules/whox.c +++ b/src/modules/whox.c @@ -144,7 +144,7 @@ CMD_FUNC(m_whox) memset(&fmt, 0, sizeof(fmt)); - if (!MyClient(sptr)) + if (!MyUser(sptr)) return 0; if ((parc < 2)) @@ -527,7 +527,7 @@ static void who_global(Client *sptr, char *mask, int operspy, struct who_format */ list_for_each_entry(acptr, &client_list, client_node) { - if(!IsPerson(acptr)) + if(!IsUser(acptr)) continue; if(IsInvisible(acptr) && !operspy) @@ -787,7 +787,7 @@ static void do_who(Client *sptr, Client *acptr, Channel *chptr, struct who_forma if (HasField(fmt, FIELD_HOP)) append_format(str, sizeof str, &pos, " %d", hide ? 0 : acptr->hopcount); if (HasField(fmt, FIELD_IDLE)) - append_format(str, sizeof str, &pos, " %d", (int)(MyClient(acptr) && + append_format(str, sizeof str, &pos, " %d", (int)(MyUser(acptr) && (!(acptr->umodes & UMODE_HIDLE) || IsOper(sptr) || (sptr == acptr)) ? TStime() - acptr->local->last : 0)); if (HasField(fmt, FIELD_ACCOUNT)) diff --git a/src/numeric.c b/src/numeric.c index aa34db489..5bbfc5b0e 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -47,7 +47,7 @@ int do_numeric(int numeric, Client *cptr, Client *sptr, MessageTag *recv_mtags, char *nick, *p; int i; - if (!IsServer(sptr) && !IsPerson(sptr) && IsHandshake(cptr) && sptr->serv && !IsServerSent(sptr)) + if (!IsServer(sptr) && !IsUser(sptr) && IsHandshake(cptr) && sptr->serv && !IsServerSent(sptr)) { /* This is an outgoing server connect that is currently not yet IsServer() but in 'unknown' state. * We need to handle a few responses here. @@ -149,7 +149,7 @@ int do_numeric(int numeric, Client *cptr, Client *sptr, MessageTag *recv_mtags, ** with numerics which can happen with nick collisions. ** - Avalon */ - if (!IsMe(acptr) && IsPerson(acptr)) + if (!IsMe(acptr) && IsUser(acptr)) { /* Added for .U3.2. drop remote 'You are not on ** that channel', we should be synced anyway, diff --git a/src/operclass.c b/src/operclass.c index eba73549c..d47b04ab9 100644 --- a/src/operclass.c +++ b/src/operclass.c @@ -291,7 +291,7 @@ OperPermission ValidatePermissionsForPath(char* path, Client *sptr, Client *vict return OPER_DENY; /* Trust Servers, U-Lines and remote opers */ - if (IsServer(sptr) || IsULine(sptr) || (IsOper(sptr) && !MyClient(sptr))) + if (IsServer(sptr) || IsULine(sptr) || (IsOper(sptr) && !MyUser(sptr))) return OPER_ALLOW; if (!IsOper(sptr)) diff --git a/src/parse.c b/src/parse.c index 7d35d40af..062f14f1b 100644 --- a/src/parse.c +++ b/src/parse.c @@ -258,7 +258,7 @@ int parse2(Client *cptr, Client **fromptr, MessageTag *mtags, char *ch) *s++ = '\0'; if (!IsRegistered(from)) flags |= M_UNREGISTERED; - if (IsPerson(from)) + if (IsUser(from)) flags |= M_USER; if (IsServer(from)) flags |= M_SERVER; @@ -294,7 +294,7 @@ int parse2(Client *cptr, Client **fromptr, MessageTag *mtags, char *ch) if (ch[0] != '\0') { - if (IsPerson(from)) + if (IsUser(from)) sendto_one(from, NULL, ":%s %d %s %s :Unknown command", me.name, ERR_UNKNOWNCOMMAND, @@ -386,7 +386,7 @@ int parse2(Client *cptr, Client **fromptr, MessageTag *mtags, char *ch) if (cmptr == NULL) return (do_numeric(numeric, cptr, from, mtags, i, para)); cmptr->count++; - if (IsRegisteredUser(cptr) && (cmptr->flags & M_RESETIDLE)) + if (IsUser(cptr) && (cmptr->flags & M_RESETIDLE)) cptr->local->last = TStime(); #ifndef DEBUGMODE @@ -431,7 +431,7 @@ static int cancel_clients(Client *cptr, Client *sptr, char *cmd) static void remove_unknown(Client *cptr, char *sender) { - if (!IsRegistered(cptr) || IsRegisteredUser(cptr)) + if (!IsRegistered(cptr) || IsUser(cptr)) return; /* * Not from a server so don't need to worry about it. diff --git a/src/send.c b/src/send.c index 1f9cd9a35..3228c4a04 100644 --- a/src/send.c +++ b/src/send.c @@ -67,7 +67,7 @@ int dead_link(Client *to, char *notice) if (to->local->error_str) return -1; /* don't overwrite & don't send multiple times */ - if (!IsPerson(to) && !IsUnknown(to) && !IsClosing(to)) + if (!IsUser(to) && !IsUnknown(to) && !IsClosing(to)) sendto_ops_and_log("Link to server %s (%s) closed: %s", to->name, to->ip?to->ip:"", notice); Debug((DEBUG_ERROR, "dead_link: %s - %s", notice, get_client_name(to, FALSE))); @@ -392,10 +392,10 @@ void sendto_channel(Channel *chptr, Client *from, Client *skip, continue; good: /* Now deal with 'clicap' (if non-zero) */ - if (clicap && MyClient(acptr) && !HasCapabilityFast(acptr, clicap)) + if (clicap && MyUser(acptr) && !HasCapabilityFast(acptr, clicap)) continue; - if (MyClient(acptr)) + if (MyUser(acptr)) { /* Local client */ if (sendflags & SEND_LOCAL) @@ -615,7 +615,7 @@ void sendto_match_butone(Client *one, Client *from, char *mask, int what, { list_for_each_entry(cptr, &lclient_list, lclient_node) { - if (!IsMe(cptr) && (cptr != one) && IsRegisteredUser(cptr) && match_it(cptr, mask, what)) + if (!IsMe(cptr) && (cptr != one) && IsUser(cptr) && match_it(cptr, mask, what)) { va_start(vl, pattern); vsendto_prefix_one(cptr, from, mtags, pattern, vl); @@ -660,7 +660,7 @@ void sendto_umode(int umodes, FORMAT_STRING(const char *pattern), ...) char nbuf[1024]; list_for_each_entry(cptr, &lclient_list, lclient_node) - if (IsPerson(cptr) && (cptr->umodes & umodes) == umodes) + if (IsUser(cptr) && (cptr->umodes & umodes) == umodes) { (void)ircsnprintf(nbuf, sizeof(nbuf), ":%s NOTICE %s :", me.name, cptr->name); @@ -700,7 +700,7 @@ void sendto_umode_global(int umodes, FORMAT_STRING(const char *pattern), ...) list_for_each_entry(cptr, &lclient_list, lclient_node) { - if (IsPerson(cptr) && (cptr->umodes & umodes) == umodes) + if (IsUser(cptr) && (cptr->umodes & umodes) == umodes) { (void)ircsnprintf(nbuf, sizeof(nbuf), ":%s NOTICE %s :", me.name, cptr->name); @@ -868,7 +868,7 @@ static int vmakebuf_local_withprefix(char *buf, size_t buflen, struct Client *fr *buf = ':'; strcpy(buf+1, from->name); - if (IsPerson(from)) + if (IsUser(from)) { char *username = from->user->username; char *host = GetHost(from); @@ -902,7 +902,7 @@ void vsendto_prefix_one(struct Client *to, struct Client *from, MessageTag *mtag { char *mtags_str = mtags ? mtags_to_string(mtags, to) : NULL; - if (to && from && MyClient(to) && from->user) + if (to && from && MyUser(to) && from->user) vmakebuf_local_withprefix(sendbuf, sizeof sendbuf, from, pattern, vl); else ircvsnprintf(sendbuf, sizeof(sendbuf), pattern, vl); diff --git a/src/serv.c b/src/serv.c index 302428bca..f37410ad6 100644 --- a/src/serv.c +++ b/src/serv.c @@ -157,7 +157,7 @@ void send_version(Client* sptr, int reply) CMD_FUNC(m_version) { /* Only allow remote VERSIONs if registered -- Syzop */ - if (!IsPerson(sptr) && !IsServer(cptr)) + if (!IsUser(sptr) && !IsServer(cptr)) { send_version(sptr,RPL_ISUPPORT); return 0; @@ -179,7 +179,7 @@ CMD_FUNC(m_version) sendnotice(sptr, "%s", curl_version()); #endif } - if (MyClient(sptr)) + if (MyUser(sptr)) send_version(sptr,RPL_ISUPPORT); else send_version(sptr,RPL_REMOTEISUPPORT); @@ -223,14 +223,14 @@ void send_proto(Client *cptr, ConfigItem_link *aconf) int remotecmdfilter(Client *sptr, int parc, char *parv[]) { /* no remote requests permitted from non-ircops */ - if (MyClient(sptr) && !ValidatePermissionsForPath("server:remote",sptr,NULL,NULL,NULL) && !BadPtr(parv[1])) + if (MyUser(sptr) && !ValidatePermissionsForPath("server:remote",sptr,NULL,NULL,NULL) && !BadPtr(parv[1])) { parv[1] = NULL; parc = 1; } /* same as above, but in case an old server forwards a request to us: we ignore it */ - if (!MyClient(sptr) && !ValidatePermissionsForPath("server:remote",sptr,NULL,NULL,NULL)) + if (!MyUser(sptr) && !ValidatePermissionsForPath("server:remote",sptr,NULL,NULL,NULL)) return 1; /* STOP (return) */ return 0; /* Continue */ @@ -597,7 +597,7 @@ CMD_FUNC(m_rehash) if (x != HUNTED_ISME) return 0; /* Now forwarded or server didnt exist */ - if (MyClient(sptr) && IsWebsocket(sptr)) + if (MyUser(sptr) && IsWebsocket(sptr)) { sendnotice(sptr, "Sorry, for technical reasons it is not possible to REHASH " "the local server from a WebSocket connection."); @@ -802,7 +802,7 @@ char *reason = parv[1]; list_for_each_entry(acptr, &lclient_list, lclient_node) { - if (IsRegisteredUser(acptr)) + if (IsUser(acptr)) sendnotice(acptr, "Server Restarted by %s", sptr->name); else if (IsServer(acptr)) sendto_one(acptr, NULL, ":%s ERROR :Restarted by %s: %s", @@ -1122,7 +1122,7 @@ CMD_FUNC(m_die) list_for_each_entry(acptr, &lclient_list, lclient_node) { - if (IsRegisteredUser(acptr)) + if (IsUser(acptr)) sendnotice(acptr, "Server Terminated by %s", sptr->name); else if (IsServer(acptr)) @@ -1146,7 +1146,7 @@ int localdie(void) list_for_each_entry(acptr, &lclient_list, lclient_node) { - if (IsRegisteredUser(acptr)) + if (IsUser(acptr)) sendnotice(acptr, "Server Terminated by local console"); else if (IsServer(acptr)) sendto_one(acptr, NULL, diff --git a/src/socket.c b/src/socket.c index c46a63351..4d00499dc 100644 --- a/src/socket.c +++ b/src/socket.c @@ -46,7 +46,7 @@ int deliver_it(Client *cptr, char *str, int len, int *want_read) *want_read = 0; - if (IsDeadSocket(cptr) || (!IsServer(cptr) && !IsPerson(cptr) + if (IsDeadSocket(cptr) || (!IsServer(cptr) && !IsUser(cptr) && !IsHandshake(cptr) && !IsTLSHandshake(cptr) diff --git a/src/tls.c b/src/tls.c index d75d0ea1a..723b584d5 100644 --- a/src/tls.c +++ b/src/tls.c @@ -524,7 +524,7 @@ void reinit_ssl(Client *acptr) if (!acptr) mylog("Reloading all SSL related data (./unrealircd reloadtls)"); - else if (IsPerson(acptr)) + else if (IsUser(acptr)) mylog("%s (%s@%s) requested a reload of all SSL related data (/rehash -ssl)", acptr->name, acptr->user->username, acptr->user->realhost); else diff --git a/src/user.c b/src/user.c index 25b8ba13c..97d67abbb 100644 --- a/src/user.c +++ b/src/user.c @@ -193,7 +193,7 @@ int hunt_server(Client *cptr, Client *sptr, MessageTag *mtags, char *command, in acptr = find_client(parv[server], NULL); /* find_client() may find a variety of clients. Only servers/persons please, no 'unknowns'. */ - if (acptr && MyConnect(acptr) && !IsMe(acptr) && !IsPerson(acptr) && !IsServer(acptr)) + if (acptr && MyConnect(acptr) && !IsMe(acptr) && !IsUser(acptr) && !IsServer(acptr)) acptr = NULL; if (!acptr) @@ -202,7 +202,7 @@ int hunt_server(Client *cptr, Client *sptr, MessageTag *mtags, char *command, in return HUNTED_NOSUCH; } - if (IsMe(acptr) || MyClient(acptr)) + if (IsMe(acptr) || MyUser(acptr)) return HUNTED_ISME; /* Never send the message back from where it came from */ @@ -469,7 +469,7 @@ void send_umode(Client *cptr, Client *sptr, long old, long sendmask, char *umode if (!Usermode_Table[i].flag) continue; flag = Usermode_Table[i].mode; - if (MyClient(sptr) && !(flag & sendmask)) + if (MyUser(sptr) && !(flag & sendmask)) continue; if ((flag & old) && !(sptr->umodes & flag)) { @@ -519,7 +519,7 @@ void send_umode_out(Client *cptr, Client *sptr, long old) } } - if (cptr && MyClient(cptr)) + if (cptr && MyUser(cptr)) send_umode(cptr, sptr, old, ALL_UMODES, buf); } @@ -547,7 +547,7 @@ int add_silence(Client *sptr, char *mask, int senderr) for (lp = sptr->user->silence; lp; lp = lp->next) { - if (MyClient(sptr)) + if (MyUser(sptr)) if ((strlen(lp->value.cp) > MAXSILELENGTH) || (++cnt >= SILENCE_LIMIT)) { if (senderr) diff --git a/src/windows/service.c b/src/windows/service.c index e27ea681b..75d241243 100644 --- a/src/windows/service.c +++ b/src/windows/service.c @@ -63,7 +63,7 @@ VOID WINAPI IRCDCtrlHandler(DWORD opcode) { if (!(acptr = local[i])) continue; - if (IsRegisteredUser(acptr)) + if (IsUser(acptr)) sendnotice(acptr, "Server Terminating."); else if (IsServer(acptr)) sendto_one(acptr, NULL, ":%s ERROR :Terminated", me.name);