From a72c1249cee354f27967b266028a68bf0990eee4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 6 Jun 2019 20:42:00 +0300 Subject: Sessions: there's no need to store bunch of empty messages in database --- plugins/Sessions/Src/Utils.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'plugins/Sessions/Src/Utils.cpp') diff --git a/plugins/Sessions/Src/Utils.cpp b/plugins/Sessions/Src/Utils.cpp index 6a5cf602b5..67a9750877 100644 --- a/plugins/Sessions/Src/Utils.cpp +++ b/plugins/Sessions/Src/Utils.cpp @@ -23,6 +23,9 @@ void AddSessionMark(MCONTACT hContact, int mode, char bit) { if (mode == 0) { CMStringA szValue(g_plugin.getMStringA(hContact, "LastSessionsMarks")); + if (bit == '0' && szValue.IsEmpty()) + return; + szValue.Insert(0, bit); szValue.Truncate(g_ses_limit); g_plugin.setString(hContact, "LastSessionsMarks", szValue); @@ -92,6 +95,9 @@ void AddInSessionOrder(MCONTACT hContact, int mode, int ordernum, int writemode) if (mode == 0) { CMStringA szValue(g_plugin.getMStringA(hContact, "LastSessionsOrder")); + if (writemode == 0 && szValue.IsEmpty()) + return; + szValue.Insert(0, buf); szValue.Truncate(g_ses_limit * 2); g_plugin.setString(hContact, "LastSessionsOrder", szValue); -- cgit v1.2.3