]> arthur.barton.de Git - ngircd-alex.git/blob - src/ngircd/client-cap.c
Use correct sender as target for ISUPPORT replies on "VERSION"
[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 "imp.h"
22 #include <assert.h>
23
24 #include "defines.h"
25 #include "conn.h"
26 #include "client.h"
27 #include "log.h"
28
29 #include "exp.h"
30 #include "client-cap.h"
31
32 GLOBAL int
33 Client_Cap(CLIENT *Client)
34 {
35         assert (Client != NULL);
36
37         return Client->capabilities;
38 }
39
40 GLOBAL void
41 Client_CapSet(CLIENT *Client, int Cap)
42 {
43         assert(Client != NULL);
44         assert(Cap >= 0);
45
46         Client->capabilities = Cap;
47         LogDebug("Set new capability of \"%s\" to %d.",
48                  Client_ID(Client), Client->capabilities);
49 }
50
51 GLOBAL void
52 Client_CapAdd(CLIENT *Client, int Cap)
53 {
54         assert(Client != NULL);
55         assert(Cap > 0);
56
57         Client->capabilities |= Cap;
58         LogDebug("Add capability %d, new capability of \"%s\" is %d.",
59                  Cap, Client_ID(Client), Client->capabilities);
60 }
61
62 GLOBAL void
63 Client_CapDel(CLIENT *Client, int Cap)
64 {
65         assert(Client != NULL);
66         assert(Cap > 0);
67
68         Client->capabilities &= ~Cap;
69         LogDebug("Delete capability %d, new capability of \"%s\" is %d.",
70                  Cap, Client_ID(Client), Client->capabilities);
71 }
72
73 /* -eof- */