Perry Lorier wrote:
Reed Loden wrote:
On Sun, 21 Jan 2007 01:24:56 -0500
Jeannot Langlois <[EMAIL PROTECTED]> wrote:
*[ChangeLog]*
- Modified m_join.c's m_join() routine to return a more
user-friendly error message (clearly pointing out the UnderNet
CService accounts webpage) to unregistered users who attempt to join
a channel set to
use mode +r.
I would much rather see this patch as a change to the numeric replies
in ircd/s_err.c. For example, take a look at QuakeNet's asuka
(https://svn.quakenet.org/svn/quakenet/asuka/branches/paultrusts/patches/asuka-friendly_errors.patch).
Notice how they just modify the replies in ircd/s_err.c instead of
modifying ircd/m_join.c. This achieves the same effect without adding a
hack to m_join.c. :)
a combination may be required to do what NumberSIX wants, changing
s_err.c to:
{ ERR_NEEDREGGEDNICK, "%s :Cannot join channel, you must be authed to
join (+r). You can obtain an account from %s", "477" },
then change m_join.c to something like:
if (err) {
switch(err) {
case ERR_NEEDREGGEDNICK:
send_reply(sptr,ERR_NEEDREGGEDNICK,name,feature_str(FEAT_URLREG);
break;
default:
send_reply(sptr,err,name);
break;
}
}
then you'd have to add FEAT_URLREG as a feature (see
FEAT_HIS_URLSERVERS as an example).
then people could configure the url in the config.
Agreed - It's always better to avoid hardcoding.
Regenerated patch using latest idea above. Re-ran all testcases.
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.
*[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/22), 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).
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: 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
--- include/ircd_features.h 16 Feb 2006 03:49:54 -0000 1.38.2.5
+++ include/ircd_features.h 23 Jan 2007 02:31:09 -0000
@@ -154,6 +154,7 @@
/* Misc. random stuff */
FEAT_NETWORK,
FEAT_URL_CLIENTS,
+ FEAT_URLREG,
FEAT_LAST_F
};
Index: 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
--- ircd/ircd_features.c 16 Feb 2006 03:49:54 -0000 1.50.2.5
+++ ircd/ircd_features.c 23 Jan 2007 02:31:09 -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: 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
--- ircd/m_join.c 5 Feb 2006 00:50:22 -0000 1.34.2.9
+++ ircd/m_join.c 23 Jan 2007 02:31:09 -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,
+ name,
+ feature_str(FEAT_URLREG));
+ break;
+ default:
+ send_reply(sptr, err, chptr->chname);
+ break;
+ }
continue;
}
Index: 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
--- ircd/s_err.c 9 Jun 2006 02:12:25 -0000 1.72.2.3
+++ ircd/s_err.c 23 Jan 2007 02:31:10 -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