From: Art Cancro Date: Sun, 31 May 2009 19:33:47 +0000 (+0000) Subject: * New session variable 'can_receive_im' which indicates that the session is running... X-Git-Tag: v7.86~1117 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=1afc2a72fb40dcf428511fb0d8ce9e4f626bdc2b * New session variable 'can_receive_im' which indicates that the session is running a protocol that is capable of receiving instant messages. This is not the same thing as quiet/nonquiet mode, it determines protocol, not policy. The server will now prohibit sending instant messages to sessions which cannot receive them (SMTP, POP, IMAP, etc.). Jabber sessions now only show buddies that are capable of receiving instant messages. --- diff --git a/citadel/citserver.c b/citadel/citserver.c index df75a28a0..063c229f8 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -1009,8 +1009,8 @@ void citproto_begin_session() { CC->kill_me = 1; } else { - cprintf("%d %s Citadel server ready.\n", - CIT_OK, config.c_nodename); + cprintf("%d %s Citadel server ready.\n", CIT_OK, config.c_nodename); + CC->can_receive_im = 1; } } diff --git a/citadel/modules/chat/serv_chat.c b/citadel/modules/chat/serv_chat.c index 2cf3bb233..024cca2e3 100644 --- a/citadel/modules/chat/serv_chat.c +++ b/citadel/modules/chat/serv_chat.c @@ -591,6 +591,7 @@ int send_instant_message(char *lun, char *lem, char *x_user, char *x_msg) if ( ((!strcasecmp(un, x_user)) || (!strcasecmp(x_user, "broadcast"))) + && (ccptr->can_receive_im) && ((ccptr->disable_exp == 0) || (CC->user.axlevel >= 6)) ) { if (do_send) { diff --git a/citadel/modules/jabber/serv_xmpp.c b/citadel/modules/jabber/serv_xmpp.c index 94a81036b..988efad29 100644 --- a/citadel/modules/jabber/serv_xmpp.c +++ b/citadel/modules/jabber/serv_xmpp.c @@ -421,6 +421,8 @@ void xmpp_greeting(void) { XML_SetElementHandler(XMPP->xp, xmpp_xml_start, xmpp_xml_end); XML_SetCharacterDataHandler(XMPP->xp, xmpp_xml_chardata); // XML_SetUserData(XMPP->xp, something...); + + CC->can_receive_im = 1; /* This protocol is capable of receiving instant messages */ } diff --git a/citadel/modules/jabber/xmpp_messages.c b/citadel/modules/jabber/xmpp_messages.c index 6ae5e83b0..a49b5f66c 100644 --- a/citadel/modules/jabber/xmpp_messages.c +++ b/citadel/modules/jabber/xmpp_messages.c @@ -89,10 +89,11 @@ void jabber_send_message(char *message_to, char *message_body) { if (!CC->logged_in) return; for (cptr = ContextList; cptr != NULL; cptr = cptr->next) { - if (cptr->logged_in) { - if (!strcasecmp(cptr->cs_inet_email, message_to)) { - recp = cptr->user.fullname; - } + if ( (cptr->logged_in) + && (cptr->can_receive_im) + && (!strcasecmp(cptr->cs_inet_email, message_to)) + ) { + recp = cptr->user.fullname; } } diff --git a/citadel/modules/jabber/xmpp_presence.c b/citadel/modules/jabber/xmpp_presence.c index f7f454bb6..7ac4439d7 100644 --- a/citadel/modules/jabber/xmpp_presence.c +++ b/citadel/modules/jabber/xmpp_presence.c @@ -63,8 +63,9 @@ void jabber_wholist_presence_dump(void) for (i=0; iuser.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 */ + && (cptr[i].can_receive_im) /* IM-capable session */ ) { cprintf("", cptr[i].cs_inet_email); @@ -96,9 +97,11 @@ void xmpp_presence_notify(char *presence_jid, int event_type) { /* Count the visible sessions for this user */ for (i=0; i