#include <andrewos.h>
#include <class.h>
#include <msgmlbox.eh>

boolean msgmailbox__InitializeObject(classid, self)
struct classheader *classid;
struct msgmailbox *self;
{
    self->folderName = NULL;
    return TRUE;
}

void msgmailbox__FinalizeObject(classid, self)
struct classheader *classid;
struct msgmailbox *self;
{
    if (self->folderName != NULL) {
	free(self->folderName);
    }
}

boolean msgmailbox__IsThereNewMail(self)
struct msgmailbox *self;
{
    return msgmailbox_CountOfNewMail(self) != 0;
}

long msgmailbox__CountOfNewMail(self)
struct msgmailbox *self;
{
    return 0;
}

boolean msgmailbox__ProcessNewMail(self, numGood, numBad, numLocked, firstError, errorBuf, bufferSize)
struct msgmailbox *self;
long *numGood;
long *numBad;
long *numLocked;
long *firstError;
char *errorBuf;
long bufferSize;
{
    return FALSE;
}

void msgmailbox__SetDatabase(self, database)
struct msgmailbox *self;
struct msgdatabase *database;
{
    self->database = database;
}

struct msgdatabase *msgmailbox__GetDatabase(self)
struct msgmailbox *self;
{
    return self->database;
}

void msgmailbox__SetFolderName(self, folderName)
struct msgmailbox *self;
char *folderName;
{
    if (self->folderName != NULL)  {
	free(self->folderName);
    }

    if (folderName == NULL)  {
	self->folderName = NULL;
    }
    else {
	char *newFolderName = (char *) malloc(strlen(folderName) + 1);

	if (newFolderName != NULL) {
	    strcpy(newFolderName, folderName);
	}
	self->folderName = newFolderName;
    }
}
	
char *msgmailbox__GetFolderName(self)
struct msgmailbox *self;
{
    return self->folderName;
}
