X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fm_admin.c;h=8c4908ec8d59c3ec14af3042a1ffdd001bad409e;hb=refs%2Fheads%2Fupstream;hp=839d7148846249972cf44916e401e9eea62c0c10;hpb=fda0e2796ececf42f7a36f8066cc63fa1ef736fc;p=ircu2.10.12-pk.git diff --git a/ircd/m_admin.c b/ircd/m_admin.c index 839d714..8c4908e 100644 --- a/ircd/m_admin.c +++ b/ircd/m_admin.c @@ -79,23 +79,35 @@ * note: it is guaranteed that parv[0]..parv[parc-1] are all * non-NULL pointers. */ -#if 0 -/* - * No need to include handlers.h here the signatures must match - * and we don't need to force a rebuild of all the handlers everytime - * we add a new one to the list. --Bleep - */ -#include "handlers.h" -#endif /* 0 */ +#include "config.h" + #include "client.h" +#include "hash.h" +#include "ircd.h" +#include "ircd_features.h" +#include "ircd_log.h" #include "ircd_reply.h" +#include "match.h" #include "msg.h" #include "numeric.h" #include "numnicks.h" #include "s_conf.h" #include "s_user.h" -#include +/* #include -- Now using assert in ircd_log.h */ + +static int send_admin_info(struct Client* sptr) +{ + const struct LocalConf* admin = conf_get_local(); + assert(0 != sptr); + + send_reply(sptr, RPL_ADMINME, cli_name(&me)); + send_reply(sptr, RPL_ADMINLOC1, admin->location1); + send_reply(sptr, RPL_ADMINLOC2, admin->location2); + send_reply(sptr, RPL_ADMINEMAIL, admin->contact); + return 0; +} + /* * m_admin - generic message handler @@ -108,15 +120,26 @@ int m_admin(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) assert(0 != cptr); assert(cptr == sptr); - if (parc > 1) { - struct Client *acptr; - if (!(acptr = find_match_server(parv[1]))) - return send_reply(sptr, ERR_NOSUCHSERVER, parv[1]); + if (parc > 1 && match(parv[1], cli_name(&me))) + return send_reply(sptr, ERR_NOPRIVILEGES); + + return send_admin_info(sptr); +} + +/* + * mo_admin - oper message handler + * + * parv[0] = sender prefix + * parv[1] = servername + */ +int mo_admin(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) +{ + assert(0 != cptr); + assert(cptr == sptr); - parv[1] = cli_name(acptr); - if (hunt_server_cmd(sptr, CMD_ADMIN, cptr, 0, ":%C", 1, parc, parv) != HUNTED_ISME) - return 0; - } + if (hunt_server_cmd(sptr, CMD_ADMIN, cptr, feature_int(FEAT_HIS_REMOTE), + ":%C", 1, parc, parv) != HUNTED_ISME) + return 0; return send_admin_info(sptr); }