POP network mailbox. More...
Go to the source code of this file.
Data Structures | |
struct | PopCache |
POP-specific email cache. More... | |
struct | PopAuth |
POP authentication multiplexor. More... | |
Macros | |
#define | POP_PORT 110 |
#define | POP_SSL_PORT 995 |
#define | POP_CACHE_LEN 10 |
#define | POP_CMD_RESPONSE 512 |
#define | pop_query(adata, buf, buflen) pop_query_d(adata, buf, buflen, NULL) |
Typedefs | |
typedef int(* | pop_fetch_t) (const char *str, void *data) |
Enumerations | |
enum | PopStatus { POP_NONE = 0 , POP_CONNECTED , POP_DISCONNECTED } |
POP server responses. More... | |
enum | PopAuthRes { POP_A_SUCCESS = 0 , POP_A_SOCKET , POP_A_FAILURE , POP_A_UNAVAIL } |
POP authentication responses. More... | |
Functions | |
bool | pop_auth_is_valid (const char *authenticator) |
Check if string is a valid pop authentication method. | |
int | pop_authenticate (struct PopAccountData *adata) |
Authenticate with a POP server. | |
void | pop_apop_timestamp (struct PopAccountData *adata, char *buf) |
Get the server timestamp for APOP authentication. | |
int | pop_parse_path (const char *path, struct ConnAccount *acct) |
Parse a POP mailbox name. | |
int | pop_connect (struct PopAccountData *adata) |
Open connection. | |
int | pop_open_connection (struct PopAccountData *adata) |
Open connection and authenticate. | |
int | pop_query_d (struct PopAccountData *adata, char *buf, size_t buflen, char *msg) |
Send data from buffer and receive answer to the same buffer. | |
int | pop_fetch_data (struct PopAccountData *adata, const char *query, struct Progress *progress, pop_fetch_t callback, void *data) |
Read Headers with callback function. | |
int | pop_reconnect (struct Mailbox *m) |
Reconnect and verify indexes if connection was lost. | |
void | pop_logout (struct Mailbox *m) |
Logout from a POP server. | |
const char * | pop_get_field (enum ConnAccountField field, void *gf_data) |
Get connection login credentials - Implements ConnAccount::get_field() -. | |
POP network mailbox.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file private.h.
#define pop_query | ( | adata, | |
buf, | |||
buflen | |||
) | pop_query_d(adata, buf, buflen, NULL) |
enum PopStatus |
POP server responses.
Enumerator | |
---|---|
POP_NONE | No connected to server. |
POP_CONNECTED | Connected to server. |
POP_DISCONNECTED | Disconnected from server. |
enum PopAuthRes |
POP authentication responses.
Enumerator | |
---|---|
POP_A_SUCCESS | Authenticated successfully. |
POP_A_SOCKET | Connection lost. |
POP_A_FAILURE | Authentication failed. |
POP_A_UNAVAIL | No valid authentication method. |
bool pop_auth_is_valid | ( | const char * | authenticator | ) |
Check if string is a valid pop authentication method.
authenticator | Authenticator string to check |
true | Argument is a valid auth method |
Validate whether an input string is an accepted pop authentication method as defined by PopAuthenticators.
Definition at line 502 of file auth.c.
int pop_authenticate | ( | struct PopAccountData * | adata | ) |
Authenticate with a POP server.
adata | POP Account data |
num | Result, e.g. POP_A_SUCCESS |
0 | Successful |
-1 | Connection lost |
-2 | Login failed |
-3 | Authentication cancelled |
Definition at line 523 of file auth.c.
void pop_apop_timestamp | ( | struct PopAccountData * | adata, |
char * | buf | ||
) |
Get the server timestamp for APOP authentication.
adata | POP Account data |
buf | Timestamp string |
Definition at line 301 of file auth.c.
int pop_parse_path | ( | const char * | path, |
struct ConnAccount * | cac | ||
) |
Parse a POP mailbox name.
path | Path to parse |
cac | Account to store details |
0 | success |
-1 | error |
Split a POP path into host, port, username and password
Definition at line 82 of file lib.c.
int pop_connect | ( | struct PopAccountData * | adata | ) |
Open connection.
adata | POP Account data |
0 | Successful |
-1 | Connection lost |
-2 | Invalid response |
Definition at line 281 of file lib.c.
int pop_open_connection | ( | struct PopAccountData * | adata | ) |
Open connection and authenticate.
adata | POP Account data |
0 | Successful |
-1 | Connection lost |
-2 | Invalid command or execution error |
-3 | Authentication cancelled |
Definition at line 316 of file lib.c.
int pop_query_d | ( | struct PopAccountData * | adata, |
char * | buf, | ||
size_t | buflen, | ||
char * | msg | ||
) |
Send data from buffer and receive answer to the same buffer.
adata | POP Account data |
buf | Buffer to send/store data |
buflen | Buffer length |
msg | Progress message |
0 | Successful |
-1 | Connection lost |
-2 | Invalid command or execution error |
Definition at line 465 of file lib.c.
int pop_fetch_data | ( | struct PopAccountData * | adata, |
const char * | query, | ||
struct Progress * | progress, | ||
pop_fetch_t | callback, | ||
void * | data | ||
) |
Read Headers with callback function.
adata | POP Account data |
query | POP query to send to server |
progress | Progress bar |
callback | Function called for each header read |
data | Data to pass to the callback |
0 | Successful |
-1 | Connection lost |
-2 | Invalid command or execution error |
-3 | Error in callback(*line, *data) |
This function calls callback(*line, *data) for each received line, callback(NULL, *data) if rewind(*data) needs, exits when fail or done.
Definition at line 510 of file lib.c.
int pop_reconnect | ( | struct Mailbox * | m | ) |
Reconnect and verify indexes if connection was lost.
m | Mailbox |
0 | Success |
-1 | Error |
Definition at line 608 of file lib.c.
void pop_logout | ( | struct Mailbox * | m | ) |
Logout from a POP server.
m | Mailbox |
Definition at line 424 of file lib.c.