/** * taxonomy.C: Lists object properties via their metadata table. * * 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: taxonomy.C,v 1.9 2007/09/22 14:27:27 pippijn Exp $ */ #include "atheme.h" #include #include static char const rcsid[] = "$Id: taxonomy.C,v 1.9 2007/09/22 14:27:27 pippijn Exp $"; REGISTER_MODULE ("chanserv/taxonomy", false, "The Ermyth Team "); static void cs_cmd_taxonomy (sourceinfo_t *si, int parc, char *parv[]); command_t const cs_taxonomy = { "TAXONOMY", N_("Displays a channel's metadata."), AC_NONE, 1, cs_cmd_taxonomy }; E cmdvec cs_cmdtree; E helpvec cs_helptree; bool _modinit (module *m) { cs_cmdtree << cs_taxonomy; help_addentry (cs_helptree, "TAXONOMY", "help/chanserv/taxonomy", NULL); return true; } void _moddeinit () { cs_cmdtree >> cs_taxonomy; help_delentry (cs_helptree, "TAXONOMY"); } void cs_cmd_taxonomy (sourceinfo_t *si, int parc, char *parv[]) { char *target = parv[0]; mychan_t *mc; bool isoper; if (!target || *target != '#') { command_fail (si, fault::needmoreparams, STR_INSUFFICIENT_PARAMS, "TAXONOMY"); command_fail (si, fault::needmoreparams, _("Syntax: TAXONOMY <#channel>")); return; } if (!(mc = mychan_t::find (target))) { command_fail (si, fault::nosuch_target, _("\2%s\2 is not a registered channel."), target); return; } isoper = has_priv (si, PRIV_CHAN_AUSPEX); if (isoper) logcommand (si, CMDLOG_ADMIN, "%s TAXONOMY (oper)", mc->name); else logcommand (si, CMDLOG_GET, "%s TAXONOMY", mc->name); command_success_nodata (si, _("Taxonomy for \2%s\2:"), target); metadata::map_type::iterator mcmdit = mc->mdmap.begin (); metadata::map_type::iterator mcmdet = mc->mdmap.end (); while (mcmdit != mcmdet) { metadata *md = mcmdit->second; ++mcmdit; if (md->is_private && !isoper) continue; command_success_nodata (si, "%-32s: %s", md->key, md->value); } command_success_nodata (si, _("End of \2%s\2 taxonomy."), target); }