]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-channel.c
io_event_disable: return if event-to-disable is already off
[ngircd-alex.git] / src / ngircd / irc-channel.c
index f30df91acdadb984be809d00c3032becdb9a0eb8..03204d653af7072258b7844c29978f8087b902b6 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-channel.c,v 1.37 2006/10/06 21:32:58 fw Exp $";
+static char UNUSED id[] = "$Id: irc-channel.c,v 1.40 2007/07/31 18:56:14 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -52,7 +52,9 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
        assert( Req != NULL );
 
        /* Bad number of arguments? */
-       if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
+       if (Req->argc < 1 || Req->argc > 2)
+               return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+                                         Client_ID(Client), Req->command);
 
        /* Who is the sender? */
        if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
@@ -78,8 +80,17 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
                chan = NULL; flags = NULL;
 
                /* wird der Channel neu angelegt? */
-               if( Channel_Search( channame )) is_new_chan = false;
-               else is_new_chan = true;
+               if( Channel_Search( channame )) {
+                       is_new_chan = false;
+               } else {
+                       if (Conf_PredefChannelsOnly) { /* this server does not allow creation of channels */
+                               IRC_WriteStrClient( Client, ERR_BANNEDFROMCHAN_MSG, Client_ID( Client ), channame );
+                               /* Try next name, if any */
+                               channame = strchr(channame, ',');
+                               continue;
+                       }
+                       is_new_chan = true;
+               }
 
                /* Hat ein Server Channel-User-Modes uebergeben? */
                if( Client_Type( Client ) == CLIENT_SERVER )
@@ -113,8 +124,8 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
                                chan = Channel_Search( channame );
                                assert( chan != NULL );
 
-                               is_banned = Lists_CheckBanned( target, chan );
-                               is_invited = Lists_CheckInvited( target, chan );
+                               is_banned = Lists_Check(Channel_GetListBans(chan), target );
+                               is_invited = Lists_Check(Channel_GetListInvites(chan), target );
 
                                /* Testen, ob Client gebanned ist */
                                if(( is_banned == true) &&  ( is_invited == false ))
@@ -169,7 +180,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
                         * commands) in this list become deleted when a user
                         * joins a channel this way. */
                        chan = Channel_Search( channame );
-                       if( chan != NULL ) (void)Lists_CheckInvited( target, chan );
+                       if( chan != NULL ) (void)Lists_Check(Channel_GetListInvites(chan), target);
                }
 
                /* Channel joinen (und ggf. anlegen) */