2016-08-13 05:05:54 +02:00
|
|
|
using namespace ircd;
|
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
static void m_echotags(struct MsgBuf *msgbuf_p, client::client &client, client::client &source, int parc, const char *parv[]);
|
2016-02-11 04:00:27 +01:00
|
|
|
|
|
|
|
struct Message echotags_msgtab = {
|
2016-03-07 10:40:51 +01:00
|
|
|
"ECHOTAGS", 0, 0, 0, 0,
|
|
|
|
{ mg_ignore, {m_echotags, 0}, mg_ignore, mg_ignore, mg_ignore, {m_echotags, 0} }
|
2016-02-11 04:00:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
mapi_clist_av1 echotags_clist[] = { &echotags_msgtab, NULL };
|
|
|
|
|
2016-03-07 10:42:43 +01:00
|
|
|
static const char echotags_desc[] = "A test module for tags";
|
2016-03-07 10:40:51 +01:00
|
|
|
|
|
|
|
DECLARE_MODULE_AV2(echotags, NULL, NULL, echotags_clist, NULL, NULL, NULL, NULL, echotags_desc);
|
2016-02-11 04:00:27 +01:00
|
|
|
|
2016-03-09 08:37:03 +01:00
|
|
|
static void
|
2016-08-23 02:37:07 +02:00
|
|
|
m_echotags(struct MsgBuf *msgbuf_p, client::client &client, client::client &source, int parc, const char *parv[])
|
2016-02-11 04:00:27 +01:00
|
|
|
{
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_notice(&source, ":*** You sent %zu tags.", msgbuf_p->n_tags);
|
2016-02-11 04:00:27 +01:00
|
|
|
|
2016-03-23 03:53:56 +01:00
|
|
|
for (size_t i = 0; i < msgbuf_p->n_tags; i++)
|
2016-02-11 04:00:27 +01:00
|
|
|
{
|
|
|
|
struct MsgTag *tag = &msgbuf_p->tags[i];
|
|
|
|
|
|
|
|
if (tag->value)
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_notice(&source, ":*** %zu: %s => %s", i, tag->key, tag->value);
|
2016-02-11 04:00:27 +01:00
|
|
|
else
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_notice(&source, ":*** %zu: %s", i, tag->key);
|
2016-02-11 04:00:27 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|