--- ../../spamdyke-3.1.7-orig/spamdyke/spamdyke.c	2008-04-24 09:12:15.000000000 -0500
+++ spamdyke.c	2008-04-24 09:20:51.000000000 -0500
@@ -292,8 +292,6 @@
           fprintf(log_file, " - %s%s\n", LOG_MESSAGE_AUTH_FAILURE, data);
           break;
         default:
-          if (action != last_action)
-            {
             fprintf(log_file, "\n%s %.2d/%.2d/%d %.2d:%.2d:%.2d", prefixes[action], tmp_tm->tm_mon + 1, tmp_tm->tm_mday, tmp_tm->tm_year + 1900, tmp_tm->tm_hour, tmp_tm->tm_min, tmp_tm->tm_sec);
 
             if (current_settings->tls_state == TLS_STATE_ACTIVE_SPAMDYKE)
@@ -305,7 +303,6 @@
               fprintf(log_file, LOG_ACTION_PREFIX_AUTH "%s", current_settings->smtp_auth_username);
 
             fprintf(log_file, "\n");
-            }
           break;
         }
 
@@ -335,14 +332,17 @@
       {
       if ((return_value = NETWORK_WRITE(current_settings, target_fd, data, data_length)) == -1)
         SPAMDYKE_LOG_DEBUG(current_settings, LOG_ERROR_WRITE "%s", data_length, target_fd, strerror(errno));
+else { char tmp[MAX_BUF + 1]; int len = snprintf(tmp, MAX_BUF, "Wrote %d bytes to file descriptor %d", data_length, target_fd); output_writeln(current_settings, LOG_ACTION_FILTER_FROM, -1, tmp, len); }
       }
     else if (current_settings->tls_state == TLS_STATE_ACTIVE_PASSTHROUGH)
       {
       if ((return_value = write(target_fd, data, data_length)) == -1)
         SPAMDYKE_LOG_DEBUG(current_settings, LOG_ERROR_WRITE "%s", data_length, target_fd, strerror(errno));
+else { char tmp[MAX_BUF + 1]; int len = snprintf(tmp, MAX_BUF, "Wrote %d bytes to file descriptor %d", data_length, target_fd); output_writeln(current_settings, LOG_ACTION_FILTER_FROM, -1, tmp, len); }
       }
     else
       {
+int total = 0;
       data_ptr = data;
       while ((data_ptr - data) < data_length)
         {
@@ -357,6 +357,7 @@
               SPAMDYKE_LOG_DEBUG(current_settings, LOG_ERROR_WRITE "%s", i + 1, target_fd, strerror(errno));
               break;
               }
+else total += i + 1;
             }
           else if ((i > 0) ||
                    (last_char != CHAR_CR))
@@ -367,12 +368,14 @@
               SPAMDYKE_LOG_DEBUG(current_settings, LOG_ERROR_WRITE "%s", i, target_fd, strerror(errno));
               break;
               }
+else total += i;
 
             if ((return_value = write(target_fd, STR_CRLF, STRLEN(STR_CRLF))) == -1)
               {
               SPAMDYKE_LOG_DEBUG(current_settings, LOG_ERROR_WRITE "%s", STRLEN(STR_CRLF), target_fd, strerror(errno));
               break;
               }
+else total += STRLEN(STR_CRLF);
             }
           else
             if ((return_value = write(target_fd, data_ptr, 1)) == -1)
@@ -380,13 +383,16 @@
               SPAMDYKE_LOG_DEBUG(current_settings, LOG_ERROR_WRITE "%s", 1, target_fd, strerror(errno));
               break;
               }
+else total += 1;
 
           data_ptr += i + 1;
+{ char tmp[MAX_BUF + 1]; int len = snprintf(tmp, MAX_BUF, "Wrote %d bytes to file descriptor %d", total, target_fd); output_writeln(current_settings, LOG_ACTION_FILTER_FROM, -1, tmp, len); }
           }
         else
           {
           if ((return_value = write(target_fd, data_ptr, i)) == -1)
             SPAMDYKE_LOG_DEBUG(current_settings, LOG_ERROR_WRITE "%s", i, target_fd, strerror(errno));
+else { char tmp[MAX_BUF + 1]; int len = snprintf(tmp, MAX_BUF, "Wrote %d bytes to file descriptor %d", i, target_fd); output_writeln(current_settings, LOG_ACTION_FILTER_FROM, -1, tmp, len); }
 
           break;
           }
@@ -1633,6 +1639,7 @@
         {
         if ((read_result = read(*inbound_fd, buf_childinput + strlen_buf_childinput, MAX_BUF - strlen_buf_childinput)) > 0)
           {
+{ char tmp[MAX_BUF + 1]; int len = snprintf(tmp, MAX_BUF, "Read %d bytes from child", read_result); output_writeln(current_settings, LOG_ACTION_FILTER_FROM, -1, tmp, len); }
           strlen_buf_childinput += read_result;
           buf_childinput[strlen_buf_childinput] = '\0';
 
@@ -1970,6 +1977,7 @@
         {
         if ((read_result = NETWORK_READ(current_settings, STDIN_FD, buf_input + strlen_buf_input, MAX_BUF - strlen_buf_input)) > 0)
           {
+{ char tmp[MAX_BUF + 1]; int len = snprintf(tmp, MAX_BUF, "Read %d bytes from network", read_result); output_writeln(current_settings, LOG_ACTION_FILTER_FROM, -1, tmp, len); }
           strlen_buf_input += read_result;
           buf_input[strlen_buf_input] = '\0';
           usable_buf_input = 1;
