diff options
Diffstat (limited to 'SwifTools/Notifier')
-rw-r--r-- | SwifTools/Notifier/GNTPNotifier.cpp | 4 | ||||
-rw-r--r-- | SwifTools/Notifier/GNTPNotifier.h | 6 | ||||
-rw-r--r-- | SwifTools/Notifier/GrowlNotifier.cpp | 5 | ||||
-rw-r--r-- | SwifTools/Notifier/GrowlNotifier.h | 4 | ||||
-rw-r--r-- | SwifTools/Notifier/LoggingNotifier.h | 8 | ||||
-rw-r--r-- | SwifTools/Notifier/Notifier.cpp | 2 | ||||
-rw-r--r-- | SwifTools/Notifier/Notifier.h | 10 | ||||
-rw-r--r-- | SwifTools/Notifier/NullNotifier.h | 2 | ||||
-rw-r--r-- | SwifTools/Notifier/SnarlNotifier.cpp | 14 | ||||
-rw-r--r-- | SwifTools/Notifier/SnarlNotifier.h | 4 | ||||
-rw-r--r-- | SwifTools/Notifier/TogglableNotifier.h | 2 |
11 files changed, 31 insertions, 30 deletions
diff --git a/SwifTools/Notifier/GNTPNotifier.cpp b/SwifTools/Notifier/GNTPNotifier.cpp index 924b921..9a20c33 100644 --- a/SwifTools/Notifier/GNTPNotifier.cpp +++ b/SwifTools/Notifier/GNTPNotifier.cpp @@ -18,7 +18,7 @@ namespace Swift { -GNTPNotifier::GNTPNotifier(const String& name, const boost::filesystem::path& icon, ConnectionFactory* connectionFactory) : name(name), icon(icon), connectionFactory(connectionFactory), initialized(false), registered(false) { +GNTPNotifier::GNTPNotifier(const std::string& name, const boost::filesystem::path& icon, ConnectionFactory* connectionFactory) : name(name), icon(icon), connectionFactory(connectionFactory), initialized(false), registered(false) { // Registration message std::ostringstream message; message << "GNTP/1.0 REGISTER NONE\r\n"; @@ -51,7 +51,7 @@ void GNTPNotifier::send(const std::string& message) { currentConnection->connect(HostAddressPort(HostAddress("127.0.0.1"), 23053)); } -void GNTPNotifier::showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()>) { +void GNTPNotifier::showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void()>) { if (registered) { std::ostringstream message; message << "GNTP/1.0 NOTIFY NONE\r\n"; diff --git a/SwifTools/Notifier/GNTPNotifier.h b/SwifTools/Notifier/GNTPNotifier.h index 47b0c01..a740c27 100644 --- a/SwifTools/Notifier/GNTPNotifier.h +++ b/SwifTools/Notifier/GNTPNotifier.h @@ -16,10 +16,10 @@ namespace Swift { class GNTPNotifier : public Notifier { public: - GNTPNotifier(const String& name, const boost::filesystem::path& icon, ConnectionFactory* connectionFactory); + GNTPNotifier(const std::string& name, const boost::filesystem::path& icon, ConnectionFactory* connectionFactory); ~GNTPNotifier(); - virtual void showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()> callback); + virtual void showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void()> callback); private: void handleConnectFinished(bool error); @@ -27,7 +27,7 @@ namespace Swift { void send(const std::string& message); private: - String name; + std::string name; boost::filesystem::path icon; ConnectionFactory* connectionFactory; bool initialized; diff --git a/SwifTools/Notifier/GrowlNotifier.cpp b/SwifTools/Notifier/GrowlNotifier.cpp index 8b5920f..5ecd34c 100644 --- a/SwifTools/Notifier/GrowlNotifier.cpp +++ b/SwifTools/Notifier/GrowlNotifier.cpp @@ -8,6 +8,7 @@ #include <cassert> +#include "Swiften/Base/String.h" #include "Swiften/Base/ByteArray.h" #include "SwifTools/Notifier/GrowlNotifier.h" #include "Swiften/Base/foreach.h" @@ -47,7 +48,7 @@ namespace { namespace Swift { -GrowlNotifier::GrowlNotifier(const String& name) { +GrowlNotifier::GrowlNotifier(const std::string& name) { // All notifications CFMutableArrayRef allNotifications = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); foreach(Type type, getAllTypes()) { @@ -71,7 +72,7 @@ GrowlNotifier::GrowlNotifier(const String& name) { Growl_SetDelegate(&delegate_); } -void GrowlNotifier::showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picturePath, boost::function<void()> callback) { +void GrowlNotifier::showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picturePath, boost::function<void()> callback) { ByteArray picture; picture.readFromFile(picturePath.string()); diff --git a/SwifTools/Notifier/GrowlNotifier.h b/SwifTools/Notifier/GrowlNotifier.h index f7c4260..d4a6178 100644 --- a/SwifTools/Notifier/GrowlNotifier.h +++ b/SwifTools/Notifier/GrowlNotifier.h @@ -21,9 +21,9 @@ namespace Swift { */ class GrowlNotifier : public Notifier { public: - GrowlNotifier(const String& name); + GrowlNotifier(const std::string& name); - virtual void showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()> callback); + virtual void showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void()> callback); private: Growl_Delegate delegate_; diff --git a/SwifTools/Notifier/LoggingNotifier.h b/SwifTools/Notifier/LoggingNotifier.h index eea07ef..18ae0e2 100644 --- a/SwifTools/Notifier/LoggingNotifier.h +++ b/SwifTools/Notifier/LoggingNotifier.h @@ -12,15 +12,15 @@ namespace Swift { class LoggingNotifier : public Notifier { public: - virtual void showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()> callback) { + virtual void showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void()> callback) { notifications.push_back(Notification(type, subject, description, picture, callback)); } struct Notification { - Notification(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()> callback) : type(type), subject(subject), description(description), picture(picture), callback(callback) {} + Notification(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void()> callback) : type(type), subject(subject), description(description), picture(picture), callback(callback) {} Type type; - String subject; - String description; + std::string subject; + std::string description; boost::filesystem::path picture; boost::function<void()> callback; }; diff --git a/SwifTools/Notifier/Notifier.cpp b/SwifTools/Notifier/Notifier.cpp index 2c2660e..1673400 100644 --- a/SwifTools/Notifier/Notifier.cpp +++ b/SwifTools/Notifier/Notifier.cpp @@ -14,7 +14,7 @@ const int Notifier::DEFAULT_MESSAGE_NOTIFICATION_TIMEOUT_SECONDS = 5; Notifier::~Notifier() { } -String Notifier::typeToString(Type type) { +std::string Notifier::typeToString(Type type) { switch (type) { case ContactAvailable: return "Contact Becomes Available"; case ContactUnavailable: return "Contact Becomes Unavailable"; diff --git a/SwifTools/Notifier/Notifier.h b/SwifTools/Notifier/Notifier.h index a8424bf..d6bd878 100644 --- a/SwifTools/Notifier/Notifier.h +++ b/SwifTools/Notifier/Notifier.h @@ -8,8 +8,8 @@ #include <boost/function.hpp> #include <boost/filesystem/path.hpp> - -#include "Swiften/Base/String.h" +#include <string> +#include <vector> namespace Swift { class Notifier { @@ -23,8 +23,8 @@ namespace Swift { */ virtual void showMessage( Type type, - const String& subject, - const String& description, + const std::string& subject, + const std::string& description, const boost::filesystem::path& picture, boost::function<void()> callback) = 0; @@ -33,7 +33,7 @@ namespace Swift { } protected: - String typeToString(Type type); + std::string typeToString(Type type); static std::vector<Type> getAllTypes(); static std::vector<Type> getDefaultTypes(); diff --git a/SwifTools/Notifier/NullNotifier.h b/SwifTools/Notifier/NullNotifier.h index e97329b..24b4476 100644 --- a/SwifTools/Notifier/NullNotifier.h +++ b/SwifTools/Notifier/NullNotifier.h @@ -11,7 +11,7 @@ namespace Swift { class NullNotifier : public Notifier { public: - virtual void showMessage(Type, const String&, const String&, const boost::filesystem::path&, boost::function<void()>) { + virtual void showMessage(Type, const std::string&, const std::string&, const boost::filesystem::path&, boost::function<void()>) { } }; } diff --git a/SwifTools/Notifier/SnarlNotifier.cpp b/SwifTools/Notifier/SnarlNotifier.cpp index 8d7407a..e93a539 100644 --- a/SwifTools/Notifier/SnarlNotifier.cpp +++ b/SwifTools/Notifier/SnarlNotifier.cpp @@ -17,11 +17,11 @@ namespace Swift { -SnarlNotifier::SnarlNotifier(const String& name, Win32NotifierWindow* window, const boost::filesystem::path& icon) : window(window), available(false) { +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.getUTF8Data(), name.getUTF8Data(), icon.string().c_str(), window->getID(), SWIFT_SNARLNOTIFIER_MESSAGE_ID); + 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).getUTF8Data(), typeToString(type).getUTF8Data()); + snarl.AddClass(typeToString(type).c_str(), typeToString(type).c_str()); } } @@ -38,12 +38,12 @@ bool SnarlNotifier::isAvailable() const { } -void SnarlNotifier::showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()> callback) { +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).getUTF8Data(), - subject.getUTF8Data(), - description.getUTF8Data(), + typeToString(type).c_str(), + subject.c_str(), + description.c_str(), timeout, picture.string().c_str()); if (notificationID > 0) { diff --git a/SwifTools/Notifier/SnarlNotifier.h b/SwifTools/Notifier/SnarlNotifier.h index 9aa75f6..9e2cddf 100644 --- a/SwifTools/Notifier/SnarlNotifier.h +++ b/SwifTools/Notifier/SnarlNotifier.h @@ -16,10 +16,10 @@ namespace Swift { class SnarlNotifier : public Notifier { public: - SnarlNotifier(const String& name, Win32NotifierWindow* window, const boost::filesystem::path& icon); + SnarlNotifier(const std::string& name, Win32NotifierWindow* window, const boost::filesystem::path& icon); ~SnarlNotifier(); - virtual void showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()> callback); + virtual void showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void()> callback); virtual bool isAvailable() const; private: diff --git a/SwifTools/Notifier/TogglableNotifier.h b/SwifTools/Notifier/TogglableNotifier.h index 1e87807..415caf6 100644 --- a/SwifTools/Notifier/TogglableNotifier.h +++ b/SwifTools/Notifier/TogglableNotifier.h @@ -40,7 +40,7 @@ namespace Swift { return persistentEnabled && !temporarilyDisabled; } - virtual void showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()> callback) { + virtual void showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void()> callback) { if (getCurrentlyEnabled()) { notifier->showMessage(type, subject, description, picture, callback); } |