CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Branch tags: u2_10_11_03
Commit time: 2002-11-23 19:05:20 UTC
Modified files:
Tag: u2_10_11_03
ChangeLog include/client.h include/s_user.h ircd/IPcheck.c
ircd/channel.c ircd/client.c ircd/ircd.c ircd/m_account.c
ircd/m_join.c ircd/m_kick.c ircd/m_kill.c ircd/m_map.c
ircd/m_mode.c ircd/m_nick.c ircd/m_notice.c ircd/m_oper.c
ircd/m_part.c ircd/m_pong.c ircd/m_privmsg.c ircd/m_server.c
ircd/m_wallchops.c ircd/m_who.c ircd/numnicks.c ircd/s_bsd.c
ircd/s_conf.c ircd/s_misc.c ircd/s_user.c ircd/send.c
Log message:
Author: Entrope <[EMAIL PROTECTED]> (by way of Kev <[EMAIL PROTECTED]>)
Log message:
This converts the cli_flags member of struct Client to work like
cli_privs does.
---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.290.2.125.2.16 ircu2.10/ChangeLog:1.290.2.125.2.17
--- ircu2.10/ChangeLog:1.290.2.125.2.16 Sat Nov 23 10:33:37 2002
+++ ircu2.10/ChangeLog Sat Nov 23 11:05:07 2002
@@ -1,3 +1,105 @@
+2002-11-23 Kevin L Mitchell <[EMAIL PROTECTED]>
+
+ * include/client.h: remove a comma from the end of the enumerator
+ list--resulted in a gcc warning.
+
+2002-11-04 Entrope <[EMAIL PROTECTED]>
+
+ * include/client.h: Convert cli_flags into a struct rather
+ than a plain integer. Add and update helper macros to match.
+
+ * include/s_user.h: Update declarations to match ircd/s_user.c
+ changes (see below).
+
+ * ircd/client.c (client_set_privs): Update (and rework) to
+ match new changes to struct Client and FLAG_* values.
+
+ * ircd/m_oper.c (m_oper): Update to match new FLAG_* values,
+ access macros and send_umode_out() arguments.
+
+ * ircd/s_user.c (register_user): Update to match new FLAG_*
+ values and access macros.
+ (userModeList): Likewise; also change meaning of "flag" field
+ to be flag number rather than bitmask.
+ (set_nick_name): Update to match userModeList.
+ (send_umode_out): Update arguments and send_umode() call to
+ match new send_umode() arguments.
+ (hide_hostmask): Change meaning of "flag" argument to be flag
+ number rather than bitmask. Update to match new FLAG_* values
+ and access macros.
+ (set_user_mode): Change "setflags" to struct Flags type, and
+ use new FLAG_* values and access macros. Use new arguments
+ for send_umode_out().
+ (umode_str): Update to match new FLAG_* values and access
+ macros. Update test for global modes.
+
+ (send_umode): Change "old" argument to struct Flags* type and
+ change "sendmask" bitmask to "sendset" enum. Update test for
+ whether to send each mode.
+
+ * ircd/IPCheck.c (ip_registry_disconenct): Update comment to
+ reflect new FLAG_* names.
+
+ * ircd/m_server.c (mr_server): Update to use new FLAG_* values
+ and access macros.
+ (ms_server): Likewise. Split out serv_flags into one variable
+ for each of the relevant flags.
+
+ * ircd/ircd.c (check_pings): Update to match new FLAG_* values
+ and access macros.
+
+ * ircd/channel.c (is_banned): Likewise.
+
+ * ircd/m_account.c (ms_account): Likewise.
+
+ * ircd/m_join.c (ms_join): Likewise.
+
+ * ircd/m_kick.c (m_kick): Likewise.
+ (ms_kick): Likewise.
+
+ * ircd/m_kill.c (do_kill): Likewise.
+
+ * ircd/m_map.c (dump_map): Likewise.
+
+ * ircd/m_mode.c (m_mode): Likewise.
+ (ms_mode): Likewise.
+
+ * ircd/m_nick.c (ms_nick): Likewise.
+
+ * ircd/m_notice.c (m_notice): Likewise.
+ (ms_notice): Likewise.
+ (mo_notice): Likewise.
+
+ * ircd/m_part.c (m_part): Likewise.
+ (ms_part): Likewise.
+
+ * ircd/m_pong.c (ms_pong): Likewise.
+ (mr_pong): Likewise.
+ (m_pong): Likewise.
+
+ * ircd/m_privmsg.c (m_privmsg): Likewise.
+ (ms_privmsg): Likewise.
+ (mo_privmsg): Likewise.
+
+ * ircd/m_wallchops.c (m_wallchops): Likewise.
+
+ * ircd/m_who.c (m_who): Likewise.
+
+ * ircd/numnicks.c (markMatchexServer): Likewise.
+
+ * ircd/s_bsd.c (deliver_it): Likewise.
+ (completed_connection): Likewise.
+ (close_connection): Likewise.
+ (read_packet): Likewise.
+ (client_sock_callback): Likewise.
+
+ * ircd/s_conf.c (attach_iline): Likewise.
+
+ * ircd/s_misc.c (exit_client): Likewise.
+
+ * ircd/send.c (dead_link): Likewise.
+ (sendwallto_group_butone): Likewise.
+
2002-11-21 Aaron Catella <[EMAIL PROTECTED]>
* ircd/m_admin.c: allow /admin <local server>
Index: ircu2.10/include/client.h
diff -u ircu2.10/include/client.h:1.23.2.4 ircu2.10/include/client.h:1.23.2.4.8.1
--- ircu2.10/include/client.h:1.23.2.4 Wed Jul 17 14:07:01 2002
+++ ircu2.10/include/client.h Sat Nov 23 11:05:07 2002
@@ -18,7 +18,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
- * $Id: client.h,v 1.23.2.4 2002/07/17 21:07:01 kev Exp $
+ * $Id: client.h,v 1.23.2.4.8.1 2002/11/23 19:05:07 klmitch Exp $
*/
#ifndef INCLUDED_client_h
#define INCLUDED_client_h
@@ -111,6 +111,48 @@
unsigned long priv_mask[(PRIV_LAST_PRIV / _PRIV_NBITS) + 1];
};
+enum Flag {
+ FLAG_PINGSENT, /* Unreplied ping sent */
+ FLAG_DEADSOCKET, /* Local socket is dead--Exiting soon */
+ FLAG_KILLED, /* Prevents "QUIT" from being sent for this */
+ FLAG_BLOCKED, /* socket is in a blocked condition */
+ FLAG_CLOSING, /* set when closing to suppress errors */
+ FLAG_UPING, /* has active UDP ping request */
+ FLAG_CHKACCESS, /* ok to check clients access if set */
+ FLAG_HUB, /* server is a hub */
+ FLAG_SERVICE, /* server is a service */
+ FLAG_LOCAL, /* set for local clients */
+ FLAG_GOTID, /* successful ident lookup achieved */
+ FLAG_DOID, /* I-lines say must use ident return */
+ FLAG_NONL, /* No \n in buffer */
+ FLAG_TS8, /* Why do you want to know? */
+ FLAG_MAP, /* Show server on the map */
+ FLAG_JUNCTION, /* Junction causing the net.burst */
+ FLAG_BURST, /* Server is receiving a net.burst */
+ FLAG_BURST_ACK, /* Server is waiting for eob ack */
+ FLAG_IPCHECK, /* Added or updated IPregistry data */
+
+ FLAG_LOCOP, /* Local operator -- SRB */
+ FLAG_SERVNOTICE, /* server notices such as kill */
+ FLAG_OPER, /* Operator */
+ FLAG_INVISIBLE, /* makes user invisible */
+ FLAG_WALLOP, /* send wallops to them */
+ FLAG_DEAF, /* Makes user deaf */
+ FLAG_CHSERV, /* Disallow KICK or MODE -o on the user;
+ don't display channels in /whois */
+ FLAG_DEBUG, /* send global debug/anti-hack info */
+ FLAG_ACCOUNT, /* account name has been set */
+ FLAG_HIDDENHOST, /* user's host is hidden */
+
+ _FLAG_COUNT,
+ FLAG_LOCAL_UMODES = FLAG_LOCOP, /* First local mode flag */
+ FLAG_GLOBAL_UMODES = FLAG_OPER /* First global mode flag */
+};
+
+struct Flags {
+ unsigned long flag_bits[((_FLAG_COUNT + _PRIV_NBITS - 1) / _PRIV_NBITS)];
+};
+
struct Connection {
/*
* The following fields are allocated only for local clients
@@ -188,7 +230,7 @@
time_t cli_firsttime; /* time client was created */
time_t cli_lastnick; /* TimeStamp on nick */
int cli_marker; /* /who processing marker */
- unsigned int cli_flags; /* client flags */
+ struct Flags cli_flags; /* client flags */
unsigned int cli_hopcount; /* number of servers to this 0 = local */
struct in_addr cli_ip; /* Real ip# NOT defined for remote servers! */
short cli_status; /* Client type */
@@ -347,110 +389,81 @@
(STAT_SERVER | STAT_CONNECTING | STAT_HANDSHAKE))
/*
- * FLAGS macros
- */
-#define FLAGS_PINGSENT 0x0001 /* Unreplied ping sent */
-#define FLAGS_DEADSOCKET 0x0002 /* Local socket is dead--Exiting soon */
-#define FLAGS_KILLED 0x0004 /* Prevents "QUIT" from being sent for this */
-#define FLAGS_OPER 0x0008 /* Operator */
-#define FLAGS_LOCOP 0x0010 /* Local operator -- SRB */
-#define FLAGS_INVISIBLE 0x0020 /* makes user invisible */
-#define FLAGS_WALLOP 0x0040 /* send wallops to them */
-#define FLAGS_SERVNOTICE 0x0080 /* server notices such as kill */
-#define FLAGS_BLOCKED 0x0100 /* socket is in a blocked condition */
-#define FLAGS_ACCOUNT 0x0200 /* account name has been set */
-#define FLAGS_CLOSING 0x0400 /* set when closing to suppress errors */
-#define FLAGS_UPING 0x0800 /* has active UDP ping request */
-#define FLAGS_CHKACCESS 0x1000 /* ok to check clients access if set */
-#define FLAGS_HUB 0x2000 /* server is a hub */
-#define FLAGS_SERVICE 0x4000 /* server is a service */
-#define FLAGS_HIDDENHOST 0x8000 /* user's host is hidden */
-#define FLAGS_LOCAL 0x00010000 /* set for local clients */
-#define FLAGS_GOTID 0x00020000 /* successful ident lookup achieved */
-#define FLAGS_DOID 0x00040000 /* I-lines say must use ident return */
-#define FLAGS_NONL 0x00080000 /* No \n in buffer */
-#define FLAGS_TS8 0x00100000 /* Why do you want to know? */
-#define FLAGS_MAP 0x00800000 /* Show server on the map */
-#define FLAGS_JUNCTION 0x01000000 /* Junction causing the net.burst */
-#define FLAGS_DEAF 0x02000000 /* Makes user deaf */
-#define FLAGS_CHSERV 0x04000000 /* Disallow KICK or MODE -o on the user;
- don't display channels in /whois */
-#define FLAGS_BURST 0x08000000 /* Server is receiving a net.burst */
-#define FLAGS_BURST_ACK 0x10000000 /* Server is waiting for eob ack */
-#define FLAGS_DEBUG 0x20000000 /* send global debug/anti-hack info */
-#define FLAGS_IPCHECK 0x40000000 /* Added or updated IPregistry data */
-
-#define SEND_UMODES \
-
(FLAGS_INVISIBLE|FLAGS_OPER|FLAGS_WALLOP|FLAGS_DEAF|FLAGS_CHSERV|FLAGS_DEBUG|FLAGS_ACCOUNT|FLAGS_HIDDENHOST)
-#define ALL_UMODES (SEND_UMODES|FLAGS_SERVNOTICE|FLAGS_LOCOP)
-#define FLAGS_ID (FLAGS_DOID|FLAGS_GOTID)
-
-/*
* flags macros.
*/
-#define DoAccess(x) (cli_flags(x) & FLAGS_CHKACCESS)
-#define IsAnOper(x) (cli_flags(x) & (FLAGS_OPER|FLAGS_LOCOP))
-#define IsBlocked(x) (cli_flags(x) & FLAGS_BLOCKED)
-#define IsBurst(x) (cli_flags(x) & FLAGS_BURST)
-#define IsBurstAck(x) (cli_flags(x) & FLAGS_BURST_ACK)
-#define IsBurstOrBurstAck(x) (cli_flags(x) & (FLAGS_BURST|FLAGS_BURST_ACK))
-#define IsChannelService(x) (cli_flags(x) & FLAGS_CHSERV)
-#define IsDead(x) (cli_flags(x) & FLAGS_DEADSOCKET)
-#define IsDeaf(x) (cli_flags(x) & FLAGS_DEAF)
-#define IsIPChecked(x) (cli_flags(x) & FLAGS_IPCHECK)
-#define IsIdented(x) (cli_flags(x) & FLAGS_GOTID)
-#define IsInvisible(x) (cli_flags(x) & FLAGS_INVISIBLE)
-#define IsJunction(x) (cli_flags(x) & FLAGS_JUNCTION)
-#define IsLocOp(x) (cli_flags(x) & FLAGS_LOCOP)
-#define IsLocal(x) (cli_flags(x) & FLAGS_LOCAL)
-#define IsOper(x) (cli_flags(x) & FLAGS_OPER)
-#define IsUPing(x) (cli_flags(x) & FLAGS_UPING)
-#define NoNewLine(x) (cli_flags(x) & FLAGS_NONL)
-#define SendDebug(x) (cli_flags(x) & FLAGS_DEBUG)
-#define SendServNotice(x) (cli_flags(x) & FLAGS_SERVNOTICE)
-#define SendWallops(x) (cli_flags(x) & FLAGS_WALLOP)
-#define IsHub(x) (cli_flags(x) & FLAGS_HUB)
-#define IsService(x) (cli_flags(x) & FLAGS_SERVICE)
-#define IsAccount(x) (cli_flags(x) & FLAGS_ACCOUNT)
-#define IsHiddenHost(x) (cli_flags(x) & FLAGS_HIDDENHOST)
+#define FlagSet(fset, flag) ((fset)->flag_bits[_PRIV_IDX(flag)] |= \
+ _PRIV_BIT(flag))
+#define FlagClr(fset, flag) ((fset)->flag_bits[_PRIV_IDX(flag)] &= \
+ ~(_PRIV_BIT(flag)))
+#define FlagHas(fset, flag) ((fset)->flag_bits[_PRIV_IDX(flag)] & \
+ _PRIV_BIT(flag))
+#define SetFlag(cli, flag) FlagSet(&cli_flags(cli), flag)
+#define ClrFlag(cli, flag) FlagClr(&cli_flags(cli), flag)
+#define HasFlag(cli, flag) FlagHas(&cli_flags(cli), flag)
+
+#define DoAccess(x) HasFlag(x, FLAG_CHKACCESS)
+#define IsAnOper(x) (HasFlag(x, FLAG_OPER) || HasFlag(x, FLAG_LOCOP))
+#define IsBlocked(x) HasFlag(x, FLAG_BLOCKED)
+#define IsBurst(x) HasFlag(x, FLAG_BURST)
+#define IsBurstAck(x) HasFlag(x, FLAG_BURST_ACK)
+#define IsBurstOrBurstAck(x) (HasFlag(x, FLAG_BURST) || HasFlag(x, FLAG_BURST_ACK))
+#define IsChannelService(x) HasFlag(x, FLAG_CHSERV)
+#define IsDead(x) HasFlag(x, FLAG_DEADSOCKET)
+#define IsDeaf(x) HasFlag(x, FLAG_DEAF)
+#define IsIPChecked(x) HasFlag(x, FLAG_IPCHECK)
+#define IsIdented(x) HasFlag(x, FLAG_GOTID)
+#define IsInvisible(x) HasFlag(x, FLAG_INVISIBLE)
+#define IsJunction(x) HasFlag(x, FLAG_JUNCTION)
+#define IsLocOp(x) HasFlag(x, FLAG_LOCOP)
+#define IsLocal(x) HasFlag(x, FLAG_LOCAL)
+#define IsOper(x) HasFlag(x, FLAG_OPER)
+#define IsUPing(x) HasFlag(x, FLAG_UPING)
+#define NoNewLine(x) HasFlag(x, FLAG_NONL)
+#define SendDebug(x) HasFlag(x, FLAG_DEBUG)
+#define SendServNotice(x) HasFlag(x, FLAG_SERVNOTICE)
+#define SendWallops(x) HasFlag(x, FLAG_WALLOP)
+#define IsHub(x) HasFlag(x, FLAG_HUB)
+#define IsService(x) HasFlag(x, FLAG_SERVICE)
+#define IsAccount(x) HasFlag(x, FLAG_ACCOUNT)
+#define IsHiddenHost(x) HasFlag(x, FLAG_HIDDENHOST)
#define HasHiddenHost(x) (IsAccount(x) && IsHiddenHost(x))
#define IsPrivileged(x) (IsAnOper(x) || IsServer(x))
-#define SetAccess(x) (cli_flags(x) |= FLAGS_CHKACCESS)
-#define SetBurst(x) (cli_flags(x) |= FLAGS_BURST)
-#define SetBurstAck(x) (cli_flags(x) |= FLAGS_BURST_ACK)
-#define SetChannelService(x) (cli_flags(x) |= FLAGS_CHSERV)
-#define SetDeaf(x) (cli_flags(x) |= FLAGS_DEAF)
-#define SetDebug(x) (cli_flags(x) |= FLAGS_DEBUG)
-#define SetGotId(x) (cli_flags(x) |= FLAGS_GOTID)
-#define SetIPChecked(x) (cli_flags(x) |= FLAGS_IPCHECK)
-#define SetInvisible(x) (cli_flags(x) |= FLAGS_INVISIBLE)
-#define SetJunction(x) (cli_flags(x) |= FLAGS_JUNCTION)
-#define SetLocOp(x) (cli_flags(x) |= FLAGS_LOCOP)
-#define SetOper(x) (cli_flags(x) |= FLAGS_OPER)
-#define SetUPing(x) (cli_flags(x) |= FLAGS_UPING)
-#define SetWallops(x) (cli_flags(x) |= FLAGS_WALLOP)
-#define SetServNotice(x) (cli_flags(x) |= FLAGS_SERVNOTICE)
-#define SetHub(x) (cli_flags(x) |= FLAGS_HUB)
-#define SetService(x) (cli_flags(x) |= FLAGS_SERVICE)
-#define SetAccount(x) (cli_flags(x) |= FLAGS_ACCOUNT)
-#define SetHiddenHost(x) (cli_flags(x) |= FLAGS_HIDDENHOST)
-
-#define ClearAccess(x) (cli_flags(x) &= ~FLAGS_CHKACCESS)
-#define ClearBurst(x) (cli_flags(x) &= ~FLAGS_BURST)
-#define ClearBurstAck(x) (cli_flags(x) &= ~FLAGS_BURST_ACK)
-#define ClearChannelService(x) (cli_flags(x) &= ~FLAGS_CHSERV)
-#define ClearDeaf(x) (cli_flags(x) &= ~FLAGS_DEAF)
-#define ClearDebug(x) (cli_flags(x) &= ~FLAGS_DEBUG)
-#define ClearIPChecked(x) (cli_flags(x) &= ~FLAGS_IPCHECK)
-#define ClearInvisible(x) (cli_flags(x) &= ~FLAGS_INVISIBLE)
-#define ClearLocOp(x) (cli_flags(x) &= ~FLAGS_LOCOP)
-#define ClearOper(x) (cli_flags(x) &= ~FLAGS_OPER)
-#define ClearUPing(x) (cli_flags(x) &= ~FLAGS_UPING)
-#define ClearWallops(x) (cli_flags(x) &= ~FLAGS_WALLOP)
-#define ClearServNotice(x) (cli_flags(x) &= ~FLAGS_SERVNOTICE)
-#define ClearHiddenHost(x) (cli_flags(x) &= ~FLAGS_HIDDENHOST)
+#define SetAccess(x) SetFlag(x, FLAG_CHKACCESS)
+#define SetBurst(x) SetFlag(x, FLAG_BURST)
+#define SetBurstAck(x) SetFlag(x, FLAG_BURST_ACK)
+#define SetChannelService(x) SetFlag(x, FLAG_CHSERV)
+#define SetDeaf(x) SetFlag(x, FLAG_DEAF)
+#define SetDebug(x) SetFlag(x, FLAG_DEBUG)
+#define SetGotId(x) SetFlag(x, FLAG_GOTID)
+#define SetIPChecked(x) SetFlag(x, FLAG_IPCHECK)
+#define SetInvisible(x) SetFlag(x, FLAG_INVISIBLE)
+#define SetJunction(x) SetFlag(x, FLAG_JUNCTION)
+#define SetLocOp(x) SetFlag(x, FLAG_LOCOP)
+#define SetOper(x) SetFlag(x, FLAG_OPER)
+#define SetUPing(x) SetFlag(x, FLAG_UPING)
+#define SetWallops(x) SetFlag(x, FLAG_WALLOP)
+#define SetServNotice(x) SetFlag(x, FLAG_SERVNOTICE)
+#define SetHub(x) SetFlag(x, FLAG_HUB)
+#define SetService(x) SetFlag(x, FLAG_SERVICE)
+#define SetAccount(x) SetFlag(x, FLAG_ACCOUNT)
+#define SetHiddenHost(x) SetFlag(x, FLAG_HIDDENHOST)
+
+#define ClearAccess(x) ClrFlag(x, FLAG_CHKACCESS)
+#define ClearBurst(x) ClrFlag(x, FLAG_BURST)
+#define ClearBurstAck(x) ClrFlag(x, FLAG_BURST_ACK)
+#define ClearChannelService(x) ClrFlag(x, FLAG_CHSERV)
+#define ClearDeaf(x) ClrFlag(x, FLAG_DEAF)
+#define ClearDebug(x) ClrFlag(x, FLAG_DEBUG)
+#define ClearIPChecked(x) ClrFlag(x, FLAG_IPCHECK)
+#define ClearInvisible(x) ClrFlag(x, FLAG_INVISIBLE)
+#define ClearLocOp(x) ClrFlag(x, FLAG_LOCOP)
+#define ClearOper(x) ClrFlag(x, FLAG_OPER)
+#define ClearUPing(x) ClrFlag(x, FLAG_UPING)
+#define ClearWallops(x) ClrFlag(x, FLAG_WALLOP)
+#define ClearServNotice(x) ClrFlag(x, FLAG_SERVNOTICE)
+#define ClearHiddenHost(x) ClrFlag(x, FLAG_HIDDENHOST)
/* free flags */
#define FREEFLAG_SOCKET 0x0001 /* socket needs to be freed */
Index: ircu2.10/include/s_user.h
diff -u ircu2.10/include/s_user.h:1.12.2.2.8.1 ircu2.10/include/s_user.h:1.12.2.2.8.2
--- ircu2.10/include/s_user.h:1.12.2.2.8.1 Fri Nov 22 21:50:33 2002
+++ ircu2.10/include/s_user.h Sat Nov 23 11:05:08 2002
@@ -1,7 +1,7 @@
/*
* s_user.h
*
- * $Id: s_user.h,v 1.12.2.2.8.1 2002/11/23 05:50:33 isomer Exp $
+ * $Id: s_user.h,v 1.12.2.2.8.2 2002/11/23 19:05:08 klmitch Exp $
*/
#ifndef INCLUDED_s_user_h
#define INCLUDED_s_user_h
@@ -14,6 +14,7 @@
struct User;
struct Channel;
struct MsgBuf;
+struct Flags;
/*
* Macros
@@ -40,6 +41,11 @@
#define HUNTED_ISME 0 /* if this server should execute the command */
#define HUNTED_PASS 1 /* if message passed onwards successfully */
+/* send sets for send_umode() */
+#define ALL_UMODES 0 /* both local and global user modes */
+#define SEND_UMODES 1 /* global user modes only */
+#define SEND_UMODES_BUT_OPER 2 /* global user modes except for FLAG_OPER */
+
/* used when sending to #mask or $mask */
#define MATCH_SERVER 1
@@ -63,15 +69,15 @@
extern int set_nick_name(struct Client* cptr, struct Client* sptr,
const char* nick, int parc, char* parv[]);
-extern void send_umode_out(struct Client* cptr, struct Client* sptr, int old,
- int prop);
+extern void send_umode_out(struct Client* cptr, struct Client* sptr,
+ struct Flags* old, int prop);
extern int whisper(struct Client* source, const char* nick,
const char* channel, const char* text, int is_notice);
extern void send_user_info(struct Client* to, char* names, int rpl,
InfoFormatter fmt);
extern int add_silence(struct Client* sptr, const char* mask);
-extern int hide_hostmask(struct Client *cptr, unsigned int flags);
+extern int hide_hostmask(struct Client *cptr, unsigned int flag);
extern int set_user_mode(struct Client *cptr, struct Client *sptr,
int parc, char *parv[]);
extern int is_silenced(struct Client *sptr, struct Client *acptr);
@@ -87,7 +93,8 @@
int server, int parc, char *parv[]);
extern struct Client* next_client(struct Client* next, const char* ch);
extern char *umode_str(struct Client *cptr);
-extern void send_umode(struct Client *cptr, struct Client *sptr, int old, int
sendmask);
+extern void send_umode(struct Client *cptr, struct Client *sptr,
+ struct Flags *old, int sendset);
extern int del_silence(struct Client *sptr, char *mask);
extern void set_snomask(struct Client *, unsigned int, int);
extern int is_snomask(char *);
Index: ircu2.10/ircd/IPcheck.c
diff -u ircu2.10/ircd/IPcheck.c:1.26.2.1 ircu2.10/ircd/IPcheck.c:1.26.2.1.8.1
--- ircu2.10/ircd/IPcheck.c:1.26.2.1 Sat Jan 12 11:59:14 2002
+++ ircu2.10/ircd/IPcheck.c Sat Nov 23 11:05:08 2002
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: IPcheck.c,v 1.26.2.1 2002/01/12 19:59:14 kev Exp $
+ * $Id: IPcheck.c,v 1.26.2.1.8.1 2002/11/23 19:05:08 klmitch Exp $
*
*
* This file should be edited in a window with a width of 141 characters
@@ -384,7 +384,7 @@
if (0 == entry) {
/*
* trying to find an entry for a server causes this to happen,
- * servers should never have FLAGS_IPCHECK set
+ * servers should never have FLAG_IPCHECK set
*/
return;
}
Index: ircu2.10/ircd/channel.c
diff -u ircu2.10/ircd/channel.c:1.73.2.10.4.5 ircu2.10/ircd/channel.c:1.73.2.10.4.6
--- ircu2.10/ircd/channel.c:1.73.2.10.4.5 Sat Nov 23 09:10:18 2002
+++ ircu2.10/ircd/channel.c Sat Nov 23 11:05:08 2002
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: channel.c,v 1.73.2.10.4.5 2002/11/23 17:10:18 klmitch Exp $
+ * $Id: channel.c,v 1.73.2.10.4.6 2002/11/23 19:05:08 klmitch Exp $
*/
#include "config.h"
@@ -425,7 +425,7 @@
s = make_nick_user_host(nu_host, cli_name(cptr), (cli_user(cptr))->username,
(cli_user(cptr))->host);
- if (cli_flags(cptr) & FLAGS_ACCOUNT) {
+ if (IsAccount(cptr)) {
if (HasHiddenHost(cptr))
sr = make_nick_user_host(nu_realhost, cli_name(cptr),
cli_user(cptr)->username,
Index: ircu2.10/ircd/client.c
diff -u ircu2.10/ircd/client.c:1.15.2.3 ircu2.10/ircd/client.c:1.15.2.3.8.1
--- ircu2.10/ircd/client.c:1.15.2.3 Fri May 17 09:42:19 2002
+++ ircu2.10/ircd/client.c Sat Nov 23 11:05:08 2002
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: client.c,v 1.15.2.3 2002/05/17 16:42:19 kev Exp $
+ * $Id: client.c,v 1.15.2.3.8.1 2002/11/23 19:05:08 klmitch Exp $
*/
#include "config.h"
@@ -104,60 +104,64 @@
static struct {
unsigned int priv;
enum Feature feat;
- unsigned int flag;
+ enum {
+ FEATFLAG_DISABLES_PRIV,
+ FEATFLAG_ENABLES_PRIV,
+ FEATFLAG_GLOBAL_OPERS,
+ FEATFLAG_LOCAL_OPERS,
+ FEATFLAG_ALL_OPERS
+ } flag;
} feattab[] = {
- { PRIV_WHOX, FEAT_LAST_F, (FLAGS_OPER | FLAGS_LOCOP) },
- { PRIV_DISPLAY, FEAT_LAST_F, (FLAGS_OPER | FLAGS_LOCOP) },
- { PRIV_CHAN_LIMIT, FEAT_OPER_NO_CHAN_LIMIT, (FLAGS_OPER | FLAGS_LOCOP) },
- { PRIV_MODE_LCHAN, FEAT_OPER_MODE_LCHAN, (FLAGS_OPER | FLAGS_LOCOP) },
- { PRIV_LOCAL_OPMODE, FEAT_OPER_MODE_LCHAN, (FLAGS_OPER | FLAGS_LOCOP) },
- { PRIV_WALK_LCHAN, FEAT_OPER_WALK_THROUGH_LMODES,
- (FLAGS_OPER | FLAGS_LOCOP) },
- { PRIV_DEOP_LCHAN, FEAT_NO_OPER_DEOP_LCHAN, (FLAGS_OPER | FLAGS_LOCOP) },
- { PRIV_SHOW_INVIS, FEAT_SHOW_INVISIBLE_USERS, (FLAGS_OPER | FLAGS_LOCOP) },
- { PRIV_SHOW_ALL_INVIS, FEAT_SHOW_ALL_INVISIBLE_USERS,
- (FLAGS_OPER | FLAGS_LOCOP) },
- { PRIV_UNLIMIT_QUERY, FEAT_UNLIMIT_OPER_QUERY, (FLAGS_OPER | FLAGS_LOCOP) },
-
- { PRIV_KILL, FEAT_LOCAL_KILL_ONLY, 0 },
- { PRIV_GLINE, FEAT_CONFIG_OPERCMDS, ~0 },
- { PRIV_JUPE, FEAT_CONFIG_OPERCMDS, ~0 },
- { PRIV_OPMODE, FEAT_CONFIG_OPERCMDS, ~0 },
- { PRIV_BADCHAN, FEAT_CONFIG_OPERCMDS, ~0 },
-
- { PRIV_PROPAGATE, FEAT_LAST_F, FLAGS_OPER },
- { PRIV_SEE_OPERS, FEAT_LAST_F, FLAGS_OPER },
- { PRIV_KILL, FEAT_OPER_KILL, FLAGS_OPER },
- { PRIV_LOCAL_KILL, FEAT_OPER_KILL, FLAGS_OPER },
- { PRIV_REHASH, FEAT_OPER_REHASH, FLAGS_OPER },
- { PRIV_RESTART, FEAT_OPER_RESTART, FLAGS_OPER },
- { PRIV_DIE, FEAT_OPER_DIE, FLAGS_OPER },
- { PRIV_GLINE, FEAT_OPER_GLINE, FLAGS_OPER },
- { PRIV_LOCAL_GLINE, FEAT_OPER_LGLINE, FLAGS_OPER },
- { PRIV_JUPE, FEAT_OPER_JUPE, FLAGS_OPER },
- { PRIV_LOCAL_JUPE, FEAT_OPER_LJUPE, FLAGS_OPER },
- { PRIV_OPMODE, FEAT_OPER_OPMODE, FLAGS_OPER },
- { PRIV_LOCAL_OPMODE, FEAT_OPER_LOPMODE, FLAGS_OPER },
- { PRIV_FORCE_OPMODE, FEAT_OPER_FORCE_OPMODE, FLAGS_OPER },
- { PRIV_FORCE_LOCAL_OPMODE, FEAT_OPER_FORCE_LOPMODE, FLAGS_OPER },
- { PRIV_BADCHAN, FEAT_OPER_BADCHAN, FLAGS_OPER },
- { PRIV_LOCAL_BADCHAN, FEAT_OPER_LBADCHAN, FLAGS_OPER },
- { PRIV_SET, FEAT_OPER_SET, FLAGS_OPER },
- { PRIV_SEE_CHAN, FEAT_OPERS_SEE_IN_SECRET_CHANNELS, FLAGS_OPER },
- { PRIV_WIDE_GLINE, FEAT_OPER_WIDE_GLINE, FLAGS_OPER },
-
- { PRIV_LOCAL_KILL, FEAT_LOCOP_KILL, FLAGS_LOCOP },
- { PRIV_REHASH, FEAT_LOCOP_REHASH, FLAGS_LOCOP },
- { PRIV_RESTART, FEAT_LOCOP_RESTART, FLAGS_LOCOP },
- { PRIV_DIE, FEAT_LOCOP_DIE, FLAGS_LOCOP },
- { PRIV_LOCAL_GLINE, FEAT_LOCOP_LGLINE, FLAGS_LOCOP },
- { PRIV_LOCAL_JUPE, FEAT_LOCOP_LJUPE, FLAGS_LOCOP },
- { PRIV_LOCAL_OPMODE, FEAT_LOCOP_LOPMODE, FLAGS_LOCOP },
- { PRIV_FORCE_LOCAL_OPMODE, FEAT_LOCOP_FORCE_LOPMODE, FLAGS_LOCOP },
- { PRIV_LOCAL_BADCHAN, FEAT_LOCOP_LBADCHAN, FLAGS_LOCOP },
- { PRIV_SET, FEAT_LOCOP_SET, FLAGS_LOCOP },
- { PRIV_SEE_CHAN, FEAT_LOCOP_SEE_IN_SECRET_CHANNELS, FLAGS_LOCOP },
- { PRIV_WIDE_GLINE, FEAT_LOCOP_WIDE_GLINE, FLAGS_LOCOP },
+ { PRIV_WHOX, FEAT_LAST_F, FEATFLAG_ALL_OPERS },
+ { PRIV_DISPLAY, FEAT_LAST_F, FEATFLAG_ALL_OPERS },
+ { PRIV_CHAN_LIMIT, FEAT_OPER_NO_CHAN_LIMIT, FEATFLAG_ALL_OPERS },
+ { PRIV_MODE_LCHAN, FEAT_OPER_MODE_LCHAN, FEATFLAG_ALL_OPERS },
+ { PRIV_LOCAL_OPMODE, FEAT_OPER_MODE_LCHAN, FEATFLAG_ALL_OPERS },
+ { PRIV_WALK_LCHAN, FEAT_OPER_WALK_THROUGH_LMODES, FEATFLAG_ALL_OPERS },
+ { PRIV_DEOP_LCHAN, FEAT_NO_OPER_DEOP_LCHAN, FEATFLAG_ALL_OPERS },
+ { PRIV_SHOW_INVIS, FEAT_SHOW_INVISIBLE_USERS, FEATFLAG_ALL_OPERS },
+ { PRIV_SHOW_ALL_INVIS, FEAT_SHOW_ALL_INVISIBLE_USERS, FEATFLAG_ALL_OPERS },
+ { PRIV_UNLIMIT_QUERY, FEAT_UNLIMIT_OPER_QUERY, FEATFLAG_ALL_OPERS },
+
+ { PRIV_KILL, FEAT_LOCAL_KILL_ONLY, FEATFLAG_DISABLES_PRIV },
+ { PRIV_GLINE, FEAT_CONFIG_OPERCMDS, FEATFLAG_ENABLES_PRIV },
+ { PRIV_JUPE, FEAT_CONFIG_OPERCMDS, FEATFLAG_ENABLES_PRIV },
+ { PRIV_OPMODE, FEAT_CONFIG_OPERCMDS, FEATFLAG_ENABLES_PRIV },
+ { PRIV_BADCHAN, FEAT_CONFIG_OPERCMDS, FEATFLAG_ENABLES_PRIV },
+
+ { PRIV_PROPAGATE, FEAT_LAST_F, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_SEE_OPERS, FEAT_LAST_F, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_KILL, FEAT_OPER_KILL, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_LOCAL_KILL, FEAT_OPER_KILL, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_REHASH, FEAT_OPER_REHASH, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_RESTART, FEAT_OPER_RESTART, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_DIE, FEAT_OPER_DIE, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_GLINE, FEAT_OPER_GLINE, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_LOCAL_GLINE, FEAT_OPER_LGLINE, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_JUPE, FEAT_OPER_JUPE, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_LOCAL_JUPE, FEAT_OPER_LJUPE, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_OPMODE, FEAT_OPER_OPMODE, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_LOCAL_OPMODE, FEAT_OPER_LOPMODE, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_FORCE_OPMODE, FEAT_OPER_FORCE_OPMODE, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_FORCE_LOCAL_OPMODE, FEAT_OPER_FORCE_LOPMODE, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_BADCHAN, FEAT_OPER_BADCHAN, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_LOCAL_BADCHAN, FEAT_OPER_LBADCHAN, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_SET, FEAT_OPER_SET, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_SEE_CHAN, FEAT_OPERS_SEE_IN_SECRET_CHANNELS, FEATFLAG_GLOBAL_OPERS },
+ { PRIV_WIDE_GLINE, FEAT_OPER_WIDE_GLINE, FEATFLAG_GLOBAL_OPERS },
+
+ { PRIV_LOCAL_KILL, FEAT_LOCOP_KILL, FEATFLAG_LOCAL_OPERS },
+ { PRIV_REHASH, FEAT_LOCOP_REHASH, FEATFLAG_LOCAL_OPERS },
+ { PRIV_RESTART, FEAT_LOCOP_RESTART, FEATFLAG_LOCAL_OPERS },
+ { PRIV_DIE, FEAT_LOCOP_DIE, FEATFLAG_LOCAL_OPERS },
+ { PRIV_LOCAL_GLINE, FEAT_LOCOP_LGLINE, FEATFLAG_LOCAL_OPERS },
+ { PRIV_LOCAL_JUPE, FEAT_LOCOP_LJUPE, FEATFLAG_LOCAL_OPERS },
+ { PRIV_LOCAL_OPMODE, FEAT_LOCOP_LOPMODE, FEATFLAG_LOCAL_OPERS },
+ { PRIV_FORCE_LOCAL_OPMODE, FEAT_LOCOP_FORCE_LOPMODE, FEATFLAG_LOCAL_OPERS },
+ { PRIV_LOCAL_BADCHAN, FEAT_LOCOP_LBADCHAN, FEATFLAG_LOCAL_OPERS },
+ { PRIV_SET, FEAT_LOCOP_SET, FEATFLAG_LOCAL_OPERS },
+ { PRIV_SEE_CHAN, FEAT_LOCOP_SEE_IN_SECRET_CHANNELS, FEATFLAG_LOCAL_OPERS },
+ { PRIV_WIDE_GLINE, FEAT_LOCOP_WIDE_GLINE, FEATFLAG_LOCAL_OPERS },
{ 0, FEAT_LAST_F, 0 }
};
@@ -188,19 +192,25 @@
/* This sequence is temporary until the .conf is carefully rewritten */
for (i = 0; feattab[i].priv; i++) {
- if (feattab[i].flag == 0) {
- if (feature_bool(feattab[i].feat))
- PrivSet(&antiprivs, feattab[i].priv);
- } else if (feattab[i].flag == ~0) {
+ if (feattab[i].flag == FEATFLAG_ENABLES_PRIV) {
if (!feature_bool(feattab[i].feat))
PrivSet(&antiprivs, feattab[i].priv);
- } else if (cli_flags(client) & feattab[i].flag) {
- if (feattab[i].feat == FEAT_LAST_F ||
- feature_bool(feattab[i].feat))
- PrivSet(&privs, feattab[i].priv);
+ } else if (feattab[i].feat == FEAT_LAST_F || feature_bool(feattab[i].feat)) {
+ if (feattab[i].flag == FEATFLAG_DISABLES_PRIV) {
+ PrivSet(&antiprivs, feattab[i].priv);
+ } else if (feattab[i].flag == FEATFLAG_ALL_OPERS) {
+ if (IsAnOper(client))
+ PrivSet(&privs, feattab[i].priv);
+ } else if (feattab[i].flag == FEATFLAG_GLOBAL_OPERS) {
+ if (IsOper(client))
+ PrivSet(&privs, feattab[i].priv);
+ } else if (feattab[i].flag == FEATFLAG_LOCAL_OPERS) {
+ if (IsLocOp(client))
+ PrivSet(&privs, feattab[i].priv);
+ }
}
}
-
+
/* This is the end of the gross section */
if (PrivHas(&privs, PRIV_PROPAGATE))
Index: ircu2.10/ircd/ircd.c
diff -u ircu2.10/ircd/ircd.c:1.51.2.9 ircu2.10/ircd/ircd.c:1.51.2.9.4.1
--- ircu2.10/ircd/ircd.c:1.51.2.9 Sat Sep 14 13:44:32 2002
+++ ircu2.10/ircd/ircd.c Sat Nov 23 11:05:08 2002
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: ircd.c,v 1.51.2.9 2002/09/14 20:44:32 kev Exp $
+ * $Id: ircd.c,v 1.51.2.9.4.1 2002/11/23 19:05:08 klmitch Exp $
*/
#include "config.h"
@@ -355,7 +355,7 @@
Debug((DEBUG_DEBUG, "check_pings(%s)=status:%s limit: %d current: %d",
cli_name(cptr),
- (cli_flags(cptr) & FLAGS_PINGSENT) ? "[Ping Sent]" : "[]",
+ HasFlag(cptr, FLAG_PINGSENT) ? "[Ping Sent]" : "[]",
max_ping, (int)(CurrentTime - cli_lasttime(cptr))));
@@ -400,11 +400,11 @@
continue;
}
- if (!(cli_flags(cptr) & FLAGS_PINGSENT)) {
+ if (!HasFlag(cptr, FLAG_PINGSENT)) {
/* If we havent PINGed the connection and we havent heard from it in a
* while, PING it to make sure it is still alive.
*/
- cli_flags(cptr) |= FLAGS_PINGSENT;
+ SetFlag(cptr, FLAG_PINGSENT);
/* If we're late in noticing don't hold it against them :) */
cli_lasttime(cptr) = CurrentTime - max_ping;
Index: ircu2.10/ircd/m_account.c
diff -u ircu2.10/ircd/m_account.c:1.1.2.3.2.1 ircu2.10/ircd/m_account.c:1.1.2.3.2.2
--- ircu2.10/ircd/m_account.c:1.1.2.3.2.1 Sat Nov 23 09:10:19 2002
+++ ircu2.10/ircd/m_account.c Sat Nov 23 11:05:08 2002
@@ -19,7 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_account.c,v 1.1.2.3.2.1 2002/11/23 17:10:19 klmitch Exp $
+ * $Id: m_account.c,v 1.1.2.3.2.2 2002/11/23 19:05:08 klmitch Exp $
*/
/*
@@ -126,7 +126,7 @@
}
ircd_strncpy(cli_user(acptr)->account, parv[2], ACCOUNTLEN);
- hide_hostmask(acptr, FLAGS_ACCOUNT);
+ hide_hostmask(acptr, FLAG_ACCOUNT);
sendcmdto_serv_butone(sptr, CMD_ACCOUNT, cptr, "%C %s", acptr,
cli_user(acptr)->account);
Index: ircu2.10/ircd/m_join.c
diff -u ircu2.10/ircd/m_join.c:1.16.2.2.2.4 ircu2.10/ircd/m_join.c:1.16.2.2.2.5
--- ircu2.10/ircd/m_join.c:1.16.2.2.2.4 Sat Nov 23 10:04:51 2002
+++ ircu2.10/ircd/m_join.c Sat Nov 23 11:05:08 2002
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_join.c,v 1.16.2.2.2.4 2002/11/23 18:04:51 klmitch Exp $
+ * $Id: m_join.c,v 1.16.2.2.2.5 2002/11/23 19:05:08 klmitch Exp $
*/
/*
@@ -350,7 +350,7 @@
name,cli_name(sptr));
continue;
}
- flags = CHFL_DEOPPED | ((cli_flags(sptr) & FLAGS_TS8) ? CHFL_SERVOPOK : 0);
+ flags = CHFL_DEOPPED | (HasFlag(sptr, FLAG_TS8) ? CHFL_SERVOPOK : 0);
/* when the network is 2.10.11+ then remove MAGIC_REMOTE_JOIN_TS */
chptr->creationtime = creation ? creation : MAGIC_REMOTE_JOIN_TS;
@@ -364,7 +364,7 @@
remove_user_from_channel(sptr, chptr);
chptr = FindChannel(name);
} else
- flags = CHFL_DEOPPED | ((cli_flags(sptr) & FLAGS_TS8) ? CHFL_SERVOPOK : 0);
+ flags = CHFL_DEOPPED | (HasFlag(sptr, FLAG_TS8) ? CHFL_SERVOPOK : 0);
}
joinbuf_join(&join, chptr, flags);
Index: ircu2.10/ircd/m_kick.c
diff -u ircu2.10/ircd/m_kick.c:1.6.2.1.8.3 ircu2.10/ircd/m_kick.c:1.6.2.1.8.4
--- ircu2.10/ircd/m_kick.c:1.6.2.1.8.3 Sat Nov 23 09:10:19 2002
+++ ircu2.10/ircd/m_kick.c Sat Nov 23 11:05:08 2002
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_kick.c,v 1.6.2.1.8.3 2002/11/23 17:10:19 klmitch Exp $
+ * $Id: m_kick.c,v 1.6.2.1.8.4 2002/11/23 19:05:08 klmitch Exp $
*/
/*
@@ -109,7 +109,7 @@
struct Membership *member = 0;
char *name, *comment;
- cli_flags(sptr) &= ~FLAGS_TS8;
+ ClrFlag(sptr, FLAG_TS8);
if (parc < 3 || *parv[1] == '\0')
return need_more_params(sptr, "KICK");
@@ -168,7 +168,7 @@
struct Membership *member = 0, *sptr_link = 0;
char *name, *comment;
- cli_flags(sptr) &= ~FLAGS_TS8;
+ ClrFlag(sptr, FLAG_TS8);
if (parc < 3 || *parv[1] == '\0')
return need_more_params(sptr, "KICK");
Index: ircu2.10/ircd/m_kill.c
diff -u ircu2.10/ircd/m_kill.c:1.18.2.9 ircu2.10/ircd/m_kill.c:1.18.2.9.8.1
--- ircu2.10/ircd/m_kill.c:1.18.2.9 Wed Jul 17 15:55:40 2002
+++ ircu2.10/ircd/m_kill.c Sat Nov 23 11:05:08 2002
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_kill.c,v 1.18.2.9 2002/07/17 22:55:40 kev Exp $
+ * $Id: m_kill.c,v 1.18.2.9.8.1 2002/11/23 19:05:08 klmitch Exp $
*/
/*
@@ -135,11 +135,11 @@
inpath, path, msg);
/*
- * Set FLAGS_KILLED. This prevents exit_one_client from sending
+ * Set FLAG_KILLED. This prevents exit_one_client from sending
* the unnecessary QUIT for this. (This flag should never be
* set in any other place)
*/
- cli_flags(victim) |= FLAGS_KILLED;
+ SetFlag(victim, FLAG_KILLED);
}
/*
Index: ircu2.10/ircd/m_map.c
diff -u ircu2.10/ircd/m_map.c:1.9.2.2 ircu2.10/ircd/m_map.c:1.9.2.2.4.1
--- ircu2.10/ircd/m_map.c:1.9.2.2 Sat Sep 14 13:44:32 2002
+++ ircu2.10/ircd/m_map.c Sat Nov 23 11:05:09 2002
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_map.c,v 1.9.2.2 2002/09/14 20:44:32 kev Exp $
+ * $Id: m_map.c,v 1.9.2.2.4.1 2002/11/23 19:05:09 klmitch Exp $
*/
/*
@@ -135,15 +135,15 @@
strcpy(p, "|-");
for (lp = cli_serv(server)->down; lp; lp = lp->next)
if (match(mask, cli_name(lp->value.cptr)))
- cli_flags(lp->value.cptr) &= ~FLAGS_MAP;
+ ClrFlag(lp->value.cptr, FLAG_MAP);
else
{
- cli_flags(lp->value.cptr) |= FLAGS_MAP;
+ SetFlag(lp->value.cptr, FLAG_MAP);
cnt++;
}
for (lp = cli_serv(server)->down; lp; lp = lp->next)
{
- if ((cli_flags(lp->value.cptr) & FLAGS_MAP) == 0)
+ if (!HasFlag(lp->value.cptr, FLAG_MAP))
continue;
if (--cnt == 0)
*p = '`';
Index: ircu2.10/ircd/m_mode.c
diff -u ircu2.10/ircd/m_mode.c:1.8.2.1.8.1 ircu2.10/ircd/m_mode.c:1.8.2.1.8.2
--- ircu2.10/ircd/m_mode.c:1.8.2.1.8.1 Sat Nov 23 09:10:19 2002
+++ ircu2.10/ircd/m_mode.c Sat Nov 23 11:05:09 2002
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_mode.c,v 1.8.2.1.8.1 2002/11/23 17:10:19 klmitch Exp $
+ * $Id: m_mode.c,v 1.8.2.1.8.2 2002/11/23 19:05:09 klmitch Exp $
*/
/*
@@ -115,7 +115,7 @@
if (('#' != *parv[1] && '&' != *parv[1]) || !(chptr = FindChannel(parv[1])))
return set_user_mode(cptr, sptr, parc, parv);
- cli_flags(sptr) &= ~FLAGS_TS8;
+ ClrFlag(sptr, FLAG_TS8);
if (parc < 3) {
char modebuf[MODEBUFLEN];
@@ -167,7 +167,7 @@
if ('#' != *parv[1] || !(chptr = FindChannel(parv[1])))
return set_user_mode(cptr, sptr, parc, parv);
- cli_flags(sptr) &= ~FLAGS_TS8;
+ ClrFlag(sptr, FLAG_TS8);
if (IsServer(sptr)) {
if (find_conf_byhost(cli_confs(cptr), cli_name(sptr), CONF_UWORLD))
Index: ircu2.10/ircd/m_nick.c
diff -u ircu2.10/ircd/m_nick.c:1.17.2.1.8.3 ircu2.10/ircd/m_nick.c:1.17.2.1.8.4
--- ircu2.10/ircd/m_nick.c:1.17.2.1.8.3 Sat Nov 23 03:10:50 2002
+++ ircu2.10/ircd/m_nick.c Sat Nov 23 11:05:09 2002
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_nick.c,v 1.17.2.1.8.3 2002/11/23 11:10:50 isomer Exp $
+ * $Id: m_nick.c,v 1.17.2.1.8.4 2002/11/23 19:05:09 klmitch Exp $
*/
/*
@@ -462,7 +462,7 @@
sptr, cli_name(&me));
assert(!MyConnect(sptr));
- cli_flags(sptr) |= FLAGS_KILLED;
+ SetFlag(sptr, FLAG_KILLED);
exit_client_msg(cptr, sptr, &me,
"Killed (%s (Nick collision))",
@@ -481,7 +481,7 @@
}
++ServerStats->is_kill;
- cli_flags(acptr) |= FLAGS_KILLED;
+ SetFlag(acptr, FLAG_KILLED);
/*
* This exits the client we had before getting the NICK message
*/
Index: ircu2.10/ircd/m_notice.c
diff -u ircu2.10/ircd/m_notice.c:1.7 ircu2.10/ircd/m_notice.c:1.7.10.1
--- ircu2.10/ircd/m_notice.c:1.7 Fri Jun 29 08:51:02 2001
+++ ircu2.10/ircd/m_notice.c Sat Nov 23 11:05:09 2002
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_notice.c,v 1.7 2001/06/29 15:51:02 kev Exp $
+ * $Id: m_notice.c,v 1.7.10.1 2002/11/23 19:05:09 klmitch Exp $
*/
/*
@@ -112,7 +112,7 @@
assert(0 != cptr);
assert(cptr == sptr);
- cli_flags(sptr) &= ~FLAGS_TS8;
+ ClrFlag(sptr, FLAG_TS8);
if (parc < 2 || EmptyString(parv[1]))
return send_reply(sptr, ERR_NORECIPIENT, MSG_NOTICE);
@@ -155,7 +155,7 @@
char* name;
char* server;
- cli_flags(sptr) &= ~FLAGS_TS8;
+ ClrFlag(sptr, FLAG_TS8);
if (parc < 3) {
/*
@@ -202,7 +202,7 @@
assert(0 != cptr);
assert(cptr == sptr);
- cli_flags(sptr) &= ~FLAGS_TS8;
+ ClrFlag(sptr, FLAG_TS8);
if (parc < 2 || EmptyString(parv[1]))
return send_reply(sptr, ERR_NORECIPIENT, MSG_NOTICE);
Index: ircu2.10/ircd/m_oper.c
diff -u ircu2.10/ircd/m_oper.c:1.13.2.1 ircu2.10/ircd/m_oper.c:1.13.2.1.8.1
--- ircu2.10/ircd/m_oper.c:1.13.2.1 Wed Mar 27 11:45:53 2002
+++ ircu2.10/ircd/m_oper.c Sat Nov 23 11:05:09 2002
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_oper.c,v 1.13.2.1 2002/03/27 19:45:53 kev Exp $
+ * $Id: m_oper.c,v 1.13.2.1.8.1 2002/11/23 19:05:09 klmitch Exp $
*/
/*
@@ -152,7 +152,7 @@
assert(0 != (aconf->status & CONF_OPS));
if (oper_password_match(password, aconf->passwd)) {
- unsigned int old_mode = (cli_flags(sptr) & ALL_UMODES);
+ struct Flags old_mode = cli_flags(sptr);
if (ACR_OK != attach_conf(sptr, aconf)) {
send_reply(sptr, ERR_NOOPERHOST);
@@ -175,13 +175,14 @@
}
cli_handler(cptr) = OPER_HANDLER;
-
- cli_flags(sptr) |= (FLAGS_WALLOP | FLAGS_SERVNOTICE | FLAGS_DEBUG);
+ SetFlag(sptr, FLAG_WALLOP);
+ SetFlag(sptr, FLAG_SERVNOTICE);
+ SetFlag(sptr, FLAG_DEBUG);
set_snomask(sptr, SNO_OPERDEFAULT, SNO_ADD);
client_set_privs(sptr);
cli_max_sendq(sptr) = 0; /* Get the sendq from the oper's class */
- send_umode_out(cptr, sptr, old_mode, HasPriv(sptr, PRIV_PROPAGATE));
+ send_umode_out(cptr, sptr, &old_mode, HasPriv(sptr, PRIV_PROPAGATE));
send_reply(sptr, RPL_YOUREOPER);
sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (%c)",
@@ -210,7 +211,7 @@
*/
if (!IsServer(sptr) && !IsOper(sptr)) {
++UserStats.opers;
- cli_flags(sptr) |= FLAGS_OPER;
+ SetFlag(sptr, FLAG_OPER);
sendcmdto_serv_butone(sptr, CMD_MODE, cptr, "%s :+o", parv[0]);
}
return 0;
Index: ircu2.10/ircd/m_part.c
diff -u ircu2.10/ircd/m_part.c:1.5 ircu2.10/ircd/m_part.c:1.5.10.1
--- ircu2.10/ircd/m_part.c:1.5 Fri Jun 29 08:51:02 2001
+++ ircu2.10/ircd/m_part.c Sat Nov 23 11:05:09 2002
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_part.c,v 1.5 2001/06/29 15:51:02 kev Exp $
+ * $Id: m_part.c,v 1.5.10.1 2002/11/23 19:05:09 klmitch Exp $
*/
/*
@@ -109,7 +109,7 @@
char *p = 0;
char *name;
- cli_flags(sptr) &= ~FLAGS_TS8;
+ ClrFlag(sptr, FLAG_TS8);
/* check number of arguments */
if (parc < 2 || parv[1][0] == '\0')
@@ -161,7 +161,7 @@
char *p = 0;
char *name;
- cli_flags(sptr) &= ~FLAGS_TS8;
+ ClrFlag(sptr, FLAG_TS8);
/* check number of arguments */
if (parc < 2 || parv[1][0] == '\0')
Index: ircu2.10/ircd/m_pong.c
diff -u ircu2.10/ircd/m_pong.c:1.12.2.1 ircu2.10/ircd/m_pong.c:1.12.2.1.8.1
--- ircu2.10/ircd/m_pong.c:1.12.2.1 Fri Jun 7 08:56:37 2002
+++ ircu2.10/ircd/m_pong.c Sat Nov 23 11:05:09 2002
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_pong.c,v 1.12.2.1 2002/06/07 15:56:37 vampire Exp $
+ * $Id: m_pong.c,v 1.12.2.1.8.1 2002/11/23 19:05:09 klmitch Exp $
*/
/*
@@ -117,8 +117,8 @@
}
origin = parv[1];
destination = parv[2];
- cli_flags(cptr) &= ~FLAGS_PINGSENT;
- cli_flags(sptr) &= ~FLAGS_PINGSENT;
+ ClrFlag(cptr, FLAG_PINGSENT);
+ ClrFlag(sptr, FLAG_PINGSENT);
cli_lasttime(cptr) = CurrentTime;
if (parc > 5) {
@@ -157,7 +157,7 @@
assert(cptr == sptr);
assert(!IsRegistered(sptr));
- cli_flags(cptr) &= ~FLAGS_PINGSENT;
+ ClrFlag(cptr, FLAG_PINGSENT);
cli_lasttime(cptr) = CurrentTime;
/*
* Check to see if this is a PONG :cookie reply from an
@@ -190,7 +190,7 @@
{
assert(0 != cptr);
assert(cptr == sptr);
- cli_flags(cptr) &= ~FLAGS_PINGSENT;
+ ClrFlag(cptr, FLAG_PINGSENT);
cli_lasttime(cptr) = CurrentTime;
return 0;
}
Index: ircu2.10/ircd/m_privmsg.c
diff -u ircu2.10/ircd/m_privmsg.c:1.7 ircu2.10/ircd/m_privmsg.c:1.7.10.1
--- ircu2.10/ircd/m_privmsg.c:1.7 Fri Jun 29 08:51:02 2001
+++ ircu2.10/ircd/m_privmsg.c Sat Nov 23 11:05:09 2002
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_privmsg.c,v 1.7 2001/06/29 15:51:02 kev Exp $
+ * $Id: m_privmsg.c,v 1.7.10.1 2002/11/23 19:05:09 klmitch Exp $
*/
/*
@@ -111,7 +111,7 @@
assert(cptr == sptr);
assert(0 != cli_user(sptr));
- cli_flags(sptr) &= ~FLAGS_TS8;
+ ClrFlag(sptr, FLAG_TS8);
if (feature_bool(FEAT_IDLE_FROM_MSG))
cli_user(sptr)->last = CurrentTime;
@@ -152,7 +152,7 @@
char* name;
char* server;
- cli_flags(sptr) &= ~FLAGS_TS8;
+ ClrFlag(sptr, FLAG_TS8);
if (parc < 3) {
/*
@@ -201,7 +201,7 @@
assert(cptr == sptr);
assert(0 != cli_user(sptr));
- cli_flags(sptr) &= ~FLAGS_TS8;
+ ClrFlag(sptr, FLAG_TS8);
if (feature_bool(FEAT_IDLE_FROM_MSG))
cli_user(sptr)->last = CurrentTime;
Index: ircu2.10/ircd/m_server.c
diff -u ircu2.10/ircd/m_server.c:1.19.2.3.8.1 ircu2.10/ircd/m_server.c:1.19.2.3.8.2
--- ircu2.10/ircd/m_server.c:1.19.2.3.8.1 Sat Nov 23 04:19:26 2002
+++ ircu2.10/ircd/m_server.c Sat Nov 23 11:05:09 2002
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_server.c,v 1.19.2.3.8.1 2002/11/23 12:19:26 a1kmm Exp $
+ * $Id: m_server.c,v 1.19.2.3.8.2 2002/11/23 19:05:09 klmitch Exp $
*/
/*
@@ -663,7 +663,7 @@
Count_newremoteserver(UserStats);
if (Protocol(acptr) < 10)
- cli_flags(acptr) |= FLAGS_TS8;
+ SetFlag(acptr, FLAG_TS8);
add_client_to_list(acptr);
hAddClient(acptr);
if (*parv[5] == 'J')
@@ -791,7 +791,8 @@
int ret;
int active_lh_line = 0;
unsigned short prot;
- unsigned int serv_flags = 0;
+ unsigned char is_hub = 0;
+ unsigned char is_service = 0;
time_t start_timestamp;
time_t timestamp = 0;
time_t recv_time;
@@ -823,10 +824,10 @@
for (ch = parv[7] + 1; *ch; ch++)
switch (*ch) {
case 'h':
- serv_flags |= FLAGS_HUB;
+ is_hub = 1;
break;
case 's':
- serv_flags |= FLAGS_SERVICE;
+ is_service = 1;
break;
}
}
@@ -1295,7 +1296,10 @@
cli_serv(acptr)->prot = prot;
cli_serv(acptr)->timestamp = timestamp;
cli_hopcount(acptr) = hop;
- cli_flags(acptr) |= serv_flags;
+ if (is_hub)
+ SetFlag(acptr, FLAG_HUB);
+ if (is_service)
+ SetFlag(acptr, FLAG_SERVICE);
ircd_strncpy(cli_name(acptr), host, HOSTLEN);
ircd_strncpy(cli_info(acptr), info, REALLEN);
cli_serv(acptr)->up = sptr;
@@ -1306,7 +1310,7 @@
Count_newremoteserver(UserStats);
if (Protocol(acptr) < 10)
- cli_flags(acptr) |= FLAGS_TS8;
+ SetFlag(acptr, FLAG_TS8);
add_client_to_list(acptr);
hAddClient(acptr);
if (*parv[5] == 'J')
Index: ircu2.10/ircd/m_wallchops.c
diff -u ircu2.10/ircd/m_wallchops.c:1.5 ircu2.10/ircd/m_wallchops.c:1.5.10.1
--- ircu2.10/ircd/m_wallchops.c:1.5 Fri Jun 29 08:51:02 2001
+++ ircu2.10/ircd/m_wallchops.c Sat Nov 23 11:05:09 2002
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_wallchops.c,v 1.5 2001/06/29 15:51:02 kev Exp $
+ * $Id: m_wallchops.c,v 1.5.10.1 2002/11/23 19:05:09 klmitch Exp $
*/
/*
@@ -105,7 +105,7 @@
assert(0 != cptr);
assert(cptr == sptr);
- cli_flags(sptr) &= ~FLAGS_TS8;
+ ClrFlag(sptr, FLAG_TS8);
if (parc < 2 || EmptyString(parv[1]))
return send_reply(sptr, ERR_NORECIPIENT, "WALLCHOPS");
Index: ircu2.10/ircd/m_who.c
diff -u ircu2.10/ircd/m_who.c:1.10.2.8 ircu2.10/ircd/m_who.c:1.10.2.8.4.1
--- ircu2.10/ircd/m_who.c:1.10.2.8 Sat Sep 14 13:44:32 2002
+++ ircu2.10/ircd/m_who.c Sat Nov 23 11:05:09 2002
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_who.c,v 1.10.2.8 2002/09/14 20:44:32 kev Exp $
+ * $Id: m_who.c,v 1.10.2.8.4.1 2002/11/23 19:05:09 klmitch Exp $
*/
/*
@@ -396,7 +396,7 @@
&& ((!(matchsel & WHO_FIELD_UID))
|| matchexec(cli_user(acptr)->username, mymask, minlen))
&& ((!(matchsel & WHO_FIELD_SER))
- || (!(cli_flags(cli_user(acptr)->server) & FLAGS_MAP)))
+ || (!HasFlag(cli_user(acptr)->server, FLAG_MAP)))
&& ((!(matchsel & WHO_FIELD_HOS))
|| matchexec(cli_user(acptr)->host, mymask, minlen))
&& ((!(matchsel & WHO_FIELD_HOS))
@@ -436,7 +436,7 @@
&& ((!(matchsel & WHO_FIELD_UID))
|| matchexec(cli_user(acptr)->username, mymask, minlen))
&& ((!(matchsel & WHO_FIELD_SER))
- || (!(cli_flags(cli_user(acptr)->server) & FLAGS_MAP)))
+ || (!HasFlag(cli_user(acptr)->server, FLAG_MAP)))
&& ((!(matchsel & WHO_FIELD_HOS))
|| matchexec(cli_user(acptr)->host, mymask, minlen))
&& ((!(matchsel & WHO_FIELD_HOS))
Index: ircu2.10/ircd/numnicks.c
diff -u ircu2.10/ircd/numnicks.c:1.16 ircu2.10/ircd/numnicks.c:1.16.10.1
--- ircu2.10/ircd/numnicks.c:1.16 Fri Aug 17 12:10:00 2001
+++ ircu2.10/ircd/numnicks.c Sat Nov 23 11:05:09 2002
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: numnicks.c,v 1.16 2001/08/17 19:10:00 kev Exp $
+ * $Id: numnicks.c,v 1.16.10.1 2002/11/23 19:05:09 klmitch Exp $
*/
#include "config.h"
@@ -331,7 +331,7 @@
/*
* markMatchexServer()
* Mark all servers whose name matches the given (compiled) mask
- * and return their count, abusing FLAGS_MAP for this :)
+ * and return their count, abusing FLAG_MAP for this :)
*/
int markMatchexServer(const char *cmask, int minlen)
{
@@ -342,9 +342,9 @@
for (i = 0; i < lastNNServer; i++) {
if ((acptr = server_list[i])) {
if (matchexec(cli_name(acptr), cmask, minlen))
- cli_flags(acptr) &= ~FLAGS_MAP;
+ ClrFlag(acptr, FLAG_MAP);
else {
- cli_flags(acptr) |= FLAGS_MAP;
+ SetFlag(acptr, FLAG_MAP);
cnt++;
}
}
Index: ircu2.10/ircd/s_bsd.c
diff -u ircu2.10/ircd/s_bsd.c:1.45.2.11 ircu2.10/ircd/s_bsd.c:1.45.2.11.8.1
--- ircu2.10/ircd/s_bsd.c:1.45.2.11 Thu Jul 11 11:58:23 2002
+++ ircu2.10/ircd/s_bsd.c Sat Nov 23 11:05:09 2002
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: s_bsd.c,v 1.45.2.11 2002/07/11 18:58:23 kev Exp $
+ * $Id: s_bsd.c,v 1.45.2.11.8.1 2002/11/23 19:05:09 klmitch Exp $
*/
#include "config.h"
@@ -356,7 +356,7 @@
switch (os_sendv_nonb(cli_fd(cptr), buf, &bytes_count, &bytes_written)) {
case IO_SUCCESS:
- cli_flags(cptr) &= ~FLAGS_BLOCKED;
+ SetFlag(cptr, FLAG_BLOCKED);
cli_sendB(cptr) += bytes_written;
cli_sendB(&me) += bytes_written;
@@ -373,14 +373,14 @@
* say it was blocked
*/
if (bytes_written < bytes_count)
- cli_flags(cptr) |= FLAGS_BLOCKED;
+ SetFlag(cptr, FLAG_BLOCKED);
break;
case IO_BLOCKED:
- cli_flags(cptr) |= FLAGS_BLOCKED;
+ SetFlag(cptr, FLAG_BLOCKED);
break;
case IO_FAILURE:
cli_error(cptr) = errno;
- cli_flags(cptr) |= FLAGS_DEADSOCKET;
+ SetFlag(cptr, FLAG_DEADSOCKET);
break;
}
return bytes_written;
@@ -458,7 +458,7 @@
* Make us timeout after twice the timeout for DNS look ups
*/
cli_lasttime(cptr) = CurrentTime;
- cli_flags(cptr) |= FLAGS_PINGSENT;
+ SetFlag(cptr, FLAG_PINGSENT);
sendrawto_one(cptr, MSG_SERVER " %s 1 %Tu %Tu J%s %s%s +%s :%s",
cli_name(&me), cli_serv(&me)->timestamp, newts,
@@ -538,7 +538,7 @@
socket_del(&(cli_socket(cptr))); /* queue a socket delete */
cli_fd(cptr) = -1;
}
- cli_flags(cptr) |= FLAGS_DEADSOCKET;
+ SetFlag(cptr, FLAG_DEADSOCKET);
MsgQClear(&(cli_sendQ(cptr)));
client_drop_sendq(cli_connect(cptr));
@@ -707,14 +707,15 @@
cli_lasttime(cptr) = CurrentTime;
if (cli_lasttime(cptr) > cli_since(cptr))
cli_since(cptr) = cli_lasttime(cptr);
- cli_flags(cptr) &= ~(FLAGS_PINGSENT | FLAGS_NONL);
+ ClrFlag(cptr, FLAG_PINGSENT);
+ ClrFlag(cptr, FLAG_NONL);
}
break;
case IO_BLOCKED:
break;
case IO_FAILURE:
cli_error(cptr) = errno;
- /* cptr->flags |= FLAGS_DEADSOCKET; */
+ /* SetFlag(cptr, FLAG_DEADSOCKET); */
return 0;
}
}
@@ -755,7 +756,7 @@
if (dolen == 0)
{
if (DBufLength(&(cli_recvQ(cptr))) < 510)
- cli_flags(cptr) |= FLAGS_NONL;
+ SetFlag(cptr, FLAG_NONL);
else
DBufClear(&(cli_recvQ(cptr)));
}
@@ -775,7 +776,7 @@
else if (dolen == 0)
{
if (DBufLength(&(cli_recvQ(cptr))) < 510)
- cli_flags(cptr) |= FLAGS_NONL;
+ SetFlag(cptr, FLAG_NONL);
else
DBufClear(&(cli_recvQ(cptr)));
}
@@ -1020,7 +1021,7 @@
case ET_EOF: /* end of file on socket */
Debug((DEBUG_ERROR, "READ ERROR: fd = %d %d", cli_fd(cptr),
cli_error(cptr)));
- cli_flags(cptr) |= FLAGS_DEADSOCKET;
+ SetFlag(cptr, FLAG_DEADSOCKET);
if ((IsServer(cptr) || IsHandshake(cptr)) && cli_error(cptr) == 0) {
exit_client_msg(cptr, cptr, &me, "Server %s closed the connection (%s)",
cli_name(cptr), cli_serv(cptr)->last_error_msg);
@@ -1032,7 +1033,7 @@
break;
case ET_WRITE: /* socket is writable */
- cli_flags(cptr) &= ~FLAGS_BLOCKED;
+ ClrFlag(cptr, FLAG_BLOCKED);
if (cli_listing(cptr) && MsgQLength(&(cli_sendQ(cptr))) < 2048)
list_next_channels(cptr, 64);
Debug((DEBUG_SEND, "Sending queued data to %C", cptr));
Index: ircu2.10/ircd/s_conf.c
diff -u ircu2.10/ircd/s_conf.c:1.44.2.3 ircu2.10/ircd/s_conf.c:1.44.2.3.8.1
--- ircu2.10/ircd/s_conf.c:1.44.2.3 Fri May 17 09:42:19 2002
+++ ircu2.10/ircd/s_conf.c Sat Nov 23 11:05:09 2002
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: s_conf.c,v 1.44.2.3 2002/05/17 16:42:19 kev Exp $
+ * $Id: s_conf.c,v 1.44.2.3.8.1 2002/11/23 19:05:09 klmitch Exp $
*/
#include "config.h"
@@ -397,7 +397,7 @@
uhost[sizeof(uhost) - 1] = 0;
if (0 == match(aconf->name, uhost)) {
if (strchr(uhost, '@'))
- cli_flags(cptr) |= FLAGS_DOID;
+ SetFlag(cptr, FLAG_DOID);
return check_limit_and_attach(cptr, aconf);
}
}
@@ -414,7 +414,7 @@
if (match(aconf->host, uhost))
continue;
if (strchr(uhost, '@'))
- cli_flags(cptr) |= FLAGS_DOID;
+ SetFlag(cptr, FLAG_DOID);
return check_limit_and_attach(cptr, aconf);
}
Index: ircu2.10/ircd/s_misc.c
diff -u ircu2.10/ircd/s_misc.c:1.24.2.7 ircu2.10/ircd/s_misc.c:1.24.2.7.4.1
--- ircu2.10/ircd/s_misc.c:1.24.2.7 Sat Sep 14 13:44:32 2002
+++ ircu2.10/ircd/s_misc.c Sat Nov 23 11:05:09 2002
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: s_misc.c,v 1.24.2.7 2002/09/14 20:44:32 kev Exp $
+ * $Id: s_misc.c,v 1.24.2.7.4.1 2002/11/23 19:05:09 klmitch Exp $
*/
#include "config.h"
@@ -391,7 +391,7 @@
char comment1[HOSTLEN + HOSTLEN + 2];
assert(killer);
if (MyConnect(victim)) {
- cli_flags(victim) |= FLAGS_CLOSING;
+ SetFlag(victim, FLAG_CLOSING);
if (feature_bool(FEAT_CONNEXIT_NOTICES) && IsUser(victim))
sendto_opmask_butone(0, SNO_CONNEXIT,
@@ -494,7 +494,7 @@
if (IsServer(victim))
sendcmdto_one(killer, CMD_SQUIT, dlp->value.cptr, "%s %Tu :%s",
cli_name(victim), cli_serv(victim)->timestamp, comment);
- else if (IsUser(victim) && 0 == (cli_flags(victim) & FLAGS_KILLED))
+ else if (IsUser(victim) && !HasFlag(victim, FLAG_KILLED))
sendcmdto_one(victim, CMD_QUIT, dlp->value.cptr, ":%s", comment);
}
}
Index: ircu2.10/ircd/s_user.c
diff -u ircu2.10/ircd/s_user.c:1.52.2.13.2.2 ircu2.10/ircd/s_user.c:1.52.2.13.2.3
--- ircu2.10/ircd/s_user.c:1.52.2.13.2.2 Fri Nov 22 21:50:33 2002
+++ ircu2.10/ircd/s_user.c Sat Nov 23 11:05:09 2002
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: s_user.c,v 1.52.2.13.2.2 2002/11/23 05:50:33 isomer Exp $
+ * $Id: s_user.c,v 1.52.2.13.2.3 2002/11/23 19:05:09 klmitch Exp $
*/
#include "config.h"
@@ -420,8 +420,8 @@
aconf = cli_confs(sptr)->value.aconf;
clean_user_id(user->username,
- (cli_flags(sptr) & FLAGS_GOTID) ? cli_username(sptr) : username,
- (cli_flags(sptr) & FLAGS_DOID) && !(cli_flags(sptr) & FLAGS_GOTID));
+ HasFlag(sptr, FLAG_GOTID) ? cli_username(sptr) : username,
+ HasFlag(sptr, FLAG_DOID) && !HasFlag(sptr, FLAG_GOTID));
if ((user->username[0] == '\0')
|| ((user->username[0] == '~') && (user->username[1] == '\000')))
@@ -509,7 +509,7 @@
else if ((!lower && !upper) || !IsAlnum(c))
badid = 1;
}
- if (badid && (!(cli_flags(sptr) & FLAGS_GOTID) ||
+ if (badid && (!HasFlag(sptr, FLAG_GOTID) ||
strcmp(cli_username(sptr), username) != 0))
{
ServerStats->is_ref++;
@@ -580,11 +580,12 @@
sendcmdto_one(&me, CMD_KILL, cptr, "%C :%s (%s != %s[%s])",
sptr, cli_name(&me), cli_name(user->server),
cli_name(cli_from(acptr)),
cli_sockhost(cli_from(acptr)));
- cli_flags(sptr) |= FLAGS_KILLED;
+ SetFlag(sptr, FLAG_KILLED);
return exit_client(cptr, sptr, &me, "NICK server wrong direction");
}
else
- cli_flags(sptr) |= (cli_flags(acptr) & FLAGS_TS8);
+ if (HasFlag(acptr, FLAG_TS8))
+ SetFlag(sptr, FLAG_TS8);
/*
* Check to see if this user is being propogated
@@ -618,8 +619,9 @@
/* Send umode to client */
if (MyUser(sptr))
{
- send_umode(cptr, sptr, 0, ALL_UMODES);
- if (cli_snomask(sptr) != SNO_DEFAULT && (cli_flags(sptr) & FLAGS_SERVNOTICE))
+ static struct Flags flags; /* automatically initialized to zeros */
+ send_umode(cptr, sptr, &flags, ALL_UMODES);
+ if (cli_snomask(sptr) != SNO_DEFAULT && HasFlag(sptr, FLAG_SERVNOTICE))
send_reply(sptr, RPL_SNOMASK, cli_snomask(sptr), cli_snomask(sptr));
}
@@ -631,16 +633,16 @@
unsigned int flag;
char c;
} userModeList[] = {
- { FLAGS_OPER, 'o' },
- { FLAGS_LOCOP, 'O' },
- { FLAGS_INVISIBLE, 'i' },
- { FLAGS_WALLOP, 'w' },
- { FLAGS_SERVNOTICE, 's' },
- { FLAGS_DEAF, 'd' },
- { FLAGS_CHSERV, 'k' },
- { FLAGS_DEBUG, 'g' },
- { FLAGS_ACCOUNT, 'r' },
- { FLAGS_HIDDENHOST, 'x' }
+ { FLAG_OPER, 'o' },
+ { FLAG_LOCOP, 'O' },
+ { FLAG_INVISIBLE, 'i' },
+ { FLAG_WALLOP, 'w' },
+ { FLAG_SERVNOTICE, 's' },
+ { FLAG_DEAF, 'd' },
+ { FLAG_CHSERV, 'k' },
+ { FLAG_DEBUG, 'g' },
+ { FLAG_ACCOUNT, 'r' },
+ { FLAG_HIDDENHOST, 'x' }
};
#define USERMODELIST_SIZE sizeof(userModeList) / sizeof(struct UserMode)
@@ -670,8 +672,8 @@
for (p = parv[6] + 1; *p; p++) {
for (i = 0; i < USERMODELIST_SIZE; ++i) {
if (userModeList[i].c == *p) {
- cli_flags(new_client) |= userModeList[i].flag;
- if (userModeList[i].flag & FLAGS_ACCOUNT)
+ SetFlag(new_client, userModeList[i].flag);
+ if (userModeList[i].flag == FLAG_ACCOUNT)
account = parv[7];
break;
}
@@ -984,13 +986,13 @@
/*
* added Sat Jul 25 07:30:42 EST 1992
*/
-void send_umode_out(struct Client *cptr, struct Client *sptr, int old,
+void send_umode_out(struct Client *cptr, struct Client *sptr, struct Flags *old,
int prop)
{
int i;
struct Client *acptr;
- send_umode(NULL, sptr, old, SEND_UMODES & ~(prop ? 0 : FLAGS_OPER));
+ send_umode(NULL, sptr, old, prop ? SEND_UMODES : SEND_UMODES_BUT_OPER);
for (i = HighestFd; i >= 0; i--) {
if ((acptr = LocalClientArray[i]) && IsServer(acptr) &&
@@ -1041,26 +1043,24 @@
* If, after setting the flags, the user has both HiddenHost and Account
* set, its hostmask is changed.
*/
-#define FLAGS_HOST_HIDDEN (FLAGS_ACCOUNT|FLAGS_HIDDENHOST)
-int hide_hostmask(struct Client *cptr, unsigned int flags)
+int hide_hostmask(struct Client *cptr, unsigned int flag)
{
struct Membership *chan;
- int newflags;
- if (MyConnect(cptr) && !feature_bool(FEAT_HOST_HIDING))
- flags &= ~FLAGS_HIDDENHOST;
+ if (MyConnect(cptr) && !feature_bool(FEAT_HOST_HIDING) && (flag == FLAG_HIDDENHOST))
+ return 0;
- newflags = cli_flags(cptr) | flags;
- if ((newflags & FLAGS_HOST_HIDDEN) != FLAGS_HOST_HIDDEN) {
+ if (((flag == FLAG_HIDDENHOST) && !HasFlag(cptr, FLAG_ACCOUNT))
+ || ((flag == FLAG_ACCOUNT) && !HasFlag(cptr, FLAG_HIDDENHOST))) {
/* The user doesn't have both flags, don't change the hostmask */
- cli_flags(cptr) |= flags;
+ SetFlag(cptr, flag);
return 0;
}
sendcmdto_common_channels_butone(cptr, CMD_QUIT, cptr, ":Registered");
ircd_snprintf(0, cli_user(cptr)->host, HOSTLEN, "%s.%s",
cli_user(cptr)->account, feature_str(FEAT_HIDDEN_HOST));
- cli_flags(cptr) |= flags;
+ SetFlag(cptr, flag);
/*
* Go through all channels the client was on, rejoin him
@@ -1095,7 +1095,7 @@
struct Client *acptr;
int what;
int i;
- int setflags;
+ struct Flags setflags;
unsigned int tmpmask = 0;
int snomask_given = 0;
char buf[BUFSIZE];
@@ -1130,13 +1130,13 @@
m = buf;
*m++ = '+';
for (i = 0; i < USERMODELIST_SIZE; ++i) {
- if ((userModeList[i].flag & cli_flags(sptr)) &&
- !(userModeList[i].flag & FLAGS_ACCOUNT))
+ if (HasFlag(sptr, userModeList[i].flag) &&
+ (userModeList[i].flag != FLAG_ACCOUNT))
*m++ = userModeList[i].c;
}
*m = '\0';
send_reply(sptr, RPL_UMODEIS, buf);
- if ((cli_flags(sptr) & FLAGS_SERVNOTICE) && MyConnect(sptr)
+ if (HasFlag(sptr, FLAG_SERVNOTICE) && MyConnect(sptr)
&& cli_snomask(sptr) !=
(unsigned int)(IsOper(sptr) ? SNO_OPERDEFAULT : SNO_DEFAULT))
send_reply(sptr, RPL_SNOMASK, cli_snomask(sptr), cli_snomask(sptr));
@@ -1188,7 +1188,8 @@
if (what == MODE_ADD)
SetOper(sptr);
else {
- cli_flags(sptr) &= ~(FLAGS_OPER | FLAGS_LOCOP);
+ ClrFlag(sptr, FLAG_OPER);
+ ClrFlag(sptr, FLAG_LOCOP);
if (MyConnect(sptr)) {
tmpmask = cli_snomask(sptr) & ~SNO_OPER;
cli_handler(sptr) = CLIENT_HANDLER;
@@ -1198,8 +1199,9 @@
case 'O':
if (what == MODE_ADD)
SetLocOp(sptr);
- else {
- cli_flags(sptr) &= ~(FLAGS_OPER | FLAGS_LOCOP);
+ else {
+ ClrFlag(sptr, FLAG_OPER);
+ ClrFlag(sptr, FLAG_LOCOP);
if (MyConnect(sptr)) {
tmpmask = cli_snomask(sptr) & ~SNO_OPER;
cli_handler(sptr) = CLIENT_HANDLER;
@@ -1246,36 +1248,37 @@
* Stop users making themselves operators too easily:
*/
if (!IsServer(cptr)) {
- if (!(setflags & FLAGS_OPER) && IsOper(sptr))
+ if (!FlagHas(&setflags, FLAG_OPER) && IsOper(sptr))
ClearOper(sptr);
- if (!(setflags & FLAGS_LOCOP) && IsLocOp(sptr))
+ if (!FlagHas(&setflags, FLAG_LOCOP) && IsLocOp(sptr))
ClearLocOp(sptr);
/*
* new umode; servers can set it, local users cannot;
* prevents users from /kick'ing or /mode -o'ing
*/
- if (!(setflags & FLAGS_CHSERV))
+ if (!FlagHas(&setflags, FLAG_CHSERV))
ClearChannelService(sptr);
/*
* only send wallops to opers
*/
if (feature_bool(FEAT_WALLOPS_OPER_ONLY) && !IsAnOper(sptr) &&
- !(setflags & FLAGS_WALLOP))
+ !FlagHas(&setflags, FLAG_WALLOP))
ClearWallops(sptr);
if (feature_bool(FEAT_HIS_SNOTICES_OPER_ONLY) && MyConnect(sptr) &&
- !IsAnOper(sptr) && !(setflags & FLAGS_SERVNOTICE)) {
+ !IsAnOper(sptr) && !FlagHas(&setflags, FLAG_SERVNOTICE)) {
ClearServNotice(sptr);
set_snomask(sptr, 0, SNO_SET);
}
if (feature_bool(FEAT_HIS_DEBUG_OPER_ONLY) && !IsAnOper(sptr) &&
- !(setflags & FLAGS_DEBUG))
+ !FlagHas(&setflags, FLAG_DEBUG))
ClearDebug(sptr);
}
if (MyConnect(sptr)) {
- if ((setflags & (FLAGS_OPER | FLAGS_LOCOP)) && !IsAnOper(sptr))
+ if ((FlagHas(&setflags, FLAG_OPER) || FlagHas(&setflags, FLAG_LOCOP)) &&
+ !IsAnOper(sptr))
det_confs_butmask(sptr, CONF_CLIENT & ~CONF_OPS);
if (SendServNotice(sptr)) {
@@ -1290,23 +1293,23 @@
* Compare new flags with old flags and send string which
* will cause servers to update correctly.
*/
- if (!(setflags & FLAGS_OPER) && IsOper(sptr)) { /* user now oper */
+ if (!FlagHas(&setflags, FLAG_OPER) && IsOper(sptr)) { /* user now oper */
++UserStats.opers;
client_set_privs(sptr); /* may set propagate privilege */
}
if (HasPriv(sptr, PRIV_PROPAGATE)) /* remember propagate privilege setting */
prop = 1;
- if ((setflags & FLAGS_OPER) && !IsOper(sptr)) { /* user no longer oper */
+ if (FlagHas(&setflags, FLAG_OPER) && !IsOper(sptr)) { /* user no longer oper */
--UserStats.opers;
client_set_privs(sptr); /* will clear propagate privilege */
}
- if ((setflags & FLAGS_INVISIBLE) && !IsInvisible(sptr))
+ if (FlagHas(&setflags, FLAG_INVISIBLE) && !IsInvisible(sptr))
--UserStats.inv_clients;
- if (!(setflags & FLAGS_INVISIBLE) && IsInvisible(sptr))
+ if (!FlagHas(&setflags, FLAG_INVISIBLE) && IsInvisible(sptr))
++UserStats.inv_clients;
- if (!(setflags & FLAGS_HIDDENHOST) && do_host_hiding)
- hide_hostmask(sptr, FLAGS_HIDDENHOST);
- send_umode_out(cptr, sptr, setflags, prop);
+ if (!FlagHas(&setflags, FLAG_HIDDENHOST) && do_host_hiding)
+ hide_hostmask(sptr, FLAG_HIDDENHOST);
+ send_umode_out(cptr, sptr, &setflags, prop);
return 0;
}
@@ -1317,18 +1320,19 @@
*/
char *umode_str(struct Client *cptr)
{
- char* m = umodeBuf; /* Maximum string size: "owidg\0" */
+ char* m = umodeBuf; /* Maximum string size: "owidgrx\0" */
int i;
- int c_flags;
+ struct Flags c_flags;
- c_flags = cli_flags(cptr) & SEND_UMODES; /* cleaning up the original code */
+ c_flags = cli_flags(cptr);
if (HasPriv(cptr, PRIV_PROPAGATE))
- c_flags |= FLAGS_OPER;
+ FlagSet(&c_flags, FLAG_OPER);
else
- c_flags &= ~FLAGS_OPER;
+ FlagClr(&c_flags, FLAG_OPER);
for (i = 0; i < USERMODELIST_SIZE; ++i) {
- if ( (c_flags & userModeList[i].flag))
+ if (FlagHas(&c_flags, userModeList[i].flag) &&
+ (userModeList[i].flag >= FLAG_GLOBAL_UMODES))
*m++ = userModeList[i].c;
}
@@ -1347,10 +1351,10 @@
}
/*
- * Send the MODE string for user (user) to connection cptr
+ * Send the MODE string for user (sptr) to connection cptr
* -avalon
*/
-void send_umode(struct Client *cptr, struct Client *sptr, int old, int sendmask)
+void send_umode(struct Client *cptr, struct Client *sptr, struct Flags *old, int
+sendset)
{
int i;
int flag;
@@ -1359,15 +1363,29 @@
/*
* Build a string in umodeBuf to represent the change in the user's
- * mode between the new (sptr->flag) and 'old'.
+ * mode between the new (cli_flags(sptr)) and 'old', but skipping
+ * the modes indicated by sendset.
*/
m = umodeBuf;
*m = '\0';
for (i = 0; i < USERMODELIST_SIZE; ++i) {
flag = userModeList[i].flag;
- if (MyUser(sptr) && !(flag & sendmask))
+ if (FlagHas(old, flag) == HasFlag(sptr, flag))
continue;
- if ( (flag & old) && !(cli_flags(sptr) & flag))
+ switch (sendset)
+ {
+ case ALL_UMODES:
+ break;
+ case SEND_UMODES_BUT_OPER:
+ if (flag == FLAG_OPER)
+ continue;
+ /* and fall through */
+ case SEND_UMODES:
+ if (flag < FLAG_GLOBAL_UMODES)
+ continue;
+ break;
+ }
+ if (FlagHas(old, flag))
{
if (what == MODE_DEL)
*m++ = userModeList[i].c;
@@ -1378,7 +1396,7 @@
*m++ = userModeList[i].c;
}
}
- else if (!(flag & old) && (cli_flags(sptr) & flag))
+ else /* !FlagHas(old, flag) */
{
if (what == MODE_ADD)
*m++ = userModeList[i].c;
Index: ircu2.10/ircd/send.c
diff -u ircu2.10/ircd/send.c:1.44.2.8 ircu2.10/ircd/send.c:1.44.2.8.8.1
--- ircu2.10/ircd/send.c:1.44.2.8 Fri Aug 30 09:12:24 2002
+++ ircu2.10/ircd/send.c Sat Nov 23 11:05:10 2002
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: send.c,v 1.44.2.8 2002/08/30 16:12:24 kev Exp $
+ * $Id: send.c,v 1.44.2.8.8.1 2002/11/23 19:05:10 klmitch Exp $
*/
#include "config.h"
@@ -57,7 +57,7 @@
*
* An error has been detected. The link *must* be closed,
* but *cannot* call ExitClient (m_bye) from here.
- * Instead, mark it with FLAGS_DEADSOCKET. This should
+ * Instead, mark it with FLAG_DEADSOCKET. This should
* generate ExitClient from the main loop.
*
* If 'notice' is not NULL, it is assumed to be a format
@@ -71,7 +71,7 @@
static void dead_link(struct Client *to, char *notice)
{
- cli_flags(to) |= FLAGS_DEADSOCKET;
+ SetFlag(to, FLAG_DEADSOCKET);
/*
* If because of BUFFERPOOL problem then clean dbuf's now so that
* notices don't hurt operators below.
@@ -85,7 +85,7 @@
*/
ircd_strncpy(cli_info(to), notice, REALLEN);
- if (!IsUser(to) && !IsUnknown(to) && !(cli_flags(to) & FLAGS_CLOSING))
+ if (!IsUser(to) && !IsUnknown(to) && !HasFlag(to, FLAG_CLOSING))
sendto_opmask_butone(0, SNO_OLDSNO, "%s for %s", cli_info(to), cli_name(to));
Debug((DEBUG_ERROR, cli_info(to)));
}
@@ -554,11 +554,11 @@
for (i = 0; i <= HighestFd; i++) {
if (!(cptr = LocalClientArray[i]) ||
(cli_fd(cli_from(cptr)) < 0) ||
- (type == WALL_DESYNCH && !(cli_flags(cptr) & FLAGS_DEBUG)) ||
+ (type == WALL_DESYNCH && !HasFlag(cptr, FLAG_DEBUG)) ||
(type == WALL_WALLOPS &&
- (!(cli_flags(cptr) & FLAGS_WALLOP) ||
+ (!HasFlag(cptr, FLAG_WALLOP) ||
(feature_bool(FEAT_HIS_WALLOPS) && !IsAnOper(cptr)))) ||
- (type == WALL_WALLUSERS && !(cli_flags(cptr) & FLAGS_WALLOP)))
+ (type == WALL_WALLUSERS && !HasFlag(cptr, FLAG_WALLOP)))
continue; /* skip it */
send_buffer(cptr, mb, 1);
}
----------------------- End of diff -----------------------