On Mon, 2013-03-04 at 23:14 +0100, Christof Schulze wrote:
> Hi Patrick,
> 
> Am Montag, 4. März 2013, 09:43:01 schrieb Patrick Ohly:
> > On Sun, 2013-03-03 at 19:23 +0100, Christof Schulze wrote:
> > > for two weeks now, I am using syncevolution to synchronize my nokia
> > > e51 phone to a webdav backend. Akonadi is using the same webdav
> > > backend to access the same data. The phone, as well as akonadi are in
> > > read-write mode.
> 
> > > The only modification that was necessary was the template. It rewrites
> > > all email addresses in vcards that were edited by akonadi such that
> > > the type is set to Internet when the vcard is delivered to the phone.
> > So it really was the missing TYPE=INTERNET which caused emails to not be
> > shown by the phone? I wasn't quite certain whether it had helped. If it
> > did, then it probably should become the default, at least for all Nokia
> > phones => https://bugs.freedesktop.org/show_bug.cgi?id=61784
> Yes that did solve it.

I'm attaching the patch that I intend to add to 1.3.99.3. I've verified
it with a Nokia N97 mini.

>  There is a minor glitch but I am not sure where
> its source is. Email addresses show up twice in many contacts now but
> this might be a result of the back and forth when trying your patch.

It could be the result of slow sync conflict resolution: the contact is
matched based on the name, then all emails are preserved because the
flags were different. Just a theory, though.

> > I should get that into 1.3.99.3 before releasing it.
> It would be great. It reduces data loss - because after a re-sync all
> email addresses would otherwise be purged from all contacts.

Is that because the phone not only ignores EMAIL without TYPE=INTERNET
in the UI, it also doesn't send them back?

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.

>From 762d6c09107bb95f1941458e6f43e49efed1158f Mon Sep 17 00:00:00 2001
From: Patrick Ohly <[email protected]>
Date: Tue, 5 Mar 2013 16:12:48 +0100
Subject: [PATCH] Nokia: always add TYPE=INTERNET to EMAIL (FDO #61784)

Without the explicit TYPE=INTERNET, email addresses sent to a Nokia
e51 were not shown by the phone and even got lost eventually (when
syncing back?).

This commit ensures that the type is set for all emails sent to any
Nokia phone, because there may be other phones which need it and
phones which don't, shouldn't mind. This was spot-checked with a N97
mini, which works fine with and without the INTERNET type.

This behavior can be disabled again for specific Nokia phones by
adding a remote rule which sets the addInternetEmail session variable
to FALSE again.

Non-Nokia phones can enable the feature in a similar way, by setting
the variable to TRUE.
---
 src/syncevo/SyncContext.cpp                          |    2 ++
 src/syncevo/configs/datatypes/02vcard-types.xml      |    2 ++
 src/syncevo/configs/remoterules/server/00_nokia.xml  |    7 ++++++-
 src/syncevo/configs/scripting/08vcard-email-type.xml |   12 ++++++++++++
 4 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 src/syncevo/configs/scripting/08vcard-email-type.xml

diff --git a/src/syncevo/SyncContext.cpp b/src/syncevo/SyncContext.cpp
index e4a2486..b475ccc 100644
--- a/src/syncevo/SyncContext.cpp
+++ b/src/syncevo/SyncContext.cpp
@@ -2354,6 +2354,8 @@ void SyncContext::getConfigXML(string &xml, string &configname)
         "      delayedabort = FALSE;\n"
         "      INTEGER alarmTimeToUTC;\n"
         "      alarmTimeToUTC = FALSE;\n"
+        "      INTEGER addInternetEmail;\n"
+        "      addInternetEmail = FALSE;\n"
         "      INTEGER stripUID;\n"
         "      stripUID = FALSE;\n"
         "    ]]></sessioninitscript>\n";
diff --git a/src/syncevo/configs/datatypes/02vcard-types.xml b/src/syncevo/configs/datatypes/02vcard-types.xml
index 41c2172..eaae659 100644
--- a/src/syncevo/configs/datatypes/02vcard-types.xml
+++ b/src/syncevo/configs/datatypes/02vcard-types.xml
@@ -13,6 +13,7 @@
         $VCARD_OUTGOING_ADDREV_SCRIPT
         $VCARD_OUTGOING_PHOTO_INLINING_SCRIPT
         $VCARD_OUTGOING_PHOTO_VALUE_SCRIPT
+        $VCARD_OUTGOING_EMAILTYPE_SCRIPT
       ]]></outgoingscript>
     </datatype>
 
@@ -29,5 +30,6 @@
         $VCARD_OUTGOING_ADDREV_SCRIPT
         $VCARD_OUTGOING_PHOTO_INLINING_SCRIPT
         $VCARD_OUTGOING_PHOTO_VALUE_SCRIPT
+        $VCARD_OUTGOING_EMAILTYPE_SCRIPT
       ]]></outgoingscript>
     </datatype>
diff --git a/src/syncevo/configs/remoterules/server/00_nokia.xml b/src/syncevo/configs/remoterules/server/00_nokia.xml
index 0649f8b..ffae408 100644
--- a/src/syncevo/configs/remoterules/server/00_nokia.xml
+++ b/src/syncevo/configs/remoterules/server/00_nokia.xml
@@ -4,11 +4,16 @@
       <finalrule>no</finalrule>
 
       <!-- At least the Nokia E55 is only able to deal with alarm times in UTC,
-           later confirmed for other Nokia models. BMC #1657 -->
+           later confirmed for other Nokia models. BMC #1657.
+           Nokia E51 only handles EMAIL with TYPE=INTERNET. Assume that this
+           is needed for all Nokia phones - doesn't hurt with a N97, anyway.
+           FDO #61784.
+      -->
       <rulescript><![CDATA[
         // no dates before 1980
         mindate=(TIMESTAMP)"19800101T000000Z";
         alarmTimeToUTC = TRUE;
+        addInternetEmail = TRUE;
       ]]></rulescript>
       
       <!-- 5800 and N97mini are confirmed to report bogus maximum size
diff --git a/src/syncevo/configs/scripting/08vcard-email-type.xml b/src/syncevo/configs/scripting/08vcard-email-type.xml
new file mode 100644
index 0000000..c0b6b75
--- /dev/null
+++ b/src/syncevo/configs/scripting/08vcard-email-type.xml
@@ -0,0 +1,12 @@
+    <macro name="VCARD_OUTGOING_EMAILTYPE_SCRIPT"><![CDATA[
+        if (SESSIONVAR("addInternetEmail")) {
+            INTEGER i;
+            i = 0;
+            while (i < SIZE(EMAIL)) {
+                if (EMAIL[i]) {
+                    EMAIL_FLAGS[i] = EMAIL_FLAGS[i] | 8; // INTERNET = B3 in vCard profile
+                }
+                i = i + 1;
+            }
+        }
+    ]]></macro>
-- 
1.7.10.4

_______________________________________________
SyncEvolution mailing list
[email protected]
http://lists.syncevolution.org/listinfo/syncevolution

Reply via email to