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

Diff of /imapfilter/imapfilter.c

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

revision 1.31 by lefcha, Fri Feb 8 22:15:43 2002 UTC revision 1.32 by lefcha, Tue Jun 18 21:16:34 2002 UTC
# Line 10  Line 10 
10  #include "data.h"  #include "data.h"
11    
12    
13    extern int sockpri;
14  extern account_t *accounts;  extern account_t *accounts;
15  extern filter_t *filters;  extern filter_t *filters;
16    extern namesp_t nsppri;
17    
18  unsigned int options;           /* Program options. */  unsigned int options;           /* Program options. */
19  unsigned int flags = 0;         /* Program flags. */  unsigned int flags = 0;         /* Program flags. */
# Line 87  int main(int argc, char *argv[]) Line 89  int main(int argc, char *argv[])
89              break;              break;
90          }          }
91      }      }
92    
93        create_homedir();
94                    
95      lockfile_check();      lockfile_check();
96      lockfile_create();      lockfile_create();
# Line 96  int main(int argc, char *argv[]) Line 100  int main(int argc, char *argv[])
100      tty_store();      tty_store();
101      catch_signals();      catch_signals();
102    
     create_homedir();  
   
103      read_config(confile);      read_config(confile);
104      open_logfile();      
           
   
105  #ifdef ENCRYPTED_PASSWORDS  #ifdef ENCRYPTED_PASSWORDS
106      read_passwords();      read_passwords();
107            
108      if ((options & OPTION_PASSWORD_EDITOR))      if ((options & OPTION_PASSWORD_EDITOR)) {
109          password_editor();          password_editor();
110            
111            secmem_clear();
112            lockfile_remove();
113            
114            exit(0);
115        }
116  #endif  #endif
117        
118        open_logfile();
119    
120        init_vbuf();
121    
122    
123      if (options & OPTION_DAEMON_MODE) {      if (options & OPTION_DAEMON_MODE) {
124          f = 1;          f = 1;
# Line 118  int main(int argc, char *argv[]) Line 129  int main(int argc, char *argv[])
129      do {      do {
130          for (ca = accounts; ca; ca = ca->next) {          for (ca = accounts; ca; ca = ca->next) {
131    
132          if (init_connection(ca->server, ca->port, ca->ssl))          if (init_connection(&sockpri, ca->server, ca->port, ca->ssl))
133              continue;              continue;
134    
135          r = greeting_response();          r = greeting_response(&sockpri);
136    
137          if (r == RESPONSE_BYE || check_capabilities())          if (r == RESPONSE_BYE || check_capabilities(&sockpri))
138              continue;              continue;
139    
140  #ifdef DEBUG  #ifdef DEBUG
141          test();          test(&sockpri);
142  #endif  #endif
143    
144          if (r != RESPONSE_PREAUTH) {          if (r != RESPONSE_PREAUTH) {
# Line 136  int main(int argc, char *argv[]) Line 147  int main(int argc, char *argv[])
147                  get_password(ca->password, PASSWORD_LEN);                  get_password(ca->password, PASSWORD_LEN);
148                  ca->passwdattr = PASSWORD_PLAIN;                  ca->passwdattr = PASSWORD_PLAIN;
149              }              }
150              if (login(ca->username, ca->password) == RESPONSE_NO) {              if (login(&sockpri, ca->username, ca->password) == RESPONSE_NO) {
151                  error("imapfilter: username %s or password rejected at %s\n",                  error("imapfilter: username %s or password rejected at %s\n",
152                        ca->username, ca->server);                        ca->username, ca->server);
153                  continue;                  continue;
154              }              }
155          }          }
156          check_namespace();          check_namespace(&sockpri, &nsppri);
157    
158          for (cm = ca->mboxes; cm; cm = cm->next)          for (cm = ca->mboxes; cm; cm = cm->next)
159              if (!*cm->filters)              if (!*cm->filters)
160                  mailbox_status(cm->name);                  mailbox_status(&sockpri, cm->name, &nsppri);
161              else if (!select_mailbox(cm->name)) {              else if (!select_mailbox(&sockpri, cm->name, &nsppri)) {
162                  apply_filters(cm->filters);                  apply_filters(cm->filters);
163                  close_mailbox();                  close_mailbox(&sockpri);
164              }              }
165          logout();          logout(&sockpri);
166    
167          close_connection();          close_connection(&sockpri);
168      }      }
169                    
170        /* Fork if in daemon mode. */      
171      if (f) {      if (f) {
172          f = 0;          f = 0;
173          pid = fork();          pid = fork();

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26