Author: Isomer <isomer@coders.net>
[ircu2.10.12-pk.git] / ircd / channel.c
index c787b88d1790dc8377dda7c4abe87b319bb3943a..3208d71492d8b8a1fdd31024859ebe3686f3f0a8 100644 (file)
@@ -207,8 +207,8 @@ int sub1_from_channel(struct Channel* chptr)
     for (i = 0; i <= HighestFd; i++)
     {
       struct Client *acptr = 0;
-      if ((acptr = LocalClientArray[i]) && con_listing(acptr) &&
-          (con_listing(acptr))->chptr == chptr)
+      if ((acptr = LocalClientArray[i]) && cli_listing(acptr) &&
+          (cli_listing(acptr))->chptr == chptr)
       {
         list_next_channels(acptr, 1);
         break;                  /* Only one client can list a channel */
@@ -611,7 +611,7 @@ void remove_user_from_all_channels(struct Client* cptr)
 {
   struct Membership* chan;
   assert(0 != cptr);
-  assert(0 != cptr->user);
+  assert(0 != cli_user(cptr));
 
   while ((chan = (cli_user(cptr))->channel))
     remove_user_from_channel(cptr, chan->channel);
@@ -696,10 +696,11 @@ int client_can_send_to_channel(struct Client *cptr, struct Channel *chptr)
 
   /*
    * You can't speak if your off channel, if the channel is modeless, or
-   * +n.(no external messages)
+   * +n (no external messages) or +m (moderated).
    */
   if (!member) {
-    if ((chptr->mode.mode & MODE_NOPRIVMSGS) || IsModelessChannel(chptr->chname)) 
+    if ((chptr->mode.mode & (MODE_NOPRIVMSGS|MODE_MODERATED)) 
+       || IsModelessChannel(chptr->chname)) 
       return 0;
     else
       return 1;
@@ -1053,15 +1054,12 @@ int can_join(struct Client *sptr, struct Channel *chptr, char *key)
     if (lp->value.chptr == chptr)
       return 0;
   
-#ifdef OPER_WALK_THROUGH_LMODES
   /* An oper can force a join on a local channel using "OVERRIDE" as the key. 
      a HACK(4) notice will be sent if he would not have been supposed
      to join normally. */ 
-  if (IsOperOnLocalChannel(sptr,chptr->chname) && !BadPtr(key) && compall("OVERRIDE",key) == 0)
-  {
+  if (IsLocalChannel(chptr->chname) && HasPriv(sptr, PRIV_WALK_LCHAN) &&
+      !BadPtr(key) && compall("OVERRIDE",key) == 0)
     overrideJoin = MAGIC_OPER_OVERRIDE;
-  }
-#endif
 
   if (chptr->mode.mode & MODE_INVITEONLY)
        return overrideJoin + ERR_INVITEONLYCHAN;
@@ -1207,7 +1205,7 @@ void del_invite(struct Client *cptr, struct Channel *chptr)
 /* List and skip all channels that are listen */
 void list_next_channels(struct Client *cptr, int nr)
 {
-  struct ListingArgs *args = con_listing(cptr);
+  struct ListingArgs *args = cli_listing(cptr);
   struct Channel *chptr = args->chptr;
   chptr->mode.mode &= ~MODE_LISTED;
   while (is_listed(chptr) || --nr >= 0)
@@ -1232,15 +1230,15 @@ void list_next_channels(struct Client *cptr, int nr)
     }
     if (!chptr)
     {
-      MyFree(con_listing(cptr));
-      con_listing(cptr) = NULL;
+      MyFree(cli_listing(cptr));
+      cli_listing(cptr) = NULL;
       send_reply(cptr, RPL_LISTEND);
       break;
     }
   }
   if (chptr)
   {
-    (con_listing(cptr))->chptr = chptr;
+    (cli_listing(cptr))->chptr = chptr;
     chptr->mode.mode |= MODE_LISTED;
   }
 }
@@ -2127,7 +2125,7 @@ mode_parse_ban(struct ParseState *state, int *flag_p)
     newban->next = 0;
 
     DupString(newban->value.ban.banstr, t_str);
-    newban->value.ban.who = state->sptr->name;
+    newban->value.ban.who = cli_name(state->sptr);
     newban->value.ban.when = TStime();
 
     newban->flags = CHFL_BAN | MODE_ADD;
@@ -2386,17 +2384,15 @@ mode_process_clients(struct ParseState *state)
        }
       }
 
-#ifdef NO_OPER_DEOP_LCHAN
       /* don't allow local opers to be deopped on local channels */
       if (MyUser(state->sptr) && state->cli_change[i].client != state->sptr &&
-         IsOperOnLocalChannel(state->cli_change[i].client,
-                              state->chptr->chname)) {
+         IsLocalChannel(state->chptr->chname) &&
+         HasPriv(state->cli_change[i].client, PRIV_DEOP_LCHAN)) {
        send_reply(state->sptr, ERR_ISOPERLCHAN,
                   cli_name(state->cli_change[i].client),
                   state->chptr->chname);
        continue;
       }
-#endif
     }
 
     /* accumulate the change */