/[imapfilter]/imapfilter/request.c
ViewVC logotype

Diff of /imapfilter/request.c

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

revision 1.57 by lefcha, Tue Feb 10 22:21:09 2004 UTC revision 1.58 by lefcha, Fri Feb 13 12:17:16 2004 UTC
# Line 2  Line 2 
2  #include "imapfilter.h"  #include "imapfilter.h"
3    
4    
5  extern conn_t connpri, connaux;  extern connection_t connpri, connaux;
6  extern opts_t opts;  extern options_t opts;
7    
8    
9  /*  /*
10   * Test/ping server.   * Test/ping server.
11   */   */
12  int  int
13  test(conn_t * conn)  test(connection_t * conn)
14  {  {
15          return server_response(conn, imap_noop(conn));          return response_generic(conn, imap_noop(conn));
16  }  }
17    
18    
# Line 20  test(conn_t * conn) Line 20  test(conn_t * conn)
20   * Check server's capabilities.   * Check server's capabilities.
21   */   */
22  int  int
23  check_capabilities(conn_t * conn)  check_capabilities(connection_t * conn)
24  {  {
25          conn->caps = CAPABILITY_NONE;          conn->caps = CAPS_NONE;
26    
27          return capability_response(conn, imap_capability(conn));          return response_capability(conn, imap_capability(conn));
28  }  }
29    
30    
# Line 32  check_capabilities(conn_t * conn) Line 32  check_capabilities(conn_t * conn)
32   * Get namespace of mail server's mailboxes.   * Get namespace of mail server's mailboxes.
33   */   */
34  int  int
35  check_namespace(conn_t * conn)  check_namespace(connection_t * conn)
36  {  {
37          conn->nsp.prefix[0] = conn->nsp.delim = '\0';          conn->ns.prefix[0] = conn->ns.delim = '\0';
38    
39          if (!opts.namespace || !(conn->caps & CAPABILITY_NAMESPACE))          if (!opts.namespace || !(conn->caps & CAPS_NAMESPACE))
40                  return 0;                  return 0;
41          else          else
42                  return namespace_response(conn, imap_namespace(conn));                  return response_namespace(conn, imap_namespace(conn));
43  }  }
44    
45    
# Line 48  check_namespace(conn_t * conn) Line 48  check_namespace(conn_t * conn)
48   * Begin TLS negotiation (STARTTLS).   * Begin TLS negotiation (STARTTLS).
49   */   */
50  int  int
51  negotiate_tls(conn_t * conn)  negotiate_tls(connection_t * conn)
52  {  {
53          int r;          int r;
54    
55          r = server_response(conn, imap_starttls(conn));          r = response_generic(conn, imap_starttls(conn));
56          init_secure_connection(conn, SSL_TLS_V1);          init_secure_connection(conn, SSL_TLS_V1);
57    
58          return r;          return r;
# Line 64  negotiate_tls(conn_t * conn) Line 64  negotiate_tls(conn_t * conn)
64   * Login to server.   * Login to server.
65   */   */
66  int  int
67  login(conn_t * conn, char *user, char *pass)  login(connection_t * conn, char *user, char *pass)
68  {  {
69          return server_response(conn, imap_login(conn, user, pass));          return response_generic(conn, imap_login(conn, user, pass));
70  }  }
71    
72    
# Line 75  login(conn_t * conn, char *user, char *p Line 75  login(conn_t * conn, char *user, char *p
75   * Check if a mailbox exists.   * Check if a mailbox exists.
76   */   */
77  int  int
78  check_mailbox(conn_t * conn, char *mbox)  check_mailbox(connection_t * conn, char *mbox)
79  {  {
80          return server_response(conn, imap_status(conn, mbox, "MESSAGES"));          return response_generic(conn, imap_status(conn, mbox, "MESSAGES"));
81  }  }
82    
83    
# Line 85  check_mailbox(conn_t * conn, char *mbox) Line 85  check_mailbox(conn_t * conn, char *mbox)
85   * Open mailbox in read-write mode.   * Open mailbox in read-write mode.
86   */   */
87  int  int
88  select_mailbox(conn_t * conn, char *mbox)  select_mailbox(connection_t * conn, char *mbox)
89  {  {
90          int r;          int r;
91    
# Line 93  select_mailbox(conn_t * conn, char *mbox Line 93  select_mailbox(conn_t * conn, char *mbox
93                  return -2;      /* No messages exist. No filters need to be                  return -2;      /* No messages exist. No filters need to be
94                                   * applied. */                                   * applied. */
95    
96          r = select_response(conn, imap_select(conn,          r = response_select(conn, imap_select(conn,
97                  apply_namespace(mbox, conn->nsp.prefix, conn->nsp.delim)));                  apply_namespace(mbox, conn->ns.prefix, conn->ns.delim)));
98    
99          log_info(LOG_MAILBOX, mbox);          log_info(LOG_MBOX, mbox);
100    
101          return r;          return r;
102  }  }
# Line 106  select_mailbox(conn_t * conn, char *mbox Line 106  select_mailbox(conn_t * conn, char *mbox
106   * Get mailbox's status.   * Get mailbox's status.
107   */   */
108  int  int
109  mailbox_status(conn_t * conn, char *mbox)  mailbox_status(connection_t * conn, char *mbox)
110  {  {
111          return status_response(conn, imap_status(conn,          return response_status(conn, imap_status(conn,
112                  apply_namespace(mbox, conn->nsp.prefix, conn->nsp.delim),                  apply_namespace(mbox, conn->ns.prefix, conn->ns.delim),
113                  "MESSAGES RECENT UNSEEN"), mbox);                  "MESSAGES RECENT UNSEEN"), mbox);
114  }  }
115    
# Line 118  mailbox_status(conn_t * conn, char *mbox Line 118  mailbox_status(conn_t * conn, char *mbox
118   * Close examined/selected mailbox.   * Close examined/selected mailbox.
119   */   */
120  int  int
121  close_mailbox(conn_t * conn)  close_mailbox(connection_t * conn)
122  {  {
123          return server_response(conn, imap_close(conn));          return response_generic(conn, imap_close(conn));
124  }  }
125    
126    
# Line 128  close_mailbox(conn_t * conn) Line 128  close_mailbox(conn_t * conn)
128   * Logout from server.   * Logout from server.
129   */   */
130  int  int
131  logout(conn_t * conn)  logout(connection_t * conn)
132  {  {
133          return logout_response(conn, imap_logout(conn));          return response_logout(conn, imap_logout(conn));
134  }  }

Legend:
Removed from v.1.57  
changed lines
  Added in v.1.58

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26