42wim/matterircd

Sending ascii art via irc clients

rmzg opened this issue · 7 comments

rmzg commented

Or more usefully, how can I compose a multi-line code block via the irc interface and send it?

42wim commented

Not possible, irc doesn't has something like multiline. You can receive ascii art from slack or mattermost though :)

rmzg commented

Well, yes, but could you fake it in some way?

What if the ircd buffered the input for something like half a second and if it received a new line inside that period it added it to the buffer and reset the timer? Then if you're pasting/outputting lines programatically you would end up with a multiline post when you stopped sending while the buffer delay would be low enough to not be noticeable for just normal interactive chatting.

Note that since irc throtles messages (by default you can only send 1 message per second, the server will just not process your next message) and you don't want to overflow your buffer on the server (servers have a limited receive buffer, and if you fill it up completly, you get disconnected from the ircd) most clients have a rate limiting in how fast they send out messages to the ircd

This means that if you make matterircd wait "like half a second" you will not solve your problem for most clients, as they will never send 2 messages within the same second...

Bitlbee has an option paste_buffer and paste_buffer_delay where it will join messages coming in in short time, also the flodding delay in the clients can be configured (irc.server_default.anti_flood_prio_high for weechat for example).

42wim commented

I've just commited support for this in master.
Matterircd will buffer up to 500ms automatically and combine those messages in 1 message.
So pasting ascii-art (and other stuff) now works.

Some changes I had to do for irssi

/set paste_join_multiline OFF
/set cmd_queue_speed 10msec
/set cmds_max_at_once 50
/set paste_detect_time 0msecs
/set paste_verify_line_count 50
42wim commented

The setting is now user configurable (default it's off)
Set PasteBufferTimeout in the matterircd.toml file

#PasteBufferTimeout specifies the amount of time in milliseconds that
#messages get kept in matterircd internal buffer before being sent to
#mattermost or slack.
#Messageis that will be received in this time will be concatenated together
#So this can be used to paste stuff like ansi-art or code.
#Default 0 (is disabled)
#Depending on how fast you type 2500 is a good number
PasteBufferTimeout = 2500
rmzg commented

You are my hero.