diff options
author | Alex Auvolat <alex@adnab.me> | 2020-02-17 15:30:01 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-02-17 15:30:01 +0100 |
commit | 584312f30805680711557ff6fbe291d2404367fb (patch) | |
tree | c1d7993200ad500003026b77b79f234d79a01981 /connector/xmpp | |
parent | c740f76826c0291005111c8554c256e8f491e7b9 (diff) | |
download | easybridge-584312f30805680711557ff6fbe291d2404367fb.tar.gz easybridge-584312f30805680711557ff6fbe291d2404367fb.zip |
Correctly update room topics (works on irc)
Diffstat (limited to 'connector/xmpp')
-rw-r--r-- | connector/xmpp/xmpp.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/connector/xmpp/xmpp.go b/connector/xmpp/xmpp.go index 5b1c71a..7516ebc 100644 --- a/connector/xmpp/xmpp.go +++ b/connector/xmpp/xmpp.go @@ -183,12 +183,19 @@ func (xm *XMPP) handleXMPP() error { case gxmpp.Chat: log.Printf("== Receiving %#v\n", v) - if v.Text == "" && v.Type == "groupchat" && !strings.Contains(v.Remote, "/") { + if v.Text == "" && v.Type == "groupchat" { // Empty message when we joined group chat - xm.handler.Joined(RoomID(v.Remote)) + if !strings.Contains(v.Remote, "/") { + xm.handler.Joined(RoomID(v.Remote)) + } if v.Subject != "" { - xm.handler.RoomInfoUpdated(RoomID(v.Remote), &RoomInfo{ - Description: v.Subject, + author := UserID("") + remote_sp := strings.Split(v.Remote, "/") + if len(remote_sp) == 2 { + author = UserID(remote_sp[1] + "@" + remote_sp[0]) + } + xm.handler.RoomInfoUpdated(RoomID(v.Remote), author, &RoomInfo{ + Topic: v.Subject, }) } continue @@ -253,7 +260,6 @@ func (xm *XMPP) User() UserID { } func (xm *XMPP) SetUserInfo(info *UserInfo) error { - //TODO return fmt.Errorf("Not implemented") } |