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