johnbellone / znc-cookbook

Application cookbook for installing and configuring the ZNC IRC bouncer.
Other
6 stars 11 forks source link

user channel options not rendered out #3

Open metaxis opened 11 years ago

metaxis commented 11 years ago

The znc.conf.erb template needs just a little bit more to permit an optional channel options hash to be wired in. In the sample user below, if the second "channels" form is used only the channel names rendered out and the options are ignored.

{
    "id": "fred",
    "groups": "znc",
    "znc": {
        "nick": "fredique",
        "pass": "see_below"
        "alt_nick": fredique-z",
        "real_name": "Steve Urbane",
        "ident": "Wanda",
        "server": "something-like-irc.freenode.net",
        "channels": ["#chef", "#chef-hacking"],
          // or
        "channels": {
            "#chef": { "Buffer": 500, "KeepBuffer": true },
            "#chef-hacking": {}
        },
        "modules": ["nickserv"]
    }
}

This change supports both arrays and option hash forms:

<% u['znc']['channels'].each do |chan,options| -%>

    <Chan <%= chan %>>
    <% options.each do |opt, val| -%>
      <%= opt %> = <%= val %>
    <% end -%>
    </Chan>
<% end -%>