remove separation between CAP and regular tracking

This commit is contained in:
Liam Stanley 2017-02-21 00:20:57 -05:00
parent 54acd5fb7e
commit fa20cdac87
3 changed files with 6 additions and 31 deletions

View File

@ -54,13 +54,11 @@ func (c *Client) registerBuiltins() {
c.Handlers.register(true, KICK, HandlerFunc(updateLastActive))
// CAP IRCv3-specific tracking and functionality.
if !c.Config.disableCapTracking {
c.Handlers.register(true, CAP, HandlerFunc(handleCAP))
c.Handlers.register(true, CAP_CHGHOST, HandlerFunc(handleCHGHOST))
c.Handlers.register(true, CAP_AWAY, HandlerFunc(handleAWAY))
c.Handlers.register(true, CAP_ACCOUNT, HandlerFunc(handleACCOUNT))
c.Handlers.register(true, ALLEVENTS, HandlerFunc(handleTags))
}
c.Handlers.register(true, CAP, HandlerFunc(handleCAP))
c.Handlers.register(true, CAP_CHGHOST, HandlerFunc(handleCHGHOST))
c.Handlers.register(true, CAP_AWAY, HandlerFunc(handleAWAY))
c.Handlers.register(true, CAP_ACCOUNT, HandlerFunc(handleACCOUNT))
c.Handlers.register(true, ALLEVENTS, HandlerFunc(handleTags))
}
// Nickname collisions.

2
cap.go
View File

@ -25,7 +25,7 @@ var possibleCap = map[string][]string{
}
func (c *Client) listCAP() {
if !c.Config.disableTracking && !c.Config.disableCapTracking {
if !c.Config.disableTracking {
c.write(&Event{Command: CAP, Params: []string{CAP_LS, "302"}})
}
}

View File

@ -156,11 +156,6 @@ type Config struct {
// disableTracking disables all channel and user-level tracking. Useful
// for highly embedded scripts with single purposes.
disableTracking bool
// disableCapTracking disables all network/server capability tracking.
// This includes determining what feature the IRC server supports, what
// the "NETWORK=" variables are, and other useful stuff. disableTracking
// cannot be enabled if you want to also tracking capabilities.
disableCapTracking bool
// HandleNickCollide when set, allows the client to handle nick collisions
// in a custom way. If unset, the client will attempt to append a
// underscore to the end of the nickname, in order to bypass using
@ -336,24 +331,6 @@ func (c *Client) DisableTracking() {
c.registerBuiltins()
}
// DisableCapTracking disables all network/server capability tracking, and
// clears all internal handlers. This includes determining what feature the
// IRC server supports, what the "NETWORK=" variables are, and other useful
// stuff. DisableTracking() cannot be called if you want to also track
// capabilities.
func (c *Client) DisableCapTracking() {
// No need to mess with internal handlers. That should already be
// handled by the clear in Client.DisableTracking().
if c.Config.disableCapTracking {
return
}
c.debug.Print("disabling CAP tracking")
c.Config.disableCapTracking = true
c.Handlers.clearInternal()
c.registerBuiltins()
}
// Server returns the string representation of host+port pair for net.Conn.
func (c *Client) Server() string {
return fmt.Sprintf("%s:%d", c.Config.Server, c.Config.Port)