summaryrefslogtreecommitdiff
path: root/src/core/hs_setall.c
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-01-02 08:20:59 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-01-02 08:20:59 +0000
commita819cb0cc0f54a042a088dfba9c1f6b817928641 (patch)
tree7931a9d81367c184ca2550a1819ef685e3e0c927 /src/core/hs_setall.c
parent3617d7978899f830d952d9bac70ed14bb0cc0fd6 (diff)
Rewrote the vhost code, and moved it to be part of nickalias instead of in its own list. This also fixes being able to steal other users vhosts with /hs on
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2724 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/core/hs_setall.c')
-rw-r--r--src/core/hs_setall.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/src/core/hs_setall.c b/src/core/hs_setall.c
index 7ab5420cd..ab21075da 100644
--- a/src/core/hs_setall.c
+++ b/src/core/hs_setall.c
@@ -15,8 +15,6 @@
#include "module.h"
-extern int do_hs_sync(NickCore *nc, char *vIdent, char *hostmask, char *creator, time_t time);
-
class CommandHSSetAll : public Command
{
public:
@@ -36,6 +34,17 @@ class CommandHSSetAll : public Command
char *vIdent = NULL;
+ if (!(na = findnick(nick)))
+ {
+ notice_lang(Config.s_HostServ, u, HOST_NOREG, nick);
+ return MOD_CONT;
+ }
+ else if (na->HasFlag(NS_FORBIDDEN))
+ {
+ notice_lang(Config.s_HostServ, u, NICK_X_FORBIDDEN, nick);
+ return MOD_CONT;
+ }
+
vIdent = myStrGetOnlyToken(rawhostmask, '@', 0); /* Get the first substring, @ as delimiter */
if (vIdent)
{
@@ -107,30 +116,17 @@ class CommandHSSetAll : public Command
tmp_time = time(NULL);
- if ((na = findnick(nick)))
- {
- if (na->HasFlag(NS_FORBIDDEN))
- {
- notice_lang(Config.s_HostServ, u, NICK_X_FORBIDDEN, nick);
- if (vIdent) {
- delete [] vIdent;
- delete [] rawhostmask;
- }
- delete [] hostmask;
- return MOD_CONT;
- }
- if (vIdent && ircd->vident)
- alog("vHost for all nicks in group \002%s\002 set to \002%s@%s\002 by oper \002%s\002", nick, vIdent, hostmask, u->nick);
- else
- alog("vHost for all nicks in group \002%s\002 set to \002%s\002 by oper \002%s\002", nick, hostmask, u->nick);
- do_hs_sync(na->nc, vIdent, hostmask, u->nick, tmp_time);
- if (vIdent)
- notice_lang(Config.s_HostServ, u, HOST_IDENT_SETALL, nick, vIdent, hostmask);
- else
- notice_lang(Config.s_HostServ, u, HOST_SETALL, nick, hostmask);
- }
+ if (vIdent && ircd->vident)
+ alog("vHost for all nicks in group \002%s\002 set to \002%s@%s\002 by oper \002%s\002", nick, vIdent, hostmask, u->nick);
else
- notice_lang(Config.s_HostServ, u, HOST_NOREG, nick);
+ alog("vHost for all nicks in group \002%s\002 set to \002%s\002 by oper \002%s\002", nick, hostmask, u->nick);
+ na->hostinfo.SetVhost(vIdent ? vIdent : "", hostmask, u->nick);
+ HostServSyncVhosts(na);
+ FOREACH_MOD(I_OnSetVhost, OnSetVhost(na));
+ if (vIdent)
+ notice_lang(Config.s_HostServ, u, HOST_IDENT_SETALL, nick, vIdent, hostmask);
+ else
+ notice_lang(Config.s_HostServ, u, HOST_SETALL, nick, hostmask);
if (vIdent)
{
delete [] vIdent;