Pending patch that will significantly change the API and ABI
- From: Philip Van Hoof <spam pvanhoof be>
- To: tinymail-devel-list gnome org
- Subject: Pending patch that will significantly change the API and ABI
- Date: Wed, 24 Oct 2007 17:14:29 +0200
Hi there,
I'm sending this patch so that everybody can prepare for this big API
and cache-format change.
The priority flags will (most likely) become normal flags in stead of
two bit flags. This will most likely be in place during pre release
0.0.4
--
Philip Van Hoof, software developer
home: me at pvanhoof dot be
gnome: pvanhoof at gnome dot org
http://www.pvanhoof.be/blog
Index: trunk/libtinymail-camel/camel-lite/camel/providers/local/camel-maildir-summary.c
===================================================================
--- trunk/libtinymail-camel/camel-lite/camel/providers/local/camel-maildir-summary.c (revision 2881)
+++ trunk/libtinymail-camel/camel-lite/camel/providers/local/camel-maildir-summary.c (working copy)
@@ -190,7 +190,7 @@
/* Non-standard flags */
{ 'A', CAMEL_MESSAGE_ATTACHMENTS },
{ 'I', CAMEL_MESSAGE_PARTIAL },
-/* 7 */ { 'H', CAMEL_MESSAGE_HIGH_PRIORITY },
+ { 'H', CAMEL_MESSAGE_HIGH_PRIORITY },
{ 'N', CAMEL_MESSAGE_NORMAL_PRIORITY },
{ 'L', CAMEL_MESSAGE_LOW_PRIORITY },
{ 'O', CAMEL_MESSAGE_SUSPENDED_PRIORITY },
@@ -208,15 +208,10 @@
/* TNY CHANGE: This used to he ":2,", but VFAT does not allow those characters */
buf = g_alloca (strlen (uid) + strlen ("!2,") + (sizeof (flagbits) / sizeof (flagbits[0])) + 1);
p = buf + sprintf (buf, "%s!2,", uid);
- for (i = 0; i < sizeof (flagbits) / sizeof (flagbits[0]); i++) {
- if (i >= 7) {
- /* Priority flags */
- priority_flag = info->info.info.flags & CAMEL_MESSAGE_HIGH_PRIORITY;
- if ((priority_flag & flagbits[i].flagbit) == flagbits[i].flagbit)
+ for (i = 0; i < sizeof (flagbits) / sizeof (flagbits[0]); i++) {
+ if (info->info.info.flags & flagbits[i].flagbit)
*p++ = flagbits[i].flag;
- } else if (info->info.info.flags & flagbits[i].flagbit)
- *p++ = flagbits[i].flag;
}
*p = 0;
@@ -242,12 +237,7 @@
while ((c = *p++)) {
/* we could assume that the flags are in order, but its just as easy not to require */
for (i=0; i < sizeof(flagbits)/sizeof(flagbits[0]);i++) {
- /* Priority flags */
- if (i >= 7) {
- priority_flag = info->info.info.flags & CAMEL_MESSAGE_HIGH_PRIORITY;
- if (flagbits[i].flag == c && (priority_flag & flagbits[i].flagbit) != flagbits[i].flagbit)
- set |= flagbits[i].flagbit;
- } else if (flagbits[i].flag == c && (info->info.info.flags & flagbits[i].flagbit) == 0)
+ if (flagbits[i].flag == c && (info->info.info.flags & flagbits[i].flagbit) == 0)
set |= flagbits[i].flagbit;
}
}
Index: trunk/libtinymail-camel/camel-lite/camel/camel-folder-summary.h
===================================================================
--- trunk/libtinymail-camel/camel-lite/camel/camel-folder-summary.h (revision 2875)
+++ trunk/libtinymail-camel/camel-lite/camel/camel-folder-summary.h (working copy)
@@ -73,18 +73,19 @@
CAMEL_MESSAGE_CACHED = 1<<6, /* used TNY_HEADER_FLAG_CACHED */
CAMEL_MESSAGE_PARTIAL = 1<<7, /* used TNY_HEADER_FLAG_PARTIAL */
CAMEL_MESSAGE_EXPUNGED = 1<<8, /* used TNY_HEADER_FLAG_EXPUNGED */
- CAMEL_MESSAGE_HIGH_PRIORITY = 1<<9|1<<10, /* used TNY_HEADER_FLAG_HIGH_PRIORITY */
- CAMEL_MESSAGE_NORMAL_PRIORITY = 0<<9|0<<10, /* used TNY_HEADER_FLAG_NORMAL_PRIORITY */
- CAMEL_MESSAGE_LOW_PRIORITY = 0<<9|1<<10, /* used TNY_HEADER_FLAG_LOW_PRIORITY */
- CAMEL_MESSAGE_SUSPENDED_PRIORITY = 1<<9|0<<10, /* TNY_HEADER_FLAG_SUSPENDED_PRIORITY */
+ CAMEL_MESSAGE_HIGH_PRIORITY = 1<<9, /* used TNY_HEADER_FLAG_HIGH_PRIORITY */
+ CAMEL_MESSAGE_NORMAL_PRIORITY = 1<<10, /* used TNY_HEADER_FLAG_NORMAL_PRIORITY */
+ CAMEL_MESSAGE_LOW_PRIORITY = 1<<11, /* used TNY_HEADER_FLAG_LOW_PRIORITY */
+ CAMEL_MESSAGE_SUSPENDED_PRIORITY = 1<<12, /* TNY_HEADER_FLAG_SUSPENDED_PRIORITY */
/* internally used */
- CAMEL_MESSAGE_FOLDER_FLAGGED = 1<<12, /* internally used */
+
CAMEL_MESSAGE_INFO_NEEDS_FREE = 1<<13,/* internally used */
CAMEL_MESSAGE_INFO_UNUSED = 1<<14, /* internally used but available */
CAMEL_MESSAGE_FREED = 1<<15, /* internally used */
CAMEL_MESSAGE_USER = 1<<16, /* free slot */
- CAMEL_MESSAGE_SECURE = 1<<17 /* free slot */
+ CAMEL_MESSAGE_SECURE = 1<<17, /* free slot */
+ CAMEL_MESSAGE_FOLDER_FLAGGED = 1<<18 /* internally used */
} CamelMessageFlags;
Index: trunk/libtinymail-camel/tny-camel-send-queue.c
===================================================================
--- trunk/libtinymail-camel/tny-camel-send-queue.c (revision 2875)
+++ trunk/libtinymail-camel/tny-camel-send-queue.c (working copy)
@@ -343,9 +343,9 @@
TnyHeader *curhdr = TNY_HEADER (tny_iterator_get_current (giter));
TnyHeaderFlags flags = tny_header_get_flags (curhdr);
- flags &= TNY_HEADER_FLAG_PRIORITY;
if (flags & TNY_HEADER_FLAG_SUSPENDED_PRIORITY)
to_remove = g_list_prepend (to_remove, curhdr);
+
g_object_unref (curhdr);
tny_iterator_next (giter);
}
Index: trunk/libtinymail-camel/tny-camel-msg-header.c
===================================================================
--- trunk/libtinymail-camel/tny-camel-msg-header.c (revision 2875)
+++ trunk/libtinymail-camel/tny-camel-msg-header.c (working copy)
@@ -220,7 +220,6 @@
static void
tny_camel_msg_header_set_flags (TnyHeader *self, TnyHeaderFlags mask)
{
- TnyHeaderPriorityFlags priority_flags;
TnyCamelMsgHeader *me = TNY_CAMEL_MSG_HEADER (self);
if (me->decorated) {
@@ -234,30 +233,28 @@
me->partial = FALSE;
}
- priority_flags = mask & TNY_HEADER_FLAG_PRIORITY;
-
camel_medium_remove_header (CAMEL_MEDIUM (me->msg), "X-MSMail-Priority");
camel_medium_remove_header (CAMEL_MEDIUM (me->msg), "X-Priority");
- switch (priority_flags) {
- case TNY_HEADER_FLAG_SUSPENDED_PRIORITY:
+ if (mask & TNY_HEADER_FLAG_SUSPENDED_PRIORITY) {
camel_medium_add_header (CAMEL_MEDIUM (me->msg), "X-MSMail-Priority", "Suspended");
camel_medium_add_header (CAMEL_MEDIUM (me->msg), "X-Priority", "-1");
- break;
+ }
- case TNY_HEADER_FLAG_HIGH_PRIORITY:
+ if (mask & TNY_HEADER_FLAG_HIGH_PRIORITY) {
camel_medium_add_header (CAMEL_MEDIUM (me->msg), "X-MSMail-Priority", "High");
camel_medium_add_header (CAMEL_MEDIUM (me->msg), "X-Priority", "1");
- break;
- case TNY_HEADER_FLAG_LOW_PRIORITY:
+ }
+
+ if (mask & TNY_HEADER_FLAG_LOW_PRIORITY) {
camel_medium_add_header (CAMEL_MEDIUM (me->msg), "X-MSMail-Priority", "Low");
camel_medium_add_header (CAMEL_MEDIUM (me->msg), "X-Priority", "5");
- break;
- case TNY_HEADER_FLAG_NORMAL_PRIORITY:
+ }
+
+ if (mask & TNY_HEADER_FLAG_NORMAL_PRIORITY) {
camel_medium_add_header (CAMEL_MEDIUM (me->msg), "X-MSMail-Priority", "Normal");
camel_medium_add_header (CAMEL_MEDIUM (me->msg), "X-Priority", "3");
- break;
- };
+ }
if (mask & TNY_HEADER_FLAG_ATTACHMENTS) {
camel_medium_remove_header (CAMEL_MEDIUM (me->msg), "X-MS-Has-Attach");
@@ -270,16 +267,18 @@
static void
tny_camel_msg_header_unset_flags (TnyHeader *self, TnyHeaderFlags mask)
{
- TnyHeaderPriorityFlags priority_flags;
TnyCamelMsgHeader *me = TNY_CAMEL_MSG_HEADER (self);
if (me->decorated) {
tny_header_set_flags (me->decorated, mask);
}
- priority_flags = mask & TNY_HEADER_FLAG_PRIORITY;
+ if (mask & TNY_HEADER_FLAG_HIGH_PRIORITY ||
+ mask & TNY_HEADER_FLAG_NORMAL_PRIORITY ||
+ mask & TNY_HEADER_FLAG_LOW_PRIORITY ||
+ mask & TNY_HEADER_FLAG_SUSPENDED_PRIORITY)
+ {
- if (priority_flags) {
camel_medium_remove_header (CAMEL_MEDIUM (me->msg), "X-MSMail-Priority");
camel_medium_remove_header (CAMEL_MEDIUM (me->msg), "X-Priority");
}
Index: trunk/libtinymail/tny-header.c
===================================================================
--- trunk/libtinymail/tny-header.c (revision 2875)
+++ trunk/libtinymail/tny-header.c (working copy)
@@ -581,35 +581,15 @@
{ TNY_HEADER_FLAG_CACHED, "TNY_HEADER_FLAG_CACHED", "cached" },
{ TNY_HEADER_FLAG_PARTIAL, "TNY_HEADER_FLAG_PARTIAL", "partial" },
{ TNY_HEADER_FLAG_EXPUNGED, "TNY_HEADER_FLAG_EXPUNGED", "expunged" },
- { TNY_HEADER_FLAG_PRIORITY, "TNY_HEADER_FLAG_PRIORITY", "priority" },
- { 0, NULL, NULL }
- };
- etype = g_flags_register_static ("TnyHeaderFlags", values);
- }
- return etype;
-}
-
-
-/**
- * tny_header_priority_flags_get_type:
- *
- * GType system helper function
- *
- * Return value: a GType
- **/
-GType
-tny_header_priority_flags_get_type (void)
-{
- static GType etype = 0;
- if (etype == 0) {
- static const GFlagsValue values[] = {
{ TNY_HEADER_FLAG_HIGH_PRIORITY, "TNY_HEADER_FLAG_HIGH_PRIORITY", "high-priority" },
{ TNY_HEADER_FLAG_NORMAL_PRIORITY, "TNY_HEADER_FLAG_NORMAL_PRIORITY", "normal-priority" },
{ TNY_HEADER_FLAG_LOW_PRIORITY, "TNY_HEADER_FLAG_LOW_PRIORITY", "low-priority" },
{ TNY_HEADER_FLAG_SUSPENDED_PRIORITY, "TNY_HEADER_FLAG_SUSPENDED_PRIORITY", "suspended-priority" },
{ 0, NULL, NULL }
};
- etype = g_flags_register_static ("TnyHeaderPriorityFlags", values);
+ etype = g_flags_register_static ("TnyHeaderFlags", values);
}
return etype;
}
+
+
Index: trunk/libtinymail/tny-header.h
===================================================================
--- trunk/libtinymail/tny-header.h (revision 2875)
+++ trunk/libtinymail/tny-header.h (working copy)
@@ -62,24 +62,16 @@
TNY_HEADER_FLAG_CACHED = 1<<6,
TNY_HEADER_FLAG_PARTIAL = 1<<7,
TNY_HEADER_FLAG_EXPUNGED = 1<<8,
- TNY_HEADER_FLAG_PRIORITY = 1<<9|1<<10
- /* Keep below 1<<12 (internally used bits) */
+ TNY_HEADER_FLAG_HIGH_PRIORITY = 1<<9,
+ TNY_HEADER_FLAG_NORMAL_PRIORITY = 1<<10,
+ TNY_HEADER_FLAG_LOW_PRIORITY = 1<<11,
+ TNY_HEADER_FLAG_SUSPENDED_PRIORITY = 1<<12
+
};
typedef enum _TnyHeaderFlags TnyHeaderFlags;
-#define TNY_TYPE_HEADER_PRIORITY_FLAGS (tny_header_priority_flags_get_type())
-enum _TnyHeaderPriorityFlags
-{
- TNY_HEADER_FLAG_HIGH_PRIORITY = 1<<9|1<<10,
- TNY_HEADER_FLAG_NORMAL_PRIORITY = 0<<9|0<<10,
- TNY_HEADER_FLAG_LOW_PRIORITY = 0<<9|1<<10,
- TNY_HEADER_FLAG_SUSPENDED_PRIORITY = 1<<9|0<<10
-};
-
-typedef enum _TnyHeaderPriorityFlags TnyHeaderPriorityFlags;
-
struct _TnyHeaderIface
{
GTypeInterface g;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]