/[libspopc]/queries.c
ViewVC logotype

Diff of /queries.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5 by ben, Thu Oct 8 15:37:49 2009 UTC revision 6 by ben, Sun Apr 18 11:05:58 2010 UTC
# Line 41  Line 41 
41    
42  #ifdef USE_SSL  #ifdef USE_SSL
43    
44  int pop3_recv (pop3sock_t sock, char* buf, int len){  DLLIMPORT int pop3_recv (pop3sock_t sock, char* buf, int len){
45          return sock->ssl?SSL_read(sock->ssl,buf,len):recv(sock->sock,buf,len,0);          return sock->ssl?SSL_read(sock->ssl,buf,len):recv(sock->sock,buf,len,0);
46  }  }
47    
48  int pop3_send (pop3sock_t sock, char* buf, int len){  DLLIMPORT int pop3_send (pop3sock_t sock, char* buf, int len){
49          return sock->ssl?SSL_write(sock->ssl,buf,len):send(sock->sock,buf,len,0);          return sock->ssl?SSL_write(sock->ssl,buf,len):send(sock->sock,buf,len,0);
50  }  }
51    
52  #else  #else
53    
54  int pop3_recv (pop3sock_t sock, char* buf, int len){  DLLIMPORT int pop3_recv (pop3sock_t sock, char* buf, int len){
55          return recv(sock,buf,len,0);          return recv(sock,buf,len,0);
56  }  }
57    
58  int pop3_send (pop3sock_t sock, char* buf, int len){  DLLIMPORT int pop3_send (pop3sock_t sock, char* buf, int len){
59          return send(sock,buf,len,0);          return send(sock,buf,len,0);
60  }  }
61    
62  #endif  #endif
63    
64  char* pop3_query(pop3sock_t sock, const char* query){  DLLIMPORT char* pop3_query(pop3sock_t sock, const char* query){
65  /* performs a simple pop query and returns server's <=512 bytes resp */  /* performs a simple pop query and returns server's <=512 bytes resp */
66          int r=0;          int r=0;
67          int bytes=0;          int bytes=0;
# Line 90  char* pop3_query(pop3sock_t sock, const Line 90  char* pop3_query(pop3sock_t sock, const
90          return(buf);          return(buf);
91  }  }
92    
93  char* pop3_user(pop3sock_t sock, const char* name){  DLLIMPORT char* pop3_user(pop3sock_t sock, const char* name){
94  /* performs "USER" pop query and returns server's <512 bytes response */  /* performs "USER" pop query and returns server's <512 bytes response */
95          char query[POPBUF]; /* total "USER ****your_name****\n" is <= 512  */          char query[POPBUF]; /* total "USER ****your_name****\n" is <= 512  */
96    
# Line 98  char* pop3_user(pop3sock_t sock, const c Line 98  char* pop3_user(pop3sock_t sock, const c
98          return(pop3_query(sock,query));          return(pop3_query(sock,query));
99  }  }
100    
101  char* pop3_pass(pop3sock_t sock, const char* pw){  DLLIMPORT char* pop3_pass(pop3sock_t sock, const char* pw){
102  /* performs "PASS" pop query and return server's <=512 bytes response */  /* performs "PASS" pop query and return server's <=512 bytes response */
103          char query[POPBUF]; /* total "PASS ****your_pass****\n" is <=512 */          char query[POPBUF]; /* total "PASS ****your_pass****\n" is <=512 */
104    
# Line 106  char* pop3_pass(pop3sock_t sock, const c Line 106  char* pop3_pass(pop3sock_t sock, const c
106          return(pop3_query(sock,query));          return(pop3_query(sock,query));
107  }  }
108    
109  char* pop3_quit(pop3sock_t sock){  DLLIMPORT char* pop3_quit(pop3sock_t sock){
110  /* performs "QUIT" pop query and returns server's <=512 bytes response */  /* performs "QUIT" pop query and returns server's <=512 bytes response */
111          char query[]="QUIT\r\n";          char query[]="QUIT\r\n";
112    
113          return(pop3_query(sock,query));          return(pop3_query(sock,query));
114  }  }
115    
116  char* pop3_stat(pop3sock_t sock){  DLLIMPORT char* pop3_stat(pop3sock_t sock){
117  /* performs "STAT" pop query and returns server's <=512 bytes response */  /* performs "STAT" pop query and returns server's <=512 bytes response */
118          char query[]="STAT\r\n";          char query[]="STAT\r\n";
119    
# Line 171  char* recv_rest(pop3sock_t sock, char* b Line 171  char* recv_rest(pop3sock_t sock, char* b
171          return(buf);          return(buf);
172  }  }
173    
174  char* pop3_list(pop3sock_t sock, int id){  DLLIMPORT char* pop3_list(pop3sock_t sock, int id){
175  /* performs a "LIST" pop query and returns server's (long) response */  /* performs a "LIST" pop query and returns server's (long) response */
176          int r;          int r;
177          char query[POPBUF]; /* total query "LIST ID\n" string is <=512 */          char query[POPBUF]; /* total query "LIST ID\n" string is <=512 */
# Line 211  char* pop3_list(pop3sock_t sock, int id) Line 211  char* pop3_list(pop3sock_t sock, int id)
211          return(recv_rest(sock,buf,r,POPBUF-1));          return(recv_rest(sock,buf,r,POPBUF-1));
212  }  }
213    
214  char* pop3_retr(pop3sock_t sock, int id){  DLLIMPORT char* pop3_retr(pop3sock_t sock, int id){
215  /* performs a "RETR" pop query and returns server's (long) response */  /* performs a "RETR" pop query and returns server's (long) response */
216          int r;          int r;
217          char query[POPBUF];          char query[POPBUF];
# Line 242  char* pop3_retr(pop3sock_t sock, int id) Line 242  char* pop3_retr(pop3sock_t sock, int id)
242          return(recv_rest(sock, buf, r, POPBUF-1));          return(recv_rest(sock, buf, r, POPBUF-1));
243  }  }
244    
245  char* pop3_dele(pop3sock_t sock, int id){  DLLIMPORT char* pop3_dele(pop3sock_t sock, int id){
246  /* performs a "DELE" pop query and returns server's <=512 bytes response */  /* performs a "DELE" pop query and returns server's <=512 bytes response */
247          char query[POPBUF]; /* total "DELE X\n" string <=512 */          char query[POPBUF]; /* total "DELE X\n" string <=512 */
248    
# Line 253  char* pop3_dele(pop3sock_t sock, int id) Line 253  char* pop3_dele(pop3sock_t sock, int id)
253          return(pop3_query(sock,query));          return(pop3_query(sock,query));
254  }  }
255    
256  char* pop3_noop(pop3sock_t sock){  DLLIMPORT char* pop3_noop(pop3sock_t sock){
257  /* performs a "NOOP" pop query and returns server's <=512 bytes response */  /* performs a "NOOP" pop query and returns server's <=512 bytes response */
258          char query[]="NOOP\r\n";          char query[]="NOOP\r\n";
259    
260          return(pop3_query(sock,query));          return(pop3_query(sock,query));
261  }  }
262    
263  char* pop3_rset(pop3sock_t sock){  DLLIMPORT char* pop3_rset(pop3sock_t sock){
264  /* performs a "RSET" pop query and returns server's <=512 bytes response */  /* performs a "RSET" pop query and returns server's <=512 bytes response */
265          char query[]="RSET\r\n";          char query[]="RSET\r\n";
266    
267          return(pop3_query(sock,query));          return(pop3_query(sock,query));
268  }  }
269    
270  char* pop3_top(pop3sock_t sock, int id, int lines){  DLLIMPORT char* pop3_top(pop3sock_t sock, int id, int lines){
271  /* performs a "TOP" pop query and returns server's (long) response */  /* performs a "TOP" pop query and returns server's (long) response */
272          int r;          int r;
273          char query[POPBUF]; /* total "TOP X Y\n" is <=512 */          char query[POPBUF]; /* total "TOP X Y\n" is <=512 */
# Line 298  char* pop3_top(pop3sock_t sock, int id, Line 298  char* pop3_top(pop3sock_t sock, int id,
298          return(recv_rest(sock,buf,r,POPBUF-1));          return(recv_rest(sock,buf,r,POPBUF-1));
299  }  }
300    
301  char* pop3_uidl(pop3sock_t sock, int id){  DLLIMPORT char* pop3_uidl(pop3sock_t sock, int id){
302  /* performs a "UIDL" pop query and returns server's (long) response */  /* performs a "UIDL" pop query and returns server's (long) response */
303          int r;          int r;
304          char query[POPBUF]; /* total "UIDL X\n" is <=512 */          char query[POPBUF]; /* total "UIDL X\n" is <=512 */
# Line 340  char* pop3_uidl(pop3sock_t sock, int id) Line 340  char* pop3_uidl(pop3sock_t sock, int id)
340          return(recv_rest(sock,buf,r,POPBUF-1));          return(recv_rest(sock,buf,r,POPBUF-1));
341  }  }
342    
343  char* pop3_apop(pop3sock_t sock, const char* name, const char* digest){  DLLIMPORT char* pop3_apop(pop3sock_t sock, const char* name, const char* digest){
344  /* performs a "APOP" secure query and returns server's <=512 bytes response */  /* performs a "APOP" secure query and returns server's <=512 bytes response */
345          char query[POPBUF]; /* total "APOP name digest\r\n" is <=512 */          char query[POPBUF]; /* total "APOP name digest\r\n" is <=512 */
346    

Legend:
Removed from v.5  
changed lines
  Added in v.6

  ViewVC Help
Powered by ViewVC 1.1.26