]> jfr.im git - solanum.git/blame - modules/m_certfp.c
Add umode +I to allow users to hide their idle time (#220)
[solanum.git] / modules / m_certfp.c
CommitLineData
8eda114a
JT
1/*
2 * m_certfp.c: propagates client certificate fingerprint information
3 *
4 * Copyright (C) 2010 Jilles Tjoelker
5 * Copyright (C) 2010 charybdis development team
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
9 * met:
10 *
11 * 1.Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the following disclaimer.
13 * 2.Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
21 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
26 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#include "stdinc.h"
31#include "client.h"
8eda114a
JT
32#include "match.h"
33#include "hash.h"
34#include "ircd.h"
35#include "numeric.h"
36#include "send.h"
37#include "msg.h"
38#include "modules.h"
39
eeabf33a
EM
40static const char certfp_desc[] =
41 "Provides the CERTFP facility used by servers to set certificate fingerprints";
42
3c7d6fcc 43static void me_certfp(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
8eda114a
JT
44
45struct Message certfp_msgtab = {
7baa37a9 46 "CERTFP", 0, 0, 0, 0,
bb73e588 47 {mg_unreg, mg_ignore, mg_ignore, mg_ignore, {me_certfp, 2}, mg_ignore}
8eda114a
JT
48};
49
50mapi_clist_av1 certfp_clist[] = { &certfp_msgtab, NULL };
51
5544da98 52DECLARE_MODULE_AV2(certfp, NULL, NULL, certfp_clist, NULL, NULL, NULL, NULL, certfp_desc);
8eda114a
JT
53
54/*
55** me_certfp
56** parv[1] = certfp string
57*/
3c7d6fcc 58static void
428ca87b 59me_certfp(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
8eda114a
JT
60{
61 if (!IsPerson(source_p))
3c7d6fcc 62 return;
8eda114a
JT
63
64 rb_free(source_p->certfp);
65 source_p->certfp = NULL;
66 if (!EmptyString(parv[1]))
67 source_p->certfp = rb_strdup(parv[1]);
8eda114a 68}