| 23 |
|
*/ |
| 24 |
|
|
| 25 |
|
#include "stdinc.h" |
| 26 |
– |
#include "handlers.h" |
| 26 |
|
#include "client.h" |
| 27 |
|
#include "ircd.h" |
| 28 |
|
#include "numeric.h" |
| 29 |
|
#include "send.h" |
| 30 |
|
#include "irc_string.h" |
| 32 |
– |
#include "msg.h" |
| 31 |
|
#include "parse.h" |
| 32 |
|
#include "modules.h" |
| 33 |
|
#include "hash.h" |
| 34 |
< |
#include "s_conf.h" |
| 34 |
> |
#include "conf.h" |
| 35 |
|
#include "s_serv.h" |
| 36 |
|
|
| 39 |
– |
static void m_ping(struct Client*, struct Client*, int, char**); |
| 40 |
– |
static void ms_ping(struct Client*, struct Client*, int, char**); |
| 41 |
– |
|
| 42 |
– |
struct Message ping_msgtab = { |
| 43 |
– |
"PING", 0, 0, 1, 0, MFLG_SLOW, 0, |
| 44 |
– |
{m_unregistered, m_ping, ms_ping, m_ignore, m_ping, m_ping} |
| 45 |
– |
}; |
| 46 |
– |
|
| 47 |
– |
#ifndef STATIC_MODULES |
| 48 |
– |
void |
| 49 |
– |
_modinit(void) |
| 50 |
– |
{ |
| 51 |
– |
mod_add_cmd(&ping_msgtab); |
| 52 |
– |
} |
| 53 |
– |
|
| 54 |
– |
void |
| 55 |
– |
_moddeinit(void) |
| 56 |
– |
{ |
| 57 |
– |
mod_del_cmd(&ping_msgtab); |
| 58 |
– |
} |
| 59 |
– |
|
| 60 |
– |
const char *_version = "$Revision$"; |
| 61 |
– |
#endif |
| 37 |
|
|
| 38 |
|
/* |
| 39 |
|
** m_ping |
| 48 |
|
struct Client *target_p; |
| 49 |
|
char *origin, *destination; |
| 50 |
|
|
| 51 |
< |
if (parc < 2 || *parv[1] == '\0') |
| 51 |
> |
if (parc < 2 || EmptyString(parv[1])) |
| 52 |
|
{ |
| 53 |
< |
sendto_one(source_p, form_str(ERR_NOORIGIN), me.name, parv[0]); |
| 53 |
> |
sendto_one(source_p, form_str(ERR_NOORIGIN), |
| 54 |
> |
me.name, source_p->name); |
| 55 |
|
return; |
| 56 |
|
} |
| 57 |
|
|
| 58 |
|
origin = parv[1]; |
| 59 |
|
destination = parv[2]; /* Will get NULL or pointer (parc >= 2!!) */ |
| 60 |
|
|
| 61 |
< |
if (ConfigFileEntry.disable_remote && !IsOper(source_p)) |
| 61 |
> |
if (ConfigFileEntry.disable_remote && !HasUMode(source_p, UMODE_OPER)) |
| 62 |
|
{ |
| 63 |
< |
sendto_one(source_p,":%s PONG %s :%s", me.name, |
| 63 |
> |
sendto_one(source_p, ":%s PONG %s :%s", me.name, |
| 64 |
|
(destination) ? destination : me.name, origin); |
| 65 |
|
return; |
| 66 |
|
} |
| 70 |
|
/* We're sending it across servers.. origin == client_p->name --fl_ */ |
| 71 |
|
origin = client_p->name; |
| 72 |
|
|
| 73 |
< |
/* XXX - sendto_server() ? --fl_ */ |
| 98 |
< |
if ((target_p = find_server(destination)) != NULL) |
| 73 |
> |
if ((target_p = hash_find_server(destination)) != NULL) |
| 74 |
|
{ |
| 75 |
< |
struct Client *ll_p; |
| 101 |
< |
|
| 102 |
< |
/* use the direct link for LL checking */ |
| 103 |
< |
ll_p = target_p->from; |
| 104 |
< |
|
| 105 |
< |
if(ServerInfo.hub && IsCapable(ll_p, CAP_LL)) |
| 106 |
< |
{ |
| 107 |
< |
if((ll_p->lazyLinkClientExists & target_p->localClient->serverMask) == 0) |
| 108 |
< |
client_burst_if_needed(target_p, ll_p); |
| 109 |
< |
} |
| 110 |
< |
|
| 111 |
< |
sendto_one(target_p,":%s PING %s :%s", parv[0], |
| 75 |
> |
sendto_one(target_p, ":%s PING %s :%s", source_p->name, |
| 76 |
|
origin, destination); |
| 77 |
|
} |
| 78 |
|
else |
| 79 |
|
{ |
| 80 |
|
sendto_one(source_p, form_str(ERR_NOSUCHSERVER), |
| 81 |
< |
me.name, parv[0], destination); |
| 81 |
> |
me.name, source_p->name, destination); |
| 82 |
|
return; |
| 83 |
|
} |
| 84 |
|
} |
| 85 |
|
else |
| 86 |
< |
sendto_one(source_p,":%s PONG %s :%s", me.name, |
| 86 |
> |
sendto_one(source_p, ":%s PONG %s :%s", me.name, |
| 87 |
|
(destination) ? destination : me.name, origin); |
| 88 |
|
} |
| 89 |
|
|
| 94 |
|
struct Client *target_p; |
| 95 |
|
const char *origin, *destination; |
| 96 |
|
|
| 97 |
< |
if (parc < 2 || *parv[1] == '\0') |
| 97 |
> |
if (parc < 2 || EmptyString(parv[1])) |
| 98 |
|
{ |
| 99 |
< |
sendto_one(source_p, form_str(ERR_NOORIGIN), me.name, parv[0]); |
| 99 |
> |
sendto_one(source_p, form_str(ERR_NOORIGIN), |
| 100 |
> |
me.name, source_p->name); |
| 101 |
|
return; |
| 102 |
|
} |
| 103 |
|
|
| 106 |
|
|
| 107 |
|
if (!EmptyString(destination) && irccmp(destination, me.name) != 0 && irccmp(destination, me.id) != 0) |
| 108 |
|
{ |
| 109 |
< |
if ((target_p = find_server(destination))) |
| 110 |
< |
sendto_one(target_p,":%s PING %s :%s", parv[0], |
| 109 |
> |
if ((target_p = hash_find_server(destination))) |
| 110 |
> |
sendto_one(target_p, ":%s PING %s :%s", source_p->name, |
| 111 |
|
origin, destination); |
| 112 |
|
else |
| 113 |
|
{ |
| 114 |
|
sendto_one(source_p, form_str(ERR_NOSUCHSERVER), |
| 115 |
< |
ID_or_name(&me, client_p), parv[0], destination); |
| 115 |
> |
ID_or_name(&me, client_p), source_p->name, destination); |
| 116 |
|
return; |
| 117 |
|
} |
| 118 |
|
} |
| 119 |
|
else |
| 120 |
< |
sendto_one(source_p,":%s PONG %s :%s", |
| 120 |
> |
sendto_one(source_p, ":%s PONG %s :%s", |
| 121 |
|
ID_or_name(&me, client_p), (destination) ? destination : me.name, origin); |
| 122 |
|
} |
| 123 |
+ |
|
| 124 |
+ |
static struct Message ping_msgtab = { |
| 125 |
+ |
"PING", 0, 0, 1, MAXPARA, MFLG_SLOW, 0, |
| 126 |
+ |
{m_unregistered, m_ping, ms_ping, m_ignore, m_ping, m_ping} |
| 127 |
+ |
}; |
| 128 |
+ |
|
| 129 |
+ |
static void |
| 130 |
+ |
module_init(void) |
| 131 |
+ |
{ |
| 132 |
+ |
mod_add_cmd(&ping_msgtab); |
| 133 |
+ |
} |
| 134 |
+ |
|
| 135 |
+ |
static void |
| 136 |
+ |
module_exit(void) |
| 137 |
+ |
{ |
| 138 |
+ |
mod_del_cmd(&ping_msgtab); |
| 139 |
+ |
} |
| 140 |
+ |
|
| 141 |
+ |
struct module module_entry = { |
| 142 |
+ |
.node = { NULL, NULL, NULL }, |
| 143 |
+ |
.name = NULL, |
| 144 |
+ |
.version = "$Revision$", |
| 145 |
+ |
.handle = NULL, |
| 146 |
+ |
.modinit = module_init, |
| 147 |
+ |
.modexit = module_exit, |
| 148 |
+ |
.flags = 0 |
| 149 |
+ |
}; |