summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-05-06 13:08:57 (GMT)
committerSwift Review <review@swift.im>2014-05-29 16:18:23 (GMT)
commitb70a50f11da1ea57a0e89ff14882eed03944eb2a (patch)
treebbe3d3f28104dcba7d276a7016da283665b8f326 /Swift/Controllers
parentab612d0f18ff545b4ebcb2bf2bb400996e751181 (diff)
downloadswift-contrib-b70a50f11da1ea57a0e89ff14882eed03944eb2a.zip
swift-contrib-b70a50f11da1ea57a0e89ff14882eed03944eb2a.tar.bz2
Right-click MUC in Recents to bookmark.
Change-Id: Idfb5907adf9bf53f0ac1f417dd57d49ecc897bb0
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp17
-rw-r--r--Swift/Controllers/Chat/MUCController.cpp4
-rw-r--r--Swift/Controllers/Chat/MUCController.h1
-rw-r--r--Swift/Controllers/UIInterfaces/ChatListWindow.h7
4 files changed, 23 insertions, 6 deletions
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 654f735..1698b4a 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -13,2 +13,3 @@
#include <boost/archive/text_iarchive.hpp>
+#include <boost/serialization/optional.hpp>
#include <boost/serialization/vector.hpp>
@@ -64,2 +65,4 @@
+BOOST_CLASS_VERSION(Swift::ChatListWindow::Chat, 1)
+
namespace boost {
@@ -81,3 +84,3 @@ namespace serialization {
- template<class Archive> void serialize(Archive& ar, Swift::ChatListWindow::Chat& chat, const unsigned int /*version*/) {
+ template<class Archive> void serialize(Archive& ar, Swift::ChatListWindow::Chat& chat, const unsigned int version) {
ar & chat.jid;
@@ -88,2 +91,5 @@ namespace serialization {
ar & chat.impromptuJIDs;
+ if (version > 0) {
+ ar & chat.password;
+ }
}
@@ -371,2 +377,3 @@ ChatListWindow::Chat ChatsManager::createChatListChatItem(const JID& jid, const
std::string nick = "";
+ std::string password = "";
if (controller) {
@@ -378,4 +385,8 @@ ChatListWindow::Chat ChatsManager::createChatListChatItem(const JID& jid, const
+ if (controller->getPassword()) {
+ password = *controller->getPassword();
+ }
+
if (controller->isImpromptu()) {
- ChatListWindow::Chat chat = ChatListWindow::Chat(jid, jid.toString(), activity, unreadCount, type, boost::filesystem::path(), true, nick);
+ ChatListWindow::Chat chat = ChatListWindow::Chat(jid, jid.toString(), activity, unreadCount, type, boost::filesystem::path(), true, nick, password);
typedef std::pair<std::string, JID> StringJIDPair;
@@ -386,3 +397,3 @@ ChatListWindow::Chat ChatsManager::createChatListChatItem(const JID& jid, const
}
- return ChatListWindow::Chat(jid, jid.toString(), activity, unreadCount, type, boost::filesystem::path(), true, nick);
+ return ChatListWindow::Chat(jid, jid.toString(), activity, unreadCount, type, boost::filesystem::path(), true, nick, password);
} else {
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp
index 4860fc8..6bc7067 100644
--- a/Swift/Controllers/Chat/MUCController.cpp
+++ b/Swift/Controllers/Chat/MUCController.cpp
@@ -245,2 +245,6 @@ const std::string& MUCController::getNick() {
+const boost::optional<std::string> MUCController::getPassword() const {
+ return password_;
+}
+
bool MUCController::isImpromptu() const {
diff --git a/Swift/Controllers/Chat/MUCController.h b/Swift/Controllers/Chat/MUCController.h
index e78ff77..feffaba 100644
--- a/Swift/Controllers/Chat/MUCController.h
+++ b/Swift/Controllers/Chat/MUCController.h
@@ -64,2 +64,3 @@ namespace Swift {
const std::string& getNick();
+ const boost::optional<std::string> getPassword() const;
bool isImpromptu() const;
diff --git a/Swift/Controllers/UIInterfaces/ChatListWindow.h b/Swift/Controllers/UIInterfaces/ChatListWindow.h
index 67cd0ff..38d8c3e 100644
--- a/Swift/Controllers/UIInterfaces/ChatListWindow.h
+++ b/Swift/Controllers/UIInterfaces/ChatListWindow.h
@@ -1,3 +1,3 @@
/*
- * Copyright (c) 2010-2011 Kevin Smith
+ * Copyright (c) 2010-2014 Kevin Smith
* Licensed under the GNU General Public License v3.
@@ -24,4 +24,4 @@ namespace Swift {
Chat() : statusType(StatusShow::None), isMUC(false), unreadCount(0) {}
- Chat(const JID& jid, const std::string& chatName, const std::string& activity, int unreadCount, StatusShow::Type statusType, const boost::filesystem::path& avatarPath, bool isMUC, const std::string& nick = "")
- : jid(jid), chatName(chatName), activity(activity), statusType(statusType), isMUC(isMUC), nick(nick), unreadCount(unreadCount), avatarPath(avatarPath) {}
+ Chat(const JID& jid, const std::string& chatName, const std::string& activity, int unreadCount, StatusShow::Type statusType, const boost::filesystem::path& avatarPath, bool isMUC, const std::string& nick = "", const boost::optional<std::string> password = boost::optional<std::string>())
+ : jid(jid), chatName(chatName), activity(activity), statusType(statusType), isMUC(isMUC), nick(nick), password(password), unreadCount(unreadCount), avatarPath(avatarPath) {}
/** Assume that nicks and other transient features aren't important for equality */
@@ -75,2 +75,3 @@ namespace Swift {
std::string nick;
+ boost::optional<std::string> password;
int unreadCount;