summaryrefslogtreecommitdiff
path: root/plugins/Sessions/Src/Utils.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-06-06 20:42:00 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-06-06 20:42:00 +0300
commita72c1249cee354f27967b266028a68bf0990eee4 (patch)
treee29c6bacdc4ea7c25ce264b46abec5a4c7d264c5 /plugins/Sessions/Src/Utils.cpp
parentbca86ffd8fd66e71ca873e160d7bb4d35b7830d5 (diff)
Sessions: there's no need to store bunch of empty messages in database
Diffstat (limited to 'plugins/Sessions/Src/Utils.cpp')
-rw-r--r--plugins/Sessions/Src/Utils.cpp6
1 files changed, 6 insertions, 0 deletions
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);