Skip to content

Commit

Permalink
Modifications to incorporate axolotl
Browse files Browse the repository at this point in the history
  • Loading branch information
kwailo888 committed Jan 20, 2016
1 parent 4dfa558 commit bcd8e87
Show file tree
Hide file tree
Showing 286 changed files with 120,475 additions and 209 deletions.
5 changes: 4 additions & 1 deletion WhatsAppApi/Base/WhatsAppBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class WhatsAppBase : WhatsEventBase

public static bool DEBUG;

public static bool DEBUGOutBound;

protected string password;

protected bool hidden;
Expand Down Expand Up @@ -140,7 +142,8 @@ protected void SendData(byte[] data)
}
}

protected void SendNode(ProtocolTreeNode node)
//BRIAN MODIFIED FIXME: SHOULD NOT BE OPENED LIKE THIS INLINE THE Axolotl CLASS INSTEAD
public void SendNode(ProtocolTreeNode node)
{
m_LastSentInfo = DateTime.UtcNow.ToFileTime();
this.SendData(this.BinWriter.Write(node));
Expand Down
395 changes: 223 additions & 172 deletions WhatsAppApi/Base/WhatsSendBase.cs

Large diffs are not rendered by default.

852 changes: 852 additions & 0 deletions WhatsAppApi/Helper/AxolotlManager.cs

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion WhatsAppApi/Helper/BinTreeNodeWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public byte[] Write(ProtocolTreeNode node, bool encrypt = true)
}
else
{
this.DebugPrint(node.NodeString("tx "));
if (WhatsApp.DEBUG && WhatsApp.DEBUGOutBound)
this.DebugPrint(node.NodeString("tx "));
this.writeInternal(node);
}
return this.flushBuffer(encrypt);
Expand Down
35 changes: 17 additions & 18 deletions WhatsAppApi/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 36 additions & 7 deletions WhatsAppApi/WhatsApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ public void SendMessageVcard(string to, string name, string vcard_data)
this.SendMessage(tmpMessage, this.hidden);
}

//BRIAN ADDED FOR LOCATION SHARING
public string SendMessageLocation(string to, string name, double lat, double lon)
{
var tmpMessage = new FMessage(GetJID(to), true) { location_details = name, media_wa_type = FMessage.Type.Location, latitude = lat, longitude = lon };
this.SendMessage(tmpMessage, this.hidden);
return tmpMessage.identifier_key.ToString();
}

public void SendSync(string[] numbers, SyncMode mode = SyncMode.Delta, SyncContext context = SyncContext.Background, int index = 0, bool last = true)
{
List<ProtocolTreeNode> users = new List<ProtocolTreeNode>();
Expand Down Expand Up @@ -69,13 +77,16 @@ public void SendSync(string[] numbers, SyncMode mode = SyncMode.Delta, SyncConte
this.SendNode(node);
}

public void SendMessageImage(string to, byte[] ImageData, ImageType imgtype)
// BRIAN modified added return string ..
public string SendMessageImage(string to, byte[] ImageData, ImageType imgtype)
{
FMessage msg = this.getFmessageImage(to, ImageData, imgtype);
if (msg != null)
{
this.SendMessage(msg);
return msg.identifier_key.ToString();
}
return "";
}

protected FMessage getFmessageImage(string to, byte[] ImageData, ImageType imgtype)
Expand Down Expand Up @@ -127,13 +138,16 @@ protected FMessage getFmessageImage(string to, byte[] ImageData, ImageType imgty
return null;
}

public void SendMessageVideo(string to, byte[] videoData, VideoType vidtype)
// BRIAN MODIFIED FOR RETURN ID
public string SendMessageVideo(string to, byte[] videoData, VideoType vidtype)
{
FMessage msg = this.getFmessageVideo(to, videoData, vidtype);
if (msg != null)
{
this.SendMessage(msg);
return msg.identifier_key.ToString();
}
return "";
}

protected FMessage getFmessageVideo(string to, byte[] videoData, VideoType vidtype)
Expand Down Expand Up @@ -640,12 +654,16 @@ public void SendMessage(FMessage message, bool hidden = false)
}
}

public void SendMessageBroadcast(string[] to, string message)
//BRIAN MODIFIED FOR RETURN ID
public string SendMessageBroadcast(string[] to, string message)
{
this.SendMessageBroadcast(to, new FMessage(string.Empty, true) { data = message, media_wa_type = FMessage.Type.Undefined });
var tmpMessage = new FMessage(string.Empty, true) { data = message, media_wa_type = FMessage.Type.Undefined };
this.SendMessageBroadcast(to, tmpMessage);
return tmpMessage.identifier_key.ToString();
}

public void SendMessageBroadcastImage(string[] recipients, byte[] ImageData, ImageType imgtype)
//BRIAN MODIFIED FOR RETURN ID
public string SendMessageBroadcastImage(string[] recipients, byte[] ImageData, ImageType imgtype)
{
string to;
List<string> foo = new List<string>();
Expand All @@ -658,10 +676,14 @@ public void SendMessageBroadcastImage(string[] recipients, byte[] ImageData, Ima
if (msg != null)
{
this.SendMessage(msg);
return msg.identifier_key.ToString();
}

return "";
}

public void SendMessageBroadcastAudio(string[] recipients, byte[] AudioData, AudioType audtype)
//BRIAN MODIFIED FOR RETURN ID
public string SendMessageBroadcastAudio(string[] recipients, byte[] AudioData, AudioType audtype)
{
string to;
List<string> foo = new List<string>();
Expand All @@ -674,10 +696,14 @@ public void SendMessageBroadcastAudio(string[] recipients, byte[] AudioData, Aud
if (msg != null)
{
this.SendMessage(msg);
return msg.identifier_key.ToString();
}

return "";
}

public void SendMessageBroadcastVideo(string[] recipients, byte[] VideoData, VideoType vidtype)
//BRIAN MODIFIED FOR RETURN ID
public string SendMessageBroadcastVideo(string[] recipients, byte[] VideoData, VideoType vidtype)
{
string to;
List<string> foo = new List<string>();
Expand All @@ -690,7 +716,10 @@ public void SendMessageBroadcastVideo(string[] recipients, byte[] VideoData, Vid
if (msg != null)
{
this.SendMessage(msg);
return msg.identifier_key.ToString();
}

return "";
}

public void SendMessageBroadcast(string[] to, FMessage message)
Expand Down
19 changes: 9 additions & 10 deletions WhatsAppApi/WhatsAppApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WhatsAppApi</RootNamespace>
<AssemblyName>WhatsAppApi</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
Expand All @@ -24,6 +24,7 @@
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<UseVSHostingProcess>false</UseVSHostingProcess>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand Down Expand Up @@ -51,6 +52,7 @@
<Compile Include="Base\ApiBase.cs" />
<Compile Include="Base\WhatsSendBase.cs" />
<Compile Include="Helper\AccountInfo.cs" />
<Compile Include="Helper\AxolotlManager.cs" />
<Compile Include="Helper\BinTreeNodeReader.cs" />
<Compile Include="Helper\BinTreeNodeWriter.cs" />
<Compile Include="Helper\DebugAdapter.cs" />
Expand All @@ -70,11 +72,6 @@
<Compile Include="Parser\FMessage.cs" />
<Compile Include="Parser\FMessageVisitor.cs" />
<Compile Include="Parser\GroupSetting.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Register\WaToken.cs" />
<Compile Include="Register\WhatsRegisterV2.cs" />
<Compile Include="Response\CorruptStreamException.cs" />
Expand All @@ -90,10 +87,12 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Parser\countries.csv" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\mylibaxolotl\mylibaxolotl.csproj">
<Project>{1debda0c-62c7-40a9-b74a-0f086fc2b65d}</Project>
<Name>mylibaxolotl</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
Binary file added mycurve25519/WhatsAppWeb.sdf
Binary file not shown.
93 changes: 93 additions & 0 deletions mycurve25519/WhatsAppWeb.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WhatsAppApi", "..\WhatsAppApi\WhatsAppApi.csproj", "{3FC9096A-C4D2-40C7-BE7B-D98ACAB3BD2B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XSocketsAgentView", "..\XSocketsAgentView\XSocketsAgentView.csproj", "{73298649-E27D-4AD3-81AA-715F2A72D339}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XWhatsAppServiceController", "..\XSocketsService\XWhatsAppServiceController.csproj", "{655E7BFD-6BAE-4263-B0EE-EF0FD19F2806}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XSocketsServiceWhatsAppHost", "..\XSocketsServiceHost\XSocketsServiceWhatsAppHost.csproj", "{6944AAF4-AFA1-4737-902B-33CDD942B0FC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mylibaxolotl", "..\mylibaxolotl\mylibaxolotl.csproj", "{1DEBDA0C-62C7-40A9-B74A-0F086FC2B65D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3FC9096A-C4D2-40C7-BE7B-D98ACAB3BD2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3FC9096A-C4D2-40C7-BE7B-D98ACAB3BD2B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3FC9096A-C4D2-40C7-BE7B-D98ACAB3BD2B}.Debug|x64.ActiveCfg = Debug|Any CPU
{3FC9096A-C4D2-40C7-BE7B-D98ACAB3BD2B}.Debug|x64.Build.0 = Debug|Any CPU
{3FC9096A-C4D2-40C7-BE7B-D98ACAB3BD2B}.Debug|x86.ActiveCfg = Debug|Any CPU
{3FC9096A-C4D2-40C7-BE7B-D98ACAB3BD2B}.Debug|x86.Build.0 = Debug|Any CPU
{3FC9096A-C4D2-40C7-BE7B-D98ACAB3BD2B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3FC9096A-C4D2-40C7-BE7B-D98ACAB3BD2B}.Release|Any CPU.Build.0 = Release|Any CPU
{3FC9096A-C4D2-40C7-BE7B-D98ACAB3BD2B}.Release|x64.ActiveCfg = Release|Any CPU
{3FC9096A-C4D2-40C7-BE7B-D98ACAB3BD2B}.Release|x64.Build.0 = Release|Any CPU
{3FC9096A-C4D2-40C7-BE7B-D98ACAB3BD2B}.Release|x86.ActiveCfg = Release|Any CPU
{3FC9096A-C4D2-40C7-BE7B-D98ACAB3BD2B}.Release|x86.Build.0 = Release|Any CPU
{73298649-E27D-4AD3-81AA-715F2A72D339}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73298649-E27D-4AD3-81AA-715F2A72D339}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73298649-E27D-4AD3-81AA-715F2A72D339}.Debug|x64.ActiveCfg = Debug|Any CPU
{73298649-E27D-4AD3-81AA-715F2A72D339}.Debug|x64.Build.0 = Debug|Any CPU
{73298649-E27D-4AD3-81AA-715F2A72D339}.Debug|x86.ActiveCfg = Debug|Any CPU
{73298649-E27D-4AD3-81AA-715F2A72D339}.Debug|x86.Build.0 = Debug|Any CPU
{73298649-E27D-4AD3-81AA-715F2A72D339}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73298649-E27D-4AD3-81AA-715F2A72D339}.Release|Any CPU.Build.0 = Release|Any CPU
{73298649-E27D-4AD3-81AA-715F2A72D339}.Release|x64.ActiveCfg = Release|Any CPU
{73298649-E27D-4AD3-81AA-715F2A72D339}.Release|x64.Build.0 = Release|Any CPU
{73298649-E27D-4AD3-81AA-715F2A72D339}.Release|x86.ActiveCfg = Release|Any CPU
{73298649-E27D-4AD3-81AA-715F2A72D339}.Release|x86.Build.0 = Release|Any CPU
{655E7BFD-6BAE-4263-B0EE-EF0FD19F2806}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{655E7BFD-6BAE-4263-B0EE-EF0FD19F2806}.Debug|Any CPU.Build.0 = Debug|Any CPU
{655E7BFD-6BAE-4263-B0EE-EF0FD19F2806}.Debug|x64.ActiveCfg = Debug|Any CPU
{655E7BFD-6BAE-4263-B0EE-EF0FD19F2806}.Debug|x64.Build.0 = Debug|Any CPU
{655E7BFD-6BAE-4263-B0EE-EF0FD19F2806}.Debug|x86.ActiveCfg = Debug|Any CPU
{655E7BFD-6BAE-4263-B0EE-EF0FD19F2806}.Debug|x86.Build.0 = Debug|Any CPU
{655E7BFD-6BAE-4263-B0EE-EF0FD19F2806}.Release|Any CPU.ActiveCfg = Release|Any CPU
{655E7BFD-6BAE-4263-B0EE-EF0FD19F2806}.Release|Any CPU.Build.0 = Release|Any CPU
{655E7BFD-6BAE-4263-B0EE-EF0FD19F2806}.Release|x64.ActiveCfg = Release|Any CPU
{655E7BFD-6BAE-4263-B0EE-EF0FD19F2806}.Release|x64.Build.0 = Release|Any CPU
{655E7BFD-6BAE-4263-B0EE-EF0FD19F2806}.Release|x86.ActiveCfg = Release|Any CPU
{655E7BFD-6BAE-4263-B0EE-EF0FD19F2806}.Release|x86.Build.0 = Release|Any CPU
{6944AAF4-AFA1-4737-902B-33CDD942B0FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6944AAF4-AFA1-4737-902B-33CDD942B0FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6944AAF4-AFA1-4737-902B-33CDD942B0FC}.Debug|x64.ActiveCfg = Debug|Any CPU
{6944AAF4-AFA1-4737-902B-33CDD942B0FC}.Debug|x64.Build.0 = Debug|Any CPU
{6944AAF4-AFA1-4737-902B-33CDD942B0FC}.Debug|x86.ActiveCfg = Debug|Any CPU
{6944AAF4-AFA1-4737-902B-33CDD942B0FC}.Debug|x86.Build.0 = Debug|Any CPU
{6944AAF4-AFA1-4737-902B-33CDD942B0FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6944AAF4-AFA1-4737-902B-33CDD942B0FC}.Release|Any CPU.Build.0 = Release|Any CPU
{6944AAF4-AFA1-4737-902B-33CDD942B0FC}.Release|x64.ActiveCfg = Release|Any CPU
{6944AAF4-AFA1-4737-902B-33CDD942B0FC}.Release|x64.Build.0 = Release|Any CPU
{6944AAF4-AFA1-4737-902B-33CDD942B0FC}.Release|x86.ActiveCfg = Release|Any CPU
{6944AAF4-AFA1-4737-902B-33CDD942B0FC}.Release|x86.Build.0 = Release|Any CPU
{1DEBDA0C-62C7-40A9-B74A-0F086FC2B65D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1DEBDA0C-62C7-40A9-B74A-0F086FC2B65D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1DEBDA0C-62C7-40A9-B74A-0F086FC2B65D}.Debug|x64.ActiveCfg = Debug|Any CPU
{1DEBDA0C-62C7-40A9-B74A-0F086FC2B65D}.Debug|x64.Build.0 = Debug|Any CPU
{1DEBDA0C-62C7-40A9-B74A-0F086FC2B65D}.Debug|x86.ActiveCfg = Debug|Any CPU
{1DEBDA0C-62C7-40A9-B74A-0F086FC2B65D}.Debug|x86.Build.0 = Debug|Any CPU
{1DEBDA0C-62C7-40A9-B74A-0F086FC2B65D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1DEBDA0C-62C7-40A9-B74A-0F086FC2B65D}.Release|Any CPU.Build.0 = Release|Any CPU
{1DEBDA0C-62C7-40A9-B74A-0F086FC2B65D}.Release|x64.ActiveCfg = Release|Any CPU
{1DEBDA0C-62C7-40A9-B74A-0F086FC2B65D}.Release|x64.Build.0 = Release|Any CPU
{1DEBDA0C-62C7-40A9-B74A-0F086FC2B65D}.Release|x86.ActiveCfg = Release|Any CPU
{1DEBDA0C-62C7-40A9-B74A-0F086FC2B65D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Tests\Tests.csproj
EndGlobalSection
EndGlobal
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added mycurve25519/mycurve25519.sdf
Binary file not shown.
40 changes: 40 additions & 0 deletions mycurve25519/mycurve25519/AssemblyInfo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//#include "stdafx.h"
#include "pch.h"


using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
using namespace System::Security::Permissions;

//
// 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:AssemblyTitleAttribute(L"mycurve25519")];
[assembly:AssemblyDescriptionAttribute(L"")];
[assembly:AssemblyConfigurationAttribute(L"")];
[assembly:AssemblyCompanyAttribute(L"")];
[assembly:AssemblyProductAttribute(L"mycurve25519")];
[assembly:AssemblyCopyrightAttribute(L"Copyright (c) 2016")];
[assembly:AssemblyTrademarkAttribute(L"")];
[assembly:AssemblyCultureAttribute(L"")];

//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the value or you can default the Revision and Build Numbers
// by using the '*' as shown below:

[assembly:AssemblyVersionAttribute("1.0.*")];

[assembly:ComVisible(false)];

[assembly:CLSCompliantAttribute(true)];
Loading

0 comments on commit bcd8e87

Please sign in to comment.