/** * status.C: This file contains code for the ChanServ STATUS function. * * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team * Rights to this code are as documented in COPYING. * * * Portions of this file were derived from sources bearing the following license: * Copyright © 2005 William Pitcock, et al. * Rights to this code are as documented in doc/pod/license.pod. * * $Id: status.C,v 1.10 2007/09/22 14:27:27 pippijn Exp $ */ #include "atheme.h" #include #include #include #include #include static char const rcsid[] = "$Id: status.C,v 1.10 2007/09/22 14:27:27 pippijn Exp $"; REGISTER_MODULE ("chanserv/status", false, "The Ermyth Team "); static void cs_cmd_status (sourceinfo_t *si, int parc, char *parv[]); command_t const cs_status = { "STATUS", N_("Displays your status in services."), AC_NONE, 1, cs_cmd_status }; E cmdvec cs_cmdtree; E helpvec cs_helptree; bool _modinit (module *m) { cs_cmdtree << cs_status; help_addentry (cs_helptree, "STATUS", "help/chanserv/status", NULL); return true; } void _moddeinit () { cs_cmdtree >> cs_status; help_delentry (cs_helptree, "STATUS"); } static void cs_cmd_status (sourceinfo_t *si, int parc, char *parv[]) { char *chan = parv[0]; if (chan) { mychan_t *mc = mychan_t::find (chan); unsigned int flags; if (*chan != '#') { command_fail (si, fault::badparams, STR_INVALID_PARAMS, "STATUS"); return; } if (!mc) { command_fail (si, fault::nosuch_target, _("\2%s\2 is not registered."), chan); return; } logcommand (si, CMDLOG_GET, "%s STATUS", mc->name); if (mc->find_metadata ("private:close:closer")) { command_fail (si, fault::noprivs, _("\2%s\2 is closed."), chan); return; } flags = chanacs_source_flags (mc, si); if (flags & CA_AKICK && !(flags & CA_REMOVE)) command_success_nodata (si, _("You are banned from \2%s\2."), mc->name); else if (flags != 0) { command_success_nodata (si, _("You have access flags \2%s\2 on \2%s\2."), bitmask_to_flags (flags, chanacs_flags), mc->name); } else command_success_nodata (si, _("You have no special access to \2%s\2."), mc->name); return; } logcommand (si, CMDLOG_GET, "STATUS"); if (!si->smu) command_success_nodata (si, _("You are not logged in.")); else { command_success_nodata (si, _("You are logged in as \2%s\2."), si->smu->name); if (is_soper (si->smu)) { soper_t *soper = si->smu->soper; command_success_nodata (si, _("You are a services operator of class %s."), soper->operclass ? soper->operclass->name : soper->classname); } } if (si->su != NULL) { mynick_t *mn; mn = mynick_t::find (si->su->nick); if (mn != NULL && mn->owner != si->smu && mn->owner->access_verify (si->su)) command_success_nodata (si, _("You are recognized as \2%s\2."), mn->owner->name); } if (si->su != NULL && is_admin (si->su)) command_success_nodata (si, _("You are a server administrator.")); if (si->su != NULL && is_ircop (si->su)) command_success_nodata (si, _("You are an IRC operator.")); }