Open Gert-dev opened 2 years ago
Oh, weird! I didn't know messages could be either of html or markdown, I've only ever seen plain text or html
I think i need to add some additional debugging to be able to see exactly what the message coming though is, otherwise you'd have to pipe Pidgin through a proxy server (such as Charles proxy, burp or mitmproxy) to see what's coming though
Is it just gitlab that does this or is there another bot i could add to be able to see that?
We don't have any other plugins active that seem to do this, but I think this should work fine with a free GitLab account and private/public GitLab project. The panel to integrate it into a project can be found under Settings -> Integrations -> Microsoft Teams notifications and looks somewhat like this:
If you want, though, since I have a GitLab account, I can try setting up one of the integrations with a Teams instance of your choosing so you can see the data that comes in and try to cause a few notifications to emit on your signal.
I'm definitely interested in markdown rendering as I use markdown quite a lot in chats, for code blocks, bulleted lists, highlights, etc. But perhaps it should be a separate plugin so that other protocols would benefit from it?
Actually it looks like there is some markdown rendering support in other @EionRobb plugins already.
https://github.com/EionRobb/purple-discord/blob/master/markdown.c https://github.com/EionRobb/purple-mattermost/blob/master/libmattermost-markdown.c https://github.com/EionRobb/telegram-purple?tab=readme-ov-file#code-tags
So perhaps it's easy to implement in purple-teams?
Yeah should be doable, i just need to sort out the debugging situation to show more of the low level stuff to see exactly what comes through to be able to parse it.
Looking at this some more, the messages are currently just dumped verbatim (eg the messages in #49) and there's a TODO
in the code to parse it https://github.com/EionRobb/purple-teams/blob/8b7d115f5aba71dca924904d0451cd06bf47c283/teams_messages.c#L359. Looks like there's 7 potential types of Cards that can end up in there (based on https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-reference#card-types ) but 3 being the most common (based on https://stackoverflow.com/questions/67921711/microsoft-teams-cards-as-html ), The webhooks I've set up on a test account mostly look like this one though https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-reference#example-of-a-connector-card-for-microsoft-365-groups
Added support for one of the 7 types, which should hopefully cover most incoming webhooks
Works for the ones I had reported in #49.
Looks like the after-call recording notices are also Cards using a different format. Will add support for that one next.
They're a bit scruffy looking, but I've added in support for a few more card types: Adaptive, Image/Video/Media, Hero/Thumnail. Adaptive Cards are the trickiest, since they're allowed to have columns but Pidgin doesn't support <table>
or something that vaguely resembles them. They don't currently download and inline any of the images that they might reference, but would love some feedback!
Any chance markdown code blocks could be rendered differently than regular text?
Not sure whats possible with pidgin, but something as simple as using a different (monospace) font would be beneficial. Although Syntax highlighting such as in PiFo would be a absolute killer.
Any chance markdown code blocks could be rendered differently than regular text?
Do you have a side-by-side screenshot of how it looks in Pidgin vs Teams that you could share? First step is getting it to render at least the same, before adding any extra hotness on top 🙂
Problem
Several Teams plug-ins, such as the GitLab plug-in, post notifications containing rich text. In Pidgin these are then also displayed, but the source markdown seems to be posted instead. For example:
Steps To Reproduce
Expected Result / Possible Solutions
The markdown is converted to HTML or the rich formatting Pidgin supports to make it more readable.
Additional Info