From 156a7cc4b450ed038d6ee239cfca66b1d5c1f689 Mon Sep 17 00:00:00 2001 From: Eric Frias Date: Thu, 21 Aug 2014 16:14:08 -0400 Subject: [PATCH] Allow setting hostname --- include/fc/network/gntp.hpp | 3 ++- src/network/gntp.cpp | 13 ++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/fc/network/gntp.hpp b/include/fc/network/gntp.hpp index f512a2e..5f5b649 100644 --- a/include/fc/network/gntp.hpp +++ b/include/fc/network/gntp.hpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -40,7 +41,7 @@ namespace fc class gntp_notifier { public: - gntp_notifier(); + gntp_notifier(const std::string& host_to_notify = "127.0.0.1", uint16_t port = 23053); ~gntp_notifier(); void set_application_name(std::string application_name); void set_application_icon(const gntp_icon_ptr& icon); diff --git a/src/network/gntp.cpp b/src/network/gntp.cpp index f6d83fa..109a6de 100644 --- a/src/network/gntp.cpp +++ b/src/network/gntp.cpp @@ -41,7 +41,7 @@ namespace fc class gntp_notifier_impl { public: - gntp_notifier_impl(); + gntp_notifier_impl(const std::string& host_to_notify = "127.0.0.1", uint16_t port = 23053); // there's no API to change these right now, it will always notify localhost at the default GNTP port std::string hostname; @@ -60,9 +60,9 @@ namespace fc void send_gntp_message(const std::string& message); }; - gntp_notifier_impl::gntp_notifier_impl() : - hostname("127.0.0.1"), - port(23053), + gntp_notifier_impl::gntp_notifier_impl(const std::string& host_to_notify /* = "127.0.0.1" */, uint16_t port /* = 23053 */ ) : + hostname(host_to_notify), + port(port), connection_failed(false), is_registered(false) { @@ -157,8 +157,8 @@ namespace fc { } - gntp_notifier::gntp_notifier() : - my(new detail::gntp_notifier_impl) + gntp_notifier::gntp_notifier(const std::string& host_to_notify /* = "127.0.0.1" */, uint16_t port /* = 23053 */ ) : + my(new detail::gntp_notifier_impl(host_to_notify, port)) { } @@ -166,7 +166,6 @@ namespace fc { } - void gntp_notifier::set_application_name(std::string appName) { my->application_name = appName;