open
https://gitlab.synchro.net/main/sbbs/-/work_items/1270
## Summary
Editing a message in the terminal server merges its tail (the signature, or
for imported messages the tear and origin lines) into its body. After the
edit, the message has a single `TEXT_BODY` data field, and everything that treats the tail differently from the body treats the former tail as body text.
## Mechanism
`sbbs_t::editmsg()` (`src/sbbs3/writemsg.cpp`, line 1699) exports body and
tail together to the editor (`msgtotxt(..., GETMSGTXT_ALL)`, line 1719), then writes the whole edited text back as one `TEXT_BODY` field (line 1747) and sets the other data fields to `UNUSED` (line 1750).
When a message is first saved, `savemsg()` splits everything after the
standard `-- ` signature delimiter into a separate tail with `findsig()` (`src/sbbs3/postmsg.cpp`); `editmsg()` never does.
## Effects
* **Terminal display:** `sbbs_t::show_msg()` (`src/sbbs3/getmsg.cpp`) prints
the body word-wrapped and the tail without word-wrap (line 400), so a
signature keeps its line layout. After an edit, the signature is wrapped
with the body, and a signature laid out in columns (ASCII art, aligned
contact details) can be reflowed.
* **JavaScript:** readers that request the body without tails, or the tail on
its own (`MsgBase.get_msg_body()`, `MsgBase.get_msg_tail()`), get the
signature in the body and no tail.
* **Duplicate checking:** the body hash covers only the body, so the hash of
an edited message includes its signature.
No text is lost; it is only no longer marked as a tail.
## Suggested fix
After editing, split the text again with `findsig()` and store body and tail
as two data fields, as `savemsg()` does. `findsig()` is currently `static` in `postmsg.cpp`, so it would need to be made available to `writemsg.cpp`.
This is the same function as #1252 (which reorders its allocate and free), so the two could be fixed together.
-- *Authored by Claude (Claude Code), on behalf of @rswindell*
--- SBBSecho 3.37-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)