support UserIP2 extension
This commit is contained in:
parent
0adc13ddfa
commit
4415109174
@ -245,7 +245,35 @@ func (this *HubConnection) processProtocolMessage(message string) {
|
||||
}
|
||||
|
||||
case "$UserIP":
|
||||
// TODO
|
||||
this.userLock.Lock()
|
||||
|
||||
pairs := strings.Split(commandParts[1], "$$")
|
||||
notifyOfUpdate := make([]string, 0, len(pairs))
|
||||
|
||||
nextIPPair:
|
||||
for _, pair := range pairs {
|
||||
parts := strings.SplitN(pair, " ", 2)
|
||||
ip2nick := parts[0]
|
||||
ip2addr := parts[1]
|
||||
|
||||
uinfo, ok := this.users[ip2nick]
|
||||
if !ok {
|
||||
this.processEvent(HubEvent{EventType: EVENT_DEBUG_MESSAGE, Message: "Recieved IP '" + ip2addr + "' for unknown user '" + ip2nick + "'"})
|
||||
continue nextIPPair
|
||||
}
|
||||
|
||||
if uinfo.IPAddress != ip2addr {
|
||||
uinfo.IPAddress = ip2addr
|
||||
notifyOfUpdate = append(notifyOfUpdate, ip2nick)
|
||||
this.users[ip2nick] = uinfo
|
||||
}
|
||||
}
|
||||
|
||||
this.userLock.Unlock()
|
||||
|
||||
for _, nick := range notifyOfUpdate {
|
||||
this.processEvent(HubEvent{EventType: EVENT_USER_UPDATED_INFO, Nick: nick})
|
||||
}
|
||||
|
||||
case "$ForceMove":
|
||||
this.Hco.Address = HubAddress(commandParts[1])
|
||||
|
@ -24,6 +24,7 @@ type UserInfo struct {
|
||||
HubsRegistered uint64
|
||||
HubsOperator uint64
|
||||
IsOperator bool
|
||||
IPAddress string
|
||||
}
|
||||
|
||||
var rx_myinfo *regexp.Regexp
|
||||
|
Loading…
Reference in New Issue
Block a user