Commit 1c7d5761 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[GATE-55] No reason why this shouldn't still function, but I'm moving things...

[GATE-55] No reason why this shouldn't still function, but I'm moving things around "as is" to help accomidate transports not in rosters.  Could be unstable.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@5801 b35dd754-fafc-0310-a699-88a17e54d16e
parent 87b019cd
...@@ -993,6 +993,7 @@ public abstract class BaseTransport implements Component, RosterEventListener, P ...@@ -993,6 +993,7 @@ public abstract class BaseTransport implements Component, RosterEventListener, P
public void syncLegacyRoster(JID userjid, List<TransportBuddy> legacyitems) throws UserNotFoundException { public void syncLegacyRoster(JID userjid, List<TransportBuddy> legacyitems) throws UserNotFoundException {
try { try {
Roster roster = rosterManager.getRoster(userjid.getNode()); Roster roster = rosterManager.getRoster(userjid.getNode());
boolean hasTransport = false;
// First thing first, we want to build ourselves an easy mapping. // First thing first, we want to build ourselves an easy mapping.
Map<JID,TransportBuddy> legacymap = new HashMap<JID,TransportBuddy>(); Map<JID,TransportBuddy> legacymap = new HashMap<JID,TransportBuddy>();
...@@ -1009,6 +1010,13 @@ public abstract class BaseTransport implements Component, RosterEventListener, P ...@@ -1009,6 +1010,13 @@ public abstract class BaseTransport implements Component, RosterEventListener, P
} }
if (ri.getJid().getNode() == null) { if (ri.getJid().getNode() == null) {
// This is a transport instance, lets leave it alone. // This is a transport instance, lets leave it alone.
if (ri.getID() == 0) {
hasTransport = true;
}
else {
// This is a persistent roster item for the transport, remove.
this.removeFromRoster(userjid, ri.getJid());
}
continue; continue;
} }
JID jid = new JID(ri.getJid().toBareJID()); JID jid = new JID(ri.getJid().toBareJID());
...@@ -1037,6 +1045,11 @@ public abstract class BaseTransport implements Component, RosterEventListener, P ...@@ -1037,6 +1045,11 @@ public abstract class BaseTransport implements Component, RosterEventListener, P
} }
} }
if (!hasTransport) {
// This person doesn't have the transport in their roster, lets put it there.
this.addOrUpdateRosterItem(userjid, this.getJID(), this.getDescription(), "Transports");
}
// Ok, we should now have only new items from the legacy roster // Ok, we should now have only new items from the legacy roster
for (TransportBuddy buddy : legacymap.values()) { for (TransportBuddy buddy : legacymap.values()) {
//Log.debug("ROSTERSYNC: We have new, adding " + buddy.getName()); //Log.debug("ROSTERSYNC: We have new, adding " + buddy.getName());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment