remove separation between CAP and regular tracking
This commit is contained in:
parent
54acd5fb7e
commit
fa20cdac87
12
builtin.go
12
builtin.go
@ -54,13 +54,11 @@ func (c *Client) registerBuiltins() {
|
|||||||
c.Handlers.register(true, KICK, HandlerFunc(updateLastActive))
|
c.Handlers.register(true, KICK, HandlerFunc(updateLastActive))
|
||||||
|
|
||||||
// CAP IRCv3-specific tracking and functionality.
|
// CAP IRCv3-specific tracking and functionality.
|
||||||
if !c.Config.disableCapTracking {
|
c.Handlers.register(true, CAP, HandlerFunc(handleCAP))
|
||||||
c.Handlers.register(true, CAP, HandlerFunc(handleCAP))
|
c.Handlers.register(true, CAP_CHGHOST, HandlerFunc(handleCHGHOST))
|
||||||
c.Handlers.register(true, CAP_CHGHOST, HandlerFunc(handleCHGHOST))
|
c.Handlers.register(true, CAP_AWAY, HandlerFunc(handleAWAY))
|
||||||
c.Handlers.register(true, CAP_AWAY, HandlerFunc(handleAWAY))
|
c.Handlers.register(true, CAP_ACCOUNT, HandlerFunc(handleACCOUNT))
|
||||||
c.Handlers.register(true, CAP_ACCOUNT, HandlerFunc(handleACCOUNT))
|
c.Handlers.register(true, ALLEVENTS, HandlerFunc(handleTags))
|
||||||
c.Handlers.register(true, ALLEVENTS, HandlerFunc(handleTags))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nickname collisions.
|
// Nickname collisions.
|
||||||
|
2
cap.go
2
cap.go
@ -25,7 +25,7 @@ var possibleCap = map[string][]string{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) listCAP() {
|
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"}})
|
c.write(&Event{Command: CAP, Params: []string{CAP_LS, "302"}})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
23
client.go
23
client.go
@ -156,11 +156,6 @@ type Config struct {
|
|||||||
// disableTracking disables all channel and user-level tracking. Useful
|
// disableTracking disables all channel and user-level tracking. Useful
|
||||||
// for highly embedded scripts with single purposes.
|
// for highly embedded scripts with single purposes.
|
||||||
disableTracking bool
|
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
|
// HandleNickCollide when set, allows the client to handle nick collisions
|
||||||
// in a custom way. If unset, the client will attempt to append a
|
// 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
|
// underscore to the end of the nickname, in order to bypass using
|
||||||
@ -336,24 +331,6 @@ func (c *Client) DisableTracking() {
|
|||||||
c.registerBuiltins()
|
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.
|
// Server returns the string representation of host+port pair for net.Conn.
|
||||||
func (c *Client) Server() string {
|
func (c *Client) Server() string {
|
||||||
return fmt.Sprintf("%s:%d", c.Config.Server, c.Config.Port)
|
return fmt.Sprintf("%s:%d", c.Config.Server, c.Config.Port)
|
||||||
|
Loading…
Reference in New Issue
Block a user