summaryrefslogtreecommitdiff
path: root/src/utils/empty_if_fixed_server.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/empty_if_fixed_server.hpp')
-rw-r--r--src/utils/empty_if_fixed_server.hpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/utils/empty_if_fixed_server.hpp b/src/utils/empty_if_fixed_server.hpp
new file mode 100644
index 0000000..8739fd9
--- /dev/null
+++ b/src/utils/empty_if_fixed_server.hpp
@@ -0,0 +1,26 @@
+#ifndef EMPTY_IF_FIXED_SERVER_HPP_INCLUDED
+#define EMPTY_IF_FIXED_SERVER_HPP_INCLUDED
+
+#include <string>
+
+#include <config/config.hpp>
+
+namespace utils
+{
+ inline std::string empty_if_fixed_server(std::string&& str)
+ {
+ if (!Config::get("fixed_irc_server", "").empty())
+ return {};
+ return str;
+ }
+
+ inline std::string empty_if_fixed_server(const std::string& str)
+ {
+ if (!Config::get("fixed_irc_server", "").empty())
+ return {};
+ return str;
+ }
+
+}
+
+#endif /* EMPTY_IF_FIXED_SERVER_HPP_INCLUDED */