feat: remove parted channel from tab bar

This commit is contained in:
2022-01-24 08:52:06 +02:00
parent 92d6449e46
commit 4ba51b7f8d
+9
View File
@@ -131,10 +131,19 @@ func handlePart(msg parser.IRCMessage, client *irc.Client) {
for i, c := range client.Channels {
if c.Name == channel {
if nick == client.Nickname {
client.Channels = append(client.Channels[:i], client.Channels[i+1:]...)
if client.ActiveChannelIndex >= i {
client.ActiveChannelIndex--
client.ActiveChannel = client.Channels[client.ActiveChannelIndex].Name
}
client.LastTabIndexInTabBar--
} else {
client.Channels[i].History += partMsg + irc.CRLF
delete(client.Channels[i].Users, nick)
}
}
}
client.Tea.Send(cmds.SwitchChannels())
}