mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-23 14:41:54 -05:00
linked-ids: rename RawLinkedIdentity to UriAttribute
This commit is contained in:
parent
57f72996e8
commit
3600cda3bc
@ -5,7 +5,7 @@ import java.net.URI;
|
||||
import android.content.Context;
|
||||
import android.support.annotation.DrawableRes;
|
||||
|
||||
public class LinkedIdentity extends RawLinkedIdentity {
|
||||
public class LinkedIdentity extends UriAttribute {
|
||||
|
||||
public final LinkedResource mResource;
|
||||
|
||||
|
@ -13,11 +13,11 @@ import android.content.Context;
|
||||
import android.support.annotation.DrawableRes;
|
||||
|
||||
/** The RawLinkedIdentity contains raw parsed data from a Linked Identity subpacket. */
|
||||
public class RawLinkedIdentity {
|
||||
public class UriAttribute {
|
||||
|
||||
public final URI mUri;
|
||||
|
||||
protected RawLinkedIdentity(URI uri) {
|
||||
protected UriAttribute(URI uri) {
|
||||
mUri = uri;
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ public class RawLinkedIdentity {
|
||||
return Strings.toUTF8ByteArray(mUri.toASCIIString());
|
||||
}
|
||||
|
||||
public static RawLinkedIdentity fromAttributeData(byte[] data) throws IOException {
|
||||
public static UriAttribute fromAttributeData(byte[] data) throws IOException {
|
||||
WrappedUserAttribute att = WrappedUserAttribute.fromData(data);
|
||||
|
||||
byte[][] subpackets = att.getSubpackets();
|
||||
@ -36,7 +36,7 @@ public class RawLinkedIdentity {
|
||||
throw new IOException("no subpacket data");
|
||||
}
|
||||
|
||||
static RawLinkedIdentity fromSubpacketData(byte[] data) {
|
||||
static UriAttribute fromSubpacketData(byte[] data) {
|
||||
|
||||
try {
|
||||
String uriStr = Strings.fromUTF8ByteArray(data);
|
||||
@ -44,7 +44,7 @@ public class RawLinkedIdentity {
|
||||
|
||||
LinkedResource res = LinkedTokenResource.fromUri(uri);
|
||||
if (res == null) {
|
||||
return new RawLinkedIdentity(uri);
|
||||
return new UriAttribute(uri);
|
||||
}
|
||||
|
||||
return new LinkedIdentity(uri, res);
|
||||
@ -55,13 +55,13 @@ public class RawLinkedIdentity {
|
||||
}
|
||||
}
|
||||
|
||||
public static RawLinkedIdentity fromResource (LinkedTokenResource res) {
|
||||
return new RawLinkedIdentity(res.toUri());
|
||||
public static UriAttribute fromResource (LinkedTokenResource res) {
|
||||
return new UriAttribute(res.toUri());
|
||||
}
|
||||
|
||||
|
||||
public WrappedUserAttribute toUserAttribute () {
|
||||
return WrappedUserAttribute.fromSubpacket(WrappedUserAttribute.UAT_LINKED_ID, getEncoded());
|
||||
return WrappedUserAttribute.fromSubpacket(WrappedUserAttribute.UAT_URI_ATTRIBUTE, getEncoded());
|
||||
}
|
||||
|
||||
public @DrawableRes int getDisplayIcon() {
|
@ -44,7 +44,7 @@ public class DnsResource extends LinkedTokenResource {
|
||||
|
||||
public static String generateText(byte[] fingerprint) {
|
||||
|
||||
return String.format("openpgpid+token=%s",
|
||||
return String.format("openpgp4fpr=%s",
|
||||
KeyFormattingUtils.convertFingerprintToHex(fingerprint));
|
||||
|
||||
}
|
||||
@ -52,7 +52,7 @@ public class DnsResource extends LinkedTokenResource {
|
||||
public static DnsResource createNew (String domain) {
|
||||
HashSet<String> flags = new HashSet<>();
|
||||
HashMap<String,String> params = new HashMap<>();
|
||||
URI uri = URI.create("dns:" + domain);
|
||||
URI uri = URI.create("dns:" + domain + "?TYPE=TXT");
|
||||
return create(flags, params, uri);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class WrappedUserAttribute implements Serializable {
|
||||
|
||||
public static final int UAT_NONE = 0;
|
||||
public static final int UAT_IMAGE = UserAttributeSubpacketTags.IMAGE_ATTRIBUTE;
|
||||
public static final int UAT_LINKED_ID = 101;
|
||||
public static final int UAT_URI_ATTRIBUTE = 101;
|
||||
|
||||
private PGPUserAttributeSubpacketVector mVector;
|
||||
|
||||
|
@ -518,7 +518,7 @@ public class KeychainProvider extends ContentProvider {
|
||||
|
||||
if (match == KEY_RING_LINKED_IDS) {
|
||||
qb.appendWhere(Tables.USER_PACKETS + "." + UserPackets.TYPE + " = "
|
||||
+ WrappedUserAttribute.UAT_LINKED_ID);
|
||||
+ WrappedUserAttribute.UAT_URI_ATTRIBUTE);
|
||||
} else {
|
||||
qb.appendWhere(Tables.USER_PACKETS + "." + UserPackets.TYPE + " IS NULL");
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ import android.widget.TextView;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.linked.LinkedIdentity;
|
||||
import org.sufficientlysecure.keychain.linked.RawLinkedIdentity;
|
||||
import org.sufficientlysecure.keychain.linked.UriAttribute;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.Certs;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.UserPackets;
|
||||
import org.sufficientlysecure.keychain.ui.linked.LinkedIdViewFragment;
|
||||
@ -49,7 +49,7 @@ import java.util.WeakHashMap;
|
||||
public class LinkedIdsAdapter extends UserAttributesAdapter {
|
||||
private final boolean mIsSecret;
|
||||
protected LayoutInflater mInflater;
|
||||
WeakHashMap<Integer,RawLinkedIdentity> mLinkedIdentityCache = new WeakHashMap<>();
|
||||
WeakHashMap<Integer,UriAttribute> mLinkedIdentityCache = new WeakHashMap<>();
|
||||
|
||||
private Cursor mUnfilteredCursor;
|
||||
|
||||
@ -85,7 +85,7 @@ public class LinkedIdsAdapter extends UserAttributesAdapter {
|
||||
FilterCursorWrapper filteredCursor = new FilterCursorWrapper(cursor) {
|
||||
@Override
|
||||
public boolean isVisible(Cursor cursor) {
|
||||
RawLinkedIdentity id = getItemAtPosition(cursor);
|
||||
UriAttribute id = getItemAtPosition(cursor);
|
||||
return id instanceof LinkedIdentity;
|
||||
}
|
||||
};
|
||||
@ -132,16 +132,16 @@ public class LinkedIdsAdapter extends UserAttributesAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
RawLinkedIdentity id = getItemAtPosition(cursor);
|
||||
UriAttribute id = getItemAtPosition(cursor);
|
||||
holder.setData(mContext, id);
|
||||
|
||||
}
|
||||
|
||||
public RawLinkedIdentity getItemAtPosition(Cursor cursor) {
|
||||
public UriAttribute getItemAtPosition(Cursor cursor) {
|
||||
int rank = cursor.getInt(INDEX_RANK);
|
||||
Log.d(Constants.TAG, "requested rank: " + rank);
|
||||
|
||||
RawLinkedIdentity ret = mLinkedIdentityCache.get(rank);
|
||||
UriAttribute ret = mLinkedIdentityCache.get(rank);
|
||||
if (ret != null) {
|
||||
Log.d(Constants.TAG, "cached!");
|
||||
return ret;
|
||||
@ -160,7 +160,7 @@ public class LinkedIdsAdapter extends UserAttributesAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RawLinkedIdentity getItem(int position) {
|
||||
public UriAttribute getItem(int position) {
|
||||
Cursor cursor = getCursor();
|
||||
cursor.moveToPosition(position);
|
||||
return getItemAtPosition(cursor);
|
||||
@ -206,7 +206,7 @@ public class LinkedIdsAdapter extends UserAttributesAdapter {
|
||||
vComment = (TextView) view.findViewById(R.id.linked_id_comment);
|
||||
}
|
||||
|
||||
public void setData(Context context, RawLinkedIdentity id) {
|
||||
public void setData(Context context, UriAttribute id) {
|
||||
|
||||
vTitle.setText(id.getDisplayTitle(context));
|
||||
|
||||
|
@ -36,7 +36,7 @@ import org.sufficientlysecure.keychain.operations.results.LinkedVerifyResult;
|
||||
import org.sufficientlysecure.keychain.linked.LinkedTokenResource;
|
||||
import org.sufficientlysecure.keychain.linked.LinkedIdentity;
|
||||
import org.sufficientlysecure.keychain.linked.LinkedResource;
|
||||
import org.sufficientlysecure.keychain.linked.RawLinkedIdentity;
|
||||
import org.sufficientlysecure.keychain.linked.UriAttribute;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.Certs;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.UserPackets;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainDatabase.Tables;
|
||||
@ -68,7 +68,7 @@ public class LinkedIdViewFragment extends CryptoOperationFragment implements
|
||||
private static final String ARG_FINGERPRINT = "fingerprint";
|
||||
private static final int LOADER_ID_LINKED_ID = 1;
|
||||
|
||||
private RawLinkedIdentity mLinkedId;
|
||||
private UriAttribute mLinkedId;
|
||||
private LinkedTokenResource mLinkedResource;
|
||||
private boolean mIsSecret;
|
||||
|
||||
@ -147,7 +147,7 @@ public class LinkedIdViewFragment extends CryptoOperationFragment implements
|
||||
int certStatus = cursor.getInt(UserIdsAdapter.INDEX_VERIFIED);
|
||||
|
||||
byte[] data = cursor.getBlob(UserIdsAdapter.INDEX_ATTRIBUTE_DATA);
|
||||
RawLinkedIdentity linkedId = LinkedIdentity.fromAttributeData(data);
|
||||
UriAttribute linkedId = LinkedIdentity.fromAttributeData(data);
|
||||
|
||||
loadIdentity(linkedId, certStatus);
|
||||
|
||||
@ -186,7 +186,7 @@ public class LinkedIdViewFragment extends CryptoOperationFragment implements
|
||||
mIdLoadedListener = listener;
|
||||
}
|
||||
|
||||
private void loadIdentity(RawLinkedIdentity linkedId, int certStatus) {
|
||||
private void loadIdentity(UriAttribute linkedId, int certStatus) {
|
||||
mLinkedId = linkedId;
|
||||
|
||||
if (mLinkedId instanceof LinkedIdentity) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user