From 531b59bf953ad6c1fb7adfb6554dcc412fbe47e5 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Mon, 17 Feb 2020 19:02:00 +0100 Subject: Logging --- connector/irc/irc.go | 6 +++--- connector/xmpp/xmpp.go | 16 +++++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'connector') diff --git a/connector/irc/irc.go b/connector/irc/irc.go index a57a2e2..ccbd803 100644 --- a/connector/irc/irc.go +++ b/connector/irc/irc.go @@ -126,15 +126,15 @@ func (irc *IRC) SetRoomInfo(roomId RoomID, info *RoomInfo) error { return err } + if info.Topic != "" { + irc.conn.Cmd.Topic(ch, info.Topic) + } if info.Name != "" && info.Name != ch { return fmt.Errorf("May not change IRC room name to other than %s", ch) } if info.Picture != nil { return fmt.Errorf("Room picture not supported on IRC") } - if info.Topic != "" { - irc.conn.Cmd.Topic(ch, info.Topic) - } return nil } diff --git a/connector/xmpp/xmpp.go b/connector/xmpp/xmpp.go index e50bb58..caeb993 100644 --- a/connector/xmpp/xmpp.go +++ b/connector/xmpp/xmpp.go @@ -249,7 +249,6 @@ func (xm *XMPP) handleXMPP() error { DisplayName: remote[1], }) } - // Do nothing. } } } @@ -264,11 +263,14 @@ func (xm *XMPP) SetUserInfo(info *UserInfo) error { func (xm *XMPP) SetRoomInfo(roomId RoomID, info *RoomInfo) error { if info.Topic != "" { - xm.conn.Send(gxmpp.Chat{ + _, err := xm.conn.Send(gxmpp.Chat{ Type: "groupchat", Remote: string(roomId), Subject: info.Topic, }) + if err != nil { + return err + } } if info.Picture != nil { @@ -297,25 +299,25 @@ func (xm *XMPP) Invite(userId UserID, roomId RoomID) error { } func (xm *XMPP) Leave(roomId RoomID) { - // TODO + xm.conn.LeaveMUC(string(roomId)) } func (xm *XMPP) Send(event *Event) error { fmt.Printf("xm *XMPP Send %#v\n", event) if len(event.Recipient) > 0 { - xm.conn.Send(gxmpp.Chat{ + _, err := xm.conn.Send(gxmpp.Chat{ Type: "chat", Remote: string(event.Recipient), Text: event.Text, }) - return nil + return err } else if len(event.Room) > 0 { - xm.conn.Send(gxmpp.Chat{ + _, err := xm.conn.Send(gxmpp.Chat{ Type: "groupchat", Remote: string(event.Room), Text: event.Text, }) - return nil + return err } else { return fmt.Errorf("Invalid event") } -- cgit v1.2.3