The MessagingService is now a singleton. Added creation of the MessageDeliverer.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11031 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2005-01-25 15:06:42 +00:00
parent c36e75d1cb
commit 35d70f9eca
2 changed files with 10 additions and 9 deletions

View File

@ -13,6 +13,7 @@
#include "ClipboardHandler.h" #include "ClipboardHandler.h"
#include "EventQueue.h" #include "EventQueue.h"
#include "MessageDeliverer.h"
#include "MessageEvent.h" #include "MessageEvent.h"
#include "MessageRunnerManager.h" #include "MessageRunnerManager.h"
#include "MessagingService.h" #include "MessagingService.h"
@ -47,8 +48,7 @@ Registrar::Registrar(status_t *error)
fMIMEManager(NULL), fMIMEManager(NULL),
fEventQueue(NULL), fEventQueue(NULL),
fMessageRunnerManager(NULL), fMessageRunnerManager(NULL),
fSanityEvent(NULL), fSanityEvent(NULL)
fMessagingService(NULL)
{ {
FUNCTION_START(); FUNCTION_START();
} }
@ -64,7 +64,6 @@ Registrar::~Registrar()
FUNCTION_START(); FUNCTION_START();
Lock(); Lock();
fEventQueue->Die(); fEventQueue->Die();
delete fMessagingService;
delete fMessageRunnerManager; delete fMessageRunnerManager;
delete fEventQueue; delete fEventQueue;
delete fSanityEvent; delete fSanityEvent;
@ -216,6 +215,13 @@ Registrar::ReadyToRun()
{ {
FUNCTION_START(); FUNCTION_START();
// create message deliverer
status_t error = MessageDeliverer::CreateDefault();
if (error != B_OK) {
FATAL(("Registrar::ReadyToRun(): Failed to create the message "
"deliverer: %s\n", strerror(error)));
}
// create event queue // create event queue
fEventQueue = new EventQueue(kEventQueueName); fEventQueue = new EventQueue(kEventQueueName);
@ -238,13 +244,10 @@ Registrar::ReadyToRun()
BRoster::Private().SetTo(be_app_messenger, BMessenger(NULL, fMIMEManager)); BRoster::Private().SetTo(be_app_messenger, BMessenger(NULL, fMIMEManager));
// create the messaging service // create the messaging service
fMessagingService = new MessagingService; error = MessagingService::CreateDefault();
status_t error = fMessagingService->Init();
if (error != B_OK) { if (error != B_OK) {
ERROR(("Registrar::ReadyToRun(): Failed to init messaging service " ERROR(("Registrar::ReadyToRun(): Failed to init messaging service "
"(that's by design when running under R5): %s\n", strerror(error))); "(that's by design when running under R5): %s\n", strerror(error)));
delete fMessagingService;
fMessagingService = NULL;
} }
// create and schedule the sanity message event // create and schedule the sanity message event

View File

@ -33,7 +33,6 @@ class DiskDeviceManager;
class EventQueue; class EventQueue;
class MessageEvent; class MessageEvent;
class MessageRunnerManager; class MessageRunnerManager;
class MessagingService;
class MIMEManager; class MIMEManager;
namespace BPrivate { namespace BPrivate {
@ -60,7 +59,6 @@ private:
EventQueue *fEventQueue; EventQueue *fEventQueue;
MessageRunnerManager *fMessageRunnerManager; MessageRunnerManager *fMessageRunnerManager;
MessageEvent *fSanityEvent; MessageEvent *fSanityEvent;
MessagingService *fMessagingService;
}; };
#endif // REGISTRAR_H #endif // REGISTRAR_H