diff options
Diffstat (limited to 'connector/irc')
-rw-r--r-- | connector/irc/irc.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/connector/irc/irc.go b/connector/irc/irc.go index dafe9db..4e5f4fd 100644 --- a/connector/irc/irc.go +++ b/connector/irc/irc.go @@ -198,9 +198,9 @@ func (irc *IRC) Leave(roomId RoomID) { irc.conn.Cmd.Part(ch) } -func (irc *IRC) Send(event *Event) error { +func (irc *IRC) Send(event *Event) (string, error) { if irc.conn == nil { - return fmt.Errorf("Not connected") + return "", fmt.Errorf("Not connected") } // Workaround girc bug @@ -212,17 +212,17 @@ func (irc *IRC) Send(event *Event) error { if event.Room != "" { ch, err := irc.checkRoomId(event.Room) if err != nil { - return err + return "", err } dest = ch } else if event.Recipient != "" { ui, err := irc.checkUserId(event.Recipient) if err != nil { - return err + return "", err } dest = ui } else { - return fmt.Errorf("Invalid target") + return "", fmt.Errorf("Invalid target") } if event.Attachments != nil && len(event.Attachments) > 0 { @@ -230,7 +230,7 @@ func (irc *IRC) Send(event *Event) error { url := at.URL() if url == "" { // TODO find a way to send them using some hosing of some kind - return fmt.Errorf("Attachment without URL sent to IRC") + return "", fmt.Errorf("Attachment without URL sent to IRC") } else { irc.conn.Cmd.Message(dest, fmt.Sprintf("%s (%s, %dkb)", url, at.Mimetype(), at.Size()/1024)) @@ -243,9 +243,9 @@ func (irc *IRC) Send(event *Event) error { } else if event.Type == EVENT_ACTION { irc.conn.Cmd.Action(dest, event.Text) } else { - return fmt.Errorf("Invalid event type") + return "", fmt.Errorf("Invalid event type") } - return nil + return "", nil } func (irc *IRC) Close() { |