mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Fixing groups not showing.
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@9039 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -51,6 +51,23 @@ import org.jivesoftware.sparkimpl.profile.VCardManager;
|
||||
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JToolBar;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
@ -79,23 +96,6 @@ import java.util.StringTokenizer;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JToolBar;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
public final class ContactList extends JPanel implements ActionListener, ContactGroupListener, Plugin, RosterListener, ConnectionListener {
|
||||
private JPanel mainPanel = new JPanel();
|
||||
private JScrollPane contactListScrollPane;
|
||||
@ -277,7 +277,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
|
||||
RosterEntry entry = roster.getEntry(bareJID);
|
||||
boolean isPending = entry != null && (entry.getType() == RosterPacket.ItemType.none || entry.getType() == RosterPacket.ItemType.from)
|
||||
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus();
|
||||
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus();
|
||||
|
||||
// If online, check to see if they are in the offline group.
|
||||
// If so, remove from offline group and add to all groups they
|
||||
@ -398,6 +398,11 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
for (RosterGroup rosterGroup : entry.getGroups()) {
|
||||
isFiled = true;
|
||||
ContactGroup contactGroup = getContactGroup(rosterGroup.getName());
|
||||
if(contactGroup == null){
|
||||
// Create Contact Group
|
||||
contactGroup = addContactGroup(rosterGroup.getName());
|
||||
}
|
||||
|
||||
if (contactGroup != null) {
|
||||
String name = entry.getName();
|
||||
if (name == null) {
|
||||
@ -480,7 +485,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
ContactItem contactItem = new ContactItem(name, entry.getUser());
|
||||
contactItem.setPresence(new Presence(Presence.Type.unavailable));
|
||||
if ((entry.getType() == RosterPacket.ItemType.none || entry.getType() == RosterPacket.ItemType.from)
|
||||
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) {
|
||||
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) {
|
||||
// Add to contact group.
|
||||
contactGroup.addContactItem(contactItem);
|
||||
contactGroup.setVisible(true);
|
||||
@ -546,11 +551,6 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
|
||||
ContactItem newContactItem = new ContactItem(nickname, entry.getUser());
|
||||
|
||||
// Update users icon
|
||||
Presence presence = SparkManager.getConnection().getRoster().getPresence(entry.getUser());
|
||||
newContactItem.setPresence(presence);
|
||||
|
||||
|
||||
if (entry != null && (entry.getType() == RosterPacket.ItemType.none || entry.getType() == RosterPacket.ItemType.from)) {
|
||||
// Ignore, since the new user is pending to be added.
|
||||
for (RosterGroup group : entry.getGroups()) {
|
||||
@ -560,7 +560,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
}
|
||||
|
||||
boolean isPending = entry != null && (entry.getType() == RosterPacket.ItemType.none || entry.getType() == RosterPacket.ItemType.from)
|
||||
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus();
|
||||
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus();
|
||||
if (isPending) {
|
||||
contactGroup.setVisible(true);
|
||||
}
|
||||
@ -573,14 +573,13 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
moveToOffline(newContactItem);
|
||||
}
|
||||
|
||||
|
||||
if (!presence.isAvailable()) {
|
||||
try {
|
||||
updateUserPresence(presence);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error(e);
|
||||
}
|
||||
// Update users icon
|
||||
Presence presence = SparkManager.getConnection().getRoster().getPresence(entry.getUser());
|
||||
try {
|
||||
updateUserPresence(presence);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -688,7 +687,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
}
|
||||
|
||||
if (entry != null && (entry.getType() == RosterPacket.ItemType.none || entry.getType() == RosterPacket.ItemType.from)
|
||||
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) {
|
||||
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) {
|
||||
contactGroup.setVisible(true);
|
||||
|
||||
}
|
||||
@ -735,7 +734,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
ContactItem offlineItem = offlineGroup.getContactItemByJID(jid);
|
||||
if (offlineItem != null) {
|
||||
if ((rosterEntry.getType() == RosterPacket.ItemType.none || rosterEntry.getType() == RosterPacket.ItemType.from)
|
||||
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) {
|
||||
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) {
|
||||
// Remove from offlineItem and add to unfiledItem.
|
||||
offlineGroup.removeContactItem(offlineItem);
|
||||
unfiledGroup.addContactItem(offlineItem);
|
||||
|
||||
Reference in New Issue
Block a user