/*
 *  Copyright (C) 2007-2008 CMM Sigma Andrzej Chmielowiec 
<cmmsigma@cmmsigma.eu>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2
 *  as published by the Free Software Foundation.
 *
 *  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.
 */

// MessageStructs.h:
//
//////////////////////////////////////////////////////////////////////

#ifndef MESSAGESTRUCTS_H
#define MESSAGESTRUCTS_H

#include <QFile>
#include <QStringList>

struct UserItem
{
	QString user;
	QString name;

	UserItem();
	UserItem(const QString &_user);
	UserItem(const QString &_user, const QString &_name);

	void clear();
	bool isEmpty();
};


struct AttachmentItem
{
	QByteArray body;
	QString file;

	AttachmentItem();
	AttachmentItem(const QByteArray &_body, const QString &_file);
};


class MessageItem
{
public:
	QString from;
	QStringList to;
	QStringList cc;
	QString subject;
	QString body;
	QString date;
	QList<AttachmentItem> atts;
	QString uid;
	QString msgId;
	QList<MessageItem> subMessages;

	MessageItem();
	const MessageItem& operator=(const MessageItem& src);
	MessageItem(const MessageItem& src);
	void clear();
	void copyTo(const MessageItem& src);
};


//////////////////////////////////////////////////////////////////////
// class tr - traces
//////////////////////////////////////////////////////////////////////
/*
class tr
{
public:
	static void trace(const char *msg, ...)
	{
		char buf[4096];
		buf[4095] = '\0';
		va_list ap;
		va_start(ap, msg);
		if (msg)
			qvsnprintf(buf, 4095, msg, ap);
		va_end(ap);


		QFile file("C:\\!trace.txt");
		file.open(QFile::Append);
		file.write(buf);
		file.write("\r\n");
		file.close();
	}

	
	static void trace(QString text)
	{
		QFile file("C:\\!trace.txt");
		file.open(QFile::Append);
		file.write(qPrintable(text));
		file.write("\r\n");
		file.close();
	}
};
*/
#endif
