Use correct last contacted time

pull/153/head
M66B 6 years ago
parent b2ea687159
commit c5bd6dd609

@ -1234,14 +1234,14 @@ class Core {
contact.name = name; contact.name = name;
contact.avatar = message.avatar; contact.avatar = message.avatar;
contact.times_contacted = 1; contact.times_contacted = 1;
contact.last_contacted = new Date().getTime(); contact.last_contacted = message.received;
contact.id = db.contact().insertContact(contact); contact.id = db.contact().insertContact(contact);
Log.i("Inserted sender contact=" + contact); Log.i("Inserted sender contact=" + contact);
} else { } else {
contact.name = name; contact.name = name;
contact.avatar = message.avatar; contact.avatar = message.avatar;
contact.times_contacted++; contact.times_contacted++;
contact.last_contacted = new Date().getTime(); contact.last_contacted = message.received;
db.contact().updateContact(contact); db.contact().updateContact(contact);
Log.i("Updated sender contact=" + contact); Log.i("Updated sender contact=" + contact);
} }

@ -314,6 +314,7 @@ public class ServiceSend extends LifecycleService {
// Send message // Send message
Address[] to = imessage.getAllRecipients(); Address[] to = imessage.getAllRecipients();
itransport.sendMessage(imessage, to); itransport.sendMessage(imessage, to);
long time = new Date().getTime();
EntityLog.log(this, "Sent via " + ident.host + "/" + ident.user + EntityLog.log(this, "Sent via " + ident.host + "/" + ident.user +
" to " + TextUtils.join(", ", to)); " to " + TextUtils.join(", ", to));
@ -328,7 +329,7 @@ public class ServiceSend extends LifecycleService {
try { try {
db.beginTransaction(); db.beginTransaction();
db.message().setMessageSent(message.id, imessage.getSentDate().getTime()); db.message().setMessageSent(message.id, time);
db.message().setMessageSeen(message.id, true); db.message().setMessageSeen(message.id, true);
db.message().setMessageUiSeen(message.id, true); db.message().setMessageUiSeen(message.id, true);
db.message().setMessageError(message.id, null); db.message().setMessageError(message.id, null);
@ -373,14 +374,14 @@ public class ServiceSend extends LifecycleService {
contact.name = name; contact.name = name;
contact.avatar = message.avatar; contact.avatar = message.avatar;
contact.times_contacted = 1; contact.times_contacted = 1;
contact.last_contacted = new Date().getTime(); contact.last_contacted = time;
contact.id = db.contact().insertContact(contact); contact.id = db.contact().insertContact(contact);
Log.i("Inserted recipient contact=" + contact); Log.i("Inserted recipient contact=" + contact);
} else { } else {
contact.name = name; contact.name = name;
contact.avatar = message.avatar; contact.avatar = message.avatar;
contact.times_contacted++; contact.times_contacted++;
contact.last_contacted = new Date().getTime(); contact.last_contacted = time;
db.contact().updateContact(contact); db.contact().updateContact(contact);
Log.i("Updated recipient contact=" + contact); Log.i("Updated recipient contact=" + contact);
} }

Loading…
Cancel
Save