summaryrefslogtreecommitdiffstats
path: root/konversation/src/konversation-0.19-notifylists.pl
blob: 42bfe9da2be41e3c12ffc2ec28902bd8eb03498f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /usr/bin/perl

use strict;

my($out);
my($group);
my($gotgroup);
my(%group2groupno);
my(%key2value);
my(@split);
my(%saw);

while (<>)
{
    if ($_ =~ /^\[ServerGroup ([0-9]+)\]/)
    { 
        $group = $1;
        $gotgroup = 1;
    }
    elsif ($_ =~ /^Name=(.+)/ && $gotgroup)
    {  
        $group2groupno{$group} = $1;
        $gotgroup = 0;
    }
    elsif ($_ =~ /^(.+)=(.+)/)
    {  
        $key2value{$1} = $2;
    }
}

foreach $out (keys %group2groupno)
{
    @split = split(" ",$key2value{$group2groupno{$out}});

    if (@split)
    {
        undef %saw;
        @saw{@split} = ();
        @split = keys %saw;

        print "[ServerGroup $out]\nNotifyList=@split\n"; 
    }
}