]> jfr.im git - irc/quakenet/newserv.git/blame - trusts2_newsearch/formats.c
Merge.
[irc/quakenet/newserv.git] / trusts2_newsearch / formats.c
CommitLineData
e2527cba
P
1#include <stdio.h>
2
3#include "../newsearch/newsearch.h"
4#include "../control/control.h"
5#include "../lib/stringbuf.h"
9a8ffb84 6#include "../trusts2/trusts.h"
e2527cba
P
7
8void printtrust_group(searchCtx *ctx, nick *sender, patricia_node_t *node) {
9 trusthost_t *tgh = node->exts[tgh_ext];
10 trustgroup_t *tg;
11
12 if (tgh) {
13 tg = tgh->trustgroup;
0ac8476d 14 ctx->reply(sender,"%s/%d | [%lu] | %lu/%lu", IPtostr(node->prefix->sin), irc_bitlen(&(node->prefix->sin),(node->prefix->bitlen)), tg->id, tg->currenton, tg->maxusage);
e2527cba 15 } else {
0ac8476d 16 ctx->reply(sender,"%s/%d | <none>", IPtostr(node->prefix->sin), irc_bitlen(&(node->prefix->sin),(node->prefix->bitlen)));
e2527cba
P
17 }
18}
19
0ac8476d
P
20void printtrust_block(searchCtx *ctx, nick *sender, patricia_node_t *node) {
21 trustblock_t *tb = node->exts[tgb_ext];
22
23 if (tb) {
24 ctx->reply(sender,"%s/%d | [%lu] | %s", IPtostr(node->prefix->sin), irc_bitlen(&(node->prefix->sin),(node->prefix->bitlen)), tb->id, tb->reason_public ? tb->reason_public->content : "");
25 } else {
26 ctx->reply(sender,"%s/%d | <none>", IPtostr(node->prefix->sin), irc_bitlen(&(node->prefix->sin),(node->prefix->bitlen)));
27 }
28}
29
30void printtrust_blockprivate(searchCtx *ctx, nick *sender, patricia_node_t *node) {
31 trustblock_t *tb = node->exts[tgb_ext];
32
33 if (tb) {
34 ctx->reply(sender,"%s/%d | [%lu] | %s", IPtostr(node->prefix->sin), irc_bitlen(&(node->prefix->sin),(node->prefix->bitlen)), tb->id, tb->reason_private ? tb->reason_private->content : "");
35 } else {
36 ctx->reply(sender,"%s/%d | <none>", IPtostr(node->prefix->sin), irc_bitlen(&(node->prefix->sin),(node->prefix->bitlen)));
37 }
38}