2
2
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
4
* Copyright (c) 1997-2014 ircd-hybrid development team
4
* Copyright (c) 1997-2015 ircd-hybrid development team
6
6
* This program is free software; you can redistribute it and/or modify
7
7
* it under the terms of the GNU General Public License as published by
53
53
m_ping(struct Client *source_p, int parc, char *parv[])
55
struct Client *target_p;
56
char *origin, *destination;
55
struct Client *target_p = NULL;
56
const char *destination = NULL;
58
58
if (parc < 2 || EmptyString(parv[1]))
65
64
destination = parv[2]; /* Will get NULL or pointer (parc >= 2!!) */
67
66
if (ConfigServerHide.disable_remote_commands && !HasUMode(source_p, UMODE_OPER))
69
68
sendto_one(source_p, ":%s PONG %s :%s", me.name,
70
(destination) ? destination : me.name, origin);
69
(destination) ? destination : me.name, parv[1]);
74
73
if (!EmptyString(destination) && irccmp(destination, me.name))
76
/* We're sending it across servers.. origin == source_p->name --fl_ */
77
origin = source_p->name;
79
75
if ((target_p = hash_find_server(destination)))
80
sendto_one(target_p, ":%s PING %s :%s", source_p->name,
76
sendto_one(target_p, ":%s PING %s :%s",
77
ID_or_name(source_p, target_p), source_p->name,
78
ID_or_name(target_p, target_p));
83
80
sendto_one_numeric(source_p, &me, ERR_NOSUCHSERVER, destination);
86
83
sendto_one(source_p, ":%s PONG %s :%s", me.name,
87
(destination) ? destination : me.name, origin);
84
(destination) ? destination : me.name, parv[1]);
104
101
ms_ping(struct Client *source_p, int parc, char *parv[])
106
struct Client *target_p;
107
const char *origin, *destination;
103
struct Client *target_p = NULL;
104
const char *destination = NULL;
109
106
if (parc < 2 || EmptyString(parv[1]))
115
origin = source_p->name;
116
112
destination = parv[2]; /* Will get NULL or pointer (parc >= 2!!) */
118
114
if (!EmptyString(destination) && irccmp(destination, me.name) && irccmp(destination, me.id))
120
116
if ((target_p = hash_find_server(destination)))
121
sendto_one(target_p, ":%s PING %s :%s", source_p->name,
122
origin, destination);
118
if (target_p->from != source_p->from)
119
sendto_one(target_p, ":%s PING %s :%s",
120
ID_or_name(source_p, target_p), source_p->name,
121
ID_or_name(target_p, target_p));
123
else if (!IsDigit(*destination))
124
124
sendto_one_numeric(source_p, &me, ERR_NOSUCHSERVER, destination);
127
127
sendto_one(source_p, ":%s PONG %s :%s", ID_or_name(&me, source_p),
128
(destination) ? destination : me.name, origin);
128
(destination) ? destination : me.name, ID_or_name(source_p, source_p));
152
152
.node = { NULL, NULL, NULL },
154
.version = "$Revision: 4564 $",
154
.version = "$Revision: 5346 $",
156
156
.modinit = module_init,
157
157
.modexit = module_exit,