/* * pmodule.C: Protocol command management. * * 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: * Rights to this code are documented in doc/pod/license.pod. * Copyright © 2005-2007 Atheme Project (http://www.atheme.org) */ static char const rcsid[] = "$Id: pmodule.C,v 1.7 2007/09/22 14:27:30 pippijn Exp $"; #include #include "atheme.h" #include "pmodule.h" #include typedef std::map pcommand_map; pcommand_map pcommands; cmode_t *mode_list; extmode_t *ignore_mode_list; cmode_t *status_mode_list; cmode_t *prefix_mode_list; protocol::ircd_t *ircd; bool protocol::handler::loaded = false; void pcommand_add (pcommand_t const &pcmd) { if (pcommand_find (pcmd.token)) { slog (LG_INFO, "pcommand_add(): token %s is already registered", pcmd.token); return; } pcommands[pcmd.token] = &pcmd; } void pcommand_delete (pcommand_t const &pcmd) { if (!pcommand_find (pcmd.token)) { slog (LG_INFO, "pcommand_delete(): token %s is not registered", pcmd.token); return; } pcommands.erase (pcmd.token); } pcommand_t const * pcommand_find (char const * const token) { pcommand_map::iterator it; if ((it = pcommands.find (token)) != pcommands.end ()) return it->second; return NULL; }