Fix some bugs feeding the textview
[cascardo/chat.git] / xmpp.h
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 #ifndef HC_XMPP_H
21 #define HC_XMPP_H
22
23 #include <iksemel.h>
24
25 enum
26 {
27   HC_XMPP_NONE,
28   HC_XMPP_AUTHENTICATED,
29   HC_XMPP_BOUND,
30   HC_XMPP_SESSION
31 };
32
33 typedef struct _hc_xmpp_t hc_xmpp_t;
34 typedef void (*hc_xmpp_hook_t) (hc_xmpp_t *, iks *);
35
36 #define HC_XMPP_NS_TLS "urn:ietf:params:xml:ns:xmpp-tls"
37 #define HC_XMPP_NS_SASL "urn:ietf:params:xml:ns:xmpp-sasl"
38 #define HC_XMPP_NS_BIND "urn:ietf:params:xml:ns:xmpp-bind"
39 #define HC_XMPP_NS_SESSION "urn:ietf:params:xml:ns:xmpp-session"
40 #define HC_XMPP_NS_DISCO "http://jabber.org/protocol/disco"
41 #define HC_XMPP_NS_DISCO_INFO "http://jabber.org/protocol/disco#info"
42
43 hc_xmpp_t * hc_xmpp_new (iksStreamHook *, char *, char *, char *);
44 int hc_xmpp_is_tls_supported (hc_xmpp_t *);
45 int hc_xmpp_is_tls_required (hc_xmpp_t *);
46 int hc_xmpp_is_tls_optional (hc_xmpp_t *);
47 int hc_xmpp_is_tls_enabled (hc_xmpp_t *);
48 int hc_xmpp_is_sasl_supported (hc_xmpp_t *);
49 int hc_xmpp_is_sasl_required (hc_xmpp_t *);
50 int hc_xmpp_is_sasl_optional (hc_xmpp_t *);
51 int hc_xmpp_is_sasl_enabled (hc_xmpp_t *);
52 int hc_xmpp_is_bind_supported (hc_xmpp_t *);
53 int hc_xmpp_is_session_supported (hc_xmpp_t *);
54 int hc_xmpp_is_session_required (hc_xmpp_t *);
55 char *hc_xmpp_server (hc_xmpp_t *);
56 int hc_xmpp_fd (hc_xmpp_t *);
57 void hc_xmpp_send_buffer (hc_xmpp_t *, char *, size_t);
58 void hc_xmpp_send_iks (hc_xmpp_t *, iks *);
59 void hc_xmpp_read_and_parse (hc_xmpp_t *);
60 void hc_xmpp_features (hc_xmpp_t *, iks *);
61 int hc_xmpp_status (hc_xmpp_t *);
62 int hc_xmpp_hook (void *, int, iks *);
63 void hc_xmpp_send_stream (hc_xmpp_t *);
64 void hc_xmpp_set_msg_hook (hc_xmpp_t *, hc_xmpp_hook_t);
65 void hc_xmpp_set_sent_msg_hook (hc_xmpp_t *, hc_xmpp_hook_t);
66 void hc_xmpp_set_pres_hook (hc_xmpp_t *, hc_xmpp_hook_t);
67 void hc_xmpp_set_sent_pres_hook (hc_xmpp_t *, hc_xmpp_hook_t);
68 void hc_xmpp_register_ns_hook (hc_xmpp_t *, char *, hc_xmpp_hook_t);
69 void hc_xmpp_recv_message (hc_xmpp_t *, iks *);
70 void hc_xmpp_sent_message (hc_xmpp_t *, iks *);
71 void hc_xmpp_recv_presence (hc_xmpp_t *, iks *);
72 void hc_xmpp_sent_presence (hc_xmpp_t *, iks *);
73
74 #endif