summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-03-28 13:40:14 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-03-28 13:40:43 (GMT)
commitb61486fefe602e0d18fa5279021006f87b965307 (patch)
tree437585cbef1179e1ec31f79789591d5610200c29 /Swiften/MUC/MUC.cpp
parentdae28dd45e43fc6e6ef2ec4c6c65d5d736ed86f8 (diff)
downloadswift-contrib-b61486fefe602e0d18fa5279021006f87b965307.zip
swift-contrib-b61486fefe602e0d18fa5279021006f87b965307.tar.bz2
Moved Swiften to a separate module.
Diffstat (limited to 'Swiften/MUC/MUC.cpp')
m---------Swiften0
-rw-r--r--Swiften/MUC/MUC.cpp70
2 files changed, 0 insertions, 70 deletions
diff --git a/Swiften b/Swiften
new file mode 160000
+Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c
diff --git a/Swiften/MUC/MUC.cpp b/Swiften/MUC/MUC.cpp
deleted file mode 100644
index 3c06c7a..0000000
--- a/Swiften/MUC/MUC.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-#include "Swiften/MUC/MUC.h"
-
-#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include "Swiften/Presence/PresenceSender.h"
-#include "Swiften/Client/StanzaChannel.h"
-#include "Swiften/Elements/IQ.h"
-#include "Swiften/Elements/MUCPayload.h"
-
-namespace Swift {
-
-typedef std::pair<String, MUCOccupant> StringMUCOccupantPair;
-
-MUC::MUC(StanzaChannel* stanzaChannel, PresenceSender* presenceSender, const JID &muc) : ownMUCJID(muc), stanzaChannel(stanzaChannel), presenceSender(presenceSender) {
- scopedConnection_ = stanzaChannel->onPresenceReceived.connect(boost::bind(&MUC::handleIncomingPresence, this, _1));
-}
-
-void MUC::joinAs(const String &nick) {
- firstPresenceSeen = false;
-
- ownMUCJID = JID(ownMUCJID.getNode(), ownMUCJID.getDomain(), nick);
-
- boost::shared_ptr<Presence> joinPresence(new Presence());
- joinPresence->setTo(ownMUCJID);
- joinPresence->addPayload(boost::shared_ptr<Payload>(new MUCPayload()));
- presenceSender->sendPresence(joinPresence);
-}
-
-void MUC::part() {
- presenceSender->removeDirectedPresenceReceiver(ownMUCJID);
-}
-
-void MUC::handleIncomingPresence(boost::shared_ptr<Presence> presence) {
- if (!isFromMUC(presence->getFrom())) {
- return;
- }
-
- if (!firstPresenceSeen) {
- if (presence->getType() == Presence::Error) {
- onJoinComplete(JoinFailed);
- return;
- }
- firstPresenceSeen = true;
- onJoinComplete(JoinSucceeded);
- presenceSender->addDirectedPresenceReceiver(ownMUCJID);
- }
-
- String nick = presence->getFrom().getResource();
- if (nick.isEmpty()) {
- return;
- }
- if (presence->getType() == Presence::Unavailable) {
- std::map<String,MUCOccupant>::iterator i = occupants.find(nick);
- if (i != occupants.end()) {
- onOccupantLeft(i->second, Part, "");
- occupants.erase(i);
- }
- }
- else if (presence->getType() == Presence::Available) {
- std::pair<std::map<String,MUCOccupant>::iterator, bool> result = occupants.insert(std::make_pair(nick, MUCOccupant(nick)));
- if (result.second) {
- onOccupantJoined(result.first->second);
- }
- onOccupantPresenceChange(presence);
- }
-}
-
-
-}