Re: [Evolution-hackers] [PATCH] evolution-ews: implement Exchange categories as evolution labels (read only)
On Mon, 2011-06-27 at 13:22 +0100, David Woodhouse wrote: > On Mon, 2011-05-23 at 16:55 +0400, James Bottomley wrote: > > > > I kid you not. > > > > You can see this just by going to your own outlook web server (when you > > highlight a message, you'll see an empty tall oblong, click and it will > > bring up the categories). > > > > Exchange allows arbitrary labels (like we do), but the default ones are > > Blue, Green, Orange, Purple, Red and Yellow. Evolution has label > > mappings for everything apart from Yellow. I figured we should map > > default to default. > > I don't really like mapping 'Red' to 'Important', etc. I was just doing a mapping of what seems to be intended. This is also what the imap camel plugin does (except it maps $label1 <-> important etc.) > Given that we support arbitrary labels on both sides, I think the best > solution is to synchronise the set of labels. If we see a label on an > Exchange message which isn't already known in Evolution, *add* it to > Evolution's list. And if we're trying to add a label to an Exchange item > which isn't already known on the Exchange side, add it there too. I don't think we can ... at least it's an invasive change. There doesn't seem to be a way to show arbitrary labels. The plugins have a label map, which is partly provider supplied and partly user supplied (if the provider allows user labels). If the imap server comes across a label it doesn't have a map for, it just ignores it ... This keeps biting me because I use a custom patch label in my mailboxes for my git workflow. When I move to a new machine, I always have a "WTF where are my patches" moment ... until I remember to add the label mapping. James ___ evolution-hackers mailing list evolution-hackers@gnome.org To change your list options or unsubscribe, visit ... http://mail.gnome.org/mailman/listinfo/evolution-hackers
Re: [Evolution-hackers] [PATCH] evolution-ews: implement Exchange categories as evolution labels (read only)
On Mon, 2011-05-23 at 16:55 +0400, James Bottomley wrote: > > I kid you not. > > You can see this just by going to your own outlook web server (when you > highlight a message, you'll see an empty tall oblong, click and it will > bring up the categories). > > Exchange allows arbitrary labels (like we do), but the default ones are > Blue, Green, Orange, Purple, Red and Yellow. Evolution has label > mappings for everything apart from Yellow. I figured we should map > default to default. I don't really like mapping 'Red' to 'Important', etc. Given that we support arbitrary labels on both sides, I think the best solution is to synchronise the set of labels. If we see a label on an Exchange message which isn't already known in Evolution, *add* it to Evolution's list. And if we're trying to add a label to an Exchange item which isn't already known on the Exchange side, add it there too. -- dwmw2 ___ evolution-hackers mailing list evolution-hackers@gnome.org To change your list options or unsubscribe, visit ... http://mail.gnome.org/mailman/listinfo/evolution-hackers
Re: [Evolution-hackers] [PATCH] evolution-ews: implement Exchange categories as evolution labels (read only)
On Mon, 2011-05-23 at 16:01 +0100, David Woodhouse wrote: > On Mon, 2011-05-23 at 17:46 +0400, James Bottomley wrote: > > I think you probably need me to get a feel for evolution development > > initially before you set me loose in the repo ... > > Why? It's mostly my baby, and I'm a kernel hacker too... :) > > > Incidentally, I presume you use bugzilla for bugs? I just ran across > > one experimenting with Categories. Apparently if I change the category > > on the outlook webserver, it causes us to delete the email (with or > > without my patch applied). > > That'll be a bug that Chen introduced on Thursday. I've reverted those > commits for now. We're currently between Alpha and Beta releases; I > don't mind a little bit of 'churn', but I draw the line at data loss :) > > Sorry about that. Sorry for it, its a bad assumption I made. Fixed it in master. - Chenthill. > > Note that HEAD doesn't compile at the moment because of something > committed by Pavel Ocheretny last night. > I'll change that to a real, working email address and *POKE*. > ___ evolution-hackers mailing list evolution-hackers@gnome.org To change your list options or unsubscribe, visit ... http://mail.gnome.org/mailman/listinfo/evolution-hackers
Re: [Evolution-hackers] [PATCH] evolution-ews: implement Exchange categories as evolution labels (read only)
On Mon, 2011-05-23 at 17:46 +0400, James Bottomley wrote: > I think you probably need me to get a feel for evolution development > initially before you set me loose in the repo ... Why? It's mostly my baby, and I'm a kernel hacker too... :) > Incidentally, I presume you use bugzilla for bugs? I just ran across > one experimenting with Categories. Apparently if I change the category > on the outlook webserver, it causes us to delete the email (with or > without my patch applied). That'll be a bug that Chen introduced on Thursday. I've reverted those commits for now. We're currently between Alpha and Beta releases; I don't mind a little bit of 'churn', but I draw the line at data loss :) Sorry about that. Note that HEAD doesn't compile at the moment because of something committed by Pavel Ocheretny last night. I'll change that to a real, working email address and *POKE*. -- dwmw2 ___ evolution-hackers mailing list evolution-hackers@gnome.org To change your list options or unsubscribe, visit ... http://mail.gnome.org/mailman/listinfo/evolution-hackers
Re: [Evolution-hackers] [PATCH] evolution-ews: implement Exchange categories as evolution labels (read only)
On Mon, 2011-05-23 at 14:34 +0100, David Woodhouse wrote: > On Mon, 2011-05-23 at 17:08 +0400, James Bottomley wrote: > > > > > could you use Gnome's bugzilla for patch reviews, please? > > > > Consider this more an RFC requiring feedback than a patch requiring > > review. > > For Evo-EWS I'm much happier with patches in email anyway. I find it a > lot easier to review patches, and to apply them with 'git am', if they > are in email. > > I'm going to get notified by email *anyway* — that's how I learn about > new bugs in bugzilla too. So it's just a question of whether all the > information I need is right there in the email when I first see it, or > whether I have to go grubbing around in a web browser to find it, > download it, and then play silly buggers to apply it and get the > authorship right. OK, if that's what you want, that's fine by me, since it's my usual workflow. > In fact, James, if you're going to make a habit of sending patches for > Evo-EWS why not just get an account in GNOME git and apply them > directly? :) > > http://live.gnome.org/NewAccounts I think you probably need me to get a feel for evolution development initially before you set me loose in the repo ... Incidentally, I presume you use bugzilla for bugs? I just ran across one experimenting with Categories. Apparently if I change the category on the outlook webserver, it causes us to delete the email (with or without my patch applied). James ___ evolution-hackers mailing list evolution-hackers@gnome.org To change your list options or unsubscribe, visit ... http://mail.gnome.org/mailman/listinfo/evolution-hackers
Re: [Evolution-hackers] [PATCH] evolution-ews: implement Exchange categories as evolution labels (read only)
On Mon, 2011-05-23 at 17:08 +0400, James Bottomley wrote: > > > could you use Gnome's bugzilla for patch reviews, please? > > Consider this more an RFC requiring feedback than a patch requiring > review. For Evo-EWS I'm much happier with patches in email anyway. I find it a lot easier to review patches, and to apply them with 'git am', if they are in email. I'm going to get notified by email *anyway* — that's how I learn about new bugs in bugzilla too. So it's just a question of whether all the information I need is right there in the email when I first see it, or whether I have to go grubbing around in a web browser to find it, download it, and then play silly buggers to apply it and get the authorship right. In fact, James, if you're going to make a habit of sending patches for Evo-EWS why not just get an account in GNOME git and apply them directly? :) http://live.gnome.org/NewAccounts -- dwmw2 ___ evolution-hackers mailing list evolution-hackers@gnome.org To change your list options or unsubscribe, visit ... http://mail.gnome.org/mailman/listinfo/evolution-hackers
Re: [Evolution-hackers] [PATCH] evolution-ews: implement Exchange categories as evolution labels (read only)
On Mon, 2011-05-23 at 14:21 +0200, Milan Crha wrote: > On Mon, 2011-05-23 at 14:41 +0400, James Bottomley wrote: > > This patch ... > > Hi, > could you use Gnome's bugzilla for patch reviews, please? Consider this more an RFC requiring feedback than a patch requiring review. James > It has couple reasons why: > a) bugzilla is meant for that > b) bugzilla has integrated tools for patches and their review > c) it's easier to follow (broken) commit with bugzilla reference than >with some mailing list message to which the reference cannot be >added such easily like a bug reference. > > Basically all the tools used in Gnome are ready and capable of bugzilla > and makes life much easier when it is used, especially the part with > commits and git and so on. There used to be evolution-patches message > list, but it was dropped because the history showed it as an unusable > medium for patch submission. That's how I understood it. > Thanks and bye, > Milan > > ___ > evolution-hackers mailing list > evolution-hackers@gnome.org > To change your list options or unsubscribe, visit ... > http://mail.gnome.org/mailman/listinfo/evolution-hackers ___ evolution-hackers mailing list evolution-hackers@gnome.org To change your list options or unsubscribe, visit ... http://mail.gnome.org/mailman/listinfo/evolution-hackers
Re: [Evolution-hackers] [PATCH] evolution-ews: implement Exchange categories as evolution labels (read only)
On Mon, 2011-05-23 at 12:19 +0100, David Woodhouse wrote: > On Mon, 2011-05-23 at 14:41 +0400, James Bottomley wrote: > > > > + > > + /* this is a mapping from Exchange/Outlook categories to > > +* evolution labels based on the standard colours */ > > + const gchar *labels[] = { > > + "Red Category", "$Labelimportant", > > + "Orange Category", "$Labelwork", > > + "Green Category", "$Labelpersonal", > > + "Blue Category", "$Labeltodo", > > + "Purple Category", "$Labellater", > > + NULL, NULL > > + }; > > That's the only reason I might *not* want to apply your patch > immediately, right? > > Is there a "correct" way to handle the mapping? Does Exchange really > just store them by colour? I kid you not. You can see this just by going to your own outlook web server (when you highlight a message, you'll see an empty tall oblong, click and it will bring up the categories). Exchange allows arbitrary labels (like we do), but the default ones are Blue, Green, Orange, Purple, Red and Yellow. Evolution has label mappings for everything apart from Yellow. I figured we should map default to default. James ___ evolution-hackers mailing list evolution-hackers@gnome.org To change your list options or unsubscribe, visit ... http://mail.gnome.org/mailman/listinfo/evolution-hackers
Re: [Evolution-hackers] [PATCH] evolution-ews: implement Exchange categories as evolution labels (read only)
On Mon, 2011-05-23 at 14:41 +0400, James Bottomley wrote: > This patch ... Hi, could you use Gnome's bugzilla for patch reviews, please? It has couple reasons why: a) bugzilla is meant for that b) bugzilla has integrated tools for patches and their review c) it's easier to follow (broken) commit with bugzilla reference than with some mailing list message to which the reference cannot be added such easily like a bug reference. Basically all the tools used in Gnome are ready and capable of bugzilla and makes life much easier when it is used, especially the part with commits and git and so on. There used to be evolution-patches message list, but it was dropped because the history showed it as an unusable medium for patch submission. That's how I understood it. Thanks and bye, Milan ___ evolution-hackers mailing list evolution-hackers@gnome.org To change your list options or unsubscribe, visit ... http://mail.gnome.org/mailman/listinfo/evolution-hackers
Re: [Evolution-hackers] [PATCH] evolution-ews: implement Exchange categories as evolution labels (read only)
On Mon, 2011-05-23 at 14:41 +0400, James Bottomley wrote: > > + > + /* this is a mapping from Exchange/Outlook categories to > +* evolution labels based on the standard colours */ > + const gchar *labels[] = { > + "Red Category", "$Labelimportant", > + "Orange Category", "$Labelwork", > + "Green Category", "$Labelpersonal", > + "Blue Category", "$Labeltodo", > + "Purple Category", "$Labellater", > + NULL, NULL > + }; That's the only reason I might *not* want to apply your patch immediately, right? Is there a "correct" way to handle the mapping? Does Exchange really just store them by colour? -- dwmw2 ___ evolution-hackers mailing list evolution-hackers@gnome.org To change your list options or unsubscribe, visit ... http://mail.gnome.org/mailman/listinfo/evolution-hackers
[Evolution-hackers] [PATCH] evolution-ews: implement Exchange categories as evolution labels (read only)
This patch is a proof of concept for adding evolution labels to an exchange back end. The outlook categories perform roughly the same function, and evolution even mirrors their colour scheme. This patch allows evolution to fill in the labels from the EWS Category element. That means that any colour you add to a message via the categories in outlook (or the outlook web server) automatically appears in evolution. The next phase will be to allow evolution to modify the categories. Signed-off-by: James Bottomley diff --git a/src/camel/camel-ews-folder.c b/src/camel/camel-ews-folder.c index cd5ac7c..af0753a 100644 --- a/src/camel/camel-ews-folder.c +++ b/src/camel/camel-ews-folder.c @@ -59,7 +59,7 @@ which needs to be better organized via functions */ #define MAX_ATTACHMENT_SIZE 1*1024*1024 /*In bytes*/ -#define SUMMARY_ITEM_FLAGS "item:ResponseObjects item:Sensitivity item:Importance" +#define SUMMARY_ITEM_FLAGS "item:ResponseObjects item:Sensitivity item:Importance item:Categories" #define ITEM_PROPS "item:Subject item:DateTimeReceived item:DateTimeSent item:DateTimeCreated item:Size " \ "item:HasAttachments item:InReplyTo" #define SUMMARY_ITEM_PROPS ITEM_PROPS " " SUMMARY_ITEM_FLAGS @@ -1301,7 +1301,7 @@ camel_ews_folder_init (CamelEwsFolder *ews_folder) folder->permanent_flags = CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_SEEN | - CAMEL_MESSAGE_FORWARDED; + CAMEL_MESSAGE_FORWARDED | CAMEL_MESSAGE_USER; folder->folder_flags = CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY | CAMEL_FOLDER_HAS_SEARCH_CAPABILITY; diff --git a/src/camel/camel-ews-utils.c b/src/camel/camel-ews-utils.c index d983130..83057ac 100644 --- a/src/camel/camel-ews-utils.c +++ b/src/camel/camel-ews-utils.c @@ -651,6 +651,58 @@ camel_ews_utils_sync_deleted_items (CamelEwsFolder *ews_folder, GSList *items_de g_slist_free (items_deleted); } +static const gchar* +ews_utils_rename_label(const gchar *cat) +{ + gint i; + + /* this is a mapping from Exchange/Outlook categories to +* evolution labels based on the standard colours */ + const gchar *labels[] = { + "Red Category", "$Labelimportant", + "Orange Category", "$Labelwork", + "Green Category", "$Labelpersonal", + "Blue Category", "$Labeltodo", + "Purple Category", "$Labellater", + NULL, NULL + }; + + if (!cat || !*cat) + return ""; + + for (i = 0; labels[i]; i += 2) { + if (!g_ascii_strcasecmp (cat, labels[i])) + return labels[i + 1]; + } + return cat; +} + +static void +ews_utils_merge_server_user_flags (EEwsItem *item, CamelEwsMessageInfo *mi) +{ + GSList *list = NULL; + const GSList *p; + const CamelFlag *flag; + + /* transfer camel flags to a list */ + for (flag = camel_message_info_user_flags (&mi->info); flag; +flag = flag->next) + list = g_slist_append(list, (gchar *)flag->name); + + /* we're transferring from server only, so just dump them */ + for (p = list; p; p = p->next) { + camel_flag_set(&mi->info.user_flags, p->data, 0); + } + //g_slist_foreach(list, (GFunc)g_free, NULL); + g_slist_free(list); + + /* now transfer over all the categories */ + for (p = e_ews_item_get_categories (item); p; p = p->next) { + camel_flag_set(&mi->info.user_flags, + ews_utils_rename_label(p->data), 1); + } +} + static gint ews_utils_get_server_flags (EEwsItem *item) { @@ -833,8 +885,9 @@ camel_ews_utils_sync_updated_items (CamelEwsFolder *ews_folder, GSList *items_up gint server_flags; server_flags = ews_utils_get_server_flags (item); + ews_utils_merge_server_user_flags (item, mi); if (camel_ews_update_message_info_flags (folder->summary, (CamelMessageInfo *)mi, - server_flags, NULL)) +server_flags, NULL)) camel_folder_change_info_change_uid (ci, mi->info.uid); mi->change_key = g_strdup (id->change_key); diff --git a/src/server/e-ews-item.c b/src/server/e-ews-item.c index fd42ea9..9787958 100644 --- a/src/server/e-ews-item.c +++ b/src/server/e-ews-item.c @@ -169,6 +169,12 @@ struct _EEwsItemPrivate { EwsId *associated_calendar_item_id; + /* the evolution labels are implemented as exchange +* Categories. These appear in the message headers as +* Keywords: and are set and extracted from the EWS server as +* which is a string array valued XML element */ + GSList *categories;