CVS commit by ossi: 

aggregate all (two ...) drivers in an array instead of naming them in
each (one ...) location explicitly.


  M +14 -12    config.c   1.31
  M +3 -0      isync.h   1.56


--- isync/src/config.c  #1.30:1.31
@@ -33,4 +33,6 @@
 #include <stdio.h>
 
+driver_t *drivers[N_DRIVERS] = { &maildir_driver, &imap_driver };
+
 store_conf_t *stores;
 channel_conf_t *channels;
@@ -257,5 +259,5 @@ load_config( const char *where, int pseu
        string_list_t *chanlist, **chanlistapp;
        char *arg, *p;
-       int err, len, cops, gcops, max_size, ms;
+       int err, len, cops, gcops, max_size, ms, i;
        char path[_POSIX_PATH_MAX];
        char buf[1024];
@@ -284,7 +286,6 @@ load_config( const char *where, int pseu
                if (!cfile.cmd)
                        continue;
-               if (imap_driver.parse_store( &cfile, &store, &err ) ||
-                   maildir_driver.parse_store( &cfile, &store, &err ))
-               {
+               for (i = 0; i < N_DRIVERS; i++)
+                       if (drivers[i]->parse_store( &cfile, &store, &err )) {
                        if (store) {
                                if (!store->path)
@@ -294,6 +295,7 @@ load_config( const char *where, int pseu
                                *storeapp = 0;
                        }
+                               goto reloop;
                }
-               else if (!strcasecmp( "Channel", cfile.cmd ))
+               if (!strcasecmp( "Channel", cfile.cmd ))
                {
                        channel = nfcalloc( sizeof(*channel) );

--- isync/src/isync.h  #1.55:1.56
@@ -250,4 +250,7 @@ int sync_boxes( store_t *ctx[], const ch
 /* config.c */
 
+#define N_DRIVERS 2
+extern driver_t *drivers[N_DRIVERS];
+
 extern channel_conf_t *channels;
 extern group_conf_t *groups;




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to