/[suikacvs]/messaging/manakai/lib/Message/DOM/Node.pm
Suika

Diff of /messaging/manakai/lib/Message/DOM/Node.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by wakaba, Wed Jun 20 13:41:16 2007 UTC revision 1.9 by wakaba, Sat Jul 7 07:36:58 2007 UTC
# Line 926  sub manakai_set_read_only ($;$$) { Line 926  sub manakai_set_read_only ($;$$) {
926    }    }
927  } # manakai_set_read_only  } # manakai_set_read_only
928    
929    sub set_user_data ($$$;$) {
930      my ($self, $key, $data, $handler) = @_;
931    
932      my $v = ($$self->{user_data} ||= {});
933      my $r = $v->{$key}->[0];
934    
935      if (defined $data) {
936        $v->{$key} = [$data, $handler];
937    
938        if (defined $handler) {
939          $$self->{manakai_onunload} = sub {
940            my $node = $_[0];
941            my $uds = $$node->{user_data};
942            for my $key (keys %$uds) {
943              if (defined $uds->{$key}->[1]) {
944                $uds->{$key}->[1]->(3, $key, $uds->{$key}->[0]); # NODE_DELETED
945              }
946            }
947          };
948        }
949      } else {
950        delete $v->{$key};
951      }
952      return $r;
953    } # set_user_data
954    
955  package Message::IF::Node;  package Message::IF::Node;
956    
957  =head1 LICENSE  =head1 LICENSE

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24