App-Alice
view release on metacpan or search on metacpan
lib/App/Alice.pod view on Meta::CPAN
by hand. You can find this file at ~/.alice/config.
The config is simply a perl hash. So, if you are familiar with perl it
should not be too intimidating. If you do not know perl, sorry! :)
You will need to add "user" and "pass" values to the "auth" hash.
The resulting section of configuration might look like this:
'auth' => {
'user' => 'lee',
'pass' => 'mypassword',
},
=head1 COMMANDS
=over 4
=item /j[oin] [-network] $channel
Takes a channel name as an argument, and an optional network flag.
If no network flag is provided, it will use the network of the
lib/App/Alice/HTTPD.pm view on Meta::CPAN
}
sub login {
my ($self, $req) = @_;
my $res = $req->new_response;
if (!$self->app->auth_enabled or $self->is_logged_in($req)) {
$res->redirect("/");
return $res->finalize;
}
elsif (my $user = $req->param("username")
and my $pass = $req->param("password")) {
if ($self->app->authenticate($user, $pass)) {
$req->env->{"psgix.session"}->{is_logged_in} = 1;
$res->redirect("/");
return $res->finalize;
}
$res->body($self->app->render("login", "bad username or password"));
}
else {
$res->body($self->app->render("login"));
}
$res->status(200);
return $res->finalize;
}
sub logout {
my ($self, $req) = @_;
lib/App/Alice/IRC.pm view on Meta::CPAN
return;
}
$self->log(info => "connected");
$self->reset_reconnect_count;
$self->connect_time(time);
$self->is_connected(1);
$self->cl->register(
$self->nick, $self->config->{username},
$self->config->{ircname}, $self->config->{password}
);
$self->broadcast({
type => "action",
event => "connect",
session => $self->alias,
windows => [map {$_->serialized} $self->windows],
});
}
share/commands.pl view on Meta::CPAN
eg => "/NAMES [-avatars]",
desc => "Lists nicks in current channel. Pass the -avatars option to display avatars with the nicks.",
code => sub {
my ($self, $window, $avatars) = @_;
$self->reply($window, $window->nick_table($avatars));
},
},
{
name => 'join',
re => qr{^/j(?:oin)?\s+$SRVOPT(.+)},
eg => "/JOIN [-<server name>] <channel> [<password>]",
desc => "Joins the specified channel.",
code => sub {
my ($self, $window, $channel, $network) = @_;
my $irc;
if ($network and $self->app->has_irc($network)) {
$irc = $self->app->get_irc($network);
} else {
$irc = $window->irc;
}
my @params = split /\s+/, $channel;
share/static/alice.js view on Meta::CPAN
},
radio: function(elem){
return "radio" === elem.type;
},
checkbox: function(elem){
return "checkbox" === elem.type;
},
file: function(elem){
return "file" === elem.type;
},
password: function(elem){
return "password" === elem.type;
},
submit: function(elem){
return "submit" === elem.type;
},
image: function(elem){
return "image" === elem.type;
},
reset: function(elem){
return "reset" === elem.type;
},
share/templates/login.html view on Meta::CPAN
<link rel="apple-touch-startup-image" href="<?= $app->static_url("image/alice.png") ?>" />
<meta name="viewport" content="width=device-width; initial-scale=1; maximum-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
</head>
<body>
<form action="/login" method="post">
<label for="username">User Name:</label>
<input type="text" name="username" value="" id="username" />
<label for="password">Password:</label>
<input type="password" name="password" value="" id="password" />
<input type="submit" value="Log in" />
<? if ($error) { ?>
<span class="error"><?= $error ?></span>
<? } ?>
</form>
</body>
</html>
share/templates/new_server.html view on Meta::CPAN
<div class="field">
<label>Ircname</label>
<input type="text" name="<?= $alias ?>_ircname" value="" size="15" />
</div>
<div class="field clear">
<label>Username</label>
<input type="text" name="<?= $alias ?>_username" value="" size="15" />
</div>
<div class="field">
<label>Password</label>
<input type="text" name="<?= $alias ?>_password" value="" size="15" />
</div>
<div class="field clear">
<label>Channels
<span style="font-size:0.8em">(e.g. <span style="font-family:monospace;font-size:1em">#alice</span>)</span>
</label>
<select name="<?= $alias ?>_channels" multiple="multiple" id="channels_<?= $alias ?>" class="channelselect">
</select>
<div class="controls">
<a href="#" onclick="return addChannel('<?= $alias ?>')">New</a>
<a href="#" onclick="return removeChannels('<?= $alias ?>')">Remove</a>
share/templates/servers.html view on Meta::CPAN
<input type="text" name="<?= $alias ?>_ircname" value="<?= $connection->config->{ircname} || ""?>" size="15" />
</div>
<div class="field clear">
<label>Username</label>
<input type="text" name="<?= $alias ?>_username" value="<?= $connection->config->{username} || ""?>" size="15" />
</div>
<div class="field">
<label>Password</label>
<input type="text" name="<?= $alias ?>_password" value="<?= $connection->config->{password} || ""?>" size="15" />
</div>
<div class="field clear">
<label>Channels
<span style="font-size:0.8em">(e.g. <span style="font-family:monospace;font-size:1em">#alice</span>)</span>
</label>
<select name="<?= $alias ?>_channels" multiple="multiple" id="channels_<?= $alias ?>" class="channelselect">
<? for my $channel (@{$connection->config->{channels}}) { ?>
<option value="<?= $channel ?>"><?= $channel ?></option>
<? } ?>
( run in 0.894 second using v1.01-cache-2.11-cpan-49f99fa48dc )