diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
commit | ea318d1431c89e647598c510c4245c6571aa5f46 (patch) | |
tree | 996d29b80c30d453dda86d1a23162d441628f169 /doc/html/mail-example.html | |
parent | aaf89d4b48f69c9293feb187db26362e550b5561 (diff) | |
download | tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.tar.gz tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.zip |
Update to latest tqt3 automated conversion
Diffstat (limited to 'doc/html/mail-example.html')
-rw-r--r-- | doc/html/mail-example.html | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/doc/html/mail-example.html b/doc/html/mail-example.html index 2dc1971ff..1598c1096 100644 --- a/doc/html/mail-example.html +++ b/doc/html/mail-example.html @@ -33,7 +33,7 @@ body { background: #ffffff; color: black; } <p> -<p> This example shows how to use the <a href="qsocket.html">TQSocket</a> class. The client can only be +<p> This example shows how to use the <a href="ntqsocket.html">TQSocket</a> class. The client can only be used to send mails. The interesting part is the implementation of the SMTP protocol. <p> <hr> @@ -51,24 +51,24 @@ SMTP protocol. #ifndef SMTP_H #define SMTP_H -#include <<a href="qobject-h.html">qobject.h</a>> -#include <<a href="qstring-h.html">qstring.h</a>> +#include <<a href="qobject-h.html">ntqobject.h</a>> +#include <<a href="qstring-h.html">ntqstring.h</a>> class TQSocket; class TQTextStream; class TQDns; -class Smtp : public <a href="qobject.html">TQObject</a> +class Smtp : public <a href="ntqobject.html">TQObject</a> { <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> public: - Smtp( const <a href="qstring.html">TQString</a> &from, const <a href="qstring.html">TQString</a> &to, - const <a href="qstring.html">TQString</a> &subject, const <a href="qstring.html">TQString</a> &body ); + Smtp( const <a href="ntqstring.html">TQString</a> &from, const <a href="ntqstring.html">TQString</a> &to, + const <a href="ntqstring.html">TQString</a> &subject, const <a href="ntqstring.html">TQString</a> &body ); ~Smtp(); signals: - void status( const <a href="qstring.html">TQString</a> & ); + void status( const <a href="ntqstring.html">TQString</a> & ); private slots: void dnsLookupHelper(); @@ -86,14 +86,14 @@ private: Close }; - <a href="qstring.html">TQString</a> message; - <a href="qstring.html">TQString</a> from; - <a href="qstring.html">TQString</a> rcpt; - <a href="qsocket.html">TQSocket</a> *socket; - <a href="qtextstream.html">TQTextStream</a> * t; + <a href="ntqstring.html">TQString</a> message; + <a href="ntqstring.html">TQString</a> from; + <a href="ntqstring.html">TQString</a> rcpt; + <a href="ntqsocket.html">TQSocket</a> *socket; + <a href="ntqtextstream.html">TQTextStream</a> * t; int state; - <a href="qstring.html">TQString</a> response; - <a href="qdns.html">TQDns</a> * mxLookup; + <a href="ntqstring.html">TQString</a> response; + <a href="ntqdns.html">TQDns</a> * mxLookup; }; #endif @@ -113,37 +113,37 @@ private: #include "smtp.h" -#include <<a href="qtextstream-h.html">qtextstream.h</a>> -#include <<a href="qsocket-h.html">qsocket.h</a>> -#include <<a href="qdns-h.html">qdns.h</a>> -#include <<a href="qtimer-h.html">qtimer.h</a>> -#include <<a href="qapplication-h.html">qapplication.h</a>> -#include <<a href="qmessagebox-h.html">qmessagebox.h</a>> -#include <<a href="qregexp-h.html">qregexp.h</a>> +#include <<a href="qtextstream-h.html">ntqtextstream.h</a>> +#include <<a href="qsocket-h.html">ntqsocket.h</a>> +#include <<a href="qdns-h.html">ntqdns.h</a>> +#include <<a href="qtimer-h.html">ntqtimer.h</a>> +#include <<a href="qapplication-h.html">ntqapplication.h</a>> +#include <<a href="qmessagebox-h.html">ntqmessagebox.h</a>> +#include <<a href="qregexp-h.html">ntqregexp.h</a>> -<a name="f297"></a>Smtp::Smtp( const <a href="qstring.html">TQString</a> &from, const <a href="qstring.html">TQString</a> &to, - const <a href="qstring.html">TQString</a> &subject, - const <a href="qstring.html">TQString</a> &body ) +<a name="f297"></a>Smtp::Smtp( const <a href="ntqstring.html">TQString</a> &from, const <a href="ntqstring.html">TQString</a> &to, + const <a href="ntqstring.html">TQString</a> &subject, + const <a href="ntqstring.html">TQString</a> &body ) { - socket = new <a href="qsocket.html">TQSocket</a>( this ); -<a name="x714"></a> <a href="qobject.html#connect">connect</a> ( socket, SIGNAL( <a href="qsocket.html#readyRead">readyRead</a>() ), + socket = new <a href="ntqsocket.html">TQSocket</a>( this ); +<a name="x714"></a> <a href="ntqobject.html#connect">connect</a> ( socket, SIGNAL( <a href="ntqsocket.html#readyRead">readyRead</a>() ), this, SLOT( readyRead() ) ); -<a name="x711"></a> <a href="qobject.html#connect">connect</a> ( socket, SIGNAL( <a href="qsocket.html#connected">connected</a>() ), +<a name="x711"></a> <a href="ntqobject.html#connect">connect</a> ( socket, SIGNAL( <a href="ntqsocket.html#connected">connected</a>() ), this, SLOT( connected() ) ); -<a name="x717"></a><a name="x715"></a> mxLookup = new <a href="qdns.html">TQDns</a>( to.<a href="qstring.html#mid">mid</a>( to.<a href="qstring.html#find">find</a>( '@' )+1 ), TQDns::Mx ); -<a name="x707"></a> <a href="qobject.html#connect">connect</a>( mxLookup, SIGNAL(<a href="qdns.html#resultsReady">resultsReady</a>()), +<a name="x717"></a><a name="x715"></a> mxLookup = new <a href="ntqdns.html">TQDns</a>( to.<a href="ntqstring.html#mid">mid</a>( to.<a href="ntqstring.html#find">find</a>( '@' )+1 ), TQDns::Mx ); +<a name="x707"></a> <a href="ntqobject.html#connect">connect</a>( mxLookup, SIGNAL(<a href="ntqdns.html#resultsReady">resultsReady</a>()), this, SLOT(dnsLookupHelper()) ); -<a name="x716"></a> message = TQString::<a href="qstring.html#fromLatin1">fromLatin1</a>( "From: " ) + from + - TQString::<a href="qstring.html#fromLatin1">fromLatin1</a>( "\nTo: " ) + to + - TQString::<a href="qstring.html#fromLatin1">fromLatin1</a>( "\nSubject: " ) + subject + - TQString::<a href="qstring.html#fromLatin1">fromLatin1</a>( "\n\n" ) + body + "\n"; - message.replace( TQString::<a href="qstring.html#fromLatin1">fromLatin1</a>( "\n" ), - TQString::<a href="qstring.html#fromLatin1">fromLatin1</a>( "\r\n" ) ); - message.replace( TQString::<a href="qstring.html#fromLatin1">fromLatin1</a>( "\r\n.\r\n" ), - TQString::<a href="qstring.html#fromLatin1">fromLatin1</a>( "\r\n..\r\n" ) ); +<a name="x716"></a> message = TQString::<a href="ntqstring.html#fromLatin1">fromLatin1</a>( "From: " ) + from + + TQString::<a href="ntqstring.html#fromLatin1">fromLatin1</a>( "\nTo: " ) + to + + TQString::<a href="ntqstring.html#fromLatin1">fromLatin1</a>( "\nSubject: " ) + subject + + TQString::<a href="ntqstring.html#fromLatin1">fromLatin1</a>( "\n\n" ) + body + "\n"; + message.replace( TQString::<a href="ntqstring.html#fromLatin1">fromLatin1</a>( "\n" ), + TQString::<a href="ntqstring.html#fromLatin1">fromLatin1</a>( "\r\n" ) ); + message.replace( TQString::<a href="ntqstring.html#fromLatin1">fromLatin1</a>( "\r\n.\r\n" ), + TQString::<a href="ntqstring.html#fromLatin1">fromLatin1</a>( "\r\n..\r\n" ) ); this->from = from; rcpt = to; @@ -161,37 +161,37 @@ Smtp::~Smtp() void <a name="f298"></a>Smtp::dnsLookupHelper() { -<a name="x706"></a> <a href="qvaluelist.html">TQValueList</a><TQDns::MailServer> s = mxLookup-><a href="qdns.html#mailServers">mailServers</a>(); -<a name="x720"></a> if ( s.<a href="qvaluelist.html#isEmpty">isEmpty</a>() ) { -<a name="x705"></a> if ( !mxLookup-><a href="qdns.html#isWorking">isWorking</a>() ) - emit status( <a href="qobject.html#tr">tr</a>( "Error in MX record lookup" ) ); +<a name="x706"></a> <a href="ntqvaluelist.html">TQValueList</a><TQDns::MailServer> s = mxLookup-><a href="ntqdns.html#mailServers">mailServers</a>(); +<a name="x720"></a> if ( s.<a href="ntqvaluelist.html#isEmpty">isEmpty</a>() ) { +<a name="x705"></a> if ( !mxLookup-><a href="ntqdns.html#isWorking">isWorking</a>() ) + emit status( <a href="ntqobject.html#tr">tr</a>( "Error in MX record lookup" ) ); return; } -<a name="x719"></a> emit status( <a href="qobject.html#tr">tr</a>( "Connecting to %1" ).arg( s.<a href="qvaluelist.html#first">first</a>().name ) ); +<a name="x719"></a> emit status( <a href="ntqobject.html#tr">tr</a>( "Connecting to %1" ).arg( s.<a href="ntqvaluelist.html#first">first</a>().name ) ); -<a name="x710"></a> socket-><a href="qsocket.html#connectToHost">connectToHost</a>( s.<a href="qvaluelist.html#first">first</a>().name, 25 ); - t = new <a href="qtextstream.html">TQTextStream</a>( socket ); +<a name="x710"></a> socket-><a href="ntqsocket.html#connectToHost">connectToHost</a>( s.<a href="ntqvaluelist.html#first">first</a>().name, 25 ); + t = new <a href="ntqtextstream.html">TQTextStream</a>( socket ); } void <a name="f299"></a>Smtp::connected() { -<a name="x712"></a> emit status( <a href="qobject.html#tr">tr</a>( "Connected to %1" ).arg( socket-><a href="qsocket.html#peerName">peerName</a>() ) ); +<a name="x712"></a> emit status( <a href="ntqobject.html#tr">tr</a>( "Connected to %1" ).arg( socket-><a href="ntqsocket.html#peerName">peerName</a>() ) ); } void <a name="f300"></a>Smtp::readyRead() { // SMTP is line-oriented -<a name="x709"></a> if ( !socket-><a href="qsocket.html#canReadLine">canReadLine</a>() ) +<a name="x709"></a> if ( !socket-><a href="ntqsocket.html#canReadLine">canReadLine</a>() ) return; - <a href="qstring.html">TQString</a> responseLine; + <a href="ntqstring.html">TQString</a> responseLine; do { -<a name="x713"></a> responseLine = socket-><a href="qsocket.html#readLine">readLine</a>(); +<a name="x713"></a> responseLine = socket-><a href="ntqsocket.html#readLine">readLine</a>(); response += responseLine; - } while( socket-><a href="qsocket.html#canReadLine">canReadLine</a>() && responseLine[3] != ' ' ); -<a name="x718"></a> responseLine.<a href="qstring.html#truncate">truncate</a>( 3 ); + } while( socket-><a href="ntqsocket.html#canReadLine">canReadLine</a>() && responseLine[3] != ' ' ); +<a name="x718"></a> responseLine.<a href="ntqstring.html#truncate">truncate</a>( 3 ); if ( state == Init && responseLine[0] == '2' ) { // banner was okay, let's go on @@ -214,15 +214,15 @@ void <a name="f300"></a>Smtp::readyRead() *t << "TQUIT\r\n"; // here, we just close. state = Close; - emit status( <a href="qobject.html#tr">tr</a>( "Message sent" ) ); + emit status( <a href="ntqobject.html#tr">tr</a>( "Message sent" ) ); } else if ( state == Close ) { - <a href="qobject.html#deleteLater">deleteLater</a>(); + <a href="ntqobject.html#deleteLater">deleteLater</a>(); return; } else { // something broke. -<a name="x708"></a><a name="x704"></a> TQMessageBox::<a href="qmessagebox.html#warning">warning</a>( qApp-><a href="qapplication.html#activeWindow">activeWindow</a>(), - <a href="qobject.html#tr">tr</a>( "TQt Mail Example" ), - <a href="qobject.html#tr">tr</a>( "Unexpected reply from SMTP server:\n\n" ) + +<a name="x708"></a><a name="x704"></a> TQMessageBox::<a href="ntqmessagebox.html#warning">warning</a>( qApp-><a href="ntqapplication.html#activeWindow">activeWindow</a>(), + <a href="ntqobject.html#tr">tr</a>( "TQt Mail Example" ), + <a href="ntqobject.html#tr">tr</a>( "Unexpected reply from SMTP server:\n\n" ) + response ); state = Close; } |