]> code.citadel.org Git - citadel.git/commitdiff
* Mega sexy hack to deliver express messages THROUGH IMAP! uber coolness!!
authorArt Cancro <ajc@citadel.org>
Sun, 11 Mar 2001 23:00:29 +0000 (23:00 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 11 Mar 2001 23:00:29 +0000 (23:00 +0000)
citadel/ChangeLog
citadel/imap_misc.c
citadel/imap_misc.h
citadel/serv_imap.c

index ef2242b5525e667243793af0c80fee0ea5b7d886..2f8b3aed239cdec75f55f250e5e46cd9c7e8a5d5 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 573.114  2001/03/11 23:00:29  ajc
+ * Mega sexy hack to deliver express messages THROUGH IMAP!  uber coolness!!
+
  Revision 573.113  2001/03/11 22:09:20  ajc
  * Replaced the "citlogin" binary wrapper with the "loginwrapper.sh" script.
 
@@ -2453,3 +2456,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
+
index bb0cf672bf7f3740f8f153935bb123742df2ba08..a0e7a7a7a70bb5b06dccd0555c1d30abc665d44f 100644 (file)
@@ -124,3 +124,54 @@ void imap_uidcopy(int num_parms, char *parms[]) {
 }
 
 
+/*
+ * Poll for express messages (yeah, we can do this in IMAP ... I think)
+ */
+void imap_print_express_messages(void) {
+       struct ExpressMessage *ptr, *holdptr;
+       char *dumpomatic = NULL;
+       int i;
+
+       if (CC->FirstExpressMessage == NULL) {
+               return;
+       }
+       begin_critical_section(S_SESSION_TABLE);
+       ptr = CC->FirstExpressMessage;
+       CC->FirstExpressMessage = NULL;
+       end_critical_section(S_SESSION_TABLE);
+
+       while (ptr != NULL) {
+               dumpomatic = mallok(strlen(ptr->text) + SIZ);
+               strcpy(dumpomatic, "");
+               if (ptr->flags && EM_BROADCAST)
+                       strcat(dumpomatic, "Broadcast message ");
+               else if (ptr->flags && EM_CHAT)
+                       strcat(dumpomatic, "Chat request ");
+               else if (ptr->flags && EM_GO_AWAY)
+                       strcat(dumpomatic, "Please logoff now, as requested ");
+               else
+                       strcat(dumpomatic, "Message ");
+               sprintf(&dumpomatic[strlen(dumpomatic)],
+                       "from %s:\n", ptr->sender);
+               if (ptr->text != NULL)
+                       strcat(dumpomatic, ptr->text);
+
+               holdptr = ptr->next;
+               if (ptr->text != NULL) phree(ptr->text);
+               phree(ptr);
+               ptr = holdptr;
+
+               for (i=0; i<strlen(dumpomatic); ++i) {
+                       if (!isprint(dumpomatic[i])) dumpomatic[i] = ' ';
+                       if (dumpomatic[i]=='\\') dumpomatic[i]='/';
+                       if (dumpomatic[i]=='\"') dumpomatic[i]='\'';
+               }
+
+               cprintf("* OK [ALERT] %s\r\n", dumpomatic);
+               phree(dumpomatic);
+       }
+       cprintf("000\n");
+}
+
+
+
index 16533f502be5031bf02d4092ef5a510d57a72cc4..d46d0357e99db0e13c82f9828ab8a611f453086b 100644 (file)
@@ -5,3 +5,4 @@
 
 void imap_copy(int num_parms, char *parms[]);
 void imap_uidcopy(int num_parms, char *parms[]);
+void imap_print_express_messages(void);
index e19f07cdff0f9e7b774f8b441b448ec444511a5d..fc68ae3b2ecc2f09e7adebd5269a06a5f3177418 100644 (file)
@@ -761,7 +761,10 @@ void imap_command_loop(void) {
        }
 
 
-       /* Ok, at this point we're in normal command mode */
+       /* Ok, at this point we're in normal command mode.  The first thing
+        * we do is print any incoming pages (yeah! we really do!)
+        */
+       imap_print_express_messages();
 
        /*
         * Before processing the command that was just entered... if we happen