ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/s_user.c
(Generate patch)

Comparing ircd-hybrid-8/src/s_user.c (file contents):
Revision 1173 by michael, Sun Aug 14 00:23:02 2011 UTC vs.
Revision 1232 by michael, Thu Sep 22 20:25:00 2011 UTC

# Line 106 | Line 106 | unsigned int user_modes[256] =
106    0,                  /* O */
107    0,                  /* P */
108    0,                  /* Q */
109 <  0,                  /* R */
110 <  UMODE_REGONLY,      /* S */
109 >  UMODE_REGONLY,      /* R */
110 >  0,                  /* S */
111    0,                  /* T */
112    0,                  /* U */
113    0,                  /* V */
# Line 190 | Line 190 | show_lusers(struct Client *source_p)
190      to = source_p->name;
191    }
192  
193 <  if (!ConfigServerHide.hide_servers || IsOper(source_p))
193 >  if (!ConfigServerHide.hide_servers || HasUMode(source_p, UMODE_OPER))
194      sendto_one(source_p, form_str(RPL_LUSERCLIENT),
195                 from, to, (Count.total-Count.invisi),
196                 Count.invisi, dlink_list_length(&global_serv_list));
# Line 210 | Line 210 | show_lusers(struct Client *source_p)
210      sendto_one(source_p, form_str(RPL_LUSERCHANNELS),
211                 from, to, dlink_list_length(&global_channel_list));
212  
213 <  if (!ConfigServerHide.hide_servers || IsOper(source_p))
213 >  if (!ConfigServerHide.hide_servers || HasUMode(source_p, UMODE_OPER))
214    {
215      sendto_one(source_p, form_str(RPL_LUSERME),
216                 from, to, Count.local, Count.myserver);
# Line 231 | Line 231 | show_lusers(struct Client *source_p)
231               from, to, Count.total, Count.max_tot,
232               Count.total, Count.max_tot);
233  
234 <  if (!ConfigServerHide.hide_servers || IsOper(source_p))
234 >  if (!ConfigServerHide.hide_servers || HasUMode(source_p, UMODE_OPER))
235      sendto_one(source_p, form_str(RPL_STATSCONN), from, to,
236                 Count.max_loc_con, Count.max_loc_cli, Count.totalrestartcount);
237  
# Line 309 | Line 309 | register_local_user(struct Client *sourc
309        return;
310    }
311  
312 <  source_p->localClient->last = CurrentTime;
312 >  source_p->localClient->last_privmsg = CurrentTime;
313    /* Straight up the maximum rate of flooding... */
314    source_p->localClient->allow_read = MAX_FLOOD_BURST;
315  
# Line 445 | Line 445 | register_local_user(struct Client *sourc
445  
446    if (ConfigFileEntry.invisible_on_connect)
447    {
448 <    source_p->umodes |= UMODE_INVISIBLE;
448 >    AddUMode(source_p, UMODE_INVISIBLE);
449      ++Count.invisi;
450    }
451  
# Line 522 | Line 522 | register_remote_user(struct Client *sour
522                           source_p->host, source_p->from->name);
523      kill_client(source_p->from, source_p, "%s (Server doesn't exist)", me.name);
524  
525 <    SetKilled(source_p);
525 >    AddFlag(source_p, FLAGS_KILLED);
526      exit_client(source_p, &me, "Ghosted Client");
527      return;
528    }
# Line 537 | Line 537 | register_remote_user(struct Client *sour
537      kill_client(source_p->from, source_p,
538                  "%s (NICK from wrong direction (%s != %s))",
539                  me.name, source_p->servptr->name, target_p->from->name);
540 <    SetKilled(source_p);
540 >    AddFlag(source_p, FLAGS_KILLED);
541      exit_client(source_p, &me, "USER server wrong direction");
542      return;
543    }
# Line 546 | Line 546 | register_remote_user(struct Client *sour
546     * If the nick has been introduced by a services server,
547     * make it a service as well.
548     */
549 <  if (IsService(source_p->servptr))
550 <    SetService(source_p);
549 >  if (HasFlag(source_p->servptr, FLAGS_SERVICE))
550 >    AddFlag(source_p, FLAGS_SERVICE);
551  
552    /* Increment our total user count here */
553    if (++Count.total > Count.max_tot)
# Line 595 | Line 595 | introduce_client(struct Client *source_p
595      if (server == source_p->from)
596          continue;
597  
598 <    if (IsCapable(server, CAP_TS6) && HasID(source_p))
599 <      sendto_one(server, ":%s UID %s %d %lu %s %s %s %s %s :%s",
600 <                 source_p->servptr->id,
601 <                 source_p->name, source_p->hopcount+1,
602 <                 (unsigned long)source_p->tsinfo,
603 <                 ubuf, source_p->username, source_p->host,
604 <                 (MyClient(source_p) && IsIPSpoof(source_p)) ?
605 <                 "0" : source_p->sockhost, source_p->id, source_p->info);
598 >    if (IsCapable(server, CAP_SVS))
599 >    {
600 >      if (IsCapable(server, CAP_TS6) && HasID(source_p))
601 >        sendto_one(server, ":%s UID %s %d %lu %s %s %s %s %s %lu :%s",
602 >                   source_p->servptr->id,
603 >                   source_p->name, source_p->hopcount+1,
604 >                   (unsigned long)source_p->tsinfo,
605 >                   ubuf, source_p->username, source_p->host,
606 >                   (MyClient(source_p) && IsIPSpoof(source_p)) ?
607 >                   "0" : source_p->sockhost, source_p->id,
608 >                   (unsigned long)source_p->servicestamp,
609 >                   source_p->info);
610 >      else
611 >        sendto_one(server, "NICK %s %d %lu %s %s %s %s %lu :%s",
612 >                   source_p->name, source_p->hopcount+1,
613 >                   (unsigned long)source_p->tsinfo,
614 >                   ubuf, source_p->username, source_p->host,
615 >                   source_p->servptr->name, (unsigned long)source_p->servicestamp,
616 >                   source_p->info);
617 >
618 >    }
619      else
620 <      sendto_one(server, "NICK %s %d %lu %s %s %s %s :%s",
621 <                 source_p->name, source_p->hopcount+1,
622 <                 (unsigned long)source_p->tsinfo,
623 <                 ubuf, source_p->username, source_p->host,
624 <                 source_p->servptr->name, source_p->info);
620 >    {
621 >      if (IsCapable(server, CAP_TS6) && HasID(source_p))
622 >        sendto_one(server, ":%s UID %s %d %lu %s %s %s %s %s :%s",
623 >                   source_p->servptr->id,
624 >                   source_p->name, source_p->hopcount+1,
625 >                   (unsigned long)source_p->tsinfo,
626 >                   ubuf, source_p->username, source_p->host,
627 >                   (MyClient(source_p) && IsIPSpoof(source_p)) ?
628 >                   "0" : source_p->sockhost, source_p->id, source_p->info);
629 >      else
630 >        sendto_one(server, "NICK %s %d %lu %s %s %s %s :%s",
631 >                   source_p->name, source_p->hopcount+1,
632 >                   (unsigned long)source_p->tsinfo,
633 >                   ubuf, source_p->username, source_p->host,
634 >                   source_p->servptr->name, source_p->info);
635 >    }
636    }
637   }
638  
# Line 762 | Line 786 | report_and_set_user_flags(struct Client
786                 me.name,source_p->name);
787    }
788  
765  /* If this user is exempt from idle time outs */
766  if (IsConfIdlelined(aconf))
767  {
768    SetIdlelined(source_p);
769    sendto_one(source_p,
770               ":%s NOTICE %s :*** You are exempt from idle limits. congrats.",
771               me.name, source_p->name);
772  }
773
789    if (IsConfCanFlood(aconf))
790    {
791      SetCanFlood(source_p);
# Line 799 | Line 814 | change_simple_umode(va_list args)
814    flag = va_arg(args, unsigned int);
815  
816    if (what == MODE_ADD)
817 <    source_p->umodes |= flag;
817 >    AddUMode(source_p, flag);
818    else
819 <    source_p->umodes &= ~flag;
819 >    DelUMode(source_p, flag);
820  
821    return NULL;
822   }
# Line 852 | Line 867 | set_user_mode(struct Client *client_p, s
867      *m++ = '+';
868  
869      for (i = 0; i < 128; i++)
870 <      if (source_p->umodes & user_modes[i])
870 >      if (HasUMode(source_p, user_modes[i]))
871          *m++ = (char)i;
872      *m = '\0';
873  
# Line 882 | Line 897 | set_user_mode(struct Client *client_p, s
897          case 'o':
898            if (what == MODE_ADD)
899            {
900 <            if (IsServer(client_p) && !IsOper(source_p))
900 >            if (IsServer(client_p) && !HasUMode(source_p, UMODE_OPER))
901              {
902                ++Count.oper;
903                SetOper(source_p);
# Line 893 | Line 908 | set_user_mode(struct Client *client_p, s
908              /* Only decrement the oper counts if an oper to begin with
909               * found by Pat Szuta, Perly , perly@xnet.com
910               */
911 <            if (!IsOper(source_p))
911 >            if (!HasUMode(source_p, UMODE_OPER))
912                break;
913  
914              ClearOper(source_p);
# Line 904 | Line 919 | set_user_mode(struct Client *client_p, s
919                dlink_node *dm;
920  
921                detach_conf(source_p, OPER_TYPE);
922 <              ClearOperFlags(source_p);
923 <              source_p->umodes &= ~ConfigFileEntry.oper_only_umodes;
922 >              ClrOFlag(source_p);
923 >              DelUMode(source_p, ConfigFileEntry.oper_only_umodes);
924  
925                if ((dm = dlinkFindDelete(&oper_list, source_p)) != NULL)
926                  free_dlink_node(dm);
# Line 927 | Line 942 | set_user_mode(struct Client *client_p, s
942          default:
943            if ((flag = user_modes[(unsigned char)*m]))
944            {
945 <            if (MyConnect(source_p) && !IsOper(source_p) &&
945 >            if (MyConnect(source_p) && !HasUMode(source_p, UMODE_OPER) &&
946                  (ConfigFileEntry.oper_only_umodes & flag))
947              {
948                badflag = 1;
# Line 950 | Line 965 | set_user_mode(struct Client *client_p, s
965      sendto_one(source_p, form_str(ERR_UMODEUNKNOWNFLAG),
966                 me.name, source_p->name);
967  
968 <  if (HasUMode(source_p, UMODE_NCHANGE) && !IsOperN(source_p))
968 >  if (HasUMode(source_p, UMODE_NCHANGE) && !HasOFlag(source_p, OPER_FLAG_N))
969    {
970 <    sendto_one(source_p, ":%s NOTICE %s :*** You have no admin flag;",
970 >    sendto_one(source_p, ":%s NOTICE %s :*** You have no nchange flag;",
971                 me.name, source_p->name);
972 <    DelUMode(source_p, UMODE_NCHANGE); /* only tcm's really need this */
972 >    DelUMode(source_p, UMODE_NCHANGE);
973    }
974  
975 <  if (MyConnect(source_p) && (source_p->umodes & UMODE_ADMIN) &&
976 <      !IsOperAdmin(source_p) && !IsOperHiddenAdmin(source_p))
975 >  if (MyConnect(source_p) && HasUMode(source_p, UMODE_ADMIN) &&
976 >      !HasOFlag(source_p, OPER_FLAG_HIDDEN_ADMIN|OPER_FLAG_ADMIN))
977    {
978      sendto_one(source_p, ":%s NOTICE %s :*** You have no admin flag;",
979                 me.name, source_p->name);
980 <    source_p->umodes &= ~UMODE_ADMIN;
980 >    DelUMode(source_p, UMODE_ADMIN);
981    }
982  
983 <  if (!(setflags & UMODE_INVISIBLE) && IsInvisible(source_p))
983 >  if (!(setflags & UMODE_INVISIBLE) && HasUMode(source_p, UMODE_INVISIBLE))
984      ++Count.invisi;
985 <  if ((setflags & UMODE_INVISIBLE) && !IsInvisible(source_p))
985 >  if ((setflags & UMODE_INVISIBLE) && !HasUMode(source_p, UMODE_INVISIBLE))
986      --Count.invisi;
987  
988    /*
# Line 1010 | Line 1025 | send_umode(struct Client *client_p, stru
1025      if (MyClient(source_p) && !(flag & sendmask))
1026        continue;
1027  
1028 <    if ((flag & old) && !(source_p->umodes & flag))
1028 >    if ((flag & old) && !HasUMode(source_p, flag))
1029      {
1030        if (what == MODE_DEL)
1031          *m++ = (char)i;
# Line 1021 | Line 1036 | send_umode(struct Client *client_p, stru
1036          *m++ = (char)i;
1037        }
1038      }
1039 <    else if (!(flag & old) && (source_p->umodes & flag))
1039 >    else if (!(flag & old) && HasUMode(source_p, flag))
1040      {
1041        if (what == MODE_ADD)
1042          *m++ = (char)i;
# Line 1055 | Line 1070 | send_umode_out(struct Client *client_p,
1070    char buf[IRCD_BUFSIZE] = { '\0' };
1071    dlink_node *ptr = NULL;
1072  
1073 <  send_umode(NULL, source_p, old, IsOperHiddenAdmin(source_p) ?
1073 >  send_umode(NULL, source_p, old, HasOFlag(source_p, OPER_FLAG_HIDDEN_ADMIN) ?
1074               SEND_UMODES & ~UMODE_ADMIN : SEND_UMODES, buf);
1075  
1076    if (buf[0])
# Line 1200 | Line 1215 | oper_up(struct Client *source_p)
1215    SetOper(source_p);
1216  
1217    if (oconf->modes)
1218 <    source_p->umodes |= oconf->modes;
1218 >    AddUMode(source_p, oconf->modes);
1219    else if (ConfigFileEntry.oper_umodes)
1220 <    source_p->umodes |= ConfigFileEntry.oper_umodes;
1206 <  else
1207 <    source_p->umodes |= (UMODE_SERVNOTICE|UMODE_OPERWALL|
1208 <                         UMODE_WALLOP|UMODE_LOCOPS);
1220 >    AddUMode(source_p, ConfigFileEntry.oper_umodes);
1221  
1222 <  if (!(old & UMODE_INVISIBLE) && IsInvisible(source_p))
1222 >  if (!(old & UMODE_INVISIBLE) && HasUMode(source_p, UMODE_INVISIBLE))
1223      ++Count.invisi;
1224 <  if ((old & UMODE_INVISIBLE) && !IsInvisible(source_p))
1224 >  if ((old & UMODE_INVISIBLE) && !HasUMode(source_p, UMODE_INVISIBLE))
1225      --Count.invisi;
1226  
1227    assert(dlinkFind(&oper_list, source_p) == NULL);
# Line 1217 | Line 1229 | oper_up(struct Client *source_p)
1229  
1230    operprivs = oper_privs_as_string(oconf->port);
1231  
1232 <  SetOFlag(source_p, oconf->port);
1232 >  AddOFlag(source_p, oconf->port);
1233  
1234 <  if (IsOperAdmin(source_p) || IsOperHiddenAdmin(source_p))
1234 >  if (HasOFlag(source_p, OPER_FLAG_HIDDEN_ADMIN|OPER_FLAG_ADMIN))
1235      AddUMode(source_p, UMODE_ADMIN);
1236 <  if (!IsOperN(source_p))
1236 >  if (!HasOFlag(source_p, OPER_FLAG_N))
1237      DelUMode(source_p, UMODE_NCHANGE);
1238  
1239    sendto_realops_flags(UMODE_ALL, L_ALL, "%s (%s@%s) is now an operator",

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)