App-Ikachan

 view release on metacpan or  search on metacpan

bin/ikachan  view on Meta::CPAN

            my $res = Plack::Response->new(200);
            $res->content_type('text/html; charset=utf-8');
            $res->content_length(length $html);
            $res->body($html);
            return $res->finalize;
        }
    } elsif ($method eq 'POST') {
        my $channel = $req->param('channel');

        if ($path eq '/join') {
            return rendar(403, "joinned channel: $channel") if $join_channels->{$channel};
            my $channel_keyword = $req->param('channel_keyword');
            join_channel($channel, $channel_keyword);
            return rendar(200, "join success channel: $channel");
        } elsif ($path eq '/leave' || $path eq '/part') {
            return rendar(404, "not joinned channel: $channel") unless $join_channels->{$channel};
            $irc->leave_channel($channel);
            delete $join_channels->{$channel};
            return rendar(200, "leave success channel: $channel");
        } elsif ($path eq '/notice') {
            if ($no_post_with_join) {
                return rendar(404, "not joinned channel: $channel") unless $join_channels->{$channel};
            } elsif (not $join_channels->{$channel}) {
                join_channel($channel);
            }
            my $message = $req->param('message');
            $irc->send_message( $message, channel => $channel );
            return rendar(200, "message sent channel: $channel $message");
        } elsif ($path eq '/privmsg') {
            if ($no_post_with_join) {
                return rendar(404, "not joinned channel: $channel") unless $join_channels->{$channel};
            } elsif (not $join_channels->{$channel}) {
                join_channel($channel);
            }
            my $message = $req->param('message');
            $irc->send_message( $message, channel => $channel, privmsg => 1 );
            return rendar(200, "message sent channel: $channel $message");
        }
    }

    return rendar(404, 'not found');
};
my $app = builder {
    if ( @reverse_proxy ) {
        enable match_if addr(\@reverse_proxy), 'Plack::Middleware::ReverseProxy';
    }
    enable 'Plack::Middleware::AccessLog', format => 'combined';
    $code;
};

warn "starting httpd: http://$http_host:$http_port/";
my $twiggy = Twiggy::Server->new(
    host => $http_host,
    port => $http_port,
);
$twiggy->register_service($app);

AnySan->run;

sub get_logo {
    'iVBORw0KGgoAAAANSUhEUgAAAKAAAAB8CAYAAADuM7t5AAAEJGlDQ1BJQ0MgUHJvZmlsZQAAOBGFVd9v21QUPolvUqQWPyBYR4eKxa9VU1u5GxqtxgZJk6XtShal6dgqJOQ6N4mpGwfb6baqT3uBNwb8AUDZAw9IPCENBmJ72fbAtElThyqqSUh76MQPISbtBVXhu3ZiJ1PEXPX6yznfOec7517bRD1fabWaGVWIlquunc8klZOnF...
}

sub get_css {
    <<'...'
/*!
 * Bootstrap v2.3.1
 *
 * Copyright 2012 Twitter, Inc
 * Licensed under the Apache License v2.0
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Designed and built with all the love in the world @twitter by @mdo and @fat.
 */

.clearfix {
  *zoom: 1;
}

.clearfix:before,
.clearfix:after {
  display: table;
  line-height: 0;
  content: "";
}

.clearfix:after {
  clear: both;
}

.hide-text {
  font: 0/0 a;
  color: transparent;
  text-shadow: none;
  background-color: transparent;
  border: 0;
}

.input-block-level {
  display: block;
  width: 100%;
  min-height: 30px;
  -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
          box-sizing: border-box;
}

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section {
  display: block;
}

audio,



( run in 0.929 second using v1.01-cache-2.11-cpan-5b529ec07f3 )