BBS:      TELESC.NET.BR
Assunto:  Re: FileFix reply kludge
De:       Matthew Asham
Data:     Wed, 18 Mar 2026 13:52:30 -0700
-----------------------------------------------------------
 MA> I noticed today that FileFix does not set a REPLY kludge to responses
 MA> but AreaFix does.  Is there a way I can enable this?


I ended up asking Codex to take a look at the problem.  I filed a Github issue regarding this as well.
https://github.com/huskyproject/htick/issues/18

Just in case this helps someone else:

Summary
=======

This change fixes reply-linkage handling in `htick/src/scan.c`,
specifically in `convertMsgText()`.

Old behavior:
- Read the control buffer into `ctrlBuff`
- Convert `ctrlBuff` into printable kludge lines with `CvtCtrlToKludge()`
- Prepend those kludge lines to `msg->text`
- Free the original control buffer

New behavior:
- Read the control buffer into `ctrlBuff`
- Keep the raw control buffer by assigning it to `msg->ctl`
- Store the control buffer length in `msg->ctlLength`
- Build `msg->text` from the message body plus the generated Via line only
- Explicitly terminate `msg->text` and update `msg->textLength`

Why this matters:
- Reply metadata such as MSGID and REPLY stays available in the control data
- Later code can inspect the real control buffer instead of reparsing text
- The message body no longer gets synthetic kludge text prepended to it

Minimal patch
=============

Apply this patch from the repository root with:

  patch -p1 < filefix-reply-fix.diff

Patch contents:

--- a/htick/src/scan.c
+++ b/htick/src/scan.c
@@ -74,15 +74,16 @@
 void convertMsgText(HMSG SQmsg, s_message * msg, hs_addr ourAka)
 {
-    char * kludgeLines, viaLine[100];
+    char viaLine[100];
     UCHAR * ctrlBuff;
     UINT32 ctrlLen;
     time_t tm;
     struct tm * dt;

-    /*  get kludge lines */
+    /* preserve raw control data so RetMsg() can recover MSGID/REPLY linkage */
     ctrlLen  = MsgGetCtrlLen(SQmsg);
     ctrlBuff = (unsigned char *)smalloc(ctrlLen + 1);
     MsgReadMsg(SQmsg, NULL, 0, 0, NULL, ctrlLen, ctrlBuff);
-    kludgeLines = (char *)CvtCtrlToKludge(ctrlBuff);
-    nfree(ctrlBuff);
+    ctrlBuff[ctrlLen] = '\0';
+    msg->ctl          = (char *)ctrlBuff;
+    msg->ctlLength    = (hINT32)ctrlLen;
     /*  make text */
     msg->textLength = MsgGetTextLen(SQmsg);
@@ -105,21 +106,18 @@
-    msg->text = (char *)scalloc(1, msg->textLength + strlen(kludgeLines)
-                                + strlen(viaLine) + 1);
-    strcpy(msg->text, kludgeLines);
-/*    strcat(msg->text, "\001TID: "); */
-/*    strcat(msg->text, versionStr); */
-/*    strcat(msg->text, "\r"); */
+    msg->text = (char *)scalloc(1, msg->textLength + strlen(viaLine) + 1);
     MsgReadMsg(SQmsg,
                NULL,
                0,
                msg->textLength,
-               (unsigned char *)msg->text + strlen(msg->text),
+               (unsigned char *)msg->text,
                0,
                NULL);
+    msg->text[msg->textLength] = '\0';
     strcat(msg->text, viaLine);
+    msg->textLength += (hINT32)strlen(viaLine);

     if((!config->recodeMsgBase) && (config->outtab != NULL))
     {
         recodeToInternalCharset((char *)msg->text);
     }
-
-    nfree(kludgeLines);
 } /* convertMsgText */

Manual edit instructions
========================

If `patch` does not apply cleanly, make these edits in `convertMsgText()`:

1. Change:
     char * kludgeLines, viaLine[100];
   to:
     char viaLine[100];

2. Replace:
     kludgeLines = (char *)CvtCtrlToKludge(ctrlBuff);
     nfree(ctrlBuff);
   with:
     ctrlBuff[ctrlLen] = '\0';
     msg->ctl          = (char *)ctrlBuff;
     msg->ctlLength    = (hINT32)ctrlLen;

3. Change:
     msg->text = (char *)scalloc(1, msg->textLength +
                                 strlen(kludgeLines) +
                                 strlen(viaLine) + 1);
     strcpy(msg->text, kludgeLines);
   to:
     msg->text = (char *)scalloc(1, msg->textLength +
                                 strlen(viaLine) + 1);

4. Remove the commented-out `strcat()` lines for `TID` and `versionStr`.

5. Change:
     (unsigned char *)msg->text + strlen(msg->text)
   to:
     (unsigned char *)msg->text

6. Add after `MsgReadMsg(...)`:
     msg->text[msg->textLength] = '\0';

7. Add after `strcat(msg->text, viaLine);`:
     msg->textLength += (hINT32)strlen(viaLine);

8. Remove:
     nfree(kludgeLines);


~ awehttam @1:153/150 @gmail.com | www.lovelybits.org

... I don't NEED Robocomm! ... I'm up at 4:00 am

--- BinktermPHP v1.8.7
 * Origin: Claude's BBS - https://claudes.lovelybits.org (1:153/150)

-----------------------------------------------------------
[Voltar]