mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-14 07:59:31 +01:00
client: Send quit messages more correctly
This commit is contained in:
parent
2e2e91689a
commit
dc605ebb01
@ -19,10 +19,12 @@ New release of Oragono!
|
|||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* Prevented a DoS related to lots of clients connecting at once.
|
|
||||||
* Removed races around setting and changing `NICK`s, to be more safe.
|
|
||||||
* Fixed crash when using STATUSMSG-like messaging.
|
* Fixed crash when using STATUSMSG-like messaging.
|
||||||
* Fixed crash with gIRC-Go ircmsg library we depend on.
|
* Fixed crash with gIRC-Go ircmsg library we depend on.
|
||||||
|
* Fixed not sending `MODE` changes to all clients in a channel.
|
||||||
|
* Fixed timeout issue with go-ident library we depend on (which caused hangs on connection).
|
||||||
|
* Prevented a DoS related to lots of clients connecting at once.
|
||||||
|
* Removed races around setting and changing `NICK`s, to be more safe.
|
||||||
|
|
||||||
|
|
||||||
## [0.4.0] - 2016-11-03
|
## [0.4.0] - 2016-11-03
|
||||||
|
@ -58,6 +58,7 @@ type Client struct {
|
|||||||
nickMaskCasefolded string
|
nickMaskCasefolded string
|
||||||
operName string
|
operName string
|
||||||
quitTimer *time.Timer
|
quitTimer *time.Timer
|
||||||
|
quitMessageSent bool
|
||||||
realname string
|
realname string
|
||||||
registered bool
|
registered bool
|
||||||
saslInProgress bool
|
saslInProgress bool
|
||||||
@ -378,8 +379,11 @@ func (client *Client) ChangeNickname(nickname string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (client *Client) Quit(message string) {
|
func (client *Client) Quit(message string) {
|
||||||
client.Send(nil, client.nickMaskString, "QUIT", message)
|
if !client.quitMessageSent {
|
||||||
client.Send(nil, client.nickMaskString, "ERROR", message)
|
client.Send(nil, client.nickMaskString, "QUIT", message)
|
||||||
|
client.Send(nil, client.nickMaskString, "ERROR", message)
|
||||||
|
client.quitMessageSent = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// destroy gets rid of a client, removes them from server lists etc.
|
// destroy gets rid of a client, removes them from server lists etc.
|
||||||
@ -388,6 +392,9 @@ func (client *Client) destroy() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// send quit/error message to client if they haven't been sent already
|
||||||
|
client.Quit("Connection closed")
|
||||||
|
|
||||||
client.isDestroyed = true
|
client.isDestroyed = true
|
||||||
client.server.whoWas.Append(client)
|
client.server.whoWas.Append(client)
|
||||||
friends := client.Friends()
|
friends := client.Friends()
|
||||||
@ -416,12 +423,6 @@ func (client *Client) destroy() {
|
|||||||
// remove my monitors
|
// remove my monitors
|
||||||
client.clearMonitorList()
|
client.clearMonitorList()
|
||||||
|
|
||||||
// send quit messages to friends
|
|
||||||
for friend := range client.Friends() {
|
|
||||||
//TODO(dan): store quit message in user, if exists use that instead here
|
|
||||||
friend.Send(nil, client.nickMaskString, "QUIT", "Exited")
|
|
||||||
}
|
|
||||||
|
|
||||||
// clean up channels
|
// clean up channels
|
||||||
for channel := range client.channels {
|
for channel := range client.channels {
|
||||||
channel.Quit(client)
|
channel.Quit(client)
|
||||||
@ -439,6 +440,12 @@ func (client *Client) destroy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
client.socket.Close()
|
client.socket.Close()
|
||||||
|
|
||||||
|
// send quit messages to friends
|
||||||
|
for friend := range friends {
|
||||||
|
//TODO(dan): store quit message in user, if exists use that instead here
|
||||||
|
friend.Send(nil, client.nickMaskString, "QUIT", "Exited")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendFromClient sends an IRC line coming from a specific client.
|
// SendFromClient sends an IRC line coming from a specific client.
|
||||||
|
Loading…
Reference in New Issue
Block a user