Define an XMPP queue...
authorArt Cancro <ajc@citadel.org>
Fri, 30 Nov 2007 21:54:58 +0000 (21:54 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 30 Nov 2007 21:54:58 +0000 (21:54 +0000)
citadel/modules/jabber/serv_xmpp.c
citadel/modules/jabber/serv_xmpp.h
citadel/modules/jabber/xmpp_presence.c
citadel/modules/jabber/xmpp_query_namespace.c
citadel/server.h

index 31c0142bc98a6da8bc140434bcd43e15c5981135..66a32097ca740fd982df1bccda496ef3fda9aa52 100644 (file)
@@ -51,6 +51,7 @@
 #include <expat.h>
 #include "serv_xmpp.h"
 
+struct xmpp_event *xmpp_queue = NULL;
 
 /* We have just received a <stream> tag from the client, so send them ours */
 
@@ -365,6 +366,19 @@ void xmpp_async_loop(void) {
 }
 
 
+/*
+ * Login hook for XMPP sessions
+ */
+void xmpp_login_hook(void) {
+
+       // we need to somehow alert all xmpp sessions that we are here
+       // and do a roster push followed by a presence push
+
+       lprintf(CTDL_DEBUG, "LOGIN HOOOOOOOOOOOOOKK!!!\n");
+
+}
+
+
 const char *CitadelServiceXMPP="XMPP";
 
 #endif /* HAVE_EXPAT */
@@ -380,6 +394,8 @@ CTDL_MODULE_INIT(jabber)
                                        xmpp_async_loop,
                                        CitadelServiceXMPP);
                CtdlRegisterSessionHook(xmpp_cleanup_function, EVT_STOP);
+                CtdlRegisterSessionHook(xmpp_login_hook, EVT_LOGIN);
+
        #else
                lprintf(CTDL_INFO, "This server is missing the Expat XML parser.  Jabber service will be disabled.\n");
 #endif
index f6f3438a4701fd3b94cf20a445b18a2445924297..ec488308c026f94f2938b1c277d1cda5d3811c3f 100644 (file)
@@ -24,6 +24,14 @@ struct citxmpp {                     /* Information about the current session */
 
 #define XMPP ((struct citxmpp *)CC->session_specific_data)
 
+struct xmpp_event {
+       struct xmpp_event *next;
+       int event_type;
+       char event_jid[256];
+};
+
+extern struct xmpp_event *xmpp_queue;
+
 void xmpp_cleanup_function(void);
 void xmpp_greeting(void);
 void xmpp_command_loop(void);
index 1b10ef4169f16b90b5df5441d08e3c983d5f6f9f..678e399eeabc4c050f16546e308dcac15ea7141f 100644 (file)
@@ -66,5 +66,4 @@ void jabber_wholist_presence_dump(void)
        }
 }
 
-
 #endif /* HAVE_EXPAT */
index 30b8d1680eab311c547c25867705659efaf70116..5cca906393f3b0b0c1827462e54cc37c99c39d55 100644 (file)
 #include "serv_xmpp.h"
 
 
+/*
+ * Output a single roster item, for roster queries or pushes
+ */
+void jabber_roster_item(struct CitContext *cptr) {
+       cprintf("<item jid=\"%s\" name=\"%s\" subscription=\"both\">",
+               cptr->cs_inet_email,
+               cptr->user.fullname
+       );
+       cprintf("<group>%s</group>", config.c_humannode);
+       cprintf("</item>");
+}
+
 /* 
  * Return the results for a "jabber:iq:roster:query"
  *
@@ -68,12 +80,7 @@ void jabber_iq_roster_query(void)
                   (((cptr->cs_flags&CS_STEALTH)==0) || (aide))
                   && (cptr->user.usernum != CC->user.usernum)
                   ) {
-                       cprintf("<item jid=\"%s\" name=\"%s\" subscription=\"both\">",
-                               cptr->cs_inet_email,
-                               cptr->user.fullname
-                       );
-                       cprintf("<group>%s</group>", config.c_humannode);
-                       cprintf("</item>");
+                       jabber_roster_item(cptr);
                }
        }
 
index 982aa37d82ad363d9f53c38f2cf650a49550f50a..6ab5a6cde44c45d45bde835e5e02b2305dc844b9 100644 (file)
@@ -240,6 +240,7 @@ enum {
        S_LOG,
        S_NETSPOOL,
        S_THREAD_LIST,
+       S_XMPP_QUEUE,
        MAX_SEMAPHORES
 };