* @return The users in the channel or null if unavailable
*/
public User[] getUsers() {
if (isInChannel()) {
final java.util.ArrayList<User> users = new java.util.ArrayList<User>();
final RSComponent list = methods.interfaces.getComponent(FriendChat.INTERFACE_FRIEND_CHAT, FriendChat.INTERFACE_FRIEND_CHAT_USERS_LIST);
if (list != null) {
for (final RSComponent c : list.getComponents()) {
if (c == null) {
continue;
}
String name = c.getText();
if (name != null && !name.isEmpty() && name.contains("..")) {
final String[] actions = c.getActions();
if (actions != null) {
for (final String action : actions) {
if (action != null) {
if (action.contains("Add") || action.contains("Remove")) {
name = action.substring(action.indexOf(32, action.indexOf(32) + 1) + 1);
break;
}
}
}
}
}
final int componentIndex = c.getComponentIndex();
RSComponent rank = methods.interfaces.getComponent(FriendChat.INTERFACE_FRIEND_CHAT, 6);
rank = rank.getComponent(componentIndex);
RSComponent world = methods.interfaces.getComponent(FriendChat.INTERFACE_FRIEND_CHAT, 8);
world = world.getComponent(componentIndex);
users.add(new User(name, rank, world));
}
return users.toArray(new User[users.size()]);
}
}