34
34
#define HISTORY_ITEM_H_
37
#include <config/config.h>
39
typedef enum CallType {
45
39
class HistoryItem {
51
* @param Timestamp start
53
* @param Timestamp stop
57
* @param Call account id
58
* @param Recording file name (if any recording were performed)
59
* @param Configuration ID
62
HistoryItem(const std::string&, CallType, const std::string&,
63
const std::string&, const std::string&, const std::string&,
64
const std::string&, const std::string&, const std::string&,
68
* Constructor from a serialized form
69
* @string contaning serialized form
71
HistoryItem(std::string="");
73
std::string get_timestamp() const {
74
return timestamp_start_;
41
static const char * const ACCOUNT_ID_KEY;
42
static const char * const CONFID_KEY;
43
static const char * const CALLID_KEY;
44
static const char * const DISPLAY_NAME_KEY;
45
static const char * const PEER_NUMBER_KEY;
46
static const char * const RECORDING_PATH_KEY;
47
static const char * const TIMESTAMP_START_KEY;
48
static const char * const TIMESTAMP_STOP_KEY;
49
static const char * const STATE_KEY;
51
static const char * const MISSED_STRING;
52
static const char * const INCOMING_STRING;
53
static const char * const OUTGOING_STRING;
54
HistoryItem(const std::map<std::string, std::string> &args);
55
HistoryItem(std::istream &stream);
57
bool hasPeerNumber() const;
59
bool youngerThan(unsigned long otherTime) const;
61
std::map<std::string, std::string> toMap() const;
62
void print(std::ostream &o) const;
63
bool operator< (const HistoryItem &other) const {
64
return timestampStart_ > other.timestampStart_;
77
bool save(Conf::ConfigTree **history);
79
std::string serialize() const;
83
* @return true if the account ID corresponds to a loaded account
85
bool valid_account(const std::string &id) const;
88
* Timestamp representing the date of the call
90
std::string timestamp_start_;
91
std::string timestamp_stop_;
94
* Represents the type of call
95
* Has be either CALL_MISSED, CALL_INCOMING or CALL_OUTGOING
100
* The information about the callee/caller, depending on the type of call.
106
* The identifier fo this item
111
* The account the call was made with
113
std::string account_id_;
116
* Whether or not a recording exist for this call
118
std::string recording_file_;
121
* The conference ID for this call (if any)
126
* Time added to conference
128
std::string timeAdded_;
68
std::map<std::string, std::string> entryMap_;
69
unsigned long timestampStart_; // cached as we use this a lot, avoids string ops
72
std::ostream& operator << (std::ostream& o, const HistoryItem& item);
132
74
#endif // HISTORY_ITEM