--- trunk/Estraier.pm 2006/05/15 22:11:22 149 +++ trunk/Estraier.pm 2006/05/16 11:39:53 151 @@ -1053,7 +1053,7 @@ $node->put_doc( $document_draft ) or die "can't add document"; -Return true on success or false on failture. +Return true on success or false on failure. =cut @@ -1061,11 +1061,15 @@ my $self = shift; my $doc = shift || return; return unless ($self->{url} && $doc->isa('Search::Estraier::Document')); - $self->shuttle_url( $self->{url} . '/put_doc', + if ($self->shuttle_url( $self->{url} . '/put_doc', 'text/x-estraier-draft', $doc->dump_draft, undef - ) == 200; + ) == 200) { + $self->_clear_info; + return 1; + } + return undef; } @@ -1084,11 +1088,15 @@ my $id = shift || return; return unless ($self->{url}); croak "id must be number, not '$id'" unless ($id =~ m/^\d+$/); - $self->shuttle_url( $self->{url} . '/out_doc', + if ($self->shuttle_url( $self->{url} . '/out_doc', 'application/x-www-form-urlencoded', "id=$id", undef - ) == 200; + ) == 200) { + $self->_clear_info; + return 1; + } + return undef; } @@ -1106,11 +1114,15 @@ my $self = shift; my $uri = shift || return; return unless ($self->{url}); - $self->shuttle_url( $self->{url} . '/out_doc', + if ($self->shuttle_url( $self->{url} . '/out_doc', 'application/x-www-form-urlencoded', "uri=" . uri_escape($uri), undef - ) == 200; + ) == 200) { + $self->_clear_info; + return 1; + } + return undef; } @@ -1128,11 +1140,15 @@ my $self = shift; my $doc = shift || return; return unless ($self->{url} && $doc->isa('Search::Estraier::Document')); - $self->shuttle_url( $self->{url} . '/edit_doc', + if ($self->shuttle_url( $self->{url} . '/edit_doc', 'text/x-estraier-draft', $doc->dump_draft, undef - ) == 200; + ) == 200) { + $self->_clear_info; + return 1; + } + return undef; } @@ -1679,9 +1695,10 @@ undef ) == 200) { # refresh node info after adding link - $self->_set_info; + $self->_clear_info; return 1; } + return undef; } =head2 admins @@ -1830,7 +1847,7 @@ if ($status == $rest->{status}) { # refresh node info after sync - $self->_set_info if ($action eq 'sync'); + $self->_clear_info if ($action eq 'sync' || $action =~ m/^node(?:add|del|clr)$/); if ($rest->{returns} && wantarray) { @@ -1889,7 +1906,7 @@ my @lines = split(/[\r\n]/,$resbody); - $self->{inform} = {}; + $self->_clear_info; ( $self->{inform}->{name}, $self->{inform}->{label}, $self->{inform}->{dnum}, $self->{inform}->{wnum}, $self->{inform}->{size} ) = split(/\t/, shift @lines, 5); @@ -1914,6 +1931,25 @@ } +=head2 _clear_info + +Clear information for node + + $node->_clear_info; + +On next call to C, C