* Fixed filling the log in ReceiveLine() - ie. it's not done anymore there.

* Fixed error message in Open() when the server didn't return anything.
* Made the pop3.h header self contained.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21804 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2007-08-02 23:05:53 +00:00
parent 171d3a85cb
commit 25c969f5a8
2 changed files with 43 additions and 36 deletions

View File

@ -7,28 +7,22 @@
//! POP3Protocol - implementation of the POP3 protocol
#include <stdlib.h>
#include <stdio.h>
#include <DataIO.h>
#include <Alert.h>
#include <Debug.h>
#include <netdb.h>
#include "pop3.h"
#include <errno.h>
#include <unistd.h>
#include <sys/time.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#ifndef HAIKU_TARGET_PLATFORM_BEOS // These headers don't exist in BeOS R5.
#include <sys/time.h>
#include <unistd.h>
#ifndef HAIKU_TARGET_PLATFORM_BEOS
// These headers don't exist in BeOS R5.
#include <arpa/inet.h>
#include <sys/select.h>
#endif
#include <status.h>
#include <StringList.h>
#include <ProtocolConfigView.h>
#include <ChainRunner.h>
#include <MDRLanguage.h>
#if USESSL
#include <openssl/ssl.h>
#include <openssl/rand.h>
@ -37,7 +31,16 @@
#include "md5.h"
#endif
#include "pop3.h"
#include <DataIO.h>
#include <Alert.h>
#include <Debug.h>
#include <status.h>
#include <StringList.h>
#include <ProtocolConfigView.h>
#include <ChainRunner.h>
#include <MDRLanguage.h>
#define POP3_RETRIEVAL_TIMEOUT 60000000
#define CRLF "\r\n"
@ -206,8 +209,12 @@ POP3Protocol::Open(const char *server, int port, int)
}
if (strncmp(line.String(), "+OK", 3) != 0) {
error_msg << MDR_DIALECT_CHOICE(". The server said:\n",
"サーバのメッセージです\n") << line.String();
if (line.Length() > 0) {
error_msg << MDR_DIALECT_CHOICE(". The server said:\n",
"サーバのメッセージです\n") << line.String();
} else
error_msg << ": No reply.\n";
runner->ShowError(error_msg.String());
return B_ERROR;
}
@ -623,14 +630,8 @@ POP3Protocol::ReceiveLine(BString &line)
line += (char)c;
}
}
} else {
status_t error = errno;
fLog = "POP3 ";
fLog << strerror(error) << ".";
runner->Stop(true);
return error;
}
} else
return errno;
return len;
}

View File

@ -1,17 +1,23 @@
#ifndef ZOIDBERG_POP3_H
#define ZOIDBERG_POP3_H
/* POP3Protocol - implementation of the POP3 protocol
**
** Copyright 2001-2002 Dr. Zoidberg Enterprises. All rights reserved.
*/
/*
* Copyright 2001-2002 Dr. Zoidberg Enterprises. All rights reserved.
* Copyright 2007, Haiku Inc. All Rights Reserved.
*
* Distributed under the terms of the MIT License.
*/
#ifndef POP3_H
#define POP3_H
#include <String.h>
#include <map>
#include <List.h>
#include <String.h>
#include "SimpleMailProtocol.h"
class POP3Protocol : public SimpleMailProtocol {
public:
public:
POP3Protocol(BMessage *settings, BMailChainRunner *status);
~POP3Protocol();
@ -50,4 +56,4 @@ private:
#endif
};
#endif /* ZOIDBERG_POP3_H */
#endif /* POP3_H */