made tags searchable
This commit is contained in:
parent
8c4236b01b
commit
2036c58cd7
|
@ -2,8 +2,8 @@ package eu.siacs.conversations.entities;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
|
import eu.siacs.conversations.utils.UIHelper;
|
||||||
import eu.siacs.conversations.xml.Element;
|
import eu.siacs.conversations.xml.Element;
|
||||||
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
|
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
|
||||||
import eu.siacs.conversations.xmpp.jid.Jid;
|
import eu.siacs.conversations.xmpp.jid.Jid;
|
||||||
|
@ -39,30 +39,11 @@ public class Bookmark extends Element implements ListItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNick(String nick) {
|
|
||||||
Element element = this.findChild("nick");
|
|
||||||
if (element == null) {
|
|
||||||
element = this.addChild("nick");
|
|
||||||
}
|
|
||||||
element.setContent(nick);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
|
||||||
Element element = this.findChild("password");
|
|
||||||
if (element != null) {
|
|
||||||
element.setContent(password);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(final ListItem another) {
|
public int compareTo(final ListItem another) {
|
||||||
return this.getDisplayName().compareToIgnoreCase(
|
return this.getDisplayName().compareToIgnoreCase(
|
||||||
another.getDisplayName());
|
another.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDisplayName() {
|
public String getDisplayName() {
|
||||||
|
@ -80,19 +61,26 @@ public class Bookmark extends Element implements ListItem {
|
||||||
public Jid getJid() {
|
public Jid getJid() {
|
||||||
final String jid = this.getAttribute("jid");
|
final String jid = this.getAttribute("jid");
|
||||||
if (jid != null) {
|
if (jid != null) {
|
||||||
try {
|
try {
|
||||||
return Jid.fromString(jid);
|
return Jid.fromString(jid);
|
||||||
} catch (final InvalidJidException e) {
|
} catch (final InvalidJidException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Tag> getTags() {
|
public List<Tag> getTags() {
|
||||||
return new ArrayList<Tag>();
|
ArrayList<Tag> tags = new ArrayList<Tag>();
|
||||||
|
for (Element element : getChildren()) {
|
||||||
|
if (element.getName().equals("group") && element.getContent() != null) {
|
||||||
|
String group = element.getContent();
|
||||||
|
tags.add(new Tag(group, UIHelper.getColorForName(group)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNick() {
|
public String getNick() {
|
||||||
|
@ -104,6 +92,14 @@ public class Bookmark extends Element implements ListItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setNick(String nick) {
|
||||||
|
Element element = this.findChild("nick");
|
||||||
|
if (element == null) {
|
||||||
|
element = this.addChild("nick");
|
||||||
|
}
|
||||||
|
element.setContent(nick);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean autojoin() {
|
public boolean autojoin() {
|
||||||
String autojoin = this.getAttribute("autojoin");
|
String autojoin = this.getAttribute("autojoin");
|
||||||
return (autojoin != null && (autojoin.equalsIgnoreCase("true") || autojoin
|
return (autojoin != null && (autojoin.equalsIgnoreCase("true") || autojoin
|
||||||
|
@ -119,29 +115,50 @@ public class Bookmark extends Element implements ListItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
Element element = this.findChild("password");
|
||||||
|
if (element != null) {
|
||||||
|
element.setContent(password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean match(String needle) {
|
public boolean match(String needle) {
|
||||||
return needle == null
|
if (needle == null) {
|
||||||
|| getJid().toString().toLowerCase(Locale.US).contains(needle.toLowerCase(Locale.US))
|
return true;
|
||||||
|| getDisplayName().toLowerCase(Locale.US).contains(
|
}
|
||||||
needle.toLowerCase(Locale.US));
|
needle = needle.toLowerCase();
|
||||||
|
return getJid().toString().contains(needle) || getDisplayName().toLowerCase().contains(needle) || matchInTag(needle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean matchInTag(String needle) {
|
||||||
|
for (Tag tag : getTags()) {
|
||||||
|
if (tag.getName().toLowerCase().contains(needle)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Account getAccount() {
|
public Account getAccount() {
|
||||||
return this.account;
|
return this.account;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConversation(Conversation conversation) {
|
|
||||||
this.mJoinedConversation = conversation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Conversation getConversation() {
|
public Conversation getConversation() {
|
||||||
return this.mJoinedConversation;
|
return this.mJoinedConversation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setConversation(Conversation conversation) {
|
||||||
|
this.mJoinedConversation = conversation;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.getAttribute("name");
|
return this.getAttribute("name");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
public void unregisterConversation() {
|
public void unregisterConversation() {
|
||||||
if (this.mJoinedConversation != null) {
|
if (this.mJoinedConversation != null) {
|
||||||
this.mJoinedConversation.deregisterWithBookmark();
|
this.mJoinedConversation.deregisterWithBookmark();
|
||||||
|
|
|
@ -8,9 +8,7 @@ import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import eu.siacs.conversations.utils.UIHelper;
|
import eu.siacs.conversations.utils.UIHelper;
|
||||||
import eu.siacs.conversations.xml.Element;
|
import eu.siacs.conversations.xml.Element;
|
||||||
|
@ -29,10 +27,10 @@ public class Contact implements ListItem {
|
||||||
public static final String KEYS = "pgpkey";
|
public static final String KEYS = "pgpkey";
|
||||||
public static final String ACCOUNT = "accountUuid";
|
public static final String ACCOUNT = "accountUuid";
|
||||||
public static final String AVATAR = "avatar";
|
public static final String AVATAR = "avatar";
|
||||||
public static final String LAST_PRESENCE = "last_presence";
|
public static final String LAST_PRESENCE = "last_presence";
|
||||||
public static final String LAST_TIME = "last_time";
|
public static final String LAST_TIME = "last_time";
|
||||||
public static final String GROUPS = "groups";
|
public static final String GROUPS = "groups";
|
||||||
|
public Lastseen lastseen = new Lastseen();
|
||||||
protected String accountUuid;
|
protected String accountUuid;
|
||||||
protected String systemName;
|
protected String systemName;
|
||||||
protected String serverName;
|
protected String serverName;
|
||||||
|
@ -45,14 +43,11 @@ public class Contact implements ListItem {
|
||||||
protected JSONObject keys = new JSONObject();
|
protected JSONObject keys = new JSONObject();
|
||||||
protected JSONArray groups = new JSONArray();
|
protected JSONArray groups = new JSONArray();
|
||||||
protected Presences presences = new Presences();
|
protected Presences presences = new Presences();
|
||||||
|
|
||||||
protected Account account;
|
protected Account account;
|
||||||
|
|
||||||
public Lastseen lastseen = new Lastseen();
|
|
||||||
|
|
||||||
public Contact(final String account, final String systemName, final String serverName,
|
public Contact(final String account, final String systemName, final String serverName,
|
||||||
final Jid jid, final int subscription, final String photoUri,
|
final Jid jid, final int subscription, final String photoUri,
|
||||||
final String systemAccount, final String keys, final String avatar, final Lastseen lastseen, final String groups) {
|
final String systemAccount, final String keys, final String avatar, final Lastseen lastseen, final String groups) {
|
||||||
this.accountUuid = account;
|
this.accountUuid = account;
|
||||||
this.systemName = systemName;
|
this.systemName = systemName;
|
||||||
this.serverName = serverName;
|
this.serverName = serverName;
|
||||||
|
@ -78,18 +73,42 @@ public class Contact implements ListItem {
|
||||||
this.jid = jid;
|
this.jid = jid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Contact fromCursor(final Cursor cursor) {
|
||||||
|
final Lastseen lastseen = new Lastseen(
|
||||||
|
cursor.getString(cursor.getColumnIndex(LAST_PRESENCE)),
|
||||||
|
cursor.getLong(cursor.getColumnIndex(LAST_TIME)));
|
||||||
|
final Jid jid;
|
||||||
|
try {
|
||||||
|
jid = Jid.fromString(cursor.getString(cursor.getColumnIndex(JID)));
|
||||||
|
} catch (final InvalidJidException e) {
|
||||||
|
// TODO: Borked DB... handle this somehow?
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Contact(cursor.getString(cursor.getColumnIndex(ACCOUNT)),
|
||||||
|
cursor.getString(cursor.getColumnIndex(SYSTEMNAME)),
|
||||||
|
cursor.getString(cursor.getColumnIndex(SERVERNAME)),
|
||||||
|
jid,
|
||||||
|
cursor.getInt(cursor.getColumnIndex(OPTIONS)),
|
||||||
|
cursor.getString(cursor.getColumnIndex(PHOTOURI)),
|
||||||
|
cursor.getString(cursor.getColumnIndex(SYSTEMACCOUNT)),
|
||||||
|
cursor.getString(cursor.getColumnIndex(KEYS)),
|
||||||
|
cursor.getString(cursor.getColumnIndex(AVATAR)),
|
||||||
|
lastseen,
|
||||||
|
cursor.getString(cursor.getColumnIndex(GROUPS)));
|
||||||
|
}
|
||||||
|
|
||||||
public String getDisplayName() {
|
public String getDisplayName() {
|
||||||
if (this.systemName != null) {
|
if (this.systemName != null) {
|
||||||
return this.systemName;
|
return this.systemName;
|
||||||
} else if (this.serverName != null) {
|
} else if (this.serverName != null) {
|
||||||
return this.serverName;
|
return this.serverName;
|
||||||
} else if (this.presenceName != null) {
|
} else if (this.presenceName != null) {
|
||||||
return this.presenceName;
|
return this.presenceName;
|
||||||
} else if (jid.hasLocalpart()) {
|
} else if (jid.hasLocalpart()) {
|
||||||
return jid.getLocalpart();
|
return jid.getLocalpart();
|
||||||
} else {
|
} else {
|
||||||
return jid.getDomainpart();
|
return jid.getDomainpart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProfilePhoto() {
|
public String getProfilePhoto() {
|
||||||
|
@ -103,33 +122,43 @@ public class Contact implements ListItem {
|
||||||
@Override
|
@Override
|
||||||
public List<Tag> getTags() {
|
public List<Tag> getTags() {
|
||||||
ArrayList<Tag> tags = new ArrayList<Tag>();
|
ArrayList<Tag> tags = new ArrayList<Tag>();
|
||||||
for(String group : getGroups()) {
|
for (String group : getGroups()) {
|
||||||
tags.add(new Tag(group, UIHelper.getColorForName(group)));
|
tags.add(new Tag(group, UIHelper.getColorForName(group)));
|
||||||
}
|
}
|
||||||
int status = getMostAvailableStatus();
|
int status = getMostAvailableStatus();
|
||||||
switch (getMostAvailableStatus()) {
|
switch (getMostAvailableStatus()) {
|
||||||
case Presences.CHAT:
|
case Presences.CHAT:
|
||||||
case Presences.ONLINE:
|
case Presences.ONLINE:
|
||||||
tags.add(new Tag("online",0xff259b24));
|
tags.add(new Tag("online", 0xff259b24));
|
||||||
break;
|
break;
|
||||||
case Presences.AWAY:
|
case Presences.AWAY:
|
||||||
tags.add(new Tag("away",0xffff9800));
|
tags.add(new Tag("away", 0xffff9800));
|
||||||
break;
|
break;
|
||||||
case Presences.XA:
|
case Presences.XA:
|
||||||
tags.add(new Tag("not available",0xffe51c23));
|
tags.add(new Tag("not available", 0xffe51c23));
|
||||||
break;
|
break;
|
||||||
case Presences.DND:
|
case Presences.DND:
|
||||||
tags.add(new Tag("dnd",0xffe51c23));
|
tags.add(new Tag("dnd", 0xffe51c23));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean match(String needle) {
|
public boolean match(String needle) {
|
||||||
return needle == null
|
if (needle == null) {
|
||||||
|| jid.toString().contains(needle.toLowerCase())
|
return true;
|
||||||
|| getDisplayName().toLowerCase()
|
}
|
||||||
.contains(needle.toLowerCase());
|
needle = needle.toLowerCase();
|
||||||
|
return jid.toString().contains(needle) || getDisplayName().toLowerCase().contains(needle) || matchInTag(needle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean matchInTag(String needle) {
|
||||||
|
for (Tag tag : getTags()) {
|
||||||
|
if (tag.getName().toLowerCase().contains(needle)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContentValues getContentValues() {
|
public ContentValues getContentValues() {
|
||||||
|
@ -145,40 +174,16 @@ public class Contact implements ListItem {
|
||||||
values.put(AVATAR, avatar);
|
values.put(AVATAR, avatar);
|
||||||
values.put(LAST_PRESENCE, lastseen.presence);
|
values.put(LAST_PRESENCE, lastseen.presence);
|
||||||
values.put(LAST_TIME, lastseen.time);
|
values.put(LAST_TIME, lastseen.time);
|
||||||
values.put(GROUPS,groups.toString());
|
values.put(GROUPS, groups.toString());
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Contact fromCursor(final Cursor cursor) {
|
|
||||||
final Lastseen lastseen = new Lastseen(
|
|
||||||
cursor.getString(cursor.getColumnIndex(LAST_PRESENCE)),
|
|
||||||
cursor.getLong(cursor.getColumnIndex(LAST_TIME)));
|
|
||||||
final Jid jid;
|
|
||||||
try {
|
|
||||||
jid = Jid.fromString(cursor.getString(cursor.getColumnIndex(JID)));
|
|
||||||
} catch (final InvalidJidException e) {
|
|
||||||
// TODO: Borked DB... handle this somehow?
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Contact(cursor.getString(cursor.getColumnIndex(ACCOUNT)),
|
|
||||||
cursor.getString(cursor.getColumnIndex(SYSTEMNAME)),
|
|
||||||
cursor.getString(cursor.getColumnIndex(SERVERNAME)),
|
|
||||||
jid,
|
|
||||||
cursor.getInt(cursor.getColumnIndex(OPTIONS)),
|
|
||||||
cursor.getString(cursor.getColumnIndex(PHOTOURI)),
|
|
||||||
cursor.getString(cursor.getColumnIndex(SYSTEMACCOUNT)),
|
|
||||||
cursor.getString(cursor.getColumnIndex(KEYS)),
|
|
||||||
cursor.getString(cursor.getColumnIndex(AVATAR)),
|
|
||||||
lastseen,
|
|
||||||
cursor.getString(cursor.getColumnIndex(GROUPS)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSubscription() {
|
public int getSubscription() {
|
||||||
return this.subscription;
|
return this.subscription;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSystemAccount(String account) {
|
public Account getAccount() {
|
||||||
this.systemAccount = account;
|
return this.account;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccount(Account account) {
|
public void setAccount(Account account) {
|
||||||
|
@ -186,14 +191,14 @@ public class Contact implements ListItem {
|
||||||
this.accountUuid = account.getUuid();
|
this.accountUuid = account.getUuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Account getAccount() {
|
|
||||||
return this.account;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Presences getPresences() {
|
public Presences getPresences() {
|
||||||
return this.presences;
|
return this.presences;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPresences(Presences pres) {
|
||||||
|
this.presences = pres;
|
||||||
|
}
|
||||||
|
|
||||||
public void updatePresence(String resource, int status) {
|
public void updatePresence(String resource, int status) {
|
||||||
this.presences.updatePresence(resource, status);
|
this.presences.updatePresence(resource, status);
|
||||||
}
|
}
|
||||||
|
@ -211,10 +216,6 @@ public class Contact implements ListItem {
|
||||||
return this.presences.getMostAvailableStatus();
|
return this.presences.getMostAvailableStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPresences(Presences pres) {
|
|
||||||
this.presences = pres;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPhotoUri(String uri) {
|
public void setPhotoUri(String uri) {
|
||||||
this.photoUri = uri;
|
this.photoUri = uri;
|
||||||
}
|
}
|
||||||
|
@ -235,9 +236,13 @@ public class Contact implements ListItem {
|
||||||
return systemAccount;
|
return systemAccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSystemAccount(String account) {
|
||||||
|
this.systemAccount = account;
|
||||||
|
}
|
||||||
|
|
||||||
public List<String> getGroups() {
|
public List<String> getGroups() {
|
||||||
ArrayList<String> groups = new ArrayList<String>();
|
ArrayList<String> groups = new ArrayList<String>();
|
||||||
for(int i = 0; i < this.groups.length(); ++i) {
|
for (int i = 0; i < this.groups.length(); ++i) {
|
||||||
try {
|
try {
|
||||||
groups.add(this.groups.getString(i));
|
groups.add(this.groups.getString(i));
|
||||||
} catch (final JSONException ignored) {
|
} catch (final JSONException ignored) {
|
||||||
|
@ -282,14 +287,6 @@ public class Contact implements ListItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPgpKeyId(long keyId) {
|
|
||||||
try {
|
|
||||||
this.keys.put("pgp_keyid", keyId);
|
|
||||||
} catch (final JSONException ignored) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getPgpKeyId() {
|
public long getPgpKeyId() {
|
||||||
if (this.keys.has("pgp_keyid")) {
|
if (this.keys.has("pgp_keyid")) {
|
||||||
try {
|
try {
|
||||||
|
@ -302,6 +299,14 @@ public class Contact implements ListItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPgpKeyId(long keyId) {
|
||||||
|
try {
|
||||||
|
this.keys.put("pgp_keyid", keyId);
|
||||||
|
} catch (final JSONException ignored) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setOption(int option) {
|
public void setOption(int option) {
|
||||||
this.subscription |= 1 << option;
|
this.subscription |= 1 << option;
|
||||||
}
|
}
|
||||||
|
@ -325,26 +330,26 @@ public class Contact implements ListItem {
|
||||||
String subscription = item.getAttribute("subscription");
|
String subscription = item.getAttribute("subscription");
|
||||||
|
|
||||||
if (subscription != null) {
|
if (subscription != null) {
|
||||||
switch (subscription) {
|
switch (subscription) {
|
||||||
case "to":
|
case "to":
|
||||||
this.resetOption(Options.FROM);
|
this.resetOption(Options.FROM);
|
||||||
this.setOption(Options.TO);
|
this.setOption(Options.TO);
|
||||||
break;
|
break;
|
||||||
case "from":
|
case "from":
|
||||||
this.resetOption(Options.TO);
|
this.resetOption(Options.TO);
|
||||||
this.setOption(Options.FROM);
|
this.setOption(Options.FROM);
|
||||||
this.resetOption(Options.PREEMPTIVE_GRANT);
|
this.resetOption(Options.PREEMPTIVE_GRANT);
|
||||||
break;
|
break;
|
||||||
case "both":
|
case "both":
|
||||||
this.setOption(Options.TO);
|
this.setOption(Options.TO);
|
||||||
this.setOption(Options.FROM);
|
this.setOption(Options.FROM);
|
||||||
this.resetOption(Options.PREEMPTIVE_GRANT);
|
this.resetOption(Options.PREEMPTIVE_GRANT);
|
||||||
break;
|
break;
|
||||||
case "none":
|
case "none":
|
||||||
this.resetOption(Options.FROM);
|
this.resetOption(Options.FROM);
|
||||||
this.resetOption(Options.TO);
|
this.resetOption(Options.TO);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// do NOT override asking if pending push request
|
// do NOT override asking if pending push request
|
||||||
|
@ -359,7 +364,7 @@ public class Contact implements ListItem {
|
||||||
|
|
||||||
public void parseGroupsFromElement(Element item) {
|
public void parseGroupsFromElement(Element item) {
|
||||||
this.groups = new JSONArray();
|
this.groups = new JSONArray();
|
||||||
for(Element element : item.getChildren()) {
|
for (Element element : item.getChildren()) {
|
||||||
if (element.getName().equals("group") && element.getContent() != null) {
|
if (element.getName().equals("group") && element.getContent() != null) {
|
||||||
this.groups.put(element.getContent());
|
this.groups.put(element.getContent());
|
||||||
}
|
}
|
||||||
|
@ -372,37 +377,12 @@ public class Contact implements ListItem {
|
||||||
if (this.serverName != null) {
|
if (this.serverName != null) {
|
||||||
item.setAttribute("name", this.serverName);
|
item.setAttribute("name", this.serverName);
|
||||||
}
|
}
|
||||||
for(String group : getGroups()) {
|
for (String group : getGroups()) {
|
||||||
item.addChild("group").setContent(group);
|
item.addChild("group").setContent(group);
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Options {
|
|
||||||
public static final int TO = 0;
|
|
||||||
public static final int FROM = 1;
|
|
||||||
public static final int ASKING = 2;
|
|
||||||
public static final int PREEMPTIVE_GRANT = 3;
|
|
||||||
public static final int IN_ROSTER = 4;
|
|
||||||
public static final int PENDING_SUBSCRIPTION_REQUEST = 5;
|
|
||||||
public static final int DIRTY_PUSH = 6;
|
|
||||||
public static final int DIRTY_DELETE = 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Lastseen {
|
|
||||||
public long time;
|
|
||||||
public String presence;
|
|
||||||
|
|
||||||
public Lastseen() {
|
|
||||||
time = 0;
|
|
||||||
presence = null;
|
|
||||||
}
|
|
||||||
public Lastseen(final String presence, final long time) {
|
|
||||||
this.time = time;
|
|
||||||
this.presence = presence;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(final ListItem another) {
|
public int compareTo(final ListItem another) {
|
||||||
return this.getDisplayName().compareToIgnoreCase(
|
return this.getDisplayName().compareToIgnoreCase(
|
||||||
|
@ -455,9 +435,35 @@ public class Contact implements ListItem {
|
||||||
public String getShareableUri() {
|
public String getShareableUri() {
|
||||||
if (getOtrFingerprints().size() >= 1) {
|
if (getOtrFingerprints().size() >= 1) {
|
||||||
String otr = getOtrFingerprints().get(0);
|
String otr = getOtrFingerprints().get(0);
|
||||||
return "xmpp:"+getJid().toBareJid().toString()+"?otr-fingerprint="+otr.replace(" ","");
|
return "xmpp:" + getJid().toBareJid().toString() + "?otr-fingerprint=" + otr.replace(" ", "");
|
||||||
} else {
|
} else {
|
||||||
return "xmpp:"+getJid().toBareJid().toString();
|
return "xmpp:" + getJid().toBareJid().toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class Lastseen {
|
||||||
|
public long time;
|
||||||
|
public String presence;
|
||||||
|
|
||||||
|
public Lastseen() {
|
||||||
|
time = 0;
|
||||||
|
presence = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Lastseen(final String presence, final long time) {
|
||||||
|
this.time = time;
|
||||||
|
this.presence = presence;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Options {
|
||||||
|
public static final int TO = 0;
|
||||||
|
public static final int FROM = 1;
|
||||||
|
public static final int ASKING = 2;
|
||||||
|
public static final int PREEMPTIVE_GRANT = 3;
|
||||||
|
public static final int IN_ROSTER = 4;
|
||||||
|
public static final int PENDING_SUBSCRIPTION_REQUEST = 5;
|
||||||
|
public static final int DIRTY_PUSH = 6;
|
||||||
|
public static final int DIRTY_DELETE = 7;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue