Author Topic: Bug report and possible fix related to group chat log messages  (Read 5082 times)

0 Members and 1 Guest are viewing this topic.

Offline snow

  • Newbie
  • *
  • Posts: 5
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.
 

Offline Wishmaster

Hi, and thanks for your remark on that. Could you please make a pull request on github with all your changes, so someone could easily verify and apply your patch?
 

Offline snow

  • Newbie
  • *
  • Posts: 5
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.
 

Offline Wishmaster

Thats fine too, thanks!
 

Offline ghazan

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
 

Offline snow

  • Newbie
  • *
  • Posts: 5
Aha, so it was Discord specific after all.