зеркало из https://github.com/mozilla/pjs.git
add new isServer attribute
This commit is contained in:
Родитель
3c8eb44968
Коммит
292c8e0141
|
@ -61,6 +61,7 @@ interface nsIMsgFolder : nsIFolder {
|
|||
readonly attribute boolean showDeletedMessages;
|
||||
|
||||
readonly attribute nsIMsgIncomingServer server;
|
||||
readonly attribute boolean isServer;
|
||||
|
||||
void OnCloseFolder ();
|
||||
void Delete ();
|
||||
|
|
|
@ -51,7 +51,8 @@ nsMsgFolder::nsMsgFolder(void)
|
|||
mDepth(0),
|
||||
mPrefFlags(0),
|
||||
mBiffState(nsMsgBiffState_NoMail),
|
||||
mNumNewBiffMessages(0)
|
||||
mNumNewBiffMessages(0),
|
||||
mIsServer(PR_FALSE)
|
||||
{
|
||||
// NS_INIT_REFCNT(); done by superclass
|
||||
|
||||
|
@ -95,7 +96,8 @@ NS_IMETHODIMP nsMsgFolder::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
{
|
||||
if (!aInstancePtr) return NS_ERROR_NULL_POINTER;
|
||||
*aInstancePtr = nsnull;
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsIMsgFolder>::GetIID()) || aIID.Equals(nsCOMTypeInfo<nsIFolder>::GetIID()))
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsIMsgFolder>::GetIID()) ||
|
||||
aIID.Equals(nsCOMTypeInfo<nsIFolder>::GetIID()))
|
||||
{
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIMsgFolder*, this);
|
||||
}
|
||||
|
@ -109,6 +111,35 @@ NS_IMETHODIMP nsMsgFolder::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
return nsRDFResource::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolder::Init(const char* aURI)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// this parsing is totally hacky. we really should generalize this,
|
||||
// but I'm not going to do this until we can eliminate the
|
||||
// nsXXX2Name/etc routines
|
||||
// -alecf
|
||||
|
||||
// do initial parsing of the URI
|
||||
const char *cp=aURI;
|
||||
|
||||
// skip to initial //
|
||||
while (*cp && (*cp != '/'))
|
||||
cp++;
|
||||
|
||||
// skip past //
|
||||
while (*cp && (*cp == '/'))
|
||||
cp++;
|
||||
|
||||
if (PL_strchr(cp, '/'))
|
||||
mIsServer = PR_FALSE;
|
||||
else
|
||||
mIsServer = PR_TRUE;
|
||||
|
||||
return nsRDFResource::Init(aURI);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef PRBool
|
||||
|
@ -295,6 +326,12 @@ NS_IMETHODIMP nsMsgFolder::BuildUrl(nsMsgDatabase *db, nsMsgKey key, char ** url
|
|||
|
||||
NS_IMETHODIMP nsMsgFolder::GetServer(nsIMsgIncomingServer ** aServer)
|
||||
{
|
||||
|
||||
/* this should really just:
|
||||
- truncate the URI
|
||||
- GetResource on the URI
|
||||
- QueryInterface to nsIMsgIncomingServer::GetIID()
|
||||
*/
|
||||
nsresult rv = NS_OK;
|
||||
if (!m_server) // if we haven't fetched the server yet....
|
||||
{
|
||||
|
@ -340,6 +377,14 @@ NS_IMETHODIMP nsMsgFolder::GetServer(nsIMsgIncomingServer ** aServer)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolder::GetIsServer(PRBool *aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = mIsServer;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetPrettyName(PRUnichar ** name)
|
||||
{
|
||||
if (!name)
|
||||
|
@ -1324,20 +1369,20 @@ NS_IMETHODIMP nsMsgFolder::UserNeedsToAuthenticateForFolder(PRBool displayOnly,
|
|||
#if 0
|
||||
NS_IMETHODIMP nsMsgFolder::GetUsername(char **userName)
|
||||
{
|
||||
if(!userName)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
nsresult rv = GetServer(getter_AddRefs(server));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*userName = "";
|
||||
return NS_OK;
|
||||
return server->GetUsername(userName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetHostname(char **hostName)
|
||||
{
|
||||
if(!hostName)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
nsresult rv = GetServer(getter_AddRefs(server));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*hostName = "";
|
||||
return NS_OK;
|
||||
return server->GetHostname(hostName);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -45,6 +45,10 @@ public:
|
|||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIRDFResource
|
||||
|
||||
NS_IMETHOD Init(const char *aURI);
|
||||
|
||||
// nsICollection methods:
|
||||
NS_IMETHOD Count(PRUint32 *result) {
|
||||
return mSubFolders->Count(result);
|
||||
|
@ -93,6 +97,7 @@ public:
|
|||
NS_IMETHOD HasMessage(nsIMessage *message, PRBool *hasMessage);
|
||||
|
||||
NS_IMETHOD GetServer(nsIMsgIncomingServer ** aServer);
|
||||
NS_IMETHOD GetIsServer(PRBool *aResult);
|
||||
|
||||
|
||||
NS_IMETHOD GetPrettyName(PRUnichar ** name);
|
||||
|
@ -345,6 +350,7 @@ protected:
|
|||
PRInt32 mNumNewBiffMessages;
|
||||
|
||||
PRBool mIsCachable;
|
||||
PRBool mIsServer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче