diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/empty_if_fixed_server.cpp | 8 | ||||
-rw-r--r-- | src/utils/empty_if_fixed_server.hpp | 26 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/utils/empty_if_fixed_server.cpp b/src/utils/empty_if_fixed_server.cpp new file mode 100644 index 0000000..85fd86d --- /dev/null +++ b/src/utils/empty_if_fixed_server.cpp @@ -0,0 +1,8 @@ +// #include <utils/empty_if_fixed_server.hpp> + +// #include <config/config.hpp> + +// namespace utils +// { +// inline std::string empty_if_fixed_server(std::string&& str) +// } 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 */ |