* #36758: displayed name in ui are the same as in daemon history
diff --git a/src/org/sflphone/loaders/HistoryLoader.java b/src/org/sflphone/loaders/HistoryLoader.java
index c454cc8..b1654a0 100644
--- a/src/org/sflphone/loaders/HistoryLoader.java
+++ b/src/org/sflphone/loaders/HistoryLoader.java
@@ -57,7 +57,7 @@
if (historyEntries.containsKey(number_called)) {
// It's a direct match
- historyEntries.get(number_called).addHistoryCall(new HistoryCall(entry));
+ historyEntries.get(number_called).addHistoryCall(new HistoryCall(entry), contact);
} else {
// Maybe we can extract the extension @ account pattern
Pattern p = Pattern.compile("<sip:([^@]+)@([^>]+)>");
@@ -65,17 +65,17 @@
if (m.find()) {
if (historyEntries.containsKey(m.group(1) + "@" + m.group(2))) {
- historyEntries.get(m.group(1) + "@" + m.group(2)).addHistoryCall(new HistoryCall(entry));
+ historyEntries.get(m.group(1) + "@" + m.group(2)).addHistoryCall(new HistoryCall(entry), contact);
} else {
HistoryEntry e = new HistoryEntry(entry.get(ServiceConstants.history.ACCOUNT_ID_KEY), contact);
- e.addHistoryCall(new HistoryCall(entry));
+ e.addHistoryCall(new HistoryCall(entry), contact);
historyEntries.put(m.group(1) + "@" + m.group(2), e);
}
} else {
HistoryEntry e = new HistoryEntry(entry.get(ServiceConstants.history.ACCOUNT_ID_KEY), contact);
- e.addHistoryCall(new HistoryCall(entry));
+ e.addHistoryCall(new HistoryCall(entry), contact);
historyEntries.put(number_called, e);
}
diff --git a/src/org/sflphone/model/CallContact.java b/src/org/sflphone/model/CallContact.java
index fd70395..7463219 100644
--- a/src/org/sflphone/model/CallContact.java
+++ b/src/org/sflphone/model/CallContact.java
@@ -323,4 +323,12 @@
contact_photo = new WeakReference<Bitmap>(externalBMP);
}
+ /**
+ * A contact is Unknown when his name == his phone number
+ * @return true when Name == Number
+ */
+ public boolean isUnknown() {
+ return mDisplayName.contentEquals(phones.get(0).getNumber());
+ }
+
}
diff --git a/src/org/sflphone/model/HistoryEntry.java b/src/org/sflphone/model/HistoryEntry.java
index 278277b..141690e 100644
--- a/src/org/sflphone/model/HistoryEntry.java
+++ b/src/org/sflphone/model/HistoryEntry.java
@@ -83,7 +83,14 @@
this.contact = contact;
}
- public void addHistoryCall(HistoryCall historyCall) {
+ /**
+ * Each call is associated with a contact.
+ * When adding a call to an HIstoryEntry, this methods also verifies if we can update
+ * the contact (if contact is Unknown, replace it)
+ * @param historyCall The call to put in this HistoryEntry
+ * @param linkedTo The associated CallContact
+ */
+ public void addHistoryCall(HistoryCall historyCall, CallContact linkedTo) {
calls.put(historyCall.call_start, historyCall);
if (historyCall.isIncoming()) {
++incoming_sum;
@@ -92,6 +99,9 @@
}
if (historyCall.isMissed())
missed_sum++;
+
+ if(contact.isUnknown() && !linkedTo.isUnknown())
+ setContact(linkedTo);
}
public String getNumber() {