Commit 3d8d8fbb 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/src/plugins/gateway@5801 b35dd754-fafc-0310-a699-88a17e54d16e
parent 75e45a08
......@@ -993,6 +993,7 @@ public abstract class BaseTransport implements Component, RosterEventListener, P
public void syncLegacyRoster(JID userjid, List<TransportBuddy> legacyitems) throws UserNotFoundException {
try {
Roster roster = rosterManager.getRoster(userjid.getNode());
boolean hasTransport = false;
// First thing first, we want to build ourselves an easy mapping.
Map<JID,TransportBuddy> legacymap = new HashMap<JID,TransportBuddy>();
......@@ -1009,6 +1010,13 @@ public abstract class BaseTransport implements Component, RosterEventListener, P
}
if (ri.getJid().getNode() == null) {
// 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;
}
JID jid = new JID(ri.getJid().toBareJID());
......@@ -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
for (TransportBuddy buddy : legacymap.values()) {
//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