# splitmsg: # Splits a message into 400byte chunks. # Some messages exceed the 512 byte buffer of most ircds, # so here's the solution, this function splits each message # into a list with 400byte chunks (400+channelname+userhost etc). # The message will not be split in words, only between them. proc splitmsg {string} { set buf1 ""; set buf2 [list]; foreach word [split $string] { append buf1 " " $word; if {[string length $buf1]-1 >= 400} { lappend buf2 [string range $buf1 1 end]; set buf1 ""; } } if {$buf1 != ""} { lappend buf2 [string range $buf1 1 end]; } return $buf2; }