2003-07-29 15:48:06 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2002 Nigel Horne <njh@bandsman.co.uk>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _MESSAGE_H
|
|
|
|
#define _MESSAGE_H
|
|
|
|
|
|
|
|
typedef struct message {
|
|
|
|
mime_type mimeType;
|
2004-09-15 18:11:55 +00:00
|
|
|
encoding_type *encodingTypes;
|
|
|
|
int numberOfEncTypes; /* size of encodingTypes */
|
2003-07-29 15:48:06 +00:00
|
|
|
char *mimeSubtype;
|
2003-08-29 14:27:15 +00:00
|
|
|
int numberOfArguments; /* count of mimeArguments */
|
|
|
|
char **mimeArguments;
|
2003-07-29 15:48:06 +00:00
|
|
|
char *mimeDispositionType; /* probably attachment */
|
|
|
|
text *body_first, *body_last;
|
2004-07-20 14:38:48 +00:00
|
|
|
|
|
|
|
char base64_1, base64_2, base64_3;
|
|
|
|
int base64chars;
|
2004-03-21 09:43:17 +00:00
|
|
|
/*
|
|
|
|
* Markers for the start of various non MIME messages that could
|
|
|
|
* be included within this message
|
|
|
|
*/
|
2004-10-16 17:26:41 +00:00
|
|
|
const text *bounce; /* start of a bounced message */
|
|
|
|
const text *binhex; /* start of a binhex message */
|
|
|
|
const text *yenc; /* start of a yEnc message */
|
|
|
|
const text *encoding; /* is the non MIME message encoded? */
|
|
|
|
const text *dedupedThisFar;
|
2003-07-29 15:48:06 +00:00
|
|
|
} message;
|
|
|
|
|
|
|
|
message *messageCreate(void);
|
|
|
|
void messageDestroy(message *m);
|
|
|
|
void messageReset(message *m);
|
2004-09-17 09:50:32 +00:00
|
|
|
int messageSetMimeType(message *m, const char *type);
|
2003-07-29 15:48:06 +00:00
|
|
|
mime_type messageGetMimeType(const message *m);
|
|
|
|
void messageSetMimeSubtype(message *m, const char *subtype);
|
|
|
|
const char *messageGetMimeSubtype(const message *m);
|
|
|
|
void messageSetDispositionType(message *m, const char *disptype);
|
|
|
|
const char *messageGetDispositionType(const message *m);
|
|
|
|
void messageAddArgument(message *m, const char *arg);
|
|
|
|
void messageAddArguments(message *m, const char *arg);
|
|
|
|
const char *messageFindArgument(const message *m, const char *variable);
|
|
|
|
void messageSetEncoding(message *m, const char *enctype);
|
|
|
|
encoding_type messageGetEncoding(const message *m);
|
2004-08-21 12:01:07 +00:00
|
|
|
int messageAddLine(message *m, line_t *line);
|
2004-11-28 22:06:40 +00:00
|
|
|
int messageAddStr(message *m, const char *data);
|
2004-08-21 12:01:07 +00:00
|
|
|
int messageAddStrAtTop(message *m, const char *data);
|
2003-07-29 15:48:06 +00:00
|
|
|
const text *messageGetBody(const message *m);
|
|
|
|
void messageClean(message *m);
|
2006-04-07 16:30:53 +00:00
|
|
|
unsigned char *base64Flush(message *m, unsigned char *buf);
|
2004-08-22 10:37:32 +00:00
|
|
|
fileblob *messageToFileblob(message *m, const char *dir);
|
2004-08-22 15:10:32 +00:00
|
|
|
blob *messageToBlob(message *m);
|
2004-07-20 14:38:48 +00:00
|
|
|
text *messageToText(message *m);
|
2004-11-22 15:19:43 +00:00
|
|
|
const text *binhexBegin(const message *m);
|
2004-09-17 13:48:38 +00:00
|
|
|
const text *yEncBegin(const message *m);
|
2004-01-28 10:16:51 +00:00
|
|
|
const text *bounceBegin(const message *m);
|
2004-03-21 17:21:12 +00:00
|
|
|
const text *encodingLine(const message *m);
|
2004-08-23 13:17:09 +00:00
|
|
|
void messageClearMarkers(message *m);
|
2005-03-07 11:26:18 +00:00
|
|
|
unsigned char *decodeLine(message *m, encoding_type enctype, const char *line, unsigned char *buf, size_t buflen);
|
2005-03-18 18:12:25 +00:00
|
|
|
int isuuencodebegin(const char *line);
|
2003-07-29 15:48:06 +00:00
|
|
|
|
|
|
|
#endif /*_MESSAGE_H*/
|