42wim / matterbridge

bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API (mattermost not required!)
Apache License 2.0
6.55k stars 617 forks source link

[XMPP <-> Slack] "USERNAME has set the subject to: ..." posted on startup #732

Closed jojosoft closed 5 years ago

jojosoft commented 5 years ago

Environment

Version: 1.13.1 1d39c77

Operating system: Linux 3.16.0-4-amd64 SMP Debian 3.16.51-3 (2017-12-13) x86_64 GNU/Linux

Please describe the expected behavior.

When changing the topic of the XMPP room, the message "USERNAME has set the subject to: ..." is expected to be forwarded only once over the bridge, in this case to a Slack channel.

Please describe the actual behavior.

(Nothing in the logs about this specific problem.) Every time matterbridge is executed, it posts "USERNAME has set the subject to: ..." into the Slack channel, even with the topic set to an empty string. The message does not appear in the XMPP room.

Any steps to reproduce the behavior?

Configure a gateway between an XMPP group chat and a Slack channel.

Please add your configuration file

[slack]
[slack.myslack]
Token="ANONYMIZED"
RemoteNickFormat="ANONYMIZED"

[xmpp.myxmpp]
Server="ANONYMIZED"
SkipTLSVerify=true
#Jid your userid
Jid="ANONYMIZED"
Password="ANONYMIZED"
Muc="ANONYMIZED"
Nick="matterbridge"
RemoteNickFormat="<{NICK}>\n"

[[gateway]]
name="ANONYMIZED"
enable=true
    [[gateway.inout]]
    account="slack.myslack"
    channel="general"

    [[gateway.inout]]
    account="xmpp.myxmpp"
    channel="ANONYMIZED"
42wim commented 5 years ago

Could you post a debug log of this? Run with --debug and change the xmpp topic and paste the output here.

It's fine to paste only the output after [0022] INFO main: Gateway(s) started succesfully. Now relaying messages

jojosoft commented 5 years ago

Okay, the following output comes directly after initialization:

[0000] DEBUG xmpp:         == Receiving xmpp.Chat{Remote:"ANONYMIZED", Type:"groupchat", Text:"matterbridge has set the subject to: ", Subject:"", Thread:"", Ooburl:"", Oobdesc:"", ID:"", ReplaceID:"", Roster:xmpp.Roster(nil), Other:[]string{}, OtherElem:[]xmpp.XMLElement(nil), Stamp:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}}
[0000] DEBUG xmpp:         <= Sending message from  on xmpp.myxmpp to gateway
[0000] DEBUG xmpp:         <= Message is config.Message{Text:"matterbridge has set the subject to: ", Channel:"ANONYMIZED", Username:"", UserID:"ANONYMIZED", Avatar:"", Account:"xmpp.myxmpp", Event:"", Protocol:"", Gateway:"", ParentID:"", Timestamp:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}, ID:"", Extra:map[string][]interface {}(nil)}
[0000] DEBUG gateway:      => Sending config.Message{Text:"matterbridge has set the subject to: ", Channel:"ANONYMIZED", Username:"", UserID:"ANONYMIZED", Avatar:"", Account:"xmpp.myxmpp", Event:"", Protocol:"", Gateway:"ANONYMIZED", ParentID:"", Timestamp:time.Time{wall:0xbf148c2519280bbe, ext:777249995, loc:(*time.Location)(0x19f97e0)}, ID:"", Extra:map[string][]interface {}(nil)} from xmpp.myxmpp (egacoqi) to slack.myslack (testing)                                             
[0000] DEBUG slack:        => Receiving config.Message{Text:"matterbridge has set the subject to: ", Channel:"testing", Username:"ANONYMIZED", UserID:"ANONYMIZED", Avatar:"", Account:"xmpp.myxmpp", Event:"", Protocol:"", Gateway:"ANONYMIZED", ParentID:"", Timestamp:time.Time{wall:0xbf148c2519280bbe, ext:777249995, loc:(*time.Location)(0x19f97e0)}, ID:"", Extra:map[string][]interface {}(nil)}                                                                                  
[0000] DEBUG slack:        == Receiving event &slack.ConnectedEvent{ConnectionCount:0, Info:(*slack.Info)(0xc0004d4790)}          
[0000] DEBUG gateway:      mID slack.myslack: 1550956820.004100                                                                   
[0001] DEBUG slack:        Start listening for Slack messages                                                                     
[0002] DEBUG slack:        getting 16 users                                                                                       
[0003] DEBUG slack:        == Receiving event &slack.HelloEvent{}                                                                 
[0003] DEBUG slack:        Unhandled incoming event: *slack.HelloEvent                                                            
[0003] DEBUG slack:        == Receiving event &slack.MessageEvent{Msg:slack.Msg{Type:"message", Channel:"GGFC84GSH", User:"", Text:"matterbridge has set the subject to: ", Timestamp:"1550956820.004100", ThreadTimestamp:"", IsStarred:false, PinnedTo:[]string(nil), Attachments:[]slack.Attachment{slack.Attachment{Color:"", Fallback:"", CallbackID:"matterbridge_bhori4o91f494t5nrjl0", ID:1, AuthorID:"", AuthorName:"", AuthorSubname:"", AuthorLink:"", AuthorIcon:"", Title:"", TitleLink:"", Pretext:"", Text:"", ImageURL:"", ThumbURL:"", Fields:[]slack.AttachmentField(nil), Actions:[]slack.AttachmentAction(nil), MarkdownIn:[]string(nil), Footer:"", FooterIcon:"", Ts:""}}, Edited:(*slack.Edited)(nil), LastRead:"", Subscribed:false, UnreadCount:0, SubType:"bot_message", Hidden:false, DeletedTimestamp:"", EventTimestamp:"1550956820.004100", BotID:"BGF0K18LC", Username:"ANONYMIZED", Icons:(*slack.Icon)(nil), Inviter:"", Topic:"", Purpose:"", Name:"", OldName:"", Members:[]string(nil), ReplyCount:0, Replies:[]slack.Reply(nil), ParentUserId:"", Files:[]slack.File(nil), Upload:false, Comment:(*slack.Comment)(nil), ItemType:"", ReplyTo:0, Team:"TGA6B2P2S", Reactions:[]slack.ItemReaction(nil), ResponseType:"", ReplaceOriginal:false, DeleteOriginal:false}, SubMessage:(*slack.Msg)(nil)}       
[0003] DEBUG slack:        Skipped message: &slack.MessageEvent{Msg:slack.Msg{Type:"message", Channel:"GGFC84GSH", User:"", Text:"matterbridge has set the subject to: ", Timestamp:"1550956820.004100", ThreadTimestamp:"", IsStarred:false, PinnedTo:[]string(nil), Attachments:[]slack.Attachment{slack.Attachment{Color:"", Fallback:"", CallbackID:"matterbridge_bhori4o91f494t5nrjl0", ID:1, AuthorID:"", AuthorName:"", AuthorSubname:"", AuthorLink:"", AuthorIcon:"", Title:"", TitleLink:"", Pretext:"", Text:"", ImageURL:"", ThumbURL:"", Fields:[]slack.AttachmentField(nil), Actions:[]slack.AttachmentAction(nil), MarkdownIn:[]string(nil), Footer:"", FooterIcon:"", Ts:""}}, Edited:(*slack.Edited)(nil), LastRead:"", Subscribed:false, UnreadCount:0, SubType:"bot_message", Hidden:false, DeletedTimestamp:"", EventTimestamp:"1550956820.004100", BotID:"BGF0K18LC", Username:"ANONYMIZED", Icons:(*slack.Icon)(nil), Inviter:"", Topic:"", Purpose:"", Name:"", OldName:"", Members:[]string(nil), ReplyCount:0, Replies:[]slack.Reply(nil), ParentUserId:"", Files:[]slack.File(nil), Upload:false, Comment:(*slack.Comment)(nil), ItemType:"", ReplyTo:0, Team:"TGA6B2P2S", Reactions:[]slack.ItemReaction(nil), ResponseType:"", ReplaceOriginal:false, DeleteOriginal:false}, SubMessage:(*slack.Msg)(nil)}
42wim commented 5 years ago

Ok, thanks, seems like the xmpp protocol is doing this. https://github.com/siacs/Conversations/issues/1301 Let me see if I can fix this before I release 1.14.0

42wim commented 5 years ago

Should be fixed in master, can you test? Dev build binaries are up on https://bintray.com/42wim/nightly/Matterbridge/v1.13.1-36-ga775b57#files

42wim commented 5 years ago

The topic is now being sent as an actual event, so if you don't have ShowTopicChange=true it won't show up anymore.

jojosoft commented 5 years ago

Thanks so much for your efforts! It's working now as expected. (By the way, I'm also looking into matterircd right now. I really like how structured all your projects are. Keep coding..!)

42wim commented 5 years ago

Thanks for the feedback and the testing! 👍

42wim commented 5 years ago

matterircd isn't that structured though :/