submitter VARCHAR(32) NOT NULL,
submitter_type INTEGER NOT NULL default 1,
fb_post_id BIGINT UNSIGNED UNIQUE NOT NULL,
- uri VARCHAR(512) NOT NULL,
+ uri VARCHAR(1024) NOT NULL,
prefix VARCHAR(512) NOT NULL,
- suffix VARCHAR(512) NOT NULL,
- scheme VARCHAR(512) NOT NULL,
- path VARCHAR(512) NOT NULL,
+ comment VARCHAR(1024) NOT NULL,
+ scheme VARCHAR(1024) NOT NULL,
+ path VARCHAR(1024) NOT NULL,
post_time BIGINT UNSIGNED NOT NULL
) ENGINE = innodb DEFAULT CHARSET utf8;
my ($me, $db_args) = @_;
my ($scheme, $path) = split(/:\/\//, $db_args->{uri});
- my $sth = $me->{dbh}->prepare("insert into posts (submitter, fb_post_id, uri, prefix, suffix, scheme, path, post_time) values (?, ?, ?, ?, ?, ?, ?, ?)");
+ my $sth = $me->{dbh}->prepare("insert into posts (submitter, fb_post_id, uri, prefix, comment, scheme, path, post_time) values (?, ?, ?, ?, ?, ?, ?, ?)");
$sth->bind_param(1, $db_args->{submitter}, SQL_VARCHAR);
$sth->bind_param(2, $db_args->{fb_post_id}, SQL_BIGINT);
$sth->bind_param(3, $db_args->{uri}, SQL_VARCHAR);
$sth->bind_param(4, $db_args->{prefix}, SQL_VARCHAR);
- $sth->bind_param(5, $db_args->{suffix}, SQL_VARCHAR);
+ $sth->bind_param(5, $db_args->{comment}, SQL_VARCHAR);
$sth->bind_param(6, $scheme, SQL_VARCHAR);
$sth->bind_param(7, $path, SQL_VARCHAR);
$sth->bind_param(8, time, SQL_BIGINT);
my $column = $word =~ /:\/\// ? 'uri' : 'path';
my $w = '%' . $word . '%';
- my $sth = $me->{dbh}->prepare('select * from posts where prefix like ? or '.$column.' like ? or suffix like ? order by post_time desc limit 1000');
+ my $sth = $me->{dbh}->prepare('select * from posts where prefix like ? or '.$column.' like ? or comment like ? order by post_time desc limit 1000');
$sth->bind_param(1, $w, SQL_VARCHAR);
$sth->bind_param(2, $w, SQL_VARCHAR);
$sth->bind_param(3, $w, SQL_VARCHAR);
sub _format_submit {
my ($me, $e) = @_;
- return $e->{submitter}.'が『'.$e->{prefix}.' '.$e->{uri}.' '.$e->{suffix}.'』と'.strftime('%Y-%m-%d %H:%M:%S', localtime($e->{post_time}));
+ return $e->{submitter}.'が『'.$e->{prefix}.' '.$e->{uri}.' '.$e->{comment}.'』と'.strftime('%Y-%m-%d %H:%M:%S', localtime($e->{post_time}));
}
sub _response {
if ($args->{body} =~ /$mu_re/) {
my $prefix = $1;
my $uri = $2;
- my $suffix = $3;
- my $text = $args->{who} . '曰く、'.$prefix.' '.$suffix;
+ my $comment = $3;
+ my $text = $args->{who} . '曰く、'.$prefix.' '.$comment;
return 0 if ($me->_check_dup($args, $uri));
fb_post_id => $post_id,
uri => $uri,
prefix => $prefix,
- suffix => $suffix});
+ comment => $comment});
$resp_msg = $args->{who} . ': うい '.$me->_fb_post_uri($post_id).' で登録';
} else {
$resp_msg = 'can not post to facebook';