Changeset 284 in code for trunk/user.go
- Timestamp:
- May 1, 2020, 1:18:14 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/user.go
r283 r284 151 151 return err 152 152 } 153 prev := net.channels[ch.Name] 153 154 net.channels[ch.Name] = ch 155 156 if prev != nil && prev.Detached != ch.Detached { 157 history := net.history[ch.Name] 158 if ch.Detached { 159 net.user.srv.Logger.Printf("network %q: detaching channel %q", net.GetName(), ch.Name) 160 net.forEachDownstream(func(dc *downstreamConn) { 161 net.offlineClients[dc.clientName] = struct{}{} 162 if history != nil { 163 history.offlineClients[dc.clientName] = history.ring.Cur() 164 } 165 166 dc.SendMessage(&irc.Message{ 167 Prefix: dc.prefix(), 168 Command: "PART", 169 Params: []string{dc.marshalEntity(net, ch.Name), "Detach"}, 170 }) 171 }) 172 } else { 173 net.user.srv.Logger.Printf("network %q: attaching channel %q", net.GetName(), ch.Name) 174 175 var uch *upstreamChannel 176 if net.conn != nil { 177 uch = net.conn.channels[ch.Name] 178 } 179 180 net.forEachDownstream(func(dc *downstreamConn) { 181 dc.SendMessage(&irc.Message{ 182 Prefix: dc.prefix(), 183 Command: "JOIN", 184 Params: []string{dc.marshalEntity(net, ch.Name)}, 185 }) 186 187 if uch != nil { 188 forwardChannel(dc, uch) 189 } 190 191 if history != nil { 192 dc.sendNetworkHistory(net) 193 } 194 }) 195 } 196 } 197 154 198 return nil 155 199 } … … 343 387 344 388 net.offlineClients[dc.clientName] = struct{}{} 345 for _, history := range net.history { 389 for target, history := range net.history { 390 if ch, ok := net.channels[target]; ok && ch.Detached { 391 continue 392 } 346 393 history.offlineClients[dc.clientName] = history.ring.Cur() 347 394 }
Note:
See TracChangeset
for help on using the changeset viewer.