+
Skip to content
This repository was archived by the owner on Feb 21, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ const (
prefixHost byte = 0x40 // Hostname
space byte = 0x20 // Separator

cutset string = "\r\n\x20\x00" // Characters to trim from prefixes/messages.

maxLength = 510 // Maximum length is 512 - 2 for the line endings.
)

func cutsetFunc(r rune) bool {
// Characters to trim from prefixes/messages.
return r == '\r' || r == '\n' || r == '\x20' || r == '\x00'
}

// Objects implementing the Sender interface are able to send messages to an IRC server.
//
// As there might be a message queue, it is possible that Send returns a nil
Expand Down Expand Up @@ -155,7 +158,7 @@ type Message struct {
func ParseMessage(raw string) (m *Message) {

// Ignore empty messages.
if raw = strings.Trim(raw, cutset); len(raw) < 2 {
if raw = strings.TrimFunc(raw, cutsetFunc); len(raw) < 2 {
return nil
}

Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载