diff --git a/ircevent/irc.go b/ircevent/irc.go index 1b4ac5c..ac3a34c 100644 --- a/ircevent/irc.go +++ b/ircevent/irc.go @@ -351,7 +351,7 @@ func (irc *Connection) sendInternal(b []byte) (err error) { // Send a built ircmsg.Message. func (irc *Connection) SendIRCMessage(msg ircmsg.Message) error { b, err := msg.LineBytesStrict(true, irc.MaxLineLen) - if err != nil { + if err != nil && !(irc.AllowTruncation && err == ircmsg.ErrorBodyTooLong) { if irc.Debug { irc.Log.Printf("couldn't assemble message: %v\n", err) } diff --git a/ircevent/irc_struct.go b/ircevent/irc_struct.go index 5c0a238..c0ecdfe 100644 --- a/ircevent/irc_struct.go +++ b/ircevent/irc_struct.go @@ -41,28 +41,29 @@ type capResult struct { type Connection struct { // config data, user-settable - Server string - TLSConfig *tls.Config - Nick string - User string - RealName string // IRC realname/gecos - WebIRC []string // parameters for the WEBIRC command - Password string // server password (PASS command) - RequestCaps []string // IRCv3 capabilities to request (failure is non-fatal) - SASLLogin string // SASL credentials to log in with (failure is fatal) - SASLPassword string - SASLMech string - QuitMessage string - Version string - Timeout time.Duration - KeepAlive time.Duration - ReconnectFreq time.Duration - MaxLineLen int // maximum line length, not including tags - UseTLS bool - UseSASL bool - EnableCTCP bool - Debug bool - AllowPanic bool // if set, don't recover() from panics in callbacks + Server string + TLSConfig *tls.Config + Nick string + User string + RealName string // IRC realname/gecos + WebIRC []string // parameters for the WEBIRC command + Password string // server password (PASS command) + RequestCaps []string // IRCv3 capabilities to request (failure is non-fatal) + SASLLogin string // SASL credentials to log in with (failure is fatal) + SASLPassword string + SASLMech string + QuitMessage string + Version string + Timeout time.Duration + KeepAlive time.Duration + ReconnectFreq time.Duration + MaxLineLen int // maximum line length, not including tags + UseTLS bool + UseSASL bool + EnableCTCP bool + Debug bool + AllowPanic bool // if set, don't recover() from panics in callbacks + AllowTruncation bool // if set, truncate lines exceeding MaxLineLen and send them // networking and synchronization stateMutex sync.Mutex // innermost mutex: don't block while holding this