* More license declarations
[citadel.git] / citadel / modules / jabber / serv_xmpp.h
1 /*
2  * $Id$
3  *
4  * Copyright (c) 2007-2009 by Art Cancro
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 3 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 struct citxmpp {                        /* Information about the current session */
22         XML_Parser xp;                  /* XML parser instance for incoming client stream */
23         char server_name[256];          /* who they think we are */
24         char *chardata;
25         int chardata_len;
26         int chardata_alloc;
27         char client_jid[256];           /* "full JID" of the client */
28         int last_event_processed;
29
30         char iq_type[256];              /* for <iq> stanzas */
31         char iq_id[256];
32         char iq_from[256];
33         char iq_to[256];
34         char iq_client_username[256];   /* username requested by the client (NON SASL ONLY) */
35         char iq_client_password[256];   /* password requested by the client (NON SASL ONLY) */
36         char iq_client_resource[256];   /* resource name requested by the client */
37         int iq_session;                 /* nonzero == client is requesting a session */
38         char iq_query_xmlns[256];       /* Namespace of <query> */
39
40         char sasl_auth_mech[32];        /* SASL auth mechanism requested by the client */
41
42         char message_to[256];
43         char *message_body;             /* Message body in transit */
44         int html_tag_level;             /* <html> tag nesting level */
45
46         int bind_requested;             /* In this stanza, client is asking server to bind a resource. */
47 };
48
49 #define XMPP ((struct citxmpp *)CC->session_specific_data)
50
51 struct xmpp_event {
52         struct xmpp_event *next;
53         int event_seq;
54         time_t event_time;
55         int event_type;
56         char event_jid[256];
57         int session_which_generated_this_event;
58 };
59
60 extern struct xmpp_event *xmpp_queue;
61 extern int queue_event_seq;
62
63 enum {
64         XMPP_EVT_LOGIN,
65         XMPP_EVT_LOGOUT
66 };
67
68 void xmpp_cleanup_function(void);
69 void xmpp_greeting(void);
70 void xmpp_command_loop(void);
71 void xmpp_async_loop(void);
72 void xmpp_sasl_auth(char *, char *);
73 void xmpp_output_auth_mechs(void);
74 void xmpp_query_namespace(char *, char *, char *, char *);
75 void jabber_wholist_presence_dump(void);
76 void jabber_output_incoming_messages(void);
77 void xmpp_queue_event(int, char *);
78 void xmpp_process_events(void);
79 void xmpp_presence_notify(char *, int);
80 void jabber_roster_item(struct CitContext *);
81 void jabber_send_message(char *, char *);
82 void jabber_non_sasl_authenticate(char *, char *, char *, char *);