added gnutls backend and moved backend code into new files
[ircu2.10.12-pk.git] / ircd / m_join.c
index e2e3e4f38151eec9ccad0e0838c99edcc5af0290..e0049667ca8a1eb691f603312e453ad0bb8688b6 100644 (file)
@@ -158,7 +158,7 @@ int m_join(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
 
     if (!(chptr = FindChannel(name))) {
       if (((name[0] == '&') && !feature_bool(FEAT_LOCAL_CHANNELS))
-          || strlen(name) >= IRCD_MIN(CHANNELLEN, feature_int(FEAT_CHANNELLEN))) {
+          || strlen(name) > IRCD_MIN(CHANNELLEN, feature_int(FEAT_CHANNELLEN))) {
         send_reply(sptr, ERR_NOSUCHCHANNEL, name);
         continue;
       }
@@ -239,24 +239,30 @@ int m_join(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
 
       /* Is there some reason the user may not join? */
       if (err) {
-        send_reply(sptr, err, chptr->chname);
+        switch(err) {
+          case ERR_NEEDREGGEDNICK:
+            send_reply(sptr, 
+                       ERR_NEEDREGGEDNICK, 
+                       chptr->chname, 
+                       feature_str(FEAT_URLREG));            
+            break;
+          default:
+            send_reply(sptr, err, chptr->chname);
+            break;
+        }
         continue;
       }
 
       joinbuf_join(&join, chptr, flags);
       if (flags & CHFL_CHANOP) {
         struct ModeBuf mbuf;
-#if 0
-        /* Send a MODE to the other servers. If the user used the A/U pass,
-        * let his server op him, otherwise let him op himself. */
-       modebuf_init(&mbuf, chptr->mode.apass[0] ? &me : sptr, cptr, chptr, MODEBUF_DEST_SERVER);
-#else
        /* Always let the server op him: this is needed on a net with older servers
           because they 'destruct' channels immediately when they become empty without
           sending out a DESTRUCT message. As a result, they would always bounce a mode
-          (as HACK(2)) when the user ops himself. */
+          (as HACK(2)) when the user ops himself.
+           (There is also no particularly good reason to have the user op himself.)
+        */
        modebuf_init(&mbuf, &me, cptr, chptr, MODEBUF_DEST_SERVER);
-#endif
        modebuf_mode_client(&mbuf, MODE_ADD | MODE_CHANOP, sptr,
                             chptr->mode.apass[0] ? ((flags & CHFL_CHANNEL_MANAGER) ? 0 : 1) : MAXOPLEVEL);
        modebuf_flush(&mbuf);