Skip to content
Snippets Groups Projects
Commit ebbcc725 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

#6251: Fix insertion in history map in before saving history file in daemon

parent 2f507826
No related branches found
No related tags found
No related merge requests found
...@@ -1464,12 +1464,6 @@ void sflphone_save_history (void) ...@@ -1464,12 +1464,6 @@ void sflphone_save_history (void)
// Decrement the reference count // Decrement the reference count
g_hash_table_unref (result); g_hash_table_unref (result);
while(*ordered_result) {
g_free(*ordered_result);
ordered_result++;
}
g_free(ordered_result);
DEBUG ("==================================================== SFLphone: Saving history (end)"); DEBUG ("==================================================== SFLphone: Saving history (end)");
} }
......
...@@ -114,15 +114,17 @@ HistoryItem::~HistoryItem () ...@@ -114,15 +114,17 @@ HistoryItem::~HistoryItem ()
bool HistoryItem::save (Conf::ConfigTree **history) bool HistoryItem::save (Conf::ConfigTree **history)
{ {
std::stringstream section;
std::string section, timestamp;
std::stringstream call_type; std::stringstream call_type;
std::string sectionstr;
bool res; bool res;
// The section is : "[" + timestamp = "]" // The section is : "[" + timestamp = "]"
section = get_timestamp (); section << rand();
call_type << _call_type; call_type << _call_type;
sectionstr = section.str();
_error("Unserialized type: %s", call_type.str().c_str()); _error("Unserialized type: %s", call_type.str().c_str());
_error("Unserialized time start: %s", _timestamp_start.c_str()); _error("Unserialized time start: %s", _timestamp_start.c_str());
_error("Unserialized time stop: %s", _timestamp_stop.c_str()); _error("Unserialized time stop: %s", _timestamp_stop.c_str());
...@@ -131,13 +133,13 @@ bool HistoryItem::save (Conf::ConfigTree **history) ...@@ -131,13 +133,13 @@ bool HistoryItem::save (Conf::ConfigTree **history)
_error("Unserialized name: %s", _name.c_str()); _error("Unserialized name: %s", _name.c_str());
_error("Unserialized record file: %s", _recording_file.c_str()); _error("Unserialized record file: %s", _recording_file.c_str());
res = ( (*history)->setConfigTreeItem (section, "type", call_type.str()) res = ( (*history)->setConfigTreeItem (sectionstr, "type", call_type.str())
&& (*history)->setConfigTreeItem (section, "timestamp_start", _timestamp_start) && (*history)->setConfigTreeItem (sectionstr, "timestamp_start", _timestamp_start)
&& (*history)->setConfigTreeItem (section, "timestamp_stop", _timestamp_stop) && (*history)->setConfigTreeItem (sectionstr, "timestamp_stop", _timestamp_stop)
&& (*history)->setConfigTreeItem (section, "number", _number) && (*history)->setConfigTreeItem (sectionstr, "number", _number)
&& (*history)->setConfigTreeItem (section, "accountid", _account_id) && (*history)->setConfigTreeItem (sectionstr, "accountid", _account_id)
&& (*history)->setConfigTreeItem (section, "name", _name) && (*history)->setConfigTreeItem (sectionstr, "name", _name)
&& (*history)->setConfigTreeItem (section, "recordfile", _recording_file)); && (*history)->setConfigTreeItem (sectionstr, "recordfile", _recording_file));
return res; return res;
} }
......
...@@ -45,7 +45,6 @@ HistoryManager::HistoryManager () ...@@ -45,7 +45,6 @@ HistoryManager::HistoryManager ()
HistoryManager::~HistoryManager () HistoryManager::~HistoryManager ()
{ {
HistoryItemMap::iterator iter = _history_items.begin(); HistoryItemMap::iterator iter = _history_items.begin();
HistoryItem * item; HistoryItem * item;
while (iter != _history_items.end()) { while (iter != _history_items.end()) {
...@@ -63,6 +62,8 @@ int HistoryManager::load_history (int limit, std::string path) ...@@ -63,6 +62,8 @@ int HistoryManager::load_history (int limit, std::string path)
{ {
Conf::ConfigTree history_list; Conf::ConfigTree history_list;
_debug("HistoryManager: Load history");
create_history_path (path); create_history_path (path);
load_history_from_file (&history_list); load_history_from_file (&history_list);
return load_history_items_map (&history_list, limit); return load_history_items_map (&history_list, limit);
...@@ -72,6 +73,8 @@ bool HistoryManager::save_history (void) ...@@ -72,6 +73,8 @@ bool HistoryManager::save_history (void)
{ {
Conf::ConfigTree history_list; Conf::ConfigTree history_list;
_debug("HistoryManager: Save history");
save_history_items_map (&history_list); save_history_items_map (&history_list);
return save_history_to_file (&history_list); return save_history_to_file (&history_list);
} }
...@@ -155,6 +158,8 @@ int HistoryManager::save_history_items_map (Conf::ConfigTree *history_list) ...@@ -155,6 +158,8 @@ int HistoryManager::save_history_items_map (Conf::ConfigTree *history_list)
HistoryItem *item; HistoryItem *item;
int items_saved = 0; int items_saved = 0;
_debug("HistoryManager: Save history items map");
iter = _history_items.begin (); iter = _history_items.begin ();
while (iter != _history_items.end ()) { while (iter != _history_items.end ()) {
...@@ -246,6 +251,8 @@ std::vector<std::string> HistoryManager::get_history_serialized (void) ...@@ -246,6 +251,8 @@ std::vector<std::string> HistoryManager::get_history_serialized (void)
HistoryItem *current; HistoryItem *current;
std::string res; std::string res;
_debug("HistoryManager: Get history serialized");
iter = _history_items.begin (); iter = _history_items.begin ();
while (iter != _history_items.end()) { while (iter != _history_items.end()) {
...@@ -272,6 +279,8 @@ int HistoryManager::set_serialized_history (std::vector<std::string> history, in ...@@ -272,6 +279,8 @@ int HistoryManager::set_serialized_history (std::vector<std::string> history, in
int history_limit; int history_limit;
time_t current_timestamp; time_t current_timestamp;
_debug("HistoryManager: Set serialized history");
// Clear the existing history // Clear the existing history
_history_items.clear (); _history_items.clear ();
......
...@@ -54,7 +54,7 @@ preferences: ...@@ -54,7 +54,7 @@ preferences:
historyMaxCalls: 20 historyMaxCalls: 20
md5Hash: false md5Hash: false
notifyMails: false notifyMails: false
order: Account:1307975440/Account:1307975347/Account:1307974800/Account:1307974672/Account:1307974527/Account:1303487773/Account:1303247743/Account:1302895321/Account:1302892836/Account:1302891834/Account:1302882519/Account:1302207377/Account:1302207262/Account:1302204136/Account:1302204108/Account:1294850905/Account:1294850775/Account:1294850618/Account:1294849651/Account:1294849602/Account:1294849310/Account:1288964768/Account:1288964603/Account:1288964434/Account:1288964141/Account:1288964134/ order: Account:1308839853/Account:1308839662/Account:1308839447/Account:1308839359/Account:1308839335/Account:1308838875/Account:1308838713/Account:1308838236/Account:1307975440/Account:1307975347/Account:1307974800/Account:1307974672/Account:1307974527/Account:1303487773/Account:1303247743/Account:1302895321/Account:1302892836/Account:1302891834/Account:1302882519/Account:1302207377/Account:1302207262/Account:1302204136/Account:1302204108/Account:1294850905/Account:1294850775/Account:1294850618/Account:1294849651/Account:1294849602/Account:1294849310/Account:1288964768/Account:1288964603/Account:1288964434/Account:1288964141/Account:1288964134/
portNum: 5060 portNum: 5060
registrationExpire: 180 registrationExpire: 180
searchBarDisplay: true searchBarDisplay: true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment