summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-06-10 17:23:57 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-06-10 17:38:05 (GMT)
commite2f5588d089e4d2148762ea092e032976254a467 (patch)
tree851946c7a36ffa96e0f3ab54bc72f233f8b2c746 /Swiften/Controllers/MUCController.cpp
parent7214d768dca85a6d43892169d5008898249dce73 (diff)
downloadswift-contrib-e2f5588d089e4d2148762ea092e032976254a467.zip
swift-contrib-e2f5588d089e4d2148762ea092e032976254a467.tar.bz2
Moved Swiften/Controllers to Swift/Controllers.
Diffstat (limited to 'Swiften/Controllers/MUCController.cpp')
-rw-r--r--Swiften/Controllers/MUCController.cpp76
1 files changed, 0 insertions, 76 deletions
diff --git a/Swiften/Controllers/MUCController.cpp b/Swiften/Controllers/MUCController.cpp
deleted file mode 100644
index 8137fe1..0000000
--- a/Swiften/Controllers/MUCController.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-#include "Swiften/Controllers/MUCController.h"
-
-#include <boost/bind.hpp>
-
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Controllers/ChatWindow.h"
-#include "Swiften/Controllers/ChatWindowFactory.h"
-#include "Swiften/MUC/MUC.h"
-#include "Swiften/Client/StanzaChannel.h"
-#include "Swiften/Roster/Roster.h"
-#include "Swiften/Roster/SetPresence.h"
-#include "Swiften/Roster/TreeWidgetFactory.h"
-
-namespace Swift {
-
-/**
- * The controller does not gain ownership of the stanzaChannel, nor the factory.
- */
-MUCController::MUCController (
- const JID &muc,
- const String &nick,
- StanzaChannel* stanzaChannel,
- IQRouter* iqRouter,
- ChatWindowFactory* chatWindowFactory,
- TreeWidgetFactory *treeWidgetFactory,
- PresenceOracle* presenceOracle) :
- ChatControllerBase(stanzaChannel, iqRouter, chatWindowFactory, muc, presenceOracle),
- muc_(new MUC(stanzaChannel, muc)),
- nick_(nick),
- treeWidgetFactory_(treeWidgetFactory) {
- roster_ = new Roster(chatWindow_->getTreeWidget(), treeWidgetFactory_);
- chatWindow_->onClosed.connect(boost::bind(&MUCController::handleWindowClosed, this));
- muc_->joinAs(nick);
- muc_->onOccupantJoined.connect(boost::bind(&MUCController::handleOccupantJoined, this, _1));
- muc_->onOccupantPresenceChange.connect(boost::bind(&MUCController::handleOccupantPresenceChange, this, _1));
- muc_->onOccupantLeft.connect(boost::bind(&MUCController::handleOccupantLeft, this, _1, _2, _3));
- chatWindow_->convertToMUC();
- chatWindow_->show();
-}
-
-MUCController::~MUCController() {
- delete muc_;
- //don't crash on exit by masking this. FIXME.
- //delete roster_;
-}
-
-void MUCController::handleWindowClosed() {
- muc_->part();
-}
-
-void MUCController::handleOccupantJoined(const MUCOccupant& occupant) {
- roster_->addContact(JID(toJID_.getNode(), toJID_.getDomain(), occupant.getNick()), occupant.getNick(), "Occupants");
-}
-
-void MUCController::handleOccupantLeft(const MUCOccupant& occupant, MUC::LeavingType, const String& /*reason*/) {
- roster_->removeContact(JID(toJID_.getNode(), toJID_.getDomain(), occupant.getNick()));
-}
-
-void MUCController::handleOccupantPresenceChange(boost::shared_ptr<Presence> presence) {
- roster_->applyOnItems(SetPresence(presence, JID::WithResource));
-}
-
-bool MUCController::isIncomingMessageFromMe(boost::shared_ptr<Message> message) {
- JID from = message->getFrom();
- return nick_ == from.getResource();
-}
-
-String MUCController::senderDisplayNameFromMessage(JID from) {
- return from.getResource();
-}
-
-void MUCController::preSendMessageRequest(boost::shared_ptr<Message> message) {
- message->setType(Swift::Message::Groupchat);
-}
-
-}