]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
added question about oper channel max
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 13 Dec 2005 16:50:17 +0000 (16:50 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 13 Dec 2005 16:50:17 +0000 (16:50 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2369 e03df62e-2008-0410-955e-edbf42e46eb7

configure
src/inspircd.cpp

index 9f408906a204b61c54d0c59a2908b624019682e7..c58d149029cab62e490544065831c02c8041962e 100755 (executable)
--- a/configure
+++ b/configure
@@ -25,7 +25,8 @@ $config{OPTIMITEMP}         = "0";                                            # Default Opti
 $config{OPTIMISATI}         = "-g";                                            # Optimisation Flag
 $config{NICK_LENGT}         = "31";                                            # Default Nick Length
 $config{CHAN_LENGT}         = "64";                                            # Default Channel Name Length
 $config{OPTIMISATI}         = "-g";                                            # Optimisation Flag
 $config{NICK_LENGT}         = "31";                                            # Default Nick Length
 $config{CHAN_LENGT}         = "64";                                            # Default Channel Name Length
-$config{MAX_CHANNE}         = "20";                                            # Default Max. Channels per user..
+$config{MAX_CHANNE}         = "20";                                            # Default Max. Channels per user
+$config{MAX_OPERCH}         = "60";                                            # Default Max. Channels per oper
 $config{MAXI_MODES}         = "20";                                            # Default Max. Number of Modes set at once.
 $config{HAS_STRLCPY}        = "false";                                         # strlcpy Check.
 $config{USE_KQUEUE}         = "y";                                             # kqueue enabled
 $config{MAXI_MODES}         = "20";                                            # Default Max. Number of Modes set at once.
 $config{HAS_STRLCPY}        = "false";                                         # strlcpy Check.
 $config{USE_KQUEUE}         = "y";                                             # kqueue enabled
@@ -330,7 +331,7 @@ while (!$continue) {
 
 $continue = 0;
 while (!$continue) {
 
 $continue = 0;
 while (!$continue) {
-  print "What is the maximum number of channels a user may join at any one time?\n";
+  print "What is the maximum number of channels a normal user may join at any one time?\n";
   print "[\033[1;32m$config{MAX_CHANNE}\033[0m] -> ";
   chomp($var = <STDIN>);
   if ($var eq "") { $var = $config{MAX_CHANNE}; }
   print "[\033[1;32m$config{MAX_CHANNE}\033[0m] -> ";
   chomp($var = <STDIN>);
   if ($var eq "") { $var = $config{MAX_CHANNE}; }
@@ -344,6 +345,20 @@ while (!$continue) {
   }
 }
 
   }
 }
 
+$continue = 0;
+while (!$continue) {
+  print "What is the maximum number of channels an oper may join at any one time?\n";
+  print "[\033[1;32m$config{MAX_OPERCH}\033[0m] -> ";
+  chomp($var = <STDIN>);
+  if ($var eq "") { $var = $config{MAX_OPERCH}; }
+  if ($var =~ /^\d+$/) {
+    # We don't care what the number is, set it and be on our way.
+    $config{MAX_OPERCH} = $var;
+    $continue = 1;
+    print "\n";
+ }
+}
+
 $continue = 0;
 while (!$continue) {
   print "What is the maximum number of mode changes in one line?\n";
 $continue = 0;
 while (!$continue) {
   print "What is the maximum number of mode changes in one line?\n";
@@ -706,6 +721,7 @@ sub writefiles {
 #define NICKMAX $NL
 #define CHANMAX $CL
 #define MAXCHANS $config{MAX_CHANNE}
 #define NICKMAX $NL
 #define CHANMAX $CL
 #define MAXCHANS $config{MAX_CHANNE}
+#define OPERMAXCHANS $config{MAX_OPERCH}
 #define MAXMODES $config{MAXI_MODES}
 #define IDENTMAX $config{MAX_IDENT}
 #define MAXQUIT $config{MAX_QUIT}
 #define MAXMODES $config{MAXI_MODES}
 #define IDENTMAX $config{MAX_IDENT}
 #define MAXQUIT $config{MAX_QUIT}
index 62731ecf98f6c96d03375c60719dccce10a2ddaf..a92a8ffdcb02177e7712814b0c7eea475b18c546 100644 (file)
@@ -718,47 +718,64 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri
        
        for (unsigned int index =0; index < user->chans.size(); index++)
        {
        
        for (unsigned int index =0; index < user->chans.size(); index++)
        {
-               log(DEBUG,"Check location %d",index);
                if (user->chans[index].channel == NULL)
                {
                if (user->chans[index].channel == NULL)
                {
-                       log(DEBUG,"Adding into their channel list at location %d",index);
-
-                       if (created == 2) 
-                       {
-                               /* first user in is given ops */
-                               user->chans[index].uc_modes = UCMODE_OP;
-                       }
-                       else
-                       {
-                               user->chans[index].uc_modes = 0;
-                       }
-                       user->chans[index].channel = Ptr;
-                       Ptr->AddUser((char*)user);
-                       WriteChannel(Ptr,user,"JOIN :%s",Ptr->name);
-                       
-                       log(DEBUG,"Sent JOIN to client");
-
-                       if (Ptr->topicset)
-                       {
-                               WriteServ(user->fd,"332 %s %s :%s", user->nick, Ptr->name, Ptr->topic);
-                               WriteServ(user->fd,"333 %s %s %s %lu", user->nick, Ptr->name, Ptr->setby, (unsigned long)Ptr->topicset);
-                       }
-                       userlist(user,Ptr);
-                       WriteServ(user->fd,"366 %s %s :End of /NAMES list.", user->nick, Ptr->name);
-                       //WriteServ(user->fd,"324 %s %s +%s",user->nick, Ptr->name,chanmodes(Ptr));
-                       //WriteServ(user->fd,"329 %s %s %lu", user->nick, Ptr->name, (unsigned long)Ptr->created);
-                       FOREACH_MOD OnUserJoin(user,Ptr);
-                       return Ptr;
+                       return ForceChan(Ptr,user->chans[index],user,created);
                }
        }
        /* XXX: If the user is an oper here, we can just extend their user->chans vector by one
                }
        }
        /* XXX: If the user is an oper here, we can just extend their user->chans vector by one
-        * and put the channel in here. Otherwise, nope, youre boned.
+        * and put the channel in here. Same for remote users which are not bound by
+        * the channel limits. Otherwise, nope, youre boned.
         */
         */
+       if (strcasecmp(user->server,ServerName))
+       {
+               ucrec a;
+               chanrec* c = ForceChan(Ptr,a,user,created);
+               user->chans.push_back(a);
+               return c;
+       }
+       else if (strchr(user->modes,'o'))
+       {
+               /* Oper allows extension up to the OPERMAXCHANS value */
+               if (user->chans.size() < OPERMAXCHANS)
+               {
+                       ucrec a;
+                       chanrec* c = ForceChan(Ptr,a,user,created);
+                       user->chans.push_back(a);
+                       return c;
+               }
+       }
        log(DEBUG,"add_channel: user channel max exceeded: %s %s",user->nick,cname);
        WriteServ(user->fd,"405 %s %s :You are on too many channels",user->nick, cname);
        return NULL;
 }
 
        log(DEBUG,"add_channel: user channel max exceeded: %s %s",user->nick,cname);
        WriteServ(user->fd,"405 %s %s :You are on too many channels",user->nick, cname);
        return NULL;
 }
 
+chanrec* ForceChan(chanrec* Ptr,ucrec &a,userrec* user, int created)
+{
+       if (created == 2)
+       {
+               /* first user in is given ops */
+               a.uc_modes = UCMODE_OP;
+       }
+       else
+       {
+               a.uc_modes = 0;
+       }
+       a.channel = Ptr;
+       Ptr->AddUser((char*)user);
+       WriteChannel(Ptr,user,"JOIN :%s",Ptr->name);
+       log(DEBUG,"Sent JOIN to client");
+       if (Ptr->topicset)
+       {
+               WriteServ(user->fd,"332 %s %s :%s", user->nick, Ptr->name, Ptr->topic);
+               WriteServ(user->fd,"333 %s %s %s %lu", user->nick, Ptr->name, Ptr->setby, (unsigned long)Ptr->topicset);
+       }
+       userlist(user,Ptr);
+       WriteServ(user->fd,"366 %s %s :End of /NAMES list.", user->nick, Ptr->name);
+       FOREACH_MOD OnUserJoin(user,Ptr);
+       return Ptr;
+}
+
 /* remove a channel from a users record, and remove the record from memory
  * if the channel has become empty */
 
 /* remove a channel from a users record, and remove the record from memory
  * if the channel has become empty */