1
0
Fork 0
mirror of https://github.com/fluffle/goirc synced 2025-09-06 00:43:20 +00:00

Slight fixes to NewChannel and tests for st's Channel methods.

This commit is contained in:
Alex Bramley 2011-10-13 22:31:09 +01:00
parent 9163b9af7a
commit 6266eba245
2 changed files with 81 additions and 0 deletions

View file

@ -88,6 +88,10 @@ func (st *stateTracker) DelNick(n string) {
// Creates a new Channel, initialises it, and stores it so it
// can be properly tracked for state management purposes.
func (st *stateTracker) NewChannel(c string) *Channel {
if _, ok := st.chans[c]; ok {
logging.Warn("StateTracker.NewChannel(): %s already tracked", c)
return nil
}
ch := &Channel{Name: c, st: st}
ch.initialise()
st.chans[c] = ch