made our spanish friends happy. fixed #68
This commit is contained in:
parent
d140ef6390
commit
04418484a2
|
@ -39,7 +39,7 @@ public class Contact extends AbstractEntity implements Serializable {
|
||||||
protected Presences presences = new Presences();
|
protected Presences presences = new Presences();
|
||||||
|
|
||||||
protected Account account;
|
protected Account account;
|
||||||
|
|
||||||
protected boolean inRoster = true;
|
protected boolean inRoster = true;
|
||||||
|
|
||||||
public Contact(Account account, String displayName, String jid,
|
public Contact(Account account, String displayName, String jid,
|
||||||
|
@ -120,7 +120,7 @@ public class Contact extends AbstractEntity implements Serializable {
|
||||||
cursor.getString(cursor.getColumnIndex(KEYS)),
|
cursor.getString(cursor.getColumnIndex(KEYS)),
|
||||||
cursor.getString(cursor.getColumnIndex(PRESENCES)));
|
cursor.getString(cursor.getColumnIndex(PRESENCES)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSubscription() {
|
public int getSubscription() {
|
||||||
return this.subscription;
|
return this.subscription;
|
||||||
}
|
}
|
||||||
|
@ -152,8 +152,10 @@ public class Contact extends AbstractEntity implements Serializable {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return (domainParts[0].equals("conf")
|
return (domainParts[0].equals("conf")
|
||||||
|| domainParts[0].equals("conference") || domainParts[0]
|
|| domainParts[0].equals("conference")
|
||||||
.equals("muc"));
|
|| domainParts[0].equals("muc")
|
||||||
|
|| domainParts[0].equals("sala")
|
||||||
|
|| domainParts[0].equals("salas"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,7 +171,7 @@ public class Contact extends AbstractEntity implements Serializable {
|
||||||
public void removePresence(String resource) {
|
public void removePresence(String resource) {
|
||||||
this.presences.removePresence(resource);
|
this.presences.removePresence(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearPresences() {
|
public void clearPresences() {
|
||||||
this.presences.clearPresences();
|
this.presences.clearPresences();
|
||||||
}
|
}
|
||||||
|
@ -198,7 +200,8 @@ public class Contact extends AbstractEntity implements Serializable {
|
||||||
Set<String> set = new HashSet<String>();
|
Set<String> set = new HashSet<String>();
|
||||||
try {
|
try {
|
||||||
if (this.keys.has("otr_fingerprints")) {
|
if (this.keys.has("otr_fingerprints")) {
|
||||||
JSONArray fingerprints = this.keys.getJSONArray("otr_fingerprints");
|
JSONArray fingerprints = this.keys
|
||||||
|
.getJSONArray("otr_fingerprints");
|
||||||
for (int i = 0; i < fingerprints.length(); ++i) {
|
for (int i = 0; i < fingerprints.length(); ++i) {
|
||||||
set.add(fingerprints.getString(i));
|
set.add(fingerprints.getString(i));
|
||||||
}
|
}
|
||||||
|
@ -225,15 +228,15 @@ public class Contact extends AbstractEntity implements Serializable {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPgpKeyId(long keyId) {
|
public void setPgpKeyId(long keyId) {
|
||||||
try {
|
try {
|
||||||
this.keys.put("pgp_keyid", keyId);
|
this.keys.put("pgp_keyid", keyId);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getPgpKeyId() {
|
public long getPgpKeyId() {
|
||||||
if (this.keys.has("pgp_keyid")) {
|
if (this.keys.has("pgp_keyid")) {
|
||||||
try {
|
try {
|
||||||
|
@ -245,24 +248,24 @@ public class Contact extends AbstractEntity implements Serializable {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSubscriptionOption(int option) {
|
public void setSubscriptionOption(int option) {
|
||||||
this.subscription |= 1 << option;
|
this.subscription |= 1 << option;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetSubscriptionOption(int option) {
|
public void resetSubscriptionOption(int option) {
|
||||||
this.subscription &= ~(1 << option);
|
this.subscription &= ~(1 << option);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getSubscriptionOption(int option) {
|
public boolean getSubscriptionOption(int option) {
|
||||||
return ((this.subscription & (1 << option)) != 0);
|
return ((this.subscription & (1 << option)) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void parseSubscriptionFromElement(Element item) {
|
public void parseSubscriptionFromElement(Element item) {
|
||||||
String ask = item.getAttribute("ask");
|
String ask = item.getAttribute("ask");
|
||||||
String subscription = item.getAttribute("subscription");
|
String subscription = item.getAttribute("subscription");
|
||||||
|
|
||||||
if (subscription!=null) {
|
if (subscription != null) {
|
||||||
if (subscription.equals("to")) {
|
if (subscription.equals("to")) {
|
||||||
this.resetSubscriptionOption(Contact.Subscription.FROM);
|
this.resetSubscriptionOption(Contact.Subscription.FROM);
|
||||||
this.setSubscriptionOption(Contact.Subscription.TO);
|
this.setSubscriptionOption(Contact.Subscription.TO);
|
||||||
|
@ -274,15 +277,14 @@ public class Contact extends AbstractEntity implements Serializable {
|
||||||
this.setSubscriptionOption(Contact.Subscription.FROM);
|
this.setSubscriptionOption(Contact.Subscription.FROM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ask!=null)&&(ask.equals("subscribe"))) {
|
if ((ask != null) && (ask.equals("subscribe"))) {
|
||||||
this.setSubscriptionOption(Contact.Subscription.ASKING);
|
this.setSubscriptionOption(Contact.Subscription.ASKING);
|
||||||
} else {
|
} else {
|
||||||
this.resetSubscriptionOption(Contact.Subscription.ASKING);
|
this.resetSubscriptionOption(Contact.Subscription.ASKING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class Subscription {
|
public class Subscription {
|
||||||
public static final int TO = 0;
|
public static final int TO = 0;
|
||||||
public static final int FROM = 1;
|
public static final int FROM = 1;
|
||||||
|
@ -290,11 +292,10 @@ public class Contact extends AbstractEntity implements Serializable {
|
||||||
public static final int PREEMPTIVE_GRANT = 4;
|
public static final int PREEMPTIVE_GRANT = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void flagAsNotInRoster() {
|
public void flagAsNotInRoster() {
|
||||||
this.inRoster = false;
|
this.inRoster = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInRoster() {
|
public boolean isInRoster() {
|
||||||
return this.inRoster;
|
return this.inRoster;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue