libspopc.h   libspopc.h 
skipping to change at line 42 skipping to change at line 42
#ifdef WIN32 #ifdef WIN32
#include <winsock.h> #include <winsock.h>
#else #else
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>
#endif #endif
/* thread-safe version of libspopc (>0.8) */ /* thread-safe version of libspopc (>0.8) */
/* call this function before to use any routine from libspopc */ /* call this function before to use any routine from libspopc */
int libspopc_init(void); int libspopc_init(void);
/* call this function when you do not use anymore libspopc routines */ /* call this function when you do not use anymore libspopc routines */
int libspopc_clean(void); int libspopc_clean(void);
/* those functions are mandatory if libspopc has
* been built with the _REENTRANT cflag */
#ifdef USE_SSL #ifdef USE_SSL
#include <openssl/ssl.h> #include <openssl/ssl.h>
/************************************************************************** **** /************************************************************************** ****
* If compiled with SSL support, the low-level functions will act on a * If compiled with SSL support, the low-level functions will act on a
* "pop3sock" structure, which contains the socket, SSL instance and contex t * "pop3sock" structure, which contains the socket, SSL instance and contex t
* for the connection. This structure is dynamically allocated and initiali zed * for the connection. This structure is dynamically allocated and initiali zed
* when you do pop3_prepare() or popbegin(), and is cleaned-up and destroye d in * when you do pop3_prepare() or popbegin(), and is cleaned-up and destroye d in
* pop3_disconnect() or popend(). * pop3_disconnect() or popend().
************************************************************************** ****/ ************************************************************************** ****/
typedef struct { typedef struct {
int sock; int sock;
SSL *ssl; SSL *ssl;
SSL_CTX *ctx; SSL_CTX *ctx;
} pop3sock; } pop3sock;
typedef pop3sock* pop3sock_t; typedef pop3sock* pop3sock_t;
#define BAD_SOCK NULL #define BAD_SOCK NULL
/************************************************************************** **** /************************************************************************** ****
* Use pop3_cert_setup() to specify the location of your SSL certificate * Use pop3_cert_setup() to specify the location of your SSL certificate
* bundle. If it is not set (or set to NULL), SSL connections can be still be * bundle. If it is not set (or set to NULL), SSL connections can be still be
* made, but certificates will not be verified! * made, but certificates will not be verified!
skipping to change at line 183 skipping to change at line 183
char* pop3_apop(pop3sock_t sock, const char* name, const char* digest); char* pop3_apop(pop3sock_t sock, const char* name, const char* digest);
/* performs a "APOP" secure pop query and returns server's <512 bytes respo nse */ /* performs a "APOP" secure pop query and returns server's <512 bytes respo nse */
/********************* /*********************
* parsing utilities * * parsing utilities *
*********************/ *********************/
#define DOTBEGIN(s) ((s)[0]=='\n'&&(s)[1]=='.') #define DOTBEGIN(s) ((s)[0]=='\n'&&(s)[1]=='.')
int dotline(char* buf); int dotline(char* buf);
/* returns 1 if 'buf' contains a "\n.\n" or "\n.\0" or \r.(etc) substring * /* returns 1 if 'buf' contains a "\n.\n" or "\n.\0" or \r.(etc) substring
/ * buf must be terminated by '\0' */
/* buf must be terminated by '\0' */
int pop3_error(char* string); int pop3_error(char* string);
/* returns 1 on pop server error reply (i.e : -ERR ...) */ /* returns 1 on pop server error (i.e : -ERR ...) or NULL reply */
/************************************ /************************************
* reply re-formatting, after query * * reply re-formatting, after query *
************************************/ ************************************/
char* nextline(char* string); char* nextline(char* string);
/* returns a pointer to the next line of given string */ /* returns a pointer to the next line of given string */
char* retr2msg(char* data); char* retr2msg(char* data);
/* returns formatted mail from a pop RETR X query */ /* returns formatted mail from a pop RETR X query
/* must only be called on data returned by pop3_retr() */ * must only be called on data returned by pop3_retr() */
void freemsg(char* msg); void freemsg(char* msg);
/* free the message received by reetr2msg */ /* free the message received by reetr2msg */
int* list2array(char* poplist); int* list2array(char* poplist);
/* WARNING: must not be called after a mail deletion */ /* WARNING: must not be called after a mail deletion
/* returns an int array of sizes of messages from a LIST pop query */ * returns an int array of sizes of messages from a LIST pop query
/* array[0] holds id of the array's last element */ * array[0] holds id of the array's last element
/* must only be called on data received by a pop3_list(sock,0) request */ * must only be called on data received by a pop3_list(sock,0) request */
void freelistarray(int* array); void freelistarray(int* array);
/* free the message sizes array created by list2array */ /* free the message sizes array created by list2array */
int listi2size(char* resp); int listi2size(char* resp);
/* grep the given size (in bytes) in resp after a pop3_list(sock,ID) reques /* grep the given size (in bytes) in resp after a pop3_list(sock,ID) reques
t */ t
/* do not use after a pop3_list(sock,0) ! */ * do not use after a pop3_list(sock,0) ! */
int stat2num(char* resp); int stat2num(char* resp);
/* returns the number of downloadable messages on pop server */ /* returns the number of downloadable messages on pop server */
int stat2bytes(char* resp); int stat2bytes(char* resp);
/* returns the sumsize in bytes of all stored messages on server */ /* returns the sumsize in bytes of all stored messages on server
/* must only be called just after a pop3_stat() request */ * must only be called just after a pop3_stat() request */
char** uidl2array(char* resp); char** uidl2array(char* resp);
/* WARNING: mus not be called after a mail deletion */ /* WARNING: mus not be called after a mail deletion
/* returns an array of unique strings for each message id */ * returns an array of unique strings for each message id
/* array[0] gives array's last id */ * array[0] gives array's last id
/* must only be called just after a pop3_uidl(sock,0) request */ * must only be called just after a pop3_uidl(sock,0) request */
void freeuidlarray(char** arrray); void freeuidlarray(char** arrray);
/* free the uidl array created by uidl2array */ /* free the uidl array created by uidl2array */
char* uidli2sig(char* resp); char* uidli2sig(char* resp);
/* grep the pop signature of *one* message signature reply*/ /* grep the pop signature of *one* message signature reply
/* should only be called on data received by a pop3_uidl(sock,ID) request * * should only be called on data received by a pop3_uidl(sock,ID) request
/ * do not use it after a pop3_uidl(sock,0) ! */
/* do not use it after a pop3_uidl(sock,0) ! */
/*************************************************** /***************************************************
* high-level API for a SIMPLE MDA/MUA * * high-level API for a SIMPLE MDA/MUA *
***************************************************/ ***************************************************/
/************************************************************************** **** /************************************************************************** ****
* 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
skipping to change at line 262 skipping to change at line 262
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 erver */ int bytes; /* total stored (in bytes) on pop s erver */
int last; /* last available message id */ int last; /* last available message id */
int num; /* number of available messages */ int num; /* number of available messages */
int del; /* 0|1 flag to ask deletion of retr ieved messages */ int del; /* 0|1 flag to ask deletion of retr ieved messages */
int sync; /* session state: 1 = sync-ed; 0 = need sync */ int sync; /* session state: 1 = sync-ed; 0 = need sync */
} popsession; } 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)
/* asks the session to not delete any retrieved message on the server */ /* asks the session to not delete any retrieved message on the server
/* arg 's' is type 'popsession*' */ * arg 's' is type 'popsession*' */
#define popmsgsize(s,i) ((s)->list[(i)]) #define popmsgsize(s,i) ((s)->list[(i)])
/* gives the size of message 'i' for session 's' */ /* gives the size of message 'i' for session 's'
/* args are type 'session*'(s) and 'int'(i) */ * args are type 'session*'(s) and 'int'(i)
/* 'i' must *not* be 0 */ * 'i' must *not* be 0 */
#define popmsguid(s,i) ((s)->uidl[(i)]) #define popmsguid(s,i) ((s)->uidl[(i)])
/* points to the 'char*' uid (unique signature) of 'int'(i) message id */ /* points to the 'char*' uid (unique signature) of 'int'(i) message id */
int poplast(popsession* session); int poplast(popsession* session);
/* gives the id of the last message of the current session */ /* gives the id of the last message of the current session */
int popnum(popsession* session); int popnum(popsession* session);
/* gives the current number of stored message. it is != to poplast() */ /* gives the current number of stored message. it is != to poplast() */
char* popbegin(const char* servername,const char* user, const char* pass, p opsession** sp); char* popbegin(const char* servername,const char* user, const char* pass, p opsession** sp);
/* prepares, connect and get lists of messages stored on pop server */ /* prepares, connect and get lists of messages stored on pop server
/* you must give a valid servername, user and pass */ * you must give a valid servername, user and pass
/* returns an error message if a problem occurs, else NULL */ * returns an error message if a problem occurs, else NULL */
char* popgethead(popsession* session, int id); char* popgethead(popsession* session, int id);
/* returns the header of a message (id between 1 and poplast()) or NULL on bad id */ /* returns the header of a message (id between 1 and poplast()) or NULL on bad id */
char* popgetmsg(popsession* session, int id); char* popgetmsg(popsession* session, int id);
/* returns a message (id between 1 and poplast()) or NULL on bad id */ /* returns a message (id between 1 and poplast()) or NULL on bad id */
int popdelmsg(popsession* session, int id); int popdelmsg(popsession* session, int id);
/* deletes message 'id' on pop server */ /* deletes message 'id' on pop server
/* 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); int popsync(popsession* session);
/* re-synchronize the session object from the server */ /* re-synchronize the session object from the server
/* need to be called if session->sync is 0 */ * need to be called if session->sync is 0
/* returns -1 on error, 0 else */ * 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. 21 change blocks. 
47 lines changed or deleted 45 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/