} else if (mClassID.Equals(kNNTPProtocolCID)) { nsNNTPProtocol *protocol = new nsNNTPProtocol(); if (protocol) rv = protocol->QueryInterface(aIID, aResult); else rv = NS_ERROR_OUT_OF_MEMORY;  if (NS_FAILED(rv) && protocol) delete protocol; } else if (mClassID.Equals(kNNTPNewsgroupPostCID)) { nsNNTPNewsgroupPost *newsgroupPost = new nsNNTPNewsgroupPost(); if (newsgroupPost) rv = newsgroupPost->QueryInterface(aIID, aResult); else rv = NS_ERROR_OUT_OF_MEMORY;  if (NS_FAILED(rv) && newsgroupPost) delete newsgroupPost; } else if (mClassID.Equals(kNNTPArticleListCID)) { nsNNTPArticleList *articleList = new nsNNTPArticleList(); if (articleList) rv = articleList->QueryInterface(aIID, aResult); else rv = NS_ERROR_OUT_OF_MEMORY;  if (NS_FAILED(rv) && articleList) delete articleList; } else if (mClassID.Equals(kNNTPNewsgroupListCID)) { nsNNTPNewsgroupList *newsgroupList = new nsNNTPNewsgroupList(); if (newsgroupList) rv = newsgroupList->QueryInterface(aIID, aResult); else rv = NS_ERROR_OUT_OF_MEMORY;  if (NS_FAILED(rv) && newsgroupList) delete newsgroupList; } else if (mClassID.Equals(kNNTPNewsgroupCID)) { nsNNTPNewsgroup *newsgroup = new nsNNTPNewsgroup(); if (newsgroup) rv = newsgroup->QueryInterface(aIID, aResult); else rv = NS_ERROR_OUT_OF_MEMORY;  if (NS_FAILED(rv) && newsgroup) delete newsgroup;
nsresult nsMsgNewsFactory::CreateInstance(nsISupports * /* aOuter */,                                          const nsIID &aIID,                                          void **aResult)  {  	nsresult rv = NS_OK;  	if (aResult == nsnull)  		return NS_ERROR_NULL_POINTER;  	*aResult = nsnull;    	// ClassID check happens here	// Whenever you add a new class that supports an interface, plug it in here!!!	// do they want a news datasource ?	if (mClassID.Equals(kNntpUrlCID)) 	{		    nsNntpUrl *url = new nsNntpUrl(nsnull, nsnull);    if (url)      rv = url->QueryInterface(aIID, aResult);    else      rv = NS_ERROR_OUT_OF_MEMORY;        if (NS_FAILED(rv) && url)       delete url;	}	else if (mClassID.Equals(kNntpServiceCID))	{    nsNntpService *service = new nsNntpService();    if (service)      rv = service->QueryInterface(aIID, aResult);    else      rv = NS_ERROR_OUT_OF_MEMORY;        if (NS_FAILED(rv) && service)       delete service;	} 	else if (mClassID.Equals(kNewsFolderResourceCID)) 	{    nsMsgNewsFolder *folder = new nsMsgNewsFolder();    if (folder)      rv = folder->QueryInterface(aIID, aResult);    else      rv = NS_ERROR_OUT_OF_MEMORY;        if (NS_FAILED(rv) && folder)       delete folder;	} 	else if (mClassID.Equals(kNntpIncomingServerCID)) 	{    rv = NS_NewNntpIncomingServer(nsISupports::GetIID(), aResult);	}	else if (mClassID.Equals(kNewsMessageResourceCID))  	{    nsNewsMessage *message = new nsNewsMessage();    if (message)      rv = message->QueryInterface(aIID, aResult);    else      rv = NS_ERROR_OUT_OF_MEMORY;        if (NS_FAILED(rv) && message)       delete message; 	}	else		return NS_NOINTERFACE;	return rv;}  