summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2015-02-25 18:35:30 +0100
committerFlorent Le Coz <louiz@louiz.org>2015-02-25 18:35:30 +0100
commit2df0ebf2dfed1dcbf80c92bff8361e2a04581bec (patch)
tree899b26c9166f921dc4f6d7cb5f661ca4a1cec8b9 /src/utils
parent1c43c3af4cbefcd482f4145ee3d7553631a7485d (diff)
downloadbiboumi-2df0ebf2dfed1dcbf80c92bff8361e2a04581bec.tar.gz
biboumi-2df0ebf2dfed1dcbf80c92bff8361e2a04581bec.tar.bz2
biboumi-2df0ebf2dfed1dcbf80c92bff8361e2a04581bec.tar.xz
biboumi-2df0ebf2dfed1dcbf80c92bff8361e2a04581bec.zip
Add support for a fixed_irc_server configuration
This option lets the administrator choose a specific IRC server, and only that server can be used with this biboumi instance. In this mode, JIDs to use are changed like this: - #chan%irc.example.com@biboumi.example.com -> #chan@biboumi.example.com - user!irc.example.com@biboumi.example.com -> user!@biboumi.example.com - #chan%irc.example.com@biboumi.example.com/Nick -> #chan@biboumi.example.com/Nick - %irc.example.com@biboumi.example.com -> no equivalent - irc.example.com@biboumi.example.com -> no equivalent
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/empty_if_fixed_server.cpp8
-rw-r--r--src/utils/empty_if_fixed_server.hpp26
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 */