summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2013-04-30 20:10:12 (GMT)
committerSwift Review <review@swift.im>2013-10-01 14:48:44 (GMT)
commitfd47dd7d5cec5155b9985959d2f0e0f3b386cd98 (patch)
treed4da57ce3f1c90f56701cab8757d75e089473c9e /Swift/Controllers/UIInterfaces
parenta3781c5b770c03ff32c5cf8f1280b21c2a8e2626 (diff)
downloadswift-fd47dd7d5cec5155b9985959d2f0e0f3b386cd98.zip
swift-fd47dd7d5cec5155b9985959d2f0e0f3b386cd98.tar.bz2
Adding support for impromptu MUCs.
Change-Id: I363e9d740bbec311454827645f4ea6df8bb60bed License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swift/Controllers/UIInterfaces')
-rw-r--r--Swift/Controllers/UIInterfaces/ChatListWindow.h18
-rw-r--r--Swift/Controllers/UIInterfaces/ChatWindow.h11
-rw-r--r--Swift/Controllers/UIInterfaces/InviteToChatWindow.h30
-rw-r--r--Swift/Controllers/UIInterfaces/UserSearchWindow.h19
4 files changed, 37 insertions, 41 deletions
diff --git a/Swift/Controllers/UIInterfaces/ChatListWindow.h b/Swift/Controllers/UIInterfaces/ChatListWindow.h
index 6eb932f..b189e72 100644
--- a/Swift/Controllers/UIInterfaces/ChatListWindow.h
+++ b/Swift/Controllers/UIInterfaces/ChatListWindow.h
@@ -7,11 +7,13 @@
#pragma once
#include <list>
+#include <set>
+#include <map>
#include <boost/shared_ptr.hpp>
#include <Swiften/MUC/MUCBookmark.h>
#include <Swiften/Elements/StatusShow.h>
#include <boost/filesystem/path.hpp>
-
+#include <Swiften/Base/foreach.h>
#include <Swiften/Base/boost_bsignals.h>
namespace Swift {
@@ -19,6 +21,7 @@ namespace Swift {
public:
class Chat {
public:
+ 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) {}
/** Assume that nicks and other transient features aren't important for equality */
@@ -35,6 +38,18 @@ namespace Swift {
void setAvatarPath(const boost::filesystem::path& path) {
avatarPath = path;
}
+ std::string getImpromptuTitle() const {
+ typedef std::pair<std::string, JID> StringJIDPair;
+ std::string title;
+ foreach(StringJIDPair pair, impromptuJIDs) {
+ if (title.empty()) {
+ title += pair.first;
+ } else {
+ title += ", " + pair.first;
+ }
+ }
+ return title;
+ }
JID jid;
std::string chatName;
std::string activity;
@@ -43,6 +58,7 @@ namespace Swift {
std::string nick;
int unreadCount;
boost::filesystem::path avatarPath;
+ std::map<std::string, JID> impromptuJIDs;
};
virtual ~ChatListWindow();
diff --git a/Swift/Controllers/UIInterfaces/ChatWindow.h b/Swift/Controllers/UIInterfaces/ChatWindow.h
index 50f2f26..e6f61ca 100644
--- a/Swift/Controllers/UIInterfaces/ChatWindow.h
+++ b/Swift/Controllers/UIInterfaces/ChatWindow.h
@@ -30,7 +30,7 @@ namespace Swift {
class RosterItem;
class ContactRosterItem;
class FileTransferController;
- class InviteToChatWindow;
+ class UserSearchWindow;
class ChatWindow {
@@ -116,7 +116,7 @@ namespace Swift {
virtual std::string addFileTransfer(const std::string& senderName, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes) = 0;
virtual void setFileTransferProgress(std::string, const int percentageDone) = 0;
virtual void setFileTransferStatus(std::string, const FileTransferState state, const std::string& msg = "") = 0;
- virtual void addMUCInvitation(const std::string& senderName, const JID& jid, const std::string& reason, const std::string& password, bool direct = true) = 0;
+ virtual void addMUCInvitation(const std::string& senderName, const JID& jid, const std::string& reason, const std::string& password, bool direct = true, bool isImpromptu = false, bool isContinuation = false) = 0;
virtual std::string addWhiteboardRequest(bool senderIsSelf) = 0;
virtual void setWhiteboardSessionStatus(std::string id, const ChatWindow::WhiteboardSessionState state) = 0;
@@ -132,7 +132,7 @@ namespace Swift {
virtual void setSecurityLabelsEnabled(bool enabled) = 0;
virtual void setCorrectionEnabled(Tristate enabled) = 0;
virtual void setUnreadMessageCount(int count) = 0;
- virtual void convertToMUC() = 0;
+ virtual void convertToMUC(bool impromptuMUC = false) = 0;
// virtual TreeWidget *getTreeWidget() = 0;
virtual void setSecurityLabelsError() = 0;
virtual SecurityLabelsCatalog::Item getSelectedSecurityLabel() = 0;
@@ -146,6 +146,7 @@ namespace Swift {
virtual void setAffiliations(MUCOccupant::Affiliation, const std::vector<JID>&) = 0;
virtual void setAvailableRoomActions(const std::vector<RoomAction> &actions) = 0;
virtual void setBlockingState(BlockingState state) = 0;
+ virtual void setCanInitiateImpromptuChats(bool supportsImpromptu) = 0;
/**
* Set an alert on the window.
* @param alertText Description of alert (required).
@@ -168,8 +169,6 @@ namespace Swift {
*/
virtual void showRoomConfigurationForm(Form::ref) = 0;
- virtual InviteToChatWindow* createInviteToChatWindow() = 0;
-
boost::signal<void ()> onClosed;
boost::signal<void ()> onAllMessagesRead;
boost::signal<void (const std::string&, bool isCorrection)> onSendMessageRequest;
@@ -182,7 +181,7 @@ namespace Swift {
boost::signal<void (const std::string&)> onChangeSubjectRequest;
boost::signal<void (Form::ref)> onConfigureRequest;
boost::signal<void ()> onDestroyRequest;
- boost::signal<void ()> onInvitePersonToThisMUCRequest;
+ boost::signal<void (const std::vector<JID>&)> onInviteToChat;
boost::signal<void ()> onConfigurationFormCancelled;
boost::signal<void ()> onGetAffiliationsRequest;
boost::signal<void (MUCOccupant::Affiliation, const JID&)> onSetAffiliationRequest;
diff --git a/Swift/Controllers/UIInterfaces/InviteToChatWindow.h b/Swift/Controllers/UIInterfaces/InviteToChatWindow.h
deleted file mode 100644
index db128c1..0000000
--- a/Swift/Controllers/UIInterfaces/InviteToChatWindow.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2012 Kevin Smith
- * Licensed under the GNU General Public License v3.
- * See Documentation/Licenses/GPLv3.txt for more information.
- */
-
-#pragma once
-
-#include <vector>
-#include <utility>
-#include <string>
-#include <Swiften/Base/boost_bsignals.h>
-#include <Swiften/JID/JID.h>
-
-namespace Swift {
- class InviteToChatWindow {
- public:
- virtual ~InviteToChatWindow() {}
-
- virtual void setAutoCompletions(std::vector<std::pair<JID, std::string> > completions) = 0;
-
- virtual std::string getReason() const = 0;
-
- virtual std::vector<JID> getJIDs() const = 0;
-
- boost::signal<void ()> onCompleted;
- boost::signal<void ()> onDismissed;
- };
-}
-
diff --git a/Swift/Controllers/UIInterfaces/UserSearchWindow.h b/Swift/Controllers/UIInterfaces/UserSearchWindow.h
index a3d69d6..9dd1811 100644
--- a/Swift/Controllers/UIInterfaces/UserSearchWindow.h
+++ b/Swift/Controllers/UIInterfaces/UserSearchWindow.h
@@ -6,19 +6,20 @@
#pragma once
-#include "Swiften/Base/boost_bsignals.h"
+#include <Swiften/Base/boost_bsignals.h>
#include <vector>
#include <string>
-#include "Swiften/JID/JID.h"
-#include "Swift/Controllers/Chat/UserSearchController.h"
+#include <Swiften/JID/JID.h>
+#include <Swift/Controllers/Chat/UserSearchController.h>
+#include <Swift/Controllers/Contact.h>
namespace Swift {
class UserSearchWindow {
public:
- enum Type {AddContact, ChatToContact};
+ enum Type {AddContact, ChatToContact, InviteToChat};
virtual ~UserSearchWindow() {}
virtual void clear() = 0;
@@ -31,10 +32,20 @@ namespace Swift {
virtual void setSearchFields(boost::shared_ptr<SearchPayload> fields) = 0;
virtual void setNameSuggestions(const std::vector<std::string>& suggestions) = 0;
virtual void prepopulateJIDAndName(const JID& jid, const std::string& name) = 0;
+ virtual void setContactSuggestions(const std::vector<Contact>& suggestions) = 0;
+ virtual void setJIDs(const std::vector<JID>&) = 0;
+ virtual void setRoomJID(const JID& roomJID) = 0;
+ virtual std::string getReason() const = 0;
+ virtual std::vector<JID> getJIDs() const = 0;
+ virtual void setCanStartImpromptuChats(bool supportsImpromptu) = 0;
+ virtual void updateContacts(const std::vector<Contact>& contacts) = 0;
+
virtual void show() = 0;
boost::signal<void (const JID&)> onFormRequested;
boost::signal<void (boost::shared_ptr<SearchPayload>, const JID&)> onSearchRequested;
boost::signal<void (const JID&)> onNameSuggestionRequested;
+ boost::signal<void (const std::string&)> onContactSuggestionsRequested;
+ boost::signal<void (const std::vector<JID>&)> onJIDUpdateRequested;
};
}