summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/lrstanley
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/lrstanley')
-rw-r--r--vendor/github.com/lrstanley/girc/commands.go3
-rw-r--r--vendor/github.com/lrstanley/girc/event.go15
2 files changed, 13 insertions, 5 deletions
diff --git a/vendor/github.com/lrstanley/girc/commands.go b/vendor/github.com/lrstanley/girc/commands.go
index 9538cedc..2ee0a23a 100644
--- a/vendor/github.com/lrstanley/girc/commands.go
+++ b/vendor/github.com/lrstanley/girc/commands.go
@@ -5,6 +5,7 @@
package girc
import (
+ "strconv"
"errors"
"fmt"
)
@@ -356,7 +357,7 @@ func (cmd *Commands) List(channels ...string) {
// Whowas sends a WHOWAS query to the server. amount is the amount of results
// you want back.
func (cmd *Commands) Whowas(user string, amount int) {
- cmd.c.Send(&Event{Command: WHOWAS, Params: []string{user, string(amount)}})
+ cmd.c.Send(&Event{Command: WHOWAS, Params: []string{user, strconv.Itoa(amount)}})
}
// Monitor sends a MONITOR query to the server. The results of the query
diff --git a/vendor/github.com/lrstanley/girc/event.go b/vendor/github.com/lrstanley/girc/event.go
index ef4633f7..423e452b 100644
--- a/vendor/github.com/lrstanley/girc/event.go
+++ b/vendor/github.com/lrstanley/girc/event.go
@@ -248,7 +248,7 @@ func (e *Event) Len() (length int) {
// If param contains a space or it's empty, it's trailing, so it should be
// prefixed with a colon (:).
- if i == len(e.Params)-1 && (strings.Contains(e.Params[i], " ") || e.Params[i] == "") {
+ if i == len(e.Params)-1 && (strings.Contains(e.Params[i], " ") || strings.HasPrefix(e.Params[i], ":") || e.Params[i] == "") {
length++
}
}
@@ -284,9 +284,8 @@ func (e *Event) Bytes() []byte {
// Space separated list of arguments.
if len(e.Params) > 0 {
// buffer.WriteByte(eventSpace)
-
for i := 0; i < len(e.Params); i++ {
- if i == len(e.Params)-1 && (strings.Contains(e.Params[i], " ") || e.Params[i] == "") {
+ if i == len(e.Params)-1 && (strings.Contains(e.Params[i], " ") || strings.HasPrefix(e.Params[i], ":") || e.Params[i] == "") {
buffer.WriteString(string(eventSpace) + string(messagePrefix) + e.Params[i])
continue
}
@@ -363,7 +362,15 @@ func (e *Event) Pretty() (out string, ok bool) {
return fmt.Sprintf("[*] CTCP query from %s: %s%s", ctcp.Source.Name, ctcp.Command, " "+ctcp.Text), true
}
- return fmt.Sprintf("[%s] (%s) %s", strings.Join(e.Params[0:len(e.Params)-1], ","), e.Source.Name, e.Last()), true
+
+ var source string
+ if e.Command == PRIVMSG {
+ source = fmt.Sprintf("(%s)", e.Source.Name)
+ } else { // NOTICE
+ source = fmt.Sprintf("--%s--", e.Source.Name)
+ }
+
+ return fmt.Sprintf("[%s] %s %s", strings.Join(e.Params[0:len(e.Params)-1], ","), source, e.Last()), true
}
if e.Command == RPL_MOTD || e.Command == RPL_MOTDSTART ||