|
|
@ -29,6 +29,8 @@ |
|
|
|
#include <stdlib.h> |
|
|
|
#include <stdlib.h> |
|
|
|
#include <stdio.h> |
|
|
|
#include <stdio.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int local_home, local_root; |
|
|
|
|
|
|
|
|
|
|
|
static char * |
|
|
|
static char * |
|
|
|
my_strndup( const char *s, size_t nchars ) |
|
|
|
my_strndup( const char *s, size_t nchars ) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -119,13 +121,16 @@ load_config( const char *path, config_t ***stor ) |
|
|
|
cfg = **stor = nfmalloc( sizeof(config_t) ); |
|
|
|
cfg = **stor = nfmalloc( sizeof(config_t) ); |
|
|
|
*stor = &cfg->next; |
|
|
|
*stor = &cfg->next; |
|
|
|
memcpy( cfg, &global, sizeof(config_t) ); |
|
|
|
memcpy( cfg, &global, sizeof(config_t) ); |
|
|
|
if (val[0] == '~' && val[1] == '/') |
|
|
|
if (val[0] == '~' && val[1] == '/') { |
|
|
|
val += 2; |
|
|
|
val += 2; |
|
|
|
else { |
|
|
|
local_home = 1; |
|
|
|
int l = strlen( Home ); |
|
|
|
} else if (!memcmp( val, Home, HomeLen ) && val[HomeLen] == '/') { |
|
|
|
if (!memcmp( val, Home, l ) && val[l] == '/') |
|
|
|
val += HomeLen + 1; |
|
|
|
val += l + 1; |
|
|
|
local_home = 1; |
|
|
|
} |
|
|
|
} else if (val[0] == '/') |
|
|
|
|
|
|
|
local_root = 1; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
local_home = 1; |
|
|
|
/* not expanded at this point */ |
|
|
|
/* not expanded at this point */ |
|
|
|
cfg->path = nfstrdup( val ); |
|
|
|
cfg->path = nfstrdup( val ); |
|
|
|
} else if (!strcasecmp( "OneToOne", cmd )) { |
|
|
|
} else if (!strcasecmp( "OneToOne", cmd )) { |
|
|
@ -343,7 +348,11 @@ write_config( int fd ) |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fprintf( fp, "SyncState *\n\nMaildirStore local\nPath \"%s/\"\nAltMap %s\n\n", maildir, tb( altmap > 0 ) ); |
|
|
|
fprintf( fp, "SyncState *\n\n" ); |
|
|
|
|
|
|
|
if (local_home || o2o) |
|
|
|
|
|
|
|
fprintf( fp, "MaildirStore local\nPath \"%s/\"\nAltMap %s\n\n", maildir, tb( altmap > 0 ) ); |
|
|
|
|
|
|
|
if (local_root) |
|
|
|
|
|
|
|
fprintf( fp, "MaildirStore local_root\nPath /\nAltMap %s\n\n", tb( altmap > 0 ) ); |
|
|
|
if (o2o) { |
|
|
|
if (o2o) { |
|
|
|
write_imap_server( fp, &global ); |
|
|
|
write_imap_server( fp, &global ); |
|
|
|
write_imap_store( fp, &global ); |
|
|
|
write_imap_store( fp, &global ); |
|
|
@ -417,8 +426,12 @@ write_config( int fd ) |
|
|
|
box->channels = 1; |
|
|
|
box->channels = 1; |
|
|
|
box->channel_name = cn; |
|
|
|
box->channel_name = cn; |
|
|
|
gotchan: |
|
|
|
gotchan: |
|
|
|
fprintf( fp, "Channel %s\nMaster :%s:%s\nSlave :local:%s\n", |
|
|
|
if (box->path[0] == '/') |
|
|
|
box->channel_name, box->store_name, box->box, box->path ); |
|
|
|
fprintf( fp, "Channel %s\nMaster :%s:%s\nSlave :local_root:%s\n", |
|
|
|
|
|
|
|
box->channel_name, box->store_name, box->box, box->path + 1 ); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
fprintf( fp, "Channel %s\nMaster :%s:%s\nSlave :local:%s\n", |
|
|
|
|
|
|
|
box->channel_name, box->store_name, box->box, box->path ); |
|
|
|
write_channel_parm( fp, box ); |
|
|
|
write_channel_parm( fp, box ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -433,6 +446,8 @@ find_box( const char *s ) |
|
|
|
config_t *p; |
|
|
|
config_t *p; |
|
|
|
char *t; |
|
|
|
char *t; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!memcmp( s, Home, HomeLen ) && s[HomeLen] == '/') |
|
|
|
|
|
|
|
s += HomeLen + 1; |
|
|
|
for (p = boxes; p; p = p->next) { |
|
|
|
for (p = boxes; p; p = p->next) { |
|
|
|
if (!strcmp( s, p->path ) || (p->alias && !strcmp( s, p->alias ))) |
|
|
|
if (!strcmp( s, p->path ) || (p->alias && !strcmp( s, p->alias ))) |
|
|
|
return p; |
|
|
|
return p; |
|
|
|