3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-23 03:02:48 +01:00

channel: Prevent duping error code in channel.Persist -- from jlatt/ergonomadic#39 <3

This commit is contained in:
Daniel Oaks 2016-08-14 13:34:24 +10:00
parent 154809dd60
commit 6e66c5c8a7

View File

@ -278,9 +278,7 @@ func (channel *Channel) SetTopic(client *Client, topic string) {
member.Send(nil, client.nickMaskString, "TOPIC", channel.nameString, channel.topic) member.Send(nil, client.nickMaskString, "TOPIC", channel.nameString, channel.topic)
} }
if err := channel.Persist(); err != nil { channel.Persist()
log.Println("Channel.Persist:", channel, err)
}
} }
func (channel *Channel) CanSpeak(client *Client) bool { func (channel *Channel) CanSpeak(client *Client) bool {
@ -437,6 +435,11 @@ func (channel *Channel) Persist() (err error) {
_, err = channel.server.db.Exec(` _, err = channel.server.db.Exec(`
DELETE FROM channel WHERE name = ?`, channel.name.String()) DELETE FROM channel WHERE name = ?`, channel.name.String())
} }
if err != nil {
Log.error.Println("Channel.Persist:", channel, err)
}
return return
} }
@ -495,9 +498,7 @@ func (channel *Channel) Invite(invitee *Client, inviter *Client) {
if channel.flags[InviteOnly] { if channel.flags[InviteOnly] {
channel.lists[InviteMask].Add(invitee.UserHost()) channel.lists[InviteMask].Add(invitee.UserHost())
if err := channel.Persist(); err != nil { channel.Persist()
log.Println("Channel.Persist:", channel, err)
}
} }
//TODO(dan): should inviter.server.nameString here be inviter.nickMaskString ? //TODO(dan): should inviter.server.nameString here be inviter.nickMaskString ?