+ private bool remove_duplicates(IdCard card)
+ {
+ bool duplicate_found = false;
+ bool found = false;
+ do {
+ var cards = get_card_list();
+ found = false;
+ foreach (IdCard id_card in cards) {
+ if ((card != id_card) && (id_card.nai == card.nai)) {
+ stdout.printf("removing duplicate id for '%s'\n", card.nai);
+ remove_card_internal(id_card);
+ found = duplicate_found = true;
+ break;
+ }
+ }
+ } while (found);
+ return duplicate_found;
+ }
+
+ public IdCard? find_id_card(string nai, bool force_flat_file_store) {
+ IdCard? retval = null;
+ IIdentityCardStore.StoreType saved_store_type = get_store_type();
+ if (force_flat_file_store)
+ set_store_type(IIdentityCardStore.StoreType.FLAT_FILE);
+
+ foreach (IdCard id in get_card_list()) {
+ if (id.nai == nai) {
+ retval = id;
+ break;
+ }
+ }
+ set_store_type(saved_store_type);
+ if (force_flat_file_store &&
+ (saved_store_type != IIdentityCardStore.StoreType.FLAT_FILE))
+ card_list_changed();
+ return retval;
+ }
+