]> code.citadel.org Git - citadel.git/commitdiff
* Reworked the <R>eply logic in messages.c - fixes bug #34
authorArt Cancro <ajc@citadel.org>
Sat, 11 Mar 2000 20:26:03 +0000 (20:26 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 11 Mar 2000 20:26:03 +0000 (20:26 +0000)
citadel/ChangeLog
citadel/messages.c

index 447ffb38034892271f7f09c7986c75d2cfa3e738..aa6b3746fc8b82bf9fc0e0b9191506cd7205ed99 100644 (file)
@@ -1,4 +1,7 @@
 $Log$
+Revision 1.485  2000/03/11 20:26:03  ajc
+* Reworked the <R>eply logic in messages.c - fixes bug #34
+
 Revision 1.484  2000/03/11 19:22:19  nbryant
  * commands.c: improved timing of background keepalives if connection is
                lagged
@@ -1721,3 +1724,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Initial CVS import 
+
index 54824cb07f5779cf4c39ab78be216811d611f23c..9d26571101452e6c002fb479026faa42b024f408 100644 (file)
@@ -321,13 +321,12 @@ int read_message(long int num, char pagin) /* Read a message from the server */
 {
        char buf[256];
        char m_subject[256];
-       char from[256];
+       char from[256], node[256], rfca[256];
        time_t now;
        struct tm *tm;
        int format_type = 0;
        int fr = 0;
        int nhdr = 0;
-       int have_rfca = 0;
 
        sigcaught = 0;
        sttybbs(1);
@@ -345,6 +344,10 @@ int read_message(long int num, char pagin) /* Read a message from the server */
 
        strcpy(m_subject,"");
        strcpy(reply_to, "nobody ... xxxxx");
+       strcpy(from, "");
+       strcpy(node, "");
+       strcpy(rfca, "");
+
        printf("\n");
        ++lines_printed;
        lines_printed = checkpagin(lines_printed,pagin,screenheight);
@@ -391,8 +394,7 @@ int read_message(long int num, char pagin) /* Read a message from the server */
                        strcpy(m_subject,&buf[5]);
 
                if (!struncmp(buf,"rfca=",5)) {
-                       strcpy(reply_to, &buf[5]);
-                       have_rfca = 1;
+                       safestrncpy(rfca, &buf[5], sizeof(rfca) - 5);
                        color(DIM_WHITE);
                        printf("<");
                        color(BRIGHT_BLUE);
@@ -402,7 +404,7 @@ int read_message(long int num, char pagin) /* Read a message from the server */
                        }
                if ((!struncmp(buf,"hnod=",5)) 
                   && (strucmp(&buf[5],serv_info.serv_humannode))
-                  && (have_rfca == 0) ) {
+                  && (strlen(rfca) == 0) ) {
                        color(DIM_WHITE);
                        printf("(");
                        color(BRIGHT_WHITE);
@@ -412,7 +414,7 @@ int read_message(long int num, char pagin) /* Read a message from the server */
                        }
                if ((!struncmp(buf,"room=",5))
                   && (strucmp(&buf[5],room_name)) 
-                  && (have_rfca == 0)) {
+                  && (strlen(rfca) == 0)) {
                        color(DIM_WHITE);
                        printf("in ");
                        color(BRIGHT_MAGENTA);
@@ -420,28 +422,19 @@ int read_message(long int num, char pagin) /* Read a message from the server */
                        }
 
                if (!struncmp(buf,"node=",5)) {
+                       safestrncpy(node, &buf[5], sizeof(buf) - 5);
                        if ( (room_flags&QR_NETWORK)
                           || ((strucmp(&buf[5],serv_info.serv_nodename)
                           &&(strucmp(&buf[5],serv_info.serv_fqdn)))) ) 
                                {
-                               if (have_rfca == 0) {
+                               if (strlen(rfca) == 0) {
                                        color(DIM_WHITE);
                                        printf("@");
                                        color(BRIGHT_YELLOW);
                                        printf("%s ",&buf[5]);
                                }
                        }
-                       if (have_rfca == 0) {
-                        if ((!strucmp(&buf[5],serv_info.serv_nodename))
-                          ||(!strucmp(&buf[5],serv_info.serv_fqdn)))
-                               {
-                               strcpy(reply_to,from);
-                               }
-                       }
-                       else {
-                               sprintf(reply_to,"%s @ %s",from,&buf[5]);
-                               }
-                       }
+               }
 
                if (!struncmp(buf,"rcpt=",5)) {
                        color(DIM_WHITE);
@@ -468,6 +461,14 @@ int read_message(long int num, char pagin) /* Read a message from the server */
                        }
                }
        printf("\n");
+
+       if (strlen(rfca) > 0) {
+               strcpy(reply_to, rfca);
+       }
+       else {
+               snprintf(reply_to, sizeof(reply_to), "%s @ %s", from, node);
+       }
+
        if (pagin == 1) color(BRIGHT_WHITE);
        ++lines_printed;
        lines_printed = checkpagin(lines_printed,pagin,screenheight);