2 * Copyright (C) 2008 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
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.
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.
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.
20 #include "xmpp_internal.h"
23 session (hc_xmpp_t *xmpp, iks *f)
26 xmpp->session |= SUPPORTED;
27 for (c = iks_child (f); c != NULL; c = iks_next (c))
29 if (!iks_strcmp (iks_name (c), "optional"))
30 xmpp->session |= OPTIONAL;
31 else if (!iks_strcmp (iks_name (c), "required"))
32 xmpp->session |= REQUIRED;
37 xmpp_bind (hc_xmpp_t *xmpp, iks *f)
40 xmpp->bind |= SUPPORTED;
41 for (c = iks_child (f); c != NULL; c = iks_next (c))
43 if (!iks_strcmp (iks_name (c), "optional"))
44 xmpp->bind |= OPTIONAL;
45 else if (!iks_strcmp (iks_name (c), "required"))
46 xmpp->bind |= REQUIRED;
51 sasl (hc_xmpp_t *xmpp, iks *f)
54 xmpp->sasl |= SUPPORTED;
55 for (c = iks_child (f); c != NULL; c = iks_next (c))
57 if (!iks_strcmp (iks_name (c), "optional"))
58 xmpp->sasl |= OPTIONAL;
59 else if (!iks_strcmp (iks_name (c), "required"))
60 xmpp->sasl |= REQUIRED;
65 tls (hc_xmpp_t *xmpp, iks *f)
68 xmpp->tls |= SUPPORTED;
69 for (c = iks_child (f); c != NULL; c = iks_next (c))
71 if (!iks_strcmp (iks_name (c), "optional"))
72 xmpp->tls |= OPTIONAL;
73 else if (!iks_strcmp (iks_name (c), "required"))
74 xmpp->tls |= REQUIRED;
79 hc_xmpp_features (hc_xmpp_t *xmpp, iks *features)
82 for (c = iks_child (features); c != NULL; c = iks_next (c))
84 if (!iks_strcmp (iks_name (c), "starttls") &&
85 !iks_strcmp (iks_find_attrib (c, "xmlns"), HC_XMPP_NS_TLS))
87 else if (!iks_strcmp (iks_name (c), "mechanisms") &&
88 !iks_strcmp (iks_find_attrib (c, "xmlns"), HC_XMPP_NS_SASL))
90 else if (!iks_strcmp (iks_name (c), "bind") &&
91 !iks_strcmp (iks_find_attrib (c, "xmlns"), HC_XMPP_NS_BIND))
93 else if (!iks_strcmp (iks_name (c), "session") &&
94 !iks_strcmp (iks_find_attrib (c, "xmlns"), HC_XMPP_NS_SESSION))