summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-07-12 09:39:50 (GMT)
committerKevin Smith <kevin.smith@isode.com>2016-07-12 10:04:59 (GMT)
commitee22c7cde330254cd97adb9ce818b80d3b6bbbd8 (patch)
tree59f9ffc0c482b8590e72bc2a0d90e4791ec50a5c /SwifTools/Notifier/SnarlNotifier.cpp
parent0ea6c4a70e324c431bb4c10eab2f2de25da253e0 (diff)
downloadswift-ee22c7cde330254cd97adb9ce818b80d3b6bbbd8.zip
swift-ee22c7cde330254cd97adb9ce818b80d3b6bbbd8.tar.bz2
Remove Snarl notification support
This removes Snarl from 3rdParty, our adapter to it in SwifTools and the integration in Swift UI. Test-Information: Builds and installer still work on Windows 8. Standard system tray balloon notifications still work. Change-Id: Id580642932eac260c79eaf2343a94ec9d5606f11
Diffstat (limited to 'SwifTools/Notifier/SnarlNotifier.cpp')
-rw-r--r--SwifTools/Notifier/SnarlNotifier.cpp73
1 files changed, 0 insertions, 73 deletions
diff --git a/SwifTools/Notifier/SnarlNotifier.cpp b/SwifTools/Notifier/SnarlNotifier.cpp
deleted file mode 100644
index e3977a7..0000000
--- a/SwifTools/Notifier/SnarlNotifier.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2010 Isode Limited.
- * All rights reserved.
- * See the COPYING file for more information.
- */
-
-#include <SwifTools/Notifier/SnarlNotifier.h>
-
-#include <cassert>
-#include <iostream>
-#include <boost/bind.hpp>
-
-#include <Swiften/Base/foreach.h>
-#include <SwifTools/Notifier/Win32NotifierWindow.h>
-
-#define SWIFT_SNARLNOTIFIER_MESSAGE_ID 0x4567 // Sounds sick to pick a number, but this is windows
-
-namespace Swift {
-
-SnarlNotifier::SnarlNotifier(const std::string& name, Win32NotifierWindow* window, const boost::filesystem::path& icon) : window(window), available(false) {
- window->onMessageReceived.connect(boost::bind(&SnarlNotifier::handleMessageReceived, this, _1));
- available = snarl.RegisterApp(name.c_str(), name.c_str(), icon.string().c_str(), window->getID(), SWIFT_SNARLNOTIFIER_MESSAGE_ID);
- foreach(Notifier::Type type, getAllTypes()) {
- snarl.AddClass(typeToString(type).c_str(), typeToString(type).c_str());
- }
-}
-
-SnarlNotifier::~SnarlNotifier() {
- snarl.UnregisterApp();
- window->onMessageReceived.disconnect(boost::bind(&SnarlNotifier::handleMessageReceived, this, _1));
- if (!notifications.empty()) {
- std::cerr << "Warning: " << notifications.size() << " Snarl notifications pending" << std::endl;
- }
-}
-
-bool SnarlNotifier::isAvailable() const {
- return available;
-}
-
-
-void SnarlNotifier::showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void()> callback) {
- int timeout = (type == IncomingMessage || type == SystemMessage) ? DEFAULT_MESSAGE_NOTIFICATION_TIMEOUT_SECONDS : DEFAULT_STATUS_NOTIFICATION_TIMEOUT_SECONDS;
- int notificationID = snarl.EZNotify(
- typeToString(type).c_str(),
- subject.c_str(),
- description.c_str(),
- timeout,
- picture.string().c_str());
- if (notificationID > 0) {
- notifications.insert(std::make_pair(notificationID, callback));
- }
-}
-
-void SnarlNotifier::handleMessageReceived(MSG* message) {
- if (message->message == SWIFT_SNARLNOTIFIER_MESSAGE_ID) {
- int action = message->wParam;
- if (action == Snarl::V41::SnarlEnums::NotificationTimedOut || action == Snarl::V41::SnarlEnums::NotificationAck || action == Snarl::V41::SnarlEnums::NotificationClosed) {
- int notificationID = message->lParam;
- NotificationsMap::iterator i = notifications.find(notificationID);
- if (i != notifications.end()) {
- if (action == Snarl::V41::SnarlEnums::NotificationAck && !i->second.empty()) {
- i->second();
- }
- notifications.erase(i);
- }
- else {
- std::cerr << "Warning: Orphaned Snarl notification received";
- }
- }
- }
-}
-
-}