haiku/headers/private/mail/ServerConnection.h
Clemens Zeidler a4710c0d46 Move ServerConnection class from the IMAP add-on to libmail.so. This avoids to init SSL each time an IMAP add-on
is loaded. SMTP and POP still have this problem! TODO: use the ServerConnection class in these add-ons too.
This would also remove a lot of #ifdef SSL form these add-ons. Will not do it in the near future, feel free to fix it
...



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41840 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-05-30 21:36:06 +00:00

50 lines
1.1 KiB
C++

/*
* Copyright 2010, Haiku Inc. All Rights Reserved.
* Copyright 2010 Clemens Zeidler. All rights reserved.
*
* Distributed under the terms of the MIT License.
*/
#ifndef SERVER_CONNECTION_H
#define SERVER_CONNECTION_H
#include "SupportDefs.h"
class AbstractConnection {
public:
virtual ~AbstractConnection();
virtual status_t Connect(const char* server, uint32 port) = 0;
virtual status_t Disconnect() = 0;
virtual status_t WaitForData(bigtime_t timeout) = 0;
virtual int32 Read(char* buffer, uint32 nBytes) = 0;
virtual int32 Write(const char* buffer, uint32 nBytes) = 0;
};
class ServerConnection {
public:
ServerConnection();
~ServerConnection();
status_t ConnectSSL(const char* server,
uint32 port = 993);
status_t ConnectSocket(const char* server,
uint32 port = 143);
status_t Disconnect();
status_t WaitForData(bigtime_t timeout);
int32 Read(char* buffer, uint32 nBytes);
int32 Write(const char* buffer, uint32 nBytes);
private:
AbstractConnection* fConnection;
};
#endif // SERVER_CONNECTION_H