#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 */
}
+/*
+ * 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 */
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
#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);
}
}
-
#endif /* HAVE_EXPAT */
#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"
*
(((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);
}
}
S_LOG,
S_NETSPOOL,
S_THREAD_LIST,
+ S_XMPP_QUEUE,
MAX_SEMAPHORES
};