Extracted updateUserStates method, fixed localDB initialization
This commit is contained in:
parent
ba0c588c77
commit
67f9f5133f
@ -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