I've been comparing faxsend's and c2faxsend's management of the queue
file and found that the "returned" value needs to get updated, i.e. the
fs.exitState needs to be written there (recoded to hylafax' needs).

The attached patch against 01.02.03_7 sources corrects this.

--- sendmain.cpp.org    2005-02-18 19:33:18.302103538 +0100
+++ sendmain.cpp        2005-02-18 19:36:09.491593805 +0100
@@ -47,6 +47,36 @@
 /*===========================================================================*\
 \*===========================================================================*/
 
+
+static int mapToHylaCode(int exitState)
+{
+    switch (exitState) {
+        case 2:
+        case 4:
+        case 5:
+        case 6:
+        case 7:
+        case 10:
+        case 12:
+            // retry
+            return 0;
+        case 15:
+        default:
+            // error
+            return 1;
+        case 0:
+            // okay
+            return 2;
+        case 1:
+        case 3:
+        case 11:
+            // reformat
+            return 3;
+    }
+    return 1;
+}
+
+
 void WriteQFile (char *QFileName, tUInt commID, CFaxSend *fs, char 
**statustext) {
     dhead ("WriteQFile", DCON_CFaxSend);
     dassert (QFileName != 0);
@@ -159,6 +189,8 @@
             dprint ("found dataformat ");
             sprintf (ne + 1, "1-D MR\n"); // SFF includes 1-D MR (Huffman) data
         }
+       else if (!strcasecmp("returned", text)) // && fs->exitState == 0)
+            sprintf(ne+1, "%d\n", mapToHylaCode(fs->exitState));
 
         *ne = ':';
         ne  = new char[strlen (text) + 1];
@@ -458,34 +490,10 @@
     dprint ("fs.exitState=%x ", fs.exitState);
     if (format == FaxFormat_Hylafax) {
         WriteQFile (argv[optind], commID, &fs, &statustext);
+
         // map error codes from mgetty+sendfax to hylafax
-        switch (fs.exitState) {
-        case 2:
-        case 4:
-        case 5:
-        case 6:
-        case 7:
-        case 10:
-        case 12:
-            // retry
-            fs.exitState = 0;
-            break;
-        case 15:
-        default:
-            // error
-            fs.exitState = 1;
-            break;
-        case 0:
-            // okay
-            fs.exitState = 2;
-            break;
-        case 1:
-        case 3:
-        case 11:
-            // reformat
-            fs.exitState = 3;
-            break;
-        }
+       fs.exitState = mapToHylaCode(fs.exitState);
+
         fs.WriteXferLog (PollStr.IsEmpty() ? "SEND" : "POLL", commID, 
JobTag.GetPointer(), &JobID,
                          deviceName, &MailAddr, &TelNumber, statustext);
         dprint ("fs.exitState=%x ", fs.exitState);

Reply via email to