Extracted updateUserStates method, fixed localDB initialization
This commit is contained in:
parent
a0dc25ba61
commit
c58a4a73d3
@ -53,6 +53,7 @@ public class Config {
|
||||
case "-db":
|
||||
localDB = new File(args[++i]);
|
||||
}
|
||||
if (localDB == null) localDB = new File(".\\localDB");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -275,19 +275,17 @@ public class ChatWindow extends JFrame {
|
||||
client.addUnreadMessagesToLocalDB(localDB);
|
||||
client.clearUnreadMessagesSync();
|
||||
|
||||
for (int i = 0; i < userList.getModel().getSize(); i++) {
|
||||
for (int j = 0; j < localDB.getChats().size(); j++) {
|
||||
if(userList.getModel().getElementAt(i).getID() == localDB.getChats().get(j).getRecipient().getID()) {
|
||||
userList.getModel().getElementAt(i).setStatus(localDB.getChats().get(j).getRecipient().getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
updateUserStates();
|
||||
|
||||
contentPane.revalidate();
|
||||
contentPane.repaint();
|
||||
userList.revalidate();
|
||||
userList.repaint();
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void updateUserStates() {
|
||||
for (int i = 0; i < userList.getModel().getSize(); i++)
|
||||
for (int j = 0; j < localDB.getChats().size(); j++)
|
||||
if (userList.getModel().getElementAt(i).getID() == localDB.getChats().get(j).getRecipient().getID())
|
||||
userList.getModel().getElementAt(i).setStatus(localDB.getChats().get(j).getRecipient().getStatus());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user