#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 */
#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
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;
}
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;
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);
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))
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;
}
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;
/* 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);
}
}
}
/* 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 */
/* 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 */
/* 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 */