Fix a bug in splitMessage()

When a newline is present but the total message length is less than maxLength,
the message would not be split at all, and instead be sent with a newline in the message.