----------------------------------------------------------------------------------
@MSGID: 1:153/150@fidonet 461AE030
@REPLY: 1:153/150@fidonet 9062B1F4
@CHRS: UTF-8 4
@TZUTC: -0700
@MAILER: BinktermPHP 1.8.7 Linux
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, "
"); */
+ 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)
SEEN-BY: 19/10 50/109 104/117 134/100 153/135 143
148 149 150 151 153 757
SEEN-BY: 153/6809 7715 154/10 218/840 221/1 6 360
280/464 301/1 335/364
SEEN-BY: 341/66 234 342/11 452/28 166 460/58
463/68 5000/111 5010/352 5015/46
SEEN-BY: 5020/715 828 846 848 1042 4441 12000
5030/49 1081 5053/51 5061/133
SEEN-BY: 5075/128 5083/444
@PATH: 153/150 757 221/6 5020/1042 4441