kunt

golang IRC bot
git clone git://git.2f30.org/kunt
Log | Files | Refs | LICENSE

commit 31592979b7d063f3255d1d34f936b8ee5425d291
parent ecaf60dcb1fdf4df73e9ac41a20cfdf800cd5e05
Author: sin <sin@2f30.org>
Date:   Fri, 10 May 2013 15:23:20 +0100

move validNick() to utils.go

Diffstat:
Msrc/irc/message.go | 16----------------
Msrc/irc/utils.go | 16++++++++++++++++
2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/irc/message.go b/src/irc/message.go @@ -7,7 +7,6 @@ package irc import ( "fmt" "strings" - "unicode" ) type Message struct { @@ -116,21 +115,6 @@ func (i *Context) Topic(channel string, text string) { i.outgoingMsg <- msg } -func validNick(n string) bool { - for i, _ := range n { - c := n[i] - if !unicode.IsLetter(rune(c)) && - !unicode.IsDigit(rune(c)) { - switch c { - case '[', ']', '\\', '`', '_', '^', '{', '|', '}', '-': - default: - return false - } - } - } - return true -} - func (i *Context) ParseRawMessage(raw string) (*Message, error) { var msg Message msg.Raw = raw diff --git a/src/irc/utils.go b/src/irc/utils.go @@ -6,6 +6,7 @@ package irc import ( "crypto/tls" + "unicode" ) func loadCerts() (*tls.Config, error) { @@ -19,3 +20,18 @@ func loadCerts() (*tls.Config, error) { InsecureSkipVerify: true, }, nil } + +func validNick(n string) bool { + for i, _ := range n { + c := n[i] + if !unicode.IsLetter(rune(c)) && + !unicode.IsDigit(rune(c)) { + switch c { + case '[', ']', '\\', '`', '_', '^', '{', '|', '}', '-': + default: + return false + } + } + } + return true +}