[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[coldsync-hackers] Help w/ conduit for addressdb (delete_Record)




Hello all,

I've been pulling my hair out trying to get a simple address book fetch
script working here, and I'm now officially out of ideas.

The main problem I'm having is that records that are deleted using
delete_Record are never actually removed from the palm.  In fact, what
appears to be happening is:

1.  My fetch conduit reads in the AddressDB
2.  I delete all records (as a test) and write out the new AddressDB.pdb
3.  The sync mechanism overwrites my newly modified AddressDB.pdb with what
is on the palm, thus missing the changes (deletes)

I've run every debug I know to run, and can't make it work.  I know that the
conduit actually deletes the records, because I had it write out to
$HOME/test.pdb, and the records in that file do have the 'deleted' attribute
set.  However, after every sync finishes, I check the AddressDB.pdb file and
the 'deleted' attribute for every record there is always cleared.  How can I
fix this?

This is using a Visor Prism (USB) with kernel 2.4.17 and commandline:
coldsync -p /dev/visor

Here's my .coldsyncrc:

options {
  CONDUITDIR: "$(CONDUITDIR):$(HOME)/.palm/conduits";
}

listen serial {
  device: "/dev/ttyUSB1";
}

pda "Visor" {
  snum: "*Visor*";
  directory: "/home/user/.palm";
  username: "Jeff Carneal";
  userid: 3130;
}

conduit fetch {
  type: addr/DATA;
  path: "/home/user/.palm/conduits/myaddr.pl";
  arguments:
  AddrFile: /home/user/etc/new.txt;
}

And here is the conduit myaddr.pl (very short):

#!/usr/bin/perl

use strict;
use Palm::Address;
use ColdSync;

ConduitMain(
 "fetch" => \&Fetch,
);

sub Fetch {

  my($record, $pdb);

  # Make sure we have the database
  if (!defined($pdb)) {
    $pdb = new Palm::Address;  # Auto-morphs on Load()
    $pdb->Load($HEADERS{OutputDB}) || die "401 No input database.\n";
  }

  foreach $record (@{$pdb->{records}}){
    $pdb->delete_Record($record, 1);
    print "106 DELETING $record->{fields}{name}, $record->{fields}{firstName}
($record->{attributes}{deleted})\n";
  }

  $pdb->Write("/home/user/test.pdb") or
    die "405 Can't write output database\n";
  $pdb->Write($HEADERS{OutputDB}) or
    die "405 Can't write output database \"$HEADERS{OutputDB}\"\n";

print "202 Success Jeff!\n";
return 1;
}



__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com

-- 
This message was sent through the coldsync-hackers mailing list.  To remove
yourself from this mailing list, send a message to majordomo@thedotin.net
with the words "unsubscribe coldsync-hackers" in the message body.  For more
information on Coldsync, send mail to coldsync-hackers-owner@thedotin.net.