adc: handle user parts
--HG-- branch : adc
This commit is contained in:
parent
916874e8bd
commit
d392cd379d
@ -229,15 +229,37 @@ func (this *AdcProtocol) ProcessCommand(msg string) {
|
||||
case "IQUI":
|
||||
// Error message from the hub
|
||||
// IQUI V3M6 DI1 MSNick\staken,\splease\spick\sanother\sone TL-1
|
||||
flags, err := this.parts2flags(parts[1:])
|
||||
if len(parts) < 2 {
|
||||
this.malformed(parts)
|
||||
return
|
||||
}
|
||||
|
||||
sid := parts[1]
|
||||
|
||||
flags, err := this.parts2flags(parts[2:])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if sid == this.sid {
|
||||
if msg, ok := flags["MS"]; ok {
|
||||
this.hc.processEvent(HubEvent{EventType: EVENT_SYSTEM_MESSAGE_FROM_HUB, Message: "The hub is closing our connection because: " + this.unescape(msg)})
|
||||
} else {
|
||||
this.hc.processEvent(HubEvent{EventType: EVENT_SYSTEM_MESSAGE_FROM_HUB, Message: "The hub is closing our connection"})
|
||||
}
|
||||
} else {
|
||||
this.hc.usersMut.Lock()
|
||||
defer this.hc.usersMut.Unlock()
|
||||
otherSidNick, ok := this.hc.userSIDs[sid]
|
||||
if ok {
|
||||
delete(this.hc.userSIDs, sid)
|
||||
delete(this.hc.users, otherSidNick)
|
||||
this.hc.processEvent(HubEvent{EventType: EVENT_USER_PART, Nick: otherSidNick})
|
||||
} else {
|
||||
// ??
|
||||
this.logError(fmt.Errorf("An unknown user quit the hub (SID=%s)", sid))
|
||||
}
|
||||
}
|
||||
|
||||
case "BMSG":
|
||||
// Message from a user
|
||||
|
Loading…
Reference in New Issue
Block a user