[patch-team] - This adds support for channels in znc configuration - Signed-off-by...
authorScott V. Kamp <outbackdingo@gmail.com>
Thu, 2 Dec 2010 22:31:38 +0000 (22:31 +0000)
committerScott V. Kamp <outbackdingo@gmail.com>
Thu, 2 Dec 2010 22:31:38 +0000 (22:31 +0000)
SVN-Revision: 24218

net/znc/files/znc.conf
net/znc/files/znc.init

index ba3f069..ea7f460 100644 (file)
@@ -8,6 +8,8 @@ config user 'sampleUser'
        option altnick  'userSample'
        option ident    'openwrt'
        option realname 'John Doe'
+       # This adds support for channels in znc configuration:
+       # list channel    '#chan optional_password'
 
        # list of allowed servers
        list server     'chat.freenode.net 6667'
index 9231f9a..38d0051 100644 (file)
@@ -10,6 +10,14 @@ add_param() {
        echo "$1 = $2" >> $ZNC_CONFIG
 }
 
+add_chan() {
+       chan=${2% *}
+       pass=${1#* }
+       echo "  <Chan $chan>" >> $ZNC_CONFIG
+       [ "$chan" != "$pass" ] && echo "                Key = $pass" >> $ZNC_CONFIG
+       echo "  </Chan>" >> $ZNC_CONFIG
+}
+
 znc_global() {
        local znc="$1"
        local anoniplimit
@@ -72,6 +80,7 @@ add_user() {
 
        config_list_foreach "$user" server "add_param \"        Server\""
        config_list_foreach "$user" module "add_param \"        LoadModule\""
+       config_list_foreach "$user" channel "add_chan"
        echo "</User>" >> $ZNC_CONFIG
 }