Commit 8ed2e9dd authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Delete a property when the value is empty. JM-275


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1304 b35dd754-fafc-0310-a699-88a17e54d16e
parent de37c255
...@@ -108,8 +108,10 @@ public class VCardManager { ...@@ -108,8 +108,10 @@ public class VCardManager {
properties = loadPropertiesFromDb(username); properties = loadPropertiesFromDb(username);
vcardCache.put(username, properties); vcardCache.put(username, properties);
} }
properties.remove(name); if (properties.remove(name) != null) {
deletePropertyFromDb(username, name); // Delete the property from the DB if it was present in memory
deletePropertyFromDb(username, name);
}
} }
/** /**
......
...@@ -139,6 +139,10 @@ public class IQvCardHandler extends IQHandler { ...@@ -139,6 +139,10 @@ public class IQvCardHandler extends IQHandler {
VCardManager.getInstance().setVCardProperty(user.getUsername(), VCardManager.getInstance().setVCardProperty(user.getUsername(),
createName(nameStack), value); createName(nameStack), value);
} }
else {
VCardManager.getInstance().deleteVCardProperty(user.getUsername(),
createName(nameStack));
}
} }
readVCard(child, nameStack, user); readVCard(child, nameStack, user);
nameStack.remove(nameStack.size() - 1); nameStack.remove(nameStack.size() - 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment