# HG changeset patch # Parent 61d020b9ec03fb0d7d9eb079b974e4d910647c9d diff -r 61d020b9ec03 ircd/m_endburst.c --- a/ircd/m_endburst.c Sun Jul 14 13:28:04 2013 +0100 +++ b/ircd/m_endburst.c Sun Jul 14 13:33:21 2013 +0100 @@ -95,6 +95,20 @@ /* #include -- Now using assert in ircd_log.h */ + +/* + * report_new_links + * send map of new links to SNO_NETWORK + * using dump_map from m_map.c + */ +void dump_map(struct Client *server, char *mask, int prompt_length, + void (*reply_function)(void **, const char *, int), void **args); +static void report_new_links(void **args, const char *buf, int overflow) +{ + sendto_opmask_butone(0, SNO_NETWORK, " New server: %s", buf); +} + + /* * ms_end_of_burst - server message handler * - Added Xorath 6-14-96, rewritten by Run 24-7-96 @@ -115,11 +129,12 @@ assert(0 != cptr); assert(0 != sptr); - sendto_opmask_butone(0, SNO_NETWORK, "Completed net.burst from %C.", - sptr); sendcmdto_serv_butone(sptr, CMD_END_OF_BURST, cptr, ""); ClearBurst(sptr); SetBurstAck(sptr); + dump_map(sptr, "*", 0, report_new_links, 0); + sendto_opmask_butone(0, SNO_NETWORK, "Completed net.burst from %C.", + sptr); if (MyConnect(sptr)) sendcmdto_one(&me, CMD_END_OF_BURST_ACK, sptr, ""); diff -r 61d020b9ec03 ircd/m_map.c --- a/ircd/m_map.c Sun Jul 14 13:28:04 2013 +0100 +++ b/ircd/m_map.c Sun Jul 14 13:33:21 2013 +0100 @@ -102,17 +102,21 @@ #include #include -static void dump_map(struct Client *cptr, struct Client *server, char *mask, int prompt_length) +void dump_map(struct Client *server, char *mask, int prompt_length, void (*reply_function)(void **, const char *, int), void **args) { const char *chr; static char prompt[64]; struct DLink *lp; char *p = prompt + prompt_length; int cnt = 0; + static char buf[512]; *p = '\0'; if (prompt_length > 60) - send_reply(cptr, RPL_MAPMORE, prompt, cli_name(server)); + { + ircd_snprintf(0, buf, sizeof(buf), "%s%s --> *more*", prompt, cli_name(server)); + reply_function(args, buf, 1); + } else { char lag[512]; @@ -128,9 +132,13 @@ chr = "!"; else chr = ""; - send_reply(cptr, RPL_MAP, prompt, chr, cli_name(server), - lag, (server == &me) ? UserStats.local_clients : - cli_serv(server)->clients); + + ircd_snprintf(0, buf, sizeof(buf), "%s%s%s %s [%u clients]", + prompt, chr, cli_name(server), lag, + (server == &me) ? UserStats.local_clients : + cli_serv(server)->clients); + + reply_function(args, buf, 0); } if (prompt_length > 0) { @@ -155,12 +163,21 @@ continue; if (--cnt == 0) *p = '`'; - dump_map(cptr, lp->value.cptr, mask, prompt_length + 2); + dump_map(lp->value.cptr, mask, prompt_length + 2, reply_function, args); } if (prompt_length > 0) p[-1] = '-'; } +static void map_reply(void **args, const char *buf, int overflow) +{ + struct Client *cptr = (struct Client *)args[0]; + + if (!overflow) + send_reply(cptr, RPL_MAP, buf); + else + send_reply(cptr, RPL_MAPMORE, buf); +} /* * m_map - generic message handler @@ -171,6 +188,7 @@ */ int m_map(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { + void *args[1]; if (feature_bool(FEAT_HIS_MAP) && !IsAnOper(sptr)) { sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :%s %s", sptr, @@ -180,7 +198,9 @@ } if (parc < 2) parv[1] = "*"; - dump_map(sptr, &me, parv[1], 0); + + args[0] = sptr; + dump_map(&me, parv[1], 0, map_reply, args); send_reply(sptr, RPL_MAPEND); return 0; diff -r 61d020b9ec03 ircd/s_err.c --- a/ircd/s_err.c Sun Jul 14 13:28:04 2013 +0100 +++ b/ircd/s_err.c Sun Jul 14 13:33:21 2013 +0100 @@ -62,9 +62,9 @@ /* 014 */ { 0 }, /* 015 */ - { RPL_MAP, ":%s%s%s %s [%u clients]", "015" }, + { RPL_MAP, ":%s", "015" }, /* 016 */ - { RPL_MAPMORE, ":%s%s --> *more*", "016" }, + { RPL_MAPMORE, ":%s", "016" }, /* 017 */ { RPL_MAPEND, ":End of /MAP", "017" }, /* 018 */ diff -r 61d020b9ec03 ircd/s_misc.c --- a/ircd/s_misc.c Sun Jul 14 13:28:04 2013 +0100 +++ b/ircd/s_misc.c Sun Jul 14 13:33:21 2013 +0100 @@ -285,6 +285,18 @@ remove_client_from_list(bcptr); } +/* + * report_lost_links + * send map of lost links to SNO_NETWORK + * using dump_map from m_map.c + */ +void dump_map(struct Client *server, char *mask, int prompt_length, + void (*reply_function)(void **, const char *, int), void **args); +static void report_lost_links(void **args, const char *buf, int overflow) +{ + sendto_opmask_butone(0, SNO_NETWORK, " Lost: %s", buf); +} + /* exit_downlinks - added by Run 25-9-94 */ /** * Removes all clients and downlinks (+clients) of any server @@ -470,6 +482,7 @@ get_client_name(killer, HIDE_IP)); sendto_opmask_butone(0, SNO_NETWORK, "Net break: %C %C (%s)", cli_serv(victim)->up, victim, comment); + dump_map(victim, "*", 0, report_lost_links, 0); } /*