Open tecknojock opened 8 years ago
Couldn't test it out myself since both irssi and xchat seem to split messages on \n, but 2d27e5e should fix you problem. Could you please confirm that for me?
You have to enable the "paste_buffer" option and then Bitlbee will concatenate all messages received within 200 ms of the first. But sure, I'll test
Well the messages send properly and no longer error out...but after seeing the output, it might be better if the /n is converted to a space. It runs the lines together.
Thanks again.
Makes sense, c4f3426 does that.
Thanks~ Great fix. I think this can be closed.
It seems perhaps that discord allows new lines now, so perhaps this concatting is no longer needed?
Hmm I've tried messing with this, and despite discord allowing mutliline, neither removing this stripping of /r/n, nor making it only strip /r seems to still result in a failure to send a message.
hi, not sure the support status of bitlbee-discord, so just posting here in case this helps anyone. It seems the problem is that the replacement string needs to be escaped properly as well. That is, in c4f3426, the " "
should be "\\r\\n"
. (Seeing how the tab is escaped above was the clue.) That seems to fix things for me and I can use paste_buffer
with no problems. Sorry for the spam.
Hey there, @lethal-click. The support status is "maintenance only" but I'd be glad to merge this if you can create a pull-request with your changes and we can ask someone (like @tecknojock) to test it out.
hey, sorry, but I don't have Git or anything like that installed. I literally just hacked the change in and recompiled locally. I only posted in the hope that anyone else with the same problem would find this handy (much gratitude to you @sm00th for making bitlbee-discord in the first place).
the diff is literally just the following on the tip of master:
363c363,364
< nmsg = g_regex_replace_literal(escregex, emsg, -1, 0, " ", 0, NULL);
---
> nmsg = g_regex_replace_literal(escregex, emsg, -1, 0, "\\r\\n", 0, NULL);
in case someone else is able to submit the pull request.
For small things like this, the web interface is easier.
Either way, submitted per your request. #196
thanks @Alcaro, looks good. Hope someone is able to get some use out of this.
Discord will reject messages sent with new lines, which if you have pastebuffer enabled on bitlbee, when you split it will add in new lines.
Pastebuffer merges multiple messages into one single message when sent within a certain period of time.
Therefore, either new lines should trigger a split into a separate message, or they should just be stripped out altogether.Update: Really the above fix that we did, is more of a jury rig, especially since discord does now support multi-line messages. So, the question becomes, why is discord rejecting multiline messages? Its generating a 400 error, which is a bad request.