aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/conduits/calendar
diff options
context:
space:
mode:
authorVeerapuram Varadhan <vvaradan@src.gnome.org>2007-01-08 23:14:25 +0800
committerVeerapuram Varadhan <vvaradan@src.gnome.org>2007-01-08 23:14:25 +0800
commita49955fbe8ad6169da6272330220f6fcc3d7f4d5 (patch)
treed88ac77c529abb9081e4cb34ada91151de05c73a /calendar/conduits/calendar
parenta97944b9bc34bbe9cf7aca46b17aac15cfc4b7f1 (diff)
downloadgsoc2013-evolution-a49955fbe8ad6169da6272330220f6fcc3d7f4d5.tar
gsoc2013-evolution-a49955fbe8ad6169da6272330220f6fcc3d7f4d5.tar.gz
gsoc2013-evolution-a49955fbe8ad6169da6272330220f6fcc3d7f4d5.tar.bz2
gsoc2013-evolution-a49955fbe8ad6169da6272330220f6fcc3d7f4d5.tar.lz
gsoc2013-evolution-a49955fbe8ad6169da6272330220f6fcc3d7f4d5.tar.xz
gsoc2013-evolution-a49955fbe8ad6169da6272330220f6fcc3d7f4d5.tar.zst
gsoc2013-evolution-a49955fbe8ad6169da6272330220f6fcc3d7f4d5.zip
Fix for 389664 - Adding pilot-link 0.12 compatibility.
* Fix for 389664 - Adding pilot-link 0.12 compatibility. svn path=/trunk/; revision=33125
Diffstat (limited to 'calendar/conduits/calendar')
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c106
1 files changed, 98 insertions, 8 deletions
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index 99b9832bd7..56dacdab9d 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -413,6 +413,9 @@ static char *print_remote (GnomePilotRecord *remote)
{
static char buff[ 4096 ];
struct Appointment appt;
+#ifdef PILOT_LINK_0_12
+ pi_buffer_t * buffer;
+#endif
if (remote == NULL) {
sprintf (buff, "[NULL]");
@@ -420,8 +423,22 @@ static char *print_remote (GnomePilotRecord *remote)
}
memset (&appt, 0, sizeof (struct Appointment));
+#ifdef PILOT_LINK_0_12
+ buffer = pi_buffer_new(DLP_BUF_SIZE);
+ if(buffer == NULL){
+ sprintf (buff, "[NULL]");
+ return buff;
+ }
+ if(pi_buffer_append(buffer, remote->record, remote->length)==NULL){
+ sprintf (buff, "[NULL]");
+ return buff;
+ }
+
+ unpack_Appointment (&appt, buffer, datebook_v1);
+ pi_buffer_free(buffer);
+#else
unpack_Appointment (&appt, remote->record, remote->length);
-
+#endif
g_snprintf (buff, 4096, "[%ld %ld '%s' '%s']",
mktime (&appt.begin),
mktime (&appt.end),
@@ -819,6 +836,9 @@ local_record_to_pilot_record (ECalLocalRecord *local,
{
GnomePilotRecord p;
static char record[0xffff];
+#ifdef PILOT_LINK_0_12
+ pi_buffer_t * buffer;
+#endif
g_assert (local->comp != NULL);
g_assert (local->appt != NULL );
@@ -830,9 +850,23 @@ local_record_to_pilot_record (ECalLocalRecord *local,
p.secret = local->local.secret;
/* Generate pilot record structure */
+#ifdef PILOT_LINK_0_12
+ buffer = pi_buffer_new(DLP_BUF_SIZE);
+ if(buffer == NULL){
+ pi_set_error(ctxt->dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
+ return p;
+ }
+
+ pack_Appointment (local->appt, buffer, datebook_v1);
+ p.record = g_new0(unsigned char, buffer->used);
+ p.length = buffer->used;
+ memcpy(p.record, buffer->data, buffer->used);
+
+ pi_buffer_free(buffer);
+#else
p.record = record;
p.length = pack_Appointment (local->appt, p.record, 0xffff);
-
+#endif
return p;
}
@@ -867,22 +901,44 @@ local_record_from_comp (ECalLocalRecord *local, ECalComponent *comp, ECalConduit
* we don't overwrite them
*/
if (local->local.ID != 0) {
+ int cat = 0;
+#ifdef PILOT_LINK_0_12
+ struct Appointment appt;
+ pi_buffer_t * record;
+
+ record = pi_buffer_new(DLP_BUF_SIZE);
+ if(record == NULL){
+ pi_set_error(ctxt->dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
+ return;
+ }
+#else
struct Appointment appt;
char record[0xffff];
- int cat = 0;
-
+#endif
if (dlp_ReadRecordById (ctxt->dbi->pilot_socket,
ctxt->dbi->db_handle,
+#ifdef PILOT_LINK_0_12
+ local->local.ID, record,
+ NULL, NULL, &cat) > 0) {
+#else
local->local.ID, &record,
NULL, NULL, NULL, &cat) > 0) {
+#endif
local->local.category = cat;
memset (&appt, 0, sizeof (struct Appointment));
+#ifdef PILOT_LINK_0_12
+ unpack_Appointment (&appt, record, datebook_v1);
+#else
unpack_Appointment (&appt, record, 0xffff);
+#endif
local->appt->alarm = appt.alarm;
local->appt->advance = appt.advance;
local->appt->advanceUnits = appt.advanceUnits;
free_Appointment (&appt);
}
+#ifdef PILOT_LINK_0_12
+ pi_buffer_free (record);
+#endif
}
/* STOP: don't replace these with g_strdup, since free_Appointment
@@ -1140,12 +1196,28 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
GSList *edl = NULL;
char *txt;
int pos, i;
-
+#ifdef PILOT_LINK_0_12
+ pi_buffer_t * buffer;
+#endif
g_return_val_if_fail (remote != NULL, NULL);
+#ifdef PILOT_LINK_0_12
+ buffer = pi_buffer_new(DLP_BUF_SIZE);
+ if(buffer == NULL){
+ return NULL;
+ }
+
+ if(pi_buffer_append(buffer, remote->record, remote->length)==NULL){
+ return NULL;
+ }
+
+ unpack_Appointment (&appt, buffer, datebook_v1);
+ pi_buffer_free(buffer);
+
+#else
memset (&appt, 0, sizeof (struct Appointment));
unpack_Appointment (&appt, remote->record, remote->length);
-
+#endif
if (in_comp == NULL) {
comp = e_cal_component_new ();
e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
@@ -1413,7 +1485,9 @@ pre_sync (GnomePilotConduit *conduit,
char *filename, *change_id;
icalcomponent *icalcomp;
gint num_records, add_records = 0, mod_records = 0, del_records = 0;
-
+#ifdef PILOT_LINK_0_12
+ pi_buffer_t * buffer;
+#endif
abs_conduit = GNOME_PILOT_CONDUIT_SYNC_ABS (conduit);
LOG (g_message ( "---------------------------------------------------------\n" ));
@@ -1521,10 +1595,21 @@ pre_sync (GnomePilotConduit *conduit,
gnome_pilot_conduit_sync_abs_set_num_updated_local_records (abs_conduit, mod_records);
gnome_pilot_conduit_sync_abs_set_num_deleted_local_records(abs_conduit, del_records);
+#ifdef PILOT_LINK_0_12
+ buffer = pi_buffer_new(DLP_BUF_SIZE);
+ if(buffer == NULL){
+ pi_set_error(dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
+ return -1;
+ }
+
+ len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
+ DLP_BUF_SIZE,
+ buffer);
+#else
buf = (unsigned char*)g_malloc (0xffff);
len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
(unsigned char *)buf, 0xffff);
-
+#endif
if (len < 0) {
WARN (_("Could not read pilot's Calendar application block"));
WARN ("dlp_ReadAppBlock(...) = %d", len);
@@ -1532,6 +1617,11 @@ pre_sync (GnomePilotConduit *conduit,
_("Could not read pilot's Calendar application block"));
return -1;
}
+#ifdef PILOT_LINK_0_12
+ buf = g_new0 (unsigned char,buffer->used);
+ memcpy(buf, buffer->data, buffer->used);
+ pi_buffer_free(buffer);
+#endif
unpack_AppointmentAppInfo (&(ctxt->ai), buf, len);
g_free (buf);