mirror of
https://github.com/matrix-construct/construct
synced 2024-09-18 14:38:55 +02:00
3c7d6fcce7
Also fix up some return values and stuff to use bool (or void if nothing). I just did it whilst I was here. According to jilles, the return value used to signify whether or not the client had exited. This was error-prone and was fixed a long, long time ago, but the return value was left int for historical reasons. Since the return type is not used (and has no clear use case anyway), it's safe to just get rid of it.
38 lines
1 KiB
C
38 lines
1 KiB
C
#include "stdinc.h"
|
|
#include "modules.h"
|
|
#include "client.h"
|
|
#include "ircd.h"
|
|
#include "send.h"
|
|
|
|
static void m_echotags(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
|
|
|
|
struct Message echotags_msgtab = {
|
|
"ECHOTAGS", 0, 0, 0, 0,
|
|
{ mg_ignore, {m_echotags, 0}, mg_ignore, mg_ignore, mg_ignore, {m_echotags, 0} }
|
|
};
|
|
|
|
mapi_clist_av1 echotags_clist[] = { &echotags_msgtab, NULL };
|
|
|
|
static const char echotags_desc[] = "A test module for tags";
|
|
|
|
DECLARE_MODULE_AV2(echotags, NULL, NULL, echotags_clist, NULL, NULL, NULL, NULL, echotags_desc);
|
|
|
|
static void
|
|
m_echotags(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
|
{
|
|
int i;
|
|
|
|
sendto_one_notice(source_p, ":*** You sent %zu tags.", msgbuf_p->n_tags);
|
|
|
|
for (i = 0; i < msgbuf_p->n_tags; i++)
|
|
{
|
|
struct MsgTag *tag = &msgbuf_p->tags[i];
|
|
|
|
if (tag->value)
|
|
sendto_one_notice(source_p, ":*** %d: %s => %s", i, tag->key, tag->value);
|
|
else
|
|
sendto_one_notice(source_p, ":*** %d: %s", i, tag->key);
|
|
}
|
|
}
|
|
|
|
|