From 584312f30805680711557ff6fbe291d2404367fb Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Mon, 17 Feb 2020 15:30:01 +0100 Subject: Correctly update room topics (works on irc) --- connector/xmpp/xmpp.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'connector/xmpp/xmpp.go') 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") } -- cgit v1.2.3