| 1 |
/* |
| 2 |
* Copyright (c) 2005-2006 Atheme Development Group |
| 3 |
* Rights to this code are documented in doc/LICENSE. |
| 4 |
* |
| 5 |
* This file contains functionality which implements the OService REHASH command. |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "atheme.h" |
| 10 |
#include "conf.h" |
| 11 |
|
| 12 |
DECLARE_MODULE_V1 |
| 13 |
( |
| 14 |
"operserv/rehash", false, _modinit, _moddeinit, |
| 15 |
PACKAGE_STRING, |
| 16 |
VENDOR_STRING |
| 17 |
); |
| 18 |
|
| 19 |
static void os_cmd_rehash(sourceinfo_t *si, int parc, char *parv[]); |
| 20 |
|
| 21 |
command_t os_rehash = { "REHASH", N_("Reload the configuration data."), PRIV_ADMIN, 0, os_cmd_rehash, { .path = "oservice/rehash" } }; |
| 22 |
|
| 23 |
void _modinit(module_t *m) |
| 24 |
{ |
| 25 |
service_named_bind_command("operserv", &os_rehash); |
| 26 |
} |
| 27 |
|
| 28 |
void _moddeinit(module_unload_intent_t intent) |
| 29 |
{ |
| 30 |
service_named_unbind_command("operserv", &os_rehash); |
| 31 |
} |
| 32 |
|
| 33 |
/* REHASH */ |
| 34 |
void os_cmd_rehash(sourceinfo_t *si, int parc, char *parv[]) |
| 35 |
{ |
| 36 |
slog(LG_INFO, "UPDATE (due to REHASH): \2%s\2", get_oper_name(si)); |
| 37 |
wallops("Updating database by request of \2%s\2.", get_oper_name(si)); |
| 38 |
expire_check(NULL); |
| 39 |
if (db_save) |
| 40 |
db_save(NULL); |
| 41 |
|
| 42 |
logcommand(si, CMDLOG_ADMIN, "REHASH"); |
| 43 |
wallops("Rehashing \2%s\2 by request of \2%s\2.", config_file, get_oper_name(si)); |
| 44 |
|
| 45 |
if (conf_rehash()) |
| 46 |
command_success_nodata(si, _("REHASH completed.")); |
| 47 |
else |
| 48 |
command_fail(si, fault_nosuch_target, _("REHASH of \2%s\2 failed. Please correct any errors in the file and try again."), config_file); |
| 49 |
} |
| 50 |
|
| 51 |
/* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs |
| 52 |
* vim:ts=8 |
| 53 |
* vim:sw=8 |
| 54 |
* vim:noexpandtab |
| 55 |
*/ |