@@ -69,6 +69,7 @@ struct imap_server_conf {
69
69
char * tunnel ;
70
70
char * host ;
71
71
int port ;
72
+ char * folder ;
72
73
char * user ;
73
74
char * pass ;
74
75
int use_ssl ;
@@ -82,6 +83,7 @@ static struct imap_server_conf server = {
82
83
NULL , /* tunnel */
83
84
NULL , /* host */
84
85
0 , /* port */
86
+ NULL , /* folder */
85
87
NULL , /* user */
86
88
NULL , /* pass */
87
89
0 , /* use_ssl */
@@ -523,7 +525,7 @@ static struct imap_cmd *issue_imap_cmd(struct imap_store *ctx,
523
525
if (Verbose ) {
524
526
if (imap -> num_in_progress )
525
527
printf ("(%d in progress) " , imap -> num_in_progress );
526
- if (memcmp (cmd -> cmd , "LOGIN" , 5 ))
528
+ if (! starts_with (cmd -> cmd , "LOGIN" ))
527
529
printf (">>> %s" , buf );
528
530
else
529
531
printf (">>> %d LOGIN <user> <pass>\n" , cmd -> tag );
@@ -791,7 +793,7 @@ static int get_cmd_result(struct imap_store *ctx, struct imap_cmd *tcmd)
791
793
else /*if (!strcmp("BAD", arg))*/
792
794
resp = RESP_BAD ;
793
795
fprintf (stderr , "IMAP command '%s' returned response (%s) - %s\n" ,
794
- memcmp (cmdp -> cmd , "LOGIN" , 5 ) ?
796
+ ! starts_with (cmdp -> cmd , "LOGIN" ) ?
795
797
cmdp -> cmd : "LOGIN <user> <pass>" ,
796
798
arg , cmd ? cmd : "" );
797
799
}
@@ -924,17 +926,16 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f
924
926
/* open connection to IMAP server */
925
927
926
928
if (srvc -> tunnel ) {
927
- const char * argv [] = { srvc -> tunnel , NULL };
928
929
struct child_process tunnel = CHILD_PROCESS_INIT ;
929
930
930
931
imap_info ("Starting tunnel '%s'... " , srvc -> tunnel );
931
932
932
- tunnel .argv = argv ;
933
+ argv_array_push ( & tunnel .args , srvc -> tunnel ) ;
933
934
tunnel .use_shell = 1 ;
934
935
tunnel .in = -1 ;
935
936
tunnel .out = -1 ;
936
937
if (start_command (& tunnel ))
937
- die ("cannot start proxy %s" , argv [ 0 ] );
938
+ die ("cannot start proxy %s" , srvc -> tunnel );
938
939
939
940
imap -> buf .sock .fd [0 ] = tunnel .out ;
940
941
imap -> buf .sock .fd [1 ] = tunnel .in ;
@@ -1306,15 +1307,13 @@ static int split_msg(struct strbuf *all_msgs, struct strbuf *msg, int *ofs)
1306
1307
return 1 ;
1307
1308
}
1308
1309
1309
- static char * imap_folder ;
1310
-
1311
1310
static void git_imap_config (void )
1312
1311
{
1313
1312
const char * val = NULL ;
1314
1313
1315
1314
git_config_get_bool ("imap.sslverify" , & server .ssl_verify );
1316
1315
git_config_get_bool ("imap.preformattedhtml" , & server .use_html );
1317
- git_config_get_string ("imap.folder" , & imap_folder );
1316
+ git_config_get_string ("imap.folder" , & server . folder );
1318
1317
1319
1318
if (!git_config_get_value ("imap.host" , & val )) {
1320
1319
if (!val ) {
@@ -1362,7 +1361,7 @@ int main(int argc, char **argv)
1362
1361
if (!server .port )
1363
1362
server .port = server .use_ssl ? 993 : 143 ;
1364
1363
1365
- if (!imap_folder ) {
1364
+ if (!server . folder ) {
1366
1365
fprintf (stderr , "no imap store specified\n" );
1367
1366
return 1 ;
1368
1367
}
@@ -1392,7 +1391,7 @@ int main(int argc, char **argv)
1392
1391
}
1393
1392
1394
1393
/* write it to the imap server */
1395
- ctx = imap_open_store (& server , imap_folder );
1394
+ ctx = imap_open_store (& server , server . folder );
1396
1395
if (!ctx ) {
1397
1396
fprintf (stderr , "failed to open store\n" );
1398
1397
return 1 ;
0 commit comments