Posted by acorah2 on Tue, 08 Jun 2010 19:25:46
first of all thanks for the great website, its been invaluable in creating my first addon.
The problem im having is collecting information on users in custom channels. I was wondering if its possible to return names/guilds of all users in a custom channel?
essentially what ListChannelByName() does, but with usable data and not an output?
thanks for any help.
Posted by jnwhiteh on Tue, 08 Jun 2010 20:13:19
That API call will always require communication with the server, but you can catch the
CHAT_MSG_CHANNEL_LISTevent in order to get the information. This means messing with the chat frame to make sure it doesn't get displayed, but that's not great.
You may be able to use GetNumChannelMembers and GetChannelRosterInfo to get the information directly. I'd look there, and here: http://wowprogramming.com/docs/api_categories#channel
Posted by acorah2 on Wed, 09 Jun 2010 23:38:14
thanks for the help, ive managed to make some great progress but have hit yet another snag.
Im currently checking to see if the player has owner or moderator for a channel by using:
SetSelectedDisplayChannel(channelID); isOwner = IsDisplayChannelOwner(); isModerator = IsDisplayChannelModerator();
However, regardless of my status, both variables are always nil. I am currently in a channel on my own and both results return nil, despite the ingame command and the API call to change owner, working sucessfully.
Have you any idea why these wont return 1? The channelID is correct, and i can change owner of the channel fine (even after the code above telling me im not the owner).
any help would be greatly appreciated.
Posted by jnwhiteh on Thu, 10 Jun 2010 09:09:18
I can't reproduce this, so I have to assume you're selecting the wrong channel. Try the following:
- Join a new chat channel so you are owner/moderator
- Open the chat window
- Select the channel
- run /dump GetSelectedDisplayChannel() to ensure you have the right index
- Then select another channel and verify that the return changes
- /run SetSelectedDisplayChannel() with the index you got before
- /dump IsDisplayChannelOwner()
It should return 1, and it does for me.