about summary refs log tree commit diff
path: root/src/ngircd/client-cap.c
blob: b0da8073b112ad3f3f354a592296b0b75b7943da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * ngIRCd -- The Next Generation IRC Daemon
 * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * Please read the file COPYING, README and AUTHORS for more information.
 */

#define __client_cap_c__

#include "portab.h"

/**
 * @file
 * Functions to deal with IRC Capabilities
 */

#include "imp.h"
#include <assert.h>

#include "defines.h"
#include "conn.h"
#include "client.h"
#include "log.h"

#include "exp.h"
#include "client-cap.h"

GLOBAL int
Client_Cap(CLIENT *Client)
{
	assert (Client != NULL);

	return Client->capabilities;
}

GLOBAL void
Client_CapSet(CLIENT *Client, int Cap)
{
	assert(Client != NULL);
	assert(Cap >= 0);

	Client->capabilities = Cap;
	LogDebug("Set new capability of \"%s\" to %d.",
		 Client_ID(Client), Client->capabilities);
}

GLOBAL void
Client_CapAdd(CLIENT *Client, int Cap)
{
	assert(Client != NULL);
	assert(Cap > 0);

	Client->capabilities |= Cap;
	LogDebug("Add capability %d, new capability of \"%s\" is %d.",
		 Cap, Client_ID(Client), Client->capabilities);
}

GLOBAL void
Client_CapDel(CLIENT *Client, int Cap)
{
	assert(Client != NULL);
	assert(Cap > 0);

	Client->capabilities &= ~Cap;
	LogDebug("Delete capability %d, new capability of \"%s\" is %d.",
		 Cap, Client_ID(Client), Client->capabilities);
}

/* -eof- */