Quantcast How to tell if someone is using remote guild chat? - WoWInterface
Thread Tools Display Modes
09-29-12, 12:54 PM   #1
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
How to tell if someone is using remote guild chat?

Hi,

I'm trying to find a way to know if a player chatting with me is really connected to the game, or just using the remote guild chat (by using the mobile Armory application).

For some reason, I couldn't find an API that returns that info... Perhaps I missed something.
Can it be done?

Thanks in advance!
  Reply With Quote
09-29-12, 01:01 PM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,447
The only way I can think of is usings the information received from GetGuildRosterInfo

http://wowprogramming.com/docs/api/GetGuildRosterInfo
__________________
  Reply With Quote
09-29-12, 01:23 PM   #3
Vis
A Pyroguard Emberseer
 
Vis's Avatar
Join Date: Mar 2009
Posts: 1,821
I just checked in with my Guild and while I am talking in /g on the remote app, my name has a speaker looking icon next to it. My guess is that they built it into the default chat frames. The Guildmate I was talking to is one of a few that doesn't run addons.
  Reply With Quote
09-29-12, 01:31 PM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,920
This is also given as the 14th argument from a chat message event.
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
09-29-12, 11:56 PM   #5
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Thank you! You've been very helpful :-)
  Reply With Quote
09-30-12, 05:21 AM   #6
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Ok, I can tell if someone chatting with me is using the mobile application by using arg14.

However, I have no idea how to tell if the player I'm whispering to is using the mobile.
I have the editbox, and I can get the whisper target name by using:
Code:
editBox:GetAttribute("tellTarget")
However, I couldn't find a way to tell if that name is using the mobile.

The API GetGuildRosterInfo gets index as a parameter, not a name.

Any ideas how to get that information from a tellTarget name?
  Reply With Quote
09-30-12, 06:09 AM   #7
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,109
If I am understanding your question correctly, then do the following. However, I am not sure if the UnitName call will work on "telltarget" so someone will have to tell me please.
Lua Code:
  1. local numOnline = select(2, GetNumGuildMembers())
  2. for i = 1, numOnline do
  3.     local isMobile = select(14, GetGuildRoster(i))
  4.     if isMobile then
  5.         local memberName = GetGuildRoster(i)
  6.         print(("%s is chatting on the mobile app"):format(memberName))
  7.         local tellName = UnitName(editbox:GetAttribute("telltarget")) -- not sure if UnitName will convert this
  8.         if tellName == memberName then
  9.             -- yes, I am whispering a guild member who is using the mobile app
  10.         end
  11.     end
  12. end
  Reply With Quote
09-30-12, 07:29 AM   #8
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Thank you for this suggestion!

I'm afraid that this is a bit "heavy" to call every time the user sends a whisper to someone.

Perhaps the solution should be to somehow create a list of online guild members, using your code. But this is problematic too, since I'm not sure when to update that list. For example, players on mobile might login to the game, new players are invited to guild, etc.
  Reply With Quote
09-30-12, 09:15 AM   #9
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,109
Register for GUILD_ROSTER_UPDATE and every time it fires, parse GetNumGuildMembers.
  Reply With Quote
09-30-12, 08:15 PM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You should avoid using select(). Function calls are basically the slowest thing you can do, and are totally unnecessary here. Plus, you're actually using two calls to GetGuildRosterInfo() instead of just using variables properly.

Here is some code that will keep track of who is currently mobile in your guild:
Code:
local mobileStatus = {}

local eventFrame = CreateFrame("Frame")
eventFrame:RegisterEvent("GUILD_ROSTER_UPDATE")
eventFrame:SetScript("OnEvent", function()
	wipe(mobileStatus)
	
	local _, numOnline = GetNumGuildMembers()
	for i = 1, numOnline do
		local name, _, _, _, _, _, _, _, _, _, _, _, _, isMobile = GetGuildRosterInfo(i)
		mobileStatus[name] = isMobile
	end
end)
Then, when you want to find out if a specific player is mobile, just check their status in the table:
Code:
if mobileStatus[name] then
	print(name, "is using the Mobile Armory app.")
else
	print(name, "is logged into WoW.")
end
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
10-01-12, 02:08 AM   #11
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Hi,

Thank you both for your help. Unfortunately, this doesn't work as expected, so I can't use this approach.

1. Iterating from 1 to numOnline doesn't work, since the online members are not necessarily indexed from 1 to numonline. The indexes depend on the sorting method and whether offline members are shown or not.
So, the whole roster should be iterated to see who are online and who has isMobile == true.
But that's not even the worse problem...

2. GetGuildRosterInfo() is bugged and totaly unreliable. Guild members connected to the game appear as connected from mobile. It happened also to my toon...
I think that unless you log off the smartphone application, your toon is displayed as isMobile, even if you login to the game afterward.

The only reliable way I've found to tell who is really isMobile, is using arg14 of the chat message event. So I took another approach and I put into an array players chatting with the user, according to their arg14. The only flaw with this approach is that the first message from the addon user to the mobile player is not detected as "to mobile" message. If the addon user is the first to chat, then there is no issue.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » How to tell if someone is using remote guild chat?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off