Nodename
This commit is contained in:
parent
bdf7d23138
commit
9795535fe4
@ -22,12 +22,14 @@ sub load {
|
|||||||
my $nick = $config->{auth}->{nick};
|
my $nick = $config->{auth}->{nick};
|
||||||
my $host = $config->{node}->{host};
|
my $host = $config->{node}->{host};
|
||||||
my @echoareas = split /,/, $config->{node}->{echoareas};
|
my @echoareas = split /,/, $config->{node}->{echoareas};
|
||||||
|
my $name = $config->{node}->{name};
|
||||||
|
|
||||||
$c = {
|
$c = {
|
||||||
nick => $nick,
|
nick => $nick,
|
||||||
key => $key,
|
key => $key,
|
||||||
host => $host,
|
host => $host,
|
||||||
echoareas => [@echoareas],
|
echoareas => [@echoareas],
|
||||||
|
name => $name,
|
||||||
};
|
};
|
||||||
|
|
||||||
return $c;
|
return $c;
|
||||||
|
29
II/Render.pm
29
II/Render.pm
@ -10,10 +10,13 @@ sub new {
|
|||||||
|
|
||||||
my $db = II::DB->new();
|
my $db = II::DB->new();
|
||||||
my $t = II::T->new();
|
my $t = II::T->new();
|
||||||
|
my $c = II::Config->new();
|
||||||
|
my $config = $c->load();
|
||||||
|
|
||||||
my $self = {
|
my $self = {
|
||||||
_db => $db,
|
_db => $db,
|
||||||
_template => $t,
|
_template => $t,
|
||||||
|
_config => $config,
|
||||||
};
|
};
|
||||||
|
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
@ -24,11 +27,12 @@ sub thread {
|
|||||||
my ( $self, $subg, $echo ) = @_;
|
my ( $self, $subg, $echo ) = @_;
|
||||||
my $db = $self->{_db};
|
my $db = $self->{_db};
|
||||||
my $t = $self->{_template};
|
my $t = $self->{_template};
|
||||||
|
my $config = $self->{_config};
|
||||||
|
|
||||||
my @post = $db->thread( $subg, $echo );
|
my @post = $db->thread( $subg, $echo );
|
||||||
|
|
||||||
# Render header
|
# Render header
|
||||||
my $render = $t->head("ii :: $echo");
|
my $render = $t->head("ii ". $config->{name} ." :: $echo");
|
||||||
my $count = 0;
|
my $count = 0;
|
||||||
while ( $count < @post ) {
|
while ( $count < @post ) {
|
||||||
$render .= $t->post( @post[$count] );
|
$render .= $t->post( @post[$count] );
|
||||||
@ -44,12 +48,13 @@ sub out {
|
|||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
my $db = $self->{_db};
|
my $db = $self->{_db};
|
||||||
my $t = $self->{_template};
|
my $t = $self->{_template};
|
||||||
|
my $config = $self->{_config};
|
||||||
|
|
||||||
my @post = $db->select_out();
|
my @post = $db->select_out();
|
||||||
|
|
||||||
# Render header
|
# Render header
|
||||||
my $render
|
my $render
|
||||||
= $t->head('ii :: неотправленные сообщения');
|
= $t->head('ii '. $config->{name} .' :: неотправленные сообщения');
|
||||||
|
|
||||||
my $count = 0;
|
my $count = 0;
|
||||||
while ( $count < @post ) {
|
while ( $count < @post ) {
|
||||||
@ -66,11 +71,12 @@ sub echo_mes {
|
|||||||
my ( $self, $echo, $view ) = @_;
|
my ( $self, $echo, $view ) = @_;
|
||||||
my $db = $self->{_db};
|
my $db = $self->{_db};
|
||||||
my $t = $self->{_template};
|
my $t = $self->{_template};
|
||||||
|
my $config = $self->{_config};
|
||||||
|
|
||||||
my @post = $db->echoes($echo);
|
my @post = $db->echoes($echo);
|
||||||
|
|
||||||
# Render header
|
# Render header
|
||||||
my $render = $t->head("ii :: $echo");
|
my $render = $t->head("ii ". $config->{name} ." :: $echo");
|
||||||
$render .= $t->echo($echo);
|
$render .= $t->echo($echo);
|
||||||
|
|
||||||
my $count = 0;
|
my $count = 0;
|
||||||
@ -101,12 +107,13 @@ sub to_me {
|
|||||||
my ( $self, $config ) = @_;
|
my ( $self, $config ) = @_;
|
||||||
my $db = $self->{_db};
|
my $db = $self->{_db};
|
||||||
my $t = $self->{_template};
|
my $t = $self->{_template};
|
||||||
|
my $config = $self->{_config};
|
||||||
|
|
||||||
my @post = $db->to_me($config);
|
my @post = $db->to_me($config);
|
||||||
my @post_from_me = $db->from_me($config);
|
my @post_from_me = $db->from_me($config);
|
||||||
|
|
||||||
# Render header
|
# Render header
|
||||||
my $render = $t->head('ii :: Моя переписка');
|
my $render = $t->head('ii '. $config->{name} .' :: Моя переписка');
|
||||||
|
|
||||||
my $count = 0;
|
my $count = 0;
|
||||||
while ( $count < @post ) {
|
while ( $count < @post ) {
|
||||||
@ -136,7 +143,7 @@ sub index {
|
|||||||
my @hashes = $db->select_index(50);
|
my @hashes = $db->select_index(50);
|
||||||
|
|
||||||
# Render header
|
# Render header
|
||||||
my $render = $t->head('ii :: Лента');
|
my $render = $t->head('ii '. $config->{name} .' :: Лента');
|
||||||
$render .= $t->index($echoareas);
|
$render .= $t->index($echoareas);
|
||||||
|
|
||||||
while (<@hashes>) {
|
while (<@hashes>) {
|
||||||
@ -156,10 +163,11 @@ sub user {
|
|||||||
my ( $self, $user ) = @_;
|
my ( $self, $user ) = @_;
|
||||||
my $db = $self->{_db};
|
my $db = $self->{_db};
|
||||||
my $t = $self->{_template};
|
my $t = $self->{_template};
|
||||||
|
my $config = $self->{_config};
|
||||||
|
|
||||||
# Render header
|
# Render header
|
||||||
my $render
|
my $render
|
||||||
= $t->head("ii :: Сообщения пользователя $user");
|
= $t->head("ii ". $config->{name} ." :: Сообщения пользователя $user");
|
||||||
|
|
||||||
my @post = $db->select_user($user);
|
my @post = $db->select_user($user);
|
||||||
|
|
||||||
@ -178,8 +186,9 @@ sub user {
|
|||||||
sub send_new {
|
sub send_new {
|
||||||
my ( $self, $echo ) = @_;
|
my ( $self, $echo ) = @_;
|
||||||
my $t = $self->{_template};
|
my $t = $self->{_template};
|
||||||
|
my $config = $self->{_config};
|
||||||
|
|
||||||
my $render = $t->head("ii :: Новое сообщение");
|
my $render = $t->head("ii ". $config->{name} ." :: Новое сообщение");
|
||||||
|
|
||||||
$render .= $t->new_mes($echo);
|
$render .= $t->new_mes($echo);
|
||||||
$render .= $t->foot();
|
$render .= $t->foot();
|
||||||
@ -192,8 +201,9 @@ sub send {
|
|||||||
my ( $self, $hash ) = @_;
|
my ( $self, $hash ) = @_;
|
||||||
my $db = $self->{_db};
|
my $db = $self->{_db};
|
||||||
my $t = $self->{_template};
|
my $t = $self->{_template};
|
||||||
|
my $config = $self->{_config};
|
||||||
|
|
||||||
my $render = $t->head("ii :: Ответ на $hash");
|
my $render = $t->head("ii". $config->{name} ." :: Ответ на $hash");
|
||||||
|
|
||||||
# Render post
|
# Render post
|
||||||
my $data = $db->select_new($hash);
|
my $data = $db->select_new($hash);
|
||||||
@ -209,8 +219,9 @@ sub new_mes {
|
|||||||
my ( $self, $msgs ) = @_;
|
my ( $self, $msgs ) = @_;
|
||||||
my $db = $self->{_db};
|
my $db = $self->{_db};
|
||||||
my $t = $self->{_template};
|
my $t = $self->{_template};
|
||||||
|
my $config = $self->{_config};
|
||||||
|
|
||||||
my $render = $t->head('ii :: Новые сообщения');
|
my $render = $t->head('ii '. $config->{name} .' :: Новые сообщения');
|
||||||
|
|
||||||
# Render posts
|
# Render posts
|
||||||
if ( defined($msgs) ) {
|
if ( defined($msgs) ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user