another fix to bobbit's IRC maximum message length#82
another fix to bobbit's IRC maximum message length#82antithalian wants to merge 2 commits intopbui:bobbit-0.2.xfrom
Conversation
…messages previously, we used len(message)/len(command) to determine when to wrap, but that doesn't necessarily correlate to the number of bytes, which is what the IRC spec cares about
IRC messages can be at most 512 bytes, including the sender's hostmask determining the hostmask 100% accurately before sending each message is hard, so setting a conservative max length makes the most sense
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## bobbit-0.2.x #82 +/- ##
=============================================
Coverage 52.83% 52.83%
=============================================
Files 21 21
Lines 810 810
=============================================
Hits 428 428
Misses 382 382 ☔ View full report in Codecov by Sentry. |
|
Note to self: possibly a longer term fix to this would be to discover the hostmask length at session start and then add a new handler for hostmask update messages I think IRC servers send those when the hostmask is changed, so... |
|
Note on the note to self: You need to request capabilities in order to get change host messages, so bobbit would need to start doing that and handling the case where the capabilities aren't granted He'd then need a handler for |
maximum length includes hostmask too, which means that messages were still being cut off despite checking that
command + body + CRNLwas <= 512 bytesthe hostmask can change at any time due to operator or service actions, so the most robust fix is setting a conservative maximum length rather than trying to keep an accurate idea of what the bot's hostmask is