Skip to content

Commit

Permalink
[imap-idle] Check if IDLE connection needs to be established after lo…
Browse files Browse the repository at this point in the history
…gin. Fixes JB#28693

Some servers only advertise full capabilities after sucessful login,
so we need to check if IDLE connection needs to be established in such
cases.
  • Loading branch information
Valério Valério committed May 11, 2015
1 parent 14903b4 commit 3f426ef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions qmf/src/plugins/messageservices/imap/imapclient.cpp
Expand Up @@ -987,6 +987,16 @@ void ImapClient::commandTransition(ImapCommand command, OperationStatus status)
}
#endif
}
// After logging in server capabilities reported may change so we need to
// check if IDLE is already established, when enabled
if (!_waitingForIdle && !_idlesEstablished
&& _protocol.supportsCapability("IDLE")
&& !_waitingForIdleFolderIds.isEmpty()
&& _pushConnectionsReserved) {
_waitingForIdle = true;
monitor(_waitingForIdleFolderIds);
emit updateStatus( tr("Logging in idle connection" ) );
}

bool compressCapable(_protocol.capabilities().contains("COMPRESS=DEFLATE", Qt::CaseInsensitive));
if (!_protocol.encrypted() && QMFALLOWCOMPRESS && compressCapable && !_protocol.compress()) {
Expand Down
2 changes: 1 addition & 1 deletion qmf/src/plugins/messageservices/imap/imapservice.cpp
Expand Up @@ -1936,7 +1936,7 @@ void ImapService::onOnlineStateChanged(bool isOnline)
qMailLog(Messaging) << "IDLE Session: Network state changed: " << isOnline;
if (accountPushEnabled() && isOnline && (!_networkSession || _networkSession->state() != QNetworkSession::Connected)) {
openIdleSession();
} else if (!isOnline) {
} else if (!isOnline) {
onSessionError(QNetworkSession::InvalidConfigurationError);
closeIdleSession();
}
Expand Down

0 comments on commit 3f426ef

Please sign in to comment.