mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-23 09:22:19 -05:00
Optimization: No getters in loops
This commit is contained in:
parent
60f4412096
commit
902b1a5b09
@ -384,8 +384,9 @@ public class IRCConnection extends PircBot
|
|||||||
@Override
|
@Override
|
||||||
protected void onNickChange(String oldNick, String login, String hostname, String newNick)
|
protected void onNickChange(String oldNick, String login, String hostname, String newNick)
|
||||||
{
|
{
|
||||||
// XXX: Optimization : No getter in for loop
|
Vector<String> channels = getChannelsByNickname(newNick);
|
||||||
for (String target : getChannelsByNickname(newNick)) {
|
|
||||||
|
for (String target : channels) {
|
||||||
Message message = new Message(oldNick + " is now known as " + newNick);
|
Message message = new Message(oldNick + " is now known as " + newNick);
|
||||||
message.setColor(Message.COLOR_GREEN);
|
message.setColor(Message.COLOR_GREEN);
|
||||||
server.getConversation(target).addMessage(message);
|
server.getConversation(target).addMessage(message);
|
||||||
@ -526,8 +527,9 @@ public class IRCConnection extends PircBot
|
|||||||
protected void onQuit(String sourceNick, String sourceLogin, String sourceHostname, String reason)
|
protected void onQuit(String sourceNick, String sourceLogin, String sourceHostname, String reason)
|
||||||
{
|
{
|
||||||
if (!sourceNick.equals(this.getNick())) {
|
if (!sourceNick.equals(this.getNick())) {
|
||||||
// XXX: Optimization : No getter in for loop
|
Vector<String> channels = getChannelsByNickname(sourceNick);
|
||||||
for (String target : getChannelsByNickname(sourceNick)) {
|
|
||||||
|
for (String target : channels) {
|
||||||
Message message = new Message(sourceNick + " quits (" + reason + ")");
|
Message message = new Message(sourceNick + " quits (" + reason + ")");
|
||||||
message.setColor(Message.COLOR_GREEN);
|
message.setColor(Message.COLOR_GREEN);
|
||||||
message.setIcon(R.drawable.quit);
|
message.setIcon(R.drawable.quit);
|
||||||
@ -981,11 +983,11 @@ public class IRCConnection extends PircBot
|
|||||||
private Vector<String> getChannelsByNickname(String nickname)
|
private Vector<String> getChannelsByNickname(String nickname)
|
||||||
{
|
{
|
||||||
Vector<String> channels = new Vector<String>();
|
Vector<String> channels = new Vector<String>();
|
||||||
|
String[] channelArray = getChannels();
|
||||||
|
|
||||||
// XXX: Optimization : No getter in for loop
|
for (String channel : channelArray) {
|
||||||
for (String channel : this.getChannels()) {
|
User[] userArray = getUsers(channel);
|
||||||
// XXX: Optimization : No getter in for loop
|
for (User user : userArray) {
|
||||||
for (User user : this.getUsers(channel)) {
|
|
||||||
if (user.getNick().equals(nickname)) {
|
if (user.getNick().equals(nickname)) {
|
||||||
channels.add(channel);
|
channels.add(channel);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user