sylvanaar / wow-instant-messenger

WIM (WoW Instant Messenger) is a World of Warcraft addon which brings an instant messenger feel to communication in game.
https://www.curseforge.com/wow/addons/wim-3
MIT License
12 stars 14 forks source link

History module not working correctly on whispers with characters from realms with space it their name #25

Open morningrise96 opened 3 years ago

morningrise96 commented 3 years ago

Describe the bug When you're talking to someone from a realm like Defias Brotherhood or Argent Dawn for example, the messages doesn't get recorded even with 'Record everyone' option is set.

To Reproduce Steps to reproduce the behavior:

  1. Fire up the game
  2. Message anyone from a realm with a space in the realm name
  3. Check the history, it's not recording anything

Expected behavior With the history module enabled, it should record all whispers and show in the history table.

Additional context I managed to track down the problem to this line in ToolBox.lua: 'user = string.gsub(user, "[A-Z]", string.lower);' in function 'WIM.FormatUserName(user)' starting at line 97. That function gets called from WhisperEngine.lua in function 'getWhisperWindowByUser(user, isBN, bnID)' starting at line 180 'getWhisperWindowByUser(user, isBN, bnID)' gets called from 'WhisperEngine:CHAT_MSG_WHISPER(...)' starting at line 322 in WhisperEngine.lua WhisperEngine:CHAT_MSG_WHISPER(...) calls 'PostEvent_Whisper' in the History.lua module, which calls 'recordWhisper(inbound, ...)' and in recordWhisper (starting at line 132 in History.lua) this line get evaluated for 'nil' every time: 'local win = windows.active.whisper[from] or windows.active.chat[from] or windows.active.w2w[from];' However, removing that one formatting option ( string.gsub(user, "[A-Z]", string.lower) ) solved the issue and everything gets recorded in the history table. Been using the addon like that for about 2 weeks now, nothing else seems to be broken without that formatting removed, but i'm using the addon only for whispers and not familiar with LUA at all, so can't really say that it is the best solution as I don't know why/if that formatting is important elsewhere.

Pazza commented 3 years ago

Thanks for the info. I'll make sure to review and figure out why its breaking.