~noskcaj/ubuntu/saucy/sflphone/merge-1.2.3-2

« back to all changes in this revision

Viewing changes to daemon/src/history/historyitem.h

  • Committer: Package Import Robot
  • Author(s): Francois Marier
  • Date: 2012-02-18 21:47:09 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120218214709-6362d71gqdsdkrj5
Tags: 1.0.2-1
* New upstream release
  - remove logging patch (applied upstream)
  - update s390 patch since it was partially applied upstream
* Include the Evolution plugin as a separate binary package

* Fix compilation issues on SH4 (closes: #658987)
* Merge Ubuntu's binutils-gold linking fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#define HISTORY_ITEM_H_
35
35
 
36
36
#include <string>
37
 
#include <config/config.h>
38
 
 
39
 
typedef enum CallType {
40
 
    CALL_MISSED,
41
 
    CALL_INCOMING,
42
 
    CALL_OUTGOING
43
 
} CallType;
 
37
#include <map>
44
38
 
45
39
class HistoryItem {
46
 
 
47
40
    public:
48
 
        /*
49
 
         * Constructor
50
 
         *
51
 
         * @param Timestamp start
52
 
         * @param Call type
53
 
         * @param Timestamp stop
54
 
         * @param Call name
55
 
         * @param Call number
56
 
                 * @param Call id
57
 
         * @param Call account id
58
 
                 * @param Recording file name (if any recording were performed)
59
 
                 * @param Configuration ID
60
 
                 * @param time added
61
 
         */
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&,
65
 
                    const std::string&);
66
 
 
67
 
        /*
68
 
         * Constructor from a serialized form
69
 
                 * @string contaning serialized form
70
 
         */
71
 
        HistoryItem(std::string="");
72
 
 
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;
 
50
 
 
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);
 
56
 
 
57
        bool hasPeerNumber() const;
 
58
 
 
59
        bool youngerThan(unsigned long otherTime) const;
 
60
 
 
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_;
75
65
        }
76
66
 
77
 
        bool save(Conf::ConfigTree **history);
78
 
 
79
 
        std::string serialize() const;
80
 
 
81
67
    private:
82
 
        /*
83
 
         * @return true if the account ID corresponds to a loaded account
84
 
         */
85
 
        bool valid_account(const std::string &id) const;
86
 
 
87
 
        /*
88
 
         * Timestamp representing the date of the call
89
 
         */
90
 
        std::string timestamp_start_;
91
 
        std::string timestamp_stop_;
92
 
 
93
 
        /*
94
 
         * Represents the type of call
95
 
         * Has be either CALL_MISSED, CALL_INCOMING or CALL_OUTGOING
96
 
         */
97
 
        CallType call_type_;
98
 
 
99
 
        /*
100
 
         * The information about the callee/caller, depending on the type of call.
101
 
         */
102
 
        std::string name_;
103
 
        std::string number_;
104
 
 
105
 
        /**
106
 
         * The identifier fo this item
107
 
         */
108
 
        std::string id_;
109
 
 
110
 
        /*
111
 
         * The account the call was made with
112
 
         */
113
 
        std::string account_id_;
114
 
 
115
 
        /**
116
 
         * Whether or not a recording exist for this call
117
 
         */
118
 
        std::string recording_file_;
119
 
 
120
 
        /**
121
 
         * The conference ID for this call (if any)
122
 
         */
123
 
        std::string confID_;
124
 
 
125
 
        /**
126
 
         * Time added to conference
127
 
         */
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
129
70
};
130
71
 
 
72
std::ostream& operator << (std::ostream& o, const HistoryItem& item);
131
73
 
132
74
#endif // HISTORY_ITEM