#import "MSMail.h"
#import "FileName.h"
#import "support.h"
#include <sys/file.h>

#define START_STR "#<begin uuencode>\n"
#define END_STR "#<end uuencode>\n\n"

@implementation MSMail

- buildBody
{
   int x, cnt, startLen, endLen;
   id aFile;

   [super buildBody];
   
   startLen = strlen(START_STR);
   endLen = strlen(END_STR);

   for(x = 0, cnt = [attachments count]; x < cnt; x++)
   {
      fwrite(START_STR, 1, startLen, fp);
      aFile = [attachments objectAt: x];
      uuencode([aFile basename],[aFile stringValue], fp, 0666);
      fwrite(END_STR, 1, endLen, fp);
   }

   return self;
}

-(BOOL)supportsAttachments
{
   return YES;
}

@end
