1
0
Fork 0
mirror of https://github.com/perlbot/perlbuut synced 2025-06-08 03:45:41 -04:00

Merge branch 'master' of gitosis@isuckatdomains.net:perlbuut

This commit is contained in:
Ryan Voots 2010-01-04 22:20:19 -05:00
commit 13619a695d

View file

@ -147,7 +147,7 @@ sub store_factoid {
my( $self, $said) =@_; my( $self, $said) =@_;
my ($author, $body ) = ($said->{name}, $said->{body}); my ($author, $body ) = ($said->{name}, $said->{body});
return unless $body =~ /^(?:\S+[:,])?\s*(.+?)\s+($COPULA_RE)\s+(.+)$/s; return unless $body =~ /^\s*(.+?)\s+($COPULA_RE)\s+(.+)$/s;
my( $subject, $copula, $predicate ) = ($1,$2,$3); my( $subject, $copula, $predicate ) = ($1,$2,$3);
my $compose_macro = 0; my $compose_macro = 0;
@ -345,6 +345,9 @@ sub get_fact_learn {
sub get_fact_search { sub get_fact_search {
my( $self, $body, $name ) = @_; my( $self, $body, $name ) = @_;
$body =~ s/^\s*for\s*//; #remove the for from searches
#XXX: need to also search contents of factoids TODO
my $results = $self->dbh->selectall_arrayref( my $results = $self->dbh->selectall_arrayref(
"SELECT subject,copula,predicate "SELECT subject,copula,predicate
FROM factoid FROM factoid
@ -357,6 +360,7 @@ sub get_fact_search {
if( $results and @$results ) { if( $results and @$results ) {
my $ret_string; my $ret_string;
for( @$results ) { for( @$results ) {
#i want a better string here, i'll probably go with just the subject, XXX TODO
$ret_string .= "[" . _fact_literal_format($_) . "] "; $ret_string .= "[" . _fact_literal_format($_) . "] ";
} }
@ -433,7 +437,6 @@ sub _db_get_fact {
return $fact; return $fact;
} }
sub basic_get_fact { sub basic_get_fact {
my( $self, $pm, $said, $subject, $name, $call_only ) = @_; my( $self, $pm, $said, $subject, $name, $call_only ) = @_;