Send minimal client ID

This commit is contained in:
M66B 2019-03-09 16:54:43 +00:00
parent e5c540b6a9
commit 1f6a4a9bd8
2 changed files with 17 additions and 5 deletions

View File

@ -56,6 +56,7 @@ import android.widget.Toast;
import com.android.billingclient.api.BillingClient;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.sun.mail.imap.IMAPStore;
import com.sun.mail.util.FolderClosedIOException;
import com.sun.mail.util.MailConnectException;
@ -83,6 +84,7 @@ import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@ -93,7 +95,6 @@ import javax.mail.AuthenticationFailedException;
import javax.mail.FolderClosedException;
import javax.mail.MessageRemovedException;
import javax.mail.MessagingException;
import javax.mail.Store;
import javax.mail.internet.InternetAddress;
import javax.net.ssl.HttpsURLConnection;
@ -802,8 +803,7 @@ public class Helper {
return true;
}
static void connect(Context context, Store istore, EntityAccount account) throws
MessagingException {
static void connect(Context context, IMAPStore istore, EntityAccount account) throws MessagingException {
try {
istore.connect(account.host, account.port, account.user, account.password);
} catch (AuthenticationFailedException ex) {
@ -814,6 +814,19 @@ public class Helper {
} else
throw ex;
}
// https://www.ietf.org/rfc/rfc2971.txt
if (istore.hasCapability("ID"))
try {
Map<String, String> id = new LinkedHashMap<>();
id.put("name", context.getString(R.string.app_name));
id.put("version", BuildConfig.VERSION_NAME);
Map<String, String> sid = istore.id(id);
for (String key : sid.keySet())
Log.i("Server " + key + "=" + sid.get(key));
} catch (MessagingException ex) {
Log.w(ex);
}
}
static String refreshToken(Context context, String type, String name, String current) {

View File

@ -61,7 +61,6 @@ import javax.mail.MessageRemovedException;
import javax.mail.MessagingException;
import javax.mail.NoSuchProviderException;
import javax.mail.Session;
import javax.mail.Store;
import javax.mail.StoreClosedException;
import javax.mail.UIDFolder;
import javax.mail.event.ConnectionAdapter;
@ -487,7 +486,7 @@ public class ServiceSynchronize extends LifecycleService {
isession.setDebug(debug);
// adb -t 1 logcat | grep "fairemail\|System.out"
final Store istore = isession.getStore(account.getProtocol());
final IMAPStore istore = (IMAPStore) isession.getStore(account.getProtocol());
final Map<EntityFolder, Folder> folders = new HashMap<>();
List<Thread> idlers = new ArrayList<>();