One more field in the xml-vcard
[citadel.git] / citadel / modules / xmpp / serv_xmpp.h
1 /*
2  * Copyright (c) 2007-2019 by the citadel.org team
3  *
4  * This program is open source software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 3.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  */
12
13 typedef struct _citxmpp {               /* Information about the current session */
14         XML_Parser xp;                  /* XML parser instance for incoming client stream */
15         char server_name[256];          /* who they think we are */
16         char *chardata;
17         int chardata_len;
18         int chardata_alloc;
19         char client_jid[256];           /* "full JID" of the client */
20         int last_event_processed;
21
22         char iq_type[256];              /* for <iq> stanzas */
23         char iq_id[256];
24         char iq_from[256];
25         char iq_to[256];
26         char iq_client_username[256];   /* username requested by the client (NON SASL ONLY) */
27         char iq_client_password[256];   /* password requested by the client (NON SASL ONLY) */
28         char iq_client_resource[256];   /* resource name requested by the client */
29         int iq_session;                 /* nonzero == client is requesting a session */
30         int iq_vcard;                   /* nonzero == client is requesting its vCard */
31         char iq_query_xmlns[256];       /* Namespace of <query> */
32
33         char sasl_auth_mech[32];        /* SASL auth mechanism requested by the client */
34
35         char message_to[256];
36         char *message_body;             /* Message body in transit */
37         int html_tag_level;             /* <html> tag nesting level */
38
39         int bind_requested;             /* In this stanza, client is asking server to bind a resource. */
40         int ping_requested;             /* In this stanza, client is pinging the server. */
41 } citxmpp;
42
43 #define XMPP ((citxmpp *)CC->session_specific_data)
44
45 struct xmpp_event {
46         struct xmpp_event *next;
47         int event_seq;
48         time_t event_time;
49         int event_type;
50         char event_jid[256];
51         int session_which_generated_this_event;
52 };
53
54 extern struct xmpp_event *xmpp_queue;
55 extern int queue_event_seq;
56
57 enum {
58         XMPP_EVT_LOGIN,
59         XMPP_EVT_LOGOUT
60 };
61
62 void xmpp_cleanup_function(void);
63 void xmpp_greeting(void);
64 void xmpp_command_loop(void);
65 void xmpp_async_loop(void);
66 void xmpp_sasl_auth(char *, char *);
67 void xmpp_output_auth_mechs(void);
68 void xmpp_query_namespace(char *, char *, char *, char *);
69 void xmpp_wholist_presence_dump(void);
70 void xmpp_output_incoming_messages(void);
71 void xmpp_queue_event(int, char *);
72 void xmpp_process_events(void);
73 void xmpp_presence_notify(char *, int);
74 void xmpp_roster_item(struct CitContext *);
75 void xmpp_send_message(char *, char *);
76 void xmpp_non_sasl_authenticate(char *, char *, char *);
77 void xmpp_massacre_roster(void);
78 void xmpp_delete_old_buddies_who_no_longer_exist_from_the_client_roster(void);
79 int xmpp_is_visible(struct CitContext *from, struct CitContext *to_whom);
80 char *xmlesc(char *buf, char *str, int bufsiz);