ip_cloaking*: Do qjm locally too.

This commit is contained in:
Keith Buck 2012-02-18 05:16:03 +00:00
parent 7e132ff005
commit 29d224a1f8
4 changed files with 64 additions and 60 deletions

View file

@ -47,25 +47,28 @@ DECLARE_MODULE_AV1(ip_cloaking, _modinit, _moddeinit, NULL, NULL,
ip_cloaking_hfnlist, "$Revision: 3526 $"); ip_cloaking_hfnlist, "$Revision: 3526 $");
static void static void
distribute_hostchange(struct Client *client) distribute_hostchange(struct Client *client_p, char *newhost)
{ {
if (irccmp(client->host, client->orighost)) if (newhost != client_p->orighost)
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :is now your hidden host", sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
client->host); client_p->host);
else else
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :hostname reset", sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :hostname reset",
client->host); client_p->host);
sendto_server(NULL, NULL, sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s", CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(client), client->host); use_id(&me), use_id(client_p), client_p->host);
sendto_server(NULL, NULL, sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s", CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(client), client->host); use_id(&me), use_id(client_p), client_p->host);
if (irccmp(client->host, client->orighost))
SetDynSpoof(client); change_nick_user_host(client_p, client_p->name, client_p->username, newhost, 0, "Changing host");
if (newhost != client_p->orighost)
SetDynSpoof(client_p);
else else
ClearDynSpoof(client); ClearDynSpoof(client_p);
} }
static void static void
@ -179,8 +182,7 @@ check_umode_change(void *vdata)
} }
if (strcmp(source_p->host, source_p->localClient->mangledhost)) if (strcmp(source_p->host, source_p->localClient->mangledhost))
{ {
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, HOSTLEN + 1); distribute_hostchange(source_p, source_p->localClient->mangledhost);
distribute_hostchange(source_p);
} }
else /* not really nice, but we need to send this numeric here */ else /* not really nice, but we need to send this numeric here */
sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host", sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
@ -191,8 +193,7 @@ check_umode_change(void *vdata)
if (source_p->localClient->mangledhost != NULL && if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost)) !strcmp(source_p->host, source_p->localClient->mangledhost))
{ {
rb_strlcpy(source_p->host, source_p->orighost, HOSTLEN + 1); distribute_hostchange(source_p, source_p->orighost);
distribute_hostchange(source_p);
} }
} }
} }

View file

@ -44,25 +44,28 @@ DECLARE_MODULE_AV1(ip_cloaking, _modinit, _moddeinit, NULL, NULL,
ip_cloaking_hfnlist, "$Revision: 3526 $"); ip_cloaking_hfnlist, "$Revision: 3526 $");
static void static void
distribute_hostchange(struct Client *client) distribute_hostchange(struct Client *client_p, char *newhost)
{ {
if (irccmp(client->host, client->orighost)) if (newhost != client_p->orighost)
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :is now your hidden host", sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
client->host); client_p->host);
else else
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :hostname reset", sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :hostname reset",
client->host); client_p->host);
sendto_server(NULL, NULL, sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s", CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(client), client->host); use_id(&me), use_id(client_p), client_p->host);
sendto_server(NULL, NULL, sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s", CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(client), client->host); use_id(&me), use_id(client_p), client_p->host);
if (irccmp(client->host, client->orighost))
SetDynSpoof(client); change_nick_user_host(client_p, client_p->name, client_p->username, newhost, 0, "Changing host");
if (newhost != client_p->orighost)
SetDynSpoof(client_p);
else else
ClearDynSpoof(client); ClearDynSpoof(client_p);
} }
#define Nval 0x8c3a48ac #define Nval 0x8c3a48ac
@ -186,8 +189,7 @@ check_umode_change(void *vdata)
} }
if (strcmp(source_p->host, source_p->localClient->mangledhost)) if (strcmp(source_p->host, source_p->localClient->mangledhost))
{ {
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, HOSTLEN); distribute_hostchange(source_p, source_p->localClient->mangledhost);
distribute_hostchange(source_p);
} }
else /* not really nice, but we need to send this numeric here */ else /* not really nice, but we need to send this numeric here */
sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host", sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
@ -198,8 +200,7 @@ check_umode_change(void *vdata)
if (source_p->localClient->mangledhost != NULL && if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost)) !strcmp(source_p->host, source_p->localClient->mangledhost))
{ {
rb_strlcpy(source_p->host, source_p->orighost, HOSTLEN); distribute_hostchange(source_p, source_p->orighost);
distribute_hostchange(source_p);
} }
} }
} }

View file

@ -47,25 +47,28 @@ DECLARE_MODULE_AV1(ip_cloaking, _modinit, _moddeinit, NULL, NULL,
ip_cloaking_hfnlist, "$Revision: 3526 $"); ip_cloaking_hfnlist, "$Revision: 3526 $");
static void static void
distribute_hostchange(struct Client *client) distribute_hostchange(struct Client *client_p, char *newhost)
{ {
if (irccmp(client->host, client->orighost)) if (newhost != client_p->orighost)
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :is now your hidden host", sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
client->host); client_p->host);
else else
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :hostname reset", sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :hostname reset",
client->host); client_p->host);
sendto_server(NULL, NULL, sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s", CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(client), client->host); use_id(&me), use_id(client_p), client_p->host);
sendto_server(NULL, NULL, sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s", CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(client), client->host); use_id(&me), use_id(client_p), client_p->host);
if (irccmp(client->host, client->orighost))
SetDynSpoof(client); change_nick_user_host(client_p, client_p->name, client_p->username, newhost, 0, "Changing host");
if (newhost != client_p->orighost)
SetDynSpoof(client_p);
else else
ClearDynSpoof(client); ClearDynSpoof(client_p);
} }
static void static void
@ -179,8 +182,7 @@ check_umode_change(void *vdata)
} }
if (strcmp(source_p->host, source_p->localClient->mangledhost)) if (strcmp(source_p->host, source_p->localClient->mangledhost))
{ {
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, HOSTLEN + 1); distribute_hostchange(source_p, source_p->localClient->mangledhost);
distribute_hostchange(source_p);
} }
else /* not really nice, but we need to send this numeric here */ else /* not really nice, but we need to send this numeric here */
sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host", sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
@ -191,8 +193,7 @@ check_umode_change(void *vdata)
if (source_p->localClient->mangledhost != NULL && if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost)) !strcmp(source_p->host, source_p->localClient->mangledhost))
{ {
rb_strlcpy(source_p->host, source_p->orighost, HOSTLEN + 1); distribute_hostchange(source_p, source_p->orighost);
distribute_hostchange(source_p);
} }
} }
} }

View file

@ -44,25 +44,28 @@ DECLARE_MODULE_AV1(ip_cloaking, _modinit, _moddeinit, NULL, NULL,
ip_cloaking_hfnlist, "$Revision: 3522 $"); ip_cloaking_hfnlist, "$Revision: 3522 $");
static void static void
distribute_hostchange(struct Client *client) distribute_hostchange(struct Client *client_p, char *newhost)
{ {
if (irccmp(client->host, client->orighost)) if (newhost != client_p->orighost)
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :is now your hidden host", sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
client->host); client_p->host);
else else
sendto_one_numeric(client, RPL_HOSTHIDDEN, "%s :hostname reset", sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :hostname reset",
client->host); client_p->host);
sendto_server(NULL, NULL, sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s", CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(client), client->host); use_id(&me), use_id(client_p), client_p->host);
sendto_server(NULL, NULL, sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s", CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(client), client->host); use_id(&me), use_id(client_p), client_p->host);
if (irccmp(client->host, client->orighost))
SetDynSpoof(client); change_nick_user_host(client_p, client_p->name, client_p->username, newhost, 0, "Changing host");
if (newhost != client_p->orighost)
SetDynSpoof(client_p);
else else
ClearDynSpoof(client); ClearDynSpoof(client_p);
} }
static void static void
@ -128,8 +131,7 @@ check_umode_change(void *vdata)
} }
if (strcmp(source_p->host, source_p->localClient->mangledhost)) if (strcmp(source_p->host, source_p->localClient->mangledhost))
{ {
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, HOSTLEN); distribute_hostchange(source_p, source_p->localClient->mangledhost);
distribute_hostchange(source_p);
} }
else /* not really nice, but we need to send this numeric here */ else /* not really nice, but we need to send this numeric here */
sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host", sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
@ -140,8 +142,7 @@ check_umode_change(void *vdata)
if (source_p->localClient->mangledhost != NULL && if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost)) !strcmp(source_p->host, source_p->localClient->mangledhost))
{ {
rb_strlcpy(source_p->host, source_p->orighost, HOSTLEN); distribute_hostchange(source_p, source_p->orighost);
distribute_hostchange(source_p);
} }
} }
} }