Show HKP server results first in key cloud search. Fixes #1066

This commit is contained in:
Max Mertens 2015-03-18 17:49:57 +01:00
parent 53d7c1f533
commit 74c474e3e2

View File

@ -70,6 +70,7 @@ public class ImportKeysList extends ArrayList<ImportKeysListEntry> {
modified = true; modified = true;
} }
boolean incomingFromHkpServer = true;
// were going to want to try to fetch the key from everywhere we found it, so remember // were going to want to try to fetch the key from everywhere we found it, so remember
// all the origins // all the origins
for (String origin : incoming.getOrigins()) { for (String origin : incoming.getOrigins()) {
@ -78,13 +79,19 @@ public class ImportKeysList extends ArrayList<ImportKeysListEntry> {
// to work properly, Keybase-sourced entries need to pass along the extra // to work properly, Keybase-sourced entries need to pass along the extra
if (KeybaseKeyserver.ORIGIN.equals(origin)) { if (KeybaseKeyserver.ORIGIN.equals(origin)) {
existing.setExtraData(incoming.getExtraData()); existing.setExtraData(incoming.getExtraData());
incomingFromHkpServer = false;
} }
} }
ArrayList<String> incomingIDs = incoming.getUserIds(); ArrayList<String> incomingIDs = incoming.getUserIds();
ArrayList<String> existingIDs = existing.getUserIds(); ArrayList<String> existingIDs = existing.getUserIds();
for (String incomingID : incomingIDs) { for (String incomingID : incomingIDs) {
if (!existingIDs.contains(incomingID)) { if (!existingIDs.contains(incomingID)) {
existingIDs.add(incomingID); if (incomingFromHkpServer) {
existingIDs.add(0, incomingID);
} else {
existingIDs.add(incomingID);
}
modified = true; modified = true;
} }
} }