Merge pull request #47 from slingamn/fail
add error prints for standard replies
This commit is contained in:
commit
9f8a43331a
@ -25,7 +25,6 @@ Packages:
|
||||
* [**ircevent**](https://godoc.org/github.com/goshuirc/irc-go/ircevent): Work-in-progress client library (fork of [thoj/go-ircevent](https://github.com/thoj/go-ircevent)).
|
||||
* [**gircclient**](https://godoc.org/github.com/goshuirc/irc-go/client): Another work-in-progress client library.
|
||||
* [**ircmap**](https://godoc.org/github.com/goshuirc/irc-go/ircmap): IRC string casefolding.
|
||||
* [**ircmatch**](https://godoc.org/github.com/goshuirc/irc-go/ircmatch): IRC string matching (mostly just a globbing engine).
|
||||
* [**ircutils**](https://godoc.org/github.com/goshuirc/irc-go/ircutils): Useful utility functions and classes that don't fit into their own packages.
|
||||
|
||||
---
|
||||
|
@ -215,6 +215,10 @@ func (irc *Connection) setupCallbacks() {
|
||||
// so they happen before any client-added callbacks
|
||||
irc.addCallback(RPL_ENDOFMOTD, irc.handleRegistration, true, 0)
|
||||
irc.addCallback(ERR_NOMOTD, irc.handleRegistration, true, 0)
|
||||
|
||||
irc.AddCallback("FAIL", irc.handleStandardReplies)
|
||||
irc.AddCallback("WARN", irc.handleStandardReplies)
|
||||
irc.AddCallback("NOTE", irc.handleStandardReplies)
|
||||
}
|
||||
|
||||
func (irc *Connection) handleRplWelcome(e Event) {
|
||||
@ -390,3 +394,12 @@ func splitCAPToken(token string) (name, value string) {
|
||||
return token[:equalIdx], token[equalIdx+1:]
|
||||
}
|
||||
}
|
||||
|
||||
func (irc *Connection) handleStandardReplies(e Event) {
|
||||
// unconditionally print messages for FAIL and WARN;
|
||||
// re. NOTE, if debug is enabled, we print the raw line anyway
|
||||
switch e.Command {
|
||||
case "FAIL", "WARN":
|
||||
irc.Log.Printf("Received error code from server: %s %s\n", e.Command, strings.Join(e.Params, " "))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user