else if (aClass.Equals(kMailboxMessageResourceCID)) { if (!mLocalMessageFactory) rv = NS_NewGenericFactory(getter_AddRefs(mLocalMessageFactory), &nsLocalMessageConstructor); fact = mLocalMessageFactory; }
NS_IMETHODIMP nsMsgLocalModule::GetClassObject(nsIComponentManager *aCompMgr,                               const nsCID& aClass,                               const nsIID& aIID,                               void** r_classObj){    nsresult rv;    // Defensive programming: Initialize *r_classObj in case of error below    if (!r_classObj)        return NS_ERROR_INVALID_POINTER;    *r_classObj = NULL;    // Do one-time-only initialization if necessary    if (!mInitialized)     {        rv = Initialize();        if (NS_FAILED(rv)) // Initialization failed! yikes!            return rv;    }    // Choose the appropriate factory, based on the desired instance    // class type (aClass).    nsCOMPtr<nsIGenericFactory> fact;    if (aClass.Equals(kMailboxUrlCID))    {        if (!mMailboxUrlFactory)            rv = NS_NewGenericFactory(getter_AddRefs(mMailboxUrlFactory), &nsMailboxUrlConstructor);        fact = mMailboxUrlFactory;    }    else if (aClass.Equals(kPop3UrlCID))    {        if (!mPop3UrlFactory)            rv = NS_NewGenericFactory(getter_AddRefs(mPop3UrlFactory), &nsPop3URLConstructor);        fact = mPop3UrlFactory;    }    else if (aClass.Equals(kMailboxParserCID))     {        if (!mMailboxParserFactory)            rv = NS_NewGenericFactory(getter_AddRefs(mMailboxParserFactory), &nsMsgMailboxParserConstructor);        fact = mMailboxParserFactory;    }    else if (aClass.Equals(kMailboxServiceCID))     {        if (!mMailboxServiceFactory)            rv = NS_NewGenericFactory(getter_AddRefs(mMailboxServiceFactory), &nsMailboxServiceConstructor);        fact = mMailboxServiceFactory;    }    else if (aClass.Equals(kPop3ServiceCID))     {        if (!mPop3ServiceFactory)            rv = NS_NewGenericFactory(getter_AddRefs(mPop3ServiceFactory), &nsPop3ServiceConstructor);        fact = mPop3ServiceFactory;    }    else if (aClass.Equals(kNoneServiceCID))     {        if (!mNoneServiceFactory)            rv = NS_NewGenericFactory(getter_AddRefs(mNoneServiceFactory), &nsNoneServiceConstructor);        fact = mNoneServiceFactory;    }    else if (aClass.Equals(kLocalMailFolderResourceCID))     {        if (!mLocalMailFolderFactory)            rv = NS_NewGenericFactory(getter_AddRefs(mLocalMailFolderFactory), &nsMsgLocalMailFolderConstructor);        fact = mLocalMailFolderFactory;    }    else if (aClass.Equals(kMailboxMessageResourceCID))     {        if (!mLocalMessageFactory)            rv = NS_NewGenericFactory(getter_AddRefs(mLocalMessageFactory), &nsLocalMessageConstructor);        fact = mLocalMessageFactory;    }    else if (aClass.Equals(kParseMailMsgStateCID))     {        if (!mParseMailMsgStateFactory)            rv = NS_NewGenericFactory(getter_AddRefs(mParseMailMsgStateFactory), &nsParseMailMessageStateConstructor);        fact = mParseMailMsgStateFactory;    }    else if (aClass.Equals(kPop3IncomingServerCID))     {        if (!mPop3IncomingServerFactory)            rv = NS_NewGenericFactory(getter_AddRefs(mPop3IncomingServerFactory), &nsPop3IncomingServerConstructor);        fact = mPop3IncomingServerFactory;    }    else if (aClass.Equals(kNoIncomingServerCID))     {        if (!mNoIncomingServerFactory)            rv = NS_NewGenericFactory(getter_AddRefs(mNoIncomingServerFactory), &nsNoIncomingServerConstructor);        fact = mNoIncomingServerFactory;    }    else if (aClass.Equals(kLocalStringServiceCID))     {      if (!mLocalStringBundleFactory)       rv = NS_NewGenericFactory(getter_AddRefs(mLocalStringBundleFactory), &nsLocalStringServiceConstructor);      fact = mLocalStringBundleFactory;    }        if (fact)        rv = fact->QueryInterface(aIID, r_classObj);    return rv;}