25 |
|
#include "stdinc.h" |
26 |
|
#include "client.h" |
27 |
|
#include "modules.h" |
28 |
– |
#include "handlers.h" |
28 |
|
#include "numeric.h" |
29 |
|
#include "send.h" |
30 |
< |
#include "s_conf.h" |
30 |
> |
#include "conf.h" |
31 |
|
#include "ircd.h" |
32 |
|
#include "irc_string.h" |
33 |
|
#include "sprintf_irc.h" |
34 |
+ |
#include "parse.h" |
35 |
|
|
36 |
|
|
37 |
|
static char buf[IRCD_BUFSIZE]; |
38 |
– |
static void m_map(struct Client *, struct Client *, int, char *[]); |
39 |
– |
static void mo_map(struct Client *, struct Client *, int, char *[]); |
40 |
– |
static void dump_map(struct Client *, const struct Client *, int, char *); |
41 |
– |
|
42 |
– |
struct Message map_msgtab = { |
43 |
– |
"MAP", 0, 0, 0, 0, MFLG_SLOW, 0, |
44 |
– |
{ m_unregistered, m_map, m_ignore, m_ignore, mo_map, m_ignore } |
45 |
– |
}; |
46 |
– |
|
47 |
– |
void |
48 |
– |
_modinit(void) |
49 |
– |
{ |
50 |
– |
mod_add_cmd(&map_msgtab); |
51 |
– |
} |
52 |
– |
|
53 |
– |
void |
54 |
– |
_moddeinit(void) |
55 |
– |
{ |
56 |
– |
mod_del_cmd(&map_msgtab); |
57 |
– |
} |
58 |
– |
|
59 |
– |
const char *_version = "$Revision$"; |
60 |
– |
|
61 |
– |
|
62 |
– |
/* m_map() |
63 |
– |
* parv[0] = sender prefix |
64 |
– |
*/ |
65 |
– |
static void |
66 |
– |
m_map(struct Client *client_p, struct Client *source_p, |
67 |
– |
int parc, char *parv[]) |
68 |
– |
{ |
69 |
– |
static time_t last_used = 0; |
70 |
– |
|
71 |
– |
if (ConfigServerHide.flatten_links) |
72 |
– |
{ |
73 |
– |
m_not_oper(client_p, source_p, parc, parv); |
74 |
– |
return; |
75 |
– |
} |
76 |
– |
|
77 |
– |
if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime) |
78 |
– |
{ |
79 |
– |
/* safe enough to give this on a local connect only */ |
80 |
– |
sendto_one(source_p, form_str(RPL_LOAD2HI), |
81 |
– |
me.name, source_p->name); |
82 |
– |
return; |
83 |
– |
} |
84 |
– |
|
85 |
– |
last_used = CurrentTime; |
86 |
– |
|
87 |
– |
dump_map(source_p, &me, 0, buf); |
88 |
– |
sendto_one(source_p, form_str(RPL_MAPEND), me.name, source_p->name); |
89 |
– |
} |
90 |
– |
|
91 |
– |
/* mo_map() |
92 |
– |
* parv[0] = sender prefix |
93 |
– |
*/ |
94 |
– |
static void |
95 |
– |
mo_map(struct Client *client_p, struct Client *source_p, |
96 |
– |
int parc, char *parv[]) |
97 |
– |
{ |
98 |
– |
dump_map(source_p, &me, 0, buf); |
99 |
– |
sendto_one(source_p, form_str(RPL_MAPEND), me.name, source_p->name); |
100 |
– |
} |
38 |
|
|
39 |
|
/* dump_map() |
40 |
|
* dumps server map, called recursively. |
115 |
|
++i; |
116 |
|
} |
117 |
|
} |
118 |
+ |
|
119 |
+ |
/* m_map() |
120 |
+ |
* parv[0] = sender prefix |
121 |
+ |
*/ |
122 |
+ |
static void |
123 |
+ |
m_map(struct Client *client_p, struct Client *source_p, |
124 |
+ |
int parc, char *parv[]) |
125 |
+ |
{ |
126 |
+ |
static time_t last_used = 0; |
127 |
+ |
|
128 |
+ |
if (ConfigServerHide.flatten_links) |
129 |
+ |
{ |
130 |
+ |
m_not_oper(client_p, source_p, parc, parv); |
131 |
+ |
return; |
132 |
+ |
} |
133 |
+ |
|
134 |
+ |
if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime) |
135 |
+ |
{ |
136 |
+ |
/* safe enough to give this on a local connect only */ |
137 |
+ |
sendto_one(source_p, form_str(RPL_LOAD2HI), |
138 |
+ |
me.name, source_p->name); |
139 |
+ |
return; |
140 |
+ |
} |
141 |
+ |
|
142 |
+ |
last_used = CurrentTime; |
143 |
+ |
|
144 |
+ |
dump_map(source_p, &me, 0, buf); |
145 |
+ |
sendto_one(source_p, form_str(RPL_MAPEND), me.name, source_p->name); |
146 |
+ |
} |
147 |
+ |
|
148 |
+ |
/* mo_map() |
149 |
+ |
* parv[0] = sender prefix |
150 |
+ |
*/ |
151 |
+ |
static void |
152 |
+ |
mo_map(struct Client *client_p, struct Client *source_p, |
153 |
+ |
int parc, char *parv[]) |
154 |
+ |
{ |
155 |
+ |
dump_map(source_p, &me, 0, buf); |
156 |
+ |
sendto_one(source_p, form_str(RPL_MAPEND), me.name, source_p->name); |
157 |
+ |
} |
158 |
+ |
|
159 |
+ |
static struct Message map_msgtab = { |
160 |
+ |
"MAP", 0, 0, 0, MAXPARA, MFLG_SLOW, 0, |
161 |
+ |
{ m_unregistered, m_map, m_ignore, m_ignore, mo_map, m_ignore } |
162 |
+ |
}; |
163 |
+ |
|
164 |
+ |
static void |
165 |
+ |
module_init(void) |
166 |
+ |
{ |
167 |
+ |
mod_add_cmd(&map_msgtab); |
168 |
+ |
} |
169 |
+ |
|
170 |
+ |
static void |
171 |
+ |
module_exit(void) |
172 |
+ |
{ |
173 |
+ |
mod_del_cmd(&map_msgtab); |
174 |
+ |
} |
175 |
+ |
|
176 |
+ |
struct module module_entry = { |
177 |
+ |
.node = { NULL, NULL, NULL }, |
178 |
+ |
.name = NULL, |
179 |
+ |
.version = "$Revision$", |
180 |
+ |
.handle = NULL, |
181 |
+ |
.modinit = module_init, |
182 |
+ |
.modexit = module_exit, |
183 |
+ |
.flags = 0 |
184 |
+ |
}; |