1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-09 19:33:13 +02:00

- Added '/REHASH -global' command which will rehash all servers on the

network. You can also specify options like '/REHASH -global -motd' to
  rehash only the MOTD/RULES/etc. Just like /REHASH <servername> this is a
  NetAdmin-only command. This command is fully backwards compatible with
  older UnrealIRCd version in the sense that it will also REHASH old
  Unreal's. Suggested by 'P' in #0001522.
This commit is contained in:
Bram Matthys
2010-11-15 15:50:52 +00:00
parent d5167c69ad
commit d107a4a6a8
4 changed files with 61 additions and 7 deletions
+6
View File
@@ -2208,3 +2208,9 @@
- Little tweak to +Z: when the last insecure user parts and the channel is
set +Z (secure), the parting user saw the MODE too, which was silly.
Reported by Robby22 (#0003720).
- Added '/REHASH -global' command which will rehash all servers on the
network. You can also specify options like '/REHASH -global -motd' to
rehash only the MOTD/RULES/etc. Just like /REHASH <servername> this is a
NetAdmin-only command. This command is fully backwards compatible with
older UnrealIRCd version in the sense that it will also REHASH old
Unreal's. Suggested by 'P' in #0001522.
+3 -2
View File
@@ -3335,9 +3335,10 @@ to get more information on a command.</p>
<td>IRCop</td>
</tr>
<tr>
<td height="39">rehash &lt;server&gt; &lt;flags&gt;</td>
<td height="39">rehash &lt;server|-global&gt; &lt;flags&gt;</td>
<td>Rehashes the servers config file. Including a server name allows you to
rehash a remote servers config file. Several flags are also available. They
rehash a remote servers config file, and using -global will rehash all
servers on the network (both are NetAdmin-only). Several flags are also available. They
Include <br>
-dns - Reinitializes and reloads the resolver<br>
-motd - Only re-read all MOTD, BOTMOTD, OPERMOTD and RULES files (including those in tld{} blocks)<br>
+6 -4
View File
@@ -913,13 +913,15 @@ help Rehash {
" Prompts the server to reread the configuration files.";
" IRC Operator only command.";
" -";
" Syntax: REHASH <servername> <flag>";
" REHASH <flag>";
" Syntax: REHASH <servername> [flag]";
" REHASH -global [flag]";
" REHASH [flag]";
" -";
" If servername and flags are not specified this rehashes the";
" If servername and flag are not specified this rehashes the";
" unrealircd.conf, and re-reads all MOTD, BOTMOTD, OPERMOTD and RULES files.";
" If servername is specified, this is used to rehash the remote server.";
" Only NetAdmins may specify a server name.";
" If -global is specified, then all servers on the network are rehashed.";
" Only NetAdmins may specify a server name and use -global.";
" -";
" The flags are used to rehash other config files, valid flags are:";
" -dns - Reinitializes and reloads the resolver";
+46 -1
View File
@@ -653,7 +653,10 @@ CMD_FUNC(m_rehash)
else
x = hunt_server_token(cptr, sptr, MSG_REHASH, TOK_REHASH, "%s", 1, parc, parv);
} else {
x = hunt_server_token(cptr, sptr, MSG_REHASH, TOK_REHASH, "%s %s", 1, parc, parv);
if (!_match("-glob*", parv[1])) /* This is really ugly... hack to make /rehash -global -something work */
x = HUNTED_ISME;
else
x = hunt_server_token(cptr, sptr, MSG_REHASH, TOK_REHASH, "%s %s", 1, parc, parv);
}
if (x != HUNTED_ISME)
return 0; /* Now forwarded or server didnt exist */
@@ -683,6 +686,48 @@ CMD_FUNC(m_rehash)
(parc > 1) ? ((*parv[1] == 'q') ? 2 : 0) : 0);
}
parv[1] = parv[2];
} else {
/* Ok this is in an 'else' because it should be only executed for sptr == cptr,
* but it's totally unrelated to the above ;).
*/
if (parv[1] && !_match("-glob*", parv[1]))
{
/* /REHASH -global [options] */
Link *lp;
aClient *acptr;
/* Shift parv's to the left */
parv[1] = parv[2];
parv[2] = NULL;
parc--;
/* Only netadmins may use /REHASH -global, which is because:
* a) it makes sense
* b) remote servers don't support remote rehashes by non-netadmins
*/
if (!IsNetAdmin(sptr))
{
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
sendnotice(sptr, "'/REHASH -global' requires you to be NetAdmin");
return 0;
}
if (parv[1] && *parv[1] != '-')
{
sendnotice(sptr, "You cannot specify a server name after /REHASH -global, for obvious reasons");
return 0;
}
/* Broadcast it in an inefficient, but backwards compatible way. */
for (lp = Servers; lp; lp = lp->next)
{
acptr = lp->value.cptr;
if (acptr == &me)
continue;
sendto_one(acptr, ":%s %s %s",
sptr->name,
IsToken(acptr->from) ? TOK_REHASH : MSG_REHASH,
parv[1] ? parv[1] : "-all");
}
/* Don't return, continue, because we need to REHASH ourselves as well. */
}
}
if (!BadPtr(parv[1]) && stricmp(parv[1], "-all"))