Merge with sync test_sync_folder
authorThomas
Sun, 07 Jul 2019 20:21:39 +0200
branchtest_sync_folder
changeset 2681059624fffc64
parent 2678 01bf495e6075
parent 2680 c13616f01c2b
Merge with sync
AdapterCallbacks.cs
CryptableMailItem.cs
     1.1 --- a/AdapterCallbacks.cs	Fri Jul 05 09:46:03 2019 +0200
     1.2 +++ b/AdapterCallbacks.cs	Sun Jul 07 20:21:39 2019 +0200
     1.3 @@ -141,11 +141,6 @@
     1.4          public void MessageToSend(ref TextMessage msg)
     1.5          {
     1.6              Log.Verbose("MessageToSend: Started");
     1.7 -            try
     1.8 -            {
     1.9 -                Log.SensitiveData("MessageToSend: Started sending message with subject " + msg.ShortMsg);
    1.10 -            }
    1.11 -            catch { }
    1.12  
    1.13              if (PEPMessage.Create(msg, out PEPMessage newMessage) != Globals.ReturnStatus.Success)
    1.14              {
    1.15 @@ -153,6 +148,25 @@
    1.16                  Marshal.ThrowExceptionForHR(0xD /* ERROR_INVALID_DATA */ );
    1.17              }
    1.18  
    1.19 +            // Try to log the message
    1.20 +            try
    1.21 +            {
    1.22 +                if (newMessage.IsSecure)
    1.23 +                {
    1.24 +                    new MsgProcessor().Decrypt(newMessage, out PEPMessage decryptedMessage);
    1.25 +                    string xml = ThisAddIn.PEPEngine.PERToXERSyncMessage(decryptedMessage.ToCOMType());
    1.26 +                    Log.Verbose("MessageToSend: Starting to send message from " + msg.From.Address + ": " + Environment.NewLine + Environment.NewLine + xml);
    1.27 +                }
    1.28 +                else
    1.29 +                {
    1.30 +                    Log.Verbose("MessageToSend: Sending beacon from " + msg.From.Address);
    1.31 +                }
    1.32 +            }
    1.33 +            catch (Exception ex)
    1.34 +            {
    1.35 +                Log.Error("MessageToSend: Error logging message content. " + ex.ToString());
    1.36 +            }
    1.37 +
    1.38              // Now send the message
    1.39              try
    1.40              {
     2.1 --- a/CryptableMailItem.cs	Fri Jul 05 09:46:03 2019 +0200
     2.2 +++ b/CryptableMailItem.cs	Sun Jul 07 20:21:39 2019 +0200
     2.3 @@ -1233,7 +1233,7 @@
     2.4                              // Save processed message data to Outlook
     2.5                              if (processedMessage != null)
     2.6                              {
     2.7 -                                // If message is Autoconsume, set property and save. Do not sync with server.
     2.8 +                                // Check for sync messages
     2.9                                  if (string.IsNullOrEmpty(processedMessage.AutoConsume) == false)
    2.10                                  {
    2.11                                      // If we have a message, add it to the sync queue
    2.12 @@ -1243,8 +1243,25 @@
    2.13                                          ThisAddIn.SyncQueue?.Add(message);
    2.14                                      }
    2.15  
    2.16 -                                    this.internalMailItem.SetPEPProperty(MailItemExtensions.PEPProperty.AutoConsume, "yes");
    2.17 -                                    saveInternalMailItem = true;
    2.18 +                                    // Print the xml content of the sync message
    2.19 +                                    string syncXml = null;
    2.20 +                                    try
    2.21 +                                    {
    2.22 +                                        syncXml = ThisAddIn.PEPEngine.PERToXERSyncMessage(processedMessage.ToCOMType());
    2.23 +                                    }
    2.24 +                                    catch (Exception ex)
    2.25 +                                    {
    2.26 +                                        syncXml = null;
    2.27 +                                        Log.Error("ProcessAndGetRating: Error parsing XER. " + ex.ToString());
    2.28 +                                    }
    2.29 +                                    Log.Verbose("ProcessAndGetRating: Received message: " + (string.IsNullOrEmpty(syncXml) ? "<null>" : (Environment.NewLine + Environment.NewLine + syncXml)));
    2.30 +
    2.31 +                                    // Set the auto consume property if needed
    2.32 +                                    if (this.internalMailItem.GetIsAutoConsume() == false)
    2.33 +                                    {
    2.34 +                                        this.internalMailItem.SetPEPProperty(MailItemExtensions.PEPProperty.AutoConsume, "yes");
    2.35 +                                        saveInternalMailItem = true;
    2.36 +                                    }
    2.37                                  }
    2.38                                  else
    2.39                                  {
     3.1 --- a/Properties/AssemblyInfo.cs	Fri Jul 05 09:46:03 2019 +0200
     3.2 +++ b/Properties/AssemblyInfo.cs	Sun Jul 07 20:21:39 2019 +0200
     3.3 @@ -46,5 +46,5 @@
     3.4  // You can specify all the values or you can default the Build and Revision Numbers 
     3.5  // by using the '*' as shown below:
     3.6  // [assembly: AssemblyVersion("1.0.*")]
     3.7 -[assembly: AssemblyVersion("1.0.213.0")]
     3.8 -[assembly: AssemblyFileVersion("1.0.213.0")]
     3.9 +[assembly: AssemblyVersion("1.0.214.0")]
    3.10 +[assembly: AssemblyFileVersion("1.0.214.0")]
     4.1 --- a/pEpForOutlook.csproj	Fri Jul 05 09:46:03 2019 +0200
     4.2 +++ b/pEpForOutlook.csproj	Sun Jul 07 20:21:39 2019 +0200
     4.3 @@ -44,7 +44,7 @@
     4.4      <PublishUrl>publish\</PublishUrl>
     4.5      <InstallUrl>https://pep-project.org/</InstallUrl>
     4.6      <TargetCulture>en</TargetCulture>
     4.7 -    <ApplicationVersion>1.0.213.0</ApplicationVersion>
     4.8 +    <ApplicationVersion>1.0.214.0</ApplicationVersion>
     4.9      <AutoIncrementApplicationRevision>true</AutoIncrementApplicationRevision>
    4.10      <UpdateEnabled>true</UpdateEnabled>
    4.11      <UpdateInterval>0</UpdateInterval>