modules.builtin
This commit is contained in:
@@ -1,140 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{52826615-7964-47FE-B4B3-1B2DBDF605B9}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Duplicati.Library.Modules.Builtin</RootNamespace>
|
||||
<AssemblyName>Duplicati.Library.Modules.Builtin</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Version>2.0.0.7</Version>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>Duplicati.snk</AssemblyOriginatorKeyFile>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<UpgradeBackupLocation />
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
<UseMSBuildEngine>false</UseMSBuildEngine>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<Copyright>LGPL, Copyright ? Duplicati Team 2015</Copyright>
|
||||
<Product>Duplicati.Library.Modules.Builtin</Product>
|
||||
<Company>Duplicati Team</Company>
|
||||
<Authors>Duplicati Team</Authors>
|
||||
<Description>Buildin modules for Duplicati</Description>
|
||||
<PackageId>ModulesBuiltin</PackageId>
|
||||
<AssemblyName>Duplicati.Library.Modules.Builtin</AssemblyName>
|
||||
<RootNamespace>Duplicati.Library.Modules.Builtin</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
|
||||
<HintPath>..\..\..\..\packages\BouncyCastle.1.8.1\lib\BouncyCastle.Crypto.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Net" />
|
||||
<Reference Include="Mono.Security" />
|
||||
<Reference Include="agsXMPP">
|
||||
<HintPath>..\..\..\..\packages\agsXMPP.1.1.1.0\lib\agsXMPP.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="MimeKit">
|
||||
<HintPath>..\..\..\..\packages\MimeKit.1.18.1\lib\net45\MimeKit.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MailKit">
|
||||
<HintPath>..\..\..\..\packages\MailKit.1.18.1.1\lib\net45\MailKit.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\..\..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<PackageReference Include="Matrix.vNext" Version="2.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
|
||||
<PackageReference Include="MailKit" Version="1.18.1.1" />
|
||||
<PackageReference Include="MimeKit" Version="1.18.1" />
|
||||
<PackageReference Include="Portable.BouncyCastle" Version="1.8.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Logging\Duplicati.Library.Logging.csproj" />
|
||||
<ProjectReference Include="..\..\Interface\Duplicati.Library.Interface.csproj" />
|
||||
<ProjectReference Include="..\..\Snapshots\Duplicati.Library.Snapshots.csproj" />
|
||||
<ProjectReference Include="..\..\Utility\Duplicati.Library.Utility.csproj" />
|
||||
<ProjectReference Include="..\..\Localization\Duplicati.Library.Localization.csproj" />
|
||||
<ProjectReference Include="..\..\Backend\OAuthHelper\Duplicati.Library.OAuthHelper.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="ConsolePasswordInput.cs" />
|
||||
<Compile Include="MSSQLOptions.cs" />
|
||||
<Compile Include="HyperVOptions.cs" />
|
||||
<Compile Include="HttpOptions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ResultExportFormat.cs" />
|
||||
<Compile Include="SendHttpMessage.cs" />
|
||||
<Compile Include="SendMail.cs" />
|
||||
<Compile Include="RunScript.cs" />
|
||||
<Compile Include="SendJabberMessage.cs" />
|
||||
<Compile Include="Strings.cs" />
|
||||
<Compile Include="CheckMonoSSL.cs" />
|
||||
<Compile Include="..\..\..\..\thirdparty\DnsLite\DnsLite.cs">
|
||||
<Link>DnsLite.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="ReportHelper.cs" />
|
||||
<Compile Include="ResultSerialization\ResultFormatSerializerProvider.cs" />
|
||||
<Compile Include="ResultSerialization\IResultFormatSerializer.cs" />
|
||||
<Compile Include="ResultSerialization\DuplicatiFormatSerializer.cs" />
|
||||
<Compile Include="ResultSerialization\JsonFormatSerializer.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Interface\Duplicati.Library.Interface.csproj">
|
||||
<Project>{C5899F45-B0FF-483C-9D38-24A9FCAAB237}</Project>
|
||||
<Name>Duplicati.Library.Interface</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Snapshots\Duplicati.Library.Snapshots.csproj">
|
||||
<Project>{D63E53E4-A458-4C2F-914D-92F715F58ACE}</Project>
|
||||
<Name>Duplicati.Library.Snapshots</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Utility\Duplicati.Library.Utility.csproj">
|
||||
<Project>{DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65}</Project>
|
||||
<Name>Duplicati.Library.Utility</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Logging\Duplicati.Library.Logging.csproj">
|
||||
<Project>{D10A5FC0-11B4-4E70-86AA-8AEA52BD9798}</Project>
|
||||
<Name>Duplicati.Library.Logging</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Localization\Duplicati.Library.Localization.csproj">
|
||||
<Project>{B68F2214-951F-4F78-8488-66E1ED3F50BF}</Project>
|
||||
<Name>Duplicati.Library.Localization</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Backend\OAuthHelper\Duplicati.Library.OAuthHelper.csproj">
|
||||
<Project>{D4C37C33-5E73-4B56-B2C3-DC4A6BAA36BB}</Project>
|
||||
<Name>Duplicati.Library.OAuthHelper</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Duplicati.snk" />
|
||||
<Content Include="run-script-example.bat">
|
||||
<Content Include="run-script-example.sh">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\..\..\..\thirdparty\mozroots\mozroots.exe">
|
||||
<Link>mozroots.exe</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ItemGroup>
|
||||
<Content Include="run-script-example.sh">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="ResultSerialization\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,56 +0,0 @@
|
||||
#region Disclaimer / License
|
||||
// Copyright (C) 2015, The Duplicati Team
|
||||
// http://www.duplicati.com, info@duplicati.com
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
#endregion
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Duplicati.Library.Modules.Builtin")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Duplicati Team")]
|
||||
[assembly: AssemblyProduct("Duplicati.Library.Modules.Builtin")]
|
||||
[assembly: AssemblyCopyright("LGPL, Copyright © Duplicati Team 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("3794e72f-a1ee-4dc7-b658-e8ac8a3aaa3c")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("2.0.0.7")]
|
||||
[assembly: AssemblyVersion("2.0.0.7")]
|
||||
[assembly: AssemblyFileVersion("2.0.0.7")]
|
||||
[assembly: InternalsVisibleTo("Duplicati.Library.Modules.Builtin.UnitTest")]
|
||||
@@ -2,9 +2,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Duplicati.Library.Interface;
|
||||
using Duplicati.Library.Logging;
|
||||
using System.Net.NetworkInformation;
|
||||
using Duplicati.Library.Modules.Builtin.ResultSerialization;
|
||||
using Matrix;
|
||||
using Matrix.Xmpp.Client;
|
||||
using Enum = System.Enum;
|
||||
|
||||
namespace Duplicati.Library.Modules.Builtin
|
||||
{
|
||||
@@ -172,73 +172,52 @@ namespace Duplicati.Library.Modules.Builtin
|
||||
return base.ReplaceTemplate(input, result, subjectline);
|
||||
}
|
||||
|
||||
protected override void SendMessage(string subject, string body)
|
||||
protected override async void SendMessage(string subject, string body)
|
||||
{
|
||||
Exception ex = null;
|
||||
var waitEvent = new System.Threading.ManualResetEvent(false);
|
||||
|
||||
var uri = new Library.Utility.Uri(m_username.Contains("://") ? m_username : "http://" + m_username);
|
||||
var con = new agsXMPP.XmppClientConnection(uri.Host, uri.Port == -1 ? (uri.Scheme == "https" ? 5223 :5222) : uri.Port);
|
||||
if (uri.Scheme == "https")
|
||||
con.UseSSL = true;
|
||||
|
||||
var resource = uri.Path ?? "";
|
||||
if (resource.StartsWith("/", StringComparison.Ordinal))
|
||||
resource = resource.Substring(1);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(resource))
|
||||
resource = "Duplicati";
|
||||
|
||||
agsXMPP.ObjectHandler loginDelegate = (sender) =>
|
||||
|
||||
var xmppClient = new XmppClient
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach(var recipient in m_to.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries))
|
||||
con.Send(new agsXMPP.protocol.client.Message(recipient, agsXMPP.protocol.client.MessageType.chat, body));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logging.Log.WriteWarningMessage(LOGTAG, "XMPPSendError", e, "Failed to send to XMPP messages: {0}", e.Message);
|
||||
ex = e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
waitEvent.Set();
|
||||
}
|
||||
Username = uri.Username,
|
||||
Password = string.IsNullOrWhiteSpace(m_password) ? uri.Password : m_password,
|
||||
XmppDomain = uri.Host,
|
||||
Port = uri.Port == -1 ? (uri.Scheme == "https" ? 5223 : 5222) : uri.Port,
|
||||
Tls = uri.Scheme == "https",
|
||||
Resource = string.IsNullOrWhiteSpace(resource) ? "Duplicati" : resource,
|
||||
HostnameResolver = new Matrix.Network.Resolver.NameResolver()
|
||||
};
|
||||
|
||||
agsXMPP.ErrorHandler errorHandler = (sender, e) => {
|
||||
Logging.Log.WriteWarningMessage(LOGTAG, "XMPPError", e, "An error ocurred in XMPP: {0}", e.Message);
|
||||
|
||||
ex = e;
|
||||
waitEvent.Set();
|
||||
};
|
||||
|
||||
agsXMPP.XmppElementHandler loginErroHandler = (sender, e) => {
|
||||
Logging.Log.WriteWarningMessage(LOGTAG, "XMPPLoginError", null, "Failed to login to XMPP: {0}", e);
|
||||
|
||||
ex = new Exception(string.Format("Failed to log in: {0}", e));
|
||||
waitEvent.Set();
|
||||
};
|
||||
|
||||
con.OnLogin += loginDelegate;
|
||||
con.OnError += errorHandler;
|
||||
con.OnAuthError += loginErroHandler;
|
||||
//con.OnBinded += (sender) => {Console.WriteLine("Binded: {0}", sender);};
|
||||
//con.OnIq += (sender, iq) => {Console.WriteLine("Iq: {0}", iq);};
|
||||
//con.OnReadXml += (sender, xml) => {Console.WriteLine("ReadXml: {0}", xml);};
|
||||
//con.OnWriteXml += (sender, xml) => {Console.WriteLine("writeXml: {0}", xml);};;
|
||||
con.Open(uri.Username, string.IsNullOrWhiteSpace(m_password) ? uri.Password : m_password, resource);
|
||||
|
||||
var timeout = !waitEvent.WaitOne(TimeSpan.FromSeconds(30), true);
|
||||
|
||||
con.OnLogin -= loginDelegate;
|
||||
con.OnError -= errorHandler;
|
||||
con.OnAuthError -= loginErroHandler;
|
||||
// connect so the server
|
||||
await xmppClient.ConnectAsync();
|
||||
|
||||
try
|
||||
{
|
||||
con.Close();
|
||||
foreach (var recipient in m_to.Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries))
|
||||
await xmppClient.SendAsync(new Message(recipient, body, subject));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logging.Log.WriteWarningMessage(LOGTAG, "XMPPSendError", e, "Failed to send to XMPP messages: {0}", e.Message);
|
||||
ex = e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
waitEvent.Set();
|
||||
}
|
||||
|
||||
var timeout = !waitEvent.WaitOne(TimeSpan.FromSeconds(30), true);
|
||||
|
||||
try
|
||||
{
|
||||
// Close connection again
|
||||
await xmppClient.DisconnectAsync();
|
||||
}
|
||||
catch (Exception lex)
|
||||
{
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="agsXMPP" version="1.1.1.0" targetFramework="net45" />
|
||||
<package id="BouncyCastle" version="1.8.1" targetFramework="net45" />
|
||||
<package id="MailKit" version="1.18.1.1" targetFramework="net45" />
|
||||
<package id="MimeKit" version="1.18.1" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user