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

Diff of /imapfilter/request.c

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

revision 1.17 by lefcha, Sat Nov 10 15:34:48 2001 UTC revision 1.18 by lefcha, Sat Dec 8 14:42:13 2001 UTC
# Line 9  Line 9 
9    
10    
11  extern unsigned int options;  extern unsigned int options;
12    extern unsigned int capabilities;
13    
14    static struct {
15        char prefix[NAMESPACE_PREFIX_LEN];
16        char delim;
17    } namesp;
18    
19    
20  #ifdef DEBUG  #ifdef DEBUG
# Line 27  int test(void) Line 33  int test(void)
33   */   */
34  int check_capabilities(void)  int check_capabilities(void)
35  {  {
36        capabilities = CAPABILITY_NONE;
37    
38      return capability_response(imap_capability());      return capability_response(imap_capability());
39  }  }
40    
41    
42  /*  /*
43     * Get namespace of mail server's mailboxes.
44     */
45    int check_namespace(void)
46    {
47        namesp.prefix[0] = namesp.delim = 0;
48    
49        if (!(options & OPTION_NAMESPACE) ||
50            !(capabilities & CAPABILITY_NAMESPACE))
51            return 0;
52        else
53            return namespace_response(imap_namespace(),
54                                      namesp.prefix, namesp.delim);
55    }
56    
57    
58    /*
59   * Login to server.   * Login to server.
60   */   */
61  int login(char *user, char *pass)  int login(char *user, char *pass)
# Line 41  int login(char *user, char *pass) Line 65  int login(char *user, char *pass)
65      return server_response(imap_login(user, pass));      return server_response(imap_login(user, pass));
66  }  }
67    
68    
69  /*  /*
70   * Open mailbox in read-write mode.   * Open mailbox in read-write mode.
71   */   */
# Line 52  int select_mailbox(char *mbox) Line 77  int select_mailbox(char *mbox)
77          return -2;              /* No messages exist. No filters need to          return -2;              /* No messages exist. No filters need to
78                                     be applied. */                                     be applied. */
79    
80      r = select_response(imap_select(mbox));      r = select_response(imap_select(apply_namespace(mbox, namesp.prefix,
81                                                        namesp.delim)));
82    
83      log_info(LOG_MAILBOX, mbox);      log_info(LOG_MAILBOX, mbox);
84    
# Line 65  int select_mailbox(char *mbox) Line 91  int select_mailbox(char *mbox)
91   */   */
92  int mailbox_status(char *mbox)  int mailbox_status(char *mbox)
93  {  {
94      return status_response(imap_status(mbox, "MESSAGES RECENT UNSEEN"), mbox);      return status_response(imap_status(apply_namespace(mbox, namesp.prefix,
95                                                           namesp.delim),
96                                           "MESSAGES RECENT UNSEEN"), mbox);
97  }  }
98    
99    
# Line 342  int apply_action(char *mesgs, unsigned i Line 370  int apply_action(char *mesgs, unsigned i
370      case FILTER_ACTION_COPY:      case FILTER_ACTION_COPY:
371          info("%d message%s copied to mailbox %s.\n", cnt, plural(cnt),          info("%d message%s copied to mailbox %s.\n", cnt, plural(cnt),
372               destmbox);               destmbox);
373          action_copy(mesgs, destmbox, args);          action_copy(mesgs, apply_namespace(destmbox, namesp.prefix,
374                                               namesp.delim), args);
375          break;          break;
376      case FILTER_ACTION_MOVE:      case FILTER_ACTION_MOVE:
377          info("%d message%s moved to mailbox %s.\n", cnt, plural(cnt),          info("%d message%s moved to mailbox %s.\n", cnt, plural(cnt),
378               destmbox);               destmbox);
379          action_move(mesgs, destmbox, args);          action_move(mesgs, apply_namespace(destmbox, namesp.prefix,
380                                               namesp.delim), args);
381          break;          break;
382      case FILTER_ACTION_LIST:      case FILTER_ACTION_LIST:
383          info("%d message%s listed.\n", cnt, plural(cnt));          info("%d message%s listed.\n", cnt, plural(cnt));

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26