[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [coldsync-hackers] Categories In AddressDB
On Sat, Jun 02, 2001 at 10:08:29PM -0400, Jeremy LaCivita wrote:
> i used the datadumper module to dump my database to a file and in the
> appinfo block, there is the unfiled category, and a bunch of blank
> categories, but none of my custom categories.
>
> does anyone have any reasons for this?
ColdSync (or rather, the "[generic]" conduit) doesn't touch
the AppInfo block, where the categories are stored. Because of the way
categories are implemented, there's always a risk of deleting or
renaming the wrong category, or putting records in the wrong
categories; so I chose to ignore the issue altogether, and not sync
the AppInfo block at all.
Thus, any categories you've created on the Palm haven't been
copied to the desktop.
However, see the attached conduit (which I've just added to
the distribution). All it does is copy the AppInfo block from the Palm
to the desktop. (And, for those who are interested, this is another
very simple Sync conduit/SPC programming example).
Bear in mind that explicitly naming a sync conduit overrides
the "[generic]" conduit, so you'll need to add that explicitly:
conduit Sync {
type: todo/DATA;
type: memo/DATA;
...
path: /usr/local/libexec/coldsync/copy-appinfo;
}
conduit Sync {
type: todo/DATA;
type: memo/DATA;
...
path: [generic];
}
or perhaps
conduit Sync {
type: */*;
path: [generic];
}
conduit Sync {
type: todo/DATA;
type: memo/DATA;
...
path: /usr/local/libexec/coldsync/copy-appinfo;
}
--
Andrew Arensburger This message *does* represent the
arensb@ooblick.com views of ooblick.com
Reality is for people who can't face science fiction.
#!/usr/bin/perl
#
# Copyright (C) 2001, Andrew Arensburger.
# You may distribute this file under the terms of the Artistic
# License, as specified in the README file.
#
# $Id: copy-appinfo,v 3.2 2001/06/04 02:28:04 arensb Exp $
# This conduit simply copies the AppInfo block from the database on the
# Palm to the desktop.
# XXX - Make this work (or make sure it works) with databases that don't
# have an AppInfo block.
# XXX - Perhaps make this do nothing (but gracefully) with PRCs?
use strict;
use ColdSync;
use ColdSync::SPC;
use Palm::Raw;
StartConduit("sync");
use vars qw( $err $dbinfo $dbh $Pappinfo );
select STDERR; # XXX - Just for debugging
# Find out which database we're dealing with
$dbinfo = spc_get_dbinfo;
die "401 Error reading database info" if !defined($dbinfo);
# Open the database
($dbh = &dlp_OpenDB($dbinfo->{name}, 0x80))
or die "402 Can't open database";
# Get the category list from the Palm
$Pappinfo = dlp_ReadAppBlock($dbh);
# Download the AppInfo block from the Palm
print STDERR "$0: read AppInfo block [$Pappinfo]\n";
# Copy the Palm's AppInfo block to the desktop PDB
$PDB->{appinfo} = $Pappinfo;
$err = &dlp_CloseDB($dbh);
# XXX - Error-checking
EndConduit;
__END__
=head1 NAME
copy-appinfo - ColdSync conduit to copy the AppInfo block (categories)
=head1 SYNOPSIS
Add the following to your F<.coldsyncrc> file:
conduit sync {
type: addr/DATA;
type: memo/DATA;
type: todo/DATA;
...
path: <...>/copy-appinfo;
}
conduit sync {
type: addr/DATA;
type: memo/DATA;
type: todo/DATA;
...
path: [generic];
}
(the "[generic]" block is so that the databases in question will be synced
the normal way, in addition to having their AppInfo blocks copied.)
=head1 DESCRIPTION
The C<copy-appinfo> conduit copies the AppInfo block (which contains
information about categories and certain other application-specific data)
from the Palm to the desktop.
Since ColdSync's generic conduit does not touch the AppInfo block at all,
you need to use C<copy-appinfo> or something like it to keep category data
in sync.
Note that this conduit only implements Palm-overwrites-desktop. If you
modify any categories in the desktop copy of a database, those changes will
be lost.
=head1 BUGS
None known.
=head1 SEE ALSO
coldsync(8)
=cut
#'
# This is for Emacs's benefit:
# Local Variables: ***
# fill-column: 75 ***
# End: ***