Commit c6594c99 c6594c9993275c999d7d70b7c63bb49070da1414 by Sergey Poznyakoff

(sieve_tag_lookup): New function.

1 parent dee48251
...@@ -359,7 +359,35 @@ sieve_print_tag_list (list_t list, sieve_printf_t printer, void *data) ...@@ -359,7 +359,35 @@ sieve_print_tag_list (list_t list, sieve_printf_t printer, void *data)
359 list_do (list, (list_action_t*) tag_printer, &dbg); 359 list_do (list, (list_action_t*) tag_printer, &dbg);
360 } 360 }
361 361
362 362 static int
363 tag_finder (void *item, void *data)
364 {
365 sieve_runtime_tag_t *val = item;
366 sieve_runtime_tag_t *target = data;
367
368 if (strcmp (val->tag, target->tag) == 0)
369 {
370 target->arg = val->arg;
371 return 1;
372 }
373 return 0;
374 }
375
376 int
377 sieve_tag_lookup (list_t taglist, char *name, sieve_value_t **arg)
378 {
379 sieve_runtime_tag_t t;
380
381 t.tag = name;
382 if (list_do (taglist, tag_finder, &t))
383 {
384 if (arg)
385 *arg = t.arg;
386 return 1;
387 }
388 return 0;
389 }
390
363 int 391 int
364 sieve_mark_deleted (message_t msg, int deleted) 392 sieve_mark_deleted (message_t msg, int deleted)
365 { 393 {
......