commit 18d08488f363837609a12ed10e9f6704db60bb02
parent 97382ffb3199268a8ea9ab8114a7e4be776f66c8
Author: sin <sin@2f30.org>
Date: Thu, 2 May 2013 15:28:32 +0100
update irc
Diffstat:
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/irc/irc.go b/src/irc/irc.go
@@ -67,12 +67,12 @@ func NewIrcContext(ircConfig IrcConfig) *IrcContext {
}
}
-//Appends a new channel pointer to intercept rx
+// Appends a new channel pointer to intercept rx
func (i *IrcContext) AddIntercept(a *chan IrcMessage) {
i.intercepts = append(i.intercepts, a)
}
-//Deletes based on pointer equality. caller must hold ref.
+// Deletes based on pointer equality. caller must hold ref.
func (i *IrcContext) DelIntercept(ap *chan IrcMessage) int {
for j := 0; j < len(i.intercepts); j++ {
if ap == i.intercepts[j] {
@@ -137,7 +137,7 @@ func (i *IrcContext) Connect() error {
// Fire off the goroutines now!
go i.incomingMsgLoop()
go i.outgoingMsgLoop()
- go i.rxLoop()
+ go i.readLoop()
i.Nick()
i.User()
@@ -154,7 +154,7 @@ func (i *IrcContext) read(buf []byte) (int, error) {
// This is the actual raw read loop. Here we parse the incoming bytes
// and form messages.
-func (i *IrcContext) rxLoop() error {
+func (i *IrcContext) readLoop() error {
for {
var buf [512]byte
n, err := i.read(buf[0:])
diff --git a/src/irc/message.go b/src/irc/message.go
@@ -83,10 +83,7 @@ func (i *IrcContext) ParseRawMessage(raw string) IrcMessage {
if raw[0] == ':' {
msg.Args = []string{raw[1:]}
} else {
- args := strings.SplitN(raw, " :", 2)
- if len(args) == 2 {
- msg.Args = []string{args[0], args[1]}
- }
+ msg.Args = strings.SplitN(raw, " :", 2)
}
return msg
}