Send nick_fail if the new nick is in use and the padded nick is the same as the old one

This commit is contained in:
Ken-Håvard Lieng 2017-07-03 01:07:55 +02:00
parent 403f7d0942
commit ae6ad0a5b9
2 changed files with 8 additions and 1 deletions

View File

@ -12,6 +12,13 @@ import (
func createNickInUseHandler(i *irc.Client, session *Session) func(string) string {
return func(nick string) string {
newNick := nick + "_"
if newNick == i.GetNick() {
session.sendJSON("nick_fail", NickFail{
Server: i.Host,
})
}
session.printError("Nickname", nick, "is already in use, using", newNick, "instead")
return newNick

View File

@ -371,5 +371,5 @@ func formatIRCError(msg *irc.Message) string {
}
func printMessage(msg *irc.Message, i *irc.Client) {
log.Println(i.GetNick()+":", msg.Prefix, msg.Command, msg.Params, msg.LastParam())
log.Println(i.GetNick()+":", msg.Prefix, msg.Command, msg.Params)
}