0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-25 23:14:13 +01:00

Show opers a list of recently (<24hrs) split servers in /map.

This commit is contained in:
Jilles Tjoelker 2007-11-23 23:38:54 +01:00
parent 994544c294
commit c0bc9fe39a
3 changed files with 30 additions and 0 deletions

View file

@ -35,6 +35,7 @@ extern struct scache_entry *scache_connect(const char *name, const char *info, i
extern void scache_split(struct scache_entry *ptr);
extern const char *scache_get_name(struct scache_entry *ptr);
extern void scache_send_flattened_links(struct Client *source_p);
extern void scache_send_missing(struct Client *source_p);
extern void count_scache(size_t *, size_t *);
#endif

View file

@ -29,6 +29,7 @@
#include "send.h"
#include "s_conf.h"
#include "sprintf_irc.h"
#include "scache.h"
#define USER_COL 50 /* display | Users: %d at col 50 */
@ -73,6 +74,7 @@ static int
mo_map(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
dump_map(client_p, &me, buf);
scache_send_missing(client_p);
sendto_one_numeric(client_p, RPL_MAPEND, form_str(RPL_MAPEND));
return 0;

View file

@ -185,6 +185,33 @@ scache_send_flattened_links(struct Client *source_p)
sendto_one_numeric(source_p, RPL_ENDOFLINKS, form_str(RPL_ENDOFLINKS), "*");
}
#define MISSING_TIMEOUT 86400
/* scache_send_missing()
*
* inputs - client to send to
* outputs - recently split servers
* side effects -
*/
void
scache_send_missing(struct Client *source_p)
{
struct scache_entry *scache_ptr;
int i;
for (i = 0; i < SCACHE_HASH_SIZE; i++)
{
scache_ptr = scache_hash[i];
while (scache_ptr)
{
if (!(scache_ptr->flags & SC_ONLINE) && scache_ptr->last_split > CurrentTime - MISSING_TIMEOUT)
sendto_one_numeric(source_p, RPL_MAP, "** %s (recently split)",
scache_ptr->name);
scache_ptr = scache_ptr->next;
}
}
}
/*
* count_scache
* inputs - pointer to where to leave number of servers cached