]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/login.c
Various fixes and enhancements for the "Autojoin" patch
[ngircd-alex.git] / src / ngircd / login.c
index 0dd0bd892bb030c9cd6ac48584e27748c4d684a0..3412e337a75e6e63a1ef03afd098c1e173878814 100644 (file)
@@ -31,6 +31,7 @@
 #include "log.h"
 #include "messages.h"
 #include "ngircd.h"
+#include "irc-channel.h"
 #include "irc-info.h"
 #include "irc-mode.h"
 #include "irc-write.h"
@@ -201,24 +202,25 @@ Login_User_PostAuth(CLIENT *Client)
        } else
                IRC_SetPenalty(Client, 1);
 
-  /* Autojoin clients to the channels */
-  Login_Autojoin(Client);
+       /* Autojoin clients to the channels */
+       Login_Autojoin(Client);
 
        return CONNECTED;
 }
 
 /**
  * Autojoin clients to the channels set by administrator
- * If autojoin is not set in Config or the channel is not available for search - do nothing
  *
+ * Do nothing if autojoin is not set in the configuration or the channel is not
+ * available (any more).
  **/
 GLOBAL void
 Login_Autojoin(CLIENT *Client)
 {
-       /** make an autojoin to each channel that is good for it **/
        REQUEST Req;
        const struct Conf_Channel *conf_chan;
-       size_t i, n, channel_count = array_length(&Conf_Channels, sizeof(*conf_chan));
+       size_t i, channel_count = array_length(&Conf_Channels, sizeof(*conf_chan));
+
        conf_chan = array_start(&Conf_Channels);
        assert(channel_count == 0 || conf_chan != NULL);
 
@@ -230,7 +232,7 @@ Login_Autojoin(CLIENT *Client)
                Req.prefix = Client_ID(Client_ThisServer());
                Req.command = "JOIN";
                Req.argc = 1;
-               Req.argv[0] = conf_chan->name;
+               Req.argv[0] = (char *)conf_chan->name;
                IRC_JOIN(Client, &Req);
        }
 }