From 944b240a9f72f967f3fd2a840e4efbd2f0ef4183 Mon Sep 17 00:00:00 2001 From: Mateusz Piekos Date: Sun, 29 Jul 2012 17:26:00 +0200 Subject: Added whiteboard discovery information diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index e866102..e67df62 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -314,6 +314,7 @@ void MainController::handleConnected() { discoInfo.addFeature(DiscoInfo::JingleTransportsS5BFeature); #endif discoInfo.addFeature(DiscoInfo::MessageDeliveryReceiptsFeature); + discoInfo.addFeature(DiscoInfo::WhiteboardFeature); client_->getDiscoManager()->setCapsNode(CLIENT_NODE); client_->getDiscoManager()->setDiscoInfo(discoInfo); diff --git a/Swift/Controllers/Roster/ContactRosterItem.h b/Swift/Controllers/Roster/ContactRosterItem.h index 9932dc4..8389a44 100644 --- a/Swift/Controllers/Roster/ContactRosterItem.h +++ b/Swift/Controllers/Roster/ContactRosterItem.h @@ -25,6 +25,7 @@ class ContactRosterItem : public RosterItem { public: enum Feature { FileTransferFeature, + WhiteboardFeature, }; public: diff --git a/Swift/Controllers/Roster/RosterController.cpp b/Swift/Controllers/Roster/RosterController.cpp index 170bfd0..ec52993 100644 --- a/Swift/Controllers/Roster/RosterController.cpp +++ b/Swift/Controllers/Roster/RosterController.cpp @@ -321,6 +321,9 @@ void RosterController::handleOnCapsChanged(const JID& jid) { if (info->hasFeature(DiscoInfo::JingleFeature) && info->hasFeature(DiscoInfo::JingleFTFeature) && info->hasFeature(DiscoInfo::JingleTransportsIBBFeature)) { features.insert(ContactRosterItem::FileTransferFeature); } + if (info->hasFeature(DiscoInfo::WhiteboardFeature)) { + features.insert(ContactRosterItem::WhiteboardFeature); + } roster_->setAvailableFeatures(jid, features); } } diff --git a/Swift/QtUI/Roster/QtRosterWidget.cpp b/Swift/QtUI/Roster/QtRosterWidget.cpp index a7767fe..7149f6a 100644 --- a/Swift/QtUI/Roster/QtRosterWidget.cpp +++ b/Swift/QtUI/Roster/QtRosterWidget.cpp @@ -63,7 +63,10 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) { sendFile = contextMenu.addAction(tr("Send File")); } #endif - QAction* startWhiteboardChat = contextMenu.addAction(tr("Start Whiteboard Chat")); + QAction* startWhiteboardChat = NULL; + if (contact->supportsFeature(ContactRosterItem::WhiteboardFeature)) { + startWhiteboardChat = contextMenu.addAction(tr("Start Whiteboard Chat")); + } QAction* result = contextMenu.exec(event->globalPos()); if (result == editContact) { eventStream_->send(boost::make_shared(contact->getJID())); @@ -81,7 +84,7 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) { } } #endif - else if (result == startWhiteboardChat) { + else if (startWhiteboardChat && result == startWhiteboardChat) { eventStream_->send(boost::make_shared(contact->getJID())); } } diff --git a/Swiften/Elements/DiscoInfo.cpp b/Swiften/Elements/DiscoInfo.cpp index a4ce079..1683916 100644 --- a/Swiften/Elements/DiscoInfo.cpp +++ b/Swiften/Elements/DiscoInfo.cpp @@ -22,6 +22,7 @@ const std::string DiscoInfo::JingleTransportsIBBFeature = std::string("urn:xmpp: const std::string DiscoInfo::JingleTransportsS5BFeature = std::string("urn:xmpp:jingle:transports:s5b:1"); const std::string DiscoInfo::Bytestream = std::string("http://jabber.org/protocol/bytestreams"); const std::string DiscoInfo::MessageDeliveryReceiptsFeature = std::string("urn:xmpp:receipts"); +const std::string DiscoInfo::WhiteboardFeature = std::string("http://swift.im/whiteboard"); bool DiscoInfo::Identity::operator<(const Identity& other) const { if (category_ == other.category_) { diff --git a/Swiften/Elements/DiscoInfo.h b/Swiften/Elements/DiscoInfo.h index fec60d6..01c373c 100644 --- a/Swiften/Elements/DiscoInfo.h +++ b/Swiften/Elements/DiscoInfo.h @@ -32,6 +32,7 @@ namespace Swift { static const std::string JingleTransportsS5BFeature; static const std::string Bytestream; static const std::string MessageDeliveryReceiptsFeature; + static const std::string WhiteboardFeature; class Identity { public: -- cgit v0.10.2-6-g49f6