diff --git a/src/net/imap/IMAPConnection.cpp b/src/net/imap/IMAPConnection.cpp index 066b5ab5..7ad5a7a7 100644 --- a/src/net/imap/IMAPConnection.cpp +++ b/src/net/imap/IMAPConnection.cpp @@ -66,7 +66,7 @@ namespace imap { IMAPConnection::IMAPConnection(ref store, ref auth) : m_store(store), m_auth(auth), m_socket(NULL), m_parser(NULL), m_tag(NULL), m_hierarchySeparator('\0'), m_state(STATE_NONE), m_timeoutHandler(NULL), - m_secured(false) + m_secured(false), m_firstTag(true) { } @@ -628,6 +628,12 @@ void IMAPConnection::initHierarchySeparator() void IMAPConnection::send(bool tag, const string& what, bool end) { + if (tag && !m_firstTag) + { + ++(*m_tag); + m_firstTag = false; + } + #if VMIME_DEBUG std::ostringstream oss; @@ -657,9 +663,6 @@ void IMAPConnection::send(bool tag, const string& what, bool end) m_socket->send("\r\n"); } #endif - - if (tag) - ++(*m_tag); } diff --git a/vmime/net/imap/IMAPConnection.hpp b/vmime/net/imap/IMAPConnection.hpp index 29a78055..cb22b416 100644 --- a/vmime/net/imap/IMAPConnection.hpp +++ b/vmime/net/imap/IMAPConnection.hpp @@ -133,6 +133,8 @@ private: bool m_secured; ref m_cntInfos; + bool m_firstTag; + void internalDisconnect();