Does anyone other than me still use this?  I had a heck of a time
getting SyncBBDB 2.3 to work with the perl 5.6.1 on redhat 7.3.  I
needed to make it work with Digest::MD5 from CPAN as the older MD5
that either came with SyncBBDB or maybe pilotmgr itself would not
work.  The fixes were simple but I am not a perl hacker by any means.
Recently I decided to try SyncBBDB 2.4 (from CVS) because I was
getting bit by a bug that it fixes.  I had to go through a similar
patching process for that and also fixed a few other things related to
its handling of empty fields (some need to be nil, some "").

Last week I sent my patches to Thomas DeWeese but I'm not sure whether
they ended up in a black hole or if he maintains it anymore at all.
In the hopes that this may be useful to someone else I'm sending my
patches here as well.

The first attachment is my patch to SyncBBDB 2.3.  Each subsequent
patch should be applied to the subdirectory it is named for in the 2.4
checkout tree under dev/perl.

Thanks,
-- 
Dave Goldberg
[EMAIL PROTECTED]
diff -cr SyncUtil/localHashDB.pm ../../pilotmgr-saved/lib/perl5/SyncUtil/localHashDB.pm
*** SyncUtil/localHashDB.pm	Wed Jun  5 17:14:11 2002
--- ../../pilotmgr-saved/lib/perl5/SyncUtil/localHashDB.pm	Wed Jun  5 02:37:39 2002
***************
*** 6,12 ****
  package localHashDB;
  
  use strict;
! require  MD5;
  
  require SyncUtil::localDB;
  @localHashDB::ISA = qw(localDB);
--- 6,12 ----
  package localHashDB;
  
  use strict;
! require  Digest::MD5;
  
  require SyncUtil::localDB;
  @localHashDB::ISA = qw(localDB);
***************
*** 42,48 ****
  sub hashRecord {
    my $self   = shift;
    my $rec = shift;
!   my($hash) = new MD5;
    $hash->add($self->toString($rec));
    return $hash->hexdigest;
  }
--- 42,48 ----
  sub hashRecord {
    my $self   = shift;
    my $rec = shift;
!   my($hash) = Digest::MD5->new;
    $hash->add($self->toString($rec));
    return $hash->hexdigest;
  }
diff -cr SyncUtil/pilotHashDB.pm ../../pilotmgr-saved/lib/perl5/SyncUtil/pilotHashDB.pm
*** SyncUtil/pilotHashDB.pm	Wed Jun  5 17:14:11 2002
--- ../../pilotmgr-saved/lib/perl5/SyncUtil/pilotHashDB.pm	Wed Jun  5 02:38:26 2002
***************
*** 6,12 ****
  package pilotHashDB;
  
  use      strict;
! require  MD5;
  
  require SyncUtil::pilotDB;
  @pilotHashDB::ISA = qw(pilotDB);
--- 6,12 ----
  package pilotHashDB;
  
  use      strict;
! require  Digest::MD5;
  
  require SyncUtil::pilotDB;
  @pilotHashDB::ISA = qw(pilotDB);
***************
*** 69,75 ****
  sub hashPilotRecord {
    my $self    = shift;
    my $record  = shift;
!   my $hash    = new MD5;
    $hash->add($record->{raw});
    return $hash->hexdigest;
  }
--- 69,75 ----
  sub hashPilotRecord {
    my $self    = shift;
    my $record  = shift;
!   my $hash    = Digest::MD5->new;
    $hash->add($record->{raw});
    return $hash->hexdigest;
  }
Index: SyncBBDB/pilotBBDB.pm
===================================================================
RCS file: /cvsroot/syncbbdb2/dev/dev/perl/SyncBBDB/pilotBBDB.pm,v
retrieving revision 1.1.1.1
diff -u -u -r1.1.1.1 pilotBBDB.pm
--- SyncBBDB/pilotBBDB.pm	4 Nov 2001 13:17:56 -0000	1.1.1.1
+++ SyncBBDB/pilotBBDB.pm	5 Mar 2003 19:34:56 -0000
@@ -179,7 +179,7 @@
       $self->setField($prec, 'Custom3', "");
       $self->setField($prec, 'Custom4', "");
 
-      my $first=true;
+      my $first=1;
       foreach my $ent (@{$rec->{'mappings'}}) {
 	  my $btype = $ent->{'bbdb-type'};
 	  my $bname = $ent->{'bbdb-name'};
@@ -212,7 +212,7 @@
 		    # This really needs better support so I can
 		    # remember if it was changed on the pilot...
 		    $prec->{'showPhone'} = $idx;
-		    $first = false;
+		    $first = 0;
 		  }
 
 	      }
Index: SyncUtil/localHashDB.pm
===================================================================
RCS file: /cvsroot/syncbbdb2/dev/dev/perl/SyncUtil/localHashDB.pm,v
retrieving revision 1.1.1.1
diff -u -u -r1.1.1.1 localHashDB.pm
--- SyncUtil/localHashDB.pm	4 Nov 2001 13:17:57 -0000	1.1.1.1
+++ SyncUtil/localHashDB.pm	5 Mar 2003 19:35:06 -0000
@@ -6,7 +6,7 @@
 package localHashDB;
 
 use strict;
-require  MD5;
+require  Digest::MD5;
 
 require SyncUtil::localDB;
 @localHashDB::ISA = qw(localDB);
@@ -42,7 +42,7 @@
 sub hashRecord {
   my $self   = shift;
   my $rec = shift;
-  my($hash) = new MD5;
+  my($hash) = Digest::MD5->new;
   $hash->add($self->toString($rec));
   return $hash->hexdigest;
 }
Index: SyncUtil/pilotHashDB.pm
===================================================================
RCS file: /cvsroot/syncbbdb2/dev/dev/perl/SyncUtil/pilotHashDB.pm,v
retrieving revision 1.1.1.1
diff -u -u -r1.1.1.1 pilotHashDB.pm
--- SyncUtil/pilotHashDB.pm	4 Nov 2001 13:17:58 -0000	1.1.1.1
+++ SyncUtil/pilotHashDB.pm	5 Mar 2003 19:35:06 -0000
@@ -6,7 +6,7 @@
 package pilotHashDB;
 
 use      strict;
-require  MD5;
+require  Digest::MD5;
 
 require SyncUtil::pilotDB;
 @pilotHashDB::ISA = qw(pilotDB);
@@ -69,7 +69,7 @@
 sub hashPilotRecord {
   my $self    = shift;
   my $record  = shift;
-  my $hash    = new MD5;
+  my $hash    = Digest::MD5->new;
   $hash->add($record->{raw});
   return $hash->hexdigest;
 }
Index: bbdb/bbdb.pm
===================================================================
RCS file: /cvsroot/syncbbdb2/dev/dev/perl/bbdb/bbdb.pm,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 bbdb.pm
--- bbdb/bbdb.pm	4 Nov 2001 13:17:55 -0000	1.1.1.1
+++ bbdb/bbdb.pm	5 Mar 2003 19:34:14 -0000
@@ -120,6 +120,18 @@
 sub eStr
 {
     my $str = shift;
+    if (!$str) { return "\"\"" }
+    $str =~ s/\\/\\\\/g;
+    $str =~ s/\"/\\\"/g;
+    $str =~ s/\n/\\n/g;
+    $str =~ s/([\x80-\xFF])/"\\" . sprintf("%o", vec($1,0,8))/eg;
+    return '"' . $str . '"';
+}
+
+
+sub nStr
+{
+    my $str = shift;
     if (!$str) { return "nil" }
     $str =~ s/\\/\\\\/g;
     $str =~ s/\"/\\\"/g;
Index: bbdb/bbdbRecord.pm
===================================================================
RCS file: /cvsroot/syncbbdb2/dev/dev/perl/bbdb/bbdbRecord.pm,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 bbdbRecord.pm
--- bbdb/bbdbRecord.pm	4 Nov 2001 13:17:56 -0000	1.1.1.1
+++ bbdb/bbdbRecord.pm	5 Mar 2003 19:34:16 -0000
@@ -144,10 +144,10 @@
   my $self = shift;
   my $ver  = shift || $bbdb::DEFAULT_VERSION;
   my $ret = ("[" .
-	     bbdb::eStr($self->{'fname'}) . " " .
-	     bbdb::eStr($self->{'lname'}) . " " .
+	     bbdb::nStr($self->{'fname'}) . " " .
+	     bbdb::nStr($self->{'lname'}) . " " .
 	     eStrLst($self->{'aka'}) . " ".
-	     bbdb::eStr($self->{'org'}) . " " .
+	     bbdb::nStr($self->{'org'}) . " " .
 	     eStrObjLst($self->{'phone'}, $ver) . " " .
 	     eStrObjLst($self->{'addr'}, $ver) . " " .
 	     eStrLst($self->{'email'}) . " " .

Reply via email to