summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/ContactEditController.cpp76
-rw-r--r--Swift/Controllers/ContactEditController.h45
-rw-r--r--Swift/Controllers/MainController.cpp11
-rw-r--r--Swift/Controllers/MainController.h2
-rw-r--r--Swift/Controllers/RosterController.cpp80
-rw-r--r--Swift/Controllers/RosterController.h8
-rw-r--r--Swift/Controllers/SConscript1
-rw-r--r--Swift/Controllers/UIEvents/RegroupRosterItemUIEvent.h34
-rw-r--r--Swift/Controllers/UIEvents/RenameGroupUIEvent.h30
-rw-r--r--Swift/Controllers/UIEvents/RequestContactEditorUIEvent.h27
-rw-r--r--Swift/Controllers/UIInterfaces/ContactEditWindow.h33
-rw-r--r--Swift/Controllers/UIInterfaces/ContactEditWindowFactory.h18
-rw-r--r--Swift/Controllers/UIInterfaces/UIFactory.h4
13 files changed, 300 insertions, 69 deletions
diff --git a/Swift/Controllers/ContactEditController.cpp b/Swift/Controllers/ContactEditController.cpp
new file mode 100644
index 0000000..286fdeb
--- /dev/null
+++ b/Swift/Controllers/ContactEditController.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swift/Controllers/ContactEditController.h>
+
+#include <boost/bind.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
+
+#include <Swift/Controllers/UIEvents/RequestContactEditorUIEvent.h>
+#include <Swift/Controllers/UIEvents/UIEventStream.h>
+#include <Swift/Controllers/UIEvents/RemoveRosterItemUIEvent.h>
+#include <Swift/Controllers/UIInterfaces/ContactEditWindowFactory.h>
+#include <Swift/Controllers/RosterController.h>
+
+
+namespace Swift {
+
+ContactEditController::ContactEditController(RosterController* rosterController, ContactEditWindowFactory* contactEditWindowFactory, UIEventStream* uiEventStream) : rosterController(rosterController), contactEditWindowFactory(contactEditWindowFactory), uiEventStream(uiEventStream), contactEditWindow(NULL) {
+ uiEventStream->onUIEvent.connect(boost::bind(&ContactEditController::handleUIEvent, this, _1));
+}
+
+ContactEditController::~ContactEditController() {
+ if (contactEditWindow) {
+ contactEditWindow->onChangeContactRequest.disconnect(boost::bind(&ContactEditController::handleChangeContactRequest, this, _1, _2));
+ contactEditWindow->onRemoveContactRequest.disconnect(boost::bind(&ContactEditController::handleRemoveContactRequest, this));
+ delete contactEditWindow;
+ }
+ uiEventStream->onUIEvent.disconnect(boost::bind(&ContactEditController::handleUIEvent, this, _1));
+}
+
+void ContactEditController::handleUIEvent(UIEvent::ref event) {
+ RequestContactEditorUIEvent::ref editEvent = boost::dynamic_pointer_cast<RequestContactEditorUIEvent>(event);
+ if (!editEvent) {
+ return;
+ }
+
+ if (!contactEditWindow) {
+ contactEditWindow = contactEditWindowFactory->createContactEditWindow();
+ contactEditWindow->onRemoveContactRequest.connect(boost::bind(&ContactEditController::handleRemoveContactRequest, this));
+ contactEditWindow->onChangeContactRequest.connect(boost::bind(&ContactEditController::handleChangeContactRequest, this, _1, _2));
+ }
+ currentContact = rosterController->getItem(editEvent->getJID());
+ assert(currentContact);
+ contactEditWindow->setContact(currentContact->getJID(), currentContact->getName(), currentContact->getGroups(), rosterController->getGroups());
+ contactEditWindow->show();
+}
+
+void ContactEditController::setAvailable(bool b) {
+ if (contactEditWindow) {
+ contactEditWindow->setEnabled(b);
+ }
+}
+
+void ContactEditController::handleRemoveContactRequest() {
+ assert(currentContact);
+ uiEventStream->send(boost::make_shared<RemoveRosterItemUIEvent>(currentContact->getJID()));
+ contactEditWindow->hide();
+}
+
+void ContactEditController::handleChangeContactRequest(const String& name, const std::vector<String>& groups) {
+ std::vector<String> oldGroupsVector = currentContact->getGroups();
+ std::set<String> oldGroups(oldGroupsVector.begin(), oldGroupsVector.end());
+ std::set<String> newGroups(groups.begin(), groups.end());
+ if (oldGroups != newGroups || currentContact->getName() != name) {
+ XMPPRosterItem newContact(*currentContact);
+ newContact.setName(name);
+ newContact.setGroups(groups);
+ rosterController->updateItem(newContact);
+ }
+ contactEditWindow->hide();
+}
+
+}
diff --git a/Swift/Controllers/ContactEditController.h b/Swift/Controllers/ContactEditController.h
new file mode 100644
index 0000000..31917b1
--- /dev/null
+++ b/Swift/Controllers/ContactEditController.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <vector>
+#include <boost/optional.hpp>
+
+#include <Swiften/JID/JID.h>
+#include <Swiften/Base/String.h>
+#include <Swift/Controllers/UIEvents/UIEvent.h>
+#include <Swiften/Roster/XMPPRosterItem.h>
+
+namespace Swift {
+ class UIEventStream;
+ class ContactEditWindowFactory;
+ class ContactEditWindow;
+ class RosterController;
+
+ class ContactEditController {
+ public:
+ ContactEditController(RosterController* rosterController, ContactEditWindowFactory* contactEditWindowFactory, UIEventStream* uiEventStream);
+ ~ContactEditController();
+
+ void setAvailable(bool b);
+
+ private:
+ void handleRemoveContactRequest();
+ void handleChangeContactRequest(const String& name, const std::vector<String>& groups);
+
+ private:
+ void handleUIEvent(UIEvent::ref event);
+
+ private:
+ boost::optional<XMPPRosterItem> currentContact;
+ RosterController* rosterController;
+ ContactEditWindowFactory* contactEditWindowFactory;
+ UIEventStream* uiEventStream;
+ ContactEditWindow* contactEditWindow;
+ };
+}
+
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 1b513cd..3e1b366 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -62,6 +62,7 @@
#include "Swift/Controllers/CertificateStorageTrustChecker.h"
#include "Swiften/Network/NetworkFactories.h"
#include <Swift/Controllers/ProfileController.h>
+#include <Swift/Controllers/ContactEditController.h>
namespace Swift {
@@ -100,6 +101,7 @@ MainController::MainController(
chatsManager_ = NULL;
eventWindowController_ = NULL;
profileController_ = NULL;
+ contactEditController_ = NULL;
userSearchControllerChat_ = NULL;
userSearchControllerAdd_ = NULL;
quitRequested_ = false;
@@ -172,6 +174,8 @@ MainController::~MainController() {
void MainController::resetClient() {
resetCurrentError();
resetPendingReconnects();
+ delete contactEditController_;
+ contactEditController_ = NULL;
delete profileController_;
profileController_ = NULL;
delete eventWindowController_;
@@ -233,11 +237,12 @@ void MainController::handleConnected() {
myStatusLooksOnline_ = true;
if (freshLogin) {
profileController_ = new ProfileController(client_->getVCardManager(), uiFactory_, uiEventStream_);
-
rosterController_ = new RosterController(jid_, client_->getRoster(), client_->getAvatarManager(), uiFactory_, client_->getNickManager(), client_->getNickResolver(), client_->getPresenceOracle(), client_->getSubscriptionManager(), eventController_, uiEventStream_, client_->getIQRouter(), settings_);
rosterController_->onChangeStatusRequest.connect(boost::bind(&MainController::handleChangeStatusRequest, this, _1, _2));
rosterController_->onSignOutRequest.connect(boost::bind(&MainController::signOut, this));
+ contactEditController_ = new ContactEditController(rosterController_, uiFactory_, uiEventStream_);
+
chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, uiFactory_, uiFactory_, client_->getNickResolver(), client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, uiFactory_, useDelayForLatency_, networkFactories_->getTimerFactory(), client_->getMUCRegistry(), client_->getEntityCapsProvider(), client_->getMUCManager(), uiFactory_, settings_);
client_->onMessageReceived.connect(boost::bind(&ChatsManager::handleIncomingMessage, chatsManager_, _1));
chatsManager_->setAvatarManager(client_->getAvatarManager());
@@ -268,6 +273,7 @@ void MainController::handleConnected() {
rosterController_->setEnabled(true);
profileController_->setAvailable(true);
+ contactEditController_->setAvailable(true);
/* Send presence later to catch all the incoming presences. */
sendPresence(statusTracker_->getNextPresence());
/* Enable chats last of all, so rejoining MUCs has the right sent presence */
@@ -532,6 +538,9 @@ void MainController::setManagersOffline() {
if (profileController_) {
profileController_->setAvailable(false);
}
+ if (contactEditController_) {
+ contactEditController_->setAvailable(false);
+ }
}
void MainController::handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo> info, ErrorPayload::ref error) {
diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h
index d6e54ef..09f17d2 100644
--- a/Swift/Controllers/MainController.h
+++ b/Swift/Controllers/MainController.h
@@ -43,6 +43,7 @@ namespace Swift {
class MUCController;
class Notifier;
class ProfileController;
+ class ContactEditController;
class TogglableNotifier;
class PresenceNotifier;
class EventNotifier;
@@ -132,6 +133,7 @@ namespace Swift {
XMLConsoleController* xmlConsoleController_;
ChatsManager* chatsManager_;
ProfileController* profileController_;
+ ContactEditController* contactEditController_;
JID jid_;
JID boundJID_;
SystemTrayController* systemTrayController_;
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp
index 0144c97..be735cf 100644
--- a/Swift/Controllers/RosterController.cpp
+++ b/Swift/Controllers/RosterController.cpp
@@ -7,6 +7,7 @@
#include "Swift/Controllers/RosterController.h"
#include <boost/bind.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include "Swiften/Base/foreach.h"
#include "Swift/Controllers/UIInterfaces/MainWindow.h"
@@ -27,10 +28,11 @@
#include "Swiften/Roster/SetName.h"
#include "Swiften/Roster/OfflineRosterFilter.h"
#include "Swiften/Roster/XMPPRoster.h"
+#include "Swiften/Roster/XMPPRosterItem.h"
#include "Swift/Controllers/UIEvents/AddContactUIEvent.h"
#include "Swift/Controllers/UIEvents/RemoveRosterItemUIEvent.h"
#include "Swift/Controllers/UIEvents/RenameRosterItemUIEvent.h"
-#include "Swift/Controllers/UIEvents/RegroupRosterItemUIEvent.h"
+#include "Swift/Controllers/UIEvents/RenameGroupUIEvent.h"
#include "Swift/Controllers/UIEvents/ToggleShowOfflineUIEvent.h"
#include <Swiften/Client/NickManager.h>
@@ -165,12 +167,10 @@ void RosterController::handleOnJIDUpdated(const JID& jid, const String& oldName,
}
void RosterController::handleUIEvent(boost::shared_ptr<UIEvent> event) {
- boost::shared_ptr<ToggleShowOfflineUIEvent> showOfflineEvent = boost::dynamic_pointer_cast<ToggleShowOfflineUIEvent>(event);
- if (showOfflineEvent) {
+ if (boost::shared_ptr<ToggleShowOfflineUIEvent> showOfflineEvent = boost::dynamic_pointer_cast<ToggleShowOfflineUIEvent>(event)) {
handleShowOfflineToggled(showOfflineEvent->getShow());
}
- boost::shared_ptr<AddContactUIEvent> addContactEvent = boost::dynamic_pointer_cast<AddContactUIEvent>(event);
- if (addContactEvent) {
+ else if (boost::shared_ptr<AddContactUIEvent> addContactEvent = boost::dynamic_pointer_cast<AddContactUIEvent>(event)) {
RosterItemPayload item;
item.setName(addContactEvent->getName());
item.setJID(addContactEvent->getJID());
@@ -180,10 +180,8 @@ void RosterController::handleUIEvent(boost::shared_ptr<UIEvent> event) {
request->onResponse.connect(boost::bind(&RosterController::handleRosterSetError, this, _1, roster));
request->send();
subscriptionManager_->requestSubscription(addContactEvent->getJID());
- return;
}
- boost::shared_ptr<RemoveRosterItemUIEvent> removeEvent = boost::dynamic_pointer_cast<RemoveRosterItemUIEvent>(event);
- if (removeEvent) {
+ else if (boost::shared_ptr<RemoveRosterItemUIEvent> removeEvent = boost::dynamic_pointer_cast<RemoveRosterItemUIEvent>(event)) {
RosterItemPayload item(removeEvent->getJID(), "", RosterItemPayload::Remove);
boost::shared_ptr<RosterPayload> roster(new RosterPayload());
roster->addItem(item);
@@ -191,10 +189,8 @@ void RosterController::handleUIEvent(boost::shared_ptr<UIEvent> event) {
request->onResponse.connect(boost::bind(&RosterController::handleRosterSetError, this, _1, roster));
request->send();
- return;
}
- boost::shared_ptr<RenameRosterItemUIEvent> renameEvent = boost::dynamic_pointer_cast<RenameRosterItemUIEvent>(event);
- if (renameEvent) {
+ else if (boost::shared_ptr<RenameRosterItemUIEvent> renameEvent = boost::dynamic_pointer_cast<RenameRosterItemUIEvent>(event)) {
JID contact(renameEvent->getJID());
RosterItemPayload item(contact, renameEvent->getNewName(), xmppRoster_->getSubscriptionStateForJID(contact));
item.setGroups(xmppRoster_->getGroupsForJID(contact));
@@ -203,34 +199,44 @@ void RosterController::handleUIEvent(boost::shared_ptr<UIEvent> event) {
SetRosterRequest::ref request = SetRosterRequest::create(roster, iqRouter_);
request->onResponse.connect(boost::bind(&RosterController::handleRosterSetError, this, _1, roster));
request->send();
- return;
}
- boost::shared_ptr<RegroupRosterItemUIEvent> regroupEvent = boost::dynamic_pointer_cast<RegroupRosterItemUIEvent>(event);
- if (regroupEvent) {
- JID contact(regroupEvent->getJID());
- RosterItemPayload item(contact, xmppRoster_->getNameForJID(contact), xmppRoster_->getSubscriptionStateForJID(contact));
- std::vector<String> newGroups;
- const std::vector<String> addedGroups = regroupEvent->getAddedGroups();
- const std::vector<String> removedGroups = regroupEvent->getRemovedGroups();
- foreach (const String& oldGroup, xmppRoster_->getGroupsForJID(contact)) {
- if (std::find(removedGroups.begin(), removedGroups.end(), oldGroup) == removedGroups.end()
- && std::find(addedGroups.begin(), addedGroups.end(), oldGroup) == addedGroups.end()) {
- newGroups.push_back(oldGroup);
- }
+ else if (boost::shared_ptr<RenameGroupUIEvent> renameGroupEvent = boost::dynamic_pointer_cast<RenameGroupUIEvent>(event)) {
+ std::vector<XMPPRosterItem> items = xmppRoster_->getItems();
+ String group = renameGroupEvent->getGroup();
+ // FIXME: We should handle contacts groups specially to avoid clashes
+ if (group == "Contacts") {
+ group = "";
}
- foreach (const String& newGroup, regroupEvent->getAddedGroups()) {
- newGroups.push_back(newGroup);
+ foreach(XMPPRosterItem& item, items) {
+ std::vector<String> groups = item.getGroups();
+ if ( (group.isEmpty() && groups.empty()) || std::find(groups.begin(), groups.end(), group) != groups.end()) {
+ groups.erase(std::remove(groups.begin(), groups.end(), group), groups.end());
+ if (std::find(groups.begin(), groups.end(), renameGroupEvent->getNewName()) == groups.end()) {
+ groups.push_back(renameGroupEvent->getNewName());
+ }
+ item.setGroups(groups);
+ updateItem(item);
+ }
}
- item.setGroups(newGroups);
- boost::shared_ptr<RosterPayload> roster(new RosterPayload());
- roster->addItem(item);
- SetRosterRequest::ref request = SetRosterRequest::create(roster, iqRouter_);
- request->onResponse.connect(boost::bind(&RosterController::handleRosterSetError, this, _1, roster));
- request->send();
- return;
}
}
+void RosterController::setContactGroups(const JID& jid, const std::vector<String>& groups) {
+ updateItem(XMPPRosterItem(jid, xmppRoster_->getNameForJID(jid), groups, xmppRoster_->getSubscriptionStateForJID(jid)));
+}
+
+void RosterController::updateItem(const XMPPRosterItem& item) {
+ RosterItemPayload itemPayload(item.getJID(), item.getName(), item.getSubscription());
+ itemPayload.setGroups(item.getGroups());
+
+ RosterPayload::ref roster = boost::make_shared<RosterPayload>();
+ roster->addItem(itemPayload);
+
+ SetRosterRequest::ref request = SetRosterRequest::create(roster, iqRouter_);
+ request->onResponse.connect(boost::bind(&RosterController::handleRosterSetError, this, _1, roster));
+ request->send();
+}
+
void RosterController::handleRosterSetError(ErrorPayload::ref error, boost::shared_ptr<RosterPayload> rosterPayload) {
if (!error) {
return;
@@ -281,4 +287,12 @@ void RosterController::handleAvatarChanged(const JID& jid) {
}
}
+boost::optional<XMPPRosterItem> RosterController::getItem(const JID& jid) const {
+ return xmppRoster_->getItem(jid);
+}
+
+std::set<String> RosterController::getGroups() const {
+ return xmppRoster_->getGroups();
+}
+
}
diff --git a/Swift/Controllers/RosterController.h b/Swift/Controllers/RosterController.h
index 9e22686..d8c2487 100644
--- a/Swift/Controllers/RosterController.h
+++ b/Swift/Controllers/RosterController.h
@@ -22,6 +22,7 @@ namespace Swift {
class IQRouter;
class Roster;
class XMPPRoster;
+ class XMPPRosterItem;
class MainWindow;
class MainWindowFactory;
class OfflineRosterFilter;
@@ -45,6 +46,13 @@ namespace Swift {
boost::signal<void ()> onSignOutRequest;
void handleAvatarChanged(const JID& jid);
void setEnabled(bool enabled);
+
+ boost::optional<XMPPRosterItem> getItem(const JID&) const;
+ std::set<String> getGroups() const;
+
+ void setContactGroups(const JID& jid, const std::vector<String>& groups);
+ void updateItem(const XMPPRosterItem&);
+
private:
void handleOnJIDAdded(const JID &jid);
void handleRosterCleared();
diff --git a/Swift/Controllers/SConscript b/Swift/Controllers/SConscript
index b149cd2..c8314de 100644
--- a/Swift/Controllers/SConscript
+++ b/Swift/Controllers/SConscript
@@ -30,6 +30,7 @@ if env["SCONS_STAGE"] == "build" :
"DiscoServiceWalker.cpp",
"MainController.cpp",
"ProfileController.cpp",
+ "ContactEditController.cpp",
"RosterController.cpp",
"RosterGroupExpandinessPersister.cpp",
"EventWindowController.cpp",
diff --git a/Swift/Controllers/UIEvents/RegroupRosterItemUIEvent.h b/Swift/Controllers/UIEvents/RegroupRosterItemUIEvent.h
deleted file mode 100644
index b8552b3..0000000
--- a/Swift/Controllers/UIEvents/RegroupRosterItemUIEvent.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2010 Kevin Smith
- * Licensed under the GNU General Public License v3.
- * See Documentation/Licenses/GPLv3.txt for more information.
- */
-
-#pragma once
-
-#include <boost/shared_ptr.hpp>
-#include <vector>
-
-#include "Swift/Controllers/UIEvents/UIEvent.h"
-#include "Swiften/MUC/MUCBookmark.h"
-
-namespace Swift {
- /**
- * An event for regrouping a roster item.
- * This doesn't need to cover all groups, so it's valid to have the
- * contact in several groups that are neither removedGroups or addedGroups.
- */
- class RegroupRosterItemUIEvent : public UIEvent {
- public:
- RegroupRosterItemUIEvent(const JID& jid, const std::vector<String>& addedGroups, const std::vector<String>& removedGroups) : jid_(jid), addedGroups_(addedGroups), removedGroups_(removedGroups) {}
-
- const JID& getJID() const {return jid_;}
- const std::vector<String>& getAddedGroups() const {return addedGroups_;}
- const std::vector<String>& getRemovedGroups() const {return removedGroups_;}
-
- private:
- JID jid_;
- std::vector<String> addedGroups_;
- std::vector<String> removedGroups_;
- };
-}
diff --git a/Swift/Controllers/UIEvents/RenameGroupUIEvent.h b/Swift/Controllers/UIEvents/RenameGroupUIEvent.h
new file mode 100644
index 0000000..1825d77
--- /dev/null
+++ b/Swift/Controllers/UIEvents/RenameGroupUIEvent.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <Swift/Controllers/UIEvents/UIEvent.h>
+#include <Swiften/Base/String.h>
+
+namespace Swift {
+ class RenameGroupUIEvent : public UIEvent {
+ public:
+ RenameGroupUIEvent(const String& group, const String& newName) : group(group), newName(newName) {
+ }
+
+ const String& getGroup() const {
+ return group;
+ }
+
+ const String& getNewName() const {
+ return newName;
+ }
+
+ private:
+ String group;
+ String newName;
+ };
+}
diff --git a/Swift/Controllers/UIEvents/RequestContactEditorUIEvent.h b/Swift/Controllers/UIEvents/RequestContactEditorUIEvent.h
new file mode 100644
index 0000000..8d04525
--- /dev/null
+++ b/Swift/Controllers/UIEvents/RequestContactEditorUIEvent.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/JID/JID.h>
+#include <Swift/Controllers/UIEvents/UIEvent.h>
+
+namespace Swift {
+ class RequestContactEditorUIEvent : public UIEvent {
+ public:
+ typedef boost::shared_ptr<RequestContactEditorUIEvent> ref;
+
+ RequestContactEditorUIEvent(const JID& jid) : jid(jid) {
+ }
+
+ const JID& getJID() const {
+ return jid;
+ }
+
+ private:
+ JID jid;
+ };
+}
diff --git a/Swift/Controllers/UIInterfaces/ContactEditWindow.h b/Swift/Controllers/UIInterfaces/ContactEditWindow.h
new file mode 100644
index 0000000..3feb718
--- /dev/null
+++ b/Swift/Controllers/UIInterfaces/ContactEditWindow.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/boost_bsignals.h>
+#include <boost/shared_ptr.hpp>
+#include <set>
+#include <vector>
+
+#include <Swiften/Base/String.h>
+
+namespace Swift {
+ class JID;
+
+ class ContactEditWindow {
+ public:
+ virtual ~ContactEditWindow() {};
+
+ virtual void setEnabled(bool b) = 0;
+
+ virtual void setContact(const JID& jid, const String& name, const std::vector<String>& groups, const std::set<String>& allGroups) = 0;
+
+ virtual void show() = 0;
+ virtual void hide() = 0;
+
+ boost::signal<void ()> onRemoveContactRequest;
+ boost::signal<void (const String& /* name */, const std::vector<String>& /* groups */)> onChangeContactRequest;
+ };
+}
diff --git a/Swift/Controllers/UIInterfaces/ContactEditWindowFactory.h b/Swift/Controllers/UIInterfaces/ContactEditWindowFactory.h
new file mode 100644
index 0000000..8ad56c0
--- /dev/null
+++ b/Swift/Controllers/UIInterfaces/ContactEditWindowFactory.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <Swift/Controllers/UIInterfaces/ContactEditWindow.h>
+
+namespace Swift {
+ class ContactEditWindowFactory {
+ public:
+ virtual ~ContactEditWindowFactory() {};
+
+ virtual ContactEditWindow* createContactEditWindow() = 0;
+ };
+}
diff --git a/Swift/Controllers/UIInterfaces/UIFactory.h b/Swift/Controllers/UIInterfaces/UIFactory.h
index 11623d7..9b36ac5 100644
--- a/Swift/Controllers/UIInterfaces/UIFactory.h
+++ b/Swift/Controllers/UIInterfaces/UIFactory.h
@@ -16,6 +16,7 @@
#include <Swift/Controllers/UIInterfaces/UserSearchWindowFactory.h>
#include <Swift/Controllers/UIInterfaces/XMLConsoleWidgetFactory.h>
#include <Swift/Controllers/UIInterfaces/ProfileWindowFactory.h>
+#include <Swift/Controllers/UIInterfaces/ContactEditWindowFactory.h>
namespace Swift {
class UIFactory :
@@ -28,7 +29,8 @@ namespace Swift {
public XMLConsoleWidgetFactory,
public UserSearchWindowFactory,
public JoinMUCWindowFactory,
- public ProfileWindowFactory {
+ public ProfileWindowFactory,
+ public ContactEditWindowFactory {
public:
virtual ~UIFactory() {}
};