From: Dave West Date: Tue, 18 Mar 2008 15:00:28 +0000 (+0000) Subject: Jabber now reads the context list safely and it writes it safely too. X-Git-Tag: v7.86~2416 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=bd22268adc68d85e3cf0c258a4d1d39047195c97;p=citadel.git Jabber now reads the context list safely and it writes it safely too. --- diff --git a/citadel/modules/jabber/xmpp_presence.c b/citadel/modules/jabber/xmpp_presence.c index 84b5662ed..5c87cca3c 100644 --- a/citadel/modules/jabber/xmpp_presence.c +++ b/citadel/modules/jabber/xmpp_presence.c @@ -54,19 +54,26 @@ void jabber_wholist_presence_dump(void) { struct CitContext *cptr = NULL; + int nContexts, i; + int aide = (CC->user.axlevel >= 6); - for (cptr = ContextList; cptr != NULL; cptr = cptr->next) { - if (cptr->logged_in) { + cptr = CtdlGetContextArray(&nContexts); + if (!cptr) + return ; /** FIXME: Does jabber need to send something to maintain the protocol? */ + + for (i=0; ics_flags&CS_STEALTH)==0) || (aide)) /* aides see everyone */ - && (cptr->user.usernum != CC->user.usernum) /* don't show myself */ + (((cptr[i].cs_flags&CS_STEALTH)==0) || (aide)) /* aides see everyone */ + && (cptr[i].user.usernum != CC->user.usernum) /* don't show myself */ ) { cprintf("", - cptr->cs_inet_email); + cptr[i].cs_inet_email); } } } + free(cptr); } diff --git a/citadel/modules/jabber/xmpp_query_namespace.c b/citadel/modules/jabber/xmpp_query_namespace.c index fdec3135f..98f62285a 100644 --- a/citadel/modules/jabber/xmpp_query_namespace.c +++ b/citadel/modules/jabber/xmpp_query_namespace.c @@ -70,21 +70,26 @@ void jabber_roster_item(struct CitContext *cptr) { void jabber_iq_roster_query(void) { struct CitContext *cptr; + int nContexts, i; int aide = (CC->user.axlevel >= 6); cprintf(""); - for (cptr = ContextList; cptr != NULL; cptr = cptr->next) { - if (cptr->logged_in) { + cptr = CtdlGetContextArray(&nContexts); + if (!cptr) + return ; /** FIXME: Does jabber need to send something to maintain the protocol? */ + + for (i=0; ics_flags&CS_STEALTH)==0) || (aide)) - && (cptr->user.usernum != CC->user.usernum) + (((cptr[i].cs_flags&CS_STEALTH)==0) || (aide)) + && (cptr[i].user.usernum != CC->user.usernum) ) { - jabber_roster_item(cptr); + jabber_roster_item(&cptr[i]); } } } - + free (cptr); cprintf(""); } diff --git a/citadel/modules/jabber/xmpp_queue.c b/citadel/modules/jabber/xmpp_queue.c index 44540496b..2c97b8431 100644 --- a/citadel/modules/jabber/xmpp_queue.c +++ b/citadel/modules/jabber/xmpp_queue.c @@ -99,11 +99,13 @@ void xmpp_queue_event(int event_type, char *email_addr) { end_critical_section(S_XMPP_QUEUE); /* Tell the sessions that something is happening */ + begin_critical_section(S_SESSION_TABLE); for (cptr = ContextList; cptr != NULL; cptr = cptr->next) { if ((cptr->logged_in) && (cptr->h_async_function == xmpp_async_loop)) { cptr->async_waiting = 1; } } + end_critical_section(S_SESSION_TABLE); }