Created XMPP context and better features parser
[cascardo/chat.git] / xmpp.c
1 /*
2  *  Copyright (C) 2008  Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License along
15  *  with this program; if not, write to the Free Software Foundation, Inc.,
16  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18
19
20 #include <stdlib.h>
21 #include "xmpp.h"
22 #include "xmpp_internal.h"
23
24 hc_xmpp_t *
25 hc_xmpp_new (void)
26 {
27   hc_xmpp_t *xmpp = malloc (sizeof (hc_xmpp_t));
28   xmpp->tls = NONE;
29   xmpp->sasl = NONE;
30   return xmpp;
31 }
32
33 int
34 hc_xmpp_is_tls_supported (hc_xmpp_t *xmpp)
35 {
36   return xmpp->tls & SUPPORTED;
37 }
38
39 int
40 hc_xmpp_is_tls_required (hc_xmpp_t *xmpp)
41 {
42   return xmpp->tls & REQUIRED;
43 }
44
45 int
46 hc_xmpp_is_tls_optional (hc_xmpp_t *xmpp)
47 {
48   return xmpp->tls & OPTIONAL;
49 }
50
51 int
52 hc_xmpp_is_tls_enabled (hc_xmpp_t *xmpp)
53 {
54   return xmpp->tls & ENABLED;
55 }
56
57 int
58 hc_xmpp_is_sasl_supported (hc_xmpp_t *xmpp)
59 {
60   return xmpp->sasl & SUPPORTED;
61 }
62
63 int
64 hc_xmpp_is_sasl_required (hc_xmpp_t *xmpp)
65 {
66   return xmpp->sasl & REQUIRED;
67 }
68
69 int
70 hc_xmpp_is_sasl_optional (hc_xmpp_t *xmpp)
71 {
72   return xmpp->sasl & OPTIONAL;
73 }
74
75 int
76 hc_xmpp_is_sasl_enabled (hc_xmpp_t *xmpp)
77 {
78   return xmpp->sasl & ENABLED;
79 }
80