Skip to content

Commit

Permalink
Fix the IRC notification plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
AmandaCameron committed Dec 13, 2014
1 parent fc881ba commit 1236d44
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions plugin/notify/irc/irc.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,23 @@ func (i *IRC) sendSuccess(req *model.Request) error {
// to the connected IRC client
func (i *IRC) send(channel string, message string) error {
client := irc.IRC(i.Nick, i.Nick)
if client != nil {

if client == nil {
return fmt.Errorf("Error creating IRC client")
}
defer client.Disconnect()
client.Connect(i.Server)
client.Notice(channel, message)

err := client.Connect(i.Server)

if err != nil {
return fmt.Errorf("Error connecting to IRC server: %v", err)
}

client.AddCallback("001", func(_ *irc.Event) {
client.Notice(channel, message)
client.Disconnect()
})

go client.Loop()

return nil
}

0 comments on commit 1236d44

Please sign in to comment.