From ce8b699291d264a10b084f1af93f65db273f6daf Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 10 May 2010 21:06:42 +0000 Subject: [PATCH] * Ok, it's not an async bug. When I changed everything over to xmpp_is_visible() I screwed up the logic of xmpp_presence_notify(). Changed the xmpp_is_visible() API to allow it to check the visibility of ANY session to ANY other session. Still need to clean up xmpp_presence_notify() and nail down the bug. --- citadel/modules/xmpp/serv_xmpp.c | 1 + citadel/modules/xmpp/serv_xmpp.h | 2 +- citadel/modules/xmpp/xmpp_presence.c | 22 +++++++++++---------- citadel/modules/xmpp/xmpp_query_namespace.c | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/citadel/modules/xmpp/serv_xmpp.c b/citadel/modules/xmpp/serv_xmpp.c index 8c7297350..e92d7ddc5 100644 --- a/citadel/modules/xmpp/serv_xmpp.c +++ b/citadel/modules/xmpp/serv_xmpp.c @@ -498,6 +498,7 @@ void xmpp_command_loop(void) { * Async loop for XMPP sessions (handles the transmission of unsolicited stanzas) */ void xmpp_async_loop(void) { + CtdlLogPrintf(CTDL_DEBUG, "\033[35m xmpp_async_loop() IS BEING CALLED!! \033[0m\n"); xmpp_process_events(); xmpp_output_incoming_messages(); } diff --git a/citadel/modules/xmpp/serv_xmpp.h b/citadel/modules/xmpp/serv_xmpp.h index 473f9937e..0292d9716 100644 --- a/citadel/modules/xmpp/serv_xmpp.h +++ b/citadel/modules/xmpp/serv_xmpp.h @@ -83,4 +83,4 @@ void xmpp_send_message(char *, char *); void xmpp_non_sasl_authenticate(char *, char *, char *, char *); void xmpp_massacre_roster(void); void xmpp_delete_old_buddies_who_no_longer_exist_from_the_client_roster(void); -int xmpp_is_visible(struct CitContext *cptr); +int xmpp_is_visible(struct CitContext *from, struct CitContext *to_whom); diff --git a/citadel/modules/xmpp/xmpp_presence.c b/citadel/modules/xmpp/xmpp_presence.c index e53b26cc0..557361169 100644 --- a/citadel/modules/xmpp/xmpp_presence.c +++ b/citadel/modules/xmpp/xmpp_presence.c @@ -75,14 +75,15 @@ void xmpp_indicate_presence(char *presence_jid) /* - * Convenience function to determine whether a particular session is visible to this user + * Convenience function to determine whether any given session is 'visible' to any other given session, + * and is capable of receiving instant messages from that session. */ -int xmpp_is_visible(struct CitContext *cptr) { - int aide = (CC->user.axlevel >= AxAideU); +int xmpp_is_visible(struct CitContext *cptr, struct CitContext *to_whom) { + int aide = (to_whom->user.axlevel >= AxAideU); if ( (cptr->logged_in) && (((cptr->cs_flags&CS_STEALTH)==0) || (aide)) /* aides see everyone */ - && (cptr->user.usernum != CC->user.usernum) /* don't show myself */ + && (cptr->user.usernum != to_whom->user.usernum) /* don't show myself */ && (cptr->can_receive_im) /* IM-capable session */ ) { return(1); @@ -107,7 +108,7 @@ void xmpp_wholist_presence_dump(void) } for (i=0; i", ++unsolicited_id); @@ -324,7 +326,7 @@ void xmpp_massacre_roster(void) cptr = CtdlGetContextArray(&nContexts); if (cptr) { for (i=0; i