зеркало из https://github.com/mozilla/gecko-dev.git
Add code to add the incoming server to the host session list when parsing it.
This commit is contained in:
Родитель
930195d95c
Коммит
c1260a7df1
|
@ -19,6 +19,7 @@
|
|||
#include "msgCore.h"
|
||||
|
||||
#include "nsIImapIncomingServer.h"
|
||||
#include "nsIImapHostSessionList.h"
|
||||
#include "nsImapIncomingServer.h"
|
||||
#include "nsMsgIncomingServer.h"
|
||||
|
||||
|
@ -27,6 +28,7 @@
|
|||
#include "prmem.h"
|
||||
#include "plstr.h"
|
||||
|
||||
static NS_DEFINE_CID(kCImapHostSessionList, NS_IIMAPHOSTSESSIONLIST_CID);
|
||||
|
||||
/* get some implementation from nsMsgIncomingServer */
|
||||
class nsImapIncomingServer : public nsMsgIncomingServer,
|
||||
|
@ -42,6 +44,7 @@ public:
|
|||
// we support the nsIImapIncomingServer interface
|
||||
NS_IMETHOD GetRootFolderPath(char **);
|
||||
NS_IMETHOD SetRootFolderPath(char *);
|
||||
NS_IMETHOD SetKey(char * aKey); // override nsMsgIncomingServer's implementation...
|
||||
|
||||
private:
|
||||
char *m_rootFolderPath;
|
||||
|
@ -64,13 +67,39 @@ nsImapIncomingServer::~nsImapIncomingServer()
|
|||
|
||||
NS_IMPL_SERVERPREF_STR(nsImapIncomingServer, RootFolderPath, "directory")
|
||||
|
||||
NS_IMETHODIMP nsImapIncomingServer::SetKey(char * aKey) // override nsMsgIncomingServer's implementation...
|
||||
{
|
||||
nsMsgIncomingServer::SetKey(aKey);
|
||||
|
||||
// okay now that the key has been set, we need to add ourselves to the
|
||||
// host session list...
|
||||
|
||||
// every time we create an imap incoming server, we need to add it to the
|
||||
// host session list!!
|
||||
|
||||
// get the user and host name and the fields to the host session list.
|
||||
char * userName = nsnull;
|
||||
char * hostName = nsnull;
|
||||
|
||||
nsresult rv = GetHostName(&hostName);
|
||||
rv = GetUserName(&userName);
|
||||
|
||||
NS_WITH_SERVICE(nsIImapHostSessionList, hostSession, kCImapHostSessionList, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
hostSession->AddHostToList(hostName, userName);
|
||||
PR_FREEIF(userName);
|
||||
PR_FREEIF(hostName);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult NS_NewImapIncomingServer(const nsIID& iid,
|
||||
void **result)
|
||||
{
|
||||
nsImapIncomingServer *server;
|
||||
if (!result) return NS_ERROR_NULL_POINTER;
|
||||
server = new nsImapIncomingServer();
|
||||
|
||||
return server->QueryInterface(iid, result);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче