Kevin L. Mitchell wrote:

Sorry to nitpick, but there's a couple of important things left out of
your patch--all features need to be documented in doc/readme.features,

Done.  "URLREG" feature documented.



and you should also list the feature in the appropriate place in
doc/example.conf.

Done.  "URLREG" feature usage example included in example.conf.



Your patch should also include a ChangeLog hunk...

Done.  Added ChangeLog hunk to latest CVS update version of ChangeLog.



Chris Behrens wrote:

There's also inconsistent use when returning the channel name to
the user.  The old way uses 'chptr->chname' and the new way uses
'name'.  Just something else to nitpick.

Done.  "chptr->chname" is now also used in newly-written code.



Re-ran existing testcases, added new ones for custom "URLREG" value.
Updated patch text follows:



As directed by Isomer, I am submitting my patch on this mailing list. I believe it will be an effective way to direct users without an UnderNet account to the CService account webpage.


[Purpose]
- Display a more user-friendly error message to (potentially clueless newbie) unregistered users who attempt to join a channel that is set to use mode +r -- to help users better understand the situation.

So, rather than seeing:

"#channel:  Cannot join channel (+r)"

An unregistered user would now rather see:

"#channel: Cannot join channel (+r): this channel requires a CService authentication -- you can obtain an account from http://cservice.undernet.org/live/";


[ChangeLog]
- Modified s_err.c's response string so the ERR_NEEDREGGEDNICK error now uses a more user-friendly error message (clearly pointing out the UnderNet CService accounts webpage using new configurable FEAT_URLREG feature) to unregistered users who attempt to join a channel set to use mode +r.
- Added "FEAT_URLREG" in ircd_features.h.
- Defined default value for "FEAT_URLREG" in ircd_features.c.
- Changed m_join.c's m_join() method to add a special case for ERR_NEEDREGGEDNICK, so custom CService URL value defined by "FEAT_URLREG" can be passed to ERR_NEEDREGGENICK's string pattern.
- Listed new "URLREG" feature in readme.features.
- Added default "URLREG" feature value in example.conf.


[Notes]
- N/A.


[TestCases]
On Linux 2.6.11, using gcc v3.2.2, built the latest IRCU2 development tree (u2_10_12_branch - ircu2.10 - 2007/01/27), and configured a dummy IRCU2 IRC server to run locally.


1.
- Using XChat 1.8.9 and nick "NumberSIX", connected to dummy server on local host.
- Created/joined test channel #test123.
- Set channel #test123 to use mode +r.
- Using a second instance of XChat 1.8.9 and nick "NumberSEX", connected to dummy server on local host.
- Tried to join test channel #test123.
PASSED (received new error message from new codepath introduced by this patch: #test123 :Cannot join channel (+r): this channel requires a CService authentication -- you can obtain an account from http://cservice.undernet.org/live/).

2.
After running testcase #1 above:
- Had "NumberSIX" change test channel #test123's mode to -r and set mode +i.
- Had "NumberSEX" try to join test channel #test123.
PASSED (received standard error message for INVITE-only channels through old codepath: Cannot join #test123 (Channel is invite only)).

3.
After running both testcases #1 and #2 above:
- Had "NumberSIX" change test channel #test123's mode to -i.
- Had "NumberSIX" try to join test channel #test123.
PASSED (join succeeded).

4.
Repeated testcases #1-#3 with custom "URLREG" value set to "http://cservice.undernet.org/live666/"; in "lib/ircd.conf".
PASSED.


Enjoy this patch,

--
*Jeannot Langlois*
B. Sc.  Computer Science / B. Sc.  Informatique
Software Developer / Programmeur-Analyste
System/Network Administrator / Administrateur Système/Réseau
*jeannot12 AT linuxmail DOT org
*icq : 1-5-2-6-2-8-9-1
msn : jeannot12 AT hotmail DOT com

LINUX_LOGO <http://jbtserver.sourceforge.net/gif/logo_linux.gif>

Vous recherchez ou voulez offrir un transport de/vers l'Abitibi-Témiscamingue (Québec)?
Cliquez sur la boîte ci-dessous...

Looking for or offering a ride to/from the Abitibi-Temiscamingue (Quebec) area?
Click on the box below...

Covoiturage Rouyn-Noranda <http://covoiturage-rn.blogspot.com>










Index: ircu2.10/ChangeLog
===================================================================
RCS file: /cvsroot/undernet-ircu/ircu2.10/ChangeLog,v
retrieving revision 1.710.2.145
diff -u -r1.710.2.145 ChangeLog
--- ircu2.10/ChangeLog  23 Jan 2007 02:23:26 -0000      1.710.2.145
+++ ircu2.10/ChangeLog  28 Jan 2007 04:31:45 -0000
@@ -1,3 +1,18 @@
+2007-01-27  Jeannot Langlois <[EMAIL PROTECTED]>
+
+       * Modified s_err.c's response string so the ERR_NEEDREGGEDNICK error 
+         now uses a more user-friendly error message (clearly pointing out 
+         the UnderNet CService accounts webpage using new configurable 
+         FEAT_URLREG feature) to unregistered users who attempt to join a 
+         channel set to use mode +r.
+       * Added "FEAT_URLREG" in ircd_features.h.
+       * Defined default value for "FEAT_URLREG" in ircd_features.c.
+       * Changed m_join.c's m_join() method to add a special case for 
+         ERR_NEEDREGGEDNICK, so custom CService URL value defined by 
+         "FEAT_URLREG" can be passed to ERR_NEEDREGGENICK's string pattern. 
+       * Listed new "URLREG" feature in readme.features.
+       * Added default "URLREG" feature value in example.conf.
+
 2007-01-22  Michael Poole <[EMAIL PROTECTED]>
 
        * ircd/channel.c (find_delayed_joins): New function.
Index: ircu2.10/doc/example.conf
===================================================================
RCS file: /cvsroot/undernet-ircu/ircu2.10/doc/example.conf,v
retrieving revision 1.61.2.12
diff -u -r1.61.2.12 example.conf
--- ircu2.10/doc/example.conf   23 Jan 2007 02:05:45 -0000      1.61.2.12
+++ ircu2.10/doc/example.conf   28 Jan 2007 04:31:45 -0000
@@ -866,6 +866,7 @@
 #  "HIS_SERVERNAME" = "*.undernet.org";
 #  "HIS_SERVERINFO" = "The Undernet Underworld";
 #  "HIS_URLSERVERS" = "http://www.undernet.org/servers.php";;
+#  "URLREG" = "http://cservice.undernet.org/live/";;
 };
 
 # Well, you have now reached the end of this sample configuration
Index: ircu2.10/doc/readme.features
===================================================================
RCS file: /cvsroot/undernet-ircu/ircu2.10/doc/readme.features,v
retrieving revision 1.19.2.4
diff -u -r1.19.2.4 readme.features
--- ircu2.10/doc/readme.features        31 May 2006 02:43:00 -0000      1.19.2.4
+++ ircu2.10/doc/readme.features        28 Jan 2007 04:31:45 -0000
@@ -765,6 +765,14 @@
 
 This defines a URL that users may visit to find compatible IRC clients.
 
+URLREG
+ * Type: string
+ * Default: "http://cservice.undernet.org/live/";
+
+This defines a URL that is used in server response 477 (ERR_NEEDREGGEDNICK) to
+let users know which website they must visit to obtain a proper account for
+authentication.
+
 NICKLEN
  * Type: integer
  * Default: 12
Index: ircu2.10/include/ircd_features.h
===================================================================
RCS file: /cvsroot/undernet-ircu/ircu2.10/include/ircd_features.h,v
retrieving revision 1.38.2.5
diff -u -r1.38.2.5 ircd_features.h
--- ircu2.10/include/ircd_features.h    16 Feb 2006 03:49:54 -0000      1.38.2.5
+++ ircu2.10/include/ircd_features.h    28 Jan 2007 04:31:45 -0000
@@ -154,6 +154,7 @@
   /* Misc. random stuff */
   FEAT_NETWORK,
   FEAT_URL_CLIENTS,
+  FEAT_URLREG,
 
   FEAT_LAST_F
 };
Index: ircu2.10/ircd/ircd_features.c
===================================================================
RCS file: /cvsroot/undernet-ircu/ircu2.10/ircd/ircd_features.c,v
retrieving revision 1.50.2.5
diff -u -r1.50.2.5 ircd_features.c
--- ircu2.10/ircd/ircd_features.c       16 Feb 2006 03:49:54 -0000      1.50.2.5
+++ ircu2.10/ircd/ircd_features.c       28 Jan 2007 04:31:45 -0000
@@ -407,6 +407,7 @@
   /* Misc. random stuff */
   F_S(NETWORK, 0, "UnderNet", 0),
   F_S(URL_CLIENTS, 0, "ftp://ftp.undernet.org/pub/irc/clients";, 0),
+  F_S(URLREG, 0, "http://cservice.undernet.org/live/";, 0),
 
 #undef F_S
 #undef F_B
Index: ircu2.10/ircd/m_join.c
===================================================================
RCS file: /cvsroot/undernet-ircu/ircu2.10/ircd/m_join.c,v
retrieving revision 1.34.2.9
diff -u -r1.34.2.9 m_join.c
--- ircu2.10/ircd/m_join.c      5 Feb 2006 00:50:22 -0000       1.34.2.9
+++ ircu2.10/ircd/m_join.c      28 Jan 2007 04:31:45 -0000
@@ -239,7 +239,17 @@
 
       /* 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;
       }
 
Index: ircu2.10/ircd/s_err.c
===================================================================
RCS file: /cvsroot/undernet-ircu/ircu2.10/ircd/s_err.c,v
retrieving revision 1.72.2.3
diff -u -r1.72.2.3 s_err.c
--- ircu2.10/ircd/s_err.c       9 Jun 2006 02:12:25 -0000       1.72.2.3
+++ ircu2.10/ircd/s_err.c       28 Jan 2007 04:31:45 -0000
@@ -986,7 +986,7 @@
 /* 476 */
   { ERR_BADCHANMASK, "%s :Bad Channel Mask", "476" },
 /* 477 */
-  { ERR_NEEDREGGEDNICK, "%s :Cannot join channel (+r)", "477" },
+  { ERR_NEEDREGGEDNICK, "%s :Cannot join channel (+r):  this channel requires 
a CService authentication -- you can obtain an account from %s", "477" },
 /* 478 */
   { ERR_BANLISTFULL, "%s %s :Channel ban/ignore list is full", "478" },
 /* 479 */
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to