-palaver.so
\ No newline at end of file
+palaver.so
+test-regex
PALAVER_VERSION := $(shell git describe --tags --always --dirty 2> /dev/null || cat VERSION)
CXXFLAGS := -Wno-unknown-pragmas -DPALAVER_VERSION=\"$(PALAVER_VERSION)\"
-palaver.so: palaver.cpp
+palaver.so: test palaver.cpp
+ @echo "Building palaver.so"
@CXXFLAGS="$(CXXFLAGS)" znc-buildmod palaver.cpp
install: palaver.so
@echo "Uninstall palaver from $(HOME)/.znc/modules"
-rm -f $(HOME)/.znc/modules/palaver.so
+test-regex: test-regex.cpp
+ @c++ -std=c++11 test-regex.cpp -o test-regex
+
+.PHONY: test
+test: test-regex
+ @./test-regex
```
/msg *status setbindhost 0.0.0.0
```
+
+###### Caught regex error
+
+This error indicates a problem with the C++ regex implementation in your C++
+compiler. Older versions of GCC have buggy implementations of regex and are
+incompatible with the module. GCC 4.9 or newer, and Clang are known to work.
+Please upgrade to a modern version.
--- /dev/null
+#include <iostream>
+#include <regex>
+
+
+int main(int argc, const char *argv[]) {
+ std::smatch match;
+ std::string message = "Hello nickname.";
+ std::string matcher = "\\bnickname\\b";
+
+ try {
+ std::regex expression = std::regex(matcher, std::regex_constants::ECMAScript | std::regex_constants::icase);
+ std::regex_search(message, match, expression);
+ } catch (std::regex_error& error) {
+ std::cout << "Your C++ compiler doesn't properly support regex. Please upgrade to GCC 4.9, Clang or newer.\n";
+ return 1;
+ }
+
+ if (match.empty()) {
+ return 1;
+ }
+
+ return 0;
+}