Skip to content
Snippets Groups Projects
Commit 2980154e authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #7593: don't add calls to history that haven't been dialed.

parent 5df0bfba
Branches
Tags
No related merge requests found
......@@ -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;
......
......@@ -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_;
};
......
......@@ -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;
}
......
......@@ -29,6 +29,7 @@
*/
#include "calllist.h"
#include <string.h>
#include "calltab.h"
#include "calltree.h"
#include "unused.h"
......@@ -168,9 +169,12 @@ calllist_remove_call(calltab_t* tab, const gchar * callID)
g_queue_remove(tab->callQueue, element);
/* 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);
}
}
callable_obj_t *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment