mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-05 08:33:37 +02:00
Allow synchronization of sent folder to rebuild local contacts
This commit is contained in:
@@ -26,7 +26,6 @@ import android.net.ConnectivityManager;
|
||||
import android.net.Network;
|
||||
import android.net.NetworkCapabilities;
|
||||
import android.net.NetworkRequest;
|
||||
import android.net.Uri;
|
||||
import android.os.PowerManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -363,32 +362,6 @@ public class ServiceSend extends LifecycleService {
|
||||
|
||||
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
nm.cancel("send", message.identity.intValue());
|
||||
|
||||
if (message.to != null)
|
||||
for (Address recipient : message.to) {
|
||||
String email = ((InternetAddress) recipient).getAddress();
|
||||
String name = ((InternetAddress) recipient).getPersonal();
|
||||
Uri avatar = ContactInfo.getLookupUri(this, new Address[]{recipient});
|
||||
EntityContact contact = db.contact().getContact(EntityContact.TYPE_TO, email);
|
||||
if (contact == null) {
|
||||
contact = new EntityContact();
|
||||
contact.type = EntityContact.TYPE_TO;
|
||||
contact.email = email;
|
||||
contact.name = name;
|
||||
contact.avatar = (avatar == null ? null : avatar.toString());
|
||||
contact.times_contacted = 1;
|
||||
contact.last_contacted = time;
|
||||
contact.id = db.contact().insertContact(contact);
|
||||
Log.i("Inserted recipient contact=" + contact);
|
||||
} else {
|
||||
contact.name = name;
|
||||
contact.avatar = (avatar == null ? null : avatar.toString());
|
||||
contact.times_contacted++;
|
||||
contact.last_contacted = time;
|
||||
db.contact().updateContact(contact);
|
||||
Log.i("Updated recipient contact=" + contact);
|
||||
}
|
||||
}
|
||||
} catch (MessagingException ex) {
|
||||
if (ex instanceof SendFailedException) {
|
||||
SendFailedException sfe = (SendFailedException) ex;
|
||||
|
||||
Reference in New Issue
Block a user