summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorCatalin Badea <catalin.badea392@gmail.com>2012-06-30 16:39:36 (GMT)
committerCătălin Badea <catalin.badea392@gmail.com>2012-08-11 15:52:57 (GMT)
commite117ec6c534e1b6bc3f1bcd18dadf2005672c38b (patch)
tree71b1ef76e57f37693cd60b13ac17e92faaa33ed4 /Swift
parent3a13bbd772f549a3ea218fe9f3a8ca6c293989f9 (diff)
downloadswift-contrib-e117ec6c534e1b6bc3f1bcd18dadf2005672c38b.zip
swift-contrib-e117ec6c534e1b6bc3f1bcd18dadf2005672c38b.tar.bz2
Changed HistoryMessage structure back
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/Chat/ChatControllerBase.cpp4
-rw-r--r--Swift/Controllers/HistoryController.cpp10
-rw-r--r--Swift/Controllers/HistoryController.h4
-rw-r--r--Swift/Controllers/HistoryViewController.cpp2
-rw-r--r--Swift/QtUI/QtHistoryWindow.cpp5
5 files changed, 13 insertions, 12 deletions
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp
index ee3a027..9d797e0 100644
--- a/Swift/Controllers/Chat/ChatControllerBase.cpp
+++ b/Swift/Controllers/Chat/ChatControllerBase.cpp
@@ -149,7 +149,7 @@ void ChatControllerBase::handleSendMessageRequest(const std::string &body, bool
// log message
if (historyController_) {
- historyController_->addMessage(getBaseJID(), selfJID_, std::string("me"), body, now);
+ historyController_->addMessage(body, selfJID_, toJID_, now);
}
}
@@ -258,7 +258,7 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m
else {
lastMessagesUIID_[from] = addMessage(body, senderDisplayNameFromMessage(from), isIncomingMessageFromMe(message), label, std::string(avatarManager_->getAvatarPath(from).string()), timeStamp);
if (historyController_) {
- historyController_->addMessage(getBaseJID(), from, senderDisplayNameFromMessage(from), body, timeStamp);
+ historyController_->addMessage(body, from, selfJID_, timeStamp);
}
}
}
diff --git a/Swift/Controllers/HistoryController.cpp b/Swift/Controllers/HistoryController.cpp
index 63d4690..7e3d1e4 100644
--- a/Swift/Controllers/HistoryController.cpp
+++ b/Swift/Controllers/HistoryController.cpp
@@ -19,13 +19,13 @@ HistoryController::~HistoryController() {
delete localHistory_;
}
-void HistoryController::addMessage(const JID& baseJID, const JID& fromJID, const std::string& displayNick, const std::string& messageBody, boost::posix_time::ptime timeStamp) {
- HistoryMessage message(messageBody, baseJID, fromJID, displayNick, timeStamp);
- localHistory_->addMessage(message);
+void HistoryController::addMessage(const std::string& message, const JID& fromJID, const JID& toJID, const boost::posix_time::ptime& timeStamp) {
+ HistoryMessage historyMessage(message, fromJID, toJID, timeStamp);
+ localHistory_->addMessage(historyMessage);
}
-std::vector<HistoryMessage> HistoryController::getMessages(const JID& baseJID) const {
- return localHistory_->getMessages(baseJID);
+std::vector<HistoryMessage> HistoryController::getMessages(const JID& selfJID, const JID& contactJID) const {
+ return localHistory_->getMessages(selfJID, contactJID);
}
std::vector<JID> HistoryController::getAllContacts() const {
diff --git a/Swift/Controllers/HistoryController.h b/Swift/Controllers/HistoryController.h
index 0d337f6..9a38b15 100644
--- a/Swift/Controllers/HistoryController.h
+++ b/Swift/Controllers/HistoryController.h
@@ -20,8 +20,8 @@ namespace Swift {
HistoryController();
~HistoryController();
- void addMessage(const JID& baseJID, const JID& fromJID, const std::string& displayNick, const std::string& messageBody, boost::posix_time::ptime timeStamp);
- std::vector<HistoryMessage> getMessages(const JID& baseJID) const;
+ void addMessage(const std::string& message, const JID& fromJID, const JID& toJID, const boost::posix_time::ptime& timeStamp);
+ std::vector<HistoryMessage> getMessages(const JID& selfJID, const JID& contactJID) const;
std::vector<JID> getAllContacts() const;
private:
diff --git a/Swift/Controllers/HistoryViewController.cpp b/Swift/Controllers/HistoryViewController.cpp
index 5cc25e0..f208925 100644
--- a/Swift/Controllers/HistoryViewController.cpp
+++ b/Swift/Controllers/HistoryViewController.cpp
@@ -62,7 +62,7 @@ void HistoryViewController::handleSelectedContactChanged(RosterItem* newContact)
ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(newContact);
- std::vector<HistoryMessage> messages = historyController_->getMessages(contact->getJID());
+ std::vector<HistoryMessage> messages; //TODO = historyController_->getMessages(contact->getJID());
for (std::vector<HistoryMessage>::iterator it = messages.begin(); it != messages.end(); it++) {
historyWindow_->addMessage(*it);
}
diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp
index 2577f4b..24085d9 100644
--- a/Swift/QtUI/QtHistoryWindow.cpp
+++ b/Swift/QtUI/QtHistoryWindow.cpp
@@ -70,8 +70,9 @@ void QtHistoryWindow::setRosterModel(Roster* model) {
}
void QtHistoryWindow::addMessage(const HistoryMessage& message) {
- boost::shared_ptr<MessageSnippet> snippet(new MessageSnippet(QString::fromStdString(message.getMessage()), QString::fromStdString(message.getDisplayNick()), QDateTime::currentDateTime(), "", false, false, theme_, "id"));
- conversation_->addMessage(snippet);
+ // TODO
+ // boost::shared_ptr<MessageSnippet> snippet(new MessageSnippet(QString::fromStdString(message.getMessage()), QString::fromStdString(message.getDisplayNick()), QDateTime::currentDateTime(), "", false, false, theme_, "id"));
+ // conversation_->addMessage(snippet);
}
void QtHistoryWindow::handleSomethingSelectedChanged(RosterItem* item) {