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 * EXTRA_ACCOUNT_NAME. * * @return A string with the following format: * display name <user@example.com> * * @see org.openintents.openpgp.util.OpenPgpApi#EXTRA_ACCOUNT_NAME */ public static String buildUserId(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(); } }