]> arthur.barton.de Git - ngircd-alex.git/blob - src/ngircd/client-cap.c
Update #include's: remove unused and add missing ones
[ngircd-alex.git] / src / ngircd / client-cap.c
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * Please read the file COPYING, README and AUTHORS for more information.
10  */
11
12 #define __client_cap_c__
13
14 #include "portab.h"
15
16 /**
17  * @file
18  * Functions to deal with IRC Capabilities
19  */
20
21 #include <assert.h>
22
23 #include "conn.h"
24 #include "log.h"
25
26 GLOBAL int
27 Client_Cap(CLIENT *Client)
28 {
29         assert (Client != NULL);
30
31         return Client->capabilities;
32 }
33
34 GLOBAL void
35 Client_CapSet(CLIENT *Client, int Cap)
36 {
37         assert(Client != NULL);
38         assert(Cap >= 0);
39
40         Client->capabilities = Cap;
41         LogDebug("Set new capability of \"%s\" to %d.",
42                  Client_ID(Client), Client->capabilities);
43 }
44
45 GLOBAL void
46 Client_CapAdd(CLIENT *Client, int Cap)
47 {
48         assert(Client != NULL);
49         assert(Cap > 0);
50
51         Client->capabilities |= Cap;
52         LogDebug("Add capability %d, new capability of \"%s\" is %d.",
53                  Cap, Client_ID(Client), Client->capabilities);
54 }
55
56 GLOBAL void
57 Client_CapDel(CLIENT *Client, int Cap)
58 {
59         assert(Client != NULL);
60         assert(Cap > 0);
61
62         Client->capabilities &= ~Cap;
63         LogDebug("Delete capability %d, new capability of \"%s\" is %d.",
64                  Cap, Client_ID(Client), Client->capabilities);
65 }
66
67 /* -eof- */