|
|
@ -43,9 +43,10 @@ sub c_list { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
eval { |
|
|
|
eval { |
|
|
|
if (my $sid = $self->app->sid_by_name($ref->{site})) { |
|
|
|
my $site = $self->app->site_by_name($ref->{site}); |
|
|
|
|
|
|
|
if ($site and ref($site) eq 'HASH') { |
|
|
|
my @cm = (); |
|
|
|
my @cm = (); |
|
|
|
if (my $pid = $self->app->pid_by_hash($sid, $ref->{hash})) { |
|
|
|
if (my $pid = $self->app->pid_by_hash($site->{id}, $ref->{hash})) { |
|
|
|
my @tm = $self->app->comments_by_pid($pid); |
|
|
|
my @tm = $self->app->comments_by_pid($pid); |
|
|
|
# TODO: processing |
|
|
|
# TODO: processing |
|
|
|
@cm = @tm; |
|
|
|
@cm = @tm; |
|
|
@ -86,8 +87,8 @@ sub c_add { |
|
|
|
$self->app->client_reply(400, "empty message"); |
|
|
|
$self->app->client_reply(400, "empty message"); |
|
|
|
last; |
|
|
|
last; |
|
|
|
} |
|
|
|
} |
|
|
|
my $sid = $self->app->sid_by_name($ref->{site}); |
|
|
|
my $site = $self->app->site_by_name($ref->{site}); |
|
|
|
unless ($sid) { |
|
|
|
unless ($site and ref($site) eq 'HASH') { |
|
|
|
$self->app->client_reply(400, "no such site"); |
|
|
|
$self->app->client_reply(400, "no such site"); |
|
|
|
last; |
|
|
|
last; |
|
|
|
} |
|
|
|
} |
|
|
@ -106,10 +107,10 @@ sub c_add { |
|
|
|
last; |
|
|
|
last; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
my $pid = $self->app->pid_by_hash($sid, $ref->{hash}); |
|
|
|
my $pid = $self->app->pid_by_hash($site->{id}, $ref->{hash}); |
|
|
|
unless ($pid) { |
|
|
|
unless ($pid) { |
|
|
|
$self->app->add_page($sid, $ref); |
|
|
|
$self->app->add_page($site->{id}, $ref); |
|
|
|
$pid = $self->app->pid_by_hash($sid, $ref->{hash}); |
|
|
|
$pid = $self->app->pid_by_hash($site->{id}, $ref->{hash}); |
|
|
|
} |
|
|
|
} |
|
|
|
$self->add_comment($pid, \%msg); |
|
|
|
$self->add_comment($pid, \%msg); |
|
|
|
}} while (0); 1; |
|
|
|
}} while (0); 1; |
|
|
|