mirror of
https://github.com/Kopano-dev/kopano-ol-extension.git
synced 2023-10-10 13:37:40 +02:00
[KOE-61] Added plugin capabilities header to Z-Push calls. May still need some renaming to match server capabilities.
This commit is contained in:
parent
79257ea42b
commit
0c7af26b6b
@ -71,6 +71,7 @@ namespace Acacia
|
||||
|
||||
public const string ZPUSH_HEADER_GAB_NAME = "X-Push-GAB-Name";
|
||||
public const string ZPUSH_HEADER_CAPABILITIES = "X-Push-Capabilities";
|
||||
public const string ZPUSH_HEADER_CLIENT_CAPABILITIES = "X-Push-Plugin-Capabilities";
|
||||
public const string ZPUSH_HEADER_PLUGIN = "X-Push-Plugin";
|
||||
public const string ZPUSH_HEADER_VERSION = "X-Z-Push-Version";
|
||||
|
||||
|
@ -63,6 +63,11 @@ namespace Acacia.Features
|
||||
get { return ThisAddIn.Instance.Application; }
|
||||
}
|
||||
|
||||
virtual public void GetCapabilities(ZPushCapabilities caps)
|
||||
{
|
||||
caps.Add(Name);
|
||||
}
|
||||
|
||||
#region Debug options
|
||||
|
||||
public static string GetFeatureName(Type featureType)
|
||||
|
@ -280,7 +280,7 @@ namespace Acacia.ZPush.Connect
|
||||
string url = string.Format(ACTIVESYNC_URL, _account.ServerURL, _account.DeviceId,
|
||||
request.Command, _account.UserName, "WindowsOutlook");
|
||||
|
||||
// Parse the body
|
||||
// Construct the body
|
||||
WBXMLDocument doc = new WBXMLDocument();
|
||||
doc.LoadXml(request.Body);
|
||||
doc.VersionNumber = 1.3;
|
||||
@ -292,6 +292,9 @@ namespace Acacia.ZPush.Connect
|
||||
{
|
||||
Logger.Instance.Trace(this, "Sending request: {0} -> {1}", _account.ServerURL, doc.ToXMLString());
|
||||
content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.ms-sync.wbxml");
|
||||
string caps = ZPushCapabilities.Client.ToString();
|
||||
Logger.Instance.Trace(this, "Sending request: {0} -> {1}: {2}", _account.ServerURL, caps, doc.ToXMLString());
|
||||
content.Headers.Add(Constants.ZPUSH_HEADER_CLIENT_CAPABILITIES, caps);
|
||||
using (HttpResponseMessage response = _client.PostAsync(url, content, _cancel).Result)
|
||||
{
|
||||
return new Response(response);
|
||||
|
@ -1,4 +1,6 @@
|
||||
/// Copyright 2016 Kopano b.v.
|
||||
|
||||
using Acacia.Features;
|
||||
/// Copyright 2016 Kopano b.v.
|
||||
///
|
||||
/// This program is free software: you can redistribute it and/or modify
|
||||
/// it under the terms of the GNU Affero General Public License, version 3,
|
||||
@ -13,7 +15,6 @@
|
||||
/// along with this program.If not, see<http://www.gnu.org/licenses/>.
|
||||
///
|
||||
/// Consult LICENSE file for details
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -50,9 +51,26 @@ namespace Acacia.ZPush
|
||||
return _capabilities.Contains(capability);
|
||||
}
|
||||
|
||||
public void Add(string capability)
|
||||
{
|
||||
_capabilities.Add(capability);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Join(",", _capabilities);
|
||||
}
|
||||
|
||||
public static ZPushCapabilities Client
|
||||
{
|
||||
get
|
||||
{
|
||||
ZPushCapabilities caps = new ZPushCapabilities();
|
||||
foreach (Feature feature in ThisAddIn.Instance.Features)
|
||||
feature.GetCapabilities(caps);
|
||||
|
||||
return caps;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user