]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blame - map
nickgline: include nick! bit in gline loggin
[irc/quakenet/snircd-patchqueue.git] / map
CommitLineData
edb26b39
P
1# HG changeset patch
2# Parent 61d020b9ec03fb0d7d9eb079b974e4d910647c9d
3
4diff -r 61d020b9ec03 ircd/m_endburst.c
5--- a/ircd/m_endburst.c Sun Jul 14 13:28:04 2013 +0100
6+++ b/ircd/m_endburst.c Sun Jul 14 13:33:21 2013 +0100
7@@ -95,6 +95,20 @@
8
9 /* #include <assert.h> -- Now using assert in ircd_log.h */
10
11+
12+/*
13+ * report_new_links
14+ * send map of new links to SNO_NETWORK
15+ * using dump_map from m_map.c
16+ */
17+void dump_map(struct Client *server, char *mask, int prompt_length,
18+ void (*reply_function)(void **, const char *, int), void **args);
19+static void report_new_links(void **args, const char *buf, int overflow)
20+{
21+ sendto_opmask_butone(0, SNO_NETWORK, " New server: %s", buf);
22+}
23+
24+
25 /*
26 * ms_end_of_burst - server message handler
27 * - Added Xorath 6-14-96, rewritten by Run 24-7-96
28@@ -115,11 +129,12 @@
29 assert(0 != cptr);
30 assert(0 != sptr);
31
32- sendto_opmask_butone(0, SNO_NETWORK, "Completed net.burst from %C.",
33- sptr);
34 sendcmdto_serv_butone(sptr, CMD_END_OF_BURST, cptr, "");
35 ClearBurst(sptr);
36 SetBurstAck(sptr);
37+ dump_map(sptr, "*", 0, report_new_links, 0);
38+ sendto_opmask_butone(0, SNO_NETWORK, "Completed net.burst from %C.",
39+ sptr);
40 if (MyConnect(sptr))
41 sendcmdto_one(&me, CMD_END_OF_BURST_ACK, sptr, "");
42
43diff -r 61d020b9ec03 ircd/m_map.c
44--- a/ircd/m_map.c Sun Jul 14 13:28:04 2013 +0100
45+++ b/ircd/m_map.c Sun Jul 14 13:33:21 2013 +0100
46@@ -102,17 +102,21 @@
47 #include <stdio.h>
48 #include <string.h>
49
50-static void dump_map(struct Client *cptr, struct Client *server, char *mask, int prompt_length)
51+void dump_map(struct Client *server, char *mask, int prompt_length, void (*reply_function)(void **, const char *, int), void **args)
52 {
53 const char *chr;
54 static char prompt[64];
55 struct DLink *lp;
56 char *p = prompt + prompt_length;
57 int cnt = 0;
58+ static char buf[512];
59
60 *p = '\0';
61 if (prompt_length > 60)
62- send_reply(cptr, RPL_MAPMORE, prompt, cli_name(server));
63+ {
64+ ircd_snprintf(0, buf, sizeof(buf), "%s%s --> *more*", prompt, cli_name(server));
65+ reply_function(args, buf, 1);
66+ }
67 else
68 {
69 char lag[512];
70@@ -128,9 +132,13 @@
71 chr = "!";
72 else
73 chr = "";
74- send_reply(cptr, RPL_MAP, prompt, chr, cli_name(server),
75- lag, (server == &me) ? UserStats.local_clients :
76- cli_serv(server)->clients);
77+
78+ ircd_snprintf(0, buf, sizeof(buf), "%s%s%s %s [%u clients]",
79+ prompt, chr, cli_name(server), lag,
80+ (server == &me) ? UserStats.local_clients :
81+ cli_serv(server)->clients);
82+
83+ reply_function(args, buf, 0);
84 }
85 if (prompt_length > 0)
86 {
87@@ -155,12 +163,21 @@
88 continue;
89 if (--cnt == 0)
90 *p = '`';
91- dump_map(cptr, lp->value.cptr, mask, prompt_length + 2);
92+ dump_map(lp->value.cptr, mask, prompt_length + 2, reply_function, args);
93 }
94 if (prompt_length > 0)
95 p[-1] = '-';
96 }
97
98+static void map_reply(void **args, const char *buf, int overflow)
99+{
100+ struct Client *cptr = (struct Client *)args[0];
101+
102+ if (!overflow)
103+ send_reply(cptr, RPL_MAP, buf);
104+ else
105+ send_reply(cptr, RPL_MAPMORE, buf);
106+}
107
108 /*
109 * m_map - generic message handler
110@@ -171,6 +188,7 @@
111 */
112 int m_map(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
113 {
114+ void *args[1];
115 if (feature_bool(FEAT_HIS_MAP) && !IsAnOper(sptr))
116 {
117 sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :%s %s", sptr,
118@@ -180,7 +198,9 @@
119 }
120 if (parc < 2)
121 parv[1] = "*";
122- dump_map(sptr, &me, parv[1], 0);
123+
124+ args[0] = sptr;
125+ dump_map(&me, parv[1], 0, map_reply, args);
126 send_reply(sptr, RPL_MAPEND);
127
128 return 0;
129diff -r 61d020b9ec03 ircd/s_err.c
130--- a/ircd/s_err.c Sun Jul 14 13:28:04 2013 +0100
131+++ b/ircd/s_err.c Sun Jul 14 13:33:21 2013 +0100
132@@ -62,9 +62,9 @@
133 /* 014 */
134 { 0 },
135 /* 015 */
136- { RPL_MAP, ":%s%s%s %s [%u clients]", "015" },
137+ { RPL_MAP, ":%s", "015" },
138 /* 016 */
139- { RPL_MAPMORE, ":%s%s --> *more*", "016" },
140+ { RPL_MAPMORE, ":%s", "016" },
141 /* 017 */
142 { RPL_MAPEND, ":End of /MAP", "017" },
143 /* 018 */
144diff -r 61d020b9ec03 ircd/s_misc.c
145--- a/ircd/s_misc.c Sun Jul 14 13:28:04 2013 +0100
146+++ b/ircd/s_misc.c Sun Jul 14 13:33:21 2013 +0100
147@@ -285,6 +285,18 @@
148 remove_client_from_list(bcptr);
149 }
150
151+/*
152+ * report_lost_links
153+ * send map of lost links to SNO_NETWORK
154+ * using dump_map from m_map.c
155+ */
156+void dump_map(struct Client *server, char *mask, int prompt_length,
157+ void (*reply_function)(void **, const char *, int), void **args);
158+static void report_lost_links(void **args, const char *buf, int overflow)
159+{
160+ sendto_opmask_butone(0, SNO_NETWORK, " Lost: %s", buf);
161+}
162+
163 /* exit_downlinks - added by Run 25-9-94 */
164 /**
165 * Removes all clients and downlinks (+clients) of any server
166@@ -470,6 +482,7 @@
167 get_client_name(killer, HIDE_IP));
168 sendto_opmask_butone(0, SNO_NETWORK, "Net break: %C %C (%s)",
169 cli_serv(victim)->up, victim, comment);
170+ dump_map(victim, "*", 0, report_lost_links, 0);
171 }
172
173 /*