diff --git a/daemon/src/history/historyitem.cpp b/daemon/src/history/historyitem.cpp index 75707ff2a708337eb4f3e4aced0991b502515dc3..a0edd4b34d9a21eb31b649f56d6a6595aab94be3 100644 --- a/daemon/src/history/historyitem.cpp +++ b/daemon/src/history/historyitem.cpp @@ -92,6 +92,11 @@ bool HistoryItem::youngerThan(int otherTime) const return atol(getTimestampStart().c_str()) >= otherTime; } +bool HistoryItem::hasPeerNumber() const +{ + return entryMap_.find(PEER_NUMBER_KEY) != entryMap_.end(); +} + std::string HistoryItem::getTimestampStart() const { using std::map; using std::string; diff --git a/daemon/src/history/historyitem.h b/daemon/src/history/historyitem.h index 2ad0b0d245740cf164703fae1b65ca5ca33b4398..c134e46f18c4763c785d5178c601738856896506 100644 --- a/daemon/src/history/historyitem.h +++ b/daemon/src/history/historyitem.h @@ -58,7 +58,7 @@ class HistoryItem { HistoryItem(const std::map<std::string, std::string> &args); HistoryItem(const std::string &item, Conf::ConfigTree &list); - std::string getTimestampStart() const; + bool hasPeerNumber() const; bool youngerThan(int otherTime) const; @@ -67,6 +67,7 @@ class HistoryItem { std::map<std::string, std::string> toMap() const; private: + std::string getTimestampStart() const; std::map<std::string, std::string> entryMap_; }; diff --git a/daemon/src/history/historymanager.cpp b/daemon/src/history/historymanager.cpp index 03c3146908f4ecbd90d58736771570e39c8d24b3..46966cc504fc6c66becdd87b6b5d630ee646030e 100644 --- a/daemon/src/history/historymanager.cpp +++ b/daemon/src/history/historymanager.cpp @@ -171,9 +171,8 @@ int HistoryManager::setHistorySerialized(const std::vector<std::map<std::string, int items_added = 0; for (vector<map<string, string> >::const_iterator iter = history.begin(); iter != history.end(); ++iter) { HistoryItem new_item(*iter); - int item_timestamp = atol(new_item.getTimestampStart().c_str()); - if (item_timestamp >= ((int) current_timestamp - history_limit)) { + if (new_item.hasPeerNumber() and new_item.youngerThan((int) current_timestamp - history_limit)) { addNewHistoryEntry(new_item); ++items_added; } diff --git a/gnome/src/contacts/calllist.c b/gnome/src/contacts/calllist.c index 4f0dfd0e9ec0e3c362a648e0eee49e21ee6adf57..4cc64dbf3875e006cacfe56a41f72ab283245150 100644 --- a/gnome/src/contacts/calllist.c +++ b/gnome/src/contacts/calllist.c @@ -29,6 +29,7 @@ */ #include "calllist.h" +#include <string.h> #include "calltab.h" #include "calltree.h" #include "unused.h" @@ -159,7 +160,7 @@ calllist_remove_call(calltab_t* tab, const gchar * callID) if (c == NULL) return; - QueueElement *element = (QueueElement *)c->data; + QueueElement *element = (QueueElement *) c->data; if (element->type != HIST_CALL) { ERROR("CallList: Error: Element %s is not a call", callID); @@ -168,8 +169,11 @@ calllist_remove_call(calltab_t* tab, const gchar * callID) g_queue_remove(tab->callQueue, element); - calllist_add_call(history_tab, element->elem.call); - calltree_add_history_entry(element->elem.call); + /* Don't save empty (i.e. started dialing, then deleted) calls */ + if (element->elem.call->_peer_number && strlen(element->elem.call->_peer_number) > 0) { + calllist_add_call(history_tab, element->elem.call); + calltree_add_history_entry(element->elem.call); + } }