]> code.citadel.org Git - citadel.git/commitdiff
* Send time-of-day with pages sent via IMAP
authorMichael Hampton <io_error@uncensored.citadel.org>
Fri, 5 Apr 2002 22:32:00 +0000 (22:32 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Fri, 5 Apr 2002 22:32:00 +0000 (22:32 +0000)
citadel/ChangeLog
citadel/imap_misc.c

index 091ab642fd9f57970ef7eff0a225b78f3d39b84b..1032ca2c3d079497a2c934e1af6c7a07e8563837 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 591.4  2002/04/05 22:31:59  error
+ * Send time-of-day with pages sent via IMAP
+
  Revision 591.3  2002/04/05 14:34:02  ajc
  * Minor tweak to nested folder algorithm to handle nesting in mail root
 
@@ -3582,3 +3585,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 6468e3f9c89e24aaabf4f7700d51e8f6f261b040..a90f203ac537d8d43b6394d2fec818e26b2b23f2 100644 (file)
@@ -140,8 +140,10 @@ void imap_uidcopy(int num_parms, char *parms[]) {
 void imap_print_express_messages(void) {
        struct ExpressMessage *ptr, *holdptr;
        char *dumpomatic = NULL;
+       char tmp[SIZ];
        int i;
        size_t size, size2;
+       struct tm *stamp;
 
        if (CC->FirstExpressMessage == NULL) {
                return;
@@ -152,6 +154,7 @@ void imap_print_express_messages(void) {
        end_critical_section(S_SESSION_TABLE);
 
        while (ptr != NULL) {
+               stamp = localtime(&(ptr->timestamp));
                size = strlen(ptr->text) + SIZ;
                dumpomatic = mallok(size);
                strcpy(dumpomatic, "");
@@ -164,9 +167,23 @@ void imap_print_express_messages(void) {
                else
                        strcat(dumpomatic, "Message ");
 
+               /* Timestamp.  Can this be improved? */
+               if (stamp->tm_hour == 0 || stamp->tm_hour == 12)
+                       sprintf(tmp, "at 12:%02d%cm",
+                               stamp->tm_min, 
+                               stamp->tm_hour ? 'p' : 'a');
+               else if (stamp->tm_hour > 12)           /* pm */
+                       sprintf(tmp, "at %d:%02dpm",
+                               stamp->tm_hour - 12,
+                               stamp->tm_min);
+               else                                    /* am */
+                       sprintf(tmp, "at %d:%02dam",
+                               stamp->tm_hour, stamp->tm_min);
+               strcat(dumpomatic, tmp);
+
                size2 = strlen(dumpomatic);
                snprintf(&dumpomatic[size2], size - size2,
-                       "from %s:\n", ptr->sender);
+                       " from %s:\n", ptr->sender);
                if (ptr->text != NULL)
                        strcat(dumpomatic, ptr->text);