evolution-data-server r8947 - branches/camel-db-summary/camel
- From: psankar svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r8947 - branches/camel-db-summary/camel
- Date: Fri, 6 Jun 2008 11:21:01 +0000 (UTC)
Author: psankar
Date: Fri Jun 6 11:21:01 2008
New Revision: 8947
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8947&view=rev
Log:
Junk, Trash etc.
Modified:
branches/camel-db-summary/camel/camel-vee-folder.c
branches/camel-db-summary/camel/camel-vee-summary.c
branches/camel-db-summary/camel/camel-vee-summary.h
branches/camel-db-summary/camel/camel-vtrash-folder.c
Modified: branches/camel-db-summary/camel/camel-vee-folder.c
==============================================================================
--- branches/camel-db-summary/camel/camel-vee-folder.c (original)
+++ branches/camel-db-summary/camel/camel-vee-folder.c Fri Jun 6 11:21:01 2008
@@ -421,7 +421,7 @@
{
CamelFolder *folder;
- folder = vinfo->real->summary->folder;
+ folder = vinfo->summary->folder;
/* locking? yes? no? although the vfolderinfo is valid when obtained
the folder in it might not necessarily be so ...? */
@@ -521,7 +521,7 @@
mi = (CamelVeeMessageInfo *)camel_folder_summary_uid(folder->summary, uid);
if (mi) {
- msg = camel_folder_get_message(mi->real->summary->folder, camel_message_info_uid(mi)+8, ex);
+ msg = camel_folder_get_message(mi->summary->folder, camel_message_info_uid(mi)+8, ex);
camel_message_info_free((CamelMessageInfo *)mi);
} else {
camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
@@ -695,14 +695,9 @@
static CamelVeeMessageInfo *
vee_folder_add_uid(CamelVeeFolder *vf, CamelFolder *f, const char *inuid, const char hash[8])
{
- CamelMessageInfo *info;
CamelVeeMessageInfo *mi = NULL;
- info = camel_folder_get_message_info(f, inuid);
- if (info) {
- mi = camel_vee_summary_add((CamelVeeSummary *)((CamelFolder *)vf)->summary, info, hash);
- camel_folder_free_message_info(f, info);
- }
+ mi = camel_vee_summary_add((CamelVeeSummary *)((CamelFolder *)vf)->summary, f->summary, (char *)inuid, hash);
return mi;
}
@@ -749,7 +744,7 @@
CamelVeeMessageInfo *mi = (CamelVeeMessageInfo *)camel_folder_summary_index(((CamelFolder *)folder_unmatched)->summary, i);
if (mi) {
- if (mi->real->summary == ssummary) {
+ if (mi->summary == ssummary) {
camel_folder_change_info_remove_uid(folder_unmatched->changes, camel_message_info_uid(mi));
if (last == -1) {
last = start = i;
@@ -775,7 +770,7 @@
for (i=0;i<count;i++) {
CamelVeeMessageInfo *mi = (CamelVeeMessageInfo *)camel_folder_summary_index(folder->summary, i);
if (mi) {
- if (mi->real->summary == ssummary) {
+ if (mi->summary == ssummary) {
const char *uid = camel_message_info_uid(mi);
camel_folder_change_info_remove_uid(vf->changes, uid);
@@ -955,7 +950,7 @@
CamelVeeMessageInfo *mi = (CamelVeeMessageInfo *)camel_folder_summary_index(folder->summary, i);
if (mi) {
- if (mi->real->summary == ssummary) {
+ if (mi->summary == ssummary) {
char *uid = (char *)camel_message_info_uid(mi), *oldkey;
void *oldval;
@@ -1001,7 +996,7 @@
CamelVeeMessageInfo *mi = (CamelVeeMessageInfo *)camel_folder_summary_index(((CamelFolder *)folder_unmatched)->summary, i);
if (mi) {
- if (mi->real->summary == ssummary) {
+ if (mi->summary == ssummary) {
char *uid = (char *)camel_message_info_uid(mi);
if (g_hash_table_lookup(allhash, uid+8) == NULL) {
@@ -1499,7 +1494,7 @@
if (mi == NULL)
continue;
- if (mi->real->summary == ssummary) {
+ if (mi->summary == ssummary) {
char *uid = (char *)camel_message_info_uid(mi);
char *oldkey;
void *oldval;
Modified: branches/camel-db-summary/camel/camel-vee-summary.c
==============================================================================
--- branches/camel-db-summary/camel/camel-vee-summary.c (original)
+++ branches/camel-db-summary/camel/camel-vee-summary.c Fri Jun 6 11:21:01 2008
@@ -40,15 +40,9 @@
vee_message_info_free(CamelFolderSummary *s, CamelMessageInfo *info)
{
CamelVeeMessageInfo *mi = (CamelVeeMessageInfo *)info;
- CamelFolderSummary *real_summary = mi->real->summary;
g_free(info->uid);
- camel_message_info_free(mi->real);
-
- /* and unref the real summary too */
- /* FIXME: You may not need this during CamelDBSummary */
- if (real_summary)
- camel_object_unref (real_summary);
+ camel_object_unref (mi->summary);
}
static CamelMessageInfo *
@@ -59,42 +53,68 @@
to = (CamelVeeMessageInfo *)camel_message_info_new(s);
- to->real = camel_message_info_clone(from->real);
+ to->summary = from->summary;
/* FIXME: We may not need this during CamelDBSummary */
- camel_object_ref (to->real->summary);
+ camel_object_ref (to->summary);
to->info.summary = s;
return (CamelMessageInfo *)to;
}
static const void *
-vee_info_ptr(const CamelMessageInfo *mi, int id)
+vee_info_ptr (const CamelMessageInfo *mi, int id)
{
- return camel_message_info_ptr(((CamelVeeMessageInfo *)mi)->real, id);
+ CamelVeeMessageInfo *vmi = (CamelVeeMessageInfo *) mi;
+ CamelMessageInfo *info;
+ gpointer p;
+
+ info = camel_folder_summary_uid (vmi->summary, mi->uid+8);
+ p = (gpointer) camel_message_info_ptr(info, id);
+ camel_message_info_free (info);
+
+ return p;
}
static guint32
vee_info_uint32(const CamelMessageInfo *mi, int id)
{
- return camel_message_info_uint32(((CamelVeeMessageInfo *)mi)->real, id);
+ CamelMessageInfo *rmi = camel_folder_summary_uid (((CamelVeeMessageInfo *)mi)->summary, mi->uid+8);
+ guint32 ret = camel_message_info_uint32 (rmi, id);
+
+ camel_message_info_free (rmi);
+
+ return ret;
+
}
static time_t
vee_info_time(const CamelMessageInfo *mi, int id)
{
- return camel_message_info_time(((CamelVeeMessageInfo *)mi)->real, id);
+ CamelMessageInfo *rmi = camel_folder_summary_uid (((CamelVeeMessageInfo *)mi)->summary, mi->uid+8);
+ time_t ret = camel_message_info_time (rmi, id);
+ camel_message_info_free (rmi);
+
+ return ret;
}
static gboolean
vee_info_user_flag(const CamelMessageInfo *mi, const char *id)
{
- return camel_message_info_user_flag(((CamelVeeMessageInfo *)mi)->real, id);
+ CamelMessageInfo *rmi = camel_folder_summary_uid (((CamelVeeMessageInfo *)mi)->summary, mi->uid+8);
+ gboolean ret = camel_message_info_user_flag (rmi, id);
+ camel_message_info_free (rmi);
+
+ return ret;
}
static const char *
vee_info_user_tag(const CamelMessageInfo *mi, const char *id)
{
- return camel_message_info_user_tag(((CamelVeeMessageInfo *)mi)->real, id);
+ CamelMessageInfo *rmi = camel_folder_summary_uid (((CamelVeeMessageInfo *)mi)->summary, mi->uid+8);
+ const char *ret = camel_message_info_user_tag (rmi, id);
+ camel_message_info_free (rmi);
+
+ return ret;
}
static gboolean
@@ -102,9 +122,12 @@
{
int res = FALSE;
- if (mi->uid)
- res = camel_message_info_set_user_flag(((CamelVeeMessageInfo *)mi)->real, name, value);
-
+ if (mi->uid) {
+ CamelMessageInfo *rmi = camel_folder_summary_uid (((CamelVeeMessageInfo *)mi)->summary, mi->uid+8);
+ res = camel_message_info_set_user_flag(rmi, name, value);
+ camel_message_info_free (rmi);
+ }
+
return res;
}
@@ -113,9 +136,12 @@
{
int res = FALSE;
- if (mi->uid)
- res = camel_message_info_set_user_tag(((CamelVeeMessageInfo *)mi)->real, name, value);
-
+ if (mi->uid) {
+ CamelMessageInfo *rmi = camel_folder_summary_uid (((CamelVeeMessageInfo *)mi)->summary, mi->uid+8);
+ res = camel_message_info_set_user_tag(rmi, name, value);
+ camel_message_info_free (rmi);
+ }
+
return res;
}
@@ -124,9 +150,12 @@
{
int res = FALSE;
- if (mi->uid)
- res = camel_message_info_set_flags(((CamelVeeMessageInfo *)mi)->real, flags, set);
-
+ if (mi->uid) {
+ CamelMessageInfo *rmi = camel_folder_summary_uid (((CamelVeeMessageInfo *)mi)->summary, mi->uid+8);
+ res = camel_message_info_set_flags(rmi, flags, set);
+ camel_message_info_free (rmi);
+ }
+
return res;
}
@@ -205,13 +234,11 @@
}
CamelVeeMessageInfo *
-camel_vee_summary_add(CamelVeeSummary *s, CamelMessageInfo *info, const char hash[8])
+camel_vee_summary_add(CamelVeeSummary *s, CamelFolderSummary *summary, const char *uid, const char hash[8])
{
CamelVeeMessageInfo *mi;
char *vuid;
- const char *uid;
- uid = camel_message_info_uid(info);
vuid = g_malloc(strlen(uid)+9);
memcpy(vuid, hash, 8);
strcpy(vuid+8, uid);
@@ -224,14 +251,7 @@
}
mi = (CamelVeeMessageInfo *)camel_message_info_new(&s->summary);
- mi->real = info;
- camel_message_info_ref(info);
-
- /* Ensures the owner of the message info will not die before we free the mi->real;
- It's obvious that the real->summary should not be changed after this call. */
- /* FIXME: We may not need this during CamelDBSummary */
- if (info->summary)
- camel_object_ref (info->summary);
+ mi->summary = summary;
mi->info.uid = vuid;
Modified: branches/camel-db-summary/camel/camel-vee-summary.h
==============================================================================
--- branches/camel-db-summary/camel/camel-vee-summary.h (original)
+++ branches/camel-db-summary/camel/camel-vee-summary.h Fri Jun 6 11:21:01 2008
@@ -42,8 +42,7 @@
struct _CamelVeeMessageInfo {
CamelMessageInfo info;
-
- CamelMessageInfo *real;
+ CamelFolderSummary *summary;
};
struct _CamelVeeSummary {
@@ -58,7 +57,7 @@
CamelType camel_vee_summary_get_type (void);
CamelFolderSummary *camel_vee_summary_new(struct _CamelFolder *parent);
-CamelVeeMessageInfo * camel_vee_summary_add(CamelVeeSummary *s, CamelMessageInfo *info, const char hash[8]);
+CamelVeeMessageInfo * camel_vee_summary_add(CamelVeeSummary *s, CamelFolderSummary *summary, const char *uid, const char hash[8]);
G_END_DECLS
Modified: branches/camel-db-summary/camel/camel-vtrash-folder.c
==============================================================================
--- branches/camel-db-summary/camel/camel-vtrash-folder.c (original)
+++ branches/camel-db-summary/camel/camel-vtrash-folder.c Fri Jun 6 11:21:01 2008
@@ -262,20 +262,20 @@
continue;
}
- if (dest == mi->real->summary->folder) {
+ if (dest == mi->summary->folder) {
/* Just unset the flag on the original message */
camel_folder_set_message_flags (source, uids->pdata[i], sbit, 0);
} else {
if (batch == NULL)
batch = g_hash_table_new(NULL, NULL);
- md = g_hash_table_lookup(batch, mi->real->summary->folder);
+ md = g_hash_table_lookup(batch, mi->summary->folder);
if (md == NULL) {
md = g_malloc0(sizeof(*md));
- md->folder = mi->real->summary->folder;
+ md->folder = mi->summary->folder;
camel_object_ref((CamelObject *)md->folder);
md->uids = g_ptr_array_new();
md->dest = dest;
- g_hash_table_insert(batch, mi->real->summary->folder, md);
+ g_hash_table_insert(batch, mi->summary->folder, md);
}
tuid = uids->pdata[i];
@@ -298,6 +298,7 @@
GList *node;
GPtrArray *matches, *result = g_ptr_array_new(), *uids = g_ptr_array_new();
struct _CamelVeeFolderPrivate *p = ((CamelVeeFolder *)folder)->priv;
+ GPtrArray *infos = camel_folder_get_summary(folder);
/* we optimise the search by only searching for messages which we have anyway */
CAMEL_VEE_FOLDER_LOCK(folder, subfolder_lock);
@@ -306,15 +307,17 @@
CamelFolder *f = node->data;
int i;
char hash[8];
- GPtrArray *infos = camel_folder_get_summary(f);
camel_vee_folder_hash_folder(f, hash);
for (i=0;i<infos->len;i++) {
- CamelMessageInfo *mi = infos->pdata[i];
-
- if (camel_message_info_flags(mi) & ((CamelVTrashFolder *)folder)->bit)
- g_ptr_array_add(uids, (void *)camel_message_info_uid(mi));
+ CamelVeeMessageInfo *vmi = (CamelVeeMessageInfo *) camel_folder_summary_uid (folder->summary, infos->pdata[i]);
+ if (!vmi)
+ continue;
+ //if (camel_message_info_flags(mi) & ((CamelVTrashFolder *)folder)->bit)
+ if (vmi->summary == f->summary) /* Belongs to this folder */
+ g_ptr_array_add(uids, (void *)(infos->pdata[i]+8));
+ camel_message_info_free (vmi);
}
if (uids->len > 0
@@ -330,10 +333,10 @@
camel_folder_search_free(f, matches);
}
g_ptr_array_set_size(uids, 0);
- camel_folder_free_summary(f, infos);
node = g_list_next(node);
}
+
CAMEL_VEE_FOLDER_UNLOCK(folder, subfolder_lock);
g_ptr_array_free(uids, TRUE);
@@ -419,13 +422,14 @@
{
char *vuid;
CamelVeeMessageInfo *vinfo;
+ CamelMessageInfoBase *binfo = (CamelMessageInfoBase *) info;
vuid = g_alloca(strlen(uid)+9);
memcpy(vuid, hash, 8);
strcpy(vuid+8, uid);
vinfo = (CamelVeeMessageInfo *)camel_folder_summary_uid(((CamelFolder *)vf)->summary, vuid);
if (vinfo == NULL) {
- camel_vee_summary_add((CamelVeeSummary *)((CamelFolder *)vf)->summary, info, hash);
+ camel_vee_summary_add((CamelVeeSummary *)((CamelFolder *)vf)->summary, binfo->summary, uid, hash);
camel_folder_change_info_add_uid(((CamelVeeFolder *)vf)->changes, vuid);
} else {
camel_folder_change_info_change_uid(((CamelVeeFolder *)vf)->changes, vuid);
@@ -506,10 +510,12 @@
infos = camel_folder_get_summary(sub);
for (i=0;i<infos->len;i++) {
- CamelMessageInfo *info = infos->pdata[i];
-
+ CamelMessageInfo *info;
+ char *uid = infos->pdata[i];
+ info = camel_folder_summary_uid (sub->summary, uid);
if ((camel_message_info_flags(info) & ((CamelVTrashFolder *)vf)->bit))
- vtrash_uid_added((CamelVTrashFolder *)vf, camel_message_info_uid(info), info, hash);
+ vtrash_uid_added((CamelVTrashFolder *)vf, uid, info, hash);
+ camel_message_info_free (info);
}
camel_folder_free_summary(sub, infos);
@@ -542,14 +548,16 @@
start = -1;
last = -1;
- infos = camel_folder_get_summary(sub);
+ infos = camel_folder_get_summary ((CamelFolder *) vf);
for (i=0;i<infos->len;i++) {
- CamelVeeMessageInfo *mi = infos->pdata[i];
- if (mi == NULL || mi->real == NULL)
+ CamelVeeMessageInfo *mi = (CamelVeeMessageInfo *) camel_folder_summary_uid (((CamelFolder *)vf)->summary, infos->pdata[i]);
+ if (mi == NULL || mi->summary == NULL) {
+ camel_message_info_free (mi);
continue;
+ }
- if (mi->real->summary == ssummary) {
+ if (mi->summary == ssummary) {
const char *uid = camel_message_info_uid(mi);
camel_folder_change_info_remove_uid(vf->changes, uid);
@@ -564,6 +572,7 @@
start = last = i;
}
}
+ camel_message_info_free (mi);
}
camel_folder_free_summary(sub, infos);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]