summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-04-28 11:06:38 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-04-28 11:08:11 (GMT)
commit534b7771cbfdee2fa60f6f154d578c3ef8cf2563 (patch)
tree21c09fa579ad4e9ef6cefdab98aee7e38a9f250e /Swift/Controllers/Chat
parentd6f10adb0a723022eb4e4b57cdfff8288145f407 (diff)
downloadswift-contrib-534b7771cbfdee2fa60f6f154d578c3ef8cf2563.zip
swift-contrib-534b7771cbfdee2fa60f6f154d578c3ef8cf2563.tar.bz2
Send label catalogue queries to bare/full JID as appropriate.
Resolves: #244
Diffstat (limited to 'Swift/Controllers/Chat')
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp4
-rw-r--r--Swift/Controllers/Chat/ChatController.h1
-rw-r--r--Swift/Controllers/Chat/ChatControllerBase.cpp8
-rw-r--r--Swift/Controllers/Chat/ChatControllerBase.h4
4 files changed, 14 insertions, 3 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index 5a18a98..2fa4559 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -91,6 +91,10 @@ ChatController::~ChatController() {
delete chatStateTracker_;
}
+JID ChatController::getBaseJID() {
+ return isInMUC_ ? toJID_ : ChatControllerBase::getBaseJID();
+}
+
void ChatController::cancelReplaces() {
lastWasPresence_ = false;
}
diff --git a/Swift/Controllers/Chat/ChatController.h b/Swift/Controllers/Chat/ChatController.h
index 00d167e..7043231 100644
--- a/Swift/Controllers/Chat/ChatController.h
+++ b/Swift/Controllers/Chat/ChatController.h
@@ -33,6 +33,7 @@ namespace Swift {
protected:
void cancelReplaces();
+ JID getBaseJID();
private:
void handlePresenceChange(boost::shared_ptr<Presence> newPresence);
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp
index 3ff52a6..bc9c14e 100644
--- a/Swift/Controllers/Chat/ChatControllerBase.cpp
+++ b/Swift/Controllers/Chat/ChatControllerBase.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2011 Kevin Smith
+ * Copyright (c) 2010-2012 Kevin Smith
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
@@ -84,9 +84,13 @@ void ChatControllerBase::setOnline(bool online) {
setEnabled(online);
}
+JID ChatControllerBase::getBaseJID() {
+ return JID(toJID_.toBare());
+}
+
void ChatControllerBase::setAvailableServerFeatures(boost::shared_ptr<DiscoInfo> info) {
if (iqRouter_->isAvailable() && info->hasFeature(DiscoInfo::SecurityLabelsCatalogFeature)) {
- GetSecurityLabelsCatalogRequest::ref request = GetSecurityLabelsCatalogRequest::create(JID(toJID_.toBare()), iqRouter_);
+ GetSecurityLabelsCatalogRequest::ref request = GetSecurityLabelsCatalogRequest::create(getBaseJID(), iqRouter_);
request->onResponse.connect(boost::bind(&ChatControllerBase::handleSecurityLabelsCatalogResponse, this, _1, _2));
request->send();
} else {
diff --git a/Swift/Controllers/Chat/ChatControllerBase.h b/Swift/Controllers/Chat/ChatControllerBase.h
index 8654311..b698581 100644
--- a/Swift/Controllers/Chat/ChatControllerBase.h
+++ b/Swift/Controllers/Chat/ChatControllerBase.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Kevin Smith
+ * Copyright (c) 2010-2012 Kevin Smith
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
@@ -76,6 +76,8 @@ namespace Swift {
std::string getErrorMessage(boost::shared_ptr<ErrorPayload>);
virtual void setContactIsReceivingPresence(bool /* isReceivingPresence */) {}
virtual void cancelReplaces() = 0;
+ /** JID any iq for account should go to - bare except for PMs */
+ virtual JID getBaseJID();
private:
IDGenerator idGenerator_;