1 |
|
/* |
2 |
< |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
< |
* s_serv.c: Server related functions. |
2 |
> |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
3 |
|
* |
4 |
< |
* Copyright (C) 2005 by the past and present ircd coders, and others. |
4 |
> |
* Copyright (c) 1997-2014 ircd-hybrid development team |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
17 |
|
* along with this program; if not, write to the Free Software |
18 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
19 |
|
* USA |
20 |
< |
* |
21 |
< |
* $Id$ |
20 |
> |
*/ |
21 |
> |
|
22 |
> |
/*! \file s_serv.c |
23 |
> |
* \brief Server related functions. |
24 |
> |
* \version $Id$ |
25 |
|
*/ |
26 |
|
|
27 |
|
#include "stdinc.h" |
33 |
|
#include "channel.h" |
34 |
|
#include "channel_mode.h" |
35 |
|
#include "client.h" |
34 |
– |
#include "dbuf.h" |
36 |
|
#include "event.h" |
37 |
|
#include "fdlist.h" |
38 |
|
#include "hash.h" |
50 |
|
#include "s_user.h" |
51 |
|
#include "send.h" |
52 |
|
#include "memory.h" |
53 |
< |
#include "channel.h" /* chcap_usage_counts stuff...*/ |
53 |
> |
#include "channel.h" |
54 |
|
#include "parse.h" |
55 |
|
|
56 |
|
#define MIN_CONN_FREQ 300 |
206 |
|
{ |
207 |
|
if (!(target_p = hash_find_server(parv[server]))) |
208 |
|
{ |
209 |
< |
sendto_one(source_p, form_str(ERR_NOSUCHSERVER), |
209 |
< |
me.name, source_p->name, parv[server]); |
209 |
> |
sendto_one_numeric(source_p, &me, ERR_NOSUCHSERVER, parv[server]); |
210 |
|
return HUNTED_NOSUCH; |
211 |
|
} |
212 |
|
} |
233 |
|
{ |
234 |
|
if(!IsRegistered(target_p)) |
235 |
|
{ |
236 |
< |
sendto_one(source_p, form_str(ERR_NOSUCHSERVER), |
237 |
< |
me.name, source_p->name, parv[server]); |
236 |
> |
sendto_one_numeric(source_p, &me, ERR_NOSUCHSERVER, parv[server]); |
237 |
|
return HUNTED_NOSUCH; |
238 |
|
} |
239 |
|
|
243 |
|
if (match(target_p->name, parv[server])) |
244 |
|
parv[server] = target_p->name; |
245 |
|
|
246 |
< |
/* This is a little kludgy but should work... */ |
248 |
< |
if (IsClient(source_p) && |
249 |
< |
((MyConnect(target_p) && IsCapable(target_p, CAP_TS6)) || |
250 |
< |
(!MyConnect(target_p) && IsCapable(target_p->from, CAP_TS6)))) |
251 |
< |
parv[0] = ID(source_p); |
252 |
< |
|
253 |
< |
sendto_one(target_p, command, parv[0], |
246 |
> |
sendto_one(target_p, command, ID_or_name(source_p, target_p), |
247 |
|
parv[1], parv[2], parv[3], parv[4], |
248 |
|
parv[5], parv[6], parv[7], parv[8]); |
249 |
|
return HUNTED_PASS; |
250 |
|
} |
251 |
|
|
252 |
< |
sendto_one(source_p, form_str(ERR_NOSUCHSERVER), |
260 |
< |
me.name, source_p->name, parv[server]); |
252 |
> |
sendto_one_numeric(source_p, &me, ERR_NOSUCHSERVER, parv[server]); |
253 |
|
return HUNTED_NOSUCH; |
254 |
|
} |
255 |
|
|
1102 |
|
"Server %s already present from %s", |
1103 |
|
conf->name, get_client_name(client_p, MASK_IP)); |
1104 |
|
if (by && IsClient(by) && !MyClient(by)) |
1105 |
< |
sendto_one(by, ":%s NOTICE %s :Server %s already present from %s", |
1106 |
< |
me.name, by->name, conf->name, |
1115 |
< |
get_client_name(client_p, MASK_IP)); |
1105 |
> |
sendto_one_notice(by, &me, ":Server %s already present from %s", |
1106 |
> |
conf->name, get_client_name(client_p, MASK_IP)); |
1107 |
|
return 0; |
1108 |
|
} |
1109 |
|
|
1141 |
|
"Host %s is not enabled for connecting: no connect{} block", |
1142 |
|
conf->name); |
1143 |
|
if (by && IsClient(by) && !MyClient(by)) |
1144 |
< |
sendto_one(by, ":%s NOTICE %s :Connect to host %s failed.", |
1145 |
< |
me.name, by->name, client_p->name); |
1144 |
> |
sendto_one_notice(by, &me, ":Connect to host %s failed.", client_p->name); |
1145 |
> |
|
1146 |
|
SetDead(client_p); |
1147 |
|
exit_client(client_p, client_p, "Connection failed"); |
1148 |
|
return 0; |