display a system message and disconnect if we're asked for a password but don't have one

This commit is contained in:
mappu 2017-02-05 17:12:59 +13:00
parent 58c1151278
commit 7f898dff32

View File

@ -167,7 +167,14 @@ func (this *HubConnection) processProtocolMessage(message string) {
this.processEvent(HubEvent{EventType: EVENT_SYSTEM_MESSAGE_FROM_CONN, Message: "Incorrect password."})
case "$GetPass":
this.SayRaw("$MyPass " + Escape(this.Hco.NickPassword) + "|")
if len(this.Hco.NickPassword) == 0 {
// We've got a problem. MyPass with no arguments is a syntax error with no message = instant close
// Just drop the connection
this.processEvent(HubEvent{EventType: EVENT_SYSTEM_MESSAGE_FROM_CONN, Message: "This account is passworded."})
this.Disconnect()
} else {
this.SayRaw("$MyPass " + Escape(this.Hco.NickPassword) + "|")
}
case "$Quit":
func() {