]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
hfaxd: Fix RECV_START, RECV_PAGE, RECV_DOC triggers
authorAidan Van Dyk <aidan@ifax.com>
Mon, 28 Apr 2008 20:37:43 +0000 (20:37 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Mon, 28 Apr 2008 20:37:43 +0000 (20:37 +0000)
The previous patch that fixed RECV_BEGIN, RECV_END and MODEM_CID triggers
actually brok RECV_START, RECV_PAGE, and RECV_DOC triggers.

This fixes the remaining 3, and combines the MODEM_ and RECV_ paths to
make it more clear what's going on.

This is the real fix for Lee's:
| commit 134af2ec4bbbc0be5e1c75f917b38c5236740a1c
| Author: Lee Howard <faxguy@howardsilvan.com>
| Date:   Sun Mar 16 08:08:21 2008 +0000
|
|   Another one of these... make sure that we stay within bounds.
|
|   It would seem that the FIFO messages were supposed to have some information
|   in them that is not there... for some reason.

hfaxd/Trigger.c++

index 0489d1ee851ead2b507175a816438f38f5a7d2b5..a32b223d4d63e3173e6eb06c833687e9bcc6e1b0 100644 (file)
@@ -170,33 +170,35 @@ HylaFAXServer::triggerEvent(const TriggerMsgHeader& h, const char* cp)
            else
                logSendEventMsg(h, job, cp);
        }
-    } else if (evt == EventType(RECV_BASE)) {
-       FaxRecvInfo ri;
-       ri.decode(cp);
-       /*
-        * Update/record receive queue status.
-        */
-       RecvInfo* rip = recvq[ri.qfile];
-       if (!rip)
-           recvq[ri.qfile] = rip = new RecvInfo(ri.qfile);
-       if (rip->recvTime == 0)
-           rip->recvTime = h.tstamp;
-       if (h.event == Trigger::RECV_END) {
-           rip->beingReceived = false;
-           rip->reason = ri.reason;
-       } else
-           rip->beingReceived = true;
-       rip->sender = ri.sender;
-       rip->subaddr = ri.subaddr;
-       rip->npages = ri.npages;
-       rip->time = h.tstamp - rip->recvTime;
-       rip->commid = ri.commid;
-       if (IS(LOGTRIG) && type == TYPE_A)
-           logRecvEventMsg(h, ri, cp);
-    } else if (evt == EventType(MODEM_BASE)) {
+    } else if (evt == EventType(MODEM_BASE) || evt == EventType(RECV_BASE)) {
        ModemExt modem;
        cp = modem.decode(cp);
-       if (IS(LOGTRIG) && type == TYPE_A)
+
+       if (evt == EventType(RECV_BASE))
+       {
+           FaxRecvInfo ri;
+           ri.decode(cp);
+           /*
+            * Update/record receive queue status.
+            */
+           RecvInfo* rip = recvq[ri.qfile];
+           if (!rip)
+               recvq[ri.qfile] = rip = new RecvInfo(ri.qfile);
+           if (rip->recvTime == 0)
+               rip->recvTime = h.tstamp;
+           if (h.event == Trigger::RECV_END) {
+               rip->beingReceived = false;
+               rip->reason = ri.reason;
+           } else
+               rip->beingReceived = true;
+           rip->sender = ri.sender;
+           rip->subaddr = ri.subaddr;
+           rip->npages = ri.npages;
+           rip->time = h.tstamp - rip->recvTime;
+           rip->commid = ri.commid;
+           if (IS(LOGTRIG) && type == TYPE_A)
+               logRecvEventMsg(h, ri, cp);
+       } else if (IS(LOGTRIG) && type == TYPE_A)
            logModemEventMsg(h, modem, cp);
     } else {
        logError("Unrecognized trigger event message %u.", h.event);