This commit is contained in:
warren%netscape.com 1999-03-09 12:29:08 +00:00
Родитель 1db44452f9
Коммит 1baf19439b
16 изменённых файлов: 288 добавлений и 124 удалений

Просмотреть файл

@ -252,7 +252,14 @@ extern "C" NS_EXPORT nsresult
NSRegisterSelf(nsISupports* aServMgr, const char* path)
{
nsresult rv;
nsService<nsIComponentManager> compMgr(aServMgr, kComponentManagerCID, &rv);
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv)) return rv;
nsIComponentManager* compMgr;
rv = servMgr->GetService(kComponentManagerCID,
nsIComponentManager::GetIID(),
(nsISupports**)&compMgr);
if (NS_FAILED(rv)) return rv;
// register the message folder factory
@ -260,49 +267,52 @@ NSRegisterSelf(nsISupports* aServMgr, const char* path)
"Folder Event",
nsnull,
path, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kCUrlListenerManagerCID,
"UrlListenerManager",
nsnull,
path, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kCMsgRFC822ParserCID,
"RFC822 Parser",
nsnull,
path, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kCMessengerCID,
"Netscape Messenger",
"component://netscape/messenger/application",
path, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kCMessengerBootstrapCID,
"Netscape Messenger Bootstrapper",
"component://netscape/messenger",
path,
PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
#if 0
rv = compMgr->RegisterComponent(kCMsgGroupRecordCID,
nsnull,
nsnull,
path,
PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
#endif
rv = compMgr->RegisterComponent(kCMsgMailSessionCID,
"Mail Session",
nsnull,
path,
PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
#ifdef NS_DEBUG
printf("mailnews registering from %s\n",path);
#endif
done:
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;
}
@ -310,23 +320,34 @@ extern "C" NS_EXPORT nsresult
NSUnregisterSelf(nsISupports* aServMgr, const char* path)
{
nsresult rv;
nsService<nsIComponentManager> compMgr(aServMgr, kComponentManagerCID, &rv);
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv)) return rv;
nsIComponentManager* compMgr;
rv = servMgr->GetService(kComponentManagerCID,
nsIComponentManager::GetIID(),
(nsISupports**)&compMgr);
if (NS_FAILED(rv)) return rv;
rv = compMgr->UnregisterComponent(kCUrlListenerManagerCID, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kCMsgRFC822ParserCID, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kCMessengerCID, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kCMessengerBootstrapCID, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
#if 0
rv = compMgr->UnregisterComponent(kCMsgGroupRecordCID, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
#endif
rv = compMgr->UnregisterComponent(kCMsgFolderEventCID, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kCMsgMailSessionCID, path);
done:
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;
}

Просмотреть файл

@ -98,13 +98,20 @@ nsresult
nsMessengerBootstrap::Initialize()
{
nsresult rv;
nsService<nsIScriptNameSetRegistry> registry(kCScriptNameSetRegistryCID, &rv);
rv = nsServiceManager::GetService(kCScriptNameSetRegistryCID,
nsIScriptNameSetRegistry::GetIID(),
(nsISupports**)&registry);
if (NS_FAILED(rv))
return rv;
nsMessengerNameSet* nameSet = new nsMessengerNameSet();
if (nameSet == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
return registry->AddExternalNameSet(nameSet);
rv = NS_ERROR_OUT_OF_MEMORY;
else
rv = registry->AddExternalNameSet(nameSet);
(void)nsServiceManager::ReleaseService(kCScriptNameSetRegistryCID,
registry);
return rv;
}

Просмотреть файл

@ -204,32 +204,52 @@ extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* aServMgr)
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* aServMgr, const char* path)
{
nsresult rv;
nsService<nsIComponentManager> compMgr(aServMgr, kComponentManagerCID, &rv);
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv)) return rv;
nsIComponentManager* compMgr;
rv = servMgr->GetService(kComponentManagerCID,
nsIComponentManager::GetIID(),
(nsISupports**)&compMgr);
if (NS_FAILED(rv)) return rv;
rv = compMgr->RegisterComponent(kCMsgComposeCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kCSmtpServiceCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kCMsgCompFieldsCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kCMsgSendCID, NULL, NULL, path, PR_TRUE, PR_TRUE);
return rv;
done:
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;
}
extern "C" NS_EXPORT nsresult
NSUnregisterSelf(nsISupports* aServMgr, const char* path)
{
nsresult rv;
nsService<nsIComponentManager> compMgr(aServMgr, kComponentManagerCID, &rv);
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv)) return rv;
nsIComponentManager* compMgr;
rv = servMgr->GetService(kComponentManagerCID,
nsIComponentManager::GetIID(),
(nsISupports**)&compMgr);
if (NS_FAILED(rv)) return rv;
rv = compMgr->UnregisterComponent(kCMsgComposeCID, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kCSmtpServiceCID, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kCMsgCompFieldsCID, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kCMsgSendCID, path);
return rv;
done:
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;
}

Просмотреть файл

@ -153,9 +153,6 @@ nsresult NS_MsgLoadMailtoUrl(nsIURL * aUrl, nsISupports * aConsumer)
if (!aUrl)
return rv;
nsService<nsINetService> pNetService(kNetServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
// turn the url into an smtp url...
rv = aUrl->QueryInterface(nsISmtpUrl::GetIID(), (void **) &smtpUrl);
if (NS_SUCCEEDED(rv) && smtpUrl)
@ -170,15 +167,24 @@ nsresult NS_MsgLoadMailtoUrl(nsIURL * aUrl, nsISupports * aConsumer)
smtpUrl->GetHost(&hostName);
smtpUrl->GetHostPort(&port);
pNetService->CreateSocketTransport(&transport, port, hostName);
if (NS_SUCCEEDED(rv) && transport)
{
// almost there...now create a nntp protocol instance to run the url in...
smtpProtocol = new nsSmtpProtocol(smtpUrl, transport);
if (smtpProtocol == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(smtpProtocol);
smtpProtocol->LoadURL(smtpUrl);
nsINetService* pNetService;
rv = nsServiceManager::GetService(kNetServiceCID,
nsINetService::GetIID(),
(nsISupports**)&pNetService);
if (NS_SUCCEEDED(rv)) {
pNetService->CreateSocketTransport(&transport, port, hostName);
if (NS_SUCCEEDED(rv) && transport)
{
// almost there...now create a nntp protocol instance to run the url in...
smtpProtocol = new nsSmtpProtocol(smtpUrl, transport);
if (smtpProtocol == nsnull)
rv = NS_ERROR_OUT_OF_MEMORY;
else {
NS_ADDREF(smtpProtocol);
smtpProtocol->LoadURL(smtpUrl);
}
}
(void)nsServiceManager::ReleaseService(kNetServiceCID, pNetService);
}
NS_RELEASE(smtpUrl);

Просмотреть файл

@ -424,7 +424,10 @@ int main()
nsComponentManager::RegisterComponent(kEventQueueServiceCID, NULL, NULL, XPCOM_DLL, PR_FALSE, PR_FALSE);
// Create the Event Queue for this thread...
nsService<nsIEventQueueService> pEventQService(kEventQueueServiceCID, &result);
nsIEventQueueService* pEventQService;
result = nsServiceManager::GetService(kEventQueueServiceCID,
nsIEventQueueService::GetIID(),
(nsISupports**)&pNetService);
if (NS_FAILED(result)) return result;
result = pEventQService->CreateThreadEventQueue();

Просмотреть файл

@ -181,35 +181,44 @@ extern "C" NS_EXPORT nsresult
NSRegisterSelf(nsISupports* aServMgr, const char* path)
{
nsresult rv;
nsService<nsIComponentManager> compMgr(aServMgr, kComponentManagerCID, &rv);
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv)) return rv;
nsIComponentManager* compMgr;
rv = servMgr->GetService(kComponentManagerCID,
nsIComponentManager::GetIID(),
(nsISupports**)&compMgr);
if (NS_FAILED(rv)) return rv;
rv = compMgr->RegisterComponent(kCMailboxUrl, nsnull, nsnull,
path, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kCMailboxService, nsnull, nsnull,
path, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kCMailboxParser, nsnull, nsnull,
path, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
// register our RDF datasources:
rv = compMgr->RegisterComponent(kMailNewsDatasourceCID,
"Mail/News Data Source",
NS_RDF_DATASOURCE_PROGID_PREFIX "mailnews",
path, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
// register our RDF resource factories:
rv = compMgr->RegisterComponent(kMailNewsResourceCID,
"Mail/News Resource Factory",
NS_RDF_RESOURCE_FACTORY_PROGID_PREFIX "mailbox",
path, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
done:
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;
}
@ -217,24 +226,32 @@ extern "C" NS_EXPORT nsresult
NSUnregisterSelf(nsISupports* aServMgr, const char* path)
{
nsresult rv;
nsService<nsIComponentManager> compMgr(aServMgr, kComponentManagerCID, &rv);
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv)) return rv;
nsIComponentManager* compMgr;
rv = servMgr->GetService(kComponentManagerCID,
nsIComponentManager::GetIID(),
(nsISupports**)&compMgr);
if (NS_FAILED(rv)) return rv;
rv = compMgr->UnregisterFactory(kCMailboxUrl, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterFactory(kCMailboxService, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterFactory(kCMailboxParser, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kMailNewsDatasourceCID, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kMailNewsResourceCID, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
done:
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;
}

Просмотреть файл

@ -94,35 +94,40 @@ nsMsgLocalMailFolder::CreateSubFolders(void)
rv = GetPath(path);
if (NS_FAILED(rv)) return rv;
nsService<nsIRDFService> rdf(kRDFServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsIRDFService* rdf;
rv = nsServiceManager::GetService(kRDFServiceCID,
nsIRDFService::GetIID(),
(nsISupports**)&rdf);
if (NS_SUCCEEDED(rv)) {
for (nsDirectoryIterator dir(path); dir.Exists(); dir++) {
nsFileSpec currentFolderPath = (nsFileSpec&)dir;
for (nsDirectoryIterator dir(path); dir.Exists(); dir++) {
nsFileSpec currentFolderPath = (nsFileSpec&)dir;
currentFolderName = currentFolderPath.GetLeafName();
if (nsShouldIgnoreFile(currentFolderName))
continue;
currentFolderName = currentFolderPath.GetLeafName();
if (nsShouldIgnoreFile(currentFolderName))
continue;
nsAutoString uri;
uri.Append(mURI);
uri.Append('/');
nsAutoString uri;
uri.Append(mURI);
uri.Append('/');
uri.Append(currentFolderName);
char* uriStr = uri.ToNewCString();
if (uriStr == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
uri.Append(currentFolderName);
char* uriStr = uri.ToNewCString();
if (uriStr == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
// XXX trim off .sbd from uriStr
nsIRDFResource* res;
rv = rdf->GetResource(uriStr, &res);
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(res, &rv));
if (NS_FAILED(rv))
return rv; // continue?
delete[] uriStr;
mSubFolders->AppendElement(folder);
// XXX trim off .sbd from uriStr
nsIRDFResource* res;
rv = rdf->GetResource(uriStr, &res);
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(res, &rv));
if (NS_FAILED(rv))
return rv; // continue?
delete[] uriStr;
mSubFolders->AppendElement(folder);
}
(void)nsServiceManager::ReleaseService(kRDFServiceCID, rdf);
}
return rv;
}

Просмотреть файл

@ -100,11 +100,15 @@ void nsMailboxProtocol::Initialize(nsIURL * aURL)
{
// extract the file name and create a file transport...
const char * fileName = nsnull;
nsService<nsINetService> pNetService(kNetServiceCID, &rv);
nsINetService* pNetService;
rv = nsServiceManager::GetService(kNetServiceCID,
nsINetService::GetIID(),
(nsISupports**)&pNetService);
if (NS_SUCCEEDED(rv) && pNetService)
{
m_runningUrl->GetFile(&fileName);
rv = pNetService->CreateFileSocketTransport(&m_transport, fileName);
(void)nsServiceManager::GetService(kNetServiceCID, pNetService)
}
}
}

Просмотреть файл

@ -519,7 +519,10 @@ nsresult nsMailboxTestDriver::OpenMailbox()
PR_FREEIF(fullFolderPath);
// now ask the mailbox service to parse this mailbox...
nsService<nsIMailboxService> mailboxService(kCMailboxServiceCID, &rv);
nsIMailboxService* mailboxService;
rv = nsServiceManager::GetService(kCMailboxServiceCID,
nsIMailboxService::GetIID(),
(nsISupports**)&mailboxService);
if (NS_SUCCEEDED(rv) && mailboxService)
{
nsIURL * url = nsnull;
@ -527,6 +530,7 @@ nsresult nsMailboxTestDriver::OpenMailbox()
if (url)
url->QueryInterface(nsIMailboxUrl::GetIID(), (void **) &m_url);
NS_IF_RELEASE(url);
(void)nsServiceManager::ReleaseService(kCMailboxServiceCID, mailboxService)
}
else
NS_ASSERTION(PR_FALSE, "unable to acquire a mailbox service...registration problem?");
@ -551,11 +555,14 @@ int main()
nsComponentManager::RegisterComponent(kCMailboxServiceCID, nsnull, nsnull, LOCAL_DLL, PR_TRUE, PR_TRUE);
// Create the Event Queue for this thread...
nsService<nsIEventQueueService> pEventQService(kEventQueueServiceCID, &result);
if (NS_SUCCEEDED(result)) {
// XXX: What if this fails?
result = pEventQService->CreateThreadEventQueue();
}
nsIEventQueueService* pEventQService;
result = nsServiceManager::GetService(kEventQueueServiceCID,
nsIEventQueueService::GetIID(),
(nsISupports**)&pNetService);
if (NS_FAILED(result)) return result;
result = pEventQService->CreateThreadEventQueue();
if (NS_FAILED(result)) return result;
// ask the net lib service for a nsINetStream:
result = NS_NewINetService(&pNetService, NULL);

Просмотреть файл

@ -530,11 +530,14 @@ int main()
nsComponentManager::RegisterComponent(kEventQueueServiceCID, NULL, NULL, XPCOM_DLL, PR_FALSE, PR_FALSE);
// Create the Event Queue for this thread...
nsService<nsIEventQueueService> pEventQService(kEventQueueServiceCID, &result);
if (NS_SUCCEEDED(result)) {
// XXX: What if this fails?
result = pEventQService->CreateThreadEventQueue();
}
nsIEventQueueService* pEventQService;
result = nsServiceManager::GetService(kEventQueueServiceCID,
nsIEventQueueService::GetIID(),
(nsISupports**)&pNetService);
if (NS_FAILED(result)) return result;
result = pEventQService->CreateThreadEventQueue();
if (NS_FAILED(result)) return result;
// ask the net lib service for a nsINetStream:
result = NS_NewINetService(&pNetService, NULL);

Просмотреть файл

@ -221,7 +221,14 @@ extern NET_StreamClass *MIME_MessageConverter(int format_out, void *closure,
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* aServMgr, const char *path)
{
nsresult rv;
nsService<nsIComponentManager> compMgr(aServMgr, kComponentManagerCID, &rv);
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv)) return rv;
nsIComponentManager* compMgr;
rv = servMgr->GetService(kComponentManagerCID,
nsIComponentManager::GetIID(),
(nsISupports**)&compMgr);
if (NS_FAILED(rv)) return rv;
#ifdef NS_DEBUG
@ -229,36 +236,49 @@ extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* aServMgr, const char *
#endif
rv = compMgr->RegisterComponent(kCMimeMimeObjectClassAccessCID, NULL, NULL, path,
PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kCMimeRFC822HTMLConverterCID, NULL, NULL, path,
PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kCMimeHeaderConverterCID, NULL, NULL, path,
PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kINetPluginMIMECID, NULL, PROGRAM_ID, path,
PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
return NS_OK;
if (NS_FAILED(rv)) goto done;
done:
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;
}
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* aServMgr, const char *path)
{
nsresult rv;
nsService<nsIComponentManager> compMgr(aServMgr, kComponentManagerCID, &rv);
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv)) return rv;
nsIComponentManager* compMgr;
rv = servMgr->GetService(kComponentManagerCID,
nsIComponentManager::GetIID(),
(nsISupports**)&compMgr);
if (NS_FAILED(rv)) return rv;
#ifdef NS_DEBUG
printf("*** Mime being unregistered\n");
#endif
rv = compMgr->UnregisterComponent(kCMimeMimeObjectClassAccessCID, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kCMimeRFC822HTMLConverterCID, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kCMimeHeaderConverterCID, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kINetPluginMIMECID, path);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto done;
done:
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;
}

Просмотреть файл

@ -657,11 +657,14 @@ int main()
nsComponentManager::RegisterComponent(kEventQueueServiceCID, NULL, NULL, XPCOM_DLL, PR_FALSE, PR_FALSE);
// Create the Event Queue for this thread...
nsService<nsIEventQueueService> pEventQService(kEventQueueServiceCID, &result);
if (NS_SUCCEEDED(result)) {
// XXX: What if this fails?
result = pEventQService->CreateThreadEventQueue();
}
nsIEventQueueService* pEventQService;
result = nsServiceManager::GetService(kEventQueueServiceCID,
nsIEventQueueService::GetIID(),
(nsISupports**)&pNetService);
if (NS_FAILED(result)) return result;
result = pEventQService->CreateThreadEventQueue();
if (NS_FAILED(result)) return result;
// ask the net lib service for a nsINetStream:
result = NS_NewINetService(&pNetService, NULL);

Просмотреть файл

@ -289,7 +289,12 @@ nsComposeAppCore::NewMessage(const nsString& aUrl)
nsresult rv;
nsString controllerCID;
nsService<nsIAppShellService> appShell(kAppShellServiceCID, &rv);
nsIAppShellService* appShell
rv = nsServiceManager::GetService(kAppShellServiceCID,
nsIAppShellService::GetIID(),
(nsISupports**)&appShell);
if (NS_FAILED(rv)) return rv;
nsIURL* url;
nsIWidget* newWindow;
@ -309,6 +314,7 @@ nsComposeAppCore::NewMessage(const nsString& aUrl)
650); // height
done:
NS_RELEASE(url);
(void)nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
return NS_OK;
}

Просмотреть файл

@ -161,29 +161,47 @@ nsresult
NSRegisterSelf(nsISupports* aServMgr, const char *fullpath)
{
nsresult rv;
nsService<nsIComponentManager> compMgr(aServMgr, kComponentManagerCID, &rv);
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv)) return rv;
nsIComponentManager* compMgr;
rv = servMgr->GetService(kComponentManagerCID,
nsIComponentManager::GetIID(),
(nsISupports**)&compMgr);
#ifdef NS_DEBUG
printf("compose: NSRegisterSelf()\n");
#endif
return compMgr->RegisterComponent(kCComposeAppCoreCID,
"Netscape Mail Composer",
"component://netscape/appcores/composer",
fullpath,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(kCComposeAppCoreCID,
"Netscape Mail Composer",
"component://netscape/appcores/composer",
fullpath,
PR_TRUE, PR_TRUE);
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;
}
nsresult
NSUnregisterSelf(nsISupports* aServMgr, const char *fullpath)
{
nsresult rv;
nsService<nsIComponentManager> compMgr(aServMgr, kComponentManagerCID, &rv);
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv)) return rv;
nsIComponentManager* compMgr;
rv = servMgr->GetService(kComponentManagerCID,
nsIComponentManager::GetIID(),
(nsISupports**)&compMgr);
#ifdef NS_DEBUG
printf("compose: NSUnregisterSelf()\n");
#endif
return compMgr->UnregisterComponent(kCComposeAppCoreCID, fullpath);
rv = compMgr->UnregisterComponent(kCComposeAppCoreCID, fullpath);
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;
}

Просмотреть файл

@ -161,28 +161,48 @@ nsresult
NSRegisterSelf(nsISupports* aServMgr, const char *fullpath)
{
nsresult rv;
nsService<nsIComponentManager> compMgr(aServMgr, kComponentManagerCID, &rv);
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv)) return rv;
nsIComponentManager* compMgr;
rv = servMgr->GetService(kComponentManagerCID,
nsIComponentManager::GetIID(),
(nsISupports**)&compMgr);
if (NS_FAILED(rv)) return rv;
#ifdef NS_DEBUG
printf("messenger: NSRegisterSelf()\n");
#endif
return compMgr->RegisterComponent(kCMsgAppCoreCID,
"Messenger AppCore",
"component://netscape/appcores/messenger",
fullpath,
PR_TRUE, PR_TRUE);
rv = compMgr->RegisterComponent(kCMsgAppCoreCID,
"Messenger AppCore",
"component://netscape/appcores/messenger",
fullpath,
PR_TRUE, PR_TRUE);
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;
}
nsresult
NSUnregisterSelf(nsISupports* aServMgr, const char *fullpath)
{
nsresult rv;
nsService<nsIComponentManager> compMgr(aServMgr, kComponentManagerCID, &rv);
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv)) return rv;
nsIComponentManager* compMgr;
rv = servMgr->GetService(kComponentManagerCID,
nsIComponentManager::GetIID(),
(nsISupports**)&compMgr);
if (NS_FAILED(rv)) return rv;
#ifdef NS_DEBUG
printf("messenger: NSUnregisterSelf()\n");
#endif
return compMgr->UnregisterComponent(kCMsgAppCoreCID, fullpath);
rv = compMgr->UnregisterComponent(kCMsgAppCoreCID, fullpath);
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;
}

Просмотреть файл

@ -229,7 +229,10 @@ nsMsgAppCore::Open3PaneWindow()
nsString controllerCID;
urlstr = "resource:/res/samples/messenger.html";
nsService<nsIAppShellService> appShell(kAppShellServiceCID, &rv);
nsIAppShellService* appShell;
rv = nsServiceManager::GetService(kAppShellServiceCID,
nsIAppShellService::GetIID(),
(nsISupports**)&appShell);
if (NS_FAILED(rv)) goto done;
nsIURL* url;
nsIWidget* newWindow;
@ -248,6 +251,7 @@ nsMsgAppCore::Open3PaneWindow()
200); // height
done:
NS_RELEASE(url);
(void)nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
return NS_OK;
}