]> code.citadel.org Git - citadel.git/commitdiff
* Changed the logic for printing RFC822 addresses (again)
authorArt Cancro <ajc@citadel.org>
Fri, 8 Feb 2002 22:36:24 +0000 (22:36 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 8 Feb 2002 22:36:24 +0000 (22:36 +0000)
* Implemented cdb_trunc() in database_sleepycat.c, using db_truncate()
  (We need to either provide an alternative implementation or require DB >=3.3)
* Automatically Re: subject line in the client where appropriate

citadel/ChangeLog
citadel/database_sleepycat.c
citadel/messages.c
citadel/msgbase.c

index 39eebb1f29f09b863b26a46ca2b4b91d57a42ae8..f9f211bb4b46b779a5b0fbcfadabafb9f7f09503 100644 (file)
@@ -1,4 +1,10 @@
  $Log$
+ Revision 590.105  2002/02/08 22:36:23  ajc
+ * Changed the logic for printing RFC822 addresses (again)
+ * Implemented cdb_trunc() in database_sleepycat.c, using db_truncate()
+   (We need to either provide an alternative implementation or require DB >=3.3)
+ * Automatically Re: subject line in the client where appropriate
+
  Revision 590.104  2002/02/08 19:02:25  ajc
  * Added client and server side support for entering Subject lines in
    messages when not using RFC822.
@@ -3308,4 +3314,3 @@ 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 62c3deb9f4f6994a1e8216adb2aabac3fe04da47..9f84a427a541f88a29b20acf48846c4b328c0d27 100644 (file)
@@ -669,7 +669,19 @@ struct cdbdata *cdb_next_item(int cdb)
  * Truncate (delete every record)
  */
 void cdb_trunc(int cdb) {
-       /* FIXME this needs to be implemented */
+       int ret = 0;
+       u_int32_t records_deleted;
+
+       cdb_begin_transaction();
+
+       lprintf(9, "truncate\n");
+       ret = dbp[cdb]->truncate(dbp[cdb], MYTID, &records_deleted, 0);
+       if (ret) {
+               lprintf(1, "cdb_trunc: db_truncate: %s\n", db_strerror(ret));
+               abort();
+       }
+
+       cdb_end_transaction();
 }
 
 
index e650c2165338150968813097bb895f4c493e91b7..33ad0cae1616dbc501c2661798223e73ec6145d4 100644 (file)
@@ -59,7 +59,8 @@ void newprompt(char *prompt, char *str, int len);
 int file_checksum(char *filename);
 void do_edit(char *desc, char *read_cmd, char *check_cmd, char *write_cmd);
 
-char reply_to[512];
+char reply_to[SIZ];
+char reply_subject[SIZ];
 long msg_arr[MAXMSGS];
 int num_msgs;
 char rc_alt_semantics;
@@ -414,9 +415,10 @@ int read_message(
                }
                if (nhdr == 1)
                        buf[0] = '_';
+
                if (!strncasecmp(buf, "type=", 5))
                        format_type = atoi(&buf[5]);
-               if ((!strncasecmp(buf, "msgn=", 5))
+               else if ((!strncasecmp(buf, "msgn=", 5))
                    && (rc_display_message_numbers)) {
                        if (dest) {
                                fprintf(dest, "[#%s] ", &buf[5]);
@@ -429,7 +431,7 @@ int read_message(
                                scr_printf("] ");
                        }
                }
-               if (!strncasecmp(buf, "from=", 5)) {
+               else if (!strncasecmp(buf, "from=", 5)) {
                        if (dest) {
                                fprintf(dest, "from %s ", &buf[5]);
                        } else {
@@ -439,10 +441,10 @@ int read_message(
                                scr_printf("%s ", &buf[5]);
                        }
                }
-               if (!strncasecmp(buf, "subj=", 5))
+               else if (!strncasecmp(buf, "subj=", 5)) {
                        strcpy(m_subject, &buf[5]);
-
-               if (!strncasecmp(buf, "rfca=", 5)) {
+               }
+               else if (!strncasecmp(buf, "rfca=", 5)) {
                        safestrncpy(rfca, &buf[5], sizeof(rfca) - 5);
                        if (dest) {
                                fprintf(dest, "<%s> ", &buf[5]);
@@ -455,7 +457,7 @@ int read_message(
                                scr_printf("> ");
                        }
                }
-               if ((!strncasecmp(buf, "hnod=", 5))
+               else if ((!strncasecmp(buf, "hnod=", 5))
                    && (strcasecmp(&buf[5], serv_info.serv_humannode))
                    && (strlen(rfca) == 0)) {
                        if (dest) {
@@ -469,7 +471,7 @@ int read_message(
                                scr_printf(") ");
                        }
                }
-               if ((!strncasecmp(buf, "room=", 5))
+               else if ((!strncasecmp(buf, "room=", 5))
                    && (strcasecmp(&buf[5], room_name))
                    && (strlen(rfca) == 0)) {
                        if (dest) {
@@ -481,8 +483,7 @@ int read_message(
                                scr_printf("%s> ", &buf[5]);
                        }
                }
-
-               if (!strncasecmp(buf, "node=", 5)) {
+               else if (!strncasecmp(buf, "node=", 5)) {
                        safestrncpy(node, &buf[5], sizeof(buf) - 5);
                        if ((room_flags & QR_NETWORK)
                            ||
@@ -503,8 +504,7 @@ int read_message(
                                }
                        }
                }
-
-               if (!strncasecmp(buf, "rcpt=", 5)) {
+               else if (!strncasecmp(buf, "rcpt=", 5)) {
                        if (dest) {
                                fprintf(dest, "to %s ", &buf[5]);
                        } else {
@@ -514,7 +514,7 @@ int read_message(
                                scr_printf("%s ", &buf[5]);
                        }
                }
-               if (!strncasecmp(buf, "time=", 5)) {
+               else if (!strncasecmp(buf, "time=", 5)) {
                        fmt_date(now, atol(&buf[5]), 0);
                        if (dest) {
                                fprintf(dest, "%s ", now);
@@ -559,6 +559,7 @@ int read_message(
                lines_printed = checkpagin(lines_printed, pagin, screenheight);
        }
 
+       strcpy(reply_subject, m_subject);
        if (strlen(m_subject) > 0) {
                if (dest) {
                        fprintf(dest, "Subject: %s\n", m_subject);
@@ -681,8 +682,6 @@ int client_make_message(char *filename,     /* temporary file name */
        char header[SIZ];
        int cksum = 0;
 
-       if (subject != NULL) strcpy(subject, "");
-
        if (mode == 2)
                if (strlen(editor_path) == 0) {
                        err_printf
@@ -927,12 +926,14 @@ int entmsg(int is_reply,  /* nonzero if this was a <R>eply command */
        long highmsg;
        FILE *fp;
        char subject[SIZ];
-       
+
        if (c > 0)
                mode = 1;
        else
                mode = 0;
 
+       strcpy(subject, "");
+
        /*
         * First, check to see if we have permission to enter a message in
         * this room.  The server will return an error code if we can't.
@@ -974,6 +975,21 @@ int entmsg(int is_reply,   /* nonzero if this was a <R>eply command */
                        strcpy(buf, "sysop");
        }
 
+       if (is_reply) {
+               if (strlen(reply_subject) > 0) {
+                       if (!strncasecmp(reply_subject,
+                          "Re: ", 3)) {
+                               strcpy(subject, reply_subject);
+                       }
+                       else {
+                               snprintf(subject,
+                                       sizeof subject,
+                                       "Re: %s",
+                                       reply_subject);
+                       }
+               }
+       }
+
        b = 0;
        if (room_flags & QR_ANONOPT) {
                scr_printf("Anonymous (Y/N)? ");
index f6c7b5e2ab0782325fc9a3faed24b8c2a9aa98f4..6194f9a364d6d00dff054640eb831a4e6362923b 100644 (file)
@@ -982,6 +982,7 @@ int CtdlOutputPreLoadedMsg(struct CtdlMessage *TheMessage,
        char display_name[SIZ];
        char *mptr;
        char *nl;       /* newline string */
+       int suppress_f = 0;
 
        /* buffers needed for RFC822 translation */
        char suser[SIZ];
@@ -1076,6 +1077,17 @@ int CtdlOutputPreLoadedMsg(struct CtdlMessage *TheMessage,
                        }
                }
 
+               /* Don't show Internet address for users on the
+                * local Citadel network.
+                */
+               suppress_f = 0;
+               if (TheMessage->cm_fields['N'] != NULL)
+                  if (strlen(TheMessage->cm_fields['N']) > 0)
+                     if (haschar(TheMessage->cm_fields['N'], '.') == 0) {
+                       suppress_f = 1;
+               }
+               
+               /* Now spew the header fields in the order we like them. */
                strcpy(allkeys, FORDER);
                for (i=0; i<strlen(allkeys); ++i) {
                        k = (int) allkeys[i];
@@ -1087,17 +1099,8 @@ int CtdlOutputPreLoadedMsg(struct CtdlMessage *TheMessage,
                                                        msgkeys[k],
                                                        display_name);
                                        }
-                                       /* Don't show Internet address for
-                                        * local users
-                                        */
-                                       else if (k == 'F') {
-                                               if (do_proto) if (TheMessage->cm_fields['N'] != NULL) if (strcasecmp(TheMessage->cm_fields['N'], config.c_nodename)) {
-                                                       cprintf("%s=%s\n",
-                                                               msgkeys[k],
-                                                               TheMessage->cm_fields[k]
-                                                       );
-
-                                               }
+                                       else if ((k == 'F') && (suppress_f)) {
+                                               /* do nothing */
                                        }
                                        /* Masquerade display name if needed */
                                        else {