diff options
-rw-r--r-- | Sluift/component.cpp | 57 | ||||
-rw-r--r-- | Swift/Controllers/Roster/ContactRosterItem.cpp | 2 | ||||
-rw-r--r-- | Swift/Controllers/Roster/ContactRosterItem.h | 2 | ||||
-rw-r--r-- | Swift/Controllers/Roster/ItemOperations/SetPresence.h | 6 | ||||
-rw-r--r-- | Swift/Controllers/Roster/RosterController.cpp | 2 | ||||
-rw-r--r-- | Swiften/FileTransfer/FileTransferManagerImpl.cpp | 1 | ||||
-rw-r--r-- | Swiften/FileTransfer/IncomingFileTransferManager.cpp | 8 | ||||
-rw-r--r-- | Swiften/FileTransfer/IncomingFileTransferManager.h | 5 |
8 files changed, 37 insertions, 46 deletions
diff --git a/Sluift/component.cpp b/Sluift/component.cpp index 5fa80ac..e92352e 100644 --- a/Sluift/component.cpp +++ b/Sluift/component.cpp | |||
@@ -1,47 +1,49 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2014 Isode Limited. | 2 | * Copyright (c) 2014-2015 Isode Limited. |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * See the COPYING file for more information. | 4 | * See the COPYING file for more information. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <boost/lambda/lambda.hpp> | ||
8 | #include <boost/lambda/bind.hpp> | ||
9 | #include <boost/assign/list_of.hpp> | ||
10 | #include <iostream> | 7 | #include <iostream> |
11 | 8 | ||
9 | #include <boost/assign/list_of.hpp> | ||
10 | #include <boost/lambda/bind.hpp> | ||
11 | #include <boost/lambda/lambda.hpp> | ||
12 | |||
13 | #include <Sluift/ElementConvertors/IQConvertor.h> | ||
14 | #include <Sluift/ElementConvertors/MessageConvertor.h> | ||
15 | #include <Sluift/ElementConvertors/PresenceConvertor.h> | ||
16 | #include <Sluift/ElementConvertors/StanzaConvertor.h> | ||
17 | #include <Sluift/ElementConvertors/StatusShowConvertor.h> | ||
18 | #include <Sluift/Lua/Check.h> | ||
19 | #include <Sluift/Lua/Exception.h> | ||
20 | #include <Sluift/Lua/FunctionRegistration.h> | ||
21 | #include <Sluift/Lua/LuaUtils.h> | ||
22 | #include <Sluift/Lua/Value.h> | ||
12 | #include <Sluift/SluiftComponent.h> | 23 | #include <Sluift/SluiftComponent.h> |
13 | #include <Swiften/JID/JID.h> | 24 | #include <Sluift/globals.h> |
14 | #include <Swiften/Elements/SoftwareVersion.h> | 25 | |
26 | #include <Swiften/Base/IDGenerator.h> | ||
27 | #include <Swiften/Base/foreach.h> | ||
28 | #include <Swiften/Elements/DiscoInfo.h> | ||
29 | #include <Swiften/Elements/MAMQuery.h> | ||
15 | #include <Swiften/Elements/Message.h> | 30 | #include <Swiften/Elements/Message.h> |
16 | #include <Swiften/Elements/Presence.h> | 31 | #include <Swiften/Elements/Presence.h> |
17 | #include <Swiften/Elements/RawXMLPayload.h> | 32 | #include <Swiften/Elements/RawXMLPayload.h> |
18 | #include <Swiften/Elements/RosterItemPayload.h> | 33 | #include <Swiften/Elements/RosterItemPayload.h> |
19 | #include <Swiften/Elements/RosterPayload.h> | 34 | #include <Swiften/Elements/RosterPayload.h> |
20 | #include <Swiften/Elements/DiscoInfo.h> | 35 | #include <Swiften/Elements/SoftwareVersion.h> |
21 | #include <Swiften/Elements/MAMQuery.h> | 36 | #include <Swiften/JID/JID.h> |
22 | #include <Swiften/Queries/GenericRequest.h> | ||
23 | #include <Swiften/Presence/PresenceSender.h> | 37 | #include <Swiften/Presence/PresenceSender.h> |
24 | #include <Swiften/Roster/XMPPRoster.h> | ||
25 | #include <Swiften/Roster/SetRosterRequest.h> | ||
26 | #include <Swiften/Presence/SubscriptionManager.h> | 38 | #include <Swiften/Presence/SubscriptionManager.h> |
27 | #include <Swiften/Roster/XMPPRosterItem.h> | 39 | #include <Swiften/Queries/GenericRequest.h> |
28 | #include <Swiften/Queries/IQRouter.h> | 40 | #include <Swiften/Queries/IQRouter.h> |
29 | #include <Swiften/Queries/Requests/GetSoftwareVersionRequest.h> | 41 | #include <Swiften/Queries/Requests/GetSoftwareVersionRequest.h> |
30 | #include <Sluift/Lua/FunctionRegistration.h> | 42 | #include <Swiften/Roster/SetRosterRequest.h> |
31 | #include <Swiften/Base/foreach.h> | 43 | #include <Swiften/Roster/XMPPRoster.h> |
32 | #include <Swiften/Base/IDGenerator.h> | 44 | #include <Swiften/Roster/XMPPRosterItem.h> |
33 | #include <Sluift/Lua/Check.h> | ||
34 | #include <Sluift/Lua/Value.h> | ||
35 | #include <Sluift/Lua/Exception.h> | ||
36 | #include <Sluift/Lua/LuaUtils.h> | ||
37 | #include <Sluift/globals.h> | ||
38 | #include <Sluift/ElementConvertors/StanzaConvertor.h> | ||
39 | #include <Sluift/ElementConvertors/IQConvertor.h> | ||
40 | #include <Sluift/ElementConvertors/PresenceConvertor.h> | ||
41 | #include <Sluift/ElementConvertors/MessageConvertor.h> | ||
42 | #include <Sluift/ElementConvertors/StatusShowConvertor.h> | ||
43 | 45 | ||
44 | using namespace Swift; | 46 | using namespace Swift; |
45 | namespace lambda = boost::lambda; | 47 | namespace lambda = boost::lambda; |
46 | 48 | ||
47 | static inline SluiftComponent* getComponent(lua_State* L) { | 49 | static inline SluiftComponent* getComponent(lua_State* L) { |
@@ -326,15 +328,10 @@ static int sendQuery(lua_State* L, IQ::Type type) { | |||
326 | 328 | ||
327 | return component->sendRequest( | 329 | return component->sendRequest( |
328 | boost::make_shared< GenericRequest<Payload> >(type, from, to, payload, component->getComponent()->getIQRouter()), timeout).convertToLuaResult(L); | 330 | boost::make_shared< GenericRequest<Payload> >(type, from, to, payload, component->getComponent()->getIQRouter()), timeout).convertToLuaResult(L); |
329 | } | 331 | } |
330 | 332 | ||
331 | #define DISPATCH_PUBSUB_PAYLOAD(payloadType, container, response) \ | ||
332 | else if (boost::shared_ptr<payloadType> p = boost::dynamic_pointer_cast<payloadType>(payload)) { \ | ||
333 | return component->sendPubSubRequest(type, to, p, timeout).convertToLuaResult(L); \ | ||
334 | } | ||
335 | |||
336 | SLUIFT_LUA_FUNCTION(Component, get) { | 333 | SLUIFT_LUA_FUNCTION(Component, get) { |
337 | return sendQuery(L, IQ::Get); | 334 | return sendQuery(L, IQ::Get); |
338 | } | 335 | } |
339 | 336 | ||
340 | SLUIFT_LUA_FUNCTION(Component, set) { | 337 | SLUIFT_LUA_FUNCTION(Component, set) { |
diff --git a/Swift/Controllers/Roster/ContactRosterItem.cpp b/Swift/Controllers/Roster/ContactRosterItem.cpp index ae05aee..3258fb5 100644 --- a/Swift/Controllers/Roster/ContactRosterItem.cpp +++ b/Swift/Controllers/Roster/ContactRosterItem.cpp | |||
@@ -92,11 +92,11 @@ typedef std::pair<std::string, boost::shared_ptr<Presence> > StringPresencePair; | |||
92 | void ContactRosterItem::clearPresence() { | 92 | void ContactRosterItem::clearPresence() { |
93 | presence_.reset(); | 93 | presence_.reset(); |
94 | onDataChanged(); | 94 | onDataChanged(); |
95 | } | 95 | } |
96 | 96 | ||
97 | void ContactRosterItem::applyPresence(const std::string& resource, boost::shared_ptr<Presence> presence) { | 97 | void ContactRosterItem::applyPresence(boost::shared_ptr<Presence> presence) { |
98 | presence_ = presence; | 98 | presence_ = presence; |
99 | onDataChanged(); | 99 | onDataChanged(); |
100 | } | 100 | } |
101 | 101 | ||
102 | const std::vector<std::string>& ContactRosterItem::getGroups() const { | 102 | const std::vector<std::string>& ContactRosterItem::getGroups() const { |
diff --git a/Swift/Controllers/Roster/ContactRosterItem.h b/Swift/Controllers/Roster/ContactRosterItem.h index ec04a8c..d21935c 100644 --- a/Swift/Controllers/Roster/ContactRosterItem.h +++ b/Swift/Controllers/Roster/ContactRosterItem.h | |||
@@ -53,11 +53,11 @@ class ContactRosterItem : public RosterItem { | |||
53 | void setAvatarPath(const boost::filesystem::path& path); | 53 | void setAvatarPath(const boost::filesystem::path& path); |
54 | const boost::filesystem::path& getAvatarPath() const; | 54 | const boost::filesystem::path& getAvatarPath() const; |
55 | const JID& getJID() const; | 55 | const JID& getJID() const; |
56 | void setDisplayJID(const JID& jid); | 56 | void setDisplayJID(const JID& jid); |
57 | const JID& getDisplayJID() const; | 57 | const JID& getDisplayJID() const; |
58 | void applyPresence(const std::string& resource, boost::shared_ptr<Presence> presence); | 58 | void applyPresence(boost::shared_ptr<Presence> presence); |
59 | const std::vector<std::string>& getGroups() const; | 59 | const std::vector<std::string>& getGroups() const; |
60 | /** Only used so a contact can know about the groups it's in*/ | 60 | /** Only used so a contact can know about the groups it's in*/ |
61 | void addGroup(const std::string& group); | 61 | void addGroup(const std::string& group); |
62 | void removeGroup(const std::string& group); | 62 | void removeGroup(const std::string& group); |
63 | void clearPresence(); | 63 | void clearPresence(); |
diff --git a/Swift/Controllers/Roster/ItemOperations/SetPresence.h b/Swift/Controllers/Roster/ItemOperations/SetPresence.h index 0b54237..2b5bbbe 100644 --- a/Swift/Controllers/Roster/ItemOperations/SetPresence.h +++ b/Swift/Controllers/Roster/ItemOperations/SetPresence.h | |||
@@ -1,18 +1,18 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2010 Isode Limited. | 2 | * Copyright (c) 2010-2015 Isode Limited. |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * See the COPYING file for more information. | 4 | * See the COPYING file for more information. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #pragma once | 7 | #pragma once |
8 | 8 | ||
9 | #include <Swiften/Elements/Presence.h> | 9 | #include <Swiften/Elements/Presence.h> |
10 | #include <Swiften/JID/JID.h> | 10 | #include <Swiften/JID/JID.h> |
11 | 11 | ||
12 | #include <Swift/Controllers/Roster/ItemOperations/RosterItemOperation.h> | ||
13 | #include <Swift/Controllers/Roster/ContactRosterItem.h> | 12 | #include <Swift/Controllers/Roster/ContactRosterItem.h> |
13 | #include <Swift/Controllers/Roster/ItemOperations/RosterItemOperation.h> | ||
14 | 14 | ||
15 | namespace Swift { | 15 | namespace Swift { |
16 | 16 | ||
17 | class RosterItem; | 17 | class RosterItem; |
18 | 18 | ||
@@ -22,11 +22,11 @@ class SetPresence : public RosterItemOperation { | |||
22 | } | 22 | } |
23 | 23 | ||
24 | virtual void operator() (RosterItem* item) const { | 24 | virtual void operator() (RosterItem* item) const { |
25 | ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item); | 25 | ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item); |
26 | if (contact && contact->getJID().equals(presence_->getFrom(), compareType_)) { | 26 | if (contact && contact->getJID().equals(presence_->getFrom(), compareType_)) { |
27 | contact->applyPresence(presence_->getFrom().getResource(), presence_); | 27 | contact->applyPresence(presence_); |
28 | } | 28 | } |
29 | } | 29 | } |
30 | 30 | ||
31 | private: | 31 | private: |
32 | Presence::ref presence_; | 32 | Presence::ref presence_; |
diff --git a/Swift/Controllers/Roster/RosterController.cpp b/Swift/Controllers/Roster/RosterController.cpp index 751ca32..75acaa9 100644 --- a/Swift/Controllers/Roster/RosterController.cpp +++ b/Swift/Controllers/Roster/RosterController.cpp | |||
@@ -375,11 +375,11 @@ void RosterController::handleAvatarChanged(const JID& jid) { | |||
375 | } | 375 | } |
376 | } | 376 | } |
377 | 377 | ||
378 | void RosterController::handlePresenceChanged(Presence::ref presence) { | 378 | void RosterController::handlePresenceChanged(Presence::ref presence) { |
379 | if (presence->getFrom().equals(myJID_, JID::WithResource)) { | 379 | if (presence->getFrom().equals(myJID_, JID::WithResource)) { |
380 | ownContact_->applyPresence(std::string(), presence); | 380 | ownContact_->applyPresence(presence); |
381 | mainWindow_->setMyContactRosterItem(ownContact_); | 381 | mainWindow_->setMyContactRosterItem(ownContact_); |
382 | } | 382 | } |
383 | else { | 383 | else { |
384 | handleIncomingPresence(presence); | 384 | handleIncomingPresence(presence); |
385 | } | 385 | } |
diff --git a/Swiften/FileTransfer/FileTransferManagerImpl.cpp b/Swiften/FileTransfer/FileTransferManagerImpl.cpp index f4f9517..9dc9d0d 100644 --- a/Swiften/FileTransfer/FileTransferManagerImpl.cpp +++ b/Swiften/FileTransfer/FileTransferManagerImpl.cpp | |||
@@ -75,11 +75,10 @@ FileTransferManagerImpl::FileTransferManagerImpl( | |||
75 | transporterFactory, | 75 | transporterFactory, |
76 | timerFactory, | 76 | timerFactory, |
77 | crypto); | 77 | crypto); |
78 | incomingFTManager = new IncomingFileTransferManager( | 78 | incomingFTManager = new IncomingFileTransferManager( |
79 | jingleSessionManager, | 79 | jingleSessionManager, |
80 | iqRouter, | ||
81 | transporterFactory, | 80 | transporterFactory, |
82 | timerFactory, | 81 | timerFactory, |
83 | crypto); | 82 | crypto); |
84 | incomingFTManager->onIncomingFileTransfer.connect(onIncomingFileTransfer); | 83 | incomingFTManager->onIncomingFileTransfer.connect(onIncomingFileTransfer); |
85 | } | 84 | } |
diff --git a/Swiften/FileTransfer/IncomingFileTransferManager.cpp b/Swiften/FileTransfer/IncomingFileTransferManager.cpp index 239c4a8..c1cc757 100644 --- a/Swiften/FileTransfer/IncomingFileTransferManager.cpp +++ b/Swiften/FileTransfer/IncomingFileTransferManager.cpp | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2010-2014 Isode Limited. | 2 | * Copyright (c) 2010-2015 Isode Limited. |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * See the COPYING file for more information. | 4 | * See the COPYING file for more information. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <Swiften/FileTransfer/IncomingFileTransferManager.h> | 7 | #include <Swiften/FileTransfer/IncomingFileTransferManager.h> |
@@ -11,24 +11,22 @@ | |||
11 | #include <Swiften/Base/Log.h> | 11 | #include <Swiften/Base/Log.h> |
12 | #include <Swiften/Elements/JingleDescription.h> | 12 | #include <Swiften/Elements/JingleDescription.h> |
13 | #include <Swiften/Elements/JingleFileTransferDescription.h> | 13 | #include <Swiften/Elements/JingleFileTransferDescription.h> |
14 | #include <Swiften/Elements/JingleIBBTransportPayload.h> | 14 | #include <Swiften/Elements/JingleIBBTransportPayload.h> |
15 | #include <Swiften/Elements/JingleS5BTransportPayload.h> | 15 | #include <Swiften/Elements/JingleS5BTransportPayload.h> |
16 | #include <Swiften/Jingle/JingleSessionManager.h> | ||
17 | #include <Swiften/Jingle/Jingle.h> | ||
18 | #include <Swiften/FileTransfer/IncomingJingleFileTransfer.h> | 16 | #include <Swiften/FileTransfer/IncomingJingleFileTransfer.h> |
17 | #include <Swiften/Jingle/Jingle.h> | ||
18 | #include <Swiften/Jingle/JingleSessionManager.h> | ||
19 | 19 | ||
20 | namespace Swift { | 20 | namespace Swift { |
21 | 21 | ||
22 | IncomingFileTransferManager::IncomingFileTransferManager( | 22 | IncomingFileTransferManager::IncomingFileTransferManager( |
23 | JingleSessionManager* jingleSessionManager, | 23 | JingleSessionManager* jingleSessionManager, |
24 | IQRouter* router, | ||
25 | FileTransferTransporterFactory* transporterFactory, | 24 | FileTransferTransporterFactory* transporterFactory, |
26 | TimerFactory* timerFactory, | 25 | TimerFactory* timerFactory, |
27 | CryptoProvider* crypto) : | 26 | CryptoProvider* crypto) : |
28 | jingleSessionManager(jingleSessionManager), | 27 | jingleSessionManager(jingleSessionManager), |
29 | router(router), | ||
30 | transporterFactory(transporterFactory), | 28 | transporterFactory(transporterFactory), |
31 | timerFactory(timerFactory), | 29 | timerFactory(timerFactory), |
32 | crypto(crypto) { | 30 | crypto(crypto) { |
33 | jingleSessionManager->addIncomingSessionHandler(this); | 31 | jingleSessionManager->addIncomingSessionHandler(this); |
34 | } | 32 | } |
diff --git a/Swiften/FileTransfer/IncomingFileTransferManager.h b/Swiften/FileTransfer/IncomingFileTransferManager.h index 6edf53b..285ff3f 100644 --- a/Swiften/FileTransfer/IncomingFileTransferManager.h +++ b/Swiften/FileTransfer/IncomingFileTransferManager.h | |||
@@ -12,25 +12,23 @@ | |||
12 | #include <Swiften/Base/boost_bsignals.h> | 12 | #include <Swiften/Base/boost_bsignals.h> |
13 | #include <Swiften/FileTransfer/IncomingFileTransfer.h> | 13 | #include <Swiften/FileTransfer/IncomingFileTransfer.h> |
14 | #include <Swiften/Jingle/IncomingJingleSessionHandler.h> | 14 | #include <Swiften/Jingle/IncomingJingleSessionHandler.h> |
15 | 15 | ||
16 | namespace Swift { | 16 | namespace Swift { |
17 | class IQRouter; | ||
18 | class JingleSessionManager; | 17 | class JingleSessionManager; |
19 | class FileTransferTransporterFactory; | 18 | class FileTransferTransporterFactory; |
20 | class TimerFactory; | 19 | class TimerFactory; |
21 | class CryptoProvider; | 20 | class CryptoProvider; |
22 | 21 | ||
23 | class SWIFTEN_API IncomingFileTransferManager : public IncomingJingleSessionHandler { | 22 | class SWIFTEN_API IncomingFileTransferManager : public IncomingJingleSessionHandler { |
24 | public: | 23 | public: |
25 | IncomingFileTransferManager( | 24 | IncomingFileTransferManager( |
26 | JingleSessionManager* jingleSessionManager, | 25 | JingleSessionManager* jingleSessionManager, |
27 | IQRouter* router, | ||
28 | FileTransferTransporterFactory* transporterFactory, | 26 | FileTransferTransporterFactory* transporterFactory, |
29 | TimerFactory* timerFactory, | 27 | TimerFactory* timerFactory, |
30 | CryptoProvider* crypto); | 28 | CryptoProvider* crypto); |
31 | ~IncomingFileTransferManager(); | 29 | virtual ~IncomingFileTransferManager(); |
32 | 30 | ||
33 | boost::signal<void (IncomingFileTransfer::ref)> onIncomingFileTransfer; | 31 | boost::signal<void (IncomingFileTransfer::ref)> onIncomingFileTransfer; |
34 | 32 | ||
35 | private: | 33 | private: |
36 | bool handleIncomingJingleSession( | 34 | bool handleIncomingJingleSession( |
@@ -38,11 +36,10 @@ namespace Swift { | |||
38 | const std::vector<JingleContentPayload::ref>& contents, | 36 | const std::vector<JingleContentPayload::ref>& contents, |
39 | const JID& recipient); | 37 | const JID& recipient); |
40 | 38 | ||
41 | private: | 39 | private: |
42 | JingleSessionManager* jingleSessionManager; | 40 | JingleSessionManager* jingleSessionManager; |
43 | IQRouter* router; | ||
44 | FileTransferTransporterFactory* transporterFactory; | 41 | FileTransferTransporterFactory* transporterFactory; |
45 | TimerFactory* timerFactory; | 42 | TimerFactory* timerFactory; |
46 | CryptoProvider* crypto; | 43 | CryptoProvider* crypto; |
47 | }; | 44 | }; |
48 | } | 45 | } |