haiku/headers/private/mail/ServerConnection.h

49 lines
876 B
C
Raw Normal View History

Map one or more server mailboxes two a local directory. All subscribed mailboxes are fetched automatically and populated under the root account folder. On startup the local copy is synced with the server, means all local changes are rejected. (We should think about store offline changes and apply them when online) Also the read flags are synced with the server. This makes it easy to have the same mailbox state on different machines. Messages could be deleted by delete them form the folder (not when moving them to trash) This maybe needs some more thoughts but its a save solution. One problem with moving it to trash is that you also want to have the option to restore it again. If it is a header only messages and you delete it from the server you lose the body part. Complete messages could theoretically be append to the mailbox again when restoring the mail form trash. Append is commented out though... An solution for the delete problem would be to move the message to a trash folder on the server. Moving mails on the server is not implemented yet, though. You can subscribe or unsubscribe to a mailbox using the imap pref panel. The settings are written to the server and are not stored locally. Add some helper classes which could also be used for POP and SMTP: ServerConnection: abstract ssl or socket connection ConnectionReader (still a bit IMAP specific but could be easily separated IMHO): read complete lines or a bunch of data more efficient. Old implementation did it byte by byte, this class read data in bunches and buffer the left over for the next request... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40399 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-09 04:54:18 +03:00
/*
* Copyright 2010-2011, Haiku Inc. All Rights Reserved.
Map one or more server mailboxes two a local directory. All subscribed mailboxes are fetched automatically and populated under the root account folder. On startup the local copy is synced with the server, means all local changes are rejected. (We should think about store offline changes and apply them when online) Also the read flags are synced with the server. This makes it easy to have the same mailbox state on different machines. Messages could be deleted by delete them form the folder (not when moving them to trash) This maybe needs some more thoughts but its a save solution. One problem with moving it to trash is that you also want to have the option to restore it again. If it is a header only messages and you delete it from the server you lose the body part. Complete messages could theoretically be append to the mailbox again when restoring the mail form trash. Append is commented out though... An solution for the delete problem would be to move the message to a trash folder on the server. Moving mails on the server is not implemented yet, though. You can subscribe or unsubscribe to a mailbox using the imap pref panel. The settings are written to the server and are not stored locally. Add some helper classes which could also be used for POP and SMTP: ServerConnection: abstract ssl or socket connection ConnectionReader (still a bit IMAP specific but could be easily separated IMHO): read complete lines or a bunch of data more efficient. Old implementation did it byte by byte, this class read data in bunches and buffer the left over for the next request... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40399 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-09 04:54:18 +03:00
* 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"
namespace BPrivate {
Map one or more server mailboxes two a local directory. All subscribed mailboxes are fetched automatically and populated under the root account folder. On startup the local copy is synced with the server, means all local changes are rejected. (We should think about store offline changes and apply them when online) Also the read flags are synced with the server. This makes it easy to have the same mailbox state on different machines. Messages could be deleted by delete them form the folder (not when moving them to trash) This maybe needs some more thoughts but its a save solution. One problem with moving it to trash is that you also want to have the option to restore it again. If it is a header only messages and you delete it from the server you lose the body part. Complete messages could theoretically be append to the mailbox again when restoring the mail form trash. Append is commented out though... An solution for the delete problem would be to move the message to a trash folder on the server. Moving mails on the server is not implemented yet, though. You can subscribe or unsubscribe to a mailbox using the imap pref panel. The settings are written to the server and are not stored locally. Add some helper classes which could also be used for POP and SMTP: ServerConnection: abstract ssl or socket connection ConnectionReader (still a bit IMAP specific but could be easily separated IMHO): read complete lines or a bunch of data more efficient. Old implementation did it byte by byte, this class read data in bunches and buffer the left over for the next request... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40399 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-09 04:54:18 +03:00
class AbstractConnection;
Map one or more server mailboxes two a local directory. All subscribed mailboxes are fetched automatically and populated under the root account folder. On startup the local copy is synced with the server, means all local changes are rejected. (We should think about store offline changes and apply them when online) Also the read flags are synced with the server. This makes it easy to have the same mailbox state on different machines. Messages could be deleted by delete them form the folder (not when moving them to trash) This maybe needs some more thoughts but its a save solution. One problem with moving it to trash is that you also want to have the option to restore it again. If it is a header only messages and you delete it from the server you lose the body part. Complete messages could theoretically be append to the mailbox again when restoring the mail form trash. Append is commented out though... An solution for the delete problem would be to move the message to a trash folder on the server. Moving mails on the server is not implemented yet, though. You can subscribe or unsubscribe to a mailbox using the imap pref panel. The settings are written to the server and are not stored locally. Add some helper classes which could also be used for POP and SMTP: ServerConnection: abstract ssl or socket connection ConnectionReader (still a bit IMAP specific but could be easily separated IMHO): read complete lines or a bunch of data more efficient. Old implementation did it byte by byte, this class read data in bunches and buffer the left over for the next request... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40399 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-09 04:54:18 +03:00
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);
ssize_t Read(char* buffer, uint32 length);
ssize_t Write(const char* buffer, uint32 length);
Map one or more server mailboxes two a local directory. All subscribed mailboxes are fetched automatically and populated under the root account folder. On startup the local copy is synced with the server, means all local changes are rejected. (We should think about store offline changes and apply them when online) Also the read flags are synced with the server. This makes it easy to have the same mailbox state on different machines. Messages could be deleted by delete them form the folder (not when moving them to trash) This maybe needs some more thoughts but its a save solution. One problem with moving it to trash is that you also want to have the option to restore it again. If it is a header only messages and you delete it from the server you lose the body part. Complete messages could theoretically be append to the mailbox again when restoring the mail form trash. Append is commented out though... An solution for the delete problem would be to move the message to a trash folder on the server. Moving mails on the server is not implemented yet, though. You can subscribe or unsubscribe to a mailbox using the imap pref panel. The settings are written to the server and are not stored locally. Add some helper classes which could also be used for POP and SMTP: ServerConnection: abstract ssl or socket connection ConnectionReader (still a bit IMAP specific but could be easily separated IMHO): read complete lines or a bunch of data more efficient. Old implementation did it byte by byte, this class read data in bunches and buffer the left over for the next request... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40399 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-09 04:54:18 +03:00
private:
AbstractConnection* fConnection;
};
} // namespace BPrivate
using BPrivate::ServerConnection;
Map one or more server mailboxes two a local directory. All subscribed mailboxes are fetched automatically and populated under the root account folder. On startup the local copy is synced with the server, means all local changes are rejected. (We should think about store offline changes and apply them when online) Also the read flags are synced with the server. This makes it easy to have the same mailbox state on different machines. Messages could be deleted by delete them form the folder (not when moving them to trash) This maybe needs some more thoughts but its a save solution. One problem with moving it to trash is that you also want to have the option to restore it again. If it is a header only messages and you delete it from the server you lose the body part. Complete messages could theoretically be append to the mailbox again when restoring the mail form trash. Append is commented out though... An solution for the delete problem would be to move the message to a trash folder on the server. Moving mails on the server is not implemented yet, though. You can subscribe or unsubscribe to a mailbox using the imap pref panel. The settings are written to the server and are not stored locally. Add some helper classes which could also be used for POP and SMTP: ServerConnection: abstract ssl or socket connection ConnectionReader (still a bit IMAP specific but could be easily separated IMHO): read complete lines or a bunch of data more efficient. Old implementation did it byte by byte, this class read data in bunches and buffer the left over for the next request... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40399 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-09 04:54:18 +03:00
#endif // SERVER_CONNECTION_H