2525 */
2626struct section {
2727 char name [16 ];
28- int disabled ;
29- struct strbuf exclude_groups ;
3028 struct strbuf patterns ;
3129 struct strbuf excludes ;
3230 struct section * next ; /* linked list */
3331};
3432
3533struct config {
36- int only_main_frame ;
37- int ignore_query_string ;
34+ int warning_when_close_dialog ;
3835 struct section * section ;
3936};
4037
@@ -64,9 +61,9 @@ static struct section *new_section(char *line)
6461 * You can define variables/URLs in each section like this:
6562 *
6663 * [GLOBAL]
67- * @TOP_PAGE_ONLY
64+ * @WARNING_WHEN_CLOSE_DIALOG
6865 *
69- * [Edge ]
66+ * [TARGETS ]
7067 * https://example.com*
7168 * -https://test.example.com*
7269 *
@@ -77,7 +74,6 @@ static void parse_conf(char *data, struct config *conf)
7774{
7875 char * line ;
7976 int global ;
80- int _default ;
8177 struct section * section ;
8278 struct section * * indirect = & conf -> section ;
8379
@@ -89,14 +85,10 @@ static void parse_conf(char *data, struct config *conf)
8985 break ;
9086 case '[' :
9187 global = 0 ;
92- _default = 0 ;
9388
9489 if (strcmp (line , "[GLOBAL]" ) == 0 ) {
9590 global = 1 ;
9691 }
97- else if (strcmp (line , "[Default]" ) == 0 ) {
98- _default = 1 ;
99- }
10092 else {
10193 section = new_section (line );
10294 * indirect = section ;
@@ -105,20 +97,9 @@ static void parse_conf(char *data, struct config *conf)
10597 break ;
10698 case '@' :
10799 if (global ) {
108- if (strcmp (line , "@TOP_PAGE_ONLY" ) == 0 ) {
109- conf -> ignore_query_string = 1 ;
110- }
111- else if (strcmp (line , "@ONLY_MAIN_FRAME" ) == 0 ) {
112- conf -> only_main_frame = 1 ;
113- }
114- }
115- else if (section ) {
116- if (strcmp (line , "@DISABLED" ) == 0 ) {
117- section -> disabled = 1 ;
118- }
119- else if (strstr (line , "@EXCLUDE_GROUP:" ) == line ) {
120- strbuf_concat (& section -> exclude_groups , line + strlen ("@EXCLUDE_GROUP:" ));
121- strbuf_putchar (& section -> exclude_groups , '\n' );
100+ if (line == "@WARNING_WHEN_CLOSE_DIALOG" )
101+ {
102+ conf .warning_when_close_dialog = true;
122103 }
123104 }
124105 break ;
@@ -150,22 +131,6 @@ static char *dump_section(struct section *section)
150131 strbuf_concat_jsonstr (& sb , section -> name , strlen (section -> name ));
151132 strbuf_putchar (& sb , ',' );
152133
153- strbuf_concat (& sb , "\"ExcludeGroups\":[" );
154- if (section -> exclude_groups .buf ) {
155- ptr = section -> exclude_groups .buf ;
156- need_comma = 0 ;
157- while (* ptr ) {
158- if (need_comma )
159- strbuf_putchar (& sb , ',' );
160-
161- end = strchr (ptr , '\n' );
162- strbuf_concat_jsonstr (& sb , ptr , end - ptr );
163- need_comma = 1 ;
164- ptr = end + 1 ;
165- }
166- }
167- strbuf_concat (& sb , "]," );
168-
169134 /* URLPatterns */
170135 strbuf_concat (& sb , "\"Patterns\":[" );
171136 if (section -> patterns .buf ) {
@@ -211,14 +176,9 @@ static char *dump_json(struct config *conf)
211176 char * json ;
212177 int need_comma ;
213178
214- /* OnlyMainFrame */
215- strbuf_concat (& sb , "{\"OnlyMainFrame\":" );
216- strbuf_concat (& sb , _itoa (conf -> only_main_frame , buf , 10 ));
217- strbuf_putchar (& sb , ',' );
218-
219- /* IgnoreQueryString */
220- strbuf_concat (& sb , "\"IgnoreQueryString\":" );
221- strbuf_concat (& sb , _itoa (conf -> ignore_query_string , buf , 10 ));
179+ /* WarningWhenCloseDialog */
180+ strbuf_concat (& sb , "\"WarningWhenCloseDialog\":" );
181+ strbuf_concat (& sb , _itoa (conf -> warning_when_close_dialog , buf , 10 ));
222182 strbuf_putchar (& sb , ',' );
223183
224184 /* Sections */
@@ -227,8 +187,8 @@ static char *dump_json(struct config *conf)
227187 section = conf -> section ;
228188 need_comma = 0 ;
229189 while (section ) {
230- /* Disabled or no pattern defined */
231- if (section -> disabled || section -> patterns .buf == NULL ) {
190+ /* no pattern defined */
191+ if (section -> patterns .buf == NULL ) {
232192 section = section -> next ;
233193 continue ;
234194 }
0 commit comments