libspopc.h | libspopc.h | |||
---|---|---|---|---|
skipping to change at line 114 | skipping to change at line 114 | |||
typedef int pop3sock_t; | typedef int pop3sock_t; | |||
#define BAD_SOCK -1 | #define BAD_SOCK -1 | |||
#endif /* SSL/Non-SSL */ | #endif /* SSL/Non-SSL */ | |||
/*************************************** | /*************************************** | |||
* low-level methods for a pop3 client * | * low-level methods for a pop3 client * | |||
***************************************/ | ***************************************/ | |||
#define SOCKET_TIMEOUT 15 /* miliseconds socket connection timeout */ | #define SOCKET_TIMEOUT 15 /* seconds a socket can block read/write */ | |||
#define TCPBUFLEN 512 /* length of the socket buffer */ | #define TCPBUFLEN 512 /* length of the socket buffer */ | |||
#define POPBUF 512 /* lenght of the pop response: 512 bytes as say RFC 1939 */ | #define POPBUF 512 /* lenght of the pop response: 512 bytes as say RFC 1939 */ | |||
/************************************************************************** **** | /************************************************************************** **** | |||
* Be careful, using the low-level API is uncompliant with using the high | * Be careful, using the low-level API is uncompliant with using the high | |||
* level API. Here, you make your choice. If you don't know the pop3 protoc ol | * level API. Here, you make your choice. If you don't know the pop3 protoc ol | |||
* or what a socket is, it is then warmly recommended to use the *high-leve l* | * or what a socket is, it is then warmly recommended to use the *high-leve l* | |||
* API if which is shown far below on this file. | * API if which is shown far below on this file. | |||
************************************************************************** ****/ | ************************************************************************** ****/ | |||
/************** | /************** | |||
skipping to change at line 248 | skipping to change at line 248 | |||
***************************************************/ | ***************************************************/ | |||
/************************************************************************** **** | /************************************************************************** **** | |||
* This is the high-level API of libspopc and it is recommended to use it | * This is the high-level API of libspopc and it is recommended to use it | |||
* instead of the low-level one. This high-level API, in spite of its very | * instead of the low-level one. This high-level API, in spite of its very | |||
* 'teasing' name, just provides a *very simple* way to access and query a | * 'teasing' name, just provides a *very simple* way to access and query a | |||
* pop3 server with your e-mail client. This API handles pop3 in a very | * pop3 server with your e-mail client. This API handles pop3 in a very | |||
* convenient manner for the non 'socket-aware' C developper. | * convenient manner for the non 'socket-aware' C developper. | |||
************************************************************************** ****/ | ************************************************************************** ****/ | |||
typedef enum{AUTHORIZATION,TRANSACTION,UPDATE}popstate; | ||||
/* pop server states definition from RFC 1725, not used here actually */ | ||||
typedef struct{ | typedef struct{ | |||
pop3sock_t sock;/* socket descriptor */ | pop3sock_t sock; /* socket descriptor */ | |||
struct sockaddr_in* connection; | struct sockaddr_in* connection; | |||
struct hostent* server; | struct hostent* server; | |||
popstate state;/* pop server state */ | int* list; /* pop messages size list */ | |||
int* list;/* pop messages size list */ | char** uidl; /* pop messages signature list */ | |||
char** uidl;/* pop messages signature list */ | int bytes; /* total stored (in bytes) on pop s | |||
int bytes;/* total stored (in bytes) on pop server */ | erver */ | |||
int last;/* last message id */ | int last; /* last available message id */ | |||
int del;/* 0|1 flag to ask deletion of retrieved messages */ | int num; /* number of available messages */ | |||
}popsession; | int del; /* 0|1 flag to ask deletion of retr | |||
ieved messages */ | ||||
int sync; /* session state: 1 = sync-ed; 0 = | ||||
need sync */ | ||||
} popsession; | ||||
#define popbytes(s) ((s)->bytes) | #define popbytes(s) ((s)->bytes) | |||
/* gives the total stored data size (in bytes) on the pop server */ | /* gives the total stored data size (in bytes) on the pop server */ | |||
/* arg 's' is type 'popsession*'; 'result' is type 'int' */ | /* arg 's' is type 'popsession*'; 'result' is type 'int' */ | |||
#define popsetdel(s) ((s)->del=1) | #define popsetdel(s) ((s)->del=1) | |||
/* asks the session to delete any retrieved messages on the server */ | /* asks the session to delete any retrieved messages on the server */ | |||
/* arg 's' is type 'popsession*' */ | /* arg 's' is type 'popsession*' */ | |||
#define popsetundel(s) ((s)->del=0) | #define popsetundel(s) ((s)->del=0) | |||
skipping to change at line 312 | skipping to change at line 310 | |||
/* returns -1 on server error, 0 else */ | /* returns -1 on server error, 0 else */ | |||
int popchkmsg(popsession* session, int id); | int popchkmsg(popsession* session, int id); | |||
/* tells if a message is still accessible on the server (not deleted) */ | /* tells if a message is still accessible on the server (not deleted) */ | |||
/* returns 1 of so, or 0 if message has been marked for deletion */ | /* returns 1 of so, or 0 if message has been marked for deletion */ | |||
int popcancel(popsession* session); | int popcancel(popsession* session); | |||
/* cancels all previous deletion on pop server */ | /* cancels all previous deletion on pop server */ | |||
/* returns -1 on server error, 0 else */ | /* returns -1 on server error, 0 else */ | |||
int popsync(popsession* session); | ||||
/* re-synchronize the session object from the server */ | ||||
/* need to be called if session->sync is 0 */ | ||||
/* returns -1 on error, 0 else */ | ||||
void popend(popsession* session); | void popend(popsession* session); | |||
/* quit and destroys pop session */ | /* quit and destroys pop session */ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 5 change blocks. | ||||
12 lines changed or deleted | 18 lines changed or added | |||