* New session variable 'can_receive_im' which indicates that the session is running...
authorArt Cancro <ajc@citadel.org>
Sun, 31 May 2009 19:33:47 +0000 (19:33 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 31 May 2009 19:33:47 +0000 (19:33 +0000)
citadel/citserver.c
citadel/modules/chat/serv_chat.c
citadel/modules/jabber/serv_xmpp.c
citadel/modules/jabber/xmpp_messages.c
citadel/modules/jabber/xmpp_presence.c
citadel/server.h

index df75a28a0d06c4f7c8e0d546d56134ef09ab1439..063c229f8ef40f55554e201cdf6ee860e53e4a2c 100644 (file)
@@ -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;
        }
 }
 
index 2cf3bb233da43313ae483ffc938af174f9dca7be..024cca2e30c2ac76dbc9842a30f62534275d2386 100644 (file)
@@ -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) {
index 94a81036bc2d61c58a26eedc94914e1e2f213e07..988efad2910221388a8b458ad871324db26853e9 100644 (file)
@@ -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 */
 }
 
 
index 6ae5e83b0df1b1d46d2e7801901983cf8b72c5e7..a49b5f66ca9dd520d9ea30b2b2c1010ab50e7ab7 100644 (file)
@@ -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;
                }
        }
 
index f7f454bb609fd97adc0d63f678a024b8aea03ec5..7ac4439d716c618c4277074ffe083df8a1dd5e14 100644 (file)
@@ -63,8 +63,9 @@ void jabber_wholist_presence_dump(void)
        for (i=0; i<nContexts; i++) {
                if (cptr[i].logged_in) {
                        if (
-                          (((cptr[i].cs_flags&CS_STEALTH)==0) || (aide))               /* aides see everyone */
-                          && (cptr[i].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 */
+                               && (cptr[i].can_receive_im)                     /* IM-capable session */
                           ) {
                                cprintf("<presence type=\"available\" from=\"%s\"></presence>",
                                        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<nContexts; i++) {
                if (cptr[i].logged_in) {
-                       if (  (!strcasecmp(cptr[i].cs_inet_email, presence_jid)) 
-                          && (((cptr[i].cs_flags&CS_STEALTH)==0) || (aide))
-                          ) {
+                       if (
+                               (!strcasecmp(cptr[i].cs_inet_email, presence_jid)) 
+                               && (((cptr[i].cs_flags&CS_STEALTH)==0) || (aide))
+                               && (cptr[i].can_receive_im)
+                       ) {
                                ++visible_sessions;
                        }
                }
index 9fc9ca6ec2458f798b5d3e230ac74b46770aec02..d78f61907837fedc9c3ad611f66261698ea266c6 100644 (file)
@@ -85,6 +85,7 @@ struct CitContext {
        int is_async;           /* Nonzero if client accepts async msgs */
        int async_waiting;      /* Nonzero if there are async msgs waiting */
        int input_waiting;      /* Nonzero if there is client input waiting */
+       int can_receive_im;     /* Session is capable of receiving instant messages */
 
        /* Client information */
        int cs_clientdev;       /* client developer ID */