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"
24 hc_xmpp_bind (hc_xmpp_t *xmpp)
28 iqbind = iks_new ("iq");
29 iks_insert_attrib (iqbind, "type", "set");
30 query = iks_insert (iqbind, "bind");
31 iks_insert_attrib (query, "xmlns", HC_XMPP_NS_BIND);
32 hc_xmpp_send_iks (xmpp, iqbind);
37 hc_xmpp_bind_result (hc_xmpp_t *xmpp, iks *result)
39 if (!iks_strcmp (iks_find_attrib (result, "type"), "result"))
41 xmpp->status = HC_XMPP_BOUND;
42 xmpp->bind |= ENABLED;
47 hc_xmpp_session (hc_xmpp_t *xmpp)
51 iqsession = iks_new ("iq");
52 iks_insert_attrib (iqsession, "type", "set");
53 query = iks_insert (iqsession, "session");
54 iks_insert_attrib (query, "xmlns", HC_XMPP_NS_SESSION);
55 hc_xmpp_send_iks (xmpp, iqsession);
56 iks_delete (iqsession);
60 hc_xmpp_session_result (hc_xmpp_t *xmpp, iks *result)
62 if (!iks_strcmp (iks_find_attrib (result, "type"), "result"))
64 xmpp->status = HC_XMPP_SESSION;
65 xmpp->session |= ENABLED;