Changes should now be in sync with dominik

This commit is contained in:
Tim Bray 2014-04-30 13:46:35 -07:00
parent b5fb311c61
commit 4c693b4509

View File

@ -112,12 +112,15 @@ public class KeybaseKeyServer extends KeyServer {
entry.setDate(tmpGreg.getTime()); entry.setDate(tmpGreg.getTime());
// key bits // key bits
// we have to fetch the user object to construct the search-result list, so we might as
// well (weakly) remember the key, in case they try to import it
mKeyCache.put(keybaseID, JWalk.getString(match,"them", "public_keys", "primary", "bundle")); mKeyCache.put(keybaseID, JWalk.getString(match,"them", "public_keys", "primary", "bundle"));
// String displayName = JWalk.getString(match, "them", "profile", "full_name"); // String displayName = JWalk.getString(match, "them", "profile", "full_name");
ArrayList<String> userIds = new ArrayList<String>(); ArrayList<String> userIds = new ArrayList<String>();
String name = "keybase.io/" + keybaseID + " <" + keybaseID + "@keybase.io>"; String name = "keybase.io/" + keybaseID + " <" + keybaseID + "@keybase.io>";
userIds.add(name); userIds.add(name);
userIds.add(keybaseID);
entry.setUserIds(userIds); entry.setUserIds(userIds);
entry.setPrimaryUserId(name); entry.setPrimaryUserId(name);
return entry; return entry;
@ -157,12 +160,10 @@ public class KeybaseKeyServer extends KeyServer {
@Override @Override
public String get(String id) throws QueryException { public String get(String id) throws QueryException {
// id is like "keybase/username" String key = mKeyCache.get(id);
String keybaseID = id.substring(id.indexOf('/') + 1);
String key = mKeyCache.get(keybaseID);
if (key == null) { if (key == null) {
try { try {
JSONObject user = getUser(keybaseID); JSONObject user = getUser(id);
key = JWalk.getString(user, "them", "public_keys", "primary", "bundle"); key = JWalk.getString(user, "them", "public_keys", "primary", "bundle");
} catch (Exception e) { } catch (Exception e) {
throw new QueryException(e.getMessage()); throw new QueryException(e.getMessage());