--- deliantra/Deliantra-Client/DC.pm 2006/08/14 01:21:01 1.113 +++ deliantra/Deliantra-Client/DC.pm 2006/09/12 20:51:17 1.119 @@ -15,7 +15,7 @@ package CFPlus; BEGIN { - $VERSION = '0.2'; + $VERSION = '0.51'; use XSLoader; XSLoader::load "CFPlus", $VERSION; @@ -71,7 +71,12 @@ sub put($$$) { my ($db, $key, $data) = @_; - $DB_SYNC{$db} = AnyEvent->timer (after => 5, cb => sub { $db->db_sync }); + my $hkey = $db + 0; + Scalar::Util::weaken $db; + $DB_SYNC{$hkey} ||= AnyEvent->timer (after => 5, cb => sub { + delete $DB_SYNC{$hkey}; + $db->db_sync if $db; + }); $db->db_put ($key => $data) } @@ -285,6 +290,16 @@ }); } ], + ["rename", # first try of an easier use of flint&steel + sub { + &::open_string_query ("Rename item to:", sub { + my ($entry, $txt) = @_; + $::CONN->send ("mark ". pack "N", $self->{tag}); + $::CONN->send ("command rename to <$txt>"); + }, $self->{name}, + "If you input no name or erase the current custom name, the custom name will be unset"); + } + ], ["apply", sub { $::CONN->send ("apply $self->{tag}") }], ( $self->{flags} & F_LOCKED