summaryrefslogtreecommitdiff
path: root/xmpp/encoder_decoder.go
AgeCommit message (Collapse)Author
2023-07-03Rename encoder_decoder.go to xml.goxengineering
This is way shorter and serves the same purpose: It reflects the responsibility of encoding and decoding XML. The encoderDecoder struct should be removed soon.
2023-07-01Drop xml.{ProcInst,Directive,Comment}xengineering
LimoX does not care about these XML tokens at least for now. The issued error messages on other levels. Dropping those tokens on the encoderDecoder level asserts that the rest of the xmpp code has only `clean` XML content to process.
2023-07-01Improve prefix and disable indentxengineering
The prefix has now more visual contrast to the XML content due to its own bracket style. Furthermore the indent for the TX stream was disabled. Indent is a nice thing but it just makes sense if both streams are indented identically. Since the RX stream received from the current development server has no indent and also no newlines it is better to turn it of completely. This might change in the future with structured logging (with the new slog package) or command line flags to toggle this behaviour. Re-encoding of the RX stream could also be an option but should stay one because it alters the RX stream and might hide errors during debugging.
2023-07-01Add log module based XML logging with prefixxengineering
The prefix is re-implemented with this commit to distinguish between RX and TX XML. Furthermore the logging is now based on the log module to have the same (e.g. timestamp) prefix as other log messages.
2023-07-01Implement byte-based logging for RXxengineering
This commit uses an io.TeeReader to achieve the same goal for RX like in the previous commit for TX.
2023-07-01Implement byte-based logging for TXxengineering
Using an io.MultiWriter it is trivially possible to write encoded tokens to the TCP channel aswell as to stdout. The disadvantage is that it is not possible to inject prefix data like the so far used `C: ` only for stdout and not for the TCP channel. Such a prefix is not wanted in the TCP channel and thus not wanted for both. The solution to get a nice log is to implement a transparent logging middleware which gets the raw TX stream and inserts a prefix at each line before sending to stdout.
2023-06-27Apply go fmtxengineering
2023-06-16Add chan xml.Token xmpp.session.rxxengineering
This allows the goroutine which fetches all tokens from the server to forward them to the main goroutine of the session.
2023-06-05Re-implement XML decodingxengineering
2023-06-05Re-implement XML encodingxengineering
2023-06-04Implement dummy XML encoder and decoderxengineering