Miranda NG Official Community Forum

Forum for English speaking Miranda NG users => Development => Topic started by: snow on 24 02 2019, 20:44:34

Title: Bug report and possible fix related to group chat log messages
Post by: snow on 24 02 2019, 20:44:34
Hi,

I noticed there's a bug with message output/printing to the message log in group chats. I came across it while using Discord, but I'm guessing it applies to all group chats? I'm using TabSRMM, but going by the code, the built-in message log should have the same problem.

The bug is that if message text - both incoming and outgoing - contains printf-style format characters (%), then miranda will incorrectly process those instead of treating it as raw text. For example if you type or receive a message like "test 1% 2% 3%%", the output on the screen will look like "test 123%".

I found that AddEventToBuffer() in chat_log.cpp, for both mir_app and TabSRMM, has various Log_CreateRTF(... lin->ptszText ...) calls with simpleMode set to false. That causes Log_CreateRTF to interpret % sequences in regular message text as formatting directives.

The quick fix I applied locally and that I'm testing now, is to set simpleMode to true for all Log_CreateRTF calls with lin->ptszText. However I'm not familiar enough with the code to know if that can cause other problems, but it fixes the obvious bug that raw message text should not be subject to printf-style format interpretation.
Title: Re: Bug report and possible fix related to group chat log messages
Post by: Wishmaster on 25 02 2019, 18:04:39
Hi, and thanks for your remark on that. Could you please make a pull request on github (https://github.com/miranda-ng/miranda-ng) with all your changes, so someone could easily verify and apply your patch?
Title: Re: Bug report and possible fix related to group chat log messages
Post by: snow on 25 02 2019, 23:19:27
I haven't done pull requests before, and I see it involves github forking and stuff. I'm afraid I'm a bit too stressed to deal with that stuff at the moment :)  I can attach a diff patch here though.
Title: Re: Bug report and possible fix related to group chat log messages
Post by: Wishmaster on 26 02 2019, 14:00:10
Thats fine too, thanks!
Title: Re: Bug report and possible fix related to group chat log messages
Post by: ghazan on 26 02 2019, 14:39:56
snow,
fix is much simpler, I committed it into development version (https://github.com/miranda-ng/miranda-ng/commit/0f00ad85feaa2fdef2c38f385cfe6ae5e46b8b05)

thanks for your efforts anyway
Title: Re: Bug report and possible fix related to group chat log messages
Post by: snow on 26 02 2019, 20:06:41
Aha, so it was Discord specific after all.