Slice the params instead of building a new channel slice in the PART handler

This commit is contained in:
Ken-Håvard Lieng 2016-12-16 23:17:15 +01:00
parent 29fad58252
commit cf759883aa

View File

@ -84,18 +84,11 @@ func (i *ircHandler) join(msg *irc.Message) {
} }
func (i *ircHandler) part(msg *irc.Message) { func (i *ircHandler) part(msg *irc.Message) {
var chans []string
for i, param := range msg.Params {
if i != len(msg.Params)-1 {
chans = append(chans, param)
}
}
i.session.sendJSON("part", Part{ i.session.sendJSON("part", Part{
Join: Join{ Join: Join{
Server: i.client.Host, Server: i.client.Host,
User: msg.Nick, User: msg.Nick,
Channels: chans, Channels: msg.Params[:len(msg.Params)-1],
}, },
Reason: msg.Params[len(msg.Params)-1], Reason: msg.Params[len(msg.Params)-1],
}) })