From 6e66c5c8a7712d0f240ad1ac221485cb164540bd Mon Sep 17 00:00:00 2001 From: Daniel Oaks Date: Sun, 14 Aug 2016 13:34:24 +1000 Subject: [PATCH] channel: Prevent duping error code in channel.Persist -- from jlatt/ergonomadic#39 <3 --- irc/channel.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/irc/channel.go b/irc/channel.go index b2c2dec1..6eb6cd6e 100644 --- a/irc/channel.go +++ b/irc/channel.go @@ -278,9 +278,7 @@ func (channel *Channel) SetTopic(client *Client, topic string) { member.Send(nil, client.nickMaskString, "TOPIC", channel.nameString, channel.topic) } - if err := channel.Persist(); err != nil { - log.Println("Channel.Persist:", channel, err) - } + channel.Persist() } func (channel *Channel) CanSpeak(client *Client) bool { @@ -437,6 +435,11 @@ func (channel *Channel) Persist() (err error) { _, err = channel.server.db.Exec(` DELETE FROM channel WHERE name = ?`, channel.name.String()) } + + if err != nil { + Log.error.Println("Channel.Persist:", channel, err) + } + return } @@ -495,9 +498,7 @@ func (channel *Channel) Invite(invitee *Client, inviter *Client) { if channel.flags[InviteOnly] { channel.lists[InviteMask].Add(invitee.UserHost()) - if err := channel.Persist(); err != nil { - log.Println("Channel.Persist:", channel, err) - } + channel.Persist() } //TODO(dan): should inviter.server.nameString here be inviter.nickMaskString ?