# HG changeset patch # User David Demelier # Date 1567351402 -7200 # Node ID 73cbd6760978a1be52494c134749e2c5310e76e7 # Parent ff11e26d798c2ce937917b870b3b66cc6eb0ace7# Parent 23e22d72aff8eb204f6cda078b851849524b1ead misc: merge from release-3.0 diff -r ff11e26d798c -r 73cbd6760978 .hgsigs --- a/.hgsigs Thu Aug 15 22:38:01 2019 +0200 +++ b/.hgsigs Sun Sep 01 17:23:22 2019 +0200 @@ -8,3 +8,4 @@ b347b10d24c1f21737c677b5dcfbdcce97a2e945 0 iQEcBAABAgAGBQJZewPlAAoJEKHa+bhAI/MfXvcIAKX+kjUlKUxLqTkEPJYSTavlLwjdBoee1tesN7r4rMkxzy+WEHZnFEZToRgOqq4bcPS02J3XQcgZdHEysI43SezV44ZQVjdYyN2p2T98RuaXYXScE/pN7m0OFhiQHK6ozbeIRdDmx3i0l7ROYBiUmDWew0PZ4YULaLcSUnzELPYQfajCi2Vx4tmuKp42OG4gZQdgK60T2prl/tkzplS0TOErnPwCN0Vg+zJkD9JR9f9hsd7A2+3bkVyn7qe3HcgHzl6OsPt/P75siDpQv9lXA7s2mSYlzTmuffrviyms90K5ogbEkW56QQ8H8DGvtM5mLsIgNiatfAuXxAJfNj6FJj4= d5bfaf362ded7a15e1c9da50805a7ee6a95b4875 0 iQEzBAABCAAdFiEEvr8S/JLqYAXrLA5Xodr5uEAj8x8FAlvhaEkACgkQodr5uEAj8x+EWwf/aeFmJ5JkHc/LsLSiHHwHQDIcnuyvRemz5VX/6um41jygTx3VUPYFC+mrtyql+ot5bstsI/9l8C1hFEAAimiIy7bhbALWdbqieJjBhXaUVSsJFq+YzOVR+k/6BZSJHTWL4lf4+Jic1ACsBWPXEQpyqxxdGpbmb7EXmx0ZZlXJIb1Xd0l/eev+ONIW9NwbabqvaoaUFab5BnrOu4LeZA1Ny2u7Wm2KJtyJAiJzwKfRjyDmJ7D0ljg7n24SzuxCC0vJS+drLd38dCaaYrLrL9WlndPql+IxTDByAGs9g/SkdJRis4ubDMXV92rLxZtdJZEyzoanethrFQn/s0Y0EOnGsg== fb0adda67228d8f1de259eaf00ecde102f99666b 0 iQEzBAABCAAdFiEEvr8S/JLqYAXrLA5Xodr5uEAj8x8FAl1VwjIACgkQodr5uEAj8x8WTwf9Hs+G8kCIjrXJXlHlPTEjEPH+icIPvXxcT+1CsIp2v4QxBgjocxBH4APdhH7iTXQ1GnOBA5txuYOonDJBL/cfkv60F366YZTNKeZt89QSty8gIIyR3WMGMlTnidhFziu3O950YOc4tjDXfQI4JuLIHNJSwEwDSzAsaXv8QNg+3VnXqX0EybGMT93Vi5eJZSUocluzWEF8eVgF6simgDUguiFPZZyYymVQTt7SZS2fevfBHOp+mtj5zdsH27N7TFU+1i3j4qfn3Yp0fYHieFeihpo3Tb9V8A1SK+3gOMp+7pEEV786XhwGaPr1XFZ/pBBdUReIfupPcdVjKoUnnIqx3w== +b83f4bbdaa9ec28ea547a7cefbb0b0475af9d1fa 0 iQEzBAABCAAdFiEEvr8S/JLqYAXrLA5Xodr5uEAj8x8FAl1r4kQACgkQodr5uEAj8x8QcQgAiF1iMgk34pwFDpNFcnwz0E0OE0VwKzn2mL3knXq8wAdi4MBjPo1tR85iPvavIfq6/FMtrJvZGQiKJv99iWgkWQ6uI8scWYwmkkheTpVtYNXxPjFGgoEm9wFvMki/jjmXkxssSanJsXHw10i2uWucRM+kky7jQcLZFsHmMDV8ZEhjE3mUJ1Zlx1s3yHs/tZzK92Bq0yMowwebdq8X+wLTAswNQbMxgxuJhQFIE14p9sIsmMcZQkwb5ldVaEV80m63EdXUtiMkWz9sR4gIgk4i7otPSU9GbKKmHys1oxDS9coKUvv12NG0RR5cpiVv70z77NJzi0sOnD3nK/6g+GZqTQ== diff -r ff11e26d798c -r 73cbd6760978 .hgtags --- a/.hgtags Thu Aug 15 22:38:01 2019 +0200 +++ b/.hgtags Sun Sep 01 17:23:22 2019 +0200 @@ -8,3 +8,4 @@ c3f46ad1ece6c9eccfe42f0f683f01aa3a29da9f 2.1.3 76aaaf7cd5a3410c97c644d3aa90bd2372c56aa4 2.2.0 6baa070e083cb7cecb4cb64c2d2729575c72b3c1 3.0.0 +d1cfe59eed061121da5325414c59262a8a2b085f 3.0.1 diff -r ff11e26d798c -r 73cbd6760978 CHANGES.md --- a/CHANGES.md Thu Aug 15 22:38:01 2019 +0200 +++ b/CHANGES.md Sun Sep 01 17:23:22 2019 +0200 @@ -1,6 +1,13 @@ IRC Client Daemon CHANGES ========================= +irccd 3.0.1 2019-09-01 +---------------------- + +- Fixed an invalid template escape sequence (#2250), +- Updated the default configuration files (#2249), +- Fix RPATH handling for private libraries like Duktape (#2257). + irccd 3.0.0 2019-08-15 ---------------------- diff -r ff11e26d798c -r 73cbd6760978 cmake/IrccdVersion.cmake --- a/cmake/IrccdVersion.cmake Thu Aug 15 22:38:01 2019 +0200 +++ b/cmake/IrccdVersion.cmake Sun Sep 01 17:23:22 2019 +0200 @@ -30,7 +30,7 @@ # Irccd version. set(IRCCD_VERSION_MAJOR "3") set(IRCCD_VERSION_MINOR "0") -set(IRCCD_VERSION_PATCH "0") +set(IRCCD_VERSION_PATCH "1") set(IRCCD_VERSION "${IRCCD_VERSION_MAJOR}.${IRCCD_VERSION_MINOR}.${IRCCD_VERSION_PATCH}${HG_REV}") set(IRCCD_VERSION_RAW "${IRCCD_VERSION_MAJOR}.${IRCCD_VERSION_MINOR}.${IRCCD_VERSION_PATCH}") set(IRCCD_VERSION_SHLIB "1") @@ -43,9 +43,9 @@ # IRCCD_RELEASE_DATE_DAY 2 digits (01 = first day of month) # set(IRCCD_RELEASE_DATE_YEAR 2019) -set(IRCCD_RELEASE_DATE_MONTH 08) -set(IRCCD_RELEASE_DATE_DAY 15) +set(IRCCD_RELEASE_DATE_MONTH 09) +set(IRCCD_RELEASE_DATE_DAY 01) set(IRCCD_RELEASE_DATE "${IRCCD_RELEASE_DATE_YEAR}-${IRCCD_RELEASE_DATE_MONTH}-${IRCCD_RELEASE_DATE_DAY}") # Irccd release data (manual version). -set(IRCCD_MAN_DATE "August 15, 2019") +set(IRCCD_MAN_DATE "September 01, 2019") diff -r ff11e26d798c -r 73cbd6760978 cmake/function/IrccdDefineExecutable.cmake --- a/cmake/function/IrccdDefineExecutable.cmake Thu Aug 15 22:38:01 2019 +0200 +++ b/cmake/function/IrccdDefineExecutable.cmake Sun Sep 01 17:23:22 2019 +0200 @@ -68,9 +68,12 @@ target_compile_options(${EXE_TARGET} PRIVATE ${EXE_OPTIONS}) target_link_libraries(${EXE_TARGET} ${EXE_LIBRARIES}) + file(RELATIVE_PATH RPATH ${CMAKE_INSTALL_FULL_BINDIR} ${CMAKE_INSTALL_FULL_LIBDIR}/irccd) + set_target_properties( ${EXE_TARGET} PROPERTIES + INSTALL_RPATH "$ORIGIN/${RPATH}" CXX_STANDARD 17 CXX_STANDARD_REQUIRED On RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin diff -r ff11e26d798c -r 73cbd6760978 doc/examples/irccd.conf.sample --- a/doc/examples/irccd.conf.sample Thu Aug 15 22:38:01 2019 +0200 +++ b/doc/examples/irccd.conf.sample Sun Sep 01 17:23:22 2019 +0200 @@ -8,10 +8,18 @@ # [plugins] # abc = "" # This will search for abc # ask = /tmp/ask.js # This use /tmp/ask.js to load the plugin +# +# Specific options for plugins are stored in a dedicated section: +# +# [plugin.hangman] +# collaborative = false +# +# See corresponding manual pages for plugins. # Section transport: -# You can use transport to wait for any input you want. Unix and internet sockets are supported. Unix are used -# for file based socket while internet bind to standard address plus a specific port. +# You can use transport to wait for any input you want. UNIX and internet +# sockets are supported. UNIX are used for file based sockets while internet +# bind to standard address plus a specific port. # # For internet sockets: # @@ -19,9 +27,10 @@ # type = "ip" # port = "1234" # (int) port number, # address = "*" # (string) address to bind or "*" for any (Optional, default: *), -# family = ( "ipv4", "ipv6" ) # (list) ipv6, ipv4. Both are accepted (Optional, default: ipv4). +# ipv6 = true # (bool) enable IPv6 (Optional, default: true), +# ipv4 = true # (bool )enable IPv4 (Optional, default: true). # -# For unix sockets: +# For UNIX sockets: # # [transport] # type = "unix" @@ -31,16 +40,14 @@ type = "ip" address = "*" port = "5980" -family = ( "ipv4", "ipv6" ) # Section server: -# List of server you want to connect to. A server may use an identity to -# set the username, nickname and so on. A server is registered with a +# List of server you want to connect to. A server is registered with a # unique id that is needed for irccdctl(1). # # [server] # name = "id" # (id) the unique id, -# host = "chat.foo.com" # (string) the server address, +# hostname = "chat.foo.com" # (string) the server address, # port = "4321" # (int) the server port (Optional, default: 6667), # nickname = "foo" # (string) the nickname (Optional, default: irccd), # username = "bar" # (string) the realname (Optional, default: IRC Client daemon), @@ -52,17 +59,13 @@ # channels = "" # (list) list of channels to auto join, (Optional, default: empty), # command-char = "!" # (string) the prefix for invoking special commands (Optional, default: !), # ssl = false # (bool) enable or disable SSL (Optional, default: false), -# ssl-verify = false # (bool) verify the SSL certificates (Optional, default: true), # auto-reconnect = true # (bool) enable reconnection after failure (Optional, default: true), -# auto-reconnect-timeout = 5 # (int) number of seconds to wait before retrying (Optional, default: 30). +# auto-reconnect-delay = 5 # (int) number of seconds to wait before retrying (Optional, default: 30). [server] -identity = "default" name = "localhost" -host = "localhost" +hostname = "localhost" port = 6667 -reconnect-timeout = 60 -reconnect-tries = 20 # Section rule: # Add one or more rules to filter IRC events. @@ -71,6 +74,7 @@ # channels = "" # (list) a list of channel (Optional, default: empty), # plugins = "" # (list) which plugins (Optional, default: empty), # events = "" # (list) which events (e.g onCommand, onMessage, ...) (Optional, default: empty), +# origins = "" # (list) nicknames to match (Optional, default: empty) # action = "" # (string) set to **accept** or **drop**. # # Block plugin hangman everywhere. @@ -86,3 +90,60 @@ # channels = "#games" # plugins = "hangman" # action = accept + +# Section paths: +# This section stores default paths mostly for plugins. For each plugin the +# string "plugin/NAME" is appended. +# +# This section is optional and default values are used instead. +# +# [paths] +# cache = "/var/cache" # (string) data files written by the plugin. +# data = "/share/ # (string) data files provided by the user. +# config = "/etc/" # (string) additional configuration from the user. +# +# To override paths per plugins: +# +# [paths.hangman] +# cache = "/var" + +# Section logs: +# Define where to store logs. Syslog, file and console are supported. +# +# This section is optional, by default console is used. +# +# Common options: +# +# [logs] +# verbose = false # (bool) be verbose. +# +# For syslog: +# +# [logs] +# type = "syslog" +# +# For files: +# +# [logs] +# path-logs # (string) Path to the normal messages, +# path-errors # (string) Path to the error messages. + +# Section templates: +# This section defines how irccd should format messages for logs and plugins. +# The syntax is described in details in the irccd-templates(7) manual page. +# Also, check corresponding information in plugin manual pages for more +# details. +# +# This section is optional, default values are used instead. +# +# To format general messages: +# +# [templates] +# debug = "DD #{message} # (string) debug messages. +# info = "II #{message} # (string) information messages. +# warning = "WW #{message} # (string) warning messages. +# +# To format specific plugins: +# +# [templates.hangman] +# win = "you win!" diff -r ff11e26d798c -r 73cbd6760978 doc/examples/irccdctl.conf.sample --- a/doc/examples/irccdctl.conf.sample Thu Aug 15 22:38:01 2019 +0200 +++ b/doc/examples/irccdctl.conf.sample Sun Sep 01 17:23:22 2019 +0200 @@ -8,7 +8,6 @@ # [general] # verbose = false # (bool) enable verbose message (Optional, default: false). - [general] # Section connect: @@ -32,3 +31,16 @@ type = "ip" host = "localhost" port = "5980" + +# Section alias: +# This section defines aliases to be used with irccdctl(1). Create a section +# per alias and add any command you need. You may use %n as placeholders for +# arguments to be provided on the command line. +# +# The option name has no meaning and is only there as self documentation. +# +# [alias.cycle] +# leave = ( "server-part", "%0", "%1", "coming back soon" ) +# join = ( "server-join", "%0", "%1" ) +# +# Use this alias with: irccdctl cycle wanadoo "#games" diff -r ff11e26d798c -r 73cbd6760978 irccd-test/CMakeLists.txt --- a/irccd-test/CMakeLists.txt Thu Aug 15 22:38:01 2019 +0200 +++ b/irccd-test/CMakeLists.txt Sun Sep 01 17:23:22 2019 +0200 @@ -27,6 +27,7 @@ irccd_define_executable( TARGET irccd-test + EXPORT LIBRARIES libirccd-test ${LIBRARIES} INCLUDES ${INCLUDES} DESCRIPTION "Plugin tester" diff -r ff11e26d798c -r 73cbd6760978 libirccd/irccd/string_util.cpp --- a/libirccd/irccd/string_util.cpp Thu Aug 15 22:38:01 2019 +0200 +++ b/libirccd/irccd/string_util.cpp Sun Sep 01 17:23:22 2019 +0200 @@ -327,7 +327,7 @@ std::ostringstream oss; for (auto it = text.cbegin(), end = text.cend(); it != end; ) { - auto token = *it; + const auto token = *it; // Is the current character a reserved token or not? if (!is_reserved(token)) { @@ -341,36 +341,22 @@ continue; } - // The token is declaring a template variable, substitute it. - if (*it == '{') { - oss << substitute(++it, end, token, params); - continue; - } + /* + * ## -> # + * #{key} -> value (if key == value) + * ##{key} -> #{key} + * ###{key} -> #value (if key == value) + * @#{key} -> @vlalue (if key == value) + */ - /* - * If the next token is different from the previous one, just let the - * next iteration parse the string because we can have the following - * constructs. - * - * "@#{var}" -> "@value" - */ - if (*it != token) { + if (*it == '{') + oss << substitute(++it, end, token, params); + else { + if (*it == token) + ++it; + oss << token; - continue; } - - /* - * Write the token only if it's not a variable because at this step we - * may have the following constructs. - * - * "##" -> "##" - * "##hello" -> "##hello" - * "##{hello}" -> "#{hello}" - */ - if (++it == end) - oss << token << token; - else if (*it == '{') - oss << token; } return oss.str(); diff -r ff11e26d798c -r 73cbd6760978 man/irccd-templates.7 --- a/man/irccd-templates.7 Thu Aug 15 22:38:01 2019 +0200 +++ b/man/irccd-templates.7 Sun Sep 01 17:23:22 2019 +0200 @@ -189,21 +189,30 @@ Valid constructs: .Bl -tag -width 20n -offset Ds .It #{target}, welcome -if target is set to "irccd", becomes "irccd, welcome". +if target is set to "irccd", becomes +.Dq "irccd, welcome" . .It @{red}#{target} if target is specified, it is written in red. .El .Pp Invalid or literals constructs: .Bl -tag -width 20n -offset Ds -.It #{target} -will output "#{target}". -.It ## -will output "##". +.It ##{target} +will output +.Dq #{target} . +.It abc##xyz +will output +.Dq abc#xyz . .It #target -will output "#target". +will output +.Dq #target . .It #{target will cause an error. +.It @#{message} +will output +.Dq @bar +if message keyword is set to +.Dq bar . .El .Pp Colors & attributes: diff -r ff11e26d798c -r 73cbd6760978 man/irccd.conf.5 --- a/man/irccd.conf.5 Thu Aug 15 22:38:01 2019 +0200 +++ b/man/irccd.conf.5 Sun Sep 01 17:23:22 2019 +0200 @@ -316,7 +316,6 @@ type = ip ipv4 = false ipv6 = true -family = ipv6 port = 12000 # A transport that binds to both IPv4 and IPv6. diff -r ff11e26d798c -r 73cbd6760978 tests/src/libirccd/string-util/main.cpp --- a/tests/src/libirccd/string-util/main.cpp Thu Aug 15 22:38:01 2019 +0200 +++ b/tests/src/libirccd/string-util/main.cpp Sun Sep 01 17:23:22 2019 +0200 @@ -51,7 +51,7 @@ BOOST_TEST(string_util::format("#") == "#"); BOOST_TEST(string_util::format(" # ") == " # "); BOOST_TEST(string_util::format("#@") == "#@"); - BOOST_TEST(string_util::format("##") == "##"); + BOOST_TEST(string_util::format("##") == "#"); BOOST_TEST(string_util::format("#!") == "#!"); BOOST_TEST(string_util::format("##{target}") == "#{target}"); BOOST_TEST(string_util::format("@#{target}", params) == "@hello"); @@ -152,6 +152,17 @@ BOOST_TEST(expected == result); } +BOOST_AUTO_TEST_CASE(fix_2250) +{ + string_util::subst params; + + params.keywords.insert({"target", "irccd"}); + + BOOST_TEST(string_util::format("abc##xyz") == "abc#xyz"); + BOOST_TEST(string_util::format("abc###xyz") == "abc##xyz"); + BOOST_TEST(string_util::format("###{target}", params) == "#irccd"); +} + BOOST_AUTO_TEST_SUITE_END() /*