src/flags.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  flag_record

Defines

#define FR_GLOBAL   0x00000001
#define FR_BOT   0x00000002
#define FR_CHAN   0x00000004
#define FR_OR   0x40000000
#define FR_AND   0x20000000
#define FR_ANYWH   0x10000000
#define FR_ALL   0x0fffffff
#define USER_VALID   0x03fbfeff
#define CHAN_VALID   0x03777c79
#define BOT_VALID   0x7fe689C1
#define USER_AUTOOP   0x00000001
#define USER_BOT   0x00000002
#define USER_COMMON   0x00000004
#define USER_DEOP   0x00000008
#define USER_EXEMPT   0x00000010
#define USER_FRIEND   0x00000020
#define USER_GVOICE   0x00000040
#define USER_HIGHLITE   0x00000080
#define USER_I   0x00000100
#define USER_JANITOR   0x00000200
#define USER_KICK   0x00000400
#define USER_HALFOP   0x00000800
#define USER_MASTER   0x00001000
#define USER_OWNER   0x00002000
#define USER_OP   0x00004000
#define USER_PARTY   0x00008000
#define USER_QUIET   0x00010000
#define USER_DEHALFOP   0x00020000
#define USER_S   0x00040000
#define USER_BOTMAST   0x00080000
#define USER_UNSHARED   0x00100000
#define USER_VOICE   0x00200000
#define USER_WASOPTEST   0x00400000
#define USER_XFER   0x00800000
#define USER_AUTOHALFOP   0x01000000
#define USER_WASHALFOPTEST   0x02000000
#define USER_DEFAULT   0x40000000
#define BOT_ALT   0x00000001
#define BOT_BOT   0x00000002
#define BOT_C   0x00000004
#define BOT_D   0x00000008
#define BOT_E   0x00000010
#define BOT_F   0x00000020
#define BOT_GLOBAL   0x00000040
#define BOT_HUB   0x00000080
#define BOT_ISOLATE   0x00000100
#define BOT_J   0x00000200
#define BOT_K   0x00000400
#define BOT_LEAF   0x00000800
#define BOT_M   0x00001000
#define BOT_N   0x00002000
#define BOT_O   0x00004000
#define BOT_PASSIVE   0x00008000
#define BOT_Q   0x00010000
#define BOT_REJECT   0x00020000
#define BOT_AGGRESSIVE   0x00040000
#define BOT_T   0x00080000
#define BOT_U   0x00100000
#define BOT_V   0x00200000
#define BOT_W   0x00400000
#define BOT_X   0x00800000
#define BOT_Y   0x01000000
#define BOT_Z   0x02000000
#define BOT_FLAG0   0x00200000
#define BOT_FLAG1   0x00400000
#define BOT_FLAG2   0x00800000
#define BOT_FLAG3   0x01000000
#define BOT_FLAG4   0x02000000
#define BOT_FLAG5   0x04000000
#define BOT_FLAG6   0x08000000
#define BOT_FLAG7   0x10000000
#define BOT_FLAG8   0x20000000
#define BOT_FLAG9   0x40000000
#define BOT_SHARE   (BOT_AGGRESSIVE|BOT_PASSIVE)
#define chan_op(x)   ((x).chan & USER_OP)
#define glob_op(x)   ((x).global & USER_OP)
#define chan_halfop(x)   ((x).chan & USER_HALFOP)
#define glob_halfop(x)   ((x).global & USER_HALFOP)
#define chan_deop(x)   ((x).chan & USER_DEOP)
#define glob_deop(x)   ((x).global & USER_DEOP)
#define chan_dehalfop(x)   ((x).chan & USER_DEHALFOP)
#define glob_dehalfop(x)   ((x).global & USER_DEHALFOP)
#define glob_master(x)   ((x).global & USER_MASTER)
#define glob_bot(x)   ((x).global & USER_BOT)
#define glob_owner(x)   ((x).global & USER_OWNER)
#define chan_master(x)   ((x).chan & USER_MASTER)
#define chan_owner(x)   ((x).chan & USER_OWNER)
#define chan_autoop(x)   ((x).chan & USER_AUTOOP)
#define glob_autoop(x)   ((x).global & USER_AUTOOP)
#define chan_autohalfop(x)   ((x).chan & USER_AUTOHALFOP)
#define glob_autohalfop(x)   ((x).global & USER_AUTOHALFOP)
#define chan_gvoice(x)   ((x).chan & USER_GVOICE)
#define glob_gvoice(x)   ((x).global & USER_GVOICE)
#define chan_kick(x)   ((x).chan & USER_KICK)
#define glob_kick(x)   ((x).global & USER_KICK)
#define chan_voice(x)   ((x).chan & USER_VOICE)
#define glob_voice(x)   ((x).global & USER_VOICE)
#define chan_wasoptest(x)   ((x).chan & USER_WASOPTEST)
#define glob_wasoptest(x)   ((x).global & USER_WASOPTEST)
#define chan_washalfoptest(x)   ((x).chan & USER_WASHALFOPTEST)
#define glob_washalfoptest(x)   ((x).global & USER_WASHALFOPTEST)
#define chan_quiet(x)   ((x).chan & USER_QUIET)
#define glob_quiet(x)   ((x).global & USER_QUIET)
#define chan_friend(x)   ((x).chan & USER_FRIEND)
#define glob_friend(x)   ((x).global & USER_FRIEND)
#define glob_botmast(x)   ((x).global & USER_BOTMAST)
#define glob_party(x)   ((x).global & USER_PARTY)
#define glob_xfer(x)   ((x).global & USER_XFER)
#define glob_hilite(x)   ((x).global & USER_HIGHLITE)
#define chan_exempt(x)   ((x).chan & USER_EXEMPT)
#define glob_exempt(x)   ((x).global & USER_EXEMPT)
#define bot_global(x)   ((x).bot & BOT_GLOBAL)
#define bot_chan(x)   ((x).chan & BOT_AGGRESSIVE)
#define bot_shared(x)   ((x).bot & BOT_SHARE)

Functions

void get_user_flagrec (struct userrec *, struct flag_record *, const char *)
void set_user_flagrec (struct userrec *, struct flag_record *, const char *)
void break_down_flags (const char *, struct flag_record *, struct flag_record *)
int build_flags (char *, struct flag_record *, struct flag_record *)
int flagrec_eq (struct flag_record *, struct flag_record *)
int flagrec_ok (struct flag_record *, struct flag_record *)
int sanity_check (int)
int chan_sanity_check (int, int)
char geticon (int)

Define Documentation

#define BOT_AGGRESSIVE   0x00040000
#define BOT_ALT   0x00000001

Definition at line 92 of file flags.h.

Referenced by botfl_set(), and cont_link().

#define BOT_BOT   0x00000002

Definition at line 93 of file flags.h.

Referenced by cmd_botattr().

#define BOT_C   0x00000004

Definition at line 94 of file flags.h.

#define bot_chan (  )     ((x).chan & BOT_AGGRESSIVE)
#define BOT_D   0x00000008

Definition at line 95 of file flags.h.

#define BOT_E   0x00000010

Definition at line 96 of file flags.h.

#define BOT_F   0x00000020

Definition at line 97 of file flags.h.

#define BOT_FLAG0   0x00200000

Definition at line 118 of file flags.h.

Referenced by break_down_flags().

#define BOT_FLAG1   0x00400000

Definition at line 119 of file flags.h.

#define BOT_FLAG2   0x00800000

Definition at line 120 of file flags.h.

#define BOT_FLAG3   0x01000000

Definition at line 121 of file flags.h.

#define BOT_FLAG4   0x02000000

Definition at line 122 of file flags.h.

#define BOT_FLAG5   0x04000000

Definition at line 123 of file flags.h.

#define BOT_FLAG6   0x08000000

Definition at line 124 of file flags.h.

#define BOT_FLAG7   0x10000000

Definition at line 125 of file flags.h.

#define BOT_FLAG8   0x20000000

Definition at line 126 of file flags.h.

#define BOT_FLAG9   0x40000000

Definition at line 127 of file flags.h.

#define bot_global (  )     ((x).bot & BOT_GLOBAL)
#define BOT_GLOBAL   0x00000040
#define BOT_HUB   0x00000080

Definition at line 99 of file flags.h.

Referenced by botfl_set(), and cont_link().

#define BOT_ISOLATE   0x00000100
#define BOT_J   0x00000200

Definition at line 101 of file flags.h.

#define BOT_K   0x00000400

Definition at line 102 of file flags.h.

#define BOT_LEAF   0x00000800

Definition at line 103 of file flags.h.

Referenced by bot_nlinked(), bot_thisbot(), check_dcc_attrs(), and greet_new_bot().

#define BOT_M   0x00001000

Definition at line 104 of file flags.h.

#define BOT_N   0x00002000

Definition at line 105 of file flags.h.

#define BOT_O   0x00004000

Definition at line 106 of file flags.h.

#define BOT_PASSIVE   0x00008000

Definition at line 107 of file flags.h.

Referenced by share_userfileq().

#define BOT_Q   0x00010000

Definition at line 108 of file flags.h.

#define BOT_REJECT   0x00020000

Definition at line 109 of file flags.h.

Referenced by bot_nlinked(), botfl_set(), and greet_new_bot().

#define BOT_SHARE   (BOT_AGGRESSIVE|BOT_PASSIVE)
#define bot_shared (  )     ((x).bot & BOT_SHARE)

Definition at line 172 of file flags.h.

#define BOT_T   0x00080000

Definition at line 111 of file flags.h.

#define BOT_U   0x00100000

Definition at line 112 of file flags.h.

#define BOT_V   0x00200000

Definition at line 113 of file flags.h.

#define BOT_VALID   0x7fe689C1

Definition at line 60 of file flags.h.

Referenced by botfl_set(), and break_down_flags().

#define BOT_W   0x00400000

Definition at line 114 of file flags.h.

#define BOT_X   0x00800000

Definition at line 115 of file flags.h.

#define BOT_Y   0x01000000

Definition at line 116 of file flags.h.

#define BOT_Z   0x02000000

Definition at line 117 of file flags.h.

#define chan_autohalfop (  )     ((x).chan & USER_AUTOHALFOP)

Definition at line 147 of file flags.h.

Referenced by check_this_member(), cmd_channel(), got_halfop(), and gotjoin().

#define chan_autoop (  )     ((x).chan & USER_AUTOOP)

Definition at line 145 of file flags.h.

Referenced by check_this_member(), cmd_channel(), got_op(), and gotjoin().

#define chan_dehalfop (  )     ((x).chan & USER_DEHALFOP)
#define chan_deop (  )     ((x).chan & USER_DEOP)
#define chan_exempt (  )     ((x).chan & USER_EXEMPT)

Definition at line 167 of file flags.h.

Referenced by cmd_channel(), got_halfop(), and got_op().

#define chan_friend (  )     ((x).chan & USER_FRIEND)
#define chan_gvoice (  )     ((x).chan & USER_GVOICE)

Definition at line 149 of file flags.h.

Referenced by check_this_member(), cmd_channel(), gotjoin(), and gotmode().

#define chan_halfop (  )     ((x).chan & USER_HALFOP)
#define chan_kick (  )     ((x).chan & USER_KICK)

Definition at line 151 of file flags.h.

Referenced by check_this_member(), cmd_channel(), cmd_mns_host(), flagrec_ok(), and gotjoin().

#define chan_master (  )     ((x).chan & USER_MASTER)
#define chan_op (  )     ((x).chan & USER_OP)
#define chan_owner (  )     ((x).chan & USER_OWNER)
#define chan_quiet (  )     ((x).chan & USER_QUIET)

Definition at line 159 of file flags.h.

Referenced by check_this_member(), cmd_channel(), cmd_devoice(), cmd_voice(), gotjoin(), and gotmode().

#define CHAN_VALID   0x03777c79

Definition at line 59 of file flags.h.

Referenced by break_down_flags().

#define chan_voice (  )     ((x).chan & USER_VOICE)
#define chan_washalfoptest (  )     ((x).chan & USER_WASHALFOPTEST)

Definition at line 157 of file flags.h.

Referenced by got_halfop().

#define chan_wasoptest (  )     ((x).chan & USER_WASOPTEST)

Definition at line 155 of file flags.h.

Referenced by cmd_channel(), and got_op().

#define FR_ALL   0x0fffffff

Definition at line 43 of file flags.h.

#define FR_AND   0x20000000
#define FR_ANYWH   0x10000000
#define FR_BOT   0x00000002
#define FR_CHAN   0x00000004

Definition at line 39 of file flags.h.

Referenced by bind_bind_entry(), break_down_flags(), build_flags(), channels_chon(), channels_report(), check_dcc_attrs(), check_dcc_chanattrs(), check_expired_chanstuff(), check_tcl_ctcpr(), check_tcl_fil(), check_tcl_msg(), check_tcl_msgm(), check_tcl_notc(), check_this_user(), cmd_botattr(), cmd_chattr(), cmd_console(), cmd_deluser(), cmd_file_help(), cmd_help(), cmd_mkdir(), cmd_mns_host(), cmd_mns_noteign(), cmd_noteigns(), cmd_pls_host(), cmd_pls_noteign(), cmd_su(), console_chon(), ctcp_DCC_CHAT(), dcc_chat_hostresolved(), dcc_chatter(), dcc_telnet_id(), dcc_telnet_pass(), detect_chan_flood(), detect_telnet_flood(), filedb_ls(), filesys_DCC_CHAT(), finish_share(), flagrec_eq(), get_user_flagrec(), geticon(), gotjoin(), gotkick(), gotmsg(), gotnick(), gotnotice(), help_subst(), irc_report(), kick_all(), msg_go(), msg_halfop(), msg_help(), msg_invite(), msg_key(), msg_op(), msg_voice(), msg_who(), msg_whois(), punish_badguy(), q_resync(), q_tbuf(), recheck_channel(), refresh_ban_kick(), resolve_dir(), set_user_flagrec(), share_chattr(), share_chchinfo(), share_mns_banchan(), share_mns_chrec(), share_mns_exemptchan(), share_mns_invitechan(), share_newuser(), share_pls_banchan(), share_pls_chrec(), share_pls_exemptchan(), share_pls_invitechan(), shareout_but(), shareout_mod(), show_banner(), show_motd(), start_sending_users(), sub_lang(), tcl_botattr(), tcl_chattr(), tcl_dccdumpfile(), tcl_dumpfile(), tcl_matchattr(), tcl_userlist(), want_to_revenge(), welcome_to_files(), write_bans(), write_exempts(), and write_invites().

#define FR_GLOBAL   0x00000001
#define FR_OR   0x40000000

Definition at line 40 of file flags.h.

Referenced by break_down_flags(), flagrec_eq(), flagrec_ok(), tcl_matchattr(), and tcl_userlist().

#define glob_autohalfop (  )     ((x).global & USER_AUTOHALFOP)

Definition at line 148 of file flags.h.

Referenced by check_this_member(), cmd_channel(), got_halfop(), and gotjoin().

#define glob_autoop (  )     ((x).global & USER_AUTOOP)

Definition at line 146 of file flags.h.

Referenced by check_this_member(), cmd_channel(), got_op(), and gotjoin().

#define glob_bot (  )     ((x).global & USER_BOT)
#define glob_botmast (  )     ((x).global & USER_BOTMAST)
#define glob_dehalfop (  )     ((x).global & USER_DEHALFOP)

Definition at line 139 of file flags.h.

Referenced by check_this_member(), cmd_channel(), cmd_halfop(), got_dehalfop(), and got_halfop().

#define glob_deop (  )     ((x).global & USER_DEOP)
#define glob_exempt (  )     ((x).global & USER_EXEMPT)

Definition at line 168 of file flags.h.

Referenced by cmd_channel(), got_halfop(), and got_op().

#define glob_friend (  )     ((x).global & USER_FRIEND)
#define glob_gvoice (  )     ((x).global & USER_GVOICE)

Definition at line 150 of file flags.h.

Referenced by check_this_member(), cmd_channel(), gotjoin(), and gotmode().

#define glob_halfop (  )     ((x).global & USER_HALFOP)
#define glob_hilite (  )     ((x).global & USER_HIGHLITE)

Definition at line 166 of file flags.h.

Referenced by help_subst().

#define glob_kick (  )     ((x).global & USER_KICK)

Definition at line 152 of file flags.h.

Referenced by check_this_member(), cmd_channel(), cmd_mns_host(), flagrec_ok(), and gotjoin().

#define glob_master (  )     ((x).global & USER_MASTER)
#define glob_op (  )     ((x).global & USER_OP)
#define glob_owner (  )     ((x).global & USER_OWNER)
#define glob_party (  )     ((x).global & USER_PARTY)
#define glob_quiet (  )     ((x).global & USER_QUIET)

Definition at line 160 of file flags.h.

Referenced by check_this_member(), cmd_channel(), and gotmode().

#define glob_voice (  )     ((x).global & USER_VOICE)
#define glob_washalfoptest (  )     ((x).global & USER_WASHALFOPTEST)

Definition at line 158 of file flags.h.

Referenced by got_halfop().

#define glob_wasoptest (  )     ((x).global & USER_WASOPTEST)

Definition at line 156 of file flags.h.

Referenced by cmd_channel(), and got_op().

#define glob_xfer (  )     ((x).global & USER_XFER)

Definition at line 165 of file flags.h.

Referenced by ctcp_DCC_CHAT(), and filesys_DCC_CHAT().

#define USER_AUTOHALFOP   0x01000000

Definition at line 87 of file flags.h.

Referenced by chan_sanity_check(), and sanity_check().

#define USER_AUTOOP   0x00000001

Definition at line 63 of file flags.h.

Referenced by chan_sanity_check(), and sanity_check().

#define USER_BOT   0x00000002
#define USER_BOTMAST   0x00080000
#define USER_COMMON   0x00000004

Definition at line 65 of file flags.h.

Referenced by msg_addhost(), msg_hello(), msg_ident(), msg_info(), msg_pass(), and sanity_check().

#define USER_DEFAULT   0x40000000

Definition at line 89 of file flags.h.

Referenced by cmd_adduser(), global(), and msg_hello().

#define USER_DEHALFOP   0x00020000

Definition at line 80 of file flags.h.

Referenced by chan_sanity_check(), and sanity_check().

#define USER_DEOP   0x00000008

Definition at line 66 of file flags.h.

Referenced by chan_sanity_check(), punish_badguy(), and sanity_check().

#define USER_EXEMPT   0x00000010

Definition at line 67 of file flags.h.

#define USER_FRIEND   0x00000020

Definition at line 68 of file flags.h.

Referenced by detect_flood(), and resolve_dir().

#define USER_GVOICE   0x00000040

Definition at line 69 of file flags.h.

Referenced by chan_sanity_check(), and sanity_check().

#define USER_HALFOP   0x00000800

Definition at line 74 of file flags.h.

Referenced by chan_sanity_check(), and sanity_check().

#define USER_HIGHLITE   0x00000080

Definition at line 70 of file flags.h.

Referenced by bot_motd(), cmd_motd(), and cmd_strip().

#define USER_I   0x00000100

Definition at line 71 of file flags.h.

#define USER_JANITOR   0x00000200

Definition at line 72 of file flags.h.

Referenced by cmd_desc(), cmd_filestats(), filedb_ls(), sanity_check(), and welcome_to_files().

#define USER_KICK   0x00000400

Definition at line 73 of file flags.h.

#define USER_MASTER   0x00001000
#define USER_OP   0x00004000
#define USER_OWNER   0x00002000
#define USER_PARTY   0x00008000
#define USER_QUIET   0x00010000

Definition at line 79 of file flags.h.

Referenced by chan_sanity_check(), and sanity_check().

#define USER_S   0x00040000

Definition at line 81 of file flags.h.

#define USER_UNSHARED   0x00100000
#define USER_VALID   0x03fbfeff

Definition at line 58 of file flags.h.

Referenced by break_down_flags().

#define USER_VOICE   0x00200000

Definition at line 84 of file flags.h.

Referenced by chan_sanity_check(), msg_whois(), and sanity_check().

#define USER_WASHALFOPTEST   0x02000000

Definition at line 88 of file flags.h.

#define USER_WASOPTEST   0x00400000

Definition at line 85 of file flags.h.

#define USER_XFER   0x00800000

Function Documentation

void break_down_flags ( const char *  ,
struct flag_record ,
struct flag_record  
)

Definition at line 344 of file flags.c.

References flag_record::bot, BOT_FLAG0, BOT_VALID, flag_record::chan, CHAN_VALID, egg_bzero, FR_AND, FR_BOT, FR_CHAN, FR_GLOBAL, FR_OR, flag_record::global, flag_record::match, flag_record::udef_chan, flag_record::udef_global, and USER_VALID.

00346 {
00347   struct flag_record *which = plus;
00348   int mode = 0;                 /* 0 = glob, 1 = chan, 2 = bot */
00349   int flags = plus->match;
00350 
00351   if (!(flags & FR_GLOBAL)) {
00352     if (flags & FR_BOT)
00353       mode = 2;
00354     else if (flags & FR_CHAN)
00355       mode = 1;
00356     else
00357       return;                   /* We dont actually want any..huh? */
00358   }
00359   egg_bzero(plus, sizeof(struct flag_record));
00360 
00361   if (minus)
00362     egg_bzero(minus, sizeof(struct flag_record));
00363 
00364   plus->match = FR_OR;          /* Default binding type OR */
00365   while (*string) {
00366     switch (*string) {
00367     case '+':
00368       which = plus;
00369       break;
00370     case '-':
00371       which = minus ? minus : plus;
00372       break;
00373     case '|':
00374     case '&':
00375       if (!mode) {
00376         if (*string == '|')
00377           plus->match = FR_OR;
00378         else
00379           plus->match = FR_AND;
00380       }
00381       which = plus;
00382       mode++;
00383       if ((mode == 2) && !(flags & (FR_CHAN | FR_BOT)))
00384         string = "";
00385       else if (mode == 3)
00386         mode = 1;
00387       break;
00388     default:
00389       if ((*string >= 'a') && (*string <= 'z')) {
00390         switch (mode) {
00391         case 0:
00392           which->global |=1 << (*string - 'a');
00393 
00394           break;
00395         case 1:
00396           which->chan |= 1 << (*string - 'a');
00397           break;
00398         case 2:
00399           which->bot |= 1 << (*string - 'a');
00400         }
00401       } else if ((*string >= 'A') && (*string <= 'Z')) {
00402         switch (mode) {
00403         case 0:
00404           which->udef_global |= 1 << (*string - 'A');
00405           break;
00406         case 1:
00407           which->udef_chan |= 1 << (*string - 'A');
00408           break;
00409         }
00410       } else if ((*string >= '0') && (*string <= '9')) {
00411         switch (mode) {
00412           /* Map 0->9 to A->K for glob/chan so they are not lost */
00413         case 0:
00414           which->udef_global |= 1 << (*string - '0');
00415           break;
00416         case 1:
00417           which->udef_chan |= 1 << (*string - '0');
00418           break;
00419         case 2:
00420           which->bot |= BOT_FLAG0 << (*string - '0');
00421           break;
00422         }
00423       }
00424     }
00425     string++;
00426   }
00427   for (which = plus; which; which = (which == plus ? minus : 0)) {
00428     which->global &=USER_VALID;
00429 
00430     which->udef_global &= 0x03ffffff;
00431     which->chan &= CHAN_VALID;
00432     which->udef_chan &= 0x03ffffff;
00433     which->bot &= BOT_VALID;
00434   }
00435   plus->match |= flags;
00436   if (minus) {
00437     minus->match |= flags;
00438     if (!(plus->match & (FR_AND | FR_OR)))
00439       plus->match |= FR_OR;
00440   }
00441 }

int build_flags ( char *  ,
struct flag_record ,
struct flag_record  
)

Definition at line 487 of file flags.c.

References flag_record::bot, bot2str(), flag_record::chan, flag2str(), FR_AND, FR_BOT, FR_CHAN, FR_GLOBAL, flag_record::global, flag_record::match, flag_record::udef_chan, and flag_record::udef_global.

00489 {
00490   char *old = string;
00491 
00492   if (plus->match & FR_GLOBAL) {
00493     if (minus && (plus->global ||plus->udef_global))
00494       *string++ = '+';
00495     string += flag2str(string, plus->global, plus->udef_global);
00496 
00497     if (minus && (minus->global ||minus->udef_global)) {
00498       *string++ = '-';
00499       string += flag2str(string, minus->global, minus->udef_global);
00500     }
00501   } else if (plus->match & FR_BOT) {
00502     if (minus && plus->bot)
00503       *string++ = '+';
00504     string += bot2str(string, plus->bot);
00505     if (minus && minus->bot) {
00506       *string++ = '-';
00507       string += bot2str(string, minus->bot);
00508     }
00509   }
00510   if (plus->match & FR_CHAN) {
00511     if (plus->match & (FR_GLOBAL | FR_BOT))
00512       *string++ = (plus->match & FR_AND) ? '&' : '|';
00513     if (minus && (plus->chan || plus->udef_chan))
00514       *string++ = '+';
00515     string += flag2str(string, plus->chan, plus->udef_chan);
00516     if (minus && (minus->chan || minus->udef_chan)) {
00517       *string++ = '-';
00518       string += flag2str(string, minus->global, minus->udef_chan);
00519     }
00520   }
00521   if (string == old) {
00522     *string++ = '-';
00523     *string = 0;
00524     return 0;
00525   }
00526   *string = 0;
00527   return string - old;
00528 }

Here is the call graph for this function:

int chan_sanity_check ( int  ,
int   
)

Definition at line 286 of file flags.c.

References BOT_SHARE, USER_AUTOHALFOP, USER_AUTOOP, USER_BOT, USER_DEHALFOP, USER_DEOP, USER_GVOICE, USER_HALFOP, USER_MASTER, USER_OP, USER_OWNER, USER_QUIET, and USER_VOICE.

Referenced by cmd_chattr(), and tcl_chattr().

00287 {
00288   if ((chatr & USER_OP) && (chatr & USER_DEOP))
00289     chatr &= ~(USER_OP | USER_DEOP);
00290   if ((chatr & USER_HALFOP) && (chatr & USER_DEHALFOP))
00291     chatr &= ~(USER_HALFOP | USER_DEHALFOP);
00292   if ((chatr & USER_AUTOOP) && (chatr & USER_DEOP))
00293     chatr &= ~(USER_AUTOOP | USER_DEOP);
00294   if ((chatr & USER_AUTOHALFOP) && (chatr & USER_DEHALFOP))
00295     chatr &= ~(USER_AUTOHALFOP | USER_DEHALFOP);
00296   if ((chatr & USER_VOICE) && (chatr & USER_QUIET))
00297     chatr &= ~(USER_VOICE | USER_QUIET);
00298   if ((chatr & USER_GVOICE) && (chatr & USER_QUIET))
00299     chatr &= ~(USER_GVOICE | USER_QUIET);
00300   /* Can't be channel owner without also being channel master */
00301   if (chatr & USER_OWNER)
00302     chatr |= USER_MASTER;
00303   /* Master implies op */
00304   if (chatr & USER_MASTER)
00305     chatr |= USER_OP;
00306   /* Op implies halfop */
00307   if (chatr & USER_OP)
00308     chatr |= USER_HALFOP;
00309   /* Can't be +s on chan unless you're a bot */
00310   if (!(atr & USER_BOT))
00311     chatr &= ~BOT_SHARE;
00312   return chatr;
00313 }

Here is the caller graph for this function:

int flagrec_eq ( struct flag_record ,
struct flag_record  
)

Definition at line 570 of file flags.c.

References flag_record::bot, flag_record::chan, FR_AND, FR_BOT, FR_CHAN, FR_GLOBAL, FR_OR, flag_record::global, flag_record::match, flag_record::udef_chan, and flag_record::udef_global.

00571 {
00572   if (req->match & FR_AND) {
00573     if (req->match & FR_GLOBAL) {
00574       if ((req->global & have->global) !=req->global)
00575         return 0;
00576       if ((req->udef_global & have->udef_global) != req->udef_global)
00577         return 0;
00578     }
00579     if (req->match & FR_BOT)
00580       if ((req->bot & have->bot) != req->bot)
00581         return 0;
00582     if (req->match & FR_CHAN) {
00583       if ((req->chan & have->chan) != req->chan)
00584         return 0;
00585       if ((req->udef_chan & have->udef_chan) != req->udef_chan)
00586         return 0;
00587     }
00588     return 1;
00589   } else if (req->match & FR_OR) {
00590     if (!req->chan && !req->global && !req->udef_chan &&
00591         !req->udef_global && !req->bot)
00592       return 1;
00593     if (req->match & FR_GLOBAL) {
00594       if (have->global & req->global)
00595         return 1;
00596       if (have->udef_global & req->udef_global)
00597         return 1;
00598     }
00599     if (req->match & FR_BOT)
00600       if (have->bot & req->bot)
00601         return 1;
00602     if (req->match & FR_CHAN) {
00603       if (have->chan & req->chan)
00604         return 1;
00605       if (have->udef_chan & req->udef_chan)
00606         return 1;
00607     }
00608     return 0;
00609   }
00610   return 0;                     /* fr0k3 binding, dont pass it */
00611 }

int flagrec_ok ( struct flag_record ,
struct flag_record  
)

Definition at line 530 of file flags.c.

References allow_dk_cmds, flag_record::chan, chan_deop, chan_kick, flagrec_eq, FR_AND, FR_OR, glob_deop, glob_kick, glob_party, flag_record::global, flag_record::match, require_p, flag_record::udef_chan, flag_record::udef_global, USER_OP, USER_OWNER, and USER_PARTY.

00531 {
00532   /* FIXME: flag masks with '&' in them won't be subject to
00533    *        further tests below. Example: 'o&j'
00534    */
00535   if (req->match & FR_AND)
00536     return flagrec_eq(req, have);
00537   else if (req->match & FR_OR) {
00538     int hav = have->global;
00539 
00540     /* Exception 1 - global +d/+k cant use -|-, unless they are +p */
00541     if (!req->chan && !req->global && !req->udef_global && !req->udef_chan) {
00542       if (!allow_dk_cmds) {
00543         if (glob_party(*have))
00544           return 1;
00545         if (glob_kick(*have) || chan_kick(*have))
00546           return 0;             /* +k cant use -|- commands */
00547         if (glob_deop(*have) || chan_deop(*have))
00548           return 0;             /* neither can +d's */
00549       }
00550       return 1;
00551     }
00552     /* The +n/+m checks aren't needed anymore because +n/+m
00553      * automatically adds lower flags
00554      */
00555     if (!require_p && ((hav & USER_OP) || (have->chan & USER_OWNER)))
00556       hav |= USER_PARTY;
00557     if (hav & req->global)
00558       return 1;
00559     if (have->chan & req->chan)
00560       return 1;
00561     if (have->udef_global & req->udef_global)
00562       return 1;
00563     if (have->udef_chan & req->udef_chan)
00564       return 1;
00565     return 0;
00566   }
00567   return 0;                     /* fr0k3 binding, dont pass it */
00568 }

void get_user_flagrec ( struct userrec ,
struct flag_record ,
const char *   
)

Definition at line 664 of file flags.c.

References flag_record::bot, flag_record::chan, chanuserrec::channel, userrec::chanrec, findchan_by_dname, chanuserrec::flags, userrec::flags, chanuserrec::flags_udef, userrec::flags_udef, FR_ANYWH, FR_BOT, FR_CHAN, FR_GLOBAL, get_user, flag_record::global, long(), flag_record::match, chanuserrec::next, NULL, rfc_casecmp, flag_record::udef_chan, flag_record::udef_global, and USERENTRY_BOTFL.

00666 {
00667   struct chanuserrec *cr = NULL;
00668 
00669   if (!u) {
00670     fr->global = fr->udef_global = fr->chan = fr->udef_chan = fr->bot = 0;
00671 
00672     return;
00673   }
00674   if (fr->match & FR_GLOBAL) {
00675     fr->global = u->flags;
00676 
00677     fr->udef_global = u->flags_udef;
00678   } else {
00679     fr->global = 0;
00680 
00681     fr->udef_global = 0;
00682   }
00683   if (fr->match & FR_BOT) {
00684     fr->bot = (long) get_user(&USERENTRY_BOTFL, u);
00685   } else
00686     fr->bot = 0;
00687   if (fr->match & FR_CHAN) {
00688     if (fr->match & FR_ANYWH) {
00689       fr->chan = u->flags;
00690       fr->udef_chan = u->flags_udef;
00691       for (cr = u->chanrec; cr; cr = cr->next)
00692         if (findchan_by_dname(cr->channel)) {
00693           fr->chan |= cr->flags;
00694           fr->udef_chan |= cr->flags_udef;
00695         }
00696     } else {
00697       if (chname)
00698         for (cr = u->chanrec; cr; cr = cr->next)
00699           if (!rfc_casecmp(chname, cr->channel))
00700             break;
00701       if (cr) {
00702         fr->chan = cr->flags;
00703         fr->udef_chan = cr->flags_udef;
00704       } else {
00705         fr->chan = 0;
00706         fr->udef_chan = 0;
00707       }
00708     }
00709   }
00710 }

Here is the call graph for this function:

char geticon ( int   ) 

Definition at line 324 of file flags.c.

References chan_halfop, chan_master, chan_op, chan_owner, FR_ANYWH, FR_CHAN, FR_GLOBAL, get_user_flagrec, glob_botmast, glob_halfop, glob_master, glob_op, glob_owner, and user.

00325 {
00326   struct flag_record fr = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 };
00327 
00328   if (!dcc[idx].user)
00329     return '-';
00330   get_user_flagrec(dcc[idx].user, &fr, 0);
00331   if (glob_owner(fr) || chan_owner(fr))
00332     return '*';
00333   if (glob_master(fr) || chan_master(fr))
00334     return '+';
00335   if (glob_botmast(fr))
00336     return '%';
00337   if (glob_op(fr) || chan_op(fr))
00338     return '@';
00339   if (glob_halfop(fr) || chan_halfop(fr))
00340     return '^';
00341   return '-';
00342 }

int sanity_check ( int   ) 

Definition at line 249 of file flags.c.

References USER_AUTOHALFOP, USER_AUTOOP, USER_BOT, USER_BOTMAST, USER_COMMON, USER_DEHALFOP, USER_DEOP, USER_GVOICE, USER_HALFOP, USER_JANITOR, USER_MASTER, USER_OP, USER_OWNER, USER_PARTY, USER_QUIET, USER_VOICE, and USER_XFER.

00250 {
00251   if ((atr & USER_BOT) &&
00252       (atr & (USER_PARTY | USER_MASTER | USER_COMMON | USER_OWNER)))
00253     atr &= ~(USER_PARTY | USER_MASTER | USER_COMMON | USER_OWNER);
00254   if ((atr & USER_OP) && (atr & USER_DEOP))
00255     atr &= ~(USER_OP | USER_DEOP);
00256   if ((atr & USER_HALFOP) && (atr & USER_DEHALFOP))
00257     atr &= ~(USER_HALFOP | USER_DEHALFOP);
00258   if ((atr & USER_AUTOOP) && (atr & USER_DEOP))
00259     atr &= ~(USER_AUTOOP | USER_DEOP);
00260   if ((atr & USER_AUTOHALFOP) && (atr & USER_DEHALFOP))
00261     atr &= ~(USER_AUTOHALFOP | USER_DEHALFOP);
00262   if ((atr & USER_VOICE) && (atr & USER_QUIET))
00263     atr &= ~(USER_VOICE | USER_QUIET);
00264   if ((atr & USER_GVOICE) && (atr & USER_QUIET))
00265     atr &= ~(USER_GVOICE | USER_QUIET);
00266   /* Can't be owner without also being master */
00267   if (atr & USER_OWNER)
00268     atr |= USER_MASTER;
00269   /* Master implies botmaster, op and janitor */
00270   if (atr & USER_MASTER)
00271     atr |= USER_BOTMAST | USER_OP | USER_JANITOR;
00272   /* Can't be botnet master without party-line access */
00273   if (atr & USER_BOTMAST)
00274     atr |= USER_PARTY;
00275   /* Janitors can use the file area */
00276   if (atr & USER_JANITOR)
00277     atr |= USER_XFER;
00278   /* Ops should be halfops */
00279   if (atr & USER_OP)
00280     atr |= USER_HALFOP;
00281   return atr;
00282 }

void set_user_flagrec ( struct userrec ,
struct flag_record ,
const char *   
)

Definition at line 613 of file flags.c.

References flag_record::bot, build_flags, flag_record::chan, chanuserrec::channel, channel_shared, userrec::chanrec, egg_bzero, findchan_by_dname, chanuserrec::flags, userrec::flags, chanuserrec::flags_udef, userrec::flags_udef, FR_BOT, FR_CHAN, FR_GLOBAL, flag_record::global, userrec::handle, flag_record::match, chanuserrec::next, noshare, NULL, rfc_casecmp, set_user, shareout, strncpyz, flag_record::udef_chan, flag_record::udef_global, USER_BOT, user_malloc, USER_UNSHARED, and USERENTRY_BOTFL.

00615 {
00616   struct chanuserrec *cr = NULL;
00617   int oldflags = fr->match;
00618   char buffer[100];
00619   struct chanset_t *ch;
00620 
00621   if (!u)
00622     return;
00623   if (oldflags & FR_GLOBAL) {
00624     u->flags = fr->global;
00625 
00626     u->flags_udef = fr->udef_global;
00627     if (!noshare && !(u->flags & USER_UNSHARED)) {
00628       fr->match = FR_GLOBAL;
00629       build_flags(buffer, fr, NULL);
00630       shareout(NULL, "a %s %s\n", u->handle, buffer);
00631     }
00632   }
00633   if ((oldflags & FR_BOT) && (u->flags & USER_BOT))
00634     set_user(&USERENTRY_BOTFL, u, (void *) fr->bot);
00635   /* Don't share bot attrs */
00636   if ((oldflags & FR_CHAN) && chname) {
00637     for (cr = u->chanrec; cr; cr = cr->next)
00638       if (!rfc_casecmp(chname, cr->channel))
00639         break;
00640     ch = findchan_by_dname(chname);
00641     if (!cr && ch) {
00642       cr = user_malloc(sizeof(struct chanuserrec));
00643       egg_bzero(cr, sizeof(struct chanuserrec));
00644 
00645       cr->next = u->chanrec;
00646       u->chanrec = cr;
00647       strncpyz(cr->channel, chname, sizeof cr->channel);
00648     }
00649     if (cr && ch) {
00650       cr->flags = fr->chan;
00651       cr->flags_udef = fr->udef_chan;
00652       if (!noshare && !(u->flags & USER_UNSHARED) && channel_shared(ch)) {
00653         fr->match = FR_CHAN;
00654         build_flags(buffer, fr, NULL);
00655         shareout(ch, "a %s %s %s\n", u->handle, buffer, chname);
00656       }
00657     }
00658   }
00659   fr->match = oldflags;
00660 }


Generated on 7 Sep 2016 for Eggdrop by  doxygen 1.6.1