File: copy-appinfo

package info (click to toggle)
coldsync 3.0%2Bpre3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,180 kB
  • ctags: 2,036
  • sloc: ansic: 20,386; perl: 2,302; cpp: 1,640; yacc: 1,102; lex: 802; makefile: 586; sh: 177
file content (106 lines) | stat: -rwxr-xr-x 2,397 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/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.4 2001/07/30 07:04:33 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:			***