Simple image host.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

hiii 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/usr/bin/perl
  2. use v5.10;
  3. use strict;
  4. use warnings;
  5. my %config = (
  6. # You can specify multiple nicknames like, 'berk|bozbalci'. All will be highlighted.
  7. 'nick' => 'mort',
  8. 'color_nicks' => 'yellow',
  9. 'color_own_nick' => 'light_red',
  10. 'color_url' => 'light_blue',
  11. 'color_actions' => 'magenta',
  12. 'color_server' => 'black',
  13. 'color_time' => 'light_green'
  14. );
  15. my %color = (
  16. 'black' => "",
  17. 'red' => "",
  18. 'green' => "",
  19. 'yellow' => "",
  20. 'blue' => "",
  21. 'magenta' => "",
  22. 'cyan' => "",
  23. 'white' => "",
  24. 'light_black' => "",
  25. 'light_red' => "",
  26. 'light_green' => "",
  27. 'light_yellow' => "",
  28. 'light_blue' => "",
  29. 'light_magenta' => "",
  30. 'light_cyan' => "",
  31. 'light_white' => "",
  32. 'reset' => ""
  33. );
  34. my $date = "[0-9]{4}-[0-9]{2}-[0-9]{2}";
  35. my $time = "([0-9]{2}:[0-9]{2})";
  36. my $url = "(((https?|ftp)|mailto):(//)?[^ <>\"[:blank:]]*|(www|ftp)[0-9]?\.[-a-z0-9.]+)";
  37. my $nick = "<(.*?)>";
  38. my $action = "ACTION (.*)?";
  39. my $useless = "^-!- (.*)";
  40. while (<>) {
  41. # Remove the huge date from the line's beginning
  42. s/^$date //;
  43. # Highlight time
  44. s/$time /$color{$config{'color_time'}} $1 $color{'reset'}/;
  45. # Highlight nicknames, remove <> around them
  46. s/$nick/$color{$config{'color_nicks'}}$1$color{'reset'} /;
  47. # Highlight me
  48. s/($config{'nick'})/$color{$config{'color_own_nick'}}$1$color{'reset'}/;
  49. # Highlight URLs
  50. s/$url/$color{$config{'color_url'}}$1$color{'reset'}/;
  51. # Highlight /me actions
  52. s/$action/$color{$config{'color_actions'}}* $1 *$color{'reset'}/;
  53. # Highlight "has joined", "changed mode", etc.
  54. s/^$useless/$color{$config{'color_server'}}$1$color{'reset'}/;
  55. # The ^C[color] color sequences:
  56. s/\cC0(.*)(\cC)?/$color{'white'}$1$color{'reset'}/;
  57. s/\cC1(.*)(\cC)?/$color{'black'}$1$color{'reset'}/;
  58. s/\cC2(.*)(\cC)?/$color{'blue'}$1$color{'reset'}/;
  59. s/\cC3(.*)(\cC)?/$color{'green'}$1$color{'reset'}/;
  60. s/\cC4(.*)(\cC)?/$color{'light_red'}$1$color{'reset'}/;
  61. s/\cC5(.*)(\cC)?/$color{'red'}$1$color{'reset'}/;
  62. s/\cC6(.*)(\cC)?/$color{'magenta'}$1$color{'reset'}/;
  63. s/\cC7(.*)(\cC)?/$color{'light_yellow'}$1$color{'reset'}/;
  64. s/\cC8(.*)(\cC)?/$color{'yellow'}$1$color{'reset'}/;
  65. s/\cC9(.*)(\cC)?/$color{'light_green'}$1$color{'reset'}/;
  66. s/\cC10(.*)(\cC)?/$color{'cyan'}$1$color{'reset'}/;
  67. s/\cC11(.*)(\cC)?/$color{'light_cyan'}$1$color{'reset'}/;
  68. s/\cC12(.*)(\cC)?/$color{'light_blue'}$1$color{'reset'}/;
  69. s/\cC13(.*)(\cC)?/$color{'light_magenta'}$1$color{'reset'}/;
  70. s/\cC14(.*)(\cC)?/$color{'black'}$1$color{'reset'}/;
  71. s/\cC15(.*)(\cC)?/$color{'light_black'}$1$color{'reset'}/;
  72. print;
  73. }