comparison src/conf.c @ 192:89f951be358f

REMOVED POP3 SUPPORT masqmail will not include a POP3 client anymore from 0.3.0 on maybe the POP3 code will be reworked into a standalone program some day if you rely on the POP3 client, use fetchmail or something similar instead
author meillo@marmaro.de
date Thu, 15 Jul 2010 14:24:40 +0200
parents 6b4a101a2455
children 4fd237550525
comparison
equal deleted inserted replaced
191:f186650135c3 192:89f951be358f
546 conf.online_file = g_strdup(rval); 546 conf.online_file = g_strdup(rval);
547 else if (strcmp(lval, "online_pipe") == 0) 547 else if (strcmp(lval, "online_pipe") == 0)
548 conf.online_pipe = g_strdup(rval); 548 conf.online_pipe = g_strdup(rval);
549 else if (strcmp(lval, "do_queue") == 0) 549 else if (strcmp(lval, "do_queue") == 0)
550 conf.do_queue = parse_boolean(rval); 550 conf.do_queue = parse_boolean(rval);
551 else if (strncmp(lval, "get.", 4) == 0) { 551 else if (strcmp(lval, "errmsg_file") == 0)
552 #ifdef ENABLE_POP3
553 table_pair *pair = create_pair_string(&(lval[4]), rval);
554 conf.get_names = g_list_append(conf.get_names, pair);
555 #else
556 logwrite(LOG_WARNING, "get.<name> ignored: not compiled with pop support\n");
557 #endif
558 } else if (strncmp(lval, "online_gets.", 12) == 0) {
559 #ifdef ENABLE_POP3
560 GList *file_list = parse_list(rval, FALSE);
561 table_pair *pair = create_pair(&(lval[12]), file_list);
562 conf.online_gets = g_list_append(conf.online_gets, pair);
563 #else
564 logwrite(LOG_WARNING, "online_gets.<name> ignored: not compiled with pop support\n");
565 #endif
566 } else if (strcmp(lval, "errmsg_file") == 0)
567 conf.errmsg_file = g_strdup(rval); 552 conf.errmsg_file = g_strdup(rval);
568 else if (strcmp(lval, "warnmsg_file") == 0) 553 else if (strcmp(lval, "warnmsg_file") == 0)
569 conf.warnmsg_file = g_strdup(rval); 554 conf.warnmsg_file = g_strdup(rval);
570 else if (strcmp(lval, "warn_intervals") == 0) 555 else if (strcmp(lval, "warn_intervals") == 0)
571 conf.warn_intervals = parse_list(rval, FALSE); 556 conf.warn_intervals = parse_list(rval, FALSE);
894 destroy_route(route); 879 destroy_route(route);
895 } 880 }
896 g_list_free(list); 881 g_list_free(list);
897 } 882 }
898 883
899 #ifdef ENABLE_POP3
900
901 get_conf*
902 read_get_conf(gchar * filename)
903 {
904 FILE *in;
905
906 get_conf *gc = g_malloc(sizeof(get_conf));
907 memset(gc, 0, sizeof(get_conf));
908
909 gc->server_port = 110;
910
911 if ((in = fopen(filename, "r")) == NULL) {
912 logwrite(LOG_ALERT, "could not open get file %s: %s\n", filename, strerror(errno));
913 g_free(gc);
914 return NULL;
915 }
916
917 gchar lval[256], rval[2048];
918 while (read_statement(in, lval, 256, rval, 2048)) {
919 if (strcmp(lval, "protocol") == 0)
920 gc->protocol = g_strdup(rval);
921 else if (strcmp(lval, "server") == 0)
922 gc->server_name = g_strdup(rval);
923 else if (strcmp(lval, "port") == 0)
924 gc->server_port = atoi(rval);
925 else if (strcmp(lval, "wrapper") == 0)
926 gc->wrapper = g_strdup(rval);
927 else if (strcmp(lval, "user") == 0)
928 gc->login_user = g_strdup(rval);
929 else if (strcmp(lval, "pass") == 0)
930 gc->login_pass = g_strdup(rval);
931 else if (strcmp(lval, "address") == 0)
932 gc->address = create_address_qualified(rval, TRUE, conf.host_name);
933 else if (strcmp(lval, "return_path") == 0)
934 gc->return_path = create_address_qualified(rval, TRUE, conf.host_name);
935 else if (strcmp(lval, "do_ssl") == 0)
936 /* we ignore this. This option is used by sqilconf */
937 ;
938 else if (strcmp(lval, "do_keep") == 0)
939 gc->do_keep = parse_boolean(rval);
940 else if (strcmp(lval, "do_uidl") == 0)
941 gc->do_uidl = parse_boolean(rval);
942 else if (strcmp(lval, "do_uidl_dele") == 0)
943 gc->do_uidl_dele = parse_boolean(rval);
944 else if (strcmp(lval, "max_size") == 0)
945 gc->max_size = atoi(rval);
946 else if (strcmp(lval, "max_size_delete") == 0)
947 gc->max_size_delete = parse_boolean(rval);
948 else if (strcmp(lval, "max_count") == 0)
949 gc->max_count = atoi(rval);
950 else if (strcmp(lval, "resolve_list") == 0)
951 gc->resolve_list = parse_resolve_list(rval);
952 else
953 logwrite(LOG_WARNING, "var '%s' not (yet) known, ignored\n", lval);
954 }
955 fclose(in);
956
957 if (gc->resolve_list == NULL) {
958 #ifdef ENABLE_RESOLVER
959 gc->resolve_list = g_list_append(NULL, resolve_dns_a);
960 #endif
961 gc->resolve_list = g_list_append(NULL, resolve_byname);
962 }
963
964 if (gc->protocol == NULL)
965 gc->protocol = g_strdup("pop3");
966 return gc;
967 }
968
969 void
970 destroy_get_conf(get_conf * gc)
971 {
972 if (gc->protocol)
973 g_free(gc->protocol);
974 if (gc->server_name)
975 g_free(gc->server_name);
976 if (gc->login_user)
977 g_free(gc->login_user);
978 if (gc->login_pass)
979 g_free(gc->login_pass);
980 if (gc->wrapper)
981 g_free(gc->wrapper);
982 if (gc->address)
983 destroy_address(gc->address);
984 if (gc->return_path)
985 destroy_address(gc->return_path);
986 if (gc->resolve_list)
987 g_list_free(gc->resolve_list);
988 g_free(gc);
989 }
990
991 #endif
992
993 connect_route* 884 connect_route*
994 create_local_route() 885 create_local_route()
995 { 886 {
996 connect_route *route; 887 connect_route *route;
997 888