Subversion Repositories HomeAutomation

Rev

Rev 507 | Rev 511 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 507 Rev 510
Line 154... Line 154...
154
        if ($currentfile) {
154
        if ($currentfile) {
155
            $parsedLine = $line;
155
            $parsedLine = $line;
156
            $parsedLine =~ s/\n//g;
156
            $parsedLine =~ s/\n//g;
157
            $parsedLine =~ s/\r//g;
157
            $parsedLine =~ s/\r//g;
158
            #$parsedLine = $parsedLine;
158
            #$parsedLine = $parsedLine;
-
 
159
 
-
 
160
            $nickLine = $parsedLine;
-
 
161
            if ($nickLine =~ m/.*<(\w{1,9})>.*/) {
-
 
162
                $nick = $1;
-
 
163
                $nickVal = 0;
-
 
164
                for ($i = 0; $i < length($nick); $i++) {
-
 
165
                    $nickVal += ord(substr($nick, $i, 1));
-
 
166
                }
-
 
167
                $nickVal = ($nickVal) % 512;
-
 
168
                $nickB = sprintf("%x", ((($nickVal & 7)**2)*2.3+5));
-
 
169
                $nickG = sprintf("%x", (((($nickVal >> 3) & 7)**2.3)*2+5));
-
 
170
                $nickR = sprintf("%x", (((($nickVal >> 6) & 7)**2.3)*2+5));
-
 
171
                if (length($nickB) == 1) {
-
 
172
                    $nickB = "0".$nickB;
-
 
173
                }
-
 
174
                if (length($nickG) == 1) {
-
 
175
                    $nickG = "0".$nickG;
-
 
176
                }
-
 
177
                if (length($nickR) == 1) {
-
 
178
                    $nickR = "0".$nickR;
-
 
179
                }
-
 
180
               
-
 
181
                #print "$nick $nickR$nickG$nickB\n";
-
 
182
                $color = "#$nickR$nickG$nickB";
-
 
183
                $parsedLine =~ s/<$nick>/<color $color><$nick><\/color>/;
-
 
184
                #print $nick." ".$nickVal."\n";
-
 
185
                #print $parsedLine ."\n";
-
 
186
            }
159
           
187
           
160
            $parsedLine =~ s/\x{e5}/å/g;
188
            $parsedLine =~ s/\x{e5}/å/g;
161
            $parsedLine =~ s/\x{e4}/ä/g;
189
            $parsedLine =~ s/\x{e4}/ä/g;
162
            $parsedLine =~ s/\x{f6}/ö/g;
190
            $parsedLine =~ s/\x{f6}/ö/g;
163
            $parsedLine =~ s/\x{c5}/Å/g;
191
            $parsedLine =~ s/\x{c5}/Å/g;