From 4b5afbd87df7252b8a37b5fffcb699f2b4e92155 Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Fri, 25 Nov 2011 18:24:34 -0500
Subject: [PATCH] * #7264: added getHistorySimple, which return a dict of
 history entries

This will replace the existing getHistory dbus method.
---
 .../dbus/configurationmanager-introspec.xml   |  26 ++--
 daemon/src/dbus/configurationmanager.cpp      |   5 +
 daemon/src/dbus/configurationmanager.h        |   1 +
 daemon/src/history/historyitem.cpp            | 117 ++++++++++++------
 daemon/src/history/historyitem.h              |  67 +++++-----
 daemon/src/history/historymanager.cpp         |  49 ++++----
 daemon/src/history/historymanager.h           |  17 ++-
 daemon/src/managerimpl.cpp                    |   5 +
 daemon/src/managerimpl.h                      |   6 +
 daemon/test/historytest.cpp                   |  11 +-
 .../dbus/configurationmanager-introspec.xml   |  26 ++--
 .../dbus/configurationmanager-introspec.xml   |  34 ++---
 12 files changed, 228 insertions(+), 136 deletions(-)

diff --git a/daemon/src/dbus/configurationmanager-introspec.xml b/daemon/src/dbus/configurationmanager-introspec.xml
index 21493d0a00..1964f615fe 100644
--- a/daemon/src/dbus/configurationmanager-introspec.xml
+++ b/daemon/src/dbus/configurationmanager-introspec.xml
@@ -258,7 +258,7 @@
 			   </tp:docstring>
 		   </arg>
 	   </method>
-	   
+
 	   <method name="getIsAlwaysRecording" tp:name-for-bindings="getIsAlwaysRecording">
 		   <tp:docstring>
 		   </tp:docstring>
@@ -333,7 +333,6 @@
 		   </arg>
 	   </method>
 
-
 	   <!-- Audio devices methods -->
 
 	   <method name="getAudioPluginList" tp:name-for-bindings="getAudioPluginList">
@@ -457,7 +456,7 @@
 		     </tp:docstring>
 		   </arg>
 	   </method>
-	   
+
 	   <method name="getEchoCancelTailLength" tp:name-for-bindings="getEchoCancelTailLength">
 	           <tp:docstring>
 		   </tp:docstring>
@@ -466,22 +465,22 @@
 		     </tp:docstring>
 		   </arg>
 	   </method>
-	   
+
 	   <method name="setEchoCancelDelay" tp:name-for-bindings="setEchoCancelDelay">
 	       <tp:docstring>
 	       </tp:docstring>
 	       <arg type="i" name="index" direction="in">
 	       </arg>
-	   </method> 
-	   
+	   </method>
+
 	   <method name="getEchoCancelDelay" tp:name-for-bindings="getEchoCancelDelay">
 	       <tp:docstring>
 	       </tp:docstring>
 	       <arg type="i" name="index" direction="out">
 	       </arg>
 	   </method>
-	   
-	   
+
+
 	   <method name="getNoiseSuppressState" tp:name-for-bindings="getEchoCancelState">
 	           <tp:docstring>
 		   </tp:docstring>
@@ -521,7 +520,6 @@
 		   </arg>
 	   </method>
 
-
 	   <method name="getHistoryLimit" tp:name-for-bindings="getHistoryLimit">
 		   <tp:docstring>
 		   </tp:docstring>
@@ -613,6 +611,12 @@
 		   </arg>
 	   </method>
 
+       <method name="getHistorySimple" tp:name-for-bindings="getHistorySimple">
+		   <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MapIntMapStringString"/>
+           <!-- Return a Dict of type <int, Dict<string, string> >...a Dict of Dicts -->
+           <arg type="a{ia{ss}}" name="info" direction="out"/>
+	   </method>
+
 	   <method name="setHistory" tp:name-for-bindings="setHistory">
 		   <tp:docstring>
 		   </tp:docstring>
@@ -624,14 +628,14 @@
 	   </method>
 
 	   <signal name="accountsChanged" tp:name-for-bindings="accountsChanged">
-	   </signal>  
+	   </signal>
 
 	   <signal name="errorAlert" tp:name-for-bindings="errorAlert">
 		   <arg type="i" name="code">
 			   <tp:docstring>
 			   </tp:docstring>
 		   </arg>
-	   </signal> 
+	   </signal>
 
 	   <!-- TLS Methods -->
 	   <method name="getSupportedTlsMethod" tp:name-for-bindings="getSupportedTlsMethod">
diff --git a/daemon/src/dbus/configurationmanager.cpp b/daemon/src/dbus/configurationmanager.cpp
index 056b819de1..f337ae439c 100644
--- a/daemon/src/dbus/configurationmanager.cpp
+++ b/daemon/src/dbus/configurationmanager.cpp
@@ -403,6 +403,11 @@ std::vector<std::string> ConfigurationManager::getHistory()
     return Manager::instance().getHistorySerialized();
 }
 
+std::map<int, std::map<std::string, std::string> > ConfigurationManager::getHistorySimple()
+{
+    return Manager::instance().getHistory();
+}
+
 void ConfigurationManager::setHistory(const std::vector<std::string>& entries)
 {
     Manager::instance().setHistorySerialized(entries);
diff --git a/daemon/src/dbus/configurationmanager.h b/daemon/src/dbus/configurationmanager.h
index f3e0367017..0f8f46964e 100644
--- a/daemon/src/dbus/configurationmanager.h
+++ b/daemon/src/dbus/configurationmanager.h
@@ -124,6 +124,7 @@ class ConfigurationManager :
         void setHookSettings(const std::map<std::string, std::string>& settings);
 
         std::vector<std::string> getHistory();
+        std::map<int, std::map<std::string, std::string> > getHistorySimple();
         void setHistory(const std::vector<std::string> &entries);
 
         std::map<std::string, std::string> getTlsSettings();
diff --git a/daemon/src/history/historyitem.cpp b/daemon/src/history/historyitem.cpp
index 738c7cf4a4..bd15e588d8 100644
--- a/daemon/src/history/historyitem.cpp
+++ b/daemon/src/history/historyitem.cpp
@@ -37,29 +37,41 @@
 
 static const char * const ITEM_SEPARATOR = "|";
 
-HistoryItem::HistoryItem(const std::string &timestamp_start,
-                         CallType call_type, const std::string &timestamp_stop,
+const char * const HistoryItem::ACCOUNT_ID_KEY = "accountid";
+const char * const HistoryItem::CALLID_KEY = "callid";
+const char * const HistoryItem::CONFID_KEY = "confid";
+const char * const HistoryItem::NAME_KEY = "name";
+const char * const HistoryItem::NUMBER_KEY = "number";
+const char * const HistoryItem::RECORDING_PATH_KEY = "recordfile";
+const char * const HistoryItem::TIME_ADDED_KEY = "timeadded";
+const char * const HistoryItem::TIMESTAMP_START_KEY = "timestamp_start";
+const char * const HistoryItem::TIMESTAMP_STOP_KEY = "timestamp_stop";
+const char * const HistoryItem::TYPE_KEY = "type";
+
+HistoryItem::HistoryItem(const std::string &timestampStart,
+                         CallType callType, const std::string &timestampStop,
                          const std::string &name, const std::string &number,
-                         const std::string &id, const std::string &account_id,
+                         const std::string &callID, const std::string &accountID,
                          const std::string &recording,
                          const std::string &confID,
                          const std::string &timeAdded)
-    :	timestamp_start_(timestamp_start),
-        timestamp_stop_(timestamp_stop),
-        call_type_(call_type),
+    :	accountID_(accountID),
+        confID_(confID),
+        callID_(callID),
         name_(name),
         number_(number),
-        id_(id),
-        account_id_(account_id),
-        recording_file_(recording),
-        confID_(confID),
-        timeAdded_(timeAdded)
+        recordingPath_(recording),
+        timeAdded_(timeAdded),
+        timestampStart_(timestampStart),
+        timestampStop_(timestampStop),
+        callType_(callType)
 {}
 
 
 HistoryItem::HistoryItem(std::string serialized_form) :
-    timestamp_start_(), timestamp_stop_(), call_type_(CALL_MISSED), name_(),
-    number_(), id_(), account_id_(), recording_file_(), confID_(), timeAdded_() 
+    accountID_(), confID_(), callID_(), name_(), number_(), recordingPath_(),
+    timeAdded_(), timestampStart_(), timestampStop_(),
+    callType_(CALL_MISSED)
 {
     for (int index = 0; serialized_form.find(ITEM_SEPARATOR, 0) != std::string::npos; ++index) {
         size_t pos = serialized_form.find(ITEM_SEPARATOR, 0);
@@ -68,7 +80,7 @@ HistoryItem::HistoryItem(std::string serialized_form) :
 
         switch (index) {
             case 0: // The call type
-                call_type_ = (CallType) atoi(tmp.c_str());
+                callType_ = (CallType) atoi(tmp.c_str());
                 break;
             case 1: // The number field
                 number_ = tmp;
@@ -80,19 +92,19 @@ HistoryItem::HistoryItem(std::string serialized_form) :
                     name_ = "";
                 break;
             case 3: // The start timestamp
-                timestamp_start_ = tmp;
+                timestampStart_ = tmp;
                 break;
             case 4: // The end timestamp
-                timestamp_stop_ = tmp;
+                timestampStop_ = tmp;
                 break;
-            case 5: // The ID
-                id_ = tmp;
+            case 5: // The call ID
+                callID_ = tmp;
                 break;
             case 6: // The account ID
-                account_id_ = tmp;
+                accountID_ = tmp;
                 break;
             case 7: // The recorded file name
-                recording_file_ = tmp;
+                recordingPath_ = tmp;
                 break;
             case 8: // The conference ID
                 confID_ = tmp;
@@ -110,23 +122,23 @@ HistoryItem::HistoryItem(std::string serialized_form) :
 bool HistoryItem::save(Conf::ConfigTree **history)
 {
     std::stringstream section;
-    std::stringstream call_type;
+    std::stringstream callType;
 
     // The section is : "[" + timestamp = "]"
     section << rand();
     std::string sectionstr = section.str();
-    call_type << call_type_;
-
-    return (*history)->setConfigTreeItem(sectionstr, "type", call_type.str())
-           && (*history)->setConfigTreeItem(sectionstr, "timestamp_start", timestamp_start_)
-           && (*history)->setConfigTreeItem(sectionstr, "timestamp_stop", timestamp_stop_)
-           && (*history)->setConfigTreeItem(sectionstr, "number", number_)
-           && (*history)->setConfigTreeItem(sectionstr, "id", id_)
-           && (*history)->setConfigTreeItem(sectionstr, "accountid", account_id_)
-           && (*history)->setConfigTreeItem(sectionstr, "name", name_)
-           && (*history)->setConfigTreeItem(sectionstr, "recordfile", recording_file_)
-           && (*history)->setConfigTreeItem(sectionstr, "confid", confID_)
-           && (*history)->setConfigTreeItem(sectionstr, "timeadded", timeAdded_);
+    callType << callType_;
+
+    return (*history)->setConfigTreeItem(sectionstr, TYPE_KEY, callType.str())
+           && (*history)->setConfigTreeItem(sectionstr, TIMESTAMP_START_KEY, timestampStart_)
+           && (*history)->setConfigTreeItem(sectionstr, TIMESTAMP_STOP_KEY, timestampStop_)
+           && (*history)->setConfigTreeItem(sectionstr, NUMBER_KEY, number_)
+           && (*history)->setConfigTreeItem(sectionstr, CALLID_KEY, callID_)
+           && (*history)->setConfigTreeItem(sectionstr, ACCOUNT_ID_KEY, accountID_)
+           && (*history)->setConfigTreeItem(sectionstr, NAME_KEY, name_)
+           && (*history)->setConfigTreeItem(sectionstr, RECORDING_PATH_KEY, recordingPath_)
+           && (*history)->setConfigTreeItem(sectionstr, CONFID_KEY, confID_)
+           && (*history)->setConfigTreeItem(sectionstr, TIME_ADDED_KEY, timeAdded_);
 }
 
 std::string HistoryItem::serialize() const
@@ -139,19 +151,50 @@ std::string HistoryItem::serialize() const
 
     // For the account ID, check also if the accountID corresponds to an existing account
     // ie the account may have been removed
-    std::string accountID(account_id_);
+    std::string accountID(accountID_);
 
-    if (account_id_.empty() or not valid_account(account_id_))
+    if (accountID_.empty() or not valid_account(accountID_))
         accountID = "empty";
 
     std::stringstream res;
     // Serialize it
-    res << call_type_ << ITEM_SEPARATOR << number_ << ITEM_SEPARATOR << name << ITEM_SEPARATOR << timestamp_start_ << ITEM_SEPARATOR << timestamp_stop_
-        << ITEM_SEPARATOR << id_ << ITEM_SEPARATOR << accountID << ITEM_SEPARATOR << recording_file_ << ITEM_SEPARATOR << confID_ << ITEM_SEPARATOR << timeAdded_;
+    res << callType_ << ITEM_SEPARATOR << number_ << ITEM_SEPARATOR << name << ITEM_SEPARATOR << timestampStart_ << ITEM_SEPARATOR << timestampStop_
+        << ITEM_SEPARATOR << callID_ << ITEM_SEPARATOR << accountID << ITEM_SEPARATOR << recordingPath_ << ITEM_SEPARATOR << confID_ << ITEM_SEPARATOR << timeAdded_;
 
     return res.str();
 }
 
+std::map<std::string, std::string> HistoryItem::toMap() const
+{
+    std::map<std::string, std::string> result;
+
+    // Replace empty string with a valid standard string value
+    if (name_.empty())
+        result[NAME_KEY] = "empty";
+    else
+        result[NAME_KEY] = name_;
+
+    // For the account ID, check also if the accountID corresponds to an existing account
+    // ie the account may have been removed
+    std::string accountID(accountID_);
+
+    if (accountID_.empty() or not valid_account(accountID_))
+        result[ACCOUNT_ID_KEY] = "empty";
+    else
+        result[ACCOUNT_ID_KEY] = accountID_;
+
+    result[TYPE_KEY] = callType_;
+    result[NUMBER_KEY] = number_;
+    result[TIMESTAMP_START_KEY] = timestampStart_;
+    result[TIMESTAMP_STOP_KEY] = timestampStop_;
+    result[CALLID_KEY] = callID_;
+    result[RECORDING_PATH_KEY] = recordingPath_;
+    result[CONFID_KEY] = confID_;
+    result[TIME_ADDED_KEY] = timeAdded_;
+
+    return result;
+}
+
 
 bool HistoryItem::valid_account(const std::string &id) const
 {
diff --git a/daemon/src/history/historyitem.h b/daemon/src/history/historyitem.h
index 5fb240d6f6..e91a3feca6 100644
--- a/daemon/src/history/historyitem.h
+++ b/daemon/src/history/historyitem.h
@@ -34,6 +34,7 @@
 #define HISTORY_ITEM_H_
 
 #include <string>
+#include <map>
 
 typedef enum CallType {
     CALL_MISSED,
@@ -46,8 +47,17 @@ class ConfigTree;
 }
 
 class HistoryItem {
-
     public:
+        static const char * const ACCOUNT_ID_KEY;
+        static const char * const CONFID_KEY;
+        static const char * const CALLID_KEY;
+        static const char * const NAME_KEY;
+        static const char * const NUMBER_KEY;
+        static const char * const RECORDING_PATH_KEY;
+        static const char * const TIME_ADDED_KEY;
+        static const char * const TIMESTAMP_START_KEY;
+        static const char * const TIMESTAMP_STOP_KEY;
+        static const char * const TYPE_KEY;
         /*
          * Constructor
          *
@@ -56,11 +66,11 @@ class HistoryItem {
          * @param Timestamp stop
          * @param Call name
          * @param Call number
-        	 * @param Call id
+         * @param Call id
          * @param Call account id
-        	 * @param Recording file name (if any recording were performed)
-        	 * @param Configuration ID
-        	 * @param time added
+         * @param Recording file name (if any recording were performed)
+         * @param Configuration ID
+         * @param time added
          */
         HistoryItem(const std::string&, CallType, const std::string&,
                     const std::string&, const std::string&, const std::string&,
@@ -74,12 +84,13 @@ class HistoryItem {
         HistoryItem(std::string="");
 
         std::string get_timestamp() const {
-            return timestamp_start_;
+            return timestampStart_;
         }
 
         bool save(Conf::ConfigTree **history);
 
         std::string serialize() const;
+        std::map<std::string, std::string> toMap() const;
 
     private:
         /*
@@ -88,16 +99,19 @@ class HistoryItem {
         bool valid_account(const std::string &id) const;
 
         /*
-         * Timestamp representing the date of the call
+         * The account the call was made with
          */
-        std::string timestamp_start_;
-        std::string timestamp_stop_;
+        std::string accountID_;
 
-        /*
-         * Represents the type of call
-         * Has be either CALL_MISSED, CALL_INCOMING or CALL_OUTGOING
+        /**
+         * The conference ID for this call (if any)
          */
-        CallType call_type_;
+        std::string confID_;
+
+        /**
+         * The identifier for this call
+         */
+        std::string callID_;
 
         /*
          * The information about the callee/caller, depending on the type of call.
@@ -106,29 +120,26 @@ class HistoryItem {
         std::string number_;
 
         /**
-         * The identifier fo this item
+         * Path of recording for this call, if it exists
          */
-        std::string id_;
-
-        /*
-         * The account the call was made with
-         */
-        std::string account_id_;
+        std::string recordingPath_;
 
         /**
-         * Whether or not a recording exist for this call
+         * Time added to conference
          */
-        std::string recording_file_;
+        std::string timeAdded_;
 
-        /**
-         * The conference ID for this call (if any)
+        /*
+         * Timestamp representing the date of the call
          */
-        std::string confID_;
+        std::string timestampStart_;
+        std::string timestampStop_;
 
-        /**
-         * Time added to conference
+        /*
+         * Represents the type of call
+         * Has be either CALL_MISSED, CALL_INCOMING or CALL_OUTGOING
          */
-        std::string timeAdded_;
+        CallType callType_;
 };
 
 
diff --git a/daemon/src/history/historymanager.cpp b/daemon/src/history/historymanager.cpp
index d19df319dd..37fc35d27a 100644
--- a/daemon/src/history/historymanager.cpp
+++ b/daemon/src/history/historymanager.cpp
@@ -45,7 +45,7 @@ namespace {
 }
 
 HistoryManager::HistoryManager() :
-    history_items_(), history_loaded_(false), history_path_("")
+    history_items_(), history_items_simple_(), history_loaded_(false), history_path_("")
 {}
 
 int HistoryManager::load_history(int limit, const std::string &path)
@@ -59,7 +59,7 @@ int HistoryManager::load_history(int limit, const std::string &path)
 bool HistoryManager::save_history()
 {
     Conf::ConfigTree history_list;
-    save_history_items_map(&history_list);
+    save_history_items_vector(&history_list);
     return save_history_to_file(&history_list);
 }
 
@@ -86,16 +86,16 @@ int HistoryManager::load_history_items_map(Conf::ConfigTree *history_list, int l
     Conf::TokenList sections(history_list->getSections());
     int nb_items = 0;
     for (Conf::TokenList::iterator iter = sections.begin(); iter != sections.end(); ++iter) {
-        CallType type = (CallType) getConfigInt(*iter, "type", history_list);
-        string timestamp_start(getConfigString(*iter, "timestamp_start", history_list));
-        string timestamp_stop(getConfigString(*iter, "timestamp_stop", history_list));
-        string name(getConfigString(*iter, "name", history_list));
-        string number(getConfigString(*iter, "number", history_list));
-        string callID(getConfigString(*iter, "id", history_list));
-        string accountID(getConfigString(*iter, "accountid", history_list));
-        string recording_file(getConfigString(*iter, "recordfile", history_list));
-        string confID(getConfigString(*iter, "confid", history_list));
-        string timeAdded(getConfigString(*iter, "timeadded", history_list));
+        CallType type = static_cast<CallType>(getConfigInt(*iter, HistoryItem::TYPE_KEY, history_list));
+        string timestamp_start(getConfigString(*iter, HistoryItem::TIMESTAMP_START_KEY, history_list));
+        string timestamp_stop(getConfigString(*iter, HistoryItem::TIMESTAMP_STOP_KEY, history_list));
+        string name(getConfigString(*iter, HistoryItem::NAME_KEY, history_list));
+        string number(getConfigString(*iter, HistoryItem::NUMBER_KEY, history_list));
+        string callID(getConfigString(*iter, HistoryItem::CALLID_KEY, history_list));
+        string accountID(getConfigString(*iter, HistoryItem::ACCOUNT_ID_KEY, history_list));
+        string recording_file(getConfigString(*iter, HistoryItem::RECORDING_PATH_KEY, history_list));
+        string confID(getConfigString(*iter, HistoryItem::CONFID_KEY, history_list));
+        string timeAdded(getConfigString(*iter, HistoryItem::TIME_ADDED_KEY, history_list));
 
         // Make a check on the start timestamp to know it is loadable according to CONFIG_HISTORY_LIMIT
         if (atoi(timestamp_start.c_str()) >= ((int) current_timestamp - history_limit)) {
@@ -115,22 +115,17 @@ bool HistoryManager::save_history_to_file(Conf::ConfigTree *history_list)
     return history_list->saveConfigTree(history_path_.data());
 }
 
-int HistoryManager::save_history_items_map(Conf::ConfigTree *history_list)
+void HistoryManager::save_history_items_vector(Conf::ConfigTree *history_list)
 {
-    int items_saved = 0;
-    for (std::vector<HistoryItem>::iterator iter = history_items_.begin(); iter != history_items_.end(); ++iter) {
-        if (iter->save(&history_list))
-            ++items_saved;
-        else
+    for (std::vector<HistoryItem>::iterator iter = history_items_.begin(); iter != history_items_.end(); ++iter)
+        if (not iter->save(&history_list))
             DEBUG("can't save NULL history item\n");
-    }
-
-    return items_saved;
 }
 
 void HistoryManager::add_new_history_entry(const HistoryItem &new_item)
 {
     history_items_.push_back(new_item);
+    history_items_simple_[rand()] = new_item;
 }
 
 void HistoryManager::create_history_path(const std::string &path)
@@ -182,6 +177,18 @@ std::vector<std::string> HistoryManager::get_history_serialized() const
     return serialized;
 }
 
+// Convert our map of HistoryItems to a map<int, map<string, string> >
+std::map<int, std::map<std::string, std::string> > HistoryManager::get_history_simple() const
+{
+    using std::map;
+    using std::string;
+    map<int, map<string, string> > result;
+    for (map<int, HistoryItem>::const_iterator iter = history_items_simple_.begin(); iter != history_items_simple_.end(); ++iter)
+        result[iter->first] = iter->second.toMap();
+
+    return result;
+}
+
 int HistoryManager::set_serialized_history(const std::vector<std::string> &history, int limit)
 {
     history_items_.clear();
diff --git a/daemon/src/history/historymanager.h b/daemon/src/history/historymanager.h
index 06614b4384..a9dceeb541 100644
--- a/daemon/src/history/historymanager.h
+++ b/daemon/src/history/historymanager.h
@@ -34,7 +34,7 @@
 #define _HISTORY_MANAGER
 
 #include "historyitem.h"
-#include <global.h>
+#include "global.h"
 
 class HistoryManager {
 
@@ -71,10 +71,7 @@ class HistoryManager {
          */
         bool save_history_to_file(Conf::ConfigTree *history_list);
 
-        /**
-         * @return int The number of history entries successfully saved
-         */
-        int save_history_items_map(Conf::ConfigTree *history_list);
+        void save_history_items_vector(Conf::ConfigTree *history_list);
 
         /**
          *@return bool  True if the history file has been successfully read
@@ -95,6 +92,7 @@ class HistoryManager {
         }
 
         std::vector<std::string> get_history_serialized() const;
+        std::map<int, std::map<std::string, std::string> > get_history_simple() const;
 
         int set_serialized_history(const std::vector<std::string> &history, int limit);
 
@@ -114,10 +112,17 @@ class HistoryManager {
         void add_new_history_entry(const HistoryItem &new_item);
 
         /*
-         * Map containing the history items
+         * Vector containing the history items
          */
         std::vector<HistoryItem> history_items_;
 
+        /*
+         * Map containing the history items
+         * key=id
+         * value=HistoryItem
+         */
+        std::map<int, HistoryItem> history_items_simple_;
+
         /*
          * History has been loaded
          */
diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp
index 2c2d008f08..feeda1f599 100644
--- a/daemon/src/managerimpl.cpp
+++ b/daemon/src/managerimpl.cpp
@@ -2960,6 +2960,11 @@ std::vector<std::string> ManagerImpl::getHistorySerialized() const
     return history_->get_history_serialized();
 }
 
+std::map<int, std::map<std::string, std::string> > ManagerImpl::getHistory() const
+{
+    return history_->get_history_simple();
+}
+
 void ManagerImpl::setHistorySerialized(std::vector<std::string> history)
 {
     history_->set_serialized_history(history, preferences.getHistoryLimit());;
diff --git a/daemon/src/managerimpl.h b/daemon/src/managerimpl.h
index fff615a48d..c1530fcd3d 100644
--- a/daemon/src/managerimpl.h
+++ b/daemon/src/managerimpl.h
@@ -1151,6 +1151,12 @@ class ManagerImpl {
          */
         std::vector<std::string> getHistorySerialized() const;
 
+        /**
+         * Get a list of serialized history entries
+         * @return A list of serialized entry
+         */
+        std::map<int, std::map<std::string, std::string> > getHistory() const;
+
         /**
          * Set a list of serialized history entries
          * @param Vector of history entries
diff --git a/daemon/test/historytest.cpp b/daemon/test/historytest.cpp
index c5a1869346..95a0ecbf6a 100644
--- a/daemon/test/historytest.cpp
+++ b/daemon/test/historytest.cpp
@@ -108,15 +108,12 @@ void HistoryTest::test_save_history_items_map()
     DEBUG("-------------------- HistoryTest::test_save_history_items_map --------------------\n");
 
     std::string path;
-    int nb_items_loaded, nb_items_saved;
     Conf::ConfigTree history_list, history_list2;
 
     history->set_history_path(HISTORY_SAMPLE);
     history->load_history_from_file(&history_list);
-    nb_items_loaded = history->load_history_items_map(&history_list,
-                      HUGE_HISTORY_LIMIT);
-    nb_items_saved = history->save_history_items_map(&history_list2);
-    CPPUNIT_ASSERT(nb_items_loaded == nb_items_saved);
+    history->load_history_items_map(&history_list, HUGE_HISTORY_LIMIT);
+    history->save_history_items_vector(&history_list2);
 }
 
 void HistoryTest::test_save_history_to_file()
@@ -131,7 +128,7 @@ void HistoryTest::test_save_history_to_file()
     history->set_history_path(HISTORY_SAMPLE);
     history->load_history_from_file(&history_list);
     history->load_history_items_map(&history_list, HUGE_HISTORY_LIMIT);
-    history->save_history_items_map(&history_list2);
+    history->save_history_items_vector(&history_list2);
     CPPUNIT_ASSERT(history->save_history_to_file(&history_list2));
 }
 
@@ -194,7 +191,7 @@ void HistoryTest::test_set_serialized_history()
     // std::cout << "test vector : " << test_vector[1] << std::endl;
     // CPPUNIT_ASSERT (Validator::isEqual (tmp, test_vector[1]));
 
-    history->save_history_items_map(&history_list);
+    history->save_history_items_vector(&history_list);
     CPPUNIT_ASSERT(history->save_history_to_file(&history_list));
 }
 
diff --git a/gnome/src/dbus/configurationmanager-introspec.xml b/gnome/src/dbus/configurationmanager-introspec.xml
index 21493d0a00..1964f615fe 100644
--- a/gnome/src/dbus/configurationmanager-introspec.xml
+++ b/gnome/src/dbus/configurationmanager-introspec.xml
@@ -258,7 +258,7 @@
 			   </tp:docstring>
 		   </arg>
 	   </method>
-	   
+
 	   <method name="getIsAlwaysRecording" tp:name-for-bindings="getIsAlwaysRecording">
 		   <tp:docstring>
 		   </tp:docstring>
@@ -333,7 +333,6 @@
 		   </arg>
 	   </method>
 
-
 	   <!-- Audio devices methods -->
 
 	   <method name="getAudioPluginList" tp:name-for-bindings="getAudioPluginList">
@@ -457,7 +456,7 @@
 		     </tp:docstring>
 		   </arg>
 	   </method>
-	   
+
 	   <method name="getEchoCancelTailLength" tp:name-for-bindings="getEchoCancelTailLength">
 	           <tp:docstring>
 		   </tp:docstring>
@@ -466,22 +465,22 @@
 		     </tp:docstring>
 		   </arg>
 	   </method>
-	   
+
 	   <method name="setEchoCancelDelay" tp:name-for-bindings="setEchoCancelDelay">
 	       <tp:docstring>
 	       </tp:docstring>
 	       <arg type="i" name="index" direction="in">
 	       </arg>
-	   </method> 
-	   
+	   </method>
+
 	   <method name="getEchoCancelDelay" tp:name-for-bindings="getEchoCancelDelay">
 	       <tp:docstring>
 	       </tp:docstring>
 	       <arg type="i" name="index" direction="out">
 	       </arg>
 	   </method>
-	   
-	   
+
+
 	   <method name="getNoiseSuppressState" tp:name-for-bindings="getEchoCancelState">
 	           <tp:docstring>
 		   </tp:docstring>
@@ -521,7 +520,6 @@
 		   </arg>
 	   </method>
 
-
 	   <method name="getHistoryLimit" tp:name-for-bindings="getHistoryLimit">
 		   <tp:docstring>
 		   </tp:docstring>
@@ -613,6 +611,12 @@
 		   </arg>
 	   </method>
 
+       <method name="getHistorySimple" tp:name-for-bindings="getHistorySimple">
+		   <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MapIntMapStringString"/>
+           <!-- Return a Dict of type <int, Dict<string, string> >...a Dict of Dicts -->
+           <arg type="a{ia{ss}}" name="info" direction="out"/>
+	   </method>
+
 	   <method name="setHistory" tp:name-for-bindings="setHistory">
 		   <tp:docstring>
 		   </tp:docstring>
@@ -624,14 +628,14 @@
 	   </method>
 
 	   <signal name="accountsChanged" tp:name-for-bindings="accountsChanged">
-	   </signal>  
+	   </signal>
 
 	   <signal name="errorAlert" tp:name-for-bindings="errorAlert">
 		   <arg type="i" name="code">
 			   <tp:docstring>
 			   </tp:docstring>
 		   </arg>
-	   </signal> 
+	   </signal>
 
 	   <!-- TLS Methods -->
 	   <method name="getSupportedTlsMethod" tp:name-for-bindings="getSupportedTlsMethod">
diff --git a/kde/src/dbus/configurationmanager-introspec.xml b/kde/src/dbus/configurationmanager-introspec.xml
index 5f84e72cf9..1964f615fe 100755
--- a/kde/src/dbus/configurationmanager-introspec.xml
+++ b/kde/src/dbus/configurationmanager-introspec.xml
@@ -85,11 +85,11 @@
 		<method name="setCredentials" tp:name-for-bindings="setCredentials">
 			<tp:docstring>
 			</tp:docstring>
-                        <annotation name="com.trolltech.QtDBus.QtTypeName.In2" value="MapStringString"/>
 			<arg type="s" name="accountID" direction="in">
 				<tp:docstring>
 				</tp:docstring>
 			</arg>
+			<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorMapStringString"/>
 			<arg type="aa{ss}" name="credentialInformation" direction="in" tp:type="String_String_Map">
 				<tp:docstring>
 				</tp:docstring>
@@ -137,11 +137,11 @@
 	   <method name="getCredentials" tp:name-for-bindings="getCredentials">
 		   <tp:docstring>
 		   </tp:docstring>
-		   <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MapStringString"/>
 		   <arg type="s" name="accountID" direction="in">
 			   <tp:docstring>
 			   </tp:docstring>
 		   </arg>
+		   <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorMapStringString"/>
 		   <arg type="aa{ss}" name="credentialInformation" direction="out">
 			   <tp:docstring>
 			   </tp:docstring>
@@ -258,7 +258,7 @@
 			   </tp:docstring>
 		   </arg>
 	   </method>
-	   
+
 	   <method name="getIsAlwaysRecording" tp:name-for-bindings="getIsAlwaysRecording">
 		   <tp:docstring>
 		   </tp:docstring>
@@ -284,8 +284,8 @@
 	   <method name="getAudioCodecList" tp:name-for-bindings="getAudioCodecList">
 		   <tp:docstring>
 		   </tp:docstring>
-		   <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorString"/>
-		   <arg type="as" name="list" direction="out">
+		   <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorInt"/>
+		   <arg type="ai" name="list" direction="out">
 			   <tp:docstring>
 			   </tp:docstring>
 		   </arg>
@@ -333,7 +333,6 @@
 		   </arg>
 	   </method>
 
-
 	   <!-- Audio devices methods -->
 
 	   <method name="getAudioPluginList" tp:name-for-bindings="getAudioPluginList">
@@ -457,7 +456,7 @@
 		     </tp:docstring>
 		   </arg>
 	   </method>
-	   
+
 	   <method name="getEchoCancelTailLength" tp:name-for-bindings="getEchoCancelTailLength">
 	           <tp:docstring>
 		   </tp:docstring>
@@ -466,22 +465,22 @@
 		     </tp:docstring>
 		   </arg>
 	   </method>
-	   
+
 	   <method name="setEchoCancelDelay" tp:name-for-bindings="setEchoCancelDelay">
 	       <tp:docstring>
 	       </tp:docstring>
 	       <arg type="i" name="index" direction="in">
 	       </arg>
-	   </method> 
-	   
+	   </method>
+
 	   <method name="getEchoCancelDelay" tp:name-for-bindings="getEchoCancelDelay">
 	       <tp:docstring>
 	       </tp:docstring>
 	       <arg type="i" name="index" direction="out">
 	       </arg>
 	   </method>
-	   
-	   
+
+
 	   <method name="getNoiseSuppressState" tp:name-for-bindings="getEchoCancelState">
 	           <tp:docstring>
 		   </tp:docstring>
@@ -521,7 +520,6 @@
 		   </arg>
 	   </method>
 
-
 	   <method name="getHistoryLimit" tp:name-for-bindings="getHistoryLimit">
 		   <tp:docstring>
 		   </tp:docstring>
@@ -613,6 +611,12 @@
 		   </arg>
 	   </method>
 
+       <method name="getHistorySimple" tp:name-for-bindings="getHistorySimple">
+		   <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MapIntMapStringString"/>
+           <!-- Return a Dict of type <int, Dict<string, string> >...a Dict of Dicts -->
+           <arg type="a{ia{ss}}" name="info" direction="out"/>
+	   </method>
+
 	   <method name="setHistory" tp:name-for-bindings="setHistory">
 		   <tp:docstring>
 		   </tp:docstring>
@@ -624,14 +628,14 @@
 	   </method>
 
 	   <signal name="accountsChanged" tp:name-for-bindings="accountsChanged">
-	   </signal>  
+	   </signal>
 
 	   <signal name="errorAlert" tp:name-for-bindings="errorAlert">
 		   <arg type="i" name="code">
 			   <tp:docstring>
 			   </tp:docstring>
 		   </arg>
-	   </signal> 
+	   </signal>
 
 	   <!-- TLS Methods -->
 	   <method name="getSupportedTlsMethod" tp:name-for-bindings="getSupportedTlsMethod">
-- 
GitLab