mirror of
https://github.com/moparisthebest/k-9
synced 2024-08-13 17:03:48 -04:00
31 lines
821 B
Java
31 lines
821 B
Java
|
package com.fsck.k9.crypto;
|
||
|
|
||
|
import android.text.TextUtils;
|
||
|
|
||
|
import com.fsck.k9.Identity;
|
||
|
|
||
|
|
||
|
public class OpenPgpApiHelper {
|
||
|
|
||
|
/**
|
||
|
* Create an "account name" from the supplied identity for use with the OpenPgp API's
|
||
|
* <code>EXTRA_ACCOUNT_NAME</code>.
|
||
|
*
|
||
|
* @return A string with the following format:
|
||
|
* <code>display name <user@example.com></code>
|
||
|
*
|
||
|
* @see org.openintents.openpgp.util.OpenPgpApi#EXTRA_ACCOUNT_NAME
|
||
|
*/
|
||
|
public static String buildAccountName(Identity identity) {
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
|
||
|
String name = identity.getName();
|
||
|
if (!TextUtils.isEmpty(name)) {
|
||
|
sb.append(name).append(" ");
|
||
|
}
|
||
|
sb.append("<").append(identity.getEmail()).append(">");
|
||
|
|
||
|
return sb.toString();
|
||
|
}
|
||
|
}
|