Example #1
0
func (conn *Conn) EnableStateTracking() {
	if conn.st == nil {
		n := conn.cfg.Me
		conn.st = state.NewTracker(n.Nick)
		conn.cfg.Me = conn.st.Me()
		conn.cfg.Me.Ident = n.Ident
		conn.cfg.Me.Name = n.Name
		conn.addSTHandlers()
	}
}
Example #2
0
func (conn *Conn) EnableStateTracking() {
	if !conn.st {
		n := conn.Me
		conn.ST = state.NewTracker(n.Nick, conn.l)
		conn.Me = conn.ST.Me()
		conn.Me.Ident = n.Ident
		conn.Me.Name = n.Name
		conn.addSTHandlers()
		conn.st = true
	}
}
Example #3
0
// EnableStateTracking causes the client to track information about
// all channels it is joined to, and all the nicks in those channels.
// This can be rather handy for a number of bot-writing tasks. See
// the state package for more details.
//
// NOTE: Calling this while connected to an IRC server may cause the
// state tracker to become very confused all over STDERR if logging
// is enabled. State tracking should enabled before connecting or
// at a pinch while the client is not joined to any channels.
func (conn *Conn) EnableStateTracking() {
	conn.mu.Lock()
	defer conn.mu.Unlock()
	if conn.st == nil {
		n := conn.cfg.Me
		conn.st = state.NewTracker(n.Nick)
		conn.st.NickInfo(n.Nick, n.Ident, n.Host, n.Name)
		conn.cfg.Me = conn.st.Me()
		conn.addSTHandlers()
	}
}