зеркало из https://github.com/mozilla/gecko-dev.git
when local caches are password protected, don't allow views to be created if user hasn't authenticated, r/sr=mscott229732
This commit is contained in:
Родитель
f668bfa612
Коммит
a075f7d8f1
|
@ -152,6 +152,8 @@ NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_MAILNEWS, value)
|
|||
#define NS_MSG_CUSTOM_HEADERS_OVERFLOW NS_MSG_GENERATE_FAILURE(28) //when num of custom headers exceeds 50
|
||||
#define NS_MSG_INVALID_CUSTOM_HEADER NS_MSG_GENERATE_FAILURE(29) //when custom header has invalid characters (as per rfc 2822)
|
||||
|
||||
#define NS_MSG_USER_NOT_AUTHENTICATED NS_MSG_GENERATE_FAILURE(30) // when local caches are password protect and user isn't auth
|
||||
|
||||
#define NS_MSGCOMP_ERROR_BEGIN 12500
|
||||
/* NS_ERROR_NNTP_NO_CROSS_POSTING lives here, and not in nsMsgComposeStringBundle.h, because it is used in news and compose. */
|
||||
#define NS_ERROR_NNTP_NO_CROSS_POSTING NS_MSG_GENERATE_FAILURE(12554)
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#include "nsIMsgCopyService.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsISpamSettings.h"
|
||||
#include "nsIMsgAccountManager.h"
|
||||
|
||||
static NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID);
|
||||
|
||||
|
@ -1722,10 +1723,21 @@ NS_IMETHODIMP nsMsgDBView::Open(nsIMsgFolder *folder, nsMsgViewSortTypeValue sor
|
|||
m_sortOrder = sortOrder;
|
||||
m_sortType = sortType;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager =
|
||||
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
PRBool userNeedsToAuthenticate = PR_FALSE;
|
||||
// if we're PasswordProtectLocalCache, then we need to find out if the server is authenticated.
|
||||
(void) accountManager->GetUserNeedsToAuthenticate(&userNeedsToAuthenticate);
|
||||
if (userNeedsToAuthenticate)
|
||||
return NS_MSG_USER_NOT_AUTHENTICATED;
|
||||
|
||||
if (folder) // search view will have a null folder
|
||||
{
|
||||
|
||||
nsCOMPtr <nsIDBFolderInfo> folderInfo;
|
||||
nsresult rv = folder->GetDBFolderInfoAndDB(getter_AddRefs(folderInfo), getter_AddRefs(m_db));
|
||||
rv = folder->GetDBFolderInfoAndDB(getter_AddRefs(folderInfo), getter_AddRefs(m_db));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
m_db->AddListener(this);
|
||||
m_folder = folder;
|
||||
|
|
Загрузка…
Ссылка в новой задаче