jhakonen / wot-teamspeak-mod

Mod for integrating TeamSpeak into World of Tanks
GNU Lesser General Public License v2.1
36 stars 8 forks source link

Suggestion for improving the fallback nick matching on missing metadata #1

Closed klemetsson closed 10 years ago

klemetsson commented 10 years ago

Hi,

I like your promising mod. A suggestion would be to do a more elaborate regex-matching on the TS-nick. Often users have their clan-name before or after their nick within [ ] or (). It would be very useful if you omit those when doing the compare. Also removing the spaces. Then it would be very much more useful when not so many are using the mod.

Regards, Christian

jhakonen commented 10 years ago

Hi Christian,

Do you mean the server group? My name in my clan's teamspeak is shown like this: "[T-BAD] jhakonen". The group is not really part of the nickname and it is ignored by the mod.

If, instead you mean something that is added manually by the TS user, then there was already another suggestion similar to yours: http://forum.worldoftanks.eu/index.php?/topic/433614-093-tessumod-wotteamspeak-integration-mod/page__pid__9115583#entry9115583

I was thinking of adding following kind of configuration options for parsing:

[General]
; Defines regular expression for extracting WOT nickname from user's
; TS nickname, e.g. if TS nickname is:
;   "wot_nickname | real name"
; Following expression will extract the wot_nickname:
;   wot_nick_extract_pattern: ([^|]+)
;   wot_nick_extract_group: 1
; The group defines capture group which will contain the WOT nickname.
; For more info, see: https://docs.python.org/2/library/re.html
; The captured nickname is also stripped of any surrounding white space and
; compared case insensitive manner to seen WOT players.
;wot_nick_extract_pattern: 
;wot_nick_extract_group: 

Would this be what you would need?

klemetsson commented 10 years ago

Hi,

Many times the clan-tag in the TS-nick is not set by server groups. Instead they are set manually by the users. So the [] or () is part of the user name. Having the clan tag assigned by server groups seems to be very uncommon. We often have lots of people from different clans on our server (we have four clans, plus many allies and friendly clans). Most have the tag-clan added after the nick in []. But some have it before the nick. Also there are people adding messages or random comments after their tag.

Maybe an easy solution for the ending part would be to remove everything after a white space, "[" or "(", as wot nicks are not allowed to contain those chars anyways.

jhakonen commented 10 years ago

That might work for you, but other clans might have different naming conventions. Also different languages, like russian, chinese, arabic, etc... could have very different ideas what the TS nickname should look like. As such the regexp would at least give the option to customize the name matching for everyone's needs.

klemetsson commented 10 years ago

But there is a very limited number of characters that are allowed in a wot nickname:

"Your nickname should contain characters and/or digits only, special symbols like "! @ # $ % ^ & * ( ) - + =" are not allowed, except for the underscore "_""

So regardless on how it is formatted in TS, it should be fairly simple to do a matching that works for almost all users (regardless on naming conventions).

The most common formats I've encountered on our and others TS are:

nick [tag] nick (tag) nick (real name) [tag] nick/real name [tag] [tag] nick

Also with or without white spaces between the [], (), / and also with some random stuff after the tag.

jhakonen commented 10 years ago

Ah, I didn't realize that the nick is limited that way. If I change the configuration so that one can define multiple regular expressions, like this:

[General]
nick_extract_patterns: "([a-z0-9_]+)","\[[^\]]+\]\s*([a-z0-9_]+)"

Those would extract nick in all the example cases.

klemetsson commented 10 years ago

Nice. I think that would work perfectly :)

jhakonen commented 10 years ago

Next version (0.3.0) is out, give it a go and see if it is working for you.

stagnate commented 10 years ago

I am trying to test this out but ran into some problems. I turned off the ge_wot_nick_from_ts_metadata and tried doing mappings with my platoonmate.

Using the NameMapping I couldn't make a TS nickname with a space match a WoT username. If I set my nick to 'Stagnate', and NameMapping to 'Stagnate:CaptainNopants' it works as expected (his name lights when I talk). If I set my nick to 'Stagnate test' and NameMapping to 'Stagnate test:CaptainNopants' it doesn't work.

That was during live play so I didn't have much time to test but I did turn on debugging if you can tell me what to look for - it's pretty noisy.

Later I tried running it with a replay to test, and it didn't work at all; it was lighting my name when I spoke regardless of the NameMapping.

One other strange issue, when I first ran WoT with this mod enabled, the users in my channel disappeared (including myself). I could see users in other channels just not my own. I re-connected and it was fine; not sure if that's a TS client thing related to how you set the WoT nickname field.

jhakonen commented 10 years ago

Hi Stagnate, thanks for the info!

Yup, there is indeed an issue with it. I just tried it myself and was able to reproduce it. The cause of the error was that TS's client query returns your TS nickname escaped, e.g: "Stagnate\stest". So, I added some unescaping for it and it seems to have fixed it. I didn't test it with many different characters, but at least \s, \t, \ and / should unescape correctly now.

Here's a link to the fixed version: https://dl.dropboxusercontent.com/u/37902077/wot/tessu_mod/TessuMod-0.3.1-nick-fix.zip

When you later tried with the replay, did you have "get_wot_nick_from_ts_metadata" set to "off"? If it was set to "on" at that point then it should work as you described.

Of the users disappearing: Only thing I can think off is that some other TS plugin is misbehaving. The metadata is just a string of data. which is accessible to all plugins in the client. TessuMod stores the WOT nickname to the metadata string in form "< wot_nickname_start>nickname< wot_nickname_end>", replacing existing value between those tags if the tags already exist. If not, then it appends it to end of the metadata string, preserving any existing data (from other plugins). Now, some other TS plugin could just rudely claim the whole metadata string to itself. And then do something weird when the metadata suddenly contains something else that it didn't put there. Except for modifying the metadata, the mod only reads data from TS and reacts to events it sends.

stagnate commented 10 years ago

Thanks, I'll take a look at it.

When using the replay I had 'get_wot_nick_from_ts_metadata' set to off - it was the same config that was working during a live game. I tested it with 3.1 and it worked, and spaces also worked so you can ignore that. I'll let you know if it happens again.

I'm not using other TS mods, but I think it's likely that it's a client problem and am not too worried about it. I haven't had it happen again, but may try clearing my ts metadata and running it again to see if I can recreate it.

Thanks again, really slick mod.

On Sunday, October 5, 2014 12:36 PM, Janne Hakonen notifications@github.com wrote:

Hi Stagnate, thanks for the info! Yup, there is indeed an issue with it. I just tried it myself and was able to reproduce it. The cause of the error was that TS's client query returns your TS nickname escaped, e.g: "Stagnate\stest". So, I added some unescaping for it and it seems to have fixed it. I didn't test it with many different characters, but at least \s, \t, \ and / should unescape correctly now. Here's a link to the fixed version: https://dl.dropboxusercontent.com/u/37902077/wot/tessu_mod/TessuMod-0.3.1-nick-fix.zip When you later tried with the replay, did you have "get_wot_nick_from_ts_metadata" set to "off"? If it was set to "on" at that point then it should work as you described. Of the users disappearing: Only thing I can think off is that some other TS plugin is misbehaving. The metadata is just a string of data. which is accessible to all plugins in the client. TessuMod stores the WOT nickname to the metadata string in form "nickname", replacing existing value between those tags if the tags already exist. If not, then it appends it to end of the metadata string, preserving any existing data (from other plugins). Now, some other TS plugin could just rudely claim the whole metadata string to itself. And then do something weird when the metadata suddenly contains something else that it didn't put there. Except for modifying the metadata, the mod only reads data from TS and reacts to events it sends. — Reply to this email directly or view it on GitHub.

jhakonen commented 10 years ago

Ok, I'm glad it worked.