Change summary
src/main/java/eu/siacs/conversations/entities/Contact.java | 8 ++++++++
src/main/java/eu/siacs/conversations/ui/XmppActivity.java | 5 ++++-
2 files changed, 12 insertions(+), 1 deletion(-)
Detailed changes
@@ -369,6 +369,12 @@ public class Contact implements ListItem, Blockable {
return groups;
}
+ public void copySystemTagsToGroups() {
+ for (String tag : getSystemTags(true)) {
+ this.groups.put(tag);
+ }
+ }
+
private Collection<String> getSystemTags(final boolean unique) {
final Collection<String> tags = unique ? new HashSet<>() : new ArrayList<>();
for (int i = 0; i < this.systemTags.length(); ++i) {
@@ -490,6 +496,8 @@ public class Contact implements ListItem, Blockable {
item.setAttribute("jid", this.jid);
if (this.serverName != null) {
item.setAttribute("name", this.serverName);
+ } else {
+ item.setAttribute("name", getDisplayName());
}
for (String group : getGroups(false)) {
item.addChild("group").setContent(group);
@@ -689,7 +689,10 @@ public abstract class XmppActivity extends ActionBarActivity {
builder.setTitle(contact.getJid().toString());
builder.setMessage(getString(R.string.not_in_roster));
builder.setNegativeButton(getString(R.string.cancel), null);
- builder.setPositiveButton(getString(R.string.add_contact), (dialog, which) -> xmppConnectionService.createContact(contact, true));
+ builder.setPositiveButton(getString(R.string.add_contact), (dialog, which) -> {
+ contact.copySystemTagsToGroups();
+ xmppConnectionService.createContact(contact, true);
+ });
builder.create().show();
}