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

Re: Synchronize <-> pilot



> >	I was wondering if there is anything to link my Synchronize 
> >	calendar ( on the Sun ) to the Pilot's DateBook?
> 
> Yes!  The SyncCM module of PilotManager which is available from
> http://www.moshpit.org/pilotmgr/

Darren- actually "Synchronize" is the name of a calendar package, different
from Calendar Manager.

** SyncCM will NOT synchronize with Crosswind's "Synchronize" package **

Below is some code written by a pilotmgr user.. maybe it will be helpful?
langrill@xxxxxxx expressed interest in wrapping this code up into a pilotmgr
conduit, but I never saw any results...

	- Alan


----- Begin Included Message -----
Date: Mon, 4 May 1998 14:00:05 -0500 (CDT)
From: Dwayne Forsyth <forsyth@xxxxxxxxxxx>
Subject: Re: Crosswind Synchronize Conduit?


I started playing with it, but did not finish... Here is a start...

Synchronize has an ascii mode.

------------------
#! /usr/test/intdb2500/bin/perl

my(%app_store);

sub store_apt_line {
  my ($rec) = @_;
  $date_key = sprintf "%2.2d/%2.2d/%2.2d %2.2d:%2.2d %d",
         $rec->{'begin'}[5],
         $rec->{'begin'}[4],
         $rec->{'begin'}[3],
         $rec->{'begin'}[2],
         $rec->{'begin'}[1],
         $rec->{'id'};
  eval Data::Dumper->Dump([$rec],["app_store{\"$date_key\"}"]);
  if ($@) { print ">> Error <<\n"; }  # delete the if breaks eval???
}

sub print_apt_line {
  my ($rec) = @_;

  my @month = (qw(Jan Feb Mar Apr May Jue Jul Aus Sep Oct Nov Dec));

  printf "%3s %2.2d/%2.2d %2.2d:%2.2d - %2.2d:%2.2d %s\n",
         $month[$rec->{'begin'}[4]],
         $rec->{'begin'}[3],
         $rec->{'begin'}[5],
         $rec->{'begin'}[2],
         $rec->{'begin'}[1],
         $rec->{'end'}[2],
         $rec->{'end'}[1],
         $rec->{'description'};
}

sub FooBar { print "Foo: $_[0]\n"; $x = $_[0]; $x =~ s/[aeiou]/\U$&/g; return $x
}; # "



sub load_date_book {
   my($socket) = @_;

   my($r,$i,$db, $a, $dlp);

   $dlp = PDA::Pilot::accept($socket);

   $db  = $dlp->open("DatebookDB");

   $i = 0;
   while ($r = $db->getRecord($i++)) {
      $r->{begin}[5] += 1900;
      $r->{end}[5] += 1900;
      &store_apt_line($r);
   }


    $db->close();

    undef $db; # Close database
}

sub load_sync {
   my($server,$user,$days) = @_;

   my(%rec);
   my($year,$month,$day,$a);


   print ">>Hello Load Sync<<\n";
   open(SYNC, "synchronize -day -user $user -range $days|");

   while (<SYNC>) {
      if (/#For \w+ \d+, (\d+)/) {
         $year = $1;
      } else {
         if (/(\d+)\/(\d+)/) { $month = $1, $day = $2; }
         if (/(\d\d):(\d\d)([ap])m-(\d\d):(\d\d)([ap])m\t(.*)/) {
            $rec{'begin'}[0] = 0;
            $rec{'begin'}[1] = $2;
            $rec{'begin'}[2] = $1;
            if ($3 eq "p") { $rec{'begin'}[2] += 12; }
            $rec{'begin'}[3] = $day;
            $rec{'begin'}[4] = $month;
            $rec{'begin'}[5] = $year;
            $rec{'end'}[0] = 0;
            $rec{'end'}[1] = $5;
            $rec{'end'}[2] = $4;
            if ($6 eq "p") { $rec{'end'}[2] += 12; }
            $rec{'end'}[3] = $day;
            $rec{'end'}[4] = $month;
            $rec{'end'}[5] = $year;
            $rec{'description'} = $7;
            &store_apt_line(bless(\%rec));
         }
      }
   }
}

sub dump_appt {
   my($a);

   foreach $a (sort keys %app_store) {
      &print_apt_line($app_store{$a});

   #
   #    $a = \%app_store;
   #
   #    print Dumper( $a );
   }
}

use PDA::Pilot;
use Data::Dumper;


$socket = PDA::Pilot::openPort("desi160");

print "Now press the HotSync button\n";

&load_date_book( $socket);

undef $dlp; # Close connection

&load_sync("EMX2500","forsyth",14);

&dump_appt;
---------
End of program

-- 


----- End Included Message -----


------------------------------------------------------------------------
***********************************************************
*             This is a public mailing list!              *
* Please do not publish Sun proprietary information here! *
*        -  -  -  -  -  -  -  -  -  -  -  -  -  -         *
*             http://www.moshpit.org/pilotmgr             *
***********************************************************


SourceForge.net Logo