summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/Clist_modern/src/modern_clc.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_contact.cpp7
2 files changed, 9 insertions, 2 deletions
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp
index 27b0dbbbdb..828ee36779 100644
--- a/plugins/Clist_modern/src/modern_clc.cpp
+++ b/plugins/Clist_modern/src/modern_clc.cpp
@@ -162,8 +162,10 @@ static int clcHookDbEventAdded(WPARAM hContact, LPARAM hDbEvent)
if ((dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE) && !(dbei.flags & DBEF_SENT)) {
g_plugin.setDword(hContact, "mf_lastmsg", dbei.timestamp);
ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact);
- if (pdnce)
+ if (pdnce) {
pdnce->dwLastMsgTime = dbei.timestamp;
+ Clist_Broadcast(CLM_AUTOREBUILD, hContact, 0);
+ }
}
}
return 0;
diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp
index 53a4ba2e22..eb4285f2eb 100644
--- a/plugins/Clist_modern/src/modern_contact.cpp
+++ b/plugins/Clist_modern/src/modern_contact.cpp
@@ -119,7 +119,12 @@ int cliCompareContacts(const ClcContact *contact1, const ClcContact *contact2)
break;
case SORTBY_LASTMSG: // last message
- r = (int)CompareContacts2_getLMTime(contact2->hContact) - (int)CompareContacts2_getLMTime(contact1->hContact);
+ if (c1->dwLastMsgTime == -1) c1->dwLastMsgTime = CompareContacts2_getLMTime(contact1->hContact);
+ if (c2->dwLastMsgTime == -1) c2->dwLastMsgTime = CompareContacts2_getLMTime(contact2->hContact);
+ if (c1->dwLastMsgTime == c2->dwLastMsgTime)
+ continue;
+
+ r = (c1->dwLastMsgTime < c2->dwLastMsgTime) ? 1 : -1; // reverse sort order
break;
case SORTBY_PROTO: