You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.8 KiB
101 lines
3.8 KiB
15 years ago
|
/* -*- c++ -*-
|
||
|
request.h
|
||
|
|
||
12 years ago
|
This file is part of kio_smtp, the KDE SMTP tdeioslave.
|
||
15 years ago
|
Copyright (c) 2003 Marc Mutz <mutz@kde.org>
|
||
|
|
||
|
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.
|
||
|
|
||
|
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||
|
|
||
|
In addition, as a special exception, the copyright holders give
|
||
|
permission to link the code of this program with any edition of
|
||
|
the Qt library by Trolltech AS, Norway (or with modified versions
|
||
|
of Qt that use the same license as Qt), and distribute linked
|
||
|
combinations including the two. You must obey the GNU General
|
||
|
Public License in all respects for all of the code used other than
|
||
|
Qt. If you modify this file, you may extend this exception to
|
||
|
your version of the file, but you are not obligated to do so. If
|
||
|
you do not wish to do so, delete this exception statement from
|
||
|
your version.
|
||
|
*/
|
||
|
|
||
|
#ifndef __KIOSMTP_REQUEST_H__
|
||
|
#define __KIOSMTP_REQUEST_H__
|
||
|
|
||
14 years ago
|
#include <tqstring.h>
|
||
|
#include <tqstringlist.h>
|
||
15 years ago
|
|
||
|
class KURL;
|
||
|
|
||
|
namespace KioSMTP {
|
||
|
|
||
|
class Request {
|
||
|
public:
|
||
|
Request()
|
||
|
: mSubject( "missing subject" ), mEmitHeaders( true ),
|
||
|
m8Bit( false ), mSize( 0 ) {}
|
||
|
|
||
|
static Request fromURL( const KURL & url );
|
||
|
|
||
14 years ago
|
TQString profileName() const { return mProfileName; }
|
||
|
void setProfileName( const TQString & profileName ) { mProfileName = profileName; }
|
||
15 years ago
|
bool hasProfile() const { return !profileName().isNull(); }
|
||
|
|
||
14 years ago
|
TQString subject() const { return mSubject; }
|
||
|
void setSubject( const TQString & subject ) { mSubject = subject; }
|
||
15 years ago
|
|
||
14 years ago
|
TQString fromAddress() const { return mFromAddress; }
|
||
|
void setFromAddress( const TQString & fromAddress ) { mFromAddress = fromAddress; }
|
||
15 years ago
|
bool hasFromAddress() const { return !mFromAddress.isEmpty(); }
|
||
|
|
||
14 years ago
|
TQStringList recipients() const { return to() + cc() + bcc() ; }
|
||
15 years ago
|
bool hasRecipients() const { return !to().empty() || !cc().empty() || !bcc().empty() ; }
|
||
|
|
||
14 years ago
|
TQStringList to() const { return mTo; }
|
||
|
TQStringList cc() const { return mCc; }
|
||
|
TQStringList bcc() const { return mBcc; }
|
||
|
void addTo( const TQString & to ) { mTo.push_back( to ); }
|
||
|
void addCc( const TQString & cc ) { mCc.push_back( cc ); }
|
||
|
void addBcc( const TQString & bcc ) { mBcc.push_back( bcc ); }
|
||
15 years ago
|
|
||
14 years ago
|
TQString heloHostname() const { return mHeloHostname; }
|
||
|
TQCString heloHostnameCString() const;
|
||
|
void setHeloHostname( const TQString & hostname ) { mHeloHostname = hostname; }
|
||
15 years ago
|
|
||
|
bool emitHeaders() const { return mEmitHeaders; }
|
||
|
void setEmitHeaders( bool emitHeaders ) { mEmitHeaders = emitHeaders; }
|
||
|
|
||
|
bool is8BitBody() const { return m8Bit; }
|
||
|
void set8BitBody( bool a8Bit ) { m8Bit = a8Bit; }
|
||
|
|
||
|
unsigned int size() const { return mSize; }
|
||
|
void setSize( unsigned int size ) { mSize = size; }
|
||
|
|
||
|
/** If @ref #emitHeaders() is true, returns the rfc2822
|
||
|
serialization of the header fields "To", "Cc", "Subject" and
|
||
|
"From", as determined by the respective settings. If @ref
|
||
|
#emitHeaders() is false, returns a null string. */
|
||
14 years ago
|
TQCString headerFields( const TQString & fromRealName=TQString::null ) const;
|
||
15 years ago
|
|
||
|
private:
|
||
14 years ago
|
TQStringList mTo, mCc, mBcc;
|
||
|
TQString mProfileName, mSubject, mFromAddress, mHeloHostname;
|
||
15 years ago
|
bool mEmitHeaders;
|
||
|
bool m8Bit;
|
||
|
unsigned int mSize;
|
||
|
};
|
||
|
|
||
|
} // namespace KioSMTP
|
||
|
|
||
|
#endif // __KIOSMTP_REQUEST_H__
|