| 1 |
/* |
| 2 |
* Copyright (c) 2005 Atheme Development Group |
| 3 |
* Rights to this code are documented in doc/LICENSE. |
| 4 |
* |
| 5 |
* This file contains routines to handle the GroupServ HELP command. |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "atheme.h" |
| 10 |
#include "groupserv.h" |
| 11 |
|
| 12 |
DECLARE_MODULE_V1 |
| 13 |
( |
| 14 |
"groupserv/fdrop", false, _modinit, _moddeinit, |
| 15 |
PACKAGE_STRING, |
| 16 |
VENDOR_STRING |
| 17 |
); |
| 18 |
|
| 19 |
static void gs_cmd_fdrop(sourceinfo_t *si, int parc, char *parv[]); |
| 20 |
|
| 21 |
command_t gs_fdrop = { "FDROP", N_("Force drops a group registration."), PRIV_GROUP_ADMIN, 1, gs_cmd_fdrop, { .path = "groupserv/fdrop" } }; |
| 22 |
|
| 23 |
static void gs_cmd_fdrop(sourceinfo_t *si, int parc, char *parv[]) |
| 24 |
{ |
| 25 |
mygroup_t *mg; |
| 26 |
char *name = parv[0]; |
| 27 |
|
| 28 |
if (!name) |
| 29 |
{ |
| 30 |
command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "DROP"); |
| 31 |
command_fail(si, fault_needmoreparams, _("Syntax: DROP <!group>")); |
| 32 |
return; |
| 33 |
} |
| 34 |
|
| 35 |
if (*name != '!') |
| 36 |
{ |
| 37 |
command_fail(si, fault_badparams, STR_INVALID_PARAMS, "DROP"); |
| 38 |
command_fail(si, fault_badparams, _("Syntax: DROP <!group>")); |
| 39 |
return; |
| 40 |
} |
| 41 |
|
| 42 |
if (!(mg = mygroup_find(name))) |
| 43 |
{ |
| 44 |
command_fail(si, fault_nosuch_target, _("Group \2%s\2 does not exist."), name); |
| 45 |
return; |
| 46 |
} |
| 47 |
|
| 48 |
remove_group_chanacs(mg); |
| 49 |
logcommand(si, CMDLOG_ADMIN | LG_REGISTER, "FDROP: \2%s\2", entity(mg)->name); |
| 50 |
wallops("%s dropped the group \2%s\2", get_oper_name(si), name); |
| 51 |
object_unref(mg); |
| 52 |
command_success_nodata(si, _("The group \2%s\2 has been dropped."), name); |
| 53 |
return; |
| 54 |
} |
| 55 |
|
| 56 |
|
| 57 |
void _modinit(module_t *m) |
| 58 |
{ |
| 59 |
use_groupserv_main_symbols(m); |
| 60 |
|
| 61 |
service_named_bind_command("groupserv", &gs_fdrop); |
| 62 |
} |
| 63 |
|
| 64 |
void _moddeinit(module_unload_intent_t intent) |
| 65 |
{ |
| 66 |
service_named_unbind_command("groupserv", &gs_fdrop); |
| 67 |
} |
| 68 |
|