From a6191f957b282e63ccd88e2f605b4e53b7a18e37 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Fri, 15 Jul 2016 23:50:09 +0200 Subject: [PATCH] Typo --- src/mrloginparam.cpp | 16 ++++++++++++---- src/mrloginparam.h | 9 +++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/mrloginparam.cpp b/src/mrloginparam.cpp index 053ff8be..cc7f8422 100644 --- a/src/mrloginparam.cpp +++ b/src/mrloginparam.cpp @@ -38,14 +38,16 @@ MrLoginParam::MrLoginParam(MrMailbox* mailbox) // init pointers (this cannot be done by Clear() as this function checks against NULL pointers) m_email = NULL; + m_mail_server = NULL; + m_mail_port = 0; m_mail_user = NULL; m_mail_pw = NULL; - m_mail_port = 0; + m_send_server = NULL; + m_send_port = 0; m_send_user = NULL; m_send_pw = NULL; - m_send_port = 0; } @@ -58,26 +60,32 @@ MrLoginParam::~MrLoginParam() void MrLoginParam::Clear() { #define FREE_(a) if((a)) { free((a)); (a) = NULL; } + FREE_(m_email) + FREE_(m_mail_server) + m_mail_port = 0; FREE_(m_mail_user) FREE_(m_mail_pw) - m_mail_port = 0; + FREE_(m_send_server) + m_send_port = 0; FREE_(m_send_user) FREE_(m_send_pw) - m_send_port = 0; } void MrLoginParam::ReadFromSql() { Clear(); + m_email = m_mailbox->GetConfig ("email", NULL); + m_mail_server = m_mailbox->GetConfig ("mail_server", NULL); m_mail_port = m_mailbox->GetConfigInt("mail_port", 0); m_mail_user = m_mailbox->GetConfig ("mail_user", NULL); m_mail_pw = m_mailbox->GetConfig ("mail_pw", NULL); + m_send_server = m_mailbox->GetConfig ("send_server", NULL); m_send_port = m_mailbox->GetConfigInt("send_port", 0); m_send_user = m_mailbox->GetConfig ("send_user", NULL); diff --git a/src/mrloginparam.h b/src/mrloginparam.h index f4b66429..fe2144ed 100644 --- a/src/mrloginparam.h +++ b/src/mrloginparam.h @@ -39,18 +39,23 @@ public: MrLoginParam (MrMailbox* mailbox); ~MrLoginParam (); + // clears all data and frees its memory. All pointers are NULL after this function is called. void Clear (); + + // read all data from database, unset values are still NULL after calling ReadFromSql() void ReadFromSql (); + + // tries to set missing parameters from at least m_email and m_mail_pw void Complete (); - // IMAP/POP3 + // IMAP/POP3 - all pointers may be NULL if unset char* m_email; char* m_mail_server; char* m_mail_user; char* m_mail_pw; uint16_t m_mail_port; - // SMTP + // SMTP - all pointers may be NULL if unset char* m_send_server; char* m_send_user; char* m_send_pw;