1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-26 19:02:17 -05:00

IRCConnection: Added getUser(String channel, String nickname)

This commit is contained in:
Sebastian Kaspari 2010-04-25 19:33:27 +02:00
parent d84808ffdb
commit a29c136240

View File

@ -1063,6 +1063,30 @@ public class IRCConnection extends PircBot
return users; return users;
} }
/**
* Get a user by channel and nickname
*
* @param channel The channel the user is in
* @param nickname The nickname of the user (with or without prefix)
* @return the User object or null if user was not found
*/
public User getUser(String channel, String nickname)
{
User[] users = getUsers(channel);
int mLength = users.length;
for (int i = 0; i < mLength; i++) {
if (nickname.equals(users[i].getNick())) {
return users[i];
}
if (nickname.equals(users[i].getPrefix() + users[i].getNick())) {
return users[i];
}
}
return null;
}
/** /**
* Quits from the IRC server with default reason. * Quits from the IRC server with default reason.
*/ */