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