if (Wallet_BadKey()) {
if (!Wallet_KeySet()) {
wallet_Capture(nsIDocument* doc, nsString field, nsString value, nsString vcard) {  /* do nothing if there is no value */  if (!value.Length()) {    return;  }  /* read in the mappings if they are not already present */  if (!vcard.Length()) {    wallet_Initialize();    wallet_InitializeCurrentURL(doc);    if (Wallet_BadKey()) {      return;    }  }  nsAutoString oldValue;  /* is there a mapping from this field name to a schema name */  nsAutoString schema(vcard);  XP_List* FieldToSchema_list = wallet_FieldToSchema_list;  XP_List* URLFieldToSchema_list = wallet_specificURLFieldToSchema_list;  XP_List* SchemaToValue_list = wallet_SchemaToValue_list;  XP_List* dummy;  if (schema.Length() ||      (wallet_ReadFromList(field, schema, dummy, URLFieldToSchema_list)) ||      (wallet_ReadFromList(field, schema, dummy, FieldToSchema_list))) {    /* field to schema mapping already exists */    /* is this a new value for the schema */    if (!(wallet_ReadFromList(schema, oldValue, dummy, SchemaToValue_list)) ||         (oldValue != value)) {      /* this is a new value so store it */      nsAutoString * aValue = new nsAutoString(value);      nsAutoString * aSchema = new nsAutoString(schema);      dummy = 0;      wallet_WriteToList(*aSchema, *aValue, dummy, wallet_SchemaToValue_list);      wallet_WriteToFile("SchemaValue.tbl", wallet_SchemaToValue_list, PR_TRUE);    }  } else {    /* no field to schema mapping so assume schema name is same as field name */    /* is this a new value for the schema */    if (!(wallet_ReadFromList(field, oldValue, dummy, SchemaToValue_list)) ||        (oldValue != value)) {      /* this is a new value so store it */      nsAutoString * aField = new nsAutoString(field);      nsAutoString * aValue = new nsAutoString(value);      dummy = 0;      wallet_WriteToList(*aField, *aValue, dummy, wallet_SchemaToValue_list);      wallet_WriteToFile("SchemaValue.tbl", wallet_SchemaToValue_list, PR_TRUE);    }  }}