summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCatalin Badea <catalin.badea392@gmail.com>2012-07-03 13:17:51 (GMT)
committerCătălin Badea <catalin.badea392@gmail.com>2012-08-11 15:52:57 (GMT)
commitb9b59d265f44e3e5341635baaac160fe57a5685e (patch)
tree1e7d85f0b7daa0791c60a2434ee0d65a50bd36c5 /Swiften/History/HistoryMessage.h
parent80d2797f246e32edce4083ed7f86389a6c358d43 (diff)
downloadswift-contrib-b9b59d265f44e3e5341635baaac160fe57a5685e.zip
swift-contrib-b9b59d265f44e3e5341635baaac160fe57a5685e.tar.bz2
Added message type logging. Fixed handling new messages.
Diffstat (limited to 'Swiften/History/HistoryMessage.h')
-rw-r--r--Swiften/History/HistoryMessage.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/Swiften/History/HistoryMessage.h b/Swiften/History/HistoryMessage.h
index 021d6b9..d35474f 100644
--- a/Swiften/History/HistoryMessage.h
+++ b/Swiften/History/HistoryMessage.h
@@ -12,16 +12,22 @@
namespace Swift {
class HistoryMessage {
public:
+ enum Type {
+ Chat = 0,
+ Groupchat = 1,
+ PrivateMessage = 2
+ };
+
HistoryMessage(
const std::string& message,
const JID& fromJID,
const JID& toJID,
- bool isGroupChat,
+ Type type,
const boost::posix_time::ptime& time) :
message_(message),
fromJID_(fromJID),
toJID_(toJID),
- isGroupChat_(isGroupChat),
+ type_(type),
time_(time) {
}
@@ -37,8 +43,8 @@ namespace Swift {
return toJID_;
}
- bool isGroupChat() const {
- return isGroupChat_;
+ Type getType() const {
+ return type_;
}
boost::posix_time::ptime getTime() const {
@@ -46,14 +52,14 @@ namespace Swift {
}
bool operator==(const HistoryMessage& o) const {
- return message_ == o.message_ && fromJID_ == o.fromJID_ && toJID_ == o.toJID_ && isGroupChat_ == o.isGroupChat_ && time_ == o.time_;
+ return message_ == o.message_ && fromJID_ == o.fromJID_ && toJID_ == o.toJID_ && type_ == o.type_ && time_ == o.time_;
}
private:
std::string message_;
JID fromJID_;
JID toJID_;
- bool isGroupChat_; // TODO: <- maybe use Message::Type ?
+ Type type_;
boost::posix_time::ptime time_;
};
}