aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Christopher Hockley <christopher@putcocoa.in>2015-02-11 17:49:29 +0100
committerGravatar Christopher Hockley <christopher@putcocoa.in>2015-02-11 17:49:29 +0100
commitfbd87ecf9b457d7bf4bbf062775ea03ffccb17aa (patch)
treedd00be681823751c4da00601bef6a98eb4c87b88
parent808f4ad0840a80b4ca49e0919812a3a757a24a16 (diff)
AccountValidator Fixes
-rw-r--r--src/core/provider/MCAccountValidator.cpp21
-rw-r--r--src/core/provider/MCMXRecordResolverOperation.cpp2
-rw-r--r--src/objc/provider/MCOAccountValidator.mm6
3 files changed, 14 insertions, 15 deletions
diff --git a/src/core/provider/MCAccountValidator.cpp b/src/core/provider/MCAccountValidator.cpp
index a5c5859b..3ca5bfbb 100644
--- a/src/core/provider/MCAccountValidator.cpp
+++ b/src/core/provider/MCAccountValidator.cpp
@@ -121,6 +121,9 @@ void AccountValidator::cancel()
if (mQueue != NULL)
mQueue->cancelAllOperations();
+ MC_SAFE_RELEASE(mOperation);
+ MC_SAFE_RELEASE(mResolveMX);
+ MC_SAFE_RELEASE(mQueue);
MC_SAFE_RELEASE(mImapSession);
MC_SAFE_RELEASE(mPopSession);
MC_SAFE_RELEASE(mSmtpSession);
@@ -215,12 +218,9 @@ void AccountValidator::checkNextHost()
{
if (mCurrentServiceTested == SERVICE_IMAP) {
if (mCurrentServiceIndex < mImapServices->count()) {
-
- if (mImapSession == NULL) {
- mImapSession = new IMAPAsyncSession();
- mImapSession->setUsername(mUsername);
- mImapSession->setPassword(mPassword);
- }
+ mImapSession = new IMAPAsyncSession();
+ mImapSession->setUsername(mUsername);
+ mImapSession->setPassword(mPassword);
mImapServer = (NetService *) mImapServices->objectAtIndex(mCurrentServiceIndex);
mImapSession->setHostname(mImapServer->hostname());
@@ -230,7 +230,6 @@ void AccountValidator::checkNextHost()
mOperation = (IMAPOperation *)mImapSession->checkAccountOperation();
mOperation->setCallback((OperationCallback *)this);
mOperation->start();
-
}
else {
mCurrentServiceTested ++;
@@ -273,7 +272,6 @@ void AccountValidator::checkNextHost()
mOperation = (SMTPOperation *)smtpSession->checkAccountOperation(Address::addressWithMailbox(mEmail));
mOperation->setCallback((OperationCallback *)this);
mOperation->start();
-
}
else {
mCurrentServiceTested ++;
@@ -282,8 +280,6 @@ void AccountValidator::checkNextHost()
}
}
else {
- MC_SAFE_RELEASE(mPopSession);
- MC_SAFE_RELEASE(mSmtpSession);
callback()->operationFinished(this);
}
}
@@ -295,16 +291,21 @@ void AccountValidator::checkNextHostDone()
if (mCurrentServiceTested == SERVICE_IMAP) {
mImapError = ((IMAPOperation *)mOperation)->error();
error = mImapError;
+ MC_SAFE_RELEASE(mImapSession);
}
else if (mCurrentServiceTested == SERVICE_POP) {
mPopError = ((POPOperation *)mOperation)->error();
error = mPopError;
+ MC_SAFE_RELEASE(mPopSession);
}
else if (mCurrentServiceTested == SERVICE_SMTP) {
mSmtpError = ((SMTPOperation *)mOperation)->error();
error = mSmtpError;
+ MC_SAFE_RELEASE(mSmtpSession);
}
+ MC_SAFE_RELEASE(mOperation);
+
if (error == ErrorNone) {
mCurrentServiceTested ++;
}
diff --git a/src/core/provider/MCMXRecordResolverOperation.cpp b/src/core/provider/MCMXRecordResolverOperation.cpp
index 4385ec8b..aa2d5448 100644
--- a/src/core/provider/MCMXRecordResolverOperation.cpp
+++ b/src/core/provider/MCMXRecordResolverOperation.cpp
@@ -53,8 +53,6 @@ void MXRecordResolverOperation::main()
(ns_initparse(response, len, &handle) >= 0) and
(ns_msg_count(handle, ns_s_an) >= 0)) {
-
-
for (int ns_index = 0; ns_index < len; ns_index++) {
if (ns_parserr(&handle, ns_s_an, ns_index, &rr)) {
/* WARN: ns_parserr failed */
diff --git a/src/objc/provider/MCOAccountValidator.mm b/src/objc/provider/MCOAccountValidator.mm
index 172fd8a6..b8260486 100644
--- a/src/objc/provider/MCOAccountValidator.mm
+++ b/src/objc/provider/MCOAccountValidator.mm
@@ -74,9 +74,9 @@ MCO_OBJC_SYNTHESIZE_STRING(setOAuth2Token, OAuth2Token)
- (id) init
{
- mailcore::AccountValidator * msg = new mailcore::AccountValidator();
- self = [self initWithMCValidator:msg];
- msg->release();
+ mailcore::AccountValidator * validator = new mailcore::AccountValidator();
+ self = [self initWithMCValidator:validator];
+ validator->release();
return self;
}