]> jfr.im git - solanum.git/blobdiff - modules/cap_account_tag.c
Combine stats A output parameters (#35)
[solanum.git] / modules / cap_account_tag.c
index df4742a3277ddf47fdccd483e735758bfb6472c0..3e4edab9749b232059adcd54344cf6495376b63e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * charybdis: an advanced ircd.
+ * Solanum: a slightly advanced ircd
  * cap_account_tag.c: implement the account-tag IRCv3.2 capability
  *
  * Copyright (c) 2016 William Pitcock <nenolod@dereferenced.org>
 #include "chmode.h"
 #include "inline/stringops.h"
 
+static const char cap_account_tag_desc[] =
+       "Provides the account-tag client capability";
+
 static void cap_account_tag_process(hook_data *);
+unsigned int CLICAP_ACCOUNT_TAG = 0;
 
 mapi_hfn_list_av1 cap_account_tag_hfnlist[] = {
        { "outbound_msgbuf", (hookfn) cap_account_tag_process },
        { NULL, NULL }
 };
-
+mapi_cap_list_av2 cap_account_tag_cap_list[] = {
+       { MAPI_CAP_CLIENT, "account-tag", NULL, &CLICAP_ACCOUNT_TAG },
+       { 0, NULL, NULL, NULL },
+};
 static void
 cap_account_tag_process(hook_data *data)
 {
        struct MsgBuf *msgbuf = data->arg1;
 
-       if (IsPerson(data->client) && *data->client->user->suser)
+       if (data->client != NULL && IsPerson(data->client) && *data->client->user->suser)
                msgbuf_append_tag(msgbuf, "account", data->client->user->suser, CLICAP_ACCOUNT_TAG);
 }
 
-DECLARE_MODULE_AV1(cap_account_tag, NULL, NULL, NULL, NULL, cap_account_tag_hfnlist, "$Revision$");
+DECLARE_MODULE_AV2(cap_account_tag, NULL, NULL, NULL, NULL, cap_account_tag_hfnlist, cap_account_tag_cap_list, NULL, cap_account_tag_desc);