more xmpp presence stuff
[citadel.git] / citadel / modules / jabber / xmpp_presence.c
1 /*
2  * $Id$ 
3  *
4  * Handle XMPP presence exchanges
5  *
6  * Copyright (c) 2007 by Art Cancro
7  * This code is released under the terms of the GNU General Public License.
8  *
9  */
10
11 #include "sysdep.h"
12 #include <stdlib.h>
13 #include <unistd.h>
14 #include <stdio.h>
15 #include <fcntl.h>
16 #include <signal.h>
17 #include <pwd.h>
18 #include <errno.h>
19 #include <sys/types.h>
20
21 #if TIME_WITH_SYS_TIME
22 # include <sys/time.h>
23 # include <time.h>
24 #else
25 # if HAVE_SYS_TIME_H
26 #  include <sys/time.h>
27 # else
28 #  include <time.h>
29 # endif
30 #endif
31
32 #include <sys/wait.h>
33 #include <string.h>
34 #include <limits.h>
35 #include <ctype.h>
36 #include <libcitadel.h>
37 #include "citadel.h"
38 #include "server.h"
39 #include "citserver.h"
40 #include "support.h"
41 #include "config.h"
42 #include "internet_addressing.h"
43 #include "md5.h"
44 #include "ctdl_module.h"
45
46 #ifdef HAVE_EXPAT
47 #include <expat.h>
48 #include "serv_xmpp.h"
49
50
51 /* 
52  * Initial dump of the entire wholist
53  */
54 void jabber_wholist_presence_dump(void)
55 {
56         struct CitContext *cptr;
57         int aide = (CC->user.axlevel >= 6);
58
59         for (cptr = ContextList; cptr != NULL; cptr = cptr->next) {
60                 if (
61                    (((cptr->cs_flags&CS_STEALTH)==0) || (aide))         /* aides can see everyone */
62                    && (cptr->user.usernum != CC->user.usernum)          /* don't tell me about myself */
63                    ) {
64                         cprintf("<presence type=\"available\" from=\"%s\"></presence>", cptr->cs_inet_email);
65                 }
66         }
67 }
68
69
70 void xmpp_presence_notify(char *presence_jid, char *presence_type) {
71         /* FIXME subject this to the same conditions as above */
72         cprintf("<presence type=\"%s\" from=\"%s\">", presence_type, presence_jid);
73 }
74
75
76 #endif  /* HAVE_EXPAT */