Been trying to figure this one out for a while. Whisp saves a history of tells sent/received by a player. I save this info in the database under the character name. In the case of BNET/realid whispers I have tried a few different things.
If I save them to the DB using the 2nd argument of "CHAT_MSG_BN_WHISPER" for example which is the player name in this format: "|Kf8|k0000000000000|k". This will work for a few sessions (seems to be a random amount) but then the players presenceID ( 8 ) will change and this player name string becomes unknown in the game.
I can't seem to find anything that will reliably identify a BNET friend between sessions. Is there some way to do this that I am missing or is it impossible?
I would think something like the following might work. Completely untested.
local myTable = {}
-- get our info
for i = 1, BNGetNumFriends() do
local _, givenName, surName, toonName = BNGetFriendInfo(i)
myTable[name] = {name = givenName.." "..surName}
myTable[name][toon] = {toon = toonName]
end
Nice thought but I tried that as well. givenname and surname both are "|K" strings as well using the prescence ID which will change and make them both become unknown to the client at some point.
Problem with that is how do you get the real name from "|Kf8|k0000000000000|"? I could isolate "0000000000000" from the string using gsub but where is the actual name?
Taken from wowiki on escape sequences:
|K[gsf][0-9]+|k[0]+|k New in 4.0 - Represents a Battle.net friend's name. The 3rd character indicates given name, surname, or full name. The number which follows it represents the friend's Bnet Presence ID. The zeros between the |k form a string of the same length as the name which will replace it. E.g. if your first name is John and your presence id is 30, your given name (John) would be represented by the string |Kg30|k0000|k .
Blizz changed the RealID system shortly after it was released because addons were saving and transmitting the real names of people. Blizz made it so that addons do not have access to the real names.
You could look at the length of the first and last names, and hope the user doesn't have two friends with names of the same length. The API would return Bob Smith as |Kf8|k000| for the first name and |Kf8|k00000|k for the last name, so you could either save it as "000 00000" or "3.5" or any other representation. Obviously it wouldn't work perfectly for everyone, but it would probably be fine for most people.
If I save them to the DB using the 2nd argument of "CHAT_MSG_BN_WHISPER" for example which is the player name in this format: "|Kf8|k0000000000000|k". This will work for a few sessions (seems to be a random amount) but then the players presenceID ( 8 ) will change and this player name string becomes unknown in the game.
I can't seem to find anything that will reliably identify a BNET friend between sessions. Is there some way to do this that I am missing or is it impossible?
Thanks
Here is the link to wowpedia.org's BattleNet APIs http://www.wowpedia.org/World_of_Warcraft_API#RealID_.28BNet.29_Functions
Taken from wowiki on escape sequences:
I was thinking of doing exactly this as well. Perhaps someone could make it into a lib of some kind.