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

* #7264: renamed CallType -> HistoryState

This is the nomenclature used in the client.
parent 4b5afbd8
Branches
Tags
No related merge requests found
...@@ -46,10 +46,10 @@ const char * const HistoryItem::RECORDING_PATH_KEY = "recordfile"; ...@@ -46,10 +46,10 @@ const char * const HistoryItem::RECORDING_PATH_KEY = "recordfile";
const char * const HistoryItem::TIME_ADDED_KEY = "timeadded"; const char * const HistoryItem::TIME_ADDED_KEY = "timeadded";
const char * const HistoryItem::TIMESTAMP_START_KEY = "timestamp_start"; const char * const HistoryItem::TIMESTAMP_START_KEY = "timestamp_start";
const char * const HistoryItem::TIMESTAMP_STOP_KEY = "timestamp_stop"; const char * const HistoryItem::TIMESTAMP_STOP_KEY = "timestamp_stop";
const char * const HistoryItem::TYPE_KEY = "type"; const char * const HistoryItem::STATE_KEY = "state";
HistoryItem::HistoryItem(const std::string &timestampStart, HistoryItem::HistoryItem(const std::string &timestampStart,
CallType callType, const std::string &timestampStop, HistoryState state, const std::string &timestampStop,
const std::string &name, const std::string &number, const std::string &name, const std::string &number,
const std::string &callID, const std::string &accountID, const std::string &callID, const std::string &accountID,
const std::string &recording, const std::string &recording,
...@@ -64,14 +64,14 @@ HistoryItem::HistoryItem(const std::string &timestampStart, ...@@ -64,14 +64,14 @@ HistoryItem::HistoryItem(const std::string &timestampStart,
timeAdded_(timeAdded), timeAdded_(timeAdded),
timestampStart_(timestampStart), timestampStart_(timestampStart),
timestampStop_(timestampStop), timestampStop_(timestampStop),
callType_(callType) state_(state)
{} {}
HistoryItem::HistoryItem(std::string serialized_form) : HistoryItem::HistoryItem(std::string serialized_form) :
accountID_(), confID_(), callID_(), name_(), number_(), recordingPath_(), accountID_(), confID_(), callID_(), name_(), number_(), recordingPath_(),
timeAdded_(), timestampStart_(), timestampStop_(), timeAdded_(), timestampStart_(), timestampStop_(),
callType_(CALL_MISSED) state_(MISSED)
{ {
for (int index = 0; serialized_form.find(ITEM_SEPARATOR, 0) != std::string::npos; ++index) { for (int index = 0; serialized_form.find(ITEM_SEPARATOR, 0) != std::string::npos; ++index) {
size_t pos = serialized_form.find(ITEM_SEPARATOR, 0); size_t pos = serialized_form.find(ITEM_SEPARATOR, 0);
...@@ -79,8 +79,8 @@ HistoryItem::HistoryItem(std::string serialized_form) : ...@@ -79,8 +79,8 @@ HistoryItem::HistoryItem(std::string serialized_form) :
serialized_form.erase(0, pos + 1); serialized_form.erase(0, pos + 1);
switch (index) { switch (index) {
case 0: // The call type case 0: // The call state
callType_ = (CallType) atoi(tmp.c_str()); state_ = (HistoryState) atoi(tmp.c_str());
break; break;
case 1: // The number field case 1: // The number field
number_ = tmp; number_ = tmp;
...@@ -122,14 +122,14 @@ HistoryItem::HistoryItem(std::string serialized_form) : ...@@ -122,14 +122,14 @@ HistoryItem::HistoryItem(std::string serialized_form) :
bool HistoryItem::save(Conf::ConfigTree **history) bool HistoryItem::save(Conf::ConfigTree **history)
{ {
std::stringstream section; std::stringstream section;
std::stringstream callType; std::stringstream state;
// The section is : "[" + timestamp = "]" // The section is : "[" + timestamp = "]"
section << rand(); section << rand();
std::string sectionstr = section.str(); std::string sectionstr = section.str();
callType << callType_; state << state_;
return (*history)->setConfigTreeItem(sectionstr, TYPE_KEY, callType.str()) return (*history)->setConfigTreeItem(sectionstr, STATE_KEY, state.str())
&& (*history)->setConfigTreeItem(sectionstr, TIMESTAMP_START_KEY, timestampStart_) && (*history)->setConfigTreeItem(sectionstr, TIMESTAMP_START_KEY, timestampStart_)
&& (*history)->setConfigTreeItem(sectionstr, TIMESTAMP_STOP_KEY, timestampStop_) && (*history)->setConfigTreeItem(sectionstr, TIMESTAMP_STOP_KEY, timestampStop_)
&& (*history)->setConfigTreeItem(sectionstr, NUMBER_KEY, number_) && (*history)->setConfigTreeItem(sectionstr, NUMBER_KEY, number_)
...@@ -158,7 +158,7 @@ std::string HistoryItem::serialize() const ...@@ -158,7 +158,7 @@ std::string HistoryItem::serialize() const
std::stringstream res; std::stringstream res;
// Serialize it // Serialize it
res << callType_ << ITEM_SEPARATOR << number_ << ITEM_SEPARATOR << name << ITEM_SEPARATOR << timestampStart_ << ITEM_SEPARATOR << timestampStop_ res << state_ << 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_; << ITEM_SEPARATOR << callID_ << ITEM_SEPARATOR << accountID << ITEM_SEPARATOR << recordingPath_ << ITEM_SEPARATOR << confID_ << ITEM_SEPARATOR << timeAdded_;
return res.str(); return res.str();
...@@ -183,7 +183,7 @@ std::map<std::string, std::string> HistoryItem::toMap() const ...@@ -183,7 +183,7 @@ std::map<std::string, std::string> HistoryItem::toMap() const
else else
result[ACCOUNT_ID_KEY] = accountID_; result[ACCOUNT_ID_KEY] = accountID_;
result[TYPE_KEY] = callType_; result[STATE_KEY] = state_;
result[NUMBER_KEY] = number_; result[NUMBER_KEY] = number_;
result[TIMESTAMP_START_KEY] = timestampStart_; result[TIMESTAMP_START_KEY] = timestampStart_;
result[TIMESTAMP_STOP_KEY] = timestampStop_; result[TIMESTAMP_STOP_KEY] = timestampStop_;
......
...@@ -36,11 +36,11 @@ ...@@ -36,11 +36,11 @@
#include <string> #include <string>
#include <map> #include <map>
typedef enum CallType { typedef enum HistoryState {
CALL_MISSED, MISSED,
CALL_INCOMING, INCOMING,
CALL_OUTGOING OUTGOING
} CallType; } HistoryState;
namespace Conf { namespace Conf {
class ConfigTree; class ConfigTree;
...@@ -57,7 +57,7 @@ class HistoryItem { ...@@ -57,7 +57,7 @@ class HistoryItem {
static const char * const TIME_ADDED_KEY; static const char * const TIME_ADDED_KEY;
static const char * const TIMESTAMP_START_KEY; static const char * const TIMESTAMP_START_KEY;
static const char * const TIMESTAMP_STOP_KEY; static const char * const TIMESTAMP_STOP_KEY;
static const char * const TYPE_KEY; static const char * const STATE_KEY;
/* /*
* Constructor * Constructor
* *
...@@ -72,7 +72,7 @@ class HistoryItem { ...@@ -72,7 +72,7 @@ class HistoryItem {
* @param Configuration ID * @param Configuration ID
* @param time added * @param time added
*/ */
HistoryItem(const std::string&, CallType, const std::string&, HistoryItem(const std::string&, HistoryState, const std::string&,
const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, const std::string&,
const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, const std::string&,
const std::string&); const std::string&);
...@@ -139,7 +139,7 @@ class HistoryItem { ...@@ -139,7 +139,7 @@ class HistoryItem {
* Represents the type of call * Represents the type of call
* Has be either CALL_MISSED, CALL_INCOMING or CALL_OUTGOING * Has be either CALL_MISSED, CALL_INCOMING or CALL_OUTGOING
*/ */
CallType callType_; HistoryState state_;
}; };
......
...@@ -86,7 +86,7 @@ int HistoryManager::load_history_items_map(Conf::ConfigTree *history_list, int l ...@@ -86,7 +86,7 @@ int HistoryManager::load_history_items_map(Conf::ConfigTree *history_list, int l
Conf::TokenList sections(history_list->getSections()); Conf::TokenList sections(history_list->getSections());
int nb_items = 0; int nb_items = 0;
for (Conf::TokenList::iterator iter = sections.begin(); iter != sections.end(); ++iter) { for (Conf::TokenList::iterator iter = sections.begin(); iter != sections.end(); ++iter) {
CallType type = static_cast<CallType>(getConfigInt(*iter, HistoryItem::TYPE_KEY, history_list)); HistoryState state = static_cast<HistoryState>(getConfigInt(*iter, HistoryItem::STATE_KEY, history_list));
string timestamp_start(getConfigString(*iter, HistoryItem::TIMESTAMP_START_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 timestamp_stop(getConfigString(*iter, HistoryItem::TIMESTAMP_STOP_KEY, history_list));
string name(getConfigString(*iter, HistoryItem::NAME_KEY, history_list)); string name(getConfigString(*iter, HistoryItem::NAME_KEY, history_list));
...@@ -99,7 +99,7 @@ int HistoryManager::load_history_items_map(Conf::ConfigTree *history_list, int l ...@@ -99,7 +99,7 @@ int HistoryManager::load_history_items_map(Conf::ConfigTree *history_list, int l
// Make a check on the start timestamp to know it is loadable according to CONFIG_HISTORY_LIMIT // 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)) { if (atoi(timestamp_start.c_str()) >= ((int) current_timestamp - history_limit)) {
HistoryItem item(timestamp_start, type, timestamp_stop, name, number, callID, accountID, recording_file, confID, timeAdded); HistoryItem item(timestamp_start, state, timestamp_stop, name, number, callID, accountID, recording_file, confID, timeAdded);
add_new_history_entry(item); add_new_history_entry(item);
++nb_items; ++nb_items;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment