* Removed the ChainRunnerGetHostByNameHack from libmail.so. Should it still
be needed in Haiku, one could easily fix that. * Automatic whitespace cleanup. * Minor other cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35382 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
/* BMailChainRunner - runs the mail inbound and outbound chains
|
/*
|
||||||
**
|
* Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved.
|
||||||
** Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved.
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
|
//! Runs the mail inbound and outbound chains
|
||||||
|
|
||||||
|
|
||||||
#include <List.h>
|
#include <List.h>
|
||||||
@@ -63,36 +65,6 @@ show_error(alert_type type, const char *message, const char *tag)
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
#if USE_NASTY_SYNC_THREAD_HACK
|
|
||||||
/* There is a memory leak in gethostbyname() that causes structures it
|
|
||||||
allocates not to be freed if they were allocated from a BLooper. So
|
|
||||||
we have this awful hack to ensure that gethostbyname() is not, in
|
|
||||||
fact, called from a BLooper. It works fairly well, too. Hopefully,
|
|
||||||
the OpenBeOS net stack will rectify this problem and then I can
|
|
||||||
turn it off. That will be nice. */
|
|
||||||
|
|
||||||
int32 BMailChainRunner::thread_sync_func(void *arg) {
|
|
||||||
BMailChainRunner *us = ((BMailChainRunner *)(arg));
|
|
||||||
us->Lock();
|
|
||||||
status_t val = us->Init();
|
|
||||||
us->Unlock();
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
status_t BMailChainRunner::init_addons() {
|
|
||||||
thread_id thread = spawn_thread(&thread_sync_func,
|
|
||||||
"ChainRunnerGetHostByNameHack",10,this);
|
|
||||||
Unlock();
|
|
||||||
resume_thread(thread);
|
|
||||||
status_t result;
|
|
||||||
wait_for_thread(thread,&result);
|
|
||||||
Lock();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define init_addons Init
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_EXPORT BMailChainRunner *
|
_EXPORT BMailChainRunner *
|
||||||
GetMailChainRunner(int32 chain_id, BMailStatusWindow *status, bool selfDestruct)
|
GetMailChainRunner(int32 chain_id, BMailStatusWindow *status, bool selfDestruct)
|
||||||
{
|
{
|
||||||
@@ -266,7 +238,10 @@ BMailChainRunner::CallCallbacksFor(BList &list, status_t code)
|
|||||||
list.MakeEmpty();
|
list.MakeEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t BMailChainRunner::Init() {
|
|
||||||
|
status_t
|
||||||
|
BMailChainRunner::Init()
|
||||||
|
{
|
||||||
status_t big_err = B_OK;
|
status_t big_err = B_OK;
|
||||||
BString desc;
|
BString desc;
|
||||||
entry_ref addon;
|
entry_ref addon;
|
||||||
@@ -334,10 +309,10 @@ BMailChainRunner::MessageReceived(BMessage *msg)
|
|||||||
{
|
{
|
||||||
switch (msg->what) {
|
switch (msg->what) {
|
||||||
case 'INIT':
|
case 'INIT':
|
||||||
if (init_addons() == B_OK)
|
if (Init() == B_OK)
|
||||||
break;
|
break;
|
||||||
case B_QUIT_REQUESTED: {
|
case B_QUIT_REQUESTED:
|
||||||
|
{
|
||||||
CallCallbacksFor(chain_cb, B_OK);
|
CallCallbacksFor(chain_cb, B_OK);
|
||||||
// who knows what the code was?
|
// who knows what the code was?
|
||||||
|
|
||||||
@@ -386,14 +361,17 @@ BMailChainRunner::MessageReceived(BMessage *msg)
|
|||||||
Quit();
|
Quit();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'GETM': {
|
case 'GETM':
|
||||||
|
{
|
||||||
BStringList list;
|
BStringList list;
|
||||||
msg->FindFlat("messages",&list);
|
msg->FindFlat("messages",&list);
|
||||||
_statview->SetTotalItems(list.CountItems());
|
_statview->SetTotalItems(list.CountItems());
|
||||||
_statview->SetMaximum(msg->FindInt32("bytes"));
|
_statview->SetMaximum(msg->FindInt32("bytes"));
|
||||||
get_messages(&list); }
|
get_messages(&list);
|
||||||
break;
|
break;
|
||||||
case 'GTSM': {
|
}
|
||||||
|
case 'GTSM':
|
||||||
|
{
|
||||||
const char *uid;
|
const char *uid;
|
||||||
status_t err = B_OK;
|
status_t err = B_OK;
|
||||||
msg->FindString("uid",&uid);
|
msg->FindString("uid",&uid);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ if $(CHECK_MALLOC) {
|
|||||||
SubDirC++Flags -D_NO_INLINE_ASM -fcheck-memory-usage ;
|
SubDirC++Flags -D_NO_INLINE_ASM -fcheck-memory-usage ;
|
||||||
}
|
}
|
||||||
|
|
||||||
SubDirC++Flags -D_BUILDING_mail=1 -DUSE_NASTY_SYNC_THREAD_HACK=1 ;
|
SubDirC++Flags -D_BUILDING_mail=1 ;
|
||||||
|
|
||||||
UsePrivateHeaders textencoding ;
|
UsePrivateHeaders textencoding ;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user