Committer : entrope
CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Commit time: 2005-04-07 02:10:33 UTC
Modified files:
ChangeLog include/numeric.h ircd/channel.c ircd/s_err.c
Log message:
Split RPL_APASSWARN and ERR_NOTMANAGER into multiple messages to avoid
embedding message strings in the logic implementation.
---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.590 ircu2.10/ChangeLog:1.591
--- ircu2.10/ChangeLog:1.590 Wed Apr 6 17:25:47 2005
+++ ircu2.10/ChangeLog Wed Apr 6 19:10:21 2005
@@ -1,5 +1,21 @@
2005-04-06 Michael Poole <[EMAIL PROTECTED]>
+ * include/numeric.h (RPL_APASSWARN): Replace with three distinct
+ values.
+ (ERR_NOMANAGER_LONG): Assign new numeric.
+ (ERR_NOMANAGER_SHORT): Assign new numeric.
+
+ * ircd/channel.c (parse_mode_upass): Adapt to new formats for
+ ERR_NOTMANAGER separation.
+ (parse_mode_apass): Likewise. Also adapt to RPL_APASSWARN split.
+
+ * ircd/s_err.c (RPL_APASSWARN): Replace with three message
+ strings, to avoid embedding long message strings in the logic
+ implementation.
+ (ERR_NOTMANAGER): Likewise (but not the same strings).
+
+2005-04-06 Michael Poole <[EMAIL PROTECTED]>
+
* ircd/ircd_parser.y (clientblock): Use the password field.
* ircd/s_user.c (register_user): Allow aconf->password to be a
Index: ircu2.10/include/numeric.h
diff -u ircu2.10/include/numeric.h:1.36 ircu2.10/include/numeric.h:1.37
--- ircu2.10/include/numeric.h:1.36 Tue Mar 29 19:48:22 2005
+++ ircu2.10/include/numeric.h Wed Apr 6 19:10:22 2005
@@ -18,7 +18,7 @@
*/
/** @file
* @brief Declarations of numeric replies and supporting functions.
- * @version $Id: numeric.h,v 1.36 2005/03/30 03:48:22 entrope Exp $
+ * @version $Id: numeric.h,v 1.37 2005/04/07 02:10:22 entrope Exp $
*/
#ifndef INCLUDED_numeric_h
#define INCLUDED_numeric_h
@@ -63,7 +63,9 @@
#define RPL_MAP 15 /* Undernet extension */
#define RPL_MAPMORE 16 /* Undernet extension */
#define RPL_MAPEND 17 /* Undernet extension */
-#define RPL_APASSWARN 30 /* Undernet extension */
+#define RPL_APASSWARN_SET 30 /* Undernet extension */
+#define RPL_APASSWARN_SECRET 31 /* Undernet extension */
+#define RPL_APASSWARN_CLEAR 32 /* Undernet extension */
/* RPL_YOURID 42 IRCnet extension */
/* RPL_ATTEMPTINGJUNC 50 aircd extension */
/* RPL_ATTEMPTINGREROUTE 51 aircd extension */
@@ -459,7 +461,9 @@
#define ERR_CHANSECURED 552 /* Undernet extension */
#define ERR_UPASSSET 553 /* Undernet extension */
#define ERR_UPASSNOTSET 554 /* Undernet extension */
-#define ERR_LASTERROR 555
+#define ERR_NOMANAGER_LONG 555 /* Undernet extension */
+#define ERR_NOMANAGER_SHORT 556 /* Undernet extension */
+#define ERR_LASTERROR 557
/* RPL_LOGON 600 dalnet,unreal
RPL_LOGOFF 601 dalnet,unreal
Index: ircu2.10/ircd/channel.c
diff -u ircu2.10/ircd/channel.c:1.123 ircu2.10/ircd/channel.c:1.124
--- ircu2.10/ircd/channel.c:1.123 Tue Mar 22 19:16:37 2005
+++ ircu2.10/ircd/channel.c Wed Apr 6 19:10:23 2005
@@ -19,7 +19,7 @@
*/
/** @file
* @brief Channel management and maintenance
- * @version $Id: channel.c,v 1.123 2005/03/23 03:16:37 entrope Exp $
+ * @version $Id: channel.c,v 1.124 2005/04/07 02:10:23 entrope Exp $
*/
#include "config.h"
@@ -2439,7 +2439,7 @@
if (state->flags & MODE_PARSE_FORCE && MyUser(state->sptr)
&& !HasPriv(state->sptr, PRIV_APASS_OPMODE)) {
send_reply(state->sptr, ERR_NOTMANAGER, state->chptr->chname,
- "Use /JOIN", state->chptr->chname, " <AdminPass>.");
+ state->chptr->chname);
return;
}
@@ -2447,16 +2447,15 @@
if (MyUser(state->sptr) && !(state->flags & MODE_PARSE_FORCE ||
IsChannelManager(state->member))) {
if (*state->chptr->mode.apass) {
send_reply(state->sptr, ERR_NOTMANAGER, state->chptr->chname,
- "Use /JOIN", state->chptr->chname, "<AdminPass>.");
+ state->chptr->chname);
+ } else if (TStime() - state->chptr->creationtime >= 171000) {
+ send_reply(state->sptr, ERR_NOMANAGER_LONG, state->chptr->chname);
} else {
- send_reply(state->sptr, ERR_NOTMANAGER, state->chptr->chname,
- "Re-create the channel. The channel must be *empty* for",
- TStime() - state->chptr->creationtime >= 171000 ? "48 contiguous
hours" : "a minute or two",
- "before it can be recreated.");
+ send_reply(state->sptr, ERR_NOMANAGER_SHORT, state->chptr->chname);
}
return;
}
-
+
if (state->done & DONE_UPASS) /* allow upass to be set only once */
return;
state->done |= DONE_UPASS;
@@ -2479,7 +2478,7 @@
if (!state->mbuf)
return;
- if (!(state->flags & MODE_PARSE_FORCE))
+ if (!(state->flags & MODE_PARSE_FORCE)) {
/* can't add the upass while apass is not set */
if (state->dir == MODE_ADD && !*state->chptr->mode.apass) {
send_reply(state->sptr, ERR_UPASSNOTSET, state->chptr->chname,
state->chptr->chname);
@@ -2492,6 +2491,7 @@
send_reply(state->sptr, ERR_KEYSET, state->chptr->chname);
return;
}
+ }
if (!(state->flags & MODE_PARSE_WIPEOUT) && state->dir == MODE_ADD &&
!ircd_strcmp(state->chptr->mode.upass, t_str))
@@ -2547,7 +2547,7 @@
if (state->flags & MODE_PARSE_FORCE && MyUser(state->sptr)
&& !HasPriv(state->sptr, PRIV_APASS_OPMODE)) {
send_reply(state->sptr, ERR_NOTMANAGER, state->chptr->chname,
- "Use /JOIN", state->chptr->chname, " <AdminPass>.");
+ state->chptr->chname);
return;
}
@@ -2561,15 +2561,15 @@
if (MyUser(state->sptr) && !(state->flags & MODE_PARSE_FORCE ||
IsChannelManager(state->member))) {
if (*state->chptr->mode.apass) {
send_reply(state->sptr, ERR_NOTMANAGER, state->chptr->chname,
- "Use /JOIN", state->chptr->chname, "<AdminPass>.");
+ state->chptr->chname);
+ } else if (TStime() - state->chptr->creationtime >= 171000) {
+ send_reply(state->sptr, ERR_NOMANAGER_LONG, state->chptr->chname);
} else {
- send_reply(state->sptr, ERR_NOTMANAGER, state->chptr->chname,
- "Re-create the channel. The channel must be *empty* for",
- "at least a whole minute", "before it can be recreated.");
+ send_reply(state->sptr, ERR_NOMANAGER_SHORT, state->chptr->chname);
}
return;
}
-
+
if (state->done & DONE_APASS) /* allow apass to be set only once */
return;
state->done |= DONE_APASS;
@@ -2624,25 +2624,14 @@
/* Make it VERY clear to the user that this is a one-time password */
ircd_strncpy(state->chptr->mode.apass, t_str, PASSLEN);
if (MyUser(state->sptr)) {
- send_reply(state->sptr, RPL_APASSWARN,
- "Channel Admin password (+A) set to '", state->chptr->mode.apass,
"'. ",
- "Are you SURE you want to use this as Admin password? ",
- "You will NOT be able to change this password anymore once the
channel is more than 48 hours old!");
- send_reply(state->sptr, RPL_APASSWARN,
- "Use \"/MODE ", state->chptr->chname, " -A ",
state->chptr->mode.apass,
- "\" to remove the password and then immediately set a new one. "
- "IMPORTANT: YOU CANNOT RECOVER THIS PASSWORD, EVER; "
- "WRITE THE PASSWORD DOWN (don't store this rescue password on
disk)! "
- "Now set the channel user password (+U).");
+ send_reply(state->sptr, RPL_APASSWARN_SET, state->chptr->mode.apass);
+ send_reply(state->sptr, RPL_APASSWARN_SECRET, state->chptr->chname,
+ state->chptr->mode.apass);
}
} else { /* remove the old apass */
*state->chptr->mode.apass = '\0';
if (MyUser(state->sptr))
- send_reply(state->sptr, RPL_APASSWARN,
- "WARNING: You removed the channel Admin password MODE (+A). ",
- "If you would disconnect or leave the channel without setting a new
password then you will ",
- "not be able to set it again and lose ownership of this channel! ",
- "SET A NEW PASSWORD NOW!", "");
+ send_reply(state->sptr, RPL_APASSWARN_CLEAR);
}
}
}
Index: ircu2.10/ircd/s_err.c
diff -u ircu2.10/ircd/s_err.c:1.64 ircu2.10/ircd/s_err.c:1.65
--- ircu2.10/ircd/s_err.c:1.64 Tue Mar 29 19:48:22 2005
+++ ircu2.10/ircd/s_err.c Wed Apr 6 19:10:23 2005
@@ -18,7 +18,7 @@
*/
/** @file
* @brief Error handling support.
- * @version $Id: s_err.c,v 1.64 2005/03/30 03:48:22 entrope Exp $
+ * @version $Id: s_err.c,v 1.65 2005/04/07 02:10:23 entrope Exp $
*/
#include "config.h"
@@ -92,11 +92,11 @@
/* 029 */
{ 0 },
/* 030 */
- { RPL_APASSWARN, ":%s%s%s%s%s", "030" },
+ { RPL_APASSWARN_SET, ":Channel Admin password (+A) set to '%s'. Are you
SURE you want to use this as Admin password? You will NOT be able to change
this password anymore once the channel is more than 48 hours old!", "030" },
/* 031 */
- { 0 },
+ { RPL_APASSWARN_SECRET, ":Use \"/MODE %s -A %s\" to remove the password and
then immediately set a new one. IMPORTANT: YOU CANNOT RECOVER THIS PASSWORD,
EVER; WRITE THE PASSWORD DOWN (don't store this rescue password on disk)! Now
set the channel user password (+U).", "031" },
/* 032 */
- { 0 },
+ { RPL_APASSWARN_CLEAR, ":WARNING: You removed the channel Admin password
(+A). If you disconnect or leave the channel without setting a new password
then you will not be able to set it again! SET A NEW PASSWORD NOW!", "032" },
/* 033 */
{ 0 },
/* 034 */
@@ -1134,7 +1134,7 @@
/* 550 */
{ ERR_NOTLOWEROPLEVEL, "%s %s %hu %hu :Cannot %s someone with %s op-level",
"550" },
/* 551 */
- { ERR_NOTMANAGER, "%s :You must be channel Admin to add or remove a
password. %s %s %s", "551" },
+ { ERR_NOTMANAGER, "%s :You must be channel Admin to add or remove a
password. Use /JOIN %s <AdminPass>.", "551" },
/* 552 */
{ ERR_CHANSECURED, "%s :Channel is older than 48 hours and secured. Cannot
change Admin pass anymore", "552" },
/* 553 */
@@ -1142,9 +1142,9 @@
/* 554 */
{ ERR_UPASSNOTSET, "%s :Cannot set user pass (+U) until Admin pass (+A) is
set. First use /MODE %s +A <adminpass>", "554" },
/* 555 */
- { 0 },
+ { ERR_NOMANAGER_LONG, "%s :Re-create the channel. The channel must be
*empty* for 48 continuous hours before it can be recreated.", "555" },
/* 556 */
- { 0 },
+ { ERR_NOMANAGER_SHORT, "%s :Re-create the channel. The channel must be
*empty* for a minute or two before it can be recreated.", "556" },
/* 557 */
{ 0 },
/* 558 */
----------------------- End of diff -----------------------