evolution-data-server r8906 - in branches/camel-db-summary/camel/providers: groupwise imap
- From: sragavan svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r8906 - in branches/camel-db-summary/camel/providers: groupwise imap
- Date: Wed, 4 Jun 2008 06:20:05 +0000 (UTC)
Author: sragavan
Date: Wed Jun 4 06:20:05 2008
New Revision: 8906
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8906&view=rev
Log:
Complete impl for GW.
Modified:
branches/camel-db-summary/camel/providers/groupwise/camel-groupwise-summary.c
branches/camel-db-summary/camel/providers/imap/camel-imap-summary.c
Modified: branches/camel-db-summary/camel/providers/groupwise/camel-groupwise-summary.c
==============================================================================
--- branches/camel-db-summary/camel/providers/groupwise/camel-groupwise-summary.c (original)
+++ branches/camel-db-summary/camel/providers/groupwise/camel-groupwise-summary.c Wed Jun 4 06:20:05 2008
@@ -42,6 +42,9 @@
#define CAMEL_GW_SUMMARY_VERSION (1)
+#define EXTRACT_FIRST_DIGIT(val) val=strtoul (part, &part, 10);
+#define EXTRACT_DIGIT(val) part++; val=strtoul (part, &part, 10);
+
/*Prototypes*/
static int gw_summary_header_load (CamelFolderSummary *, FILE *);
static int gw_summary_header_save (CamelFolderSummary *, FILE *);
@@ -189,8 +192,9 @@
if (part)
EXTRACT_DIGIT (gms->validity);
- if (part)
-
+ if (part && part++) {
+ ims->time_string = g_strdup (part);
+ }
return 0;
}
@@ -212,39 +216,23 @@
return 0 ;
}
-static CamelMIRecord *
-message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info)
-{
- return NULL;
-}
-
-static CamelMessageInfo *
-message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir)
-{
- return NULL;
-}
-
-static int
-content_info_to_db (CamelFolderSummary *s, CamelMessageContentInfo *info, CamelMIRecord *mir)
-{
- return -1;
-}
-static CamelMessageContentInfo *
-content_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir)
-{
- return NULL;
-}
static CamelFIRecord *
summary_header_to_db (CamelFolderSummary *s, CamelException *ex)
{
- CamelFIRecord *fir;
- GString *str = g_string_new (NULL);
+ CamelGroupwiseSummary *ims = CAMEL_GROUPWISE_SUMMARY(s);
+ struct _CamelFIRecord *fir;
+
+ fir = camel_groupwise_summary_parent->summary_header_to_db (s, ex);
+ if (!fir)
+ return NULL;
+
+ fir->bdata = g_strdup_printf ("%d %d %s", CAMEL_GW_SUMMARY_VERSION, ims->validity, ims->time_string);
- return NULL;
+ return fir;
}
@@ -261,6 +249,21 @@
return camel_file_util_encode_string (out, gms->time_string);
}
+static CamelMessageInfo *
+message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir)
+{
+ CamelMessageInfo *info;
+ CamelGroupwiseMessageInfo *iinfo;
+
+ info = camel_groupwise_summary_parent->message_info_from_db (s, mir);
+ if (info) {
+ char *part = mir->bdata;
+ iinfo = (CamelGroupwiseMessageInfo *)info;
+ EXTRACT_FIRST_DIGIT (iinfo->server_flags)
+ }
+
+ return info;}
+
static CamelMessageInfo *
gw_message_info_load (CamelFolderSummary *s, FILE *in)
{
@@ -281,6 +284,18 @@
return NULL ;
}
+static CamelMIRecord *
+message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info)
+{
+ CamelGroupwiseMessageInfo *iinfo = (CamelGroupwiseMessageInfo *)info;
+ struct _CamelMIRecord *mir;
+
+ mir = camel_groupwise_summary_parent->message_info_to_db (s, info);
+ if (mir)
+ mir->bdata = g_strdup_printf ("%u", iinfo->server_flags);
+
+ return mir;
+}
static int
gw_message_info_save (CamelFolderSummary *s, FILE *out, CamelMessageInfo *info)
@@ -293,6 +308,21 @@
return camel_file_util_encode_uint32 (out, gw_info->server_flags);
}
+static CamelMessageContentInfo *
+content_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir)
+{
+ char *part = mir->cinfo;
+ guint32 type=0;
+
+ if (part) {
+ EXTRACT_FIRST_DIGIT (type);
+ }
+ if (type)
+ return camel_groupwise_summary_parent->content_info_from_db (s, mir);
+ else
+ return camel_folder_summary_content_info_new (s);
+}
+
static CamelMessageContentInfo *
gw_content_info_load (CamelFolderSummary *s, FILE *in)
@@ -303,6 +333,18 @@
return camel_folder_summary_content_info_new (s);
}
+static int
+content_info_to_db (CamelFolderSummary *s, CamelMessageContentInfo *info, CamelMIRecord *mir)
+{
+
+ if (info->type) {
+ mir->cinfo = g_strdup ("1");
+ return camel_groupwise_summary_parent->content_info_to_db (s, info, mir);
+ } else {
+ mir->cinfo = g_strdup ("0");
+ return 0;
+ }
+}
static int
gw_content_info_save (CamelFolderSummary *s, FILE *out,
Modified: branches/camel-db-summary/camel/providers/imap/camel-imap-summary.c
==============================================================================
--- branches/camel-db-summary/camel/providers/imap/camel-imap-summary.c (original)
+++ branches/camel-db-summary/camel/providers/imap/camel-imap-summary.c Wed Jun 4 06:20:05 2008
@@ -232,16 +232,11 @@
{
CamelImapSummary *ims = CAMEL_IMAP_SUMMARY(s);
struct _CamelFIRecord *fir;
- GString *str = g_string_new (NULL);
fir = camel_imap_summary_parent->summary_header_to_db (s, ex);
if (!fir)
return NULL;
-
- g_string_append_printf (str, "%d %u", CAMEL_IMAP_SUMMARY_VERSION, ims->validity);
-
- fir->bdata = str->str;
- g_string_free (str, FALSE);
+ fir->bdata = g_strdup_printf ("%d %u", CAMEL_IMAP_SUMMARY_VERSION, ims->validity);
return fir;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]