summaryrefslogtreecommitdiff
path: root/noncore/unsupported/mailit/smtpclient.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/mailit/smtpclient.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/mailit/smtpclient.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/unsupported/mailit/smtpclient.cpp b/noncore/unsupported/mailit/smtpclient.cpp
index 7bb7933..3bdc072 100644
--- a/noncore/unsupported/mailit/smtpclient.cpp
+++ b/noncore/unsupported/mailit/smtpclient.cpp
@@ -41,42 +41,42 @@ SmtpClient::~SmtpClient()
41 41
42void SmtpClient::newConnection(QString target, int port) 42void SmtpClient::newConnection(QString target, int port)
43{ 43{
44 if (sending) { 44 if (sending) {
45 qWarning("socket in use, connection refused"); 45 qWarning("socket in use, connection refused");
46 return; 46 return;
47 } 47 }
48 48
49 status = Init; 49 status = Init;
50 sending = TRUE; 50 sending = TRUE;
51 socket->connectToHost(target, port); 51 socket->connectToHost(target, port);
52 52
53 emit updateStatus("DNS lookup"); 53 emit updateStatus(tr("DNS lookup"));
54} 54}
55 55
56void SmtpClient::addMail(QString from, QString subject, QStringList to, QString body) 56void SmtpClient::addMail(QString from, QString subject, QStringList to, QString body)
57{ 57{
58 RawEmail *mail = new RawEmail; 58 RawEmail *mail = new RawEmail;
59 59
60 mail->from = from; 60 mail->from = from;
61 mail->subject = subject; 61 mail->subject = subject;
62 mail->to = to; 62 mail->to = to;
63 mail->body = body; 63 mail->body = body;
64 64
65 mailList.append(mail); 65 mailList.append(mail);
66} 66}
67 67
68void SmtpClient::connectionEstablished() 68void SmtpClient::connectionEstablished()
69{ 69{
70 emit updateStatus("Connection established"); 70 emit updateStatus(tr("Connection established"));
71 71
72} 72}
73 73
74void SmtpClient::errorHandling(int status) 74void SmtpClient::errorHandling(int status)
75{ 75{
76 emit errorOccurred(status); 76 emit errorOccurred(status);
77 socket->close(); 77 socket->close();
78 mailList.clear(); 78 mailList.clear();
79 sending = FALSE; 79 sending = FALSE;
80} 80}
81 81
82void SmtpClient::incomingData() 82void SmtpClient::incomingData()
@@ -120,44 +120,44 @@ void SmtpClient::incomingData()
120 if ( it != mailPtr->to.end() ) { 120 if ( it != mailPtr->to.end() ) {
121 *stream << "RCPT TO: <" << *it << ">\r\n"; 121 *stream << "RCPT TO: <" << *it << ">\r\n";
122 break; 122 break;
123 } else { 123 } else {
124 status = Data; 124 status = Data;
125 } 125 }
126 } else errorHandling(ErrUnknownResponse); 126 } else errorHandling(ErrUnknownResponse);
127 } 127 }
128 case Data: { 128 case Data: {
129 if (response[0] == '2') { 129 if (response[0] == '2') {
130 *stream << "DATA\r\n"; 130 *stream << "DATA\r\n";
131 status = Body; 131 status = Body;
132 emit updateStatus("Sending: " + mailPtr->subject); 132 emit updateStatus(tr("Sending: ") + mailPtr->subject);
133 } else errorHandling(ErrUnknownResponse); 133 } else errorHandling(ErrUnknownResponse);
134 break; 134 break;
135 } 135 }
136 case Body: { 136 case Body: {
137 if (response[0] == '3') { 137 if (response[0] == '3') {
138 *stream << mailPtr->body << "\r\n.\r\n"; 138 *stream << mailPtr->body << "\r\n.\r\n";
139 mailPtr = mailList.next(); 139 mailPtr = mailList.next();
140 if (mailPtr != NULL) { 140 if (mailPtr != NULL) {
141 status = From; 141 status = From;
142 } else { 142 } else {
143 status = Quit; 143 status = Quit;
144 } 144 }
145 } else errorHandling(ErrUnknownResponse); 145 } else errorHandling(ErrUnknownResponse);
146 break; 146 break;
147 } 147 }
148 case Quit: { 148 case Quit: {
149 if (response[0] == '2') { 149 if (response[0] == '2') {
150 *stream << "QUIT\r\n"; 150 *stream << "QUIT\r\n";
151 status = Done; 151 status = Done;
152 QString temp; 152 QString temp;
153 temp.setNum(mailList.count()); 153 temp.setNum(mailList.count());
154 emit updateStatus("Sent " + temp + " messages"); 154 emit updateStatus(tr("Sent ") + temp + tr(" messages"));
155 emit mailSent(); 155 emit mailSent();
156 mailList.clear(); 156 mailList.clear();
157 sending = FALSE; 157 sending = FALSE;
158 socket->close(); 158 socket->close();
159 } else errorHandling(ErrUnknownResponse); 159 } else errorHandling(ErrUnknownResponse);
160 break; 160 break;
161 } 161 }
162 } 162 }
163} 163}