aboutsummaryrefslogtreecommitdiff
path: root/connector/xmpp
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-02-17 19:02:00 +0100
committerAlex Auvolat <alex@adnab.me>2020-02-17 19:02:00 +0100
commit531b59bf953ad6c1fb7adfb6554dcc412fbe47e5 (patch)
tree1aef995d77c3254bc9ad1081d22fa52a0c64aa6f /connector/xmpp
parent86942a34a2aa086dee76c9e4e0b6942848e1b979 (diff)
downloadeasybridge-531b59bf953ad6c1fb7adfb6554dcc412fbe47e5.tar.gz
easybridge-531b59bf953ad6c1fb7adfb6554dcc412fbe47e5.zip
Logging
Diffstat (limited to 'connector/xmpp')
-rw-r--r--connector/xmpp/xmpp.go16
1 files changed, 9 insertions, 7 deletions
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")
}