]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Enhancement on Bug 583
authorAidan Van Dyk <aidan@ifax.com>
Fri, 29 Oct 2004 13:45:20 +0000 (13:45 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Fri, 29 Oct 2004 13:45:20 +0000 (13:45 +0000)
http://bugs.hylafax.org/bugzilla/show_bug.cgi?id=583

This implements proper desireddf handling in faxsend.  It also improves the
selection of DF faxq uses in preparation to hopefully minimize the work
faxsend may have to do when sending a image to remotes.

The desireddf of a job (and the destcontrols admin override) now place a
hard top limit on the best dataformat used for transmitting.

faxd/FaxSend.c++
faxd/faxQueueApp.c++
faxd/faxSendApp.c++
faxd/faxSendApp.h

index 6bb38bc1945c8fa5e8a3de3e4969b65806f09e03..c6233d4e744be1151950b336eec5488433be52e8 100644 (file)
@@ -140,12 +140,15 @@ FaxServer::sendFax(FaxRequest& fax, FaxMachineInfo& clientInfo, const fxStr& num
      * Class 1.0 modems know to not enable V.34 support if ECM is not
      * being used.  Hopefully this doesn't interfere with batched faxes.
      */
-    Class2Params dis;
-    dis.decodePage(fax.pagehandling);
-    dis.br = fxmin(modem->getBestSignallingRate(), (u_int) fax.desiredbr);
-    dis.ec = (modem->supportsECM() ? fax.desiredec : EC_DISABLE);
-    dis.st = fxmax(modem->getBestScanlineTime(), (u_int) fax.desiredst);
-    dis.bf = BF_DISABLE;
+    clientParams.decodePage(fax.pagehandling);
+    /*
+     * So we want to restrict DF sellection to those masked in fax.desireddf
+     */
+    clientParams.df = fxmin(modem->getBestDataFormat(), (u_int)fax.desireddf);
+    clientParams.br = fxmin(modem->getBestSignallingRate(), (u_int) fax.desiredbr);
+    clientParams.ec = (modem->supportsECM() ? fax.desiredec : EC_DISABLE);
+    clientParams.st = fxmax(modem->getBestScanlineTime(), (u_int) fax.desiredst);
+    clientParams.bf = BF_DISABLE;
     /*
      * Force the modem into the appropriate class
      * used to send facsimile.  We do this before
@@ -153,7 +156,7 @@ FaxServer::sendFax(FaxRequest& fax, FaxMachineInfo& clientInfo, const fxStr& num
      * requesting polling.
      */
     if ((batched & BATCH_FIRST) &&
-       !modem->faxService(!clientInfo.getHasV34Trouble() && dis.ec != EC_DISABLE && dis.br > BR_14400)) {
+       !modem->faxService(!clientInfo.getHasV34Trouble() && clientParams.ec != EC_DISABLE && clientParams.br > BR_14400)) {
        sendFailed(fax, send_failed, "Unable to configure modem for fax use");
        return;
     }
@@ -168,7 +171,7 @@ FaxServer::sendFax(FaxRequest& fax, FaxMachineInfo& clientInfo, const fxStr& num
        sendFailed(fax, send_failed, notice);
        return;
     }
-    if (!modem->sendSetup(fax, dis, notice)) {
+    if (!modem->sendSetup(fax, clientParams, notice)) {
        sendFailed(fax, send_failed, notice);
        return;
     }
@@ -561,7 +564,7 @@ FaxServer::sendSetupParams1(TIFF* tif,
      * requested.  So, RTFCC defeats requested data formatting. :-(
      */
     if (class2RTFCC || softRTFCC) {
-       params.df = clientCapabilities.df;
+       params.df = fxmin(params.df, clientCapabilities.df);
        // even if RTFCC supported uncompressed mode (and it doesn't)
        // it's likely that the remote was incorrect in telling us it does
        if (params.df == DF_2DMRUNCOMP) params.df = DF_2DMR;
index 64fae21c50b27c6b61f5d5417e4aaae63749a1d9..a231a543979b456ae6921fe2e3a6a8fcbcd495fb 100644 (file)
@@ -594,11 +594,11 @@ faxQueueApp::prepareJob(Job& job, FaxRequest& req,
      */
     if (req.desireddf == DF_2DMMR && (req.desiredec != EC_DISABLE) && 
        use2D && job.modem->supportsMMR() &&
-       info.getCalledBefore() && info.getSupportsMMR())
+        (! info.getCalledBefore() || info.getSupportsMMR()) )
            params.df = DF_2DMMR;
     else if (req.desireddf > DF_1DMH) {
        params.df = (use2D && job.modem->supports2D() &&
-           info.getCalledBefore() && info.getSupports2DEncoding()) ?
+           (! info.getCalledBefore() || info.getSupports2DEncoding()) ) ?
                DF_2DMR : DF_1DMH;
     } else
        params.df = DF_1DMH;
index c83b1ee1043700f71ff26092f9ad24063acb2add..fdfee5bbdac81bf37d4341e98b125fc7ddd6b5b1 100644 (file)
@@ -164,7 +164,7 @@ faxSendApp::send(const char* filenames)
                    ai.start = Sys::now();
 
                    /*
-                    * Force any DesiredBR/EC/ST options in the configuration
+                    * Force any DesiredDF/BR/EC/ST options in the configuration
                     * files (i.e. DestControls) to take precedence over
                     * any user-specified settings.  This shouldn't cause
                     * too many problems, hopefully, since their usage should
@@ -172,6 +172,8 @@ faxSendApp::send(const char* filenames)
                     * user-specification.
                     */
 
+                   if (desiredDF != (u_int) -1)
+                       req->desireddf = desiredDF;
                    if (desiredBR != (u_int) -1)
                        req->desiredbr = desiredBR;
                    if (desiredEC != (u_int) -1)
@@ -410,6 +412,7 @@ faxSendApp::stringtag faxSendApp::strings[] = {
 { "pollrcvdcmd",       &faxSendApp::pollRcvdCmd,       FAX_POLLRCVDCMD },
 };
 faxSendApp::numbertag faxSendApp::numbers[] = {
+{ "desireddf",         &faxSendApp::desiredDF,         (u_int) -1 },
 { "desiredbr",         &faxSendApp::desiredBR,         (u_int) -1 },
 { "desiredst",         &faxSendApp::desiredST,         (u_int) -1 },
 { "desiredec",         &faxSendApp::desiredEC,         (u_int) -1 },
index 25b29d5e70d1c28c29f5f7eb4c83887da1241d1c..e96dfbb804979b4cbed02ef6dc16c1c0239f81a4 100644 (file)
@@ -50,6 +50,7 @@ private:
     bool       ready;                  // modem ready for use
     UUCPLock*  modemLock;              // uucp lockfile handle
     fxStr      pollRcvdCmd;            // command for docs received by polling
+    u_int      desiredDF;              // desired data format
     u_int      desiredBR;              // desired signalling rate
     u_int      desiredST;              // desired min-scanline-time
     u_int      desiredEC;              // enable use of ECM if available