summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers')
-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
4 files changed, 10 insertions, 10 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);
}