diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/hs_group.c | 52 | ||||
-rw-r--r-- | src/core/hs_off.c | 23 | ||||
-rw-r--r-- | src/core/hs_on.c | 45 |
3 files changed, 46 insertions, 74 deletions
diff --git a/src/core/hs_group.c b/src/core/hs_group.c index c63766e17..3011e3203 100644 --- a/src/core/hs_group.c +++ b/src/core/hs_group.c @@ -26,7 +26,6 @@ class CommandHSGroup : public Command CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) { - NickAlias *na; HostCore *tmp; char *vHost = NULL; char *vIdent = NULL; @@ -37,42 +36,33 @@ class CommandHSGroup : public Command head = hostCoreListHead(); - if ((na = findnick(u->nick))) + tmp = findHostCore(head, u->nick, &found); + if (found) { - if (na->status & NS_IDENTIFIED) - { - tmp = findHostCore(head, u->nick, &found); - if (found) - { - if (!tmp) - tmp = head; /* incase first in list */ - else if (tmp->next) /* we dont want the previous entry were not inserting! */ - tmp = tmp->next; /* jump to the next */ + if (!tmp) + tmp = head; /* incase first in list */ + else if (tmp->next) /* we dont want the previous entry were not inserting! */ + tmp = tmp->next; /* jump to the next */ - vHost = sstrdup(tmp->vHost); - if (tmp->vIdent) - vIdent = sstrdup(tmp->vIdent); - creator = sstrdup(tmp->creator); - time = tmp->time; + vHost = sstrdup(tmp->vHost); + if (tmp->vIdent) + vIdent = sstrdup(tmp->vIdent); + creator = sstrdup(tmp->creator); + time = tmp->time; - do_hs_sync(na->nc, vIdent, vHost, creator, time); - if (tmp->vIdent) - notice_lang(s_HostServ, u, HOST_IDENT_GROUP, na->nc->display, vIdent, vHost); - else - notice_lang(s_HostServ, u, HOST_GROUP, na->nc->display, vHost); - delete [] vHost; - if (vIdent) - delete [] vIdent; - delete [] creator; - } - else - notice_lang(s_HostServ, u, HOST_NOT_ASSIGNED); - } + do_hs_sync(u->nc, vIdent, vHost, creator, time); + if (tmp->vIdent) + notice_lang(s_HostServ, u, HOST_IDENT_GROUP, u->nc->display, vIdent, vHost); else - notice_lang(s_HostServ, u, HOST_ID); + notice_lang(s_HostServ, u, HOST_GROUP, u->nc->display, vHost); + delete [] vHost; + if (vIdent) + delete [] vIdent; + delete [] creator; } else - notice_lang(s_HostServ, u, HOST_NOT_REGED); + notice_lang(s_HostServ, u, HOST_NOT_ASSIGNED); + return MOD_CONT; } diff --git a/src/core/hs_off.c b/src/core/hs_off.c index 086381fee..b8aabfcc2 100644 --- a/src/core/hs_off.c +++ b/src/core/hs_off.c @@ -24,25 +24,16 @@ class CommandHSOff : public Command CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) { - NickAlias *na; char *vhost; char *vident = NULL; - if ((na = findnick(u->nick))) - { - if (na->status & NS_IDENTIFIED) - { - vhost = getvHost(u->nick); - vident = getvIdent(u->nick); - if (!vhost && !vident) - notice_lang(s_HostServ, u, HOST_NOT_ASSIGNED); - else - ircdproto->SendVhostDel(u); - } - else - notice_lang(s_HostServ, u, HOST_ID); - } + + vhost = getvHost(u->nick); + vident = getvIdent(u->nick); + if (!vhost && !vident) + notice_lang(s_HostServ, u, HOST_NOT_ASSIGNED); else - notice_lang(s_HostServ, u, HOST_NOT_REGED); + ircdproto->SendVhostDel(u); + return MOD_CONT; } diff --git a/src/core/hs_on.c b/src/core/hs_on.c index d1c2b391f..5d102273c 100644 --- a/src/core/hs_on.c +++ b/src/core/hs_on.c @@ -24,39 +24,30 @@ class CommandHSOn : public Command CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) { - NickAlias *na; char *vHost; char *vIdent = NULL; - if ((na = findnick(u->nick))) + + vHost = getvHost(u->nick); + vIdent = getvIdent(u->nick); + if (!vHost) + notice_lang(s_HostServ, u, HOST_NOT_ASSIGNED); + else { - if (na->status & NS_IDENTIFIED) + if (vIdent) + notice_lang(s_HostServ, u, HOST_IDENT_ACTIVATED, vIdent, vHost); + else + notice_lang(s_HostServ, u, HOST_ACTIVATED, vHost); + ircdproto->SendVhost(u->nick, vIdent, vHost); + if (ircd->vhost) + u->vhost = sstrdup(vHost); + if (ircd->vident) { - vHost = getvHost(u->nick); - vIdent = getvIdent(u->nick); - if (!vHost) - notice_lang(s_HostServ, u, HOST_NOT_ASSIGNED); - else - { - if (vIdent) - notice_lang(s_HostServ, u, HOST_IDENT_ACTIVATED, vIdent, vHost); - else - notice_lang(s_HostServ, u, HOST_ACTIVATED, vHost); - ircdproto->SendVhost(u->nick, vIdent, vHost); - if (ircd->vhost) - u->vhost = sstrdup(vHost); - if (ircd->vident) - { - if (vIdent) - u->SetVIdent(vIdent); - } - set_lastmask(u); - } + if (vIdent) + u->SetVIdent(vIdent); } - else - notice_lang(s_HostServ, u, HOST_ID); + set_lastmask(u); } - else - notice_lang(s_HostServ, u, HOST_NOT_REGED); + return MOD_CONT; } |