mirror of https://github.com/fluffle/goirc
gofix weekly fixes for state.
This commit is contained in:
parent
0dc19703ab
commit
81eb9ee3df
|
@ -125,8 +125,8 @@ func (ch *Channel) addNick(nk *Nick, cp *ChanPrivs) {
|
|||
// Disassociates a Nick from a Channel.
|
||||
func (ch *Channel) delNick(nk *Nick) {
|
||||
if _, ok := ch.nicks[nk]; ok {
|
||||
ch.nicks[nk] = nil, false
|
||||
ch.lookup[nk.Nick] = nil, false
|
||||
delete(ch.nicks, nk)
|
||||
delete(ch.lookup, nk.Nick)
|
||||
} else {
|
||||
ch.l.Warn("Channel.delNick(): %s not on %s.", nk.Nick, ch.Name)
|
||||
}
|
||||
|
|
|
@ -78,8 +78,8 @@ func (nk *Nick) addChannel(ch *Channel, cp *ChanPrivs) {
|
|||
// Disassociates a Channel from a Nick.
|
||||
func (nk *Nick) delChannel(ch *Channel) {
|
||||
if _, ok := nk.chans[ch]; ok {
|
||||
nk.chans[ch] = nil, false
|
||||
nk.lookup[ch.Name] = nil, false
|
||||
delete(nk.chans, ch)
|
||||
delete(nk.lookup, ch.Name)
|
||||
} else {
|
||||
nk.l.Warn("Nick.delChannel(): %s not on %s.", nk.Nick, ch.Name)
|
||||
}
|
||||
|
|
|
@ -88,12 +88,12 @@ func (st *stateTracker) ReNick(old, neu string) {
|
|||
if nk, ok := st.nicks[old]; ok {
|
||||
if _, ok := st.nicks[neu]; !ok {
|
||||
nk.Nick = neu
|
||||
st.nicks[old] = nil, false
|
||||
delete(st.nicks, old)
|
||||
st.nicks[neu] = nk
|
||||
for ch, _ := range nk.chans {
|
||||
// We also need to update the lookup maps of all the channels
|
||||
// the nick is on, to keep things in sync.
|
||||
ch.lookup[old] = nil, false
|
||||
delete(ch.lookup, old)
|
||||
ch.lookup[neu] = nk
|
||||
}
|
||||
} else {
|
||||
|
@ -123,7 +123,7 @@ func (st *stateTracker) delNick(nk *Nick) {
|
|||
st.l.Error("StateTracker.DelNick(): TRYING TO DELETE ME :-(")
|
||||
return
|
||||
}
|
||||
st.nicks[nk.Nick] = nil, false
|
||||
delete(st.nicks, nk.Nick)
|
||||
for ch, _ := range nk.chans {
|
||||
nk.delChannel(ch)
|
||||
ch.delNick(nk)
|
||||
|
@ -165,7 +165,7 @@ func (st *stateTracker) DelChannel(c string) {
|
|||
}
|
||||
|
||||
func (st *stateTracker) delChannel(ch *Channel) {
|
||||
st.chans[ch.Name] = nil, false
|
||||
delete(st.chans, ch.Name)
|
||||
for nk, _ := range ch.nicks {
|
||||
ch.delNick(nk)
|
||||
nk.delChannel(ch)
|
||||
|
|
Loading…
Reference in New Issue