ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC.pm (file contents):
Revision 1.114 by elmex, Mon Aug 14 04:34:40 2006 UTC vs.
Revision 1.118 by root, Tue Sep 12 20:48:17 2006 UTC

13=cut 13=cut
14 14
15package CFPlus; 15package CFPlus;
16 16
17BEGIN { 17BEGIN {
18 $VERSION = '0.2'; 18 $VERSION = '0.5';
19 19
20 use XSLoader; 20 use XSLoader;
21 XSLoader::load "CFPlus", $VERSION; 21 XSLoader::load "CFPlus", $VERSION;
22} 22}
23 23
69my %DB_SYNC; 69my %DB_SYNC;
70 70
71sub put($$$) { 71sub put($$$) {
72 my ($db, $key, $data) = @_; 72 my ($db, $key, $data) = @_;
73 73
74 my $hkey = $db + 0;
75 Scalar::Util::weaken $db;
74 $DB_SYNC{$db} = AnyEvent->timer (after => 5, cb => sub { $db->db_sync }); 76 $DB_SYNC{$hkey} ||= AnyEvent->timer (after => 5, cb => sub {
77 delete $DB_SYNC{$hkey};
78 $db->db_sync if $db;
79 });
75 80
76 $db->db_put ($key => $data) 81 $db->db_put ($key => $data)
77} 82}
78 83
79package CFPlus; 84package CFPlus;
289 sub { 294 sub {
290 &::open_string_query ("Rename item to:", sub { 295 &::open_string_query ("Rename item to:", sub {
291 my ($entry, $txt) = @_; 296 my ($entry, $txt) = @_;
292 $::CONN->send ("mark ". pack "N", $self->{tag}); 297 $::CONN->send ("mark ". pack "N", $self->{tag});
293 $::CONN->send ("command rename to <$txt>"); 298 $::CONN->send ("command rename to <$txt>");
294 }); 299 }, $self->{name},
300 "If you input no name or erase the current custom name, the custom name will be unset");
295 } 301 }
296 ], 302 ],
297 ["apply", sub { $::CONN->send ("apply $self->{tag}") }], 303 ["apply", sub { $::CONN->send ("apply $self->{tag}") }],
298 ( 304 (
299 $self->{flags} & F_LOCKED 305 $self->{flags} & F_LOCKED

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines