diff options
author | Vadim Dashevskiy <watcherhd@gmail.com> | 2015-05-31 18:18:59 +0000 |
---|---|---|
committer | Vadim Dashevskiy <watcherhd@gmail.com> | 2015-05-31 18:18:59 +0000 |
commit | ee073251eba82de6a4632b467b1574baddd6aeaa (patch) | |
tree | 5fbadbc4e2068d60fba4de2ee9f7170bd2506582 | |
parent | afdb3f779b8d9059a474882ad78974b3ce021ff7 (diff) |
SkypeClassic moved to deprecated
git-svn-id: http://svn.miranda-ng.org/main/trunk@13943 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
75 files changed, 2 insertions, 13538 deletions
diff --git a/bin10/mir_dev.sln b/bin10/mir_dev.sln index 61ab220a6a..dcc6575399 100644 --- a/bin10/mir_dev.sln +++ b/bin10/mir_dev.sln @@ -380,8 +380,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VKontakte", "..\protocols\V EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StartupSilence", "..\plugins\StartupSilence\StartupSilence_10.vcxproj", "{7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SkypeClassic", "..\protocols\SkypeClassic\SkypeClassic_10.vcxproj", "{5F9243AE-C6C9-4F42-B670-67A97767A50B}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MirandaG15", "..\plugins\MirandaG15\MirandaG15_10.vcxproj", "{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcurl", "..\plugins\FTPFileYM\curl\lib\vc6libcurl_10.vcxproj", "{01F9E227-06F5-4BED-907F-402CA7DFAFE6}"
@@ -1758,14 +1756,6 @@ Global {7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}.Release|Win32.Build.0 = Release|Win32
{7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}.Release|x64.ActiveCfg = Release|x64
{7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}.Release|x64.Build.0 = Release|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|Win32.ActiveCfg = Debug|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|Win32.Build.0 = Debug|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|x64.ActiveCfg = Debug|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|x64.Build.0 = Debug|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|Win32.ActiveCfg = Release|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|Win32.Build.0 = Release|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|x64.ActiveCfg = Release|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|x64.Build.0 = Release|x64
{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}.Debug|Win32.ActiveCfg = Debug|Win32
{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}.Debug|Win32.Build.0 = Debug|Win32
{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}.Debug|x64.ActiveCfg = Debug|x64
diff --git a/bin10/mir_full.sln b/bin10/mir_full.sln index 06068d3fc8..87f570cc7d 100644 --- a/bin10/mir_full.sln +++ b/bin10/mir_full.sln @@ -387,8 +387,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VKontakte", "..\protocols\V EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StartupSilence", "..\plugins\StartupSilence\StartupSilence_10.vcxproj", "{7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SkypeClassic", "..\protocols\SkypeClassic\SkypeClassic_10.vcxproj", "{5F9243AE-C6C9-4F42-B670-67A97767A50B}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MirandaG15", "..\plugins\MirandaG15\MirandaG15_10.vcxproj", "{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RemovePersonalSettings", "..\plugins\RemovePersonalSettings\rps_10.vcxproj", "{0D3EF7C4-B99C-E87E-D0D8-C6E003B7EB65}"
@@ -1769,14 +1767,6 @@ Global {7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}.Release|Win32.Build.0 = Release|Win32
{7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}.Release|x64.ActiveCfg = Release|x64
{7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}.Release|x64.Build.0 = Release|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|Win32.ActiveCfg = Debug|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|Win32.Build.0 = Debug|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|x64.ActiveCfg = Debug|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|x64.Build.0 = Debug|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|Win32.ActiveCfg = Release|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|Win32.Build.0 = Release|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|x64.ActiveCfg = Release|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|x64.Build.0 = Release|x64
{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}.Debug|Win32.ActiveCfg = Debug|Win32
{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}.Debug|Win32.Build.0 = Debug|Win32
{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}.Debug|x64.ActiveCfg = Debug|x64
diff --git a/bin10/mir_full_pro.sln b/bin10/mir_full_pro.sln index 489b397a8c..3bb6827b28 100644 --- a/bin10/mir_full_pro.sln +++ b/bin10/mir_full_pro.sln @@ -421,8 +421,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VKontakte", "..\protocols\V EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StartupSilence", "..\plugins\StartupSilence\StartupSilence_10.vcxproj", "{7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SkypeClassic", "..\protocols\SkypeClassic\SkypeClassic_10.vcxproj", "{5F9243AE-C6C9-4F42-B670-67A97767A50B}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MirandaG15", "..\plugins\MirandaG15\MirandaG15_10.vcxproj", "{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RemovePersonalSettings", "..\plugins\RemovePersonalSettings\rps_10.vcxproj", "{0D3EF7C4-B99C-E87E-D0D8-C6E003B7EB65}"
@@ -1801,14 +1799,6 @@ Global {7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}.Release|Win32.Build.0 = Release|Win32
{7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}.Release|x64.ActiveCfg = Release|x64
{7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}.Release|x64.Build.0 = Release|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|Win32.ActiveCfg = Debug|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|Win32.Build.0 = Debug|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|x64.ActiveCfg = Debug|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|x64.Build.0 = Debug|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|Win32.ActiveCfg = Release|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|Win32.Build.0 = Release|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|x64.ActiveCfg = Release|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|x64.Build.0 = Release|x64
{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}.Debug|Win32.ActiveCfg = Debug|Win32
{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}.Debug|Win32.Build.0 = Debug|Win32
{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}.Debug|x64.ActiveCfg = Debug|x64
@@ -2043,7 +2033,6 @@ Global {0E046380-14CA-4C23-A807-8C678519A605} = {B913F0DC-E0A2-4973-A65C-BB00A51DB9E4}
{475ED6ED-C311-4188-ACB2-1C41830B22EE} = {B913F0DC-E0A2-4973-A65C-BB00A51DB9E4}
{BF6E1942-7E42-4564-9DF5-FD0A00D71173} = {B913F0DC-E0A2-4973-A65C-BB00A51DB9E4}
- {5F9243AE-C6C9-4F42-B670-67A97767A50B} = {B913F0DC-E0A2-4973-A65C-BB00A51DB9E4}
{BE22A21F-73B7-453F-86A0-B867F0056490} = {B913F0DC-E0A2-4973-A65C-BB00A51DB9E4}
{13E796AD-BEA4-4213-A1B8-E18E2397E544} = {B913F0DC-E0A2-4973-A65C-BB00A51DB9E4}
{D3B4DDFF-D3A5-4452-AE9D-B43B3C97C821} = {B913F0DC-E0A2-4973-A65C-BB00A51DB9E4}
diff --git a/bin12/mir_dev.sln b/bin12/mir_dev.sln index 076ae6c2d3..02e647501f 100644 --- a/bin12/mir_dev.sln +++ b/bin12/mir_dev.sln @@ -387,8 +387,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VKontakte", "..\protocols\V EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StartupSilence", "..\plugins\StartupSilence\StartupSilence_12.vcxproj", "{7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SkypeClassic", "..\protocols\SkypeClassic\SkypeClassic_12.vcxproj", "{5F9243AE-C6C9-4F42-B670-67A97767A50B}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MirandaG15", "..\plugins\MirandaG15\MirandaG15_12.vcxproj", "{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcurl", "..\plugins\FTPFileYM\curl\lib\vc6libcurl_12.vcxproj", "{01F9E227-06F5-4BED-907F-402CA7DFAFE6}"
@@ -1773,14 +1771,6 @@ Global {7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}.Release|Win32.Build.0 = Release|Win32
{7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}.Release|x64.ActiveCfg = Release|x64
{7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}.Release|x64.Build.0 = Release|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|Win32.ActiveCfg = Debug|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|Win32.Build.0 = Debug|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|x64.ActiveCfg = Debug|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|x64.Build.0 = Debug|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|Win32.ActiveCfg = Release|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|Win32.Build.0 = Release|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|x64.ActiveCfg = Release|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|x64.Build.0 = Release|x64
{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}.Debug|Win32.ActiveCfg = Debug|Win32
{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}.Debug|Win32.Build.0 = Debug|Win32
{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}.Debug|x64.ActiveCfg = Debug|x64
diff --git a/bin12/mir_full.sln b/bin12/mir_full.sln index ab0515a95a..8f84593b0c 100644 --- a/bin12/mir_full.sln +++ b/bin12/mir_full.sln @@ -389,8 +389,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VKontakte", "..\protocols\V EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StartupSilence", "..\plugins\StartupSilence\StartupSilence_12.vcxproj", "{7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SkypeClassic", "..\protocols\SkypeClassic\SkypeClassic_12.vcxproj", "{5F9243AE-C6C9-4F42-B670-67A97767A50B}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MirandaG15", "..\plugins\MirandaG15\MirandaG15_12.vcxproj", "{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RemovePersonalSettings", "..\plugins\RemovePersonalSettings\rps_12.vcxproj", "{0D3EF7C4-B99C-E87E-D0D8-C6E003B7EB65}"
@@ -1771,14 +1769,6 @@ Global {7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}.Release|Win32.Build.0 = Release|Win32
{7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}.Release|x64.ActiveCfg = Release|x64
{7B072B7F-E2AA-4935-AAF5-5BEF99665AD3}.Release|x64.Build.0 = Release|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|Win32.ActiveCfg = Debug|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|Win32.Build.0 = Debug|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|x64.ActiveCfg = Debug|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Debug|x64.Build.0 = Debug|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|Win32.ActiveCfg = Release|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|Win32.Build.0 = Release|Win32
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|x64.ActiveCfg = Release|x64
- {5F9243AE-C6C9-4F42-B670-67A97767A50B}.Release|x64.Build.0 = Release|x64
{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}.Debug|Win32.ActiveCfg = Debug|Win32
{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}.Debug|Win32.Build.0 = Debug|Win32
{8ACA3C8B-BDFA-47B2-8578-069555BA05B3}.Debug|x64.ActiveCfg = Debug|x64
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 6ebafacb3e..7282f2f045 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -524,16 +524,14 @@ static renameTable[] = { _T("rss.dll"), _T("Plugins\\newsaggregator.dll") },
{ _T("dbx_3x.dll"), _T("Plugins\\dbx_mmap.dll") },
{ _T("actman30.dll"), _T("Plugins\\actman.dll") },
+ { _T("skype.dll"), _T("Plugins\\skypeweb.dll") },
+ { _T("skypeclassic.dll"), _T("Plugins\\skypeweb.dll") },
#if MIRANDA_VER >= 0x0A00
{ _T("dbx_mmap_sa.dll"), _T("Plugins\\dbx_mmap.dll") },
{ _T("dbx_tree.dll"), _T("Plugins\\dbx_mmap.dll") },
{ _T("rc4.dll"), NULL },
{ _T("athena.dll"), NULL },
- { _T("skype.dll"), NULL },
- { _T("skypekit.exe"), NULL },
-#else
- { _T("skype.dll"), _T("Plugins\\skypeclassic.dll") },
#endif
{ _T("proto_newsaggr.dll"), _T("Icons\\proto_newsaggregator.dll") },
diff --git a/protocols/SkypeClassic/SkypeClassic_10.vcxproj b/protocols/SkypeClassic/SkypeClassic_10.vcxproj deleted file mode 100644 index 12b8d4d3ff..0000000000 --- a/protocols/SkypeClassic/SkypeClassic_10.vcxproj +++ /dev/null @@ -1,281 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <ItemGroup>
- <None Include="res\add.ico" />
- <None Include="res\away.ico" />
- <None Include="res\blockcon.ico" />
- <None Include="res\call.bmp" />
- <None Include="res\call.ico" />
- <None Include="res\chat.ico" />
- <None Include="res\DND.ico" />
- <None Include="res\error.ico" />
- <None Include="res\hang_up.ico" />
- <None Include="res\hold.ico" />
- <None Include="res\import.ico" />
- <None Include="res\invisible.ico" />
- <None Include="res\Invite.ico" />
- <None Include="res\message.ico" />
- <None Include="res\NA.ico" />
- <None Include="res\occupied.ico" />
- <None Include="res\offline.ico" />
- <None Include="res\online.ico" />
- <None Include="res\phone.ico" />
- <None Include="res\resume.ico" />
- <None Include="res\skype.ico" />
- <None Include="res\skypeout.ico" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="res\Resource.rc" />
- <ResourceCompile Include="res\Version.rc" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\alogon.cpp" />
- <ClCompile Include="src\contacts.cpp" />
- <ClCompile Include="src\debug.cpp" />
- <ClCompile Include="src\filexfer.cpp" />
- <ClCompile Include="src\gchat.cpp" />
- <ClCompile Include="src\memlist.cpp" />
- <ClCompile Include="src\msglist.cpp" />
- <ClCompile Include="src\msgq.cpp" />
- <ClCompile Include="src\pthread.cpp" />
- <ClCompile Include="src\skype.cpp" />
- <ClCompile Include="src\skypeapi.cpp" />
- <ClCompile Include="src\skypeopt.cpp" />
- <ClCompile Include="src\skypeprofile.cpp" />
- <ClCompile Include="src\skypesvc.cpp" />
- <ClCompile Include="src\utf8.cpp" />
- <ClCompile Include="src\util.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="src\alogon.h" />
- <ClInclude Include="src\contacts.h" />
- <ClInclude Include="src\debug.h" />
- <ClInclude Include="src\filexfer.h" />
- <ClInclude Include="src\gchat.h" />
- <ClInclude Include="src\memlist.h" />
- <ClInclude Include="src\msglist.h" />
- <ClInclude Include="src\msgq.h" />
- <ClInclude Include="src\pthread.h" />
- <ClInclude Include="src\resource.h" />
- <ClInclude Include="src\skype.h" />
- <ClInclude Include="src\skypeapi.h" />
- <ClInclude Include="src\skypeopt.h" />
- <ClInclude Include="src\skypeprofile.h" />
- <ClInclude Include="src\skypesvc.h" />
- <ClInclude Include="src\utf8.h" />
- <ClInclude Include="src\util.h" />
- <ClInclude Include="src\version.h" />
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{5F9243AE-C6C9-4F42-B670-67A97767A50B}</ProjectGuid>
- <ProjectName>SkypeClassic</ProjectName>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
- <IgnoreImportLibrary>true</IgnoreImportLibrary>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ExceptionHandling>false</ExceptionHandling>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <RuntimeTypeInfo>false</RuntimeTypeInfo>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <CompileAs>Default</CompileAs>
- <AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PrecompiledHeaderFile>skype.h</PrecompiledHeaderFile>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <FloatingPointModel>Fast</FloatingPointModel>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>wsock32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib;</AdditionalLibraryDirectories>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <ExceptionHandling>false</ExceptionHandling>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <RuntimeTypeInfo>false</RuntimeTypeInfo>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <CompileAs>Default</CompileAs>
- <AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PrecompiledHeaderFile>skype.h</PrecompiledHeaderFile>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <FloatingPointModel>Fast</FloatingPointModel>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>wsock32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib;</AdditionalLibraryDirectories>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <Optimization>Full</Optimization>
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
- <OmitFramePointers>true</OmitFramePointers>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>true</StringPooling>
- <ExceptionHandling>false</ExceptionHandling>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <CompileAs>Default</CompileAs>
- <AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PrecompiledHeaderFile>skype.h</PrecompiledHeaderFile>
- <FloatingPointModel>Fast</FloatingPointModel>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>wsock32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib;</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <Optimization>Full</Optimization>
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
- <OmitFramePointers>true</OmitFramePointers>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>true</StringPooling>
- <ExceptionHandling>false</ExceptionHandling>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <RuntimeTypeInfo>false</RuntimeTypeInfo>
- <WarningLevel>Level3</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <CompileAs>Default</CompileAs>
- <AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PrecompiledHeaderFile>skype.h</PrecompiledHeaderFile>
- <FloatingPointModel>Fast</FloatingPointModel>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>wsock32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib;</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file diff --git a/protocols/SkypeClassic/SkypeClassic_10.vcxproj.filters b/protocols/SkypeClassic/SkypeClassic_10.vcxproj.filters deleted file mode 100644 index 6f460cab98..0000000000 --- a/protocols/SkypeClassic/SkypeClassic_10.vcxproj.filters +++ /dev/null @@ -1,202 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Header Files">
- <UniqueIdentifier>{4d6279cf-842d-458b-95b8-c0cebb4a5d71}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl</Extensions>
- </Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{eb3a2f1b-05b7-4a39-b7d9-41be6256999e}</UniqueIdentifier>
- <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
- </Filter>
- <Filter Include="Source Files">
- <UniqueIdentifier>{611796ce-4528-47d4-872f-4744f22bd19d}</UniqueIdentifier>
- <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
- </Filter>
- <Filter Include="Resource Files\Icons">
- <UniqueIdentifier>{828cf039-0d45-4b22-a188-b4be83331fe5}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\alogon.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\contacts.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\debug.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\gchat.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\memlist.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\msglist.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\msgq.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\pthread.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\skype.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\skypeapi.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\skypeopt.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\skypeprofile.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\skypesvc.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\utf8.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\util.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\filexfer.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="src\alogon.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\contacts.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\debug.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\gchat.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\memlist.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\msglist.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\msgq.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\pthread.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\resource.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\skype.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\skypeapi.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\skypeopt.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\skypeprofile.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\skypesvc.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\utf8.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\util.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\version.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\filexfer.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <None Include="res\skypeout.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\add.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\away.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\call.bmp">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\call.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\chat.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\DND.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\error.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\hang_up.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\hold.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\import.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\invisible.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\Invite.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\message.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\NA.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\occupied.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\offline.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\online.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\phone.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\resume.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\skype.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\blockcon.ico">
- <Filter>Resource Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="res\Resource.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- <ResourceCompile Include="res\Version.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file diff --git a/protocols/SkypeClassic/SkypeClassic_12.vcxproj b/protocols/SkypeClassic/SkypeClassic_12.vcxproj deleted file mode 100644 index 0742b2cfff..0000000000 --- a/protocols/SkypeClassic/SkypeClassic_12.vcxproj +++ /dev/null @@ -1,263 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <ItemGroup>
- <None Include="res\add.ico" />
- <None Include="res\away.ico" />
- <None Include="res\call.bmp" />
- <None Include="res\call.ico" />
- <None Include="res\chat.ico" />
- <None Include="res\DND.ico" />
- <None Include="res\error.ico" />
- <None Include="res\hang_up.ico" />
- <None Include="res\hold.ico" />
- <None Include="res\import.ico" />
- <None Include="res\invisible.ico" />
- <None Include="res\Invite.ico" />
- <None Include="res\message.ico" />
- <None Include="res\NA.ico" />
- <None Include="res\occupied.ico" />
- <None Include="res\offline.ico" />
- <None Include="res\online.ico" />
- <None Include="res\phone.ico" />
- <None Include="res\resume.ico" />
- <None Include="res\skype.ico" />
- <None Include="res\skypeout.ico" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="res\Resource.rc" />
- <ResourceCompile Include="res\Version.rc" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\alogon.cpp" />
- <ClCompile Include="src\contacts.cpp" />
- <ClCompile Include="src\debug.cpp" />
- <ClCompile Include="src\filexfer.cpp" />
- <ClCompile Include="src\gchat.cpp" />
- <ClCompile Include="src\memlist.cpp" />
- <ClCompile Include="src\msglist.cpp" />
- <ClCompile Include="src\msgq.cpp" />
- <ClCompile Include="src\pthread.cpp" />
- <ClCompile Include="src\skype.cpp" />
- <ClCompile Include="src\skypeapi.cpp" />
- <ClCompile Include="src\skypeopt.cpp" />
- <ClCompile Include="src\skypeprofile.cpp" />
- <ClCompile Include="src\skypesvc.cpp" />
- <ClCompile Include="src\utf8.cpp" />
- <ClCompile Include="src\util.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="src\alogon.h" />
- <ClInclude Include="src\contacts.h" />
- <ClInclude Include="src\debug.h" />
- <ClInclude Include="src\filexfer.h" />
- <ClInclude Include="src\gchat.h" />
- <ClInclude Include="src\memlist.h" />
- <ClInclude Include="src\msglist.h" />
- <ClInclude Include="src\msgq.h" />
- <ClInclude Include="src\pthread.h" />
- <ClInclude Include="src\resource.h" />
- <ClInclude Include="src\skype.h" />
- <ClInclude Include="src\skypeapi.h" />
- <ClInclude Include="src\skypeopt.h" />
- <ClInclude Include="src\skypeprofile.h" />
- <ClInclude Include="src\skypesvc.h" />
- <ClInclude Include="src\utf8.h" />
- <ClInclude Include="src\util.h" />
- <ClInclude Include="src\version.h" />
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{5F9243AE-C6C9-4F42-B670-67A97767A50B}</ProjectGuid>
- <ProjectName>SkypeClassic</ProjectName>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v120_xp</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v120_xp</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>v120_xp</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v120_xp</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
- <IgnoreImportLibrary>true</IgnoreImportLibrary>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ExceptionHandling>false</ExceptionHandling>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <RuntimeTypeInfo>false</RuntimeTypeInfo>
- <WarningLevel>Level3</WarningLevel>
- <AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <FloatingPointModel>Fast</FloatingPointModel>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>wsock32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin12\lib</AdditionalLibraryDirectories>
- <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
- <SubSystem>Windows</SubSystem>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <ExceptionHandling>false</ExceptionHandling>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <RuntimeTypeInfo>false</RuntimeTypeInfo>
- <WarningLevel>Level3</WarningLevel>
- <AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <FloatingPointModel>Fast</FloatingPointModel>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>wsock32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin12\lib</AdditionalLibraryDirectories>
- <SubSystem>Windows</SubSystem>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <Optimization>Full</Optimization>
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
- <OmitFramePointers>true</OmitFramePointers>
- <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>true</StringPooling>
- <ExceptionHandling>false</ExceptionHandling>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <WarningLevel>Level3</WarningLevel>
- <AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <FloatingPointModel>Fast</FloatingPointModel>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>wsock32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin12\lib</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Windows</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <Optimization>Full</Optimization>
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
- <OmitFramePointers>true</OmitFramePointers>
- <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <StringPooling>true</StringPooling>
- <ExceptionHandling>false</ExceptionHandling>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <RuntimeTypeInfo>false</RuntimeTypeInfo>
- <WarningLevel>Level3</WarningLevel>
- <AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <FloatingPointModel>Fast</FloatingPointModel>
- <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <ResourceCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>wsock32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin12\lib</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Windows</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- </Link>
- </ItemDefinitionGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file diff --git a/protocols/SkypeClassic/SkypeClassic_12.vcxproj.filters b/protocols/SkypeClassic/SkypeClassic_12.vcxproj.filters deleted file mode 100644 index 16a77cbe39..0000000000 --- a/protocols/SkypeClassic/SkypeClassic_12.vcxproj.filters +++ /dev/null @@ -1,199 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Header Files">
- <UniqueIdentifier>{4d6279cf-842d-458b-95b8-c0cebb4a5d71}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl</Extensions>
- </Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{eb3a2f1b-05b7-4a39-b7d9-41be6256999e}</UniqueIdentifier>
- <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
- </Filter>
- <Filter Include="Source Files">
- <UniqueIdentifier>{611796ce-4528-47d4-872f-4744f22bd19d}</UniqueIdentifier>
- <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
- </Filter>
- <Filter Include="Resource Files\Icons">
- <UniqueIdentifier>{9b506b49-0e1a-4af6-98e1-0dfa19a4d6c8}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\alogon.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\contacts.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\debug.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\gchat.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\memlist.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\msglist.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\msgq.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\pthread.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\skype.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\skypeapi.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\skypeopt.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\skypeprofile.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\skypesvc.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\utf8.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\util.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\filexfer.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="src\alogon.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\contacts.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\debug.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\gchat.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\memlist.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\msglist.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\msgq.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\pthread.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\resource.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\skype.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\skypeapi.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\skypeopt.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\skypeprofile.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\skypesvc.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\utf8.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\util.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\version.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\filexfer.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <None Include="res\add.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\away.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\call.bmp">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\call.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\chat.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\DND.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\error.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\hang_up.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\hold.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\import.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\invisible.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\Invite.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\message.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\NA.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\occupied.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\offline.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\online.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\phone.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\resume.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\skype.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- <None Include="res\skypeout.ico">
- <Filter>Resource Files\Icons</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="res\Resource.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- <ResourceCompile Include="res\Version.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file diff --git a/protocols/SkypeClassic/docs/changelog.txt b/protocols/SkypeClassic/docs/changelog.txt deleted file mode 100644 index 60526b1116..0000000000 --- a/protocols/SkypeClassic/docs/changelog.txt +++ /dev/null @@ -1,330 +0,0 @@ -NOTES
------
-
- You have to manually disable popup of messages in SKYPE, as there is
- currently no function in the API to do this
- Got to File/Options/Instant messages and disable the checkboxes there
-
-
-CODE
-----
- Currently a real mess. At least I splitted it up a bit now.
- But hey, it kinda works... ;)
-
-HISTORY
--------
-
-0.0.0.45 - ! "NA" and "Free for chat" status are available again; NA is supported by skype and Free for chat
- uses skypes "Skype Me" status; better leave it that way
- ! changes to the mood message of a contact were only visible after a status change
- ! plugin was crashing when status changed to offline and a proxy is used
-
-0.0.0.44 - ! menu item "Hang up (Skype)" was show on none skype contacts
- ! fixed serveral bugs in skype startup (including starting skype twice)
- ! show connecting state correctly
- ! hangup while ringing caused a state where contact isnt callable anymore
- * removed "NA" and "Free for chat" status
-
-0.0.0.43 - + Added option to suppress summary chat message after call is finished (jls17)
- ! Fix hangup causes a dial command if opponent hangs up a little bit earlier (jls17)
- ! removed empty chat message on incoming call
- ! empty mood message is send to skype correctly
-
-
-0.0.0.42 - + Added a trick to identify skype 3 version (fingerprint)
-0.0.0.41 - + Added option to enter user name and password. (Patch by NN)
-
-0.0.0.40 - + Support for new core service: get avatar caps
- + Option to show/hide default avatar for contacts
- + Hide Skype Avatar page in user details if >= #27
-
-0.0.0.39 - + Voice service support in normall calls - no support for SkypeOut yet (pescuma)
- ! Made options dialog a little bit smaller, removed frame and set bold frame for popups (pescuma)
- + Add more status to manage for away message
-
-0.0.0.38 - ! Fix the load for pre 0.7.0 #17 build
- * Patch by pescuma for avatar.
-
-0.0.0.37 - ! Avoid empty message from myself on first message received.
- + Add the Get user avatar interface
- * Change the get user info thread
- * code cleanup
- + Support for miranda 0.8
- ! Correct use of folder plugin (using "avatar cache folder"\SKYPE).
-
-0.0.0.36 - ! When settings skype offline, first set proto off then contacts.
- * move the broadcast of status change out of if statement in status change.
- * Set contacts ofline on plugin load (avoid skype contact to be online if starts skype is not checked)
- ! Fix the use of datapath for portable skype
- * Allow to choose no splash - no tray - minimized even if start skype with miranda is not checked.
- ! Fix bug with timestamp in irc
-
-0.0.0.35 - * Use unicode nick, status message, city and country in skype profile.
- ! Fix for sending status change when offline
- * Do not send message to skype if not attached (avoid trying to connect to api at startup)
- ! Fix crash on recieving message with groupchat checked.
-
-0.0.0.34 - + Try to identify if chat message comes from a group chat or not
- + Add a option to flag group chat message as read if not using chat.dll for group chat.
- ! Fix the check of message type (group chat or normal)
-
-0.0.0.33 - ! Fix for flags of event and metacontact (thanks SJE)
- * Next step to custom popup support (in popup option page)
- ! Fix infinite for error popup
-
-0.0.0.32 - ! Improvemnt of the Action message support.
- ! Fix empty message on first chat with a contact.
-
-0.0.0.31 - + First step to Action Message support ( /me )
- + Updater support for File Listing.
- + First step to a custom popup for call notification.
-
-0.0.0.30 - + Add an option to enable/disable the timezone patch
-
-0.0.0.29 - ! Try to fix the bug (set skype offline when closing miranda)
-
-0.0.0.28 - * Improved portable skype integration
-
-0.0.0.27 - * Try to fix the start using custom command line
- + Close skype using custom command line too
-
-0.0.0.26 - + Add a way to use a custom command line to start skype.
-
-0.0.0.25 - ! patch from markcs about timezones.
- ! shutdown patch by sje
-
-0.0.0.24 - * Change options dialog (use tabsrmm uxtheme)
-
-0.0.0.23 - ! Wrong db entry name for cellular (cellucar)
- + Set mirver using is video capabale to identify skype 2.0 user
-
-0.0.0.22 - * Options page redesigned
- * Work around to force refresh of avatar in MyDetail (w8 the avatar change service)
- * Change Skype protocol to Skype in options->Network
- * Free buffer in status message retrieve
- * First step to a details info page.
-
-0.0.0.21 - * Some minor bugfixes
- * Severe bugfix: Message sending routine worked incorrectly (no errors were shown
- even if there were sending-errors)
- * Removed PingPong - thread in favour of WM_TIMER
- * Fixed critical section unlocking in skypeapi.c. In certain cases, critical sections
- were not left correctly.
- * Fixed a bug that caused Miranda to crash on exit with Newstatusnotify plugin
- (thanks to TioDuke for reporting)
- * Hopefully fixed the nasty bug that caused Miranda to lockup on exit.
-
-0.0.0.20 - * Split service and options in two new cpp file.
- * Put the default attemps number to 10
-
-0.0.0.19 - * Add avatar support for own user only (no api to ge contacts avatar)
- * Add set status message.
- * Add Get status message for contact where viewing contact details
- * Change icons (thanks to Faith Healer)
- * Updater support (BETA ONLY)
- * DBeEditor known module support
- * Mods to avoid warning in VC++ 8
- * Implement the MyDetail requested services
-
-0.0.0.18 - * HOTFIX - Double File-Transfer icon removed. Please note that you can't send files
- via drag & drop, because of the nature of Skype API - Skype wants to open its own
- "File/Open" dialog, so I cannot supply a path to the file to be sent, therefore I
- had to add a seperate File-sending function rather than using Miranda's function.
-
-0.0.0.17 - * Startup of Skype in a seperate thread was not solved properly. Now it should really
- start in background
- * The hack for the statusmode-bug is optional in the settings and is turned off
- per default. (Thx to Eddie Hung for reporting problems and help)
- * Added an ugly hack for the Skype-API offline bug (grr.. )
- * Nickname is now set correctly. To cleanup the existing Nicks, please go to
- the options page an push the "Cleanup Nicknames" button.
- This will clean out entries where the Nick was set to the Skype handle
- * Fixed a bug in the message sending routine that caused errors in communication
- (missed messages in Skype that were not fetched..)
- * Added "Hold call" feature while calling
- * Added support for conference calls (if a second user is calling while you
- are in a conversation, you can now choose whether to block the call or let
- the user join you in a conference with the existing caller or to put the
- other caller on hold)
- * Fixed a bug in the code for adding users that were just searched via the
- Skype search-window but never have been in contact list.
- * Fixed some bugs (memleak, nick error, ..) in the Search-Routine for
- Skype-contacts. (thx to Deadman for reporting)
- * Fixed a bug with unknown SKYPE_IN contacts
- * Added file-sending capability (requires new Skype-version)
- * Did a litte code-cleanup
- * Adding / Removing contacts can now be done via the Miranda standard-dialogs if
- you use the newest Skype-Version
- * With the new Skype-version you are able to handle Authorisation-Requests via Miranda
- now.
-
-0.0.0.16 - * Fixed a severe memory-allocation bug in utf8-encoded messages that caused random
- crashes (oops :-O) - Thanks to Ary Dvoretz for reporting.
- * Bug in SkypeStatusMode-Bug fix from last release fixed (protocol stayed offline)
- * Now onlinestatus for SkypeOut-Contacts is configurable
- * Made Menu-Options translatable
- * Added support for calling SkypeOut-Phonenumbers. You can now dial a PSTN-Number
- by calling "Do a SkypeOut call" in the main menu (or top toolbar if the
- toptoolbar plugin is installed) and entering a number or
- by right-clicking on a non-Skype contact and selecting "Call using SkypeOut",
- if there is a phone-Number entry in the User's-Details.
- This, of course, is only working if you have SkypeOut privilege
-
-0.0.0.15 - * Fixed a crash on Miranda-exit when error occured on Skype-Protocol start
- * Fixed Bug #0000006: Now user is asked if he wants to enable the Protocol
- for the current profile, if he starts with a new profile.
- * Fixed Bug #0000002: Now interfacing with Skype is really stopped on going
- offline if the option is enabled. (PingPong-thread killed)
- - This also applies on closing Skype
- * Fixed a memory leak in MsgFetchThread that appeared in the last version because
- of the groupchat-implementation (free() within wrong if clause, ooops ;)
- * Fixed Bug #0000005: When there is a msg from a user that is not on Skype's contact
- list, the user is now added PALF_TEMPORARY and disappears again on next Miranda-start
- * Implemented a fix for Skype API's statusmode bug reported by Markus Mützel:
- If you change the online status while Skype is still connecting, Skype changes to
- the FIRST state that it was requested to change to, after going online, instead of
- the LAST state. However the bug was not reproducable for me.
- * Fixed broken popup-support (I hope)
- * CHANGE of behaviour (inspired by Bug #0000007):
- If you turn off "Start Skype with Miranda", the plugin wouldn't search for a
- running Skype instance anymore.
- * Now when going online and Skype is not launched, Skype will be launched via a
- seperate thread (in background) so that Miranda isn't blocked while Skype is loading
- * Options Dlg. should now be translateable too.
-
-0.0.0.14 -
- * Miranda crash on exit if Skype was not found installed should be
- fixed by now.
- * Implemented compatibility layer for Skype API Protocol V3 and above.
- * Removed some useless code introduced in 0.0.0.12
- * Added some fixes made by TioDuke (thank you!)
- - Using your own Nick instead of your Skype-Handle in conversations
- - LastName 3rd token & above are not ignored any more
- - Status modes "On the phone" and "out to lunch" are mapped now
- * Fixed a bug that caused "Skype API not available" messages under high load.
- (thanks to Romeo28 for testing!)
- * Fixed a bug that caused Message sending thread to wait forever if sending
- a message times out (causing dead threads)
- * Skype contact list should be synced now when Skype-Status changes.
- (thx to Markus Mützel for Bugreport)
- * Implemented a garbage collector that removes old messages from queue
- in order to prevent possible memory exhaustion
- * Added option to disable all modal Error-message dialog boxes (as people
- keep telling me that they are annoyed by them)
- * Added langpack support for error messages
- * Added option to increase the time the protocol is waiting for Skype
- * Added groupchat functions. WARNING: For testing purposes only!
- Currently there is a memleak which I cannot find, but even worse,
- Skype API doesn't seem to support sending to a groupchat, inviting etc.
- So this is currently only experimental! When you send to a groupchat you
- currently send single messages to every user seperately. Skype staff
- didn't answer my question about sending to groupchats so far, so it
- depends on them when this feature will be available for real use.
-
-0.0.0.13 - A few minor fixes:
- * Logging off users shouldn't flood the StatusNotify-Plugin now.
- * Popup-plugin can be enabled/disabled in the options dlg.
- * Implemented support for SkypeOut contacts (they caused crashes)
- * Now using Nick instead of Skype-Handle as Contact list name on
- adding new users, if it is available.
-
-0.0.0.12 - Bugfixing because of strange Skype API behaviour:
- * Adding of contacts that are just searched, but not added in Skype
- should be prevented now.
- * Version number correct again.
-
-0.0.0.11 - Only minor bugfixes:
- * The gender in user-details is now saved correctly to the DB
- (thanks to LeON for the hint!)
- * The Apply-Button should now be disabled in the options DLG by default
- (thanks to sje for the bug report)
- * Contactlist should be reinitialized after a SYNC-Problem now.
- * Bug with usernames that contain commas should be fixed
- * Protocol messages are now shown as popups if Popup-plugin is installed
-
-0.0.0.10 - * Hopefully recovery after sync problem works a bit better now
- (Sync-Problem Messages are no longer shown)
- * Now you can hang up a call directly from a contact's context menu
- * Now implemented support for using Skype over a network. You can use
- the included skypeproxy service to in/output Skype API messages
- on a socket and can connect to it with the plugin.
- So you can, for example, launch the skypeproxy service on your
- Windows-server (eeek! :P) and control Skype from your workstation
- using Miranda. (requested feature by foosmate)
- * Now you can accept incoming calls via Miranda (or hang them up)
- * The status mode bug (clist status menu was not updated properly)
- should be fixed by now.
- * The logfile in the dbeug-build should now always be written to the
- Miranda directory.
-
-0.0.0.9 - * Fixed bug with error when starting Skype with Miranda ("Wheee...")
- * As Skype seems to use new, UNDOCUMENTED Message types (I think it's
- a severe Skype-API bug) I adapted the plugin so that it works
- with new API now. This fixes the problem of not being able to receive
- messages in new Skype versions.
- Skype now sends "MESSAGE TYPE SAID" instead of "MESSAGE TYPE TEXT",
- the bug has been reported to Skype forum.
- (http://forum.skype.com/viewtopic.php?t=15435)
- * Fixed a memory leak in Message-receiving routine
- * Added UTF8-support for Contact properties (does this fix something?)
- * Fixed a memory leak in Startup-routine
- * Finally renamed Plugin from SKYPE_PROTOCOL to SKYPE internally.
- Hopefully it will upgrade your existing DB seamlessly.
- * Now all threads should be sync with Miranda as I'm using the pthread-
- functions "borrowed" from Yahoo protocol.
-
-0.0.0.8 - * Now there is support for the "Occupied" mode, which is mapped to DND
- This is useful for users who do a global statusmodechange so that Skype
- gets to "Occupied" state instead of staying online.
- * Now the protocol doesn't disable itself when you chose to not start
- Skype on startup, instead it stays offline and starts Skype when you
- try to go online.
-
-0.0.0.7 - * Fixed a bug that caused a lockup on Plugin startup (when a Window was not
- reacting to the HWND_BROADCAST) (thx to Cool Blue)
- * Fixed a bug in the Startup-procedure..
- * Now Skype doesn't go offline when you close Miranda (thx to Egodust)
- * Now it should really work unter WIN98 (thx to TioDuke for testing)
- * Implemented feature for Shutting down Skype on going offline and
- restarting Skype on changing to online mode again, as many people requested.
-
-0.0.0.6 - * Added feature requests from kreisquadratur:
- * Option to disable Skype-Menuitems
- * Fixed bug with Apply-Button
- * Using a nicer Skype-Icon now
- * Now using Skype-Timestamp for messages
- * Implementing importing history from skype (see contextmenu of contact)
- * Fixed bug with processing first message of MESSAGES - List
- * Found out, that RegisterClass() doesn't work for UNICODE-Programs on
- non-UNICODE win98, therefore return-value check for RegisterClass removed
- * Fixed a bug that caused a "We got a Sync problem :("
-
-0.0.0.5 - * Fixed a bug that caused the plugin to crash with bigger contact lists
- (Skype API was flooded on startup)
-
-0.0.0.4 - * Missed messages are fetched now
- * User details work now
- * More verbose error msgs now (to help Win98 user debugging his problem)
- * Added option for starting skype with miranda and shutting down
- Skype when closing miranda.
- * You can now chose the command line options to pass to Skype on startup
- * Hopefully the bug with multiple Call - Entries per user is fixed now
- * Protocol name is now "Skype", not "Skype_protocol" - Remember this
- when updating, so DELETE skype_protocol.dll first!!
- * Secured Message Queue with a Mutex
- * Fixed a Message-receiving bug that could cause delays in message-processing
- * Adding a Contact in Skype now also adds it to Miranda immediately
- (Deleting should also work, but doesn't because of a Skype API bug)
- * Added searching for contacts, but this feature seems to be quite useless,
- as Skype API doesn't support adding contacts, so you still have to add
- your contacts in the Skype program, sorry
- In order to do this comfortably, I added a Miranda Menu-Item for adding
- Skype-contacts.
-
-0.0.0.3 - * I hope it's thread-safe now
- * Changing the Online-Status should work correctly now
- * Fixed "We got a sync problem :(" bug - big thx to Azzie
- * Now starts Skype more in the background as proposed by Kreisquadratur
- * Implemented PING-PONG with Skype to detect if Connection to Skype API
- was lost
- * Launching of Skype by Miranda improved
diff --git a/protocols/SkypeClassic/docs/readme.txt b/protocols/SkypeClassic/docs/readme.txt deleted file mode 100644 index 333f92d90a..0000000000 --- a/protocols/SkypeClassic/docs/readme.txt +++ /dev/null @@ -1,47 +0,0 @@ -Skype Protocol - Maybe we can call it beta now? ;)
-
-As so many people requested it, here is now a implementation of the Skype
-protocol for Miranda IM.
-Note, that this is just a wrapper for the Skype-API, which means that Skype
-has to be running while you use this plugin.
-The plugin should be able to launch Skype, if it is not running on startup.
-Please note, that I never coded a protocol-plugin for Miranda before, so
-expect it to be buggy and unstable, I hope I have some time to correct the
-severest bugs and to add more features soon.
-No warranty, whatsoever! I suggest that you back up your existing Miranda
-Database before using this plugin, just to be sure you have a backup if
-it runs amok ;-) Feel free to improve the ugly sourcecode.
-Please give me feedback, if it works for you, it would be interesting.
-
-NOTES - READ THEM CAREFULLY!
-----------------------------
-
- * You need Skype 1.0.0.97 or above in order to have access to the Skype API
- * You have to manually disable popup of messages in SKYPE, as there is
- currently no function in the API to do this
- Got to File/Options/Short messages and disable the checkboxes there
- Otherwise you would get all Skype-Messages twice (in Skype AND Miranda)
- * If you always get "Unknown event" when a call is incoming and you are using
- the NewEventNotify-plugin or Tabsrmm then go to the plugin's options
- (Sessions / Event Notifications / Announce events of type) and disable
- "other events" there.
- * Importing history for a contact can be launched by clickting "import History"
- in the context menu of a contact. The importing takes place in the background.
- AS soon, as it's finished, you will be notified by a messagebox.
- This feature is still buggy and quite a bit unpredictable.
- * There is a nice Iconset with the original Skype-Icons created by X-Byte
- Thanks for that. Grab it at http://dose.0wnz.at/Skype/Skype_icons.zip
- * Skype API bug: When you set Skype offline via API, the contacts stay online
- I made a Miranda-sie workaround for this now, but it's a Skype-API bug,
- not a plugin-bug
- * Skype API bug: when you rename Skypeout-contacts in Skype, their new nicks
- aren't sent correctly via the API, instead, the previous nick is sent and
- therefore the Miranda-name is not up-to-date after nick change.
- This is not a plugin bug either.
-BUGS
-----
-
- * To track bugs, you have to make a Debug-Build out from the source.
- The plugin then will log the Skype-API communication to a logfile
- called skype_log.txt so that we may se what caused the crash.
-
diff --git a/protocols/SkypeClassic/res/DND.ico b/protocols/SkypeClassic/res/DND.ico Binary files differdeleted file mode 100644 index ace441c3ad..0000000000 --- a/protocols/SkypeClassic/res/DND.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/Invite.ico b/protocols/SkypeClassic/res/Invite.ico Binary files differdeleted file mode 100644 index 12af3b8ab8..0000000000 --- a/protocols/SkypeClassic/res/Invite.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/NA.ico b/protocols/SkypeClassic/res/NA.ico Binary files differdeleted file mode 100644 index 5bb7dba823..0000000000 --- a/protocols/SkypeClassic/res/NA.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/Resource.rc b/protocols/SkypeClassic/res/Resource.rc deleted file mode 100644 index 6fa8339224..0000000000 --- a/protocols/SkypeClassic/res/Resource.rc +++ /dev/null @@ -1,388 +0,0 @@ -// Microsoft Visual C++ generated resource script.
-//
-#include "..\src\resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_SETAVATAR DIALOGEX 0, 0, 222, 131
-STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 400, 0, 0x1
-BEGIN
- PUSHBUTTON "Set",IDC_SETAVATAR,10,108,45,13,WS_GROUP
- PUSHBUTTON "Delete",IDC_DELETEAVATAR,57,108,45,13
- CONTROL "",IDC_AVATAR,"Static",SS_BITMAP | SS_CENTERIMAGE | SS_SUNKEN | WS_GROUP,10,10,96,93
-END
-
-IDD_OPT_DEFAULT DIALOGEX 0, 0, 310, 223
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "Start Skype with Miranda NG if not running using the following command line options:",IDC_STARTSKYPE,
- "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,10,4,290,10
- CONTROL "/NOSPLASH - Don't show splash screen on startup",IDC_NOSPLASH,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,36,17,264,12
- CONTROL "/MINIMIZED - Start Skype minimized",IDC_MINIMIZED,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,36,28,264,12
- CONTROL "/NOTRAY - Skype tray icon becomes gray and is therefore ""invisible""",IDC_NOTRAY,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,36,40,264,12
- CONTROL "/REMOVEABLE - For running portable Skype",IDC_REMOVEABLE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,36,51,264,12
- CONTROL "/SECONDARY - This is the second instance",IDC_SECONDARY,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,36,62,264,12
- CONTROL "/DATAPATH - Specify Skype data folder*",IDC_DATAPATHO,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,36,74,264,12
- EDITTEXT IDC_DATAPATH,47,88,236,12,ES_AUTOHSCROLL
- PUSHBUTTON "...",IDC_BROWSEDP,285,87,16,15
- CONTROL "Use custom Skype executable*",IDC_CUSTOMCOMMAND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,36,103,264,10
- EDITTEXT IDC_COMMANDLINE,47,116,236,12,ES_AUTOHSCROLL
- PUSHBUTTON "...",IDC_BROWSECMDL,285,115,16,15
- CTEXT "* Relative path root is Miranda NG folder",IDC_STATIC_PATHINFO,10,136,290,8,NOT WS_GROUP
- CONTROL "Shutdown Skype when you close Miranda NG",IDC_SHUTDOWN,
- "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,10,151,290,10
- CONTROL "Unload Skype when you change to Offline status",IDC_UNLOADOFFLINE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,164,290,11
- LTEXT "Try at least",IDC_STATIC,10,185,39,8
- EDITTEXT IDC_CONNATTEMPTS,52,183,21,12,ES_AUTOHSCROLL | ES_NUMBER
- LTEXT "times to connect to Skype API before giving up",IDC_STATIC,78,185,224,8,NOT WS_GROUP
- LTEXT "User name:",IDC_STATIC,10,206,38,8
- EDITTEXT IDC_USERNAME,52,204,79,12,ES_AUTOHSCROLL
- LTEXT "Password:",IDC_STATIC,148,206,34,8
- EDITTEXT IDC_PASSWORD,186,204,79,12,ES_PASSWORD | ES_AUTOHSCROLL
-END
-
-IDD_DIAL DIALOGEX 0, 0, 198, 46
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION "Dial"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- LTEXT "Number:",IDC_STATIC,7,8,30,11
- COMBOBOX IDC_NUMBER,41,6,149,13,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
- DEFPUSHBUTTON "Dial",IDDIAL,88,25,50,14,WS_GROUP
- PUSHBUTTON "Cancel",IDCANCEL,141,25,50,14
-END
-
-IDD_CALLSTAT DIALOGEX 0, 0, 220, 67
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION
-CAPTION "%s is calling"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "Join conference with %s",IDC_JOIN,"Button",BS_AUTORADIOBUTTON | WS_GROUP,7,7,206,10
- CONTROL "Answer call; set call to %s on hold",IDC_HOLD,"Button",BS_AUTORADIOBUTTON,7,19,206,10
- CONTROL "Hang up",IDC_HANGUP,"Button",BS_AUTORADIOBUTTON,7,31,206,10
- DEFPUSHBUTTON "OK",IDOK,163,46,50,14,WS_GROUP
-END
-
-IDD_INPUTBOX DIALOGEX 0, 0, 221, 46
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Dialog"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- EDITTEXT IDC_TEXT,7,7,207,13,ES_AUTOHSCROLL | WS_GROUP
- DEFPUSHBUTTON "OK",IDOK,112,25,50,14,WS_GROUP
- PUSHBUTTON "Cancel",IDCANCEL,165,25,50,14
-END
-
-IDD_OPTIONS DIALOGEX 0, 0, 313, 249
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "Tab1",IDC_OPTIONSTAB,"SysTabControl32",0x0,0,-1,313,250
-END
-
-IDD_OPT_PROXY DIALOGEX 0, 0, 310, 223
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "Use Skype proxy connection over network instead of local Skype API",IDC_USES2S,
- "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,10,4,290,9
- LTEXT "Host:",IDC_STATIC_HOST,20,21,18,10
- EDITTEXT IDC_HOST,41,19,133,12,ES_AUTOHSCROLL
- LTEXT "Port:",IDC_STATIC_PORT,180,21,16,10,0,WS_EX_RIGHT
- EDITTEXT IDC_PORT,200,19,29,12,ES_AUTOHSCROLL | ES_NUMBER
- CTEXT "* You must restart Miranda NG in order to let the settings take effect",IDC_STATIC_RESTART,10,54,290,8,NOT WS_GROUP
- CONTROL "This Skype proxy requires password authentication:",IDC_REQPASS,
- "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,20,38,176,9
- EDITTEXT IDC_PASSWORD,200,36,82,12,ES_PASSWORD | ES_AUTOHSCROLL
-END
-
-IDD_SETDETAILS DIALOGEX 0, 0, 216, 151
-STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- LTEXT "Name:",IDC_STATIC,7,6,61,9
- EDITTEXT IDC_FULLNAME,73,4,141,12,ES_AUTOHSCROLL
- LTEXT "Birthday:",IDC_STATIC,7,20,61,9
- CONTROL "DateTimePicker1",IDC_BIRTHDAY,"SysDateTimePick32",DTS_RIGHTALIGN | DTS_APPCANPARSE | WS_TABSTOP,73,18,62,12
- LTEXT "Sex:",IDC_STATIC,7,34,61,9
- COMBOBOX IDC_SEX,73,32,141,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- LTEXT "City:",IDC_STATIC,7,48,61,9
- EDITTEXT IDC_CITY,73,46,141,12,ES_AUTOHSCROLL
- LTEXT "Country:",IDC_STATIC,7,62,61,9
- EDITTEXT IDC_COUNTRY,73,60,141,12,ES_AUTOHSCROLL
- LTEXT "Province:",IDC_STATIC,7,76,61,9
- EDITTEXT IDC_PROVINCE,73,74,141,12,ES_AUTOHSCROLL
- LTEXT "Home phone:",IDC_STATIC,7,90,61,9
- EDITTEXT IDC_HOMEPHONE,73,88,141,12,ES_AUTOHSCROLL
- LTEXT "Office phone:",IDC_STATIC,7,104,61,9
- EDITTEXT IDC_OFFICEPHONE,73,102,141,12,ES_AUTOHSCROLL
- LTEXT "Homepage:",IDC_STATIC,7,118,61,9
- EDITTEXT IDC_HOMEPAGE,73,116,141,12,ES_AUTOHSCROLL
- PUSHBUTTON "Save",IDC_SAVEDETAILS,170,134,45,14,WS_GROUP
-END
-
-IDD_OPT_ADVANCED DIALOGEX 0, 0, 310, 223
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "Enable Skype menu options (currently: Find/Add user)",IDC_ENABLEMENU,
- "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,10,4,290,9
- CONTROL "Use popup plugin for displaying messages",IDC_USEPOPUP,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,19,290,9
- CONTROL "Suppress all error messages (not recommended, but if it annoys you... ;)",IDC_NOERRORS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,34,290,9
- CONTROL "Use group chat interface for conversations (requires group chat module)",IDC_GROUPCHAT,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,49,290,9
- CONTROL "Mark group chat message as read to avoid notification",IDC_GROUPCHATREAD,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,64,290,9
- CONTROL "Keep requested online status on startup under every circumstance",IDC_KEEPSTATE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,79,290,9
- CONTROL "Use time zone patch",IDC_TIMEZONE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,94,290,9
- CONTROL "Ignore time zones",IDC_IGNTZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,109,290,9
- CONTROL "Show default Skype avatar for contacts",IDC_SHOWDEFAULTAVATAR,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,124,290,9
- CONTROL "Suppress call summary chat message",IDC_SUPPRESSCALLSUMMARYMESSAGE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,139,290,9
- CONTROL "Disable support for N/A and SkypeMe status (for Skype 4+)",IDC_NOSKYPE3STATS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,154,290,9
- CONTROL "Show full name in contact list instead of nickname",IDC_SHOWFULLNAME,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,169,290,9
- LTEXT "SkypeOut contacts are in status:",IDC_STATIC,10,200,108,8
- COMBOBOX IDC_SKYPEOUTSTAT,119,198,79,54,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- PUSHBUTTON "Cleanup nicknames",IDC_CLEANUP,220,199,80,14,BS_MULTILINE | WS_GROUP
- CONTROL "Do not wait for message SENT acknowledgment (for some buggy Skype versions >6)",IDC_NOACK,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,182,290,13
-END
-
-IDD_OPT_POPUP DIALOGEX 0, 0, 310, 228
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- GROUPBOX "Skype popups",IDC_STATIC,0,1,309,227
- GROUPBOX "Incoming calls",IDC_STATIC,6,16,297,62,WS_GROUP
- CONTROL "Show incoming calls",IDC_POPUPINCOMING,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,10,28,278,8
- EDITTEXT IDC_POPUPTIME,16,41,20,12,ES_AUTOHSCROLL | ES_NUMBER
- LTEXT "seconds",IDC_STATIC,41,43,92,8,NOT WS_GROUP
- CONTROL "",IDC_POPUPBACKCOLOR,"ColourPicker",WS_GROUP | WS_TABSTOP,142,40,39,12
- LTEXT "Background",IDC_STATIC_POPUPBACKCOLOR,186,42,50,8,SS_CENTERIMAGE | NOT WS_GROUP
- CONTROL "Use Windows colors",IDC_USEWINCOLORS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | BS_FLAT | WS_TABSTOP,16,58,121,8
- CONTROL "",IDC_POPUPTEXTCOLOR,"ColourPicker",WS_TABSTOP,142,55,39,12
- LTEXT "Text",IDC_STATIC_POPUPTEXTCOLOR,186,56,50,8,SS_CENTERIMAGE | NOT WS_GROUP
- PUSHBUTTON "Preview",IDC_PREVIEW,247,58,50,14,WS_GROUP
- GROUPBOX "Error messages",IDC_STATIC,6,81,297,62,WS_GROUP
- CONTROL "Display error messages",IDC_POPUPERROR,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,10,94,278,8
- EDITTEXT IDC_POPUPTIMEERR,16,107,20,12,ES_AUTOHSCROLL | ES_NUMBER
- LTEXT "seconds",IDC_STATIC,41,109,92,8,NOT WS_GROUP
- CONTROL "",IDC_POPUPBACKCOLORERR,"ColourPicker",WS_GROUP | WS_TABSTOP,142,106,39,12
- LTEXT "Background",IDC_STATIC_POPUPBACKCOLORERR,186,108,50,8,SS_CENTERIMAGE | NOT WS_GROUP
- CONTROL "Use Windows colors",IDC_USEWINCOLORSERR,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | BS_FLAT | WS_TABSTOP,16,124,121,8
- CONTROL "",IDC_POPUPTEXTCOLORERR,"ColourPicker",WS_TABSTOP,142,121,39,12
- LTEXT "Text",IDC_STATIC_POPUPTEXTCOLORERR,186,123,50,8,SS_CENTERIMAGE | NOT WS_GROUP
- PUSHBUTTON "Preview",IDC_PREVIEWERR,247,124,50,14,WS_GROUP
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
- IDD_SETAVATAR, DIALOG
- BEGIN
- LEFTMARGIN, 10
- RIGHTMARGIN, 212
- TOPMARGIN, 10
- BOTTOMMARGIN, 121
- END
-
- IDD_OPT_DEFAULT, DIALOG
- BEGIN
- LEFTMARGIN, 1
- VERTGUIDE, 10
- VERTGUIDE, 300
- TOPMARGIN, 4
- END
-
- IDD_DIAL, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 190
- TOPMARGIN, 6
- BOTTOMMARGIN, 39
- END
-
- IDD_CALLSTAT, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 213
- TOPMARGIN, 7
- BOTTOMMARGIN, 60
- END
-
- IDD_INPUTBOX, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 214
- TOPMARGIN, 7
- BOTTOMMARGIN, 39
- END
-
- IDD_OPTIONS, DIALOG
- BEGIN
- RIGHTMARGIN, 311
- BOTTOMMARGIN, 243
- END
-
- IDD_OPT_PROXY, DIALOG
- BEGIN
- LEFTMARGIN, 10
- RIGHTMARGIN, 300
- TOPMARGIN, 4
- BOTTOMMARGIN, 221
- END
-
- IDD_SETDETAILS, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 214
- TOPMARGIN, 4
- BOTTOMMARGIN, 148
- END
-
- IDD_OPT_ADVANCED, DIALOG
- BEGIN
- LEFTMARGIN, 10
- RIGHTMARGIN, 300
- TOPMARGIN, 4
- BOTTOMMARGIN, 221
- HORZGUIDE, 4
- END
-END
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_SKYPE ICON "skype.ico"
-IDI_INVITE ICON "Invite.ico"
-IDI_ADD ICON "add.ico"
-IDI_IMPORT ICON "import.ico"
-IDI_ERRORS ICON "error.ico"
-IDI_MESSAGE ICON "message.ico"
-IDI_CALL ICON "call.ico"
-IDI_CALLSKYPEOUT ICON "skypeout.ico"
-IDI_HOLD ICON "hold.ico"
-IDI_RESUME ICON "resume.ico"
-IDI_HANGUP ICON "hang_up.ico"
-IDI_ONLINE ICON "online.ico"
-IDI_CHAT ICON "chat.ico"
-IDI_AWAY ICON "away.ico"
-IDI_NA ICON "na.ico"
-IDI_OCCUPIED ICON "occupied.ico"
-IDI_DND ICON "dnd.ico"
-IDI_INVISIBLE ICON "invisible.ico"
-IDI_OFFLINE ICON "offline.ico"
-IDI_PHONE ICON "phone.ico"
-IDI_BLOCKCONTACT ICON "blockcon.ico"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Bitmap
-//
-
-IDB_CALL BITMAP "call.bmp"
-#endif // Neutral resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// German (Austria) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEA)
-LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_AUSTRIAN
-#pragma code_page(1252)
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "..\\src\\resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-#endif // German (Austria) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/protocols/SkypeClassic/res/Version.rc b/protocols/SkypeClassic/res/Version.rc deleted file mode 100644 index d741488c4f..0000000000 --- a/protocols/SkypeClassic/res/Version.rc +++ /dev/null @@ -1,42 +0,0 @@ -// Microsoft Visual C++ generated resource script.
-//
-#ifdef APSTUDIO_INVOKED
-#error this file is not editable by Microsoft Visual C++
-#endif //APSTUDIO_INVOKED
-
-#include "afxres.h"
-#include "..\src\version.h"
-
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#endif //_WIN32
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION __FILEVERSION_STRING
- PRODUCTVERSION __FILEVERSION_STRING
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x0L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "000004b0"
- BEGIN
- VALUE "FileDescription", __DESCRIPTION
- VALUE "InternalName", __PLUGIN_NAME
- VALUE "LegalCopyright", __COPYRIGHT
- VALUE "OriginalFilename", __FILENAME
- VALUE "ProductName", __PLUGIN_NAME
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x0, 1200
- END
-END
diff --git a/protocols/SkypeClassic/res/add.ico b/protocols/SkypeClassic/res/add.ico Binary files differdeleted file mode 100644 index b0e9903bbe..0000000000 --- a/protocols/SkypeClassic/res/add.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/away.ico b/protocols/SkypeClassic/res/away.ico Binary files differdeleted file mode 100644 index 7993291dcc..0000000000 --- a/protocols/SkypeClassic/res/away.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/blockcon.ico b/protocols/SkypeClassic/res/blockcon.ico Binary files differdeleted file mode 100644 index c371be9473..0000000000 --- a/protocols/SkypeClassic/res/blockcon.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/call.bmp b/protocols/SkypeClassic/res/call.bmp Binary files differdeleted file mode 100644 index 7da6ac53cf..0000000000 --- a/protocols/SkypeClassic/res/call.bmp +++ /dev/null diff --git a/protocols/SkypeClassic/res/call.ico b/protocols/SkypeClassic/res/call.ico Binary files differdeleted file mode 100644 index 43516a3c0f..0000000000 --- a/protocols/SkypeClassic/res/call.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/chat.ico b/protocols/SkypeClassic/res/chat.ico Binary files differdeleted file mode 100644 index cf6e01e93d..0000000000 --- a/protocols/SkypeClassic/res/chat.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/error.ico b/protocols/SkypeClassic/res/error.ico Binary files differdeleted file mode 100644 index e191cbf754..0000000000 --- a/protocols/SkypeClassic/res/error.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/hang_up.ico b/protocols/SkypeClassic/res/hang_up.ico Binary files differdeleted file mode 100644 index dacfcd4935..0000000000 --- a/protocols/SkypeClassic/res/hang_up.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/hold.ico b/protocols/SkypeClassic/res/hold.ico Binary files differdeleted file mode 100644 index 3ad69006a7..0000000000 --- a/protocols/SkypeClassic/res/hold.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/import.ico b/protocols/SkypeClassic/res/import.ico Binary files differdeleted file mode 100644 index 863d45cd6b..0000000000 --- a/protocols/SkypeClassic/res/import.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/invisible.ico b/protocols/SkypeClassic/res/invisible.ico Binary files differdeleted file mode 100644 index b734f6a495..0000000000 --- a/protocols/SkypeClassic/res/invisible.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/message.ico b/protocols/SkypeClassic/res/message.ico Binary files differdeleted file mode 100644 index c4ca27be54..0000000000 --- a/protocols/SkypeClassic/res/message.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/occupied.ico b/protocols/SkypeClassic/res/occupied.ico Binary files differdeleted file mode 100644 index a0baafec21..0000000000 --- a/protocols/SkypeClassic/res/occupied.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/offline.ico b/protocols/SkypeClassic/res/offline.ico Binary files differdeleted file mode 100644 index e26af6fdec..0000000000 --- a/protocols/SkypeClassic/res/offline.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/online.ico b/protocols/SkypeClassic/res/online.ico Binary files differdeleted file mode 100644 index ae1a3df64f..0000000000 --- a/protocols/SkypeClassic/res/online.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/phone.ico b/protocols/SkypeClassic/res/phone.ico Binary files differdeleted file mode 100644 index 1a13073ce6..0000000000 --- a/protocols/SkypeClassic/res/phone.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/resume.ico b/protocols/SkypeClassic/res/resume.ico Binary files differdeleted file mode 100644 index 294bad488e..0000000000 --- a/protocols/SkypeClassic/res/resume.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/skype.ico b/protocols/SkypeClassic/res/skype.ico Binary files differdeleted file mode 100644 index b267bbb5fc..0000000000 --- a/protocols/SkypeClassic/res/skype.ico +++ /dev/null diff --git a/protocols/SkypeClassic/res/skypeout.ico b/protocols/SkypeClassic/res/skypeout.ico Binary files differdeleted file mode 100644 index 6d135bae96..0000000000 --- a/protocols/SkypeClassic/res/skypeout.ico +++ /dev/null diff --git a/protocols/SkypeClassic/src/alogon.cpp b/protocols/SkypeClassic/src/alogon.cpp deleted file mode 100644 index 3eedadc637..0000000000 --- a/protocols/SkypeClassic/src/alogon.cpp +++ /dev/null @@ -1,124 +0,0 @@ -#include "skype.h"
-#include "debug.h"
-
-extern char g_szProtoName[];
-extern HANDLE SkypeReady;
-
-/**
- * Purpose: Retrieves class name from window
- *
- * Note: This is some sort of hack to return static local variable,
- * but it works :)
- */
-static const TCHAR* getClassName(HWND wnd)
-{
- static TCHAR className[256];
-
- *className = 0;
- GetClassName(wnd, &className[0], sizeof(className) / sizeof(className[0]));
- return className;
-}
-
-/**
- * Purpose: Finds a window
- *
- * Note: This function relies on Skype window placement.
- * It should work for Skype 3.x
- */
-static HWND findWindow(HWND parent, const TCHAR* childClassName)
-{
- // Get child window
- // This window is not combo box or edit box
- HWND wnd = GetWindow(parent, GW_CHILD);
- while (wnd != NULL && mir_tstrcmp(getClassName(wnd), childClassName) != 0)
- wnd = GetWindow(wnd, GW_HWNDNEXT);
-
- return wnd;
-}
-
-static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
-{
- DWORD dwPID;
- GetWindowThreadProcessId(hWnd, &dwPID);
- if (lParam != 0 && dwPID != (DWORD)lParam) return TRUE;
- const TCHAR *lpszClassName = getClassName(hWnd);
- if (mir_tstrcmp(lpszClassName, _T("tSkMainForm.UnicodeClass")) == 0 ||
- mir_tstrcmp(lpszClassName, _T("TLoginForm.UnicodeClass")) == 0)
- {
- HWND loginControl = GetWindow(hWnd, GW_CHILD);
-
- LOG(("setUserNamePasswordThread: Skype window found!"));
-
- // Sleep for some time, while Skype is loading
- // It loads slowly :(
- //Sleep(5000);
- LOG(("TLoginControl = %S", getClassName(loginControl)));
-
- // Check for login control
- if (mir_tstrcmp(getClassName(loginControl), _T("TLoginControl")) == 0)
- {
- // Find user name window
- HWND userName = findWindow(loginControl, _T("TNavigableTntComboBox.UnicodeClass"));
- HWND password = findWindow(loginControl, _T("TNavigableTntEdit.UnicodeClass"));
-
- LOG(("userName=%08X; password=%08X", userName, password));
- if (userName && password)
- {
- // Set user name and password
- DBVARIANT dbv;
-
- if (!db_get_ws(NULL, SKYPE_PROTONAME, "LoginUserName", &dbv))
- {
- SetWindowTextW(userName, dbv.pwszVal);
- db_free(&dbv);
- }
-
- if (!db_get_ws(NULL, SKYPE_PROTONAME, "LoginPassword", &dbv))
- {
- SetWindowTextW(password, dbv.pwszVal);
- db_free(&dbv);
- SendMessageW(password, WM_CHAR, 13, 0);
- }
-
-
- SendMessageW(hWnd,
- WM_COMMAND,
- 0x4a8, // sign-in button; WARNING: This ID can change during newer Skype versions
- (LPARAM)findWindow(loginControl, _T("TTntButton.UnicodeClass")));
- }
- return FALSE;
- }
-
- }
- return TRUE;
-}
-
-void __cdecl setUserNamePasswordThread(void *lpDummy)
-{
- DWORD dwPid = (DWORD)lpDummy;
- HANDLE mutex = CreateMutex(NULL, TRUE, _T("setUserNamePasswordMutex"));
-
- // Check double entrance
- if (GetLastError() == ERROR_ALREADY_EXISTS)
- return;
-
- WaitForSingleObject(SkypeReady, 5000);
- EnumWindows(EnumWindowsProc, dwPid);
-
- ReleaseMutex(mutex);
- CloseHandle(mutex);
-}
-
-/**
- * Purpose: Finds Skype window and sets user name and password.
- *
- * Note: This function relies on Skype window placement.
- * It should work for Skype 3.x
- */
-void setUserNamePassword(int dwPid)
-{
- mir_forkthread(setUserNamePasswordThread, (void*)dwPid);
-
- // Give time to thread
- Sleep(100);
-}
diff --git a/protocols/SkypeClassic/src/alogon.h b/protocols/SkypeClassic/src/alogon.h deleted file mode 100644 index 00d2e7e703..0000000000 --- a/protocols/SkypeClassic/src/alogon.h +++ /dev/null @@ -1 +0,0 @@ -void setUserNamePassword(int dwPid);
diff --git a/protocols/SkypeClassic/src/contacts.cpp b/protocols/SkypeClassic/src/contacts.cpp deleted file mode 100644 index 2e00d5750a..0000000000 --- a/protocols/SkypeClassic/src/contacts.cpp +++ /dev/null @@ -1,427 +0,0 @@ -/*
- * Contactlist management functions
- */
-
-#include "skype.h"
-#include "skypeapi.h"
-#include "debug.h"
-#include "pthread.h"
-#include "gchat.h"
-
-#include <m_langpack.h>
-
-// Imported Globals
-extern HINSTANCE hInst;
-extern BOOL bSkypeOut, bIsImoproxy, bHasFileXfer;
-extern char protocol, g_szProtoName[];
-
-// Handles
-static HGENMENU hMenuCallItem, hMenuCallHangup, hMenuSkypeOutCallItem, hMenuHoldCallItem, hMenuFileTransferItem, hMenuChatInitItem, hMenuBlockContactItem;
-
-// Check if alpha blending icons are supported
-// Seems to be not neccessary
-/*
-BOOL SupportAlphaIcons(void) {
-HANDLE hMod;
-DLLVERSIONINFO tDVI={0};
-BOOL retval=FALSE;
-FARPROC pDllGetVersion;
-
-if (!(hMod=LoadLibrary("comctl32.dll"))) return FALSE;
-if (pDllGetVersion=GetProcAddress(hMod, "DllGetVersion")) {
-tDVI.cbSize=sizeof(tDVI);
-if (!pDllGetVersion ((DLLVERSIONINFO *)&tDVI)) {
-if (GetDeviceCaps(GetDC(NULL), BITSPIXEL)*GetDeviceCaps(GetDC(NULL), PLANES)>=32 &&
-tDVI.dwMajorVersion>=6)
-retval=TRUE;
-}
-}
-FreeLibrary(hMod);
-return retval;
-}
-*/
-
-CLISTMENUITEM CallItem(void) {
- CLISTMENUITEM mi = { 0 };
-
- mi.cbSize = sizeof(mi);
- mi.position = -2000005000;
- mi.flags = CMIF_NOTOFFLINE | CMIF_TCHAR;
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CALL));
- mi.pszContactOwner = SKYPE_PROTONAME;
- mi.ptszName = LPGENT("Call (Skype)");
- mi.pszService = SKYPE_CALL;
-
- return mi;
-}
-
-CLISTMENUITEM SkypeOutCallItem(void) {
- CLISTMENUITEM mi = { 0 };
-
- mi.cbSize = sizeof(mi);
- mi.position = -2000005000;
- mi.flags = CMIF_HIDDEN | CMIF_TCHAR;
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CALLSKYPEOUT));
- mi.ptszName = LPGENT("Call using SkypeOut");
- mi.pszService = SKYPEOUT_CALL;
-
- return mi;
-}
-
-CLISTMENUITEM HupItem(void) {
- CLISTMENUITEM mi = { 0 };
-
- mi.cbSize = sizeof(mi);
- mi.position = -2000005000;
- mi.flags = CMIF_NOTOFFLINE | CMIF_TCHAR;
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_HANGUP));
- mi.pszContactOwner = SKYPE_PROTONAME;
- mi.ptszName = LPGENT("Hang up call (Skype)");
- mi.pszService = SKYPE_CALLHANGUP;
-
- return mi;
-}
-
-CLISTMENUITEM SkypeOutHupItem(void) {
- CLISTMENUITEM mi = { 0 };
-
- mi.cbSize = sizeof(mi);
- mi.position = -2000005000;
- mi.flags = CMIF_TCHAR;
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_HANGUP));
- mi.ptszName = LPGENT("Hang up SkypeOut call");
- mi.pszService = SKYPEOUT_CALL;
- return mi;
-}
-
-CLISTMENUITEM HoldCallItem(void) {
- CLISTMENUITEM mi = { 0 };
-
- mi.cbSize = sizeof(mi);
- mi.position = -2000005000;
- mi.flags = CMIF_HIDDEN | CMIF_NOTOFFLINE | CMIF_TCHAR;
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_HOLD));
- mi.ptszName = LPGENT("Hold call");
- mi.pszService = SKYPE_HOLDCALL;
- return mi;
-}
-
-CLISTMENUITEM ResumeCallItem(void) {
- CLISTMENUITEM mi = { 0 };
-
- mi.cbSize = sizeof(mi);
- mi.position = -2000005000;
- mi.flags = CMIF_HIDDEN | CMIF_NOTOFFLINE | CMIF_TCHAR;
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_RESUME));
- mi.ptszName = LPGENT("Resume call");
- mi.pszService = SKYPE_HOLDCALL;
- return mi;
-}
-
-CLISTMENUITEM FileTransferItem(void) {
- CLISTMENUITEM mi = { 0 };
-
- // Stolen from file.c of Miranda core
- mi.cbSize = sizeof(mi);
- mi.position = -2000020000;
- mi.flags = CMIF_HIDDEN | CMIF_NOTOFFLINE | CMIF_TCHAR;
- mi.hIcon = LoadSkinnedIcon(SKINICON_EVENT_FILE);
- mi.ptszName = LPGENT("&File");
- mi.pszContactOwner = SKYPE_PROTONAME;
- mi.pszService = SKYPE_SENDFILE;
- return mi;
-}
-
-CLISTMENUITEM ChatInitItem(void) {
- CLISTMENUITEM mi = { 0 };
-
- mi.cbSize = sizeof(mi);
- mi.position = -2000020000;
- mi.flags = CMIF_HIDDEN | CMIF_NOTOFFLINE | CMIF_TCHAR;
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_INVITE));
- mi.ptszName = LPGENT("&Open group chat");
- mi.pszContactOwner = SKYPE_PROTONAME;
- mi.pszService = SKYPE_CHATNEW;
- return mi;
-}
-
-CLISTMENUITEM BlockContactItem(void) {
- CLISTMENUITEM mi = { 0 };
-
- mi.cbSize = sizeof(mi);
- mi.position = -2000005000;
- mi.flags = CMIF_HIDDEN | CMIF_TCHAR;
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_BLOCKCONTACT));
- mi.ptszName = LPGENT("Block contact");
- mi.pszContactOwner = SKYPE_PROTONAME;
- mi.pszService = SKYPE_BLOCKCONTACT;
- return mi;
-}
-
-HANDLE add_contextmenu(MCONTACT) {
- CLISTMENUITEM mi = CallItem();
- hMenuCallItem = Menu_AddContactMenuItem(&mi);
-
- mi = HupItem();
- hMenuCallHangup = Menu_AddContactMenuItem(&mi);
-
- mi = SkypeOutCallItem();
- hMenuSkypeOutCallItem = Menu_AddContactMenuItem(&mi);
-
- mi = HoldCallItem();
- hMenuHoldCallItem = Menu_AddContactMenuItem(&mi);
-
- // We cannot use flag PF1_FILESEND for sending files, as Skype opens its own
- // sendfile-Dialog.
- if (!bHasFileXfer) {
- mi = FileTransferItem();
- hMenuFileTransferItem = Menu_AddContactMenuItem(&mi);
- }
-
- mi = ChatInitItem();
- hMenuChatInitItem = Menu_AddContactMenuItem(&mi);
-
- mi = BlockContactItem();
- hMenuBlockContactItem = Menu_AddContactMenuItem(&mi);
-
- memset(&mi, 0, sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = -2000005000;
- mi.flags = CMIF_TCHAR;
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_IMPORT));
- mi.pszContactOwner = SKYPE_PROTONAME;
- mi.ptszName = LPGENT("Import Skype history");
- mi.pszService = SKYPE_IMPORTHISTORY;
- return Menu_AddContactMenuItem(&mi);
-}
-
-HANDLE add_mainmenu(void) {
- CLISTMENUITEM mi = { 0 };
-
- mi.cbSize = sizeof(mi);
- mi.position = -2000005000;
- mi.flags = CMIF_TCHAR;
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ADD));
- mi.pszContactOwner = SKYPE_PROTONAME;
- mi.ptszName = LPGENT("Add Skype contact");
- mi.pszService = SKYPE_ADDUSER;
- return Menu_AddMainMenuItem(&mi);
-
-}
-
-int __cdecl PrebuildContactMenu(WPARAM wParam, LPARAM) {
- MCONTACT hContact = (MCONTACT) wParam;
- char *szProto = GetContactProto(hContact);
- if (!szProto)
- return 0;
-
- // Clear hold-Item in case it exists
- CLISTMENUITEM mi = HoldCallItem();
- mi.flags |= CMIM_ALL;
- Menu_ModifyItem(hMenuHoldCallItem, &mi);
-
- DBVARIANT dbv;
- BOOL callAvailable = FALSE;
- BOOL hangupAvailable = FALSE;
- if (!mir_strcmp(szProto, SKYPE_PROTONAME)) {
- if (!db_get(hContact, SKYPE_PROTONAME, "CallId", &dbv)) {
- if (db_get_b(hContact, SKYPE_PROTONAME, "OnHold", 0))
- mi = ResumeCallItem(); else mi = HoldCallItem();
- mi.flags = CMIM_ALL;
- Menu_ModifyItem(hMenuHoldCallItem, &mi);
-
- callAvailable = FALSE;
- hangupAvailable = TRUE;
-
- db_free(&dbv);
- }
- else { callAvailable = TRUE; hangupAvailable = FALSE; }
-
- if (db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) != 0) {
- callAvailable = FALSE;
- hangupAvailable = FALSE;
- }
-
- mi = CallItem();
- mi.flags |= CMIM_ALL | (!callAvailable ? CMIF_HIDDEN : 0);
- Menu_ModifyItem(hMenuCallItem, &mi);
-
- mi = HupItem();
- mi.flags |= CMIM_ALL | (!hangupAvailable ? CMIF_HIDDEN : 0);
- Menu_ModifyItem(hMenuCallHangup, &mi);
-
- // Clear SkypeOut menu in case it exists
- mi = SkypeOutCallItem();
- mi.flags |= CMIM_ALL;
- Menu_ModifyItem(hMenuSkypeOutCallItem, &mi);
-
- // File sending and groupchat-creation works starting with protocol version 5
- if (protocol >= 5) {
- if (!bHasFileXfer) {
- mi = FileTransferItem();
- if (db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0)
- mi.flags ^= CMIF_HIDDEN;
- mi.flags |= CMIM_FLAGS;
- Menu_ModifyItem(hMenuFileTransferItem, &mi);
- }
- mi = BlockContactItem();
- mi.flags ^= CMIF_HIDDEN;
- mi.flags |= CMIM_FLAGS | CMIM_NAME;
- if (db_get_b(hContact, SKYPE_PROTONAME, "IsBlocked", 0) == 1)
- mi.ptszName = LPGENT("Unblock contact");
- Menu_ModifyItem(hMenuBlockContactItem, &mi);
- }
-
- if (protocol >= 5 || bIsImoproxy) {
- mi = ChatInitItem();
- if (db_get_b(NULL, SKYPE_PROTONAME, "UseGroupchat", 0) &&
- db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0)
- mi.flags ^= CMIF_HIDDEN;
- mi.flags |= CMIM_FLAGS;
- Menu_ModifyItem(hMenuChatInitItem, &mi);
- }
-
- }
- else if (bSkypeOut) {
- if (!db_get(hContact, SKYPE_PROTONAME, "CallId", &dbv)) {
- mi = SkypeOutHupItem();
- db_free(&dbv);
- }
- else {
- mi = SkypeOutCallItem();
- if (!db_get(hContact, "UserInfo", "MyPhone0", &dbv)) {
- db_free(&dbv);
- mi.flags = 0;
- }
- }
- mi.flags |= CMIM_ALL;
- Menu_ModifyItem(hMenuSkypeOutCallItem, &mi);
- }
-
- return 0;
-}
-
-/*
-int ClistDblClick(WPARAM wParam, LPARAM lParam) {
-char *szProto;
-
-szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 );
-if (szProto!=NULL && !mir_strcmp(szProto, SKYPE_PROTONAME) &&
-db_get_w((HANDLE)wParam, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE)==ID_STATUS_ONTHEPHONE) {
-SkypeCall(wParam, 0);
-}
-
-return 0;
-}
-*/
-
-MCONTACT find_contact(char *name)
-{
- int tCompareResult;
- DBVARIANT dbv;
-
- // already on list?
- for (MCONTACT hContact = db_find_first(SKYPE_PROTONAME); hContact != NULL; hContact = db_find_next(hContact,SKYPE_PROTONAME))
- {
- if (db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0)
- {
- if (db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) continue;
- tCompareResult = mir_strcmp(dbv.pszVal, name);
- db_free(&dbv);
- if (tCompareResult) continue;
- return hContact; // already there, return handle
- }
- }
- return NULL;
-}
-
-MCONTACT find_contactT(TCHAR *name)
-{
- int tCompareResult;
- DBVARIANT dbv;
-
- // already on list?
- for (MCONTACT hContact = db_find_first(SKYPE_PROTONAME); hContact != NULL; hContact = db_find_next(hContact,SKYPE_PROTONAME))
- {
- if (db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0)
- {
- if (db_get_ts(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) continue;
- tCompareResult = mir_tstrcmp(dbv.ptszVal, name);
- db_free(&dbv);
- if (tCompareResult) continue;
- return hContact; // already there, return handle
- }
- }
- return NULL;
-}
-
-
-MCONTACT add_contact(char *name, DWORD flags)
-{
- // already on list?
- MCONTACT hContact = find_contact(name);
- if (hContact) {
- if (!(flags & PALF_TEMPORARY) && db_get_b(hContact, "CList", "NotOnList", 1)) {
- db_unset(hContact, "CList", "NotOnList");
- db_unset(hContact, "CList", "Hidden");
- }
- LOG(("add_contact: Found %s", name));
- return hContact; // already there, return handle
- }
- // no, so add
-
- LOG(("add_contact: Adding %s", name));
- hContact = (MCONTACT)CallServiceSync(MS_DB_CONTACT_ADD, 0, 0);
- if (hContact) {
- if (CallServiceSync(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)SKYPE_PROTONAME) != 0) {
- LOG(("add_contact: Ouch! MS_PROTO_ADDTOCONTACT failed for some reason"));
- CallServiceSync(MS_DB_CONTACT_DELETE, hContact, 0);
- return NULL;
- }
- if (name[0]) db_set_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, name);
-
- if (flags & PALF_TEMPORARY) {
- db_set_b(hContact, "CList", "NotOnList", 1);
- db_set_b(hContact, "CList", "Hidden", 1);
- }
- if (name[0]) {
- SkypeSend("GET USER %s DISPLAYNAME", name);
- }
- else { LOG(("add_contact: Info: The contact added has no name.")); }
- }
- else { LOG(("add_contact: Ouch! MS_DB_CONTACT_ADD failed for some reason")); }
- LOG(("add_contact succeeded"));
- return hContact;
-}
-
-void logoff_contacts(BOOL bCleanup) {
- MCONTACT hContact;
- char *szProto;
- DBVARIANT dbv = { 0 };
-
- LOG(("logoff_contacts: Logging off contacts."));
- for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
- szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
- if (szProto != NULL && !mir_strcmp(szProto, SKYPE_PROTONAME))
- {
- if (db_get_w(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- db_set_w(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE);
-
- db_unset(hContact, SKYPE_PROTONAME, "CallId");
- if (db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 1)
- {
- if (db_get_ts(hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv)) continue;
- RemChat(dbv.ptszVal);
- db_free(&dbv);
- }
- if (db_get_s(hContact, SKYPE_PROTONAME, "Typing_Stream", &dbv) == 0)
- {
- if (bCleanup) SkypeSend("ALTER APPLICATION libpurple_typing DISCONNECT %s", dbv.pszVal);
- db_free(&dbv);
- db_unset(hContact, SKYPE_PROTONAME, "Typing_Stream");
- }
-
- }
- }
- if (bCleanup && (protocol >= 5 || bIsImoproxy)) SkypeSend("DELETE APPLICATION libpurple_typing");
-}
diff --git a/protocols/SkypeClassic/src/contacts.h b/protocols/SkypeClassic/src/contacts.h deleted file mode 100644 index 5665b70a7b..0000000000 --- a/protocols/SkypeClassic/src/contacts.h +++ /dev/null @@ -1,14 +0,0 @@ -// Prototypes
-HANDLE add_contextmenu(MCONTACT hContact);
-HANDLE add_mainmenu(void);
-
-MCONTACT find_contact(char *name);
-MCONTACT find_contactT(TCHAR *name);
-MCONTACT add_contact(char *name, DWORD flags);
-
-CLISTMENUITEM HupItem(void);
-CLISTMENUITEM CallItem(void);
-
-void logoff_contacts(BOOL bCleanup);
-int PrebuildContactMenu(WPARAM, LPARAM);
-//int ClistDblClick(WPARAM, LPARAM);
\ No newline at end of file diff --git a/protocols/SkypeClassic/src/debug.cpp b/protocols/SkypeClassic/src/debug.cpp deleted file mode 100644 index 5b28e748de..0000000000 --- a/protocols/SkypeClassic/src/debug.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef _DEBUG
-#pragma warning (disable: 4206) // nonstandard extension used : translation unit is empty
-#else
-#include "debug.h"
-
-#define WIN32_LEAN_AND_MEAN
-//#include <windows.h>
-#include <stdio.h>
-//#include <time.h>
-#include "skype.h"
-#include <string.h>
-#include <stdlib.h>
-
-#define INITBUF 1024 /* Initial size of buffer */
-
-#pragma warning (disable: 4706) // assignment within conditional expression
-
-extern char g_szProtoName[];
-
-static CRITICAL_SECTION m_WriteFileMutex;
-static FILE *m_fpLogFile = NULL;
-static char *m_szLogBuf = NULL;
-static DWORD m_iBufSize = 0;
-
-void init_debug(void) {
- char *p;
- char logfile[MAX_PATH];
-
- memset(logfile, 0, sizeof(logfile));
- p=logfile+GetModuleFileNameA(NULL, logfile, SIZEOF(logfile));
- if (!(p=strrchr (logfile, '\\'))) p=logfile; else p++;
- sprintf (p, "%s_log.txt", SKYPE_PROTONAME);
- m_szLogBuf = (char*)calloc (1, (m_iBufSize = INITBUF));
- m_fpLogFile = fopen(logfile, "a");
- InitializeCriticalSection(&m_WriteFileMutex);
-}
-
-void end_debug (void) {
- if (m_szLogBuf) free (m_szLogBuf);
- if (m_fpLogFile) fclose (m_fpLogFile);
- DeleteCriticalSection(&m_WriteFileMutex);
-}
-
-void do_log(const char *pszFormat, ...) {
- char *ct, *pNewBuf;
- va_list ap;
- time_t lt;
- int iLen;
-
- if (!m_szLogBuf || !m_fpLogFile) return;
- EnterCriticalSection(&m_WriteFileMutex);
- time(<);
- ct=ctime(<);
- ct[mir_strlen(ct)-1]=0;
- do
- {
- va_start(ap, pszFormat);
- iLen = _vsnprintf(m_szLogBuf, m_iBufSize, pszFormat, ap);
- va_end(ap);
- if (iLen == -1)
- {
- if (!(pNewBuf = (char*)realloc (m_szLogBuf, m_iBufSize*2)))
- {
- iLen = mir_strlen (m_szLogBuf);
- break;
- }
- m_szLogBuf = pNewBuf;
- m_iBufSize*=2;
- }
- } while (iLen == -1);
- fprintf (m_fpLogFile, sizeof(time_t) == sizeof(int) ? "%s (%ld) [%08X] %s\n" : "%s (%lld) [%08X] %s\n", ct, lt, GetCurrentThreadId(), m_szLogBuf);
- fflush (m_fpLogFile);
- LeaveCriticalSection(&m_WriteFileMutex);
-}
-#endif
\ No newline at end of file diff --git a/protocols/SkypeClassic/src/debug.h b/protocols/SkypeClassic/src/debug.h deleted file mode 100644 index 9582246251..0000000000 --- a/protocols/SkypeClassic/src/debug.h +++ /dev/null @@ -1,23 +0,0 @@ -//#define DEBUG_RELEASE 1
-
-#ifdef DEBUG_RELEASE
- #define _DEBUG 1
-#endif
-
-#ifdef _DEBUG
- void init_debug(void);
- void end_debug (void);
- void do_log(const char *pszFormat, ...);
- #define DEBUG_OUT(a) OUTPUT(a)
- #define TRACE(a) OutputDebugString(a)
- #define TRACEA(a) OutputDebugStringA(a)
- #define TRACEW(a) OutputDebugStringW(a)
- #define LOG(a) do_log a
-#else
- #define DEBUG_OUT(a)
- #define LOG(a)
- #define TRACE(a)
- #define TRACEA(a)
- #define TRACEW(a)
-#endif
-
diff --git a/protocols/SkypeClassic/src/ezxml/ezxml.c b/protocols/SkypeClassic/src/ezxml/ezxml.c deleted file mode 100644 index 24c02fbd70..0000000000 --- a/protocols/SkypeClassic/src/ezxml/ezxml.c +++ /dev/null @@ -1,1033 +0,0 @@ -/* ezxml.c - * - * Copyright 2004-2006 Aaron Voisine <aaron@voisine.org> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -
-#if defined(WIN32) || defined(_WIN32)
-#include <io.h>
-#ifndef EZXML_NOMMAP
-#define EZXML_NOMMAP
-#endif
-#endif
- -#include <stdlib.h> -#include <stdio.h> -#include <stdarg.h> -#include <string.h> -#include <ctype.h>
-#if !defined(WIN32) && !defined(_WIN32) -#include <unistd.h>
-#endif -#include <sys/types.h> -#ifndef EZXML_NOMMAP -#include <sys/mman.h> -#endif // EZXML_NOMMAP -#include <sys/stat.h> -#include "ezxml.h"
-
-#if defined(WIN32) || defined(_WIN32)
-#define vsnprintf _vsnprintf
-#define snprintf _snprintf
-#define open _open
-#define read _read
-#define write _write
-#define close _close
-#endif - -#define EZXML_WS "\t\r\n " // whitespace -#define EZXML_ERRL 128 // maximum error string length - -typedef struct ezxml_root *ezxml_root_t; -struct ezxml_root { // additional data for the root tag - struct ezxml xml; // is a super-struct built on top of ezxml struct - ezxml_t cur; // current xml tree insertion point - char *m; // original xml string - size_t len; // length of allocated memory for mmap, -1 for malloc - char *u; // UTF-8 conversion of string if original was UTF-16 - char *s; // start of work area - char *e; // end of work area - char **ent; // general entities (ampersand sequences) - char ***attr; // default attributes - char ***pi; // processing instructions - short standalone; // non-zero if <?xml standalone="yes"?> - char err[EZXML_ERRL]; // error string -}; - -char *EZXML_NIL[] = { NULL }; // empty, null terminated array of strings - -// returns the first child tag with the given name or NULL if not found -ezxml_t ezxml_child(ezxml_t xml, const char *name) -{ - xml = (xml) ? xml->child : NULL; - while (xml && strcmp(name, xml->name)) xml = xml->sibling; - return xml; -} - -// returns the Nth tag with the same name in the same subsection or NULL if not -// found -ezxml_t ezxml_idx(ezxml_t xml, int idx) -{ - for (; xml && idx; idx--) xml = xml->next; - return xml; -} - -// returns the value of the requested tag attribute or NULL if not found -const char *ezxml_attr(ezxml_t xml, const char *attr) -{ - int i = 0, j = 1; - ezxml_root_t root = (ezxml_root_t)xml; - - if (! xml || ! xml->attr) return NULL; - while (xml->attr[i] && strcmp(attr, xml->attr[i])) i += 2; - if (xml->attr[i]) return xml->attr[i + 1]; // found attribute - - while (root->xml.parent) root = (ezxml_root_t)root->xml.parent; // root tag - for (i = 0; root->attr[i] && strcmp(xml->name, root->attr[i][0]); i++); - if (! root->attr[i]) return NULL; // no matching default attributes - while (root->attr[i][j] && strcmp(attr, root->attr[i][j])) j += 3; - return (root->attr[i][j]) ? root->attr[i][j + 1] : NULL; // found default -} - -// same as ezxml_get but takes an already initialized va_list -ezxml_t ezxml_vget(ezxml_t xml, va_list ap) -{ - char *name = va_arg(ap, char *); - int idx = -1; - - if (name && *name) { - idx = va_arg(ap, int); - xml = ezxml_child(xml, name); - } - return (idx < 0) ? xml : ezxml_vget(ezxml_idx(xml, idx), ap); -} - -// Traverses the xml tree to retrieve a specific subtag. Takes a variable -// length list of tag names and indexes. The argument list must be terminated -// by either an index of -1 or an empty string tag name. Example: -// title = ezxml_get(library, "shelf", 0, "book", 2, "title", -1); -// This retrieves the title of the 3rd book on the 1st shelf of library. -// Returns NULL if not found. -ezxml_t ezxml_get(ezxml_t xml, ...) -{ - va_list ap; - ezxml_t r; - - va_start(ap, xml); - r = ezxml_vget(xml, ap); - va_end(ap); - return r; -} - -// returns a null terminated array of processing instructions for the given -// target -const char **ezxml_pi(ezxml_t xml, const char *target) -{ - ezxml_root_t root = (ezxml_root_t)xml; - int i = 0; - - if (! root) return (const char **)EZXML_NIL; - while (root->xml.parent) root = (ezxml_root_t)root->xml.parent; // root tag - while (root->pi[i] && strcmp(target, root->pi[i][0])) i++; // find target - return (const char **)((root->pi[i]) ? root->pi[i] + 1 : EZXML_NIL); -} - -// set an error string and return root -ezxml_t ezxml_err(ezxml_root_t root, char *s, const char *err, ...) -{ - va_list ap; - int line = 1; - char *t, fmt[EZXML_ERRL]; - - for (t = root->s; t < s; t++) if (*t == '\n') line++; - snprintf(fmt, EZXML_ERRL, "[error near line %d]: %s", line, err); - - va_start(ap, err); - vsnprintf(root->err, EZXML_ERRL, fmt, ap); - va_end(ap); - - return &root->xml; -} - -// Recursively decodes entity and character references and normalizes new lines -// ent is a null terminated array of alternating entity names and values. set t -// to '&' for general entity decoding, '%' for parameter entity decoding, 'c' -// for cdata sections, ' ' for attribute normalization, or '*' for non-cdata -// attribute normalization. Returns s, or if the decoded string is longer than -// s, returns a malloced string that must be freed. -char *ezxml_decode(char *s, char **ent, char t) -{ - char *e, *r = s, *m = s; - long b, c, d, l; - - for (; *s; s++) { // normalize line endings - while (*s == '\r') { - *(s++) = '\n'; - if (*s == '\n') memmove(s, (s + 1), strlen(s)); - } - } - - for (s = r; ; ) { - while (*s && *s != '&' && (*s != '%' || t != '%') && !isspace(*s)) s++; - - if (! *s) break; - else if (t != 'c' && ! strncmp(s, "&#", 2)) { // character reference - if (s[2] == 'x') c = strtol(s + 3, &e, 16); // base 16 - else c = strtol(s + 2, &e, 10); // base 10 - if (! c || *e != ';') { s++; continue; } // not a character ref - - if (c < 0x80) *(s++) = c; // US-ASCII subset - else { // multi-byte UTF-8 sequence - for (b = 0, d = c; d; d /= 2) b++; // number of bits in c - b = (b - 2) / 5; // number of bytes in payload - *(s++) = (0xFF << (7 - b)) | (c >> (6 * b)); // head - while (b) *(s++) = 0x80 | ((c >> (6 * --b)) & 0x3F); // payload - } - - memmove(s, strchr(s, ';') + 1, strlen(strchr(s, ';'))); - } - else if ((*s == '&' && (t == '&' || t == ' ' || t == '*')) || - (*s == '%' && t == '%')) { // entity reference - for (b = 0; ent[b] && strncmp(s + 1, ent[b], strlen(ent[b])); - b += 2); // find entity in entity list - - if (ent[b++]) { // found a match - if ((c = strlen(ent[b])) - 1 > (e = strchr(s, ';')) - s) { - l = (d = (s - r)) + c + strlen(e); // new length - r = (r == m) ? strcpy(malloc(l), r) : realloc(r, l); - e = strchr((s = r + d), ';'); // fix up pointers - } - - memmove(s + c, e + 1, strlen(e)); // shift rest of string - strncpy(s, ent[b], c); // copy in replacement text - } - else s++; // not a known entity - } - else if ((t == ' ' || t == '*') && isspace(*s)) *(s++) = ' '; - else s++; // no decoding needed - } - - if (t == '*') { // normalize spaces for non-cdata attributes - for (s = r; *s; s++) { - if ((l = strspn(s, " "))) memmove(s, s + l, strlen(s + l) + 1); - while (*s && *s != ' ') s++; - } - if (--s >= r && *s == ' ') *s = '\0'; // trim any trailing space - } - return r; -} - -// called when parser finds start of new tag -void ezxml_open_tag(ezxml_root_t root, char *name, char **attr) -{ - ezxml_t xml = root->cur; - - if (xml->name) xml = ezxml_add_child(xml, name, strlen(xml->txt)); - else xml->name = name; // first open tag - - xml->attr = attr; - root->cur = xml; // update tag insertion point -} - -// called when parser finds character content between open and closing tag -void ezxml_char_content(ezxml_root_t root, char *s, size_t len, char t) -{ - ezxml_t xml = root->cur; - char *m = s; - size_t l; - - if (! xml || ! xml->name || ! len) return; // sanity check - - s[len] = '\0'; // null terminate text (calling functions anticipate this) - len = strlen(s = ezxml_decode(s, root->ent, t)) + 1; - - if (! *(xml->txt)) xml->txt = s; // initial character content - else { // allocate our own memory and make a copy - xml->txt = (xml->flags & EZXML_TXTM) // allocate some space - ? realloc(xml->txt, (l = strlen(xml->txt)) + len) - : strcpy(malloc((l = strlen(xml->txt)) + len), xml->txt); - strcpy(xml->txt + l, s); // add new char content - if (s != m) free(s); // free s if it was malloced by ezxml_decode() - } - - if (xml->txt != m) ezxml_set_flag(xml, EZXML_TXTM); -} - -// called when parser finds closing tag -ezxml_t ezxml_close_tag(ezxml_root_t root, char *name, char *s) -{ - if (! root->cur || ! root->cur->name || strcmp(name, root->cur->name)) - return ezxml_err(root, s, "unexpected closing tag </%s>", name); - - root->cur = root->cur->parent; - return NULL; -} - -// checks for circular entity references, returns non-zero if no circular -// references are found, zero otherwise -int ezxml_ent_ok(char *name, char *s, char **ent) -{ - int i; - - for (; ; s++) { - while (*s && *s != '&') s++; // find next entity reference - if (! *s) return 1; - if (! strncmp(s + 1, name, strlen(name))) return 0; // circular ref. - for (i = 0; ent[i] && strncmp(ent[i], s + 1, strlen(ent[i])); i += 2); - if (ent[i] && ! ezxml_ent_ok(name, ent[i + 1], ent)) return 0; - } -} - -// called when the parser finds a processing instruction -void ezxml_proc_inst(ezxml_root_t root, char *s, size_t len) -{ - int i = 0, j = 1; - char *target = s; - - s[len] = '\0'; // null terminate instruction - if (*(s += strcspn(s, EZXML_WS))) { - *s = '\0'; // null terminate target - s += strspn(s + 1, EZXML_WS) + 1; // skip whitespace after target - } - - if (! strcmp(target, "xml")) { // <?xml ... ?> - if ((s = strstr(s, "standalone")) && ! strncmp(s + strspn(s + 10, - EZXML_WS "='\"") + 10, "yes", 3)) root->standalone = 1; - return; - } - - if (! root->pi[0]) *(root->pi = malloc(sizeof(char **))) = NULL; //first pi - - while (root->pi[i] && strcmp(target, root->pi[i][0])) i++; // find target - if (! root->pi[i]) { // new target - root->pi = realloc(root->pi, sizeof(char **) * (i + 2)); - root->pi[i] = malloc(sizeof(char *) * 3); - root->pi[i][0] = target; - root->pi[i][1] = (char *)(root->pi[i + 1] = NULL); // terminate pi list - root->pi[i][2] = strdup(""); // empty document position list - } - - while (root->pi[i][j]) j++; // find end of instruction list for this target - root->pi[i] = realloc(root->pi[i], sizeof(char *) * (j + 3)); - root->pi[i][j + 2] = realloc(root->pi[i][j + 1], j + 1); - strcpy(root->pi[i][j + 2] + j - 1, (root->xml.name) ? ">" : "<"); - root->pi[i][j + 1] = NULL; // null terminate pi list for this target - root->pi[i][j] = s; // set instruction -} - -// called when the parser finds an internal doctype subset -short ezxml_internal_dtd(ezxml_root_t root, char *s, size_t len) -{ - char q, *c, *t, *n = NULL, *v, **ent, **pe; - int i, j; - - pe = memcpy(malloc(sizeof(EZXML_NIL)), EZXML_NIL, sizeof(EZXML_NIL)); - - for (s[len] = '\0'; s; ) { - while (*s && *s != '<' && *s != '%') s++; // find next declaration - - if (! *s) break; - else if (! strncmp(s, "<!ENTITY", 8)) { // parse entity definitions - c = s += strspn(s + 8, EZXML_WS) + 8; // skip white space separator - n = s + strspn(s, EZXML_WS "%"); // find name - *(s = n + strcspn(n, EZXML_WS)) = ';'; // append ; to name - - v = s + strspn(s + 1, EZXML_WS) + 1; // find value - if ((q = *(v++)) != '"' && q != '\'') { // skip externals - s = strchr(s, '>'); - continue; - } - - for (i = 0, ent = (*c == '%') ? pe : root->ent; ent[i]; i++); - ent = realloc(ent, (i + 3) * sizeof(char *)); // space for next ent - if (*c == '%') pe = ent; - else root->ent = ent; - - *(++s) = '\0'; // null terminate name - if ((s = strchr(v, q))) *(s++) = '\0'; // null terminate value - ent[i + 1] = ezxml_decode(v, pe, '%'); // set value - ent[i + 2] = NULL; // null terminate entity list - if (! ezxml_ent_ok(n, ent[i + 1], ent)) { // circular reference - if (ent[i + 1] != v) free(ent[i + 1]); - ezxml_err(root, v, "circular entity declaration &%s", n); - break; - } - else ent[i] = n; // set entity name - } - else if (! strncmp(s, "<!ATTLIST", 9)) { // parse default attributes - t = s + strspn(s + 9, EZXML_WS) + 9; // skip whitespace separator - if (! *t) { ezxml_err(root, t, "unclosed <!ATTLIST"); break; } - if (*(s = t + strcspn(t, EZXML_WS ">")) == '>') continue; - else *s = '\0'; // null terminate tag name - for (i = 0; root->attr[i] && strcmp(n, root->attr[i][0]); i++); - - while (*(n = ++s + strspn(s, EZXML_WS)) && *n != '>') { - if (*(s = n + strcspn(n, EZXML_WS))) *s = '\0'; // attr name - else { ezxml_err(root, t, "malformed <!ATTLIST"); break; } - - s += strspn(s + 1, EZXML_WS) + 1; // find next token - c = (strncmp(s, "CDATA", 5)) ? "*" : " "; // is it cdata? - if (! strncmp(s, "NOTATION", 8)) - s += strspn(s + 8, EZXML_WS) + 8; - s = (*s == '(') ? strchr(s, ')') : s + strcspn(s, EZXML_WS); - if (! s) { ezxml_err(root, t, "malformed <!ATTLIST"); break; } - - s += strspn(s, EZXML_WS ")"); // skip white space separator - if (! strncmp(s, "#FIXED", 6)) - s += strspn(s + 6, EZXML_WS) + 6; - if (*s == '#') { // no default value - s += strcspn(s, EZXML_WS ">") - 1; - if (*c == ' ') continue; // cdata is default, nothing to do - v = NULL; - } - else if ((*s == '"' || *s == '\'') && // default value - (s = strchr(v = s + 1, *s))) *s = '\0'; - else { ezxml_err(root, t, "malformed <!ATTLIST"); break; } - - if (! root->attr[i]) { // new tag name - root->attr = (! i) ? malloc(2 * sizeof(char **)) - : realloc(root->attr, - (i + 2) * sizeof(char **)); - root->attr[i] = malloc(2 * sizeof(char *)); - root->attr[i][0] = t; // set tag name - root->attr[i][1] = (char *)(root->attr[i + 1] = NULL); - } - - for (j = 1; root->attr[i][j]; j += 3); // find end of list - root->attr[i] = realloc(root->attr[i], - (j + 4) * sizeof(char *)); - - root->attr[i][j + 3] = NULL; // null terminate list - root->attr[i][j + 2] = c; // is it cdata? - root->attr[i][j + 1] = (v) ? ezxml_decode(v, root->ent, *c) - : NULL; - root->attr[i][j] = n; // attribute name - } - } - else if (! strncmp(s, "<!--", 4)) s = strstr(s + 4, "-->"); // comments - else if (! strncmp(s, "<?", 2)) { // processing instructions - if ((s = strstr(c = s + 2, "?>"))) - ezxml_proc_inst(root, c, s++ - c); - } - else if (*s == '<') s = strchr(s, '>'); // skip other declarations - else if (*(s++) == '%' && ! root->standalone) break; - } - - free(pe); - return ! *root->err; -} - -// Converts a UTF-16 string to UTF-8. Returns a new string that must be freed -// or NULL if no conversion was needed. -char *ezxml_str2utf8(char **s, size_t *len) -{ - char *u; - size_t l = 0, sl, max = *len; - long c, d; - int b, be = (**s == '\xFE') ? 1 : (**s == '\xFF') ? 0 : -1; - - if (be == -1) return NULL; // not UTF-16 - - u = malloc(max); - for (sl = 2; sl < *len - 1; sl += 2) { - c = (be) ? (((*s)[sl] & 0xFF) << 8) | ((*s)[sl + 1] & 0xFF) //UTF-16BE - : (((*s)[sl + 1] & 0xFF) << 8) | ((*s)[sl] & 0xFF); //UTF-16LE - if (c >= 0xD800 && c <= 0xDFFF && (sl += 2) < *len - 1) { // high-half - d = (be) ? (((*s)[sl] & 0xFF) << 8) | ((*s)[sl + 1] & 0xFF) - : (((*s)[sl + 1] & 0xFF) << 8) | ((*s)[sl] & 0xFF); - c = (((c & 0x3FF) << 10) | (d & 0x3FF)) + 0x10000; - } - - while (l + 6 > max) u = realloc(u, max += EZXML_BUFSIZE); - if (c < 0x80) u[l++] = c; // US-ASCII subset - else { // multi-byte UTF-8 sequence - for (b = 0, d = c; d; d /= 2) b++; // bits in c - b = (b - 2) / 5; // bytes in payload - u[l++] = (0xFF << (7 - b)) | (c >> (6 * b)); // head - while (b) u[l++] = 0x80 | ((c >> (6 * --b)) & 0x3F); // payload - } - } - return *s = realloc(u, *len = l); -} - -// frees a tag attribute list -void ezxml_free_attr(char **attr) { - int i = 0; - char *m; - - if (! attr || attr == EZXML_NIL) return; // nothing to free - while (attr[i]) i += 2; // find end of attribute list - m = attr[i + 1]; // list of which names and values are malloced - for (i = 0; m[i]; i++) { - if (m[i] & EZXML_NAMEM) free(attr[i * 2]); - if (m[i] & EZXML_TXTM) free(attr[(i * 2) + 1]); - } - free(m); - free(attr); -} - -// parse the given xml string and return an ezxml structure -ezxml_t ezxml_parse_str(char *s, size_t len) -{ - ezxml_root_t root = (ezxml_root_t)ezxml_new(NULL); - char q, e, *d, **attr, **a = NULL; // initialize a to avoid compile warning - int l, i, j; - - root->m = s; - if (! len) return ezxml_err(root, NULL, "root tag missing"); - root->u = ezxml_str2utf8(&s, &len); // convert utf-16 to utf-8 - root->e = (root->s = s) + len; // record start and end of work area - - e = s[len - 1]; // save end char - s[len - 1] = '\0'; // turn end char into null terminator - - while (*s && *s != '<') s++; // find first tag - if (! *s) return ezxml_err(root, s, "root tag missing"); - - for (; ; ) { - attr = (char **)EZXML_NIL; - d = ++s; - - if (isalpha(*s) || *s == '_' || *s == ':' || *s < '\0') { // new tag - if (! root->cur) - return ezxml_err(root, d, "markup outside of root element"); - - s += strcspn(s, EZXML_WS "/>"); - while (isspace(*s)) *(s++) = '\0'; // null terminate tag name - - if (*s && *s != '/' && *s != '>') // find tag in default attr list - for (i = 0; (a = root->attr[i]) && strcmp(a[0], d); i++); - - for (l = 0; *s && *s != '/' && *s != '>'; l += 2) { // new attrib - attr = (l) ? realloc(attr, (l + 4) * sizeof(char *)) - : malloc(4 * sizeof(char *)); // allocate space - attr[l + 3] = (l) ? realloc(attr[l + 1], (l / 2) + 2) - : malloc(2); // mem for list of maloced vals - strcpy(attr[l + 3] + (l / 2), " "); // value is not malloced - attr[l + 2] = NULL; // null terminate list - attr[l + 1] = ""; // temporary attribute value - attr[l] = s; // set attribute name - - s += strcspn(s, EZXML_WS "=/>"); - if (*s == '=' || isspace(*s)) { - *(s++) = '\0'; // null terminate tag attribute name - q = *(s += strspn(s, EZXML_WS "=")); - if (q == '"' || q == '\'') { // attribute value - attr[l + 1] = ++s; - while (*s && *s != q) s++; - if (*s) *(s++) = '\0'; // null terminate attribute val - else { - ezxml_free_attr(attr); - return ezxml_err(root, d, "missing %c", q); - } - - for (j = 1; a && a[j] && strcmp(a[j], attr[l]); j +=3); - attr[l + 1] = ezxml_decode(attr[l + 1], root->ent, (a - && a[j]) ? *a[j + 2] : ' '); - if (attr[l + 1] < d || attr[l + 1] > s) - attr[l + 3][l / 2] = EZXML_TXTM; // value malloced - } - } - while (isspace(*s)) s++; - } - - if (*s == '/') { // self closing tag - *(s++) = '\0'; - if ((*s && *s != '>') || (! *s && e != '>')) { - if (l) ezxml_free_attr(attr); - return ezxml_err(root, d, "missing >"); - } - ezxml_open_tag(root, d, attr); - ezxml_close_tag(root, d, s); - } - else if ((q = *s) == '>' || (! *s && e == '>')) { // open tag - *s = '\0'; // temporarily null terminate tag name - ezxml_open_tag(root, d, attr); - *s = q; - } - else { - if (l) ezxml_free_attr(attr); - return ezxml_err(root, d, "missing >"); - } - } - else if (*s == '/') { // close tag - s += strcspn(d = s + 1, EZXML_WS ">") + 1; - if (! (q = *s) && e != '>') return ezxml_err(root, d, "missing >"); - *s = '\0'; // temporarily null terminate tag name - if (ezxml_close_tag(root, d, s)) return &root->xml; - if (isspace(*s = q)) s += strspn(s, EZXML_WS); - } - else if (! strncmp(s, "!--", 3)) { // xml comment - if (! (s = strstr(s + 3, "--")) || (*(s += 2) != '>' && *s) || - (! *s && e != '>')) return ezxml_err(root, d, "unclosed <!--"); - } - else if (! strncmp(s, "![CDATA[", 8)) { // cdata - if ((s = strstr(s, "]]>"))) - ezxml_char_content(root, d + 8, (s += 2) - d - 10, 'c'); - else return ezxml_err(root, d, "unclosed <![CDATA["); - } - else if (! strncmp(s, "!DOCTYPE", 8)) { // dtd - for (l = 0; *s && ((! l && *s != '>') || (l && (*s != ']' || - *(s + strspn(s + 1, EZXML_WS) + 1) != '>'))); - l = (*s == '[') ? 1 : l) s += strcspn(s + 1, "[]>") + 1; - if (! *s && e != '>') - return ezxml_err(root, d, "unclosed <!DOCTYPE"); - d = (l) ? strchr(d, '[') + 1 : d; - if (l && ! ezxml_internal_dtd(root, d, s++ - d)) return &root->xml; - } - else if (*s == '?') { // <?...?> processing instructions - do { s = strchr(s, '?'); } while (s && *(++s) && *s != '>'); - if (! s || (! *s && e != '>')) - return ezxml_err(root, d, "unclosed <?"); - else ezxml_proc_inst(root, d + 1, s - d - 2); - } - else return ezxml_err(root, d, "unexpected <"); - - if (! s || ! *s) break; - *s = '\0'; - d = ++s; - if (*s && *s != '<') { // tag character content - while (*s && *s != '<') s++; - if (*s) ezxml_char_content(root, d, s - d, '&'); - else break; - } - else if (! *s) break; - } - - if (! root->cur) return &root->xml; - else if (! root->cur->name) return ezxml_err(root, d, "root tag missing"); - else return ezxml_err(root, d, "unclosed tag <%s>", root->cur->name); -} - -// Wrapper for ezxml_parse_str() that accepts a file stream. Reads the entire -// stream into memory and then parses it. For xml files, use ezxml_parse_file() -// or ezxml_parse_fd() -ezxml_t ezxml_parse_fp(FILE *fp) -{ - ezxml_root_t root; - size_t l, len = 0; - char *s; - - if (! (s = malloc(EZXML_BUFSIZE))) return NULL; - do { - len += (l = fread((s + len), 1, EZXML_BUFSIZE, fp)); - if (l == EZXML_BUFSIZE) s = realloc(s, len + EZXML_BUFSIZE); - } while (s && l == EZXML_BUFSIZE); - - if (! s) return NULL; - root = (ezxml_root_t)ezxml_parse_str(s, len); - root->len = -1; // so we know to free s in ezxml_free() - return &root->xml; -} - -// A wrapper for ezxml_parse_str() that accepts a file descriptor. First -// attempts to mem map the file. Failing that, reads the file into memory. -// Returns NULL on failure. -ezxml_t ezxml_parse_fd(int fd) -{ - ezxml_root_t root; - struct stat st; - size_t l; - void *m; - - if (fd < 0) return NULL; - fstat(fd, &st); - -#ifndef EZXML_NOMMAP - l = (st.st_size + sysconf(_SC_PAGESIZE) - 1) & ~(sysconf(_SC_PAGESIZE) -1); - if ((m = mmap(NULL, l, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0)) != - MAP_FAILED) { - madvise(m, l, MADV_SEQUENTIAL); // optimize for sequential access - root = (ezxml_root_t)ezxml_parse_str(m, st.st_size); - madvise(m, root->len = l, MADV_NORMAL); // put it back to normal - } - else { // mmap failed, read file into memory -#endif // EZXML_NOMMAP - l = read(fd, m = malloc(st.st_size), st.st_size); - root = (ezxml_root_t)ezxml_parse_str(m, l); - root->len = -1; // so we know to free s in ezxml_free() -#ifndef EZXML_NOMMAP - } -#endif // EZXML_NOMMAP - return &root->xml; -} - -// a wrapper for ezxml_parse_fd that accepts a file name -ezxml_t ezxml_parse_file(const char *file) -{ - int fd = open(file, O_RDONLY, 0); - ezxml_t xml = ezxml_parse_fd(fd); - - if (fd >= 0) close(fd); - return xml; -} - -// Encodes ampersand sequences appending the results to *dst, reallocating *dst -// if length excedes max. a is non-zero for attribute encoding. Returns *dst -char *ezxml_ampencode(const char *s, size_t len, char **dst, size_t *dlen, - size_t *max, short a) -{ - const char *e; - - for (e = s + len; s != e; s++) { - while (*dlen + 10 > *max) *dst = realloc(*dst, *max += EZXML_BUFSIZE); - - switch (*s) { - case '\0': return *dst; - case '&': *dlen += sprintf(*dst + *dlen, "&"); break; - case '<': *dlen += sprintf(*dst + *dlen, "<"); break; - case '>': *dlen += sprintf(*dst + *dlen, ">"); break; - case '"': *dlen += sprintf(*dst + *dlen, (a) ? """ : "\""); break; - case '\n': *dlen += sprintf(*dst + *dlen, (a) ? "
" : "\n"); break; - case '\t': *dlen += sprintf(*dst + *dlen, (a) ? "	" : "\t"); break; - case '\r': *dlen += sprintf(*dst + *dlen, "
"); break; - default: (*dst)[(*dlen)++] = *s; - } - } - return *dst; -} - -// Recursively converts each tag to xml appending it to *s. Reallocates *s if -// its length excedes max. start is the location of the previous tag in the -// parent tag's character content. Returns *s. -char *ezxml_toxml_r(ezxml_t xml, char **s, size_t *len, size_t *max, - size_t start, char ***attr) -{ - int i, j; - char *txt = (xml->parent) ? xml->parent->txt : ""; - size_t off = 0; - - // parent character content up to this tag - *s = ezxml_ampencode(txt + start, xml->off - start, s, len, max, 0); - - while (*len + strlen(xml->name) + 4 > *max) // reallocate s - *s = realloc(*s, *max += EZXML_BUFSIZE); - - *len += sprintf(*s + *len, "<%s", xml->name); // open tag - for (i = 0; xml->attr[i]; i += 2) { // tag attributes - if (ezxml_attr(xml, xml->attr[i]) != xml->attr[i + 1]) continue; - while (*len + strlen(xml->attr[i]) + 7 > *max) // reallocate s - *s = realloc(*s, *max += EZXML_BUFSIZE); - - *len += sprintf(*s + *len, " %s=\"", xml->attr[i]); - ezxml_ampencode(xml->attr[i + 1], -1, s, len, max, 1); - *len += sprintf(*s + *len, "\""); - } - - for (i = 0; attr[i] && strcmp(attr[i][0], xml->name); i++); - for (j = 1; attr[i] && attr[i][j]; j += 3) { // default attributes - if (! attr[i][j + 1] || ezxml_attr(xml, attr[i][j]) != attr[i][j + 1]) - continue; // skip duplicates and non-values - while (*len + strlen(attr[i][j]) + 7 > *max) // reallocate s - *s = realloc(*s, *max += EZXML_BUFSIZE); - - *len += sprintf(*s + *len, " %s=\"", attr[i][j]); - ezxml_ampencode(attr[i][j + 1], -1, s, len, max, 1); - *len += sprintf(*s + *len, "\""); - } - *len += sprintf(*s + *len, ">"); - - *s = (xml->child) ? ezxml_toxml_r(xml->child, s, len, max, 0, attr) //child - : ezxml_ampencode(xml->txt, -1, s, len, max, 0); //data - - while (*len + strlen(xml->name) + 4 > *max) // reallocate s - *s = realloc(*s, *max += EZXML_BUFSIZE); - - *len += sprintf(*s + *len, "</%s>", xml->name); // close tag - - while (txt[off] && off < xml->off) off++; // make sure off is within bounds - return (xml->ordered) ? ezxml_toxml_r(xml->ordered, s, len, max, off, attr) - : ezxml_ampencode(txt + off, -1, s, len, max, 0); -} - -// Converts an ezxml structure back to xml. Returns a string of xml data that -// must be freed. -char *ezxml_toxml(ezxml_t xml) -{ - ezxml_t p = (xml) ? xml->parent : NULL, o = (xml) ? xml->ordered : NULL; - ezxml_root_t root = (ezxml_root_t)xml; - size_t len = 0, max = EZXML_BUFSIZE; - char *s = strcpy(malloc(max), ""), *t, *n; - int i, j, k; - - if (! xml || ! xml->name) return realloc(s, len + 1); - while (root->xml.parent) root = (ezxml_root_t)root->xml.parent; // root tag - - for (i = 0; ! p && root->pi[i]; i++) { // pre-root processing instructions - for (k = 2; root->pi[i][k - 1]; k++); - for (j = 1; (n = root->pi[i][j]); j++) { - if (root->pi[i][k][j - 1] == '>') continue; // not pre-root - while (len + strlen(t = root->pi[i][0]) + strlen(n) + 7 > max) - s = realloc(s, max += EZXML_BUFSIZE); - len += sprintf(s + len, "<?%s%s%s?>\n", t, *n ? " " : "", n); - } - } - - xml->parent = xml->ordered = NULL; - s = ezxml_toxml_r(xml, &s, &len, &max, 0, root->attr); - xml->parent = p; - xml->ordered = o; - - for (i = 0; ! p && root->pi[i]; i++) { // post-root processing instructions - for (k = 2; root->pi[i][k - 1]; k++); - for (j = 1; (n = root->pi[i][j]); j++) { - if (root->pi[i][k][j - 1] == '<') continue; // not post-root - while (len + strlen(t = root->pi[i][0]) + strlen(n) + 7 > max) - s = realloc(s, max += EZXML_BUFSIZE); - len += sprintf(s + len, "\n<?%s%s%s?>", t, *n ? " " : "", n); - } - } - return realloc(s, len + 1); -} - -// free the memory allocated for the ezxml structure -void ezxml_free(ezxml_t xml) -{ - ezxml_root_t root = (ezxml_root_t)xml; - int i, j; - char **a, *s; - - if (! xml) return; - ezxml_free(xml->child); - ezxml_free(xml->ordered); - - if (! xml->parent) { // free root tag allocations - for (i = 10; root->ent[i]; i += 2) // 0 - 9 are default entites (<>&"') - if ((s = root->ent[i + 1]) < root->s || s > root->e) free(s); - free(root->ent); // free list of general entities - - for (i = 0; (a = root->attr[i]); i++) { - for (j = 1; a[j++]; j += 2) // free malloced attribute values - if (a[j] && (a[j] < root->s || a[j] > root->e)) free(a[j]); - free(a); - } - if (root->attr[0]) free(root->attr); // free default attribute list - - for (i = 0; root->pi[i]; i++) { - for (j = 1; root->pi[i][j]; j++); - free(root->pi[i][j + 1]); - free(root->pi[i]); - } - if (root->pi[0]) free(root->pi); // free processing instructions - - if (root->len == -1) free(root->m); // malloced xml data -#ifndef EZXML_NOMMAP - else if (root->len) munmap(root->m, root->len); // mem mapped xml data -#endif // EZXML_NOMMAP - if (root->u) free(root->u); // utf8 conversion - } - - ezxml_free_attr(xml->attr); // tag attributes - if ((xml->flags & EZXML_TXTM)) free(xml->txt); // character content - if ((xml->flags & EZXML_NAMEM)) free(xml->name); // tag name - free(xml); -} - -// return parser error message or empty string if none -const char *ezxml_error(ezxml_t xml) -{ - while (xml && xml->parent) xml = xml->parent; // find root tag - return (xml) ? ((ezxml_root_t)xml)->err : ""; -} - -// returns a new empty ezxml structure with the given root tag name -ezxml_t ezxml_new(const char *name) -{ - static char *ent[] = { "lt;", "<", "gt;", ">", "quot;", """, - "apos;", "'", "amp;", "&", NULL }; - ezxml_root_t root = (ezxml_root_t)memset(malloc(sizeof(struct ezxml_root)), - '\0', sizeof(struct ezxml_root)); - root->xml.name = (char *)name; - root->cur = &root->xml; - strcpy(root->err, root->xml.txt = ""); - root->ent = memcpy(malloc(sizeof(ent)), ent, sizeof(ent)); - root->attr = root->pi = (char ***)(root->xml.attr = EZXML_NIL); - return &root->xml; -} - -// inserts an existing tag into an ezxml structure -ezxml_t ezxml_insert(ezxml_t xml, ezxml_t dest, size_t off) -{ - ezxml_t cur, prev, head; - - xml->next = xml->sibling = xml->ordered = NULL; - xml->off = off; - xml->parent = dest; - - if ((head = dest->child)) { // already have sub tags - if (head->off <= off) { // not first subtag - for (cur = head; cur->ordered && cur->ordered->off <= off; - cur = cur->ordered); - xml->ordered = cur->ordered; - cur->ordered = xml; - } - else { // first subtag - xml->ordered = head; - dest->child = xml; - } - - for (cur = head, prev = NULL; cur && strcmp(cur->name, xml->name); - prev = cur, cur = cur->sibling); // find tag type - if (cur && cur->off <= off) { // not first of type - while (cur->next && cur->next->off <= off) cur = cur->next; - xml->next = cur->next; - cur->next = xml; - } - else { // first tag of this type - if (prev && cur) prev->sibling = cur->sibling; // remove old first - xml->next = cur; // old first tag is now next - for (cur = head, prev = NULL; cur && cur->off <= off; - prev = cur, cur = cur->sibling); // new sibling insert point - xml->sibling = cur; - if (prev) prev->sibling = xml; - } - } - else dest->child = xml; // only sub tag - - return xml; -} - -// Adds a child tag. off is the offset of the child tag relative to the start -// of the parent tag's character content. Returns the child tag. -ezxml_t ezxml_add_child(ezxml_t xml, const char *name, size_t off) -{ - ezxml_t child; - - if (! xml) return NULL; - child = (ezxml_t)memset(malloc(sizeof(struct ezxml)), '\0', - sizeof(struct ezxml)); - child->name = (char *)name; - child->attr = EZXML_NIL; - child->txt = ""; - - return ezxml_insert(child, xml, off); -} - -// sets the character content for the given tag and returns the tag -ezxml_t ezxml_set_txt(ezxml_t xml, const char *txt) -{ - if (! xml) return NULL; - if (xml->flags & EZXML_TXTM) free(xml->txt); // existing txt was malloced - xml->flags &= ~EZXML_TXTM; - xml->txt = (char *)txt; - return xml; -} - -// Sets the given tag attribute or adds a new attribute if not found. A value -// of NULL will remove the specified attribute. Returns the tag given. -ezxml_t ezxml_set_attr(ezxml_t xml, const char *name, const char *value) -{ - int l = 0, c; - - if (! xml) return NULL; - while (xml->attr[l] && strcmp(xml->attr[l], name)) l += 2; - if (! xml->attr[l]) { // not found, add as new attribute - if (! value) return xml; // nothing to do - if (xml->attr == EZXML_NIL) { // first attribute - xml->attr = malloc(4 * sizeof(char *)); - xml->attr[1] = strdup(""); // empty list of malloced names/vals - } - else xml->attr = realloc(xml->attr, (l + 4) * sizeof(char *)); - - xml->attr[l] = (char *)name; // set attribute name - xml->attr[l + 2] = NULL; // null terminate attribute list - xml->attr[l + 3] = realloc(xml->attr[l + 1], - (c = strlen(xml->attr[l + 1])) + 2); - strcpy(xml->attr[l + 3] + c, " "); // set name/value as not malloced - if (xml->flags & EZXML_DUP) xml->attr[l + 3][c] = EZXML_NAMEM; - } - else if (xml->flags & EZXML_DUP) free((char *)name); // name was strduped - - for (c = l; xml->attr[c]; c += 2); // find end of attribute list - if (xml->attr[c + 1][l / 2] & EZXML_TXTM) free(xml->attr[l + 1]); //old val - if (xml->flags & EZXML_DUP) xml->attr[c + 1][l / 2] |= EZXML_TXTM; - else xml->attr[c + 1][l / 2] &= ~EZXML_TXTM; - - if (value) xml->attr[l + 1] = (char *)value; // set attribute value - else { // remove attribute - if (xml->attr[c + 1][l / 2] & EZXML_NAMEM) free(xml->attr[l]); - memmove(xml->attr + l, xml->attr + l + 2, (c - l + 2) * sizeof(char*)); - xml->attr = realloc(xml->attr, (c + 2) * sizeof(char *)); - memmove(xml->attr[c + 1] + (l / 2), xml->attr[c + 1] + (l / 2) + 1, - (c / 2) - (l / 2)); // fix list of which name/vals are malloced - } - xml->flags &= ~EZXML_DUP; // clear strdup() flag - return xml; -} - -// sets a flag for the given tag and returns the tag -ezxml_t ezxml_set_flag(ezxml_t xml, short flag) -{ - if (xml) xml->flags |= flag; - return xml; -} - -// removes a tag along with its subtags without freeing its memory -ezxml_t ezxml_cut(ezxml_t xml) -{ - ezxml_t cur; - - if (! xml) return NULL; // nothing to do - if (xml->next) xml->next->sibling = xml->sibling; // patch sibling list - - if (xml->parent) { // not root tag - cur = xml->parent->child; // find head of subtag list - if (cur == xml) xml->parent->child = xml->ordered; // first subtag - else { // not first subtag - while (cur->ordered != xml) cur = cur->ordered; - cur->ordered = cur->ordered->ordered; // patch ordered list - - cur = xml->parent->child; // go back to head of subtag list - if (strcmp(cur->name, xml->name)) { // not in first sibling list - while (strcmp(cur->sibling->name, xml->name)) - cur = cur->sibling; - if (cur->sibling == xml) { // first of a sibling list - cur->sibling = (xml->next) ? xml->next - : cur->sibling->sibling; - } - else cur = cur->sibling; // not first of a sibling list - } - - while (cur->next && cur->next != xml) cur = cur->next; - if (cur->next) cur->next = cur->next->next; // patch next list - } - } - xml->ordered = xml->sibling = xml->next = NULL; - return xml; -} - -#ifdef EZXML_TEST // test harness -int main(int argc, char **argv) -{ - ezxml_t xml; - char *s; - int i; - - if (argc != 2) return fprintf(stderr, "usage: %s xmlfile\n", argv[0]); - - xml = ezxml_parse_file(argv[1]); - printf("%s\n", (s = ezxml_toxml(xml))); - free(s); - i = fprintf(stderr, "%s", ezxml_error(xml)); - ezxml_free(xml); - return (i) ? 1 : 0; -} -#endif // EZXML_TEST diff --git a/protocols/SkypeClassic/src/ezxml/ezxml.h b/protocols/SkypeClassic/src/ezxml/ezxml.h deleted file mode 100644 index 3e020788b4..0000000000 --- a/protocols/SkypeClassic/src/ezxml/ezxml.h +++ /dev/null @@ -1,167 +0,0 @@ -/* ezxml.h - * - * Copyright 2004-2006 Aaron Voisine <aaron@voisine.org> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef _EZXML_H -#define _EZXML_H - -#include <stdlib.h> -#include <stdio.h> -#include <stdarg.h> -#include <fcntl.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define EZXML_BUFSIZE 1024 // size of internal memory buffers -#define EZXML_NAMEM 0x80 // name is malloced -#define EZXML_TXTM 0x40 // txt is malloced -#define EZXML_DUP 0x20 // attribute name and value are strduped - -typedef struct ezxml *ezxml_t; -struct ezxml { - char *name; // tag name - char **attr; // tag attributes { name, value, name, value, ... NULL } - char *txt; // tag character content, empty string if none - size_t off; // tag offset from start of parent tag character content - ezxml_t next; // next tag with same name in this section at this depth - ezxml_t sibling; // next tag with different name in same section and depth - ezxml_t ordered; // next tag, same section and depth, in original order - ezxml_t child; // head of sub tag list, NULL if none - ezxml_t parent; // parent tag, NULL if current tag is root tag - short flags; // additional information -}; - -// Given a string of xml data and its length, parses it and creates an ezxml -// structure. For efficiency, modifies the data by adding null terminators -// and decoding ampersand sequences. If you don't want this, copy the data and -// pass in the copy. Returns NULL on failure. -ezxml_t ezxml_parse_str(char *s, size_t len); - -// A wrapper for ezxml_parse_str() that accepts a file descriptor. First -// attempts to mem map the file. Failing that, reads the file into memory. -// Returns NULL on failure. -ezxml_t ezxml_parse_fd(int fd); - -// a wrapper for ezxml_parse_fd() that accepts a file name -ezxml_t ezxml_parse_file(const char *file); - -// Wrapper for ezxml_parse_str() that accepts a file stream. Reads the entire -// stream into memory and then parses it. For xml files, use ezxml_parse_file() -// or ezxml_parse_fd() -ezxml_t ezxml_parse_fp(FILE *fp); - -// returns the first child tag (one level deeper) with the given name or NULL -// if not found -ezxml_t ezxml_child(ezxml_t xml, const char *name); - -// returns the next tag of the same name in the same section and depth or NULL -// if not found -#define ezxml_next(xml) ((xml) ? xml->next : NULL) - -// Returns the Nth tag with the same name in the same section at the same depth -// or NULL if not found. An index of 0 returns the tag given. -ezxml_t ezxml_idx(ezxml_t xml, int idx); - -// returns the name of the given tag -#define ezxml_name(xml) ((xml) ? xml->name : NULL) - -// returns the given tag's character content or empty string if none -#define ezxml_txt(xml) ((xml) ? xml->txt : "") - -// returns the value of the requested tag attribute, or NULL if not found -const char *ezxml_attr(ezxml_t xml, const char *attr); - -// Traverses the ezxml sturcture to retrieve a specific subtag. Takes a -// variable length list of tag names and indexes. The argument list must be -// terminated by either an index of -1 or an empty string tag name. Example: -// title = ezxml_get(library, "shelf", 0, "book", 2, "title", -1); -// This retrieves the title of the 3rd book on the 1st shelf of library. -// Returns NULL if not found. -ezxml_t ezxml_get(ezxml_t xml, ...); - -// Converts an ezxml structure back to xml. Returns a string of xml data that -// must be freed. -char *ezxml_toxml(ezxml_t xml); - -// returns a NULL terminated array of processing instructions for the given -// target -const char **ezxml_pi(ezxml_t xml, const char *target); - -// frees the memory allocated for an ezxml structure -void ezxml_free(ezxml_t xml); - -// returns parser error message or empty string if none -const char *ezxml_error(ezxml_t xml); - -// returns a new empty ezxml structure with the given root tag name -ezxml_t ezxml_new(const char *name); - -// wrapper for ezxml_new() that strdup()s name -#define ezxml_new_d(name) ezxml_set_flag(ezxml_new(strdup(name)), EZXML_NAMEM) - -// Adds a child tag. off is the offset of the child tag relative to the start -// of the parent tag's character content. Returns the child tag. -ezxml_t ezxml_add_child(ezxml_t xml, const char *name, size_t off); - -// wrapper for ezxml_add_child() that strdup()s name -#define ezxml_add_child_d(xml, name, off) \ - ezxml_set_flag(ezxml_add_child(xml, strdup(name), off), EZXML_NAMEM) - -// sets the character content for the given tag and returns the tag -ezxml_t ezxml_set_txt(ezxml_t xml, const char *txt); - -// wrapper for ezxml_set_txt() that strdup()s txt -#define ezxml_set_txt_d(xml, txt) \ - ezxml_set_flag(ezxml_set_txt(xml, strdup(txt)), EZXML_TXTM) - -// Sets the given tag attribute or adds a new attribute if not found. A value -// of NULL will remove the specified attribute. Returns the tag given. -ezxml_t ezxml_set_attr(ezxml_t xml, const char *name, const char *value); - -// Wrapper for ezxml_set_attr() that strdup()s name/value. Value cannot be NULL -#define ezxml_set_attr_d(xml, name, value) \ - ezxml_set_attr(ezxml_set_flag(xml, EZXML_DUP), strdup(name), strdup(value)) - -// sets a flag for the given tag and returns the tag -ezxml_t ezxml_set_flag(ezxml_t xml, short flag); - -// removes a tag along with its subtags without freeing its memory -ezxml_t ezxml_cut(ezxml_t xml); - -// inserts an existing tag into an ezxml structure -ezxml_t ezxml_insert(ezxml_t xml, ezxml_t dest, size_t off); - -// Moves an existing tag to become a subtag of dest at the given offset from -// the start of dest's character content. Returns the moved tag. -#define ezxml_move(xml, dest, off) ezxml_insert(ezxml_cut(xml), dest, off) - -// removes a tag along with all its subtags -#define ezxml_remove(xml) ezxml_free(ezxml_cut(xml)) - -#ifdef __cplusplus -} -#endif - -#endif // _EZXML_H diff --git a/protocols/SkypeClassic/src/filexfer.cpp b/protocols/SkypeClassic/src/filexfer.cpp deleted file mode 100644 index 313af9a315..0000000000 --- a/protocols/SkypeClassic/src/filexfer.cpp +++ /dev/null @@ -1,382 +0,0 @@ -#include "skype.h"
-#include "skypeapi.h"
-#include "utf8.h"
-#include "msglist.h"
-#include "pthread.h"
-
-extern char g_szProtoName[];
-
-/* Services */
-INT_PTR SkypeRecvFile(WPARAM, LPARAM lParam)
-{
- DBEVENTINFO dbei = { 0 };
- CCSDATA *ccs = (CCSDATA *)lParam;
- PROTORECVEVENT *pre = (PROTORECVEVENT *)ccs->lParam;
- size_t cbFilename;
- int nFiles;
- INT_PTR ret = 0;
-
- db_unset(ccs->hContact, "CList", "Hidden");
- dbei.cbSize = sizeof(dbei);
- dbei.szModule = SKYPE_PROTONAME;
- dbei.timestamp = pre->timestamp;
- if (pre->flags & PREF_CREATEREAD) dbei.flags |= DBEF_READ;
- dbei.eventType = EVENTTYPE_FILE;
- dbei.cbBlob = sizeof(DWORD);
- for (nFiles = 0; cbFilename = mir_strlen(&pre->szMessage[dbei.cbBlob]); nFiles++)
- dbei.cbBlob += DWORD(cbFilename) + 1;
- dbei.cbBlob++;
- dbei.pBlob = (PBYTE)pre->szMessage;
-
- TYP_MSGLENTRY *pEntry = MsgList_Add(pre->lParam, db_event_add(ccs->hContact, &dbei));
- if (pEntry) {
- DWORD cbSize = sizeof(PROTOFILETRANSFERSTATUS);
- /* Allocate basic entry and fill some stuff we already know */
- if (pEntry->pfts = calloc(1, cbSize)) {
- PROTOFILETRANSFERSTATUS *pfts = (PROTOFILETRANSFERSTATUS*)pEntry->pfts;
- size_t iOffs = sizeof(DWORD);
-
- pfts->cbSize = cbSize;
- pfts->hContact = ccs->hContact;
- pfts->totalFiles = nFiles;
- if (pfts->pszFiles = (char**)calloc(nFiles + 1, sizeof(char*))) {
- char *pFN;
- for (size_t i = 0; cbFilename = mir_strlen(pFN = &pre->szMessage[iOffs]); i++) {
- pfts->pszFiles[i] = strdup(pFN);
- iOffs += cbFilename + 1;
- }
- pfts->flags |= PFTS_UTF;
- ret = pre->lParam;
- }
- }
- }
- return ret;
-}
-
-INT_PTR SkypeSendFile(WPARAM, LPARAM lParam)
-{
- CCSDATA *ccs = (CCSDATA *)lParam;
- DBVARIANT dbv;
- char *mymsgcmd, *utfmsg = NULL, *pszFile = NULL;
- TCHAR **files = (TCHAR**)ccs->lParam;
- int nFiles, ret = 0;
- BYTE bIsChatroom = 0 != db_get_b(ccs->hContact, SKYPE_PROTONAME, "ChatRoom", 0);
-
- if (bIsChatroom) {
- if (db_get_s(ccs->hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv))
- return 0;
- mymsgcmd = "CHATFILE";
- }
- else {
- if (db_get_s(ccs->hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- return 0;
- mymsgcmd = "FILE";
- }
-
- size_t iLen = 0;
- for (nFiles = 0; files[nFiles]; nFiles++) {
- utfmsg = (char*)make_utf8_string(files[nFiles]);
- iLen += mir_strlen(utfmsg) + 3;
- if (pszFile = pszFile ? (char*)realloc(pszFile, iLen) : (char*)calloc(1, iLen)) {
- if (nFiles > 0) mir_strcat(pszFile, ",");
- mir_strcat(pszFile, "\"");
- mir_strcat(pszFile, utfmsg);
- mir_strcat(pszFile, "\"");
- }
- free(utfmsg);
- }
- if (pszFile) {
- if (SkypeSend("%s %s %s", mymsgcmd, dbv.pszVal, pszFile) == 0) {
- /* No chatmessage IDs available for filetransfers, there is no possibility
- * in SkypeKit to check if incoming filetransfer SENT message belongs to
- * the last file sent :( */
- char *str = SkypeRcvTime("CHATFILE", SkypeTime(NULL), INFINITE);
- if (str) {
- if (strncmp(str, "ERROR", 5)) {
- char *pTok = strtok(str + 9, " ");
-
- if (pTok) {
- ret = strtoul(pTok, NULL, 10);
- TYP_MSGLENTRY *pEntry = MsgList_Add(ret, -1);
- if (pEntry) {
- DWORD cbSize = sizeof(PROTOFILETRANSFERSTATUS);
- /* Allocate basic entry and fill some stuff we already know */
- if (pEntry->pfts = calloc(1, cbSize)) {
- PROTOFILETRANSFERSTATUS *pfts = (PROTOFILETRANSFERSTATUS*)pEntry->pfts;
-
- pfts->cbSize = cbSize;
- pfts->hContact = ccs->hContact;
- pfts->totalFiles = nFiles;
- pfts->flags = PFTS_SENDING;
- if (pfts->pszFiles = (char**)calloc(nFiles + 1, sizeof(char*))) {
- for (int i = 0; i < nFiles; i++)
- ((TCHAR**)pfts->pszFiles)[i] = _tcsdup(files[i]);
- }
- }
-
- }
- }
- }
- free(str);
- }
- }
- free(pszFile);
- }
- db_free(&dbv);
- return ret;
-}
-
-INT_PTR SkypeFileAllow(WPARAM, LPARAM lParam)
-{
- CCSDATA *ccs = (CCSDATA *)lParam;
- if (!ccs || !ccs->lParam || !ccs->wParam)
- return 0;
-
- TYP_MSGLENTRY *pEntry = MsgList_FindMessage(ccs->wParam);
- if (!pEntry)
- return 0;
-
- char *pszMsgNum, szMsgNum[16];
- sprintf(szMsgNum, "%d", ccs->wParam);
- char *pszXferIDs = SkypeGetErr("CHATMESSAGE", szMsgNum, "FILETRANSFERS");
- if (!pszXferIDs)
- return 0;
-
- INT_PTR ret = 0;
- char *pszDir = (char*)make_utf8_string((wchar_t*)ccs->lParam);
- if (pszDir) {
- for (pszMsgNum = strtok(pszXferIDs, ", "); pszMsgNum; pszMsgNum = strtok(NULL, ", ")) {
- if (SkypeSend("ALTER FILETRANSFER %s ACCEPT %s", pszMsgNum, pszDir) != -1) {
- char *ptr = SkypeRcv("ALTER FILETRANSFER ACCEPT", 2000);
- if (ptr) {
- if (strncmp(ptr, "ERROR", 5))
- ret = ccs->wParam;
- free(ptr);
- }
- }
- }
-
- /* Now we know the save directory in pfts */
- PROTOFILETRANSFERSTATUS *pfts = (PROTOFILETRANSFERSTATUS*)pEntry->pfts;
- pfts->szWorkingDir = pszDir;
- }
- free(pszXferIDs);
- return ret;
-}
-
-INT_PTR SkypeFileCancel(WPARAM, LPARAM lParam)
-{
- CCSDATA *ccs = (CCSDATA *)lParam;
- if (!ccs || !ccs->wParam)
- return 0;
-
- char *pszMsgNum, szMsgNum[16], *ptr;
- sprintf(szMsgNum, "%d", ccs->wParam);
- char *pszXferIDs = SkypeGetErr("CHATMESSAGE", szMsgNum, "FILETRANSFERS");
- if (!pszXferIDs)
- return 0;
- INT_PTR ret = 1;
- for (pszMsgNum = strtok(pszXferIDs, ", "); pszMsgNum; pszMsgNum = strtok(NULL, ", ")) {
- if (SkypeSend("ALTER FILETRANSFER %s CANCEL", pszMsgNum) != -1) {
- if (ptr = SkypeRcv("ALTER FILETRANSFER CANCEL", 2000)) {
- if (strncmp(ptr, "ERROR", 5))
- ret = 0;
- free(ptr);
- }
- }
- }
- free(pszXferIDs);
- return ret;
-}
-
-void FXFreePFTS(void *Ppfts)
-{
- PROTOFILETRANSFERSTATUS *pfts = (PROTOFILETRANSFERSTATUS*)Ppfts;
- if (pfts->pszFiles) {
- for (int i = 0; i < pfts->totalFiles; i++)
- free(pfts->pszFiles[i]);
- free(pfts->pszFiles);
- free(pfts->szWorkingDir);
- }
- free(pfts);
-}
-
-BOOL FXHandleRecv(PROTORECVEVENT *pre, MCONTACT hContact)
-{
- // Our custom Skypekit FILETRANSFER extension
- size_t cbMsg = sizeof(DWORD), cbNewSize;
-
- char szMsgNum[16];
- sprintf(szMsgNum, "%d", pre->lParam);
- char *pszXferIDs = SkypeGetErr("CHATMESSAGE", szMsgNum, "FILETRANSFERS");
- if (!pszXferIDs)
- return FALSE;
-
- for (char *pszMsgNum = strtok(pszXferIDs, ", "); pszMsgNum; pszMsgNum = strtok(NULL, ", ")) {
- char *pszStatus = SkypeGetErrID("FILETRANSFER", pszMsgNum, "STATUS");
- if (pszStatus) {
- if (!mir_strcmp(pszStatus, "NEW") || !mir_strcmp(pszStatus, "PLACEHOLDER")) {
- char *pszType = SkypeGetErr("FILETRANSFER", pszMsgNum, "TYPE");
- if (pszType) {
- if (!mir_strcmp(pszType, "INCOMING")) {
- char *pszFN = SkypeGetErr("FILETRANSFER", pszMsgNum, "FILENAME");
- if (pszFN) {
- cbNewSize = cbMsg + mir_strlen(pszFN) + 2;
- if ((pre->szMessage = (char*)realloc(pre->szMessage, cbNewSize))) {
- memcpy(pre->szMessage + cbMsg, pszFN, cbNewSize - cbMsg - 1);
- cbMsg = cbNewSize - 1;
- }
- else pszMsgNum = NULL;
- free(pszFN);
- }
- }
- free(pszType);
- }
- }
- free(pszStatus);
- }
- }
- free(pszXferIDs);
- if (pre->szMessage) {
- *((TCHAR*)&pre->szMessage[cbMsg]) = 0;
- *((DWORD*)pre->szMessage) = pre->lParam;
-
- CCSDATA ccs = { 0 };
- ccs.szProtoService = PSR_FILE;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)pre;
- CallServiceSync(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
- free(pre->szMessage);
- return TRUE;
- }
- return FALSE;
-}
-
-typedef struct
-{
- BOOL bStatus;
- char szNum[16];
- char szArg[32];
-} ft_args;
-
-void FXHandleMessageThread(ft_args *pargs)
-{
- char *pszChat = SkypeGetErr("FILETRANSFER", pargs->szNum, "CHATMESSAGE");
- if (!pszChat) {
- free(pargs);
- return;
- }
-
- DWORD dwChat = strtoul(pszChat, NULL, 10);
- TYP_MSGLENTRY *pEntry = MsgList_FindMessage(dwChat);
- if (!pEntry) {
- free(pargs);
- free(pszChat);
- return;
- }
-
- MCONTACT hContact = ((PROTOFILETRANSFERSTATUS*)pEntry->pfts)->hContact;
- if (!hContact) {
- free(pargs);
- free(pszChat);
- return;
- }
-
- if (pargs->bStatus) {
- if (!mir_strcmp(pargs->szArg, "CONNECTING"))
- ProtoBroadcastAck(SKYPE_PROTONAME, hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, (HANDLE)dwChat, 0);
- else if (!strncmp(pargs->szArg, "TRANSFERRING", 12))
- ProtoBroadcastAck(SKYPE_PROTONAME, hContact, ACKTYPE_FILE, ACKRESULT_CONNECTED, (HANDLE)dwChat, 0);
- else if (!mir_strcmp(pargs->szArg, "FAILED"))
- ProtoBroadcastAck(SKYPE_PROTONAME, hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)dwChat, 0);
- else if (!mir_strcmp(pargs->szArg, "CANCELLED"))
- ProtoBroadcastAck(SKYPE_PROTONAME, hContact, ACKTYPE_FILE, ACKRESULT_DENIED, (HANDLE)dwChat, 0);
- else if (!mir_strcmp(pargs->szArg, "COMPLETED")) {
- // Check if all transfers from this message are completed.
- char *pszMsgNum, *pszStatus;
- BOOL bAllComplete = TRUE;
- char *pszXferIDs = SkypeGetErr("CHATMESSAGE", pszChat, "FILETRANSFERS");
- if (pszXferIDs) {
- for (pszMsgNum = strtok(pszXferIDs, ", "); pszMsgNum; pszMsgNum = strtok(NULL, ", ")) {
- if (pszStatus = SkypeGetErrID("FILETRANSFER", pszMsgNum, "STATUS")) {
- if (mir_strcmp(pszStatus, "COMPLETED")) bAllComplete = FALSE;
- free(pszStatus);
- if (!bAllComplete) break;
- }
- }
- free(pszXferIDs);
- if (bAllComplete) {
- ProtoBroadcastAck(SKYPE_PROTONAME, hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, (HANDLE)dwChat, 0);
- // We could free pEntry at this point, but Garbage Collector will take care of it anyway
- }
- }
- }
- }
- else {
- // BYTESTRANSFERRED
- PROTOFILETRANSFERSTATUS pfts = { 0 };
- char *pszMsgNum;
- int i;
-
- // This always needs some fetching to fill PFTS :/
- char *pszXferIDs = SkypeGetErr("CHATMESSAGE", pszChat, "FILETRANSFERS");
- if (pszXferIDs) {
- for (pszMsgNum = strtok(pszXferIDs, ", "), i = 0; pszMsgNum; pszMsgNum = strtok(NULL, ", "), i++) {
- DWORD dwTransferred;
- BOOL bIsCurFil = mir_strcmp(pargs->szNum, pszMsgNum) == 0;
-
- if (bIsCurFil)
- pfts.currentFileNumber = i;
- char *pszcbFile = SkypeGetErr("FILETRANSFER", pszMsgNum, "FILESIZE");
- if (pszcbFile) {
- dwTransferred = strtoul(pszcbFile, NULL, 10);
- pfts.totalBytes += dwTransferred;
- if (bIsCurFil) pfts.currentFileSize = dwTransferred;
- free(pszcbFile);
- }
- if (pszcbFile = SkypeGetErrID("FILETRANSFER", pszMsgNum, "BYTESTRANSFERRED")) {
- dwTransferred = strtoul(pszcbFile, NULL, 10);
- pfts.totalProgress += dwTransferred;
- if (bIsCurFil) pfts.currentFileProgress = dwTransferred;
- free(pszcbFile);
- }
- }
- free(pszXferIDs);
- PROTOFILETRANSFERSTATUS *pftsv2 = (PROTOFILETRANSFERSTATUS*)pEntry->pfts;
-
- pftsv2->currentFileNumber = pfts.currentFileNumber;
- pftsv2->totalBytes = pfts.totalBytes;
- pftsv2->totalProgress = pfts.totalProgress;
- pftsv2->currentFileSize = pfts.currentFileSize;
- pftsv2->currentFileProgress = pfts.currentFileProgress;
- pftsv2->szCurrentFile = pftsv2->pszFiles[pftsv2->currentFileNumber];
- ProtoBroadcastAck(SKYPE_PROTONAME, hContact, ACKTYPE_FILE, ACKRESULT_DATA, (HANDLE)dwChat, (LPARAM)pEntry->pfts);
- }
- }
- free(pszChat);
- free(pargs);
-}
-
-BOOL FXHandleMessage(const char *pszMsg)
-{
- ft_args args = { 0 };
-
- const char *pTok = strchr(pszMsg, ' ');
- if (!pTok)
- return FALSE;
-
- strncpy(args.szNum, pszMsg, pTok - pszMsg);
- pszMsg = pTok + 1;
- if (!(pTok = strchr(pszMsg, ' '))) return FALSE;
- pTok++;
- if (!(args.bStatus = !strncmp(pszMsg, "STATUS", 6)) && strncmp(pszMsg, "BYTESTRANSFERRED", 16))
- return FALSE;
- ft_args *pargs = (ft_args*)malloc(sizeof(args));
- if (!pargs) return TRUE;
- strncpy(args.szArg, pTok, sizeof(args.szArg));
- memcpy(pargs, &args, sizeof(args));
- pthread_create((pThreadFunc)FXHandleMessageThread, pargs);
- return TRUE;
-}
-
diff --git a/protocols/SkypeClassic/src/filexfer.h b/protocols/SkypeClassic/src/filexfer.h deleted file mode 100644 index e35f26e900..0000000000 --- a/protocols/SkypeClassic/src/filexfer.h +++ /dev/null @@ -1,9 +0,0 @@ -#include "skype.h"
-INT_PTR SkypeRecvFile(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeFileAllow(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeFileCancel(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeSendFile(WPARAM wParam, LPARAM lParam);
-
-BOOL FXHandleRecv(PROTORECVEVENT *pre, MCONTACT hContact);
-BOOL FXHandleMessage(const char *pszMsg);
-void FXFreePFTS(void *pfts);
diff --git a/protocols/SkypeClassic/src/gchat.cpp b/protocols/SkypeClassic/src/gchat.cpp deleted file mode 100644 index c8e4dca6b5..0000000000 --- a/protocols/SkypeClassic/src/gchat.cpp +++ /dev/null @@ -1,830 +0,0 @@ -#include "skype.h" -#include "skypeapi.h" -#include "gchat.h" -#include "contacts.h" -#include "debug.h" -#include "utf8.h" -#include "pthread.h" - - -#ifndef DWLP_USER -#define DWLP_USER DWL_USER -#endif - -#ifdef _UNICODE -#define STR "%S" -#else -#define STR "%s" -#endif - -#pragma warning (disable: 4706) // assignment within conditional expression - -extern HANDLE hInitChat; -extern HINSTANCE hInst; -extern char protocol, g_szProtoName[]; - -static gchat_contacts *chats=NULL; -static int chatcount=0; -static CRITICAL_SECTION m_GCMutex; - -// TODO: Disable groupchat for Protocol verisons <5 - -/****************************************************************************/ -/* Chat management helper functions */ -/****************************************************************************/ - -/* Get the gchat_contacts entry for the chat with the id szChatId - If the chat doesn't already exist in the list, it is added. - - Parameters: szChatId - String with the chat ID of the chat to be found - Returns: Pointer to the gchat_contacts entry for the given id. - NULL on failure (not enough memory) -*/ -gchat_contacts *GetChat(const TCHAR *szChatId) { - for (int i=0;i<chatcount;i++) - if (!mir_tstrcmp(chats[i].szChatName, szChatId)) - return &chats[i]; - - gchat_contacts *pchats = (gchat_contacts *)realloc(chats, sizeof(gchat_contacts)*(++chatcount)); - if (pchats) { - chats=pchats; - memset(&chats[chatcount-1], 0, sizeof(gchat_contacts)); - chats[chatcount-1].szChatName=_tcsdup(szChatId); - return &chats[chatcount-1]; - } - return NULL; -} - -/* Removes the gchat_contacts entry for the chat with the id szChatId, - if it exists. - - Parameters: szChatId - String with the chat ID to be removed from list - */ -void RemChat(TCHAR *szChatId) { - for (int i=0;i<chatcount;i++) - if (!mir_tstrcmp(chats[i].szChatName, szChatId)) { - if (chats[i].szChatName) free(chats[i].szChatName); - if (chats[i].mJoinedContacts) free(chats[i].mJoinedContacts); - if (i<--chatcount) memmove(&chats[i], &chats[i+1], (chatcount-i)*sizeof(gchat_contacts)); - gchat_contacts *pchats = (gchat_contacts *)realloc(chats, sizeof(gchat_contacts)*chatcount); - if (pchats) - chats = pchats; - return; - } -} - -/* Checks, if the contact with the handle hContact exists in the groupchat - given in gc - - Parameters: gc - gchat_contacts entry for the chat session to be searched - who - Name of member - Returns: -1 = Not found - >=0 = Number of found item - */ -static int ExistsChatContact(gchat_contacts *gc, const TCHAR *who) { - for (int i=0;i<gc->mJoinedCount;i++) - if (mir_tstrcmp(gc->mJoinedContacts[i].who, who)==0) - return i; - return -1; -} - -gchat_contact *GetChatContact(gchat_contacts *gc, const TCHAR *who) { - int i = ExistsChatContact (gc, who); - - if (i==-1) return NULL; - return &gc->mJoinedContacts[i]; -} - -/* Adds contact with the name who to the groupchat given in gc - - Parameters: gc - - Returns: -1 = Contact not found - -2 = On failure - >=0 = Number of added item - */ -static int AddChatContact(gchat_contacts *gc, char *who, TCHAR *pszRole) -{ - LOG (("AddChatContact %s", who)); - TCHAR *twho = make_nonutf_tchar_string((const unsigned char*)who); - if (!twho) - return -2; - - int i = ExistsChatContact(gc, twho); - if (i >= 0) { - free_nonutf_tchar_string(twho); - return i; - } - - MCONTACT hContact = find_contact(who); - - GCDEST gcd = { SKYPE_PROTONAME, gc->szChatName, GC_EVENT_JOIN }; - GCEVENT gce = { sizeof(gce), &gcd }; - gce.time = (DWORD)time(NULL); - gce.dwFlags = GCEF_ADDTOLOG; - gce.ptszStatus = pszRole ? pszRole : _T("USER"); - - CONTACTINFO ci = {0}; - ci.cbSize = sizeof(ci); - ci.szProto = SKYPE_PROTONAME; - ci.dwFlag = CNF_DISPLAY | CNF_TCHAR; - ci.hContact = hContact; - - if (hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) - gce.ptszNick=ci.pszVal; - else - gce.ptszNick=twho; - - gce.ptszUID=twho; - if (!CallService(MS_GC_EVENT, 0, (LPARAM)&gce)) { - if ((gc->mJoinedContacts=(gchat_contact*)realloc(gc->mJoinedContacts, (gc->mJoinedCount+1)*sizeof(gchat_contact)))) - { - gc->mJoinedContacts[i=gc->mJoinedCount].hContact=hContact; - mir_tstrcpy (gc->mJoinedContacts[i].szRole, gce.ptszStatus); - mir_tstrcpy (gc->mJoinedContacts[i].who, twho); - gc->mJoinedCount++; - } - } - if (ci.pszVal) mir_free (ci.pszVal); - free_nonutf_tchar_string(twho); - return i; -} - -void RemChatContact(gchat_contacts *gc, const TCHAR *who) { - if (!gc) - return; - for (int i=0;i<gc->mJoinedCount;i++) - if (mir_tstrcmp(gc->mJoinedContacts[i].who, who)==0) { - if (i<--gc->mJoinedCount) - memmove(&gc->mJoinedContacts[i], &gc->mJoinedContacts[i+1], (gc->mJoinedCount-i)*sizeof(gchat_contact)); - if (gc->mJoinedCount) gc->mJoinedContacts = (gchat_contact*)realloc(gc->mJoinedContacts, sizeof(gchat_contact)*gc->mJoinedCount); - else {free (gc->mJoinedContacts); gc->mJoinedContacts = NULL; } - return; - } -} - -MCONTACT find_chat(LPCTSTR chatname) { - for (MCONTACT hContact=db_find_first(SKYPE_PROTONAME);hContact != NULL;hContact=db_find_next(hContact,SKYPE_PROTONAME)) { - if (db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==1) - { - DBVARIANT dbv; - if (!db_get_ts(hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv)) { - int tCompareResult = mir_tstrcmp(dbv.ptszVal, chatname); - db_free(&dbv); - if (!tCompareResult) - return hContact; // already there, return handle - } - } - } - return NULL; -} - -MCONTACT find_chatA(char *chatname) { - for (MCONTACT hContact=db_find_first(SKYPE_PROTONAME);hContact != NULL;hContact=db_find_next(hContact,SKYPE_PROTONAME)) { - if (db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==1) - { - DBVARIANT dbv; - if (!db_get_s(hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv)) { - int tCompareResult = mir_strcmp(dbv.pszVal, chatname); - db_free(&dbv); - if (!tCompareResult) - return hContact; // already there, return handle - } - } - } - return NULL; -} - - - -int __cdecl AddMembers(char *szSkypeMsg) { - BYTE *contactmask=NULL; - DBVARIANT dbv2; - CONTACTINFO ci={0}; - char *who, *nextoken; - int i, iRet = 0; - gchat_contacts *gc; - - LOG(("AddMembers STARTED")); - char *ptr=strstr(szSkypeMsg, " MEMBERS"); - if (!ptr) - return -1; - EnterCriticalSection(&m_GCMutex); - ptr[0]=0; - TCHAR *szChatId = make_nonutf_tchar_string((const unsigned char*)szSkypeMsg+5); - ptr+=9; - if (find_chat(szChatId) && (gc=GetChat(szChatId)) && - !db_get_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv2)) - { - char *pszMemObjs, *token; - - if (protocol>=7 && (pszMemObjs = SkypeGet ("CHAT", szSkypeMsg+5, "MEMBEROBJECTS"))) { - // Add new contacts (protocol 7+ with memberobjects, supports roles) - for (token=strtok_r(pszMemObjs, ", ", &nextoken); token; token=strtok_r(NULL, ", ", &nextoken)) { - if (!contactmask && !(contactmask = (unsigned char*)calloc(gc->mJoinedCount, 1))) { - iRet = -1; - break; - } - if (!(who = SkypeGet ("CHATMEMBER", token, "IDENTITY"))) continue; - if (mir_strcmp(who, dbv2.pszVal)) { - TCHAR *ptszRole = NULL; - - char *pszRole = SkypeGet("CHATMEMBER", token, "ROLE"); - if (pszRole) - ptszRole = make_nonutf_tchar_string((const unsigned char*)pszRole); - - i=AddChatContact(gc, who, ptszRole); - free_nonutf_tchar_string (ptszRole); - if (pszRole) free (pszRole); - BYTE *pcontactmask = (BYTE *) realloc(contactmask, gc->mJoinedCount); - if (!pcontactmask) { - iRet = -1; - free (who); - break; - } - contactmask = pcontactmask; - contactmask[i]=TRUE; - } - free (who); - } - free (pszMemObjs); - } - else - { - // Add new contacts (normal) - for (who=strtok_r(ptr, " ", &nextoken); who; who=strtok_r(NULL, " ", &nextoken)) { - if (!contactmask && !(contactmask = (unsigned char*)calloc(gc->mJoinedCount, 1))) { - iRet = -1; - break; - } - if (mir_strcmp(who, dbv2.pszVal)) { - i=AddChatContact(gc, who, NULL); - BYTE *pcontactmask; - if (i<0 || !(pcontactmask= (BYTE *) realloc(contactmask, gc->mJoinedCount))) { - iRet = -1; - break; - } - contactmask = pcontactmask; - contactmask[i]=TRUE; - } - } - } - // Quit contacts which are no longer there - if (iRet == 0 && contactmask) { - GCDEST gcd = { SKYPE_PROTONAME, szChatId, GC_EVENT_QUIT }; - GCEVENT gce = { sizeof(gce), &gcd }; - gce.time = (DWORD)time(NULL); - gce.dwFlags = GCEF_ADDTOLOG; - - ci.cbSize = sizeof(ci); - ci.szProto = SKYPE_PROTONAME; - ci.dwFlag = CNF_DISPLAY; - - for (i=0;i<gc->mJoinedCount;i++) - if (!contactmask[i]) - { - ci.hContact = gc->mJoinedContacts[i].hContact; - ci.dwFlag = CNF_TCHAR; - if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal; - else gce.ptszNick=gc->mJoinedContacts[i].who; - gce.ptszUID = gc->mJoinedContacts[i].who; - CallService(MS_GC_EVENT, 0, (LPARAM)&gce); - if (ci.pszVal) { - mir_free (ci.pszVal); - ci.pszVal=NULL; - } - RemChatContact(gc, gc->mJoinedContacts[i].who); - } - // We don't do this, because the dialog group-chat may have been started intentionally - /* - if (gc->mJoinedCount == 1) { - // switch back to normal session - KillChatSession(&gcd); - } - */ - } - if (contactmask) free(contactmask); - db_free(&dbv2); - } else iRet = -1; - free_nonutf_tchar_string (szChatId); - LeaveCriticalSection(&m_GCMutex); - LOG(("AddMembers DONE")); - return iRet; -} - -void AddMembersThread(char *szSkypeMsg) -{ - AddMembers(szSkypeMsg); - free(szSkypeMsg); -} - -/****************************************************************************/ -/* Window procedures */ -/****************************************************************************/ -INT_PTR CALLBACK InputBoxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) { - case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); - SetWindowLongPtr(hwndDlg, DWLP_USER, lParam); - SetDlgItemText(hwndDlg, IDC_TEXT, (TCHAR*)lParam); - return TRUE; - } - - case WM_COMMAND: - switch ( LOWORD( wParam )) { - case IDOK: - { - GetDlgItemText(hwndDlg, IDC_TEXT, (TCHAR*)GetWindowLongPtr(hwndDlg, DWLP_USER), (MAX_BUF-1)*sizeof(TCHAR)); - EndDialog(hwndDlg, 1); - break; - } - case IDCANCEL: - EndDialog(hwndDlg, 0); - break; - } } - return FALSE; -} - -/****************************************************************************/ -/* Core Chat management functions */ -/****************************************************************************/ - -/* We have a new Groupchat - - This hook is called when a new chat is initialised. - Parameters: wParam = (char *)Name of new chat session [Has to be ASCIIZ/UTF8] - lParam = 1 - Create groupchat, but don't open it - 0 - Default - open groupchat after init -*/ - -int __cdecl ChatInit(WPARAM wParam, LPARAM lParam) -{ - if (!wParam) return -1; - - DBVARIANT dbv, dbv2; - int iRet = -1; - - GCSESSION gcw = { sizeof(gcw) }; - gcw.iType = GCW_CHATROOM; - gcw.pszModule = SKYPE_PROTONAME; - - char *szChatName = SkypeGet ("CHAT", (char *)wParam, "FRIENDLYNAME"); - if (!szChatName || !*szChatName) - gcw.ptszName=TranslateT("Unknown"); - else { - gcw.ptszName=make_unicode_string((const unsigned char*)szChatName); - free (szChatName); - szChatName = (char*)gcw.ptszName; - } - gcw.ptszID = make_nonutf_tchar_string((const unsigned char*)wParam); - gcw.ptszStatusbarText = NULL; - EnterCriticalSection(&m_GCMutex); - if (!CallService(MS_GC_NEWSESSION, 0, (LPARAM)&gcw)) { - char *szChatRole; - - GCDEST gcd = { SKYPE_PROTONAME, gcw.ptszID, GC_EVENT_ADDGROUP }; - GCEVENT gce = { sizeof(gce), &gcd }; - gce.ptszStatus = _T("CREATOR"); - // BUG: Groupchat returns nonzero on success here in earlier versions, so we don't check - // it here - CallService(MS_GC_EVENT, 0, (LPARAM)&gce); - gce.ptszStatus = _T("MASTER"); - CallService(MS_GC_EVENT, 0, (LPARAM)&gce); - gce.ptszStatus = _T("HELPER"); - CallService(MS_GC_EVENT, 0, (LPARAM)&gce); - gce.ptszStatus = _T("USER"); - CallService(MS_GC_EVENT, 0, (LPARAM)&gce); - gce.ptszStatus = _T("LISTENER"); - CallService(MS_GC_EVENT, 0, (LPARAM)&gce); - gce.ptszStatus = _T("APPLICANT"); - CallService(MS_GC_EVENT, 0, (LPARAM)&gce); - - gcd.iType = GC_EVENT_JOIN; - gce.ptszStatus = NULL; - if (protocol >=7 && (szChatRole = SkypeGet ("CHAT", (char *)wParam, "MYROLE"))) { - if (strncmp(szChatRole, "ERROR", 5)) - { - gce.ptszStatus = make_unicode_string((const unsigned char*)szChatRole); - free (szChatRole); - } - } - if (!gce.ptszStatus) gce.ptszStatus=_tcsdup(_T("CREATOR")); - - if (!db_get_ts(NULL, SKYPE_PROTONAME, "Nick", &dbv)) { - if (!db_get_ts(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv2)) { - gce.ptszNick = dbv.ptszVal; - gce.ptszUID = dbv2.ptszVal; - gce.time = 0; - gce.bIsMe = TRUE; - gce.dwFlags |= GCEF_ADDTOLOG; - if (!CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce)) { - gcd.iType = GC_EVENT_CONTROL; - if (!lParam) - CallService(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce); - CallService(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce); - CallService(MS_GC_EVENT, lParam ? WINDOW_HIDDEN : WINDOW_VISIBLE, (LPARAM)&gce); - SkypeSend ("GET CHAT %s MEMBERS", (char *)wParam); - iRet = 0; - } - else {LOG (("ChatInit: Joining 'me' failed."));} - } - db_free(&dbv2); - } - free ((void*)gce.ptszStatus); - db_free(&dbv); - } - free (szChatName); - free_nonutf_tchar_string ((void*)gcw.ptszID); - LeaveCriticalSection(&m_GCMutex); - return iRet; -} - -/* Open new Groupchat - - Parameters: szChatId = (char *)Name of new chat session -*/ -int __cdecl ChatStart(char *szChatId, BOOL bJustCreate) { - LOG(("ChatStart: New groupchat started")); - if (!szChatId || NotifyEventHooks(hInitChat, (WPARAM)szChatId, bJustCreate)) return -1; - return 0; -} - - -void KillChatSession(GCDEST *gcd) -{ - GCEVENT gce = { sizeof(gce), gcd }; - EnterCriticalSection(&m_GCMutex); - LOG(("KillChatSession: Groupchatsession terminated.")); - gcd->iType = GC_EVENT_CONTROL; - if (SkypeSend ("ALTER CHAT "STR" LEAVE", gcd->ptszID) == 0) - { - CallService(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce); - CallService(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce); - } - LeaveCriticalSection(&m_GCMutex); -} - -void InviteUser(const TCHAR *szChatId) -{ - if (!szChatId) - return; - - gchat_contacts *gc=GetChat(szChatId); - if (!gc) - return; - - // add the heading - HMENU tMenu = CreatePopupMenu(); - AppendMenu(tMenu, MF_STRING|MF_GRAYED|MF_DISABLED, 0, TranslateT("&Invite user...")); - AppendMenu(tMenu, MF_SEPARATOR, 1, NULL); - - DBVARIANT dbv; - POINT pt; - int j; - - // generate a list of contact - for (MCONTACT hContact = db_find_first(SKYPE_PROTONAME);hContact;hContact = db_find_next(hContact,SKYPE_PROTONAME)) { - if (!db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) && - db_get_w(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE)!=ID_STATUS_OFFLINE) - { - BOOL alreadyInSession = FALSE; - for (j=0; j<gc->mJoinedCount; j++) { - if (gc->mJoinedContacts[j].hContact==hContact) { - alreadyInSession = TRUE; - break; - } - } - if (!alreadyInSession) - AppendMenu(tMenu, MF_STRING, (UINT_PTR)hContact, - (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)); - } - - } - - HWND tWindow = CreateWindow(_T("EDIT"),_T(""),0,1,1,1,1,NULL,NULL,hInst,NULL); - - GetCursorPos (&pt); - MCONTACT hInvitedUser = (MCONTACT)TrackPopupMenu(tMenu, TPM_NONOTIFY | TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, tWindow, NULL); - DestroyMenu(tMenu); - DestroyWindow(tWindow); - - if (!hInvitedUser || db_get_s(hInvitedUser, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) - return; - SkypeSend ("ALTER CHAT "STR" ADDMEMBERS %s", szChatId, dbv.pszVal); - db_free(&dbv); - -} - -static void KickUser (MCONTACT hContact, GCHOOK *gch) -{ - EnterCriticalSection(&m_GCMutex); - if (SkypeSend ("ALTER CHAT "STR" KICK "STR, gch->pDest->ptszID, gch->ptszUID)!=-1) { - char *ptr = SkypeRcv("ALTER CHAT KICK", 2000); - if (ptr) { - if (strncmp(ptr, "ERROR", 5)) { - GCDEST gcd = { SKYPE_PROTONAME, gch->pDest->ptszID, GC_EVENT_KICK }; - GCEVENT gce = { sizeof(gce), &gcd }; - gce.time = (DWORD)time(NULL); - gce.dwFlags = GCEF_ADDTOLOG; - gce.ptszUID = gch->ptszUID; - - CONTACTINFO ci = {0}; - ci.cbSize = sizeof(ci); - ci.szProto = SKYPE_PROTONAME; - ci.dwFlag = CNF_DISPLAY | CNF_TCHAR; - ci.hContact = hContact; - if (hContact && !CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) gce.ptszNick=ci.pszVal; - else gce.ptszNick=gce.ptszUID; - - DBVARIANT dbv; - if (!db_get_ts(NULL, SKYPE_PROTONAME, "Nick", &dbv)) { - gce.ptszStatus = dbv.ptszVal; - CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce); - RemChatContact (GetChat(gcd.ptszID), gch->ptszUID); - db_free(&dbv); - } - if (ci.pszVal) mir_free (ci.pszVal); - } - free (ptr); - } - } - LeaveCriticalSection(&m_GCMutex); -} - -void SetChatTopic(const TCHAR *szChatId, TCHAR *szTopic, BOOL bSet) -{ - MCONTACT hContact = find_chat (szChatId); - char *szUTFTopic; - - GCDEST gcd = { SKYPE_PROTONAME, szChatId, GC_EVENT_TOPIC }; - GCEVENT gce = { sizeof(gce), &gcd }; - gce.ptszText = szTopic; - gce.dwFlags = GCEF_ADDTOLOG; - gce.time = (DWORD)time (NULL); - CallService(MS_GC_EVENT, 0, (LPARAM)&gce); - - gcd.iType = GC_EVENT_SETSBTEXT; - CallService(MS_GC_EVENT, 0, (LPARAM)&gce); - - if (bSet) { - szUTFTopic=(char*)make_utf8_string(szTopic); - if (szUTFTopic) { - SkypeSend ("ALTER CHAT "STR" SETTOPIC %s", szChatId, szUTFTopic); - free (szUTFTopic); - } - testfor ("ALTER CHAT SETTOPIC", INFINITE); - } - - if (hContact) - db_set_ts(hContact, SKYPE_PROTONAME, "Nick", szTopic); -} - - -int GCEventHook(WPARAM,LPARAM lParam) { - GCHOOK *gch = (GCHOOK*)lParam; - gchat_contacts *gc; - - if (gch == NULL || gch->pDest == NULL) - return 0; - if (_stricmp(gch->pDest->pszModule, SKYPE_PROTONAME)) - return 0; - gc = GetChat(gch->pDest->ptszID); - - switch (gch->pDest->iType) { - case GC_SESSION_TERMINATE: { - MCONTACT hContact; - - if (gc->mJoinedCount == 1) { - // switch back to normal session - // I don't know if this behaviour isn't a bit annoying, therefore, we - // don't do this now, until a user requests this feature :) - - // open up srmm dialog when quit while 1 person left - // CallService(MS_MSG_SENDMESSAGE, (WPARAM)gc->mJoinedContacts[0].hContact, 0); - - RemChatContact(gc, gc->mJoinedContacts[0].who); - } - // Delete Chatroom from Contact list, as we don't need it anymore...? - if (hContact = find_chat(gc->szChatName)) - CallService(MS_DB_CONTACT_DELETE, hContact, 0); - RemChat(gc->szChatName); - - break; - } - case GC_USER_MESSAGE: - if(gch->ptszText && mir_tstrlen(gch->ptszText) > 0) { - DBVARIANT dbv, dbv2; - CCSDATA ccs = {0}; - TCHAR *pEnd; - - // remove the ending linebreak - for (pEnd = &gch->ptszText[mir_tstrlen(gch->ptszText) - 1]; - *pEnd==_T('\r') || *pEnd==_T('\n'); pEnd--) *pEnd=0; - // Send message to the chat-contact - if (ccs.hContact = find_chat(gch->pDest->ptszID)) { - // If PREF_UTF is supported, just convert it to UTF8 and pass the buffer to PSS_MESSAGE - ccs.lParam = (LPARAM)make_utf8_string(gch->ptszText); - ccs.wParam = 0; - CallProtoService (SKYPE_PROTONAME, PSS_MESSAGE, 0, (LPARAM)&ccs); - free ((void*)ccs.lParam); - } - - // Add our line to the chatlog - GCDEST gcd = { gch->pDest->pszModule, gch->pDest->ptszID, 0 }; - GCEVENT gce = { sizeof(gce), &gcd }; - if ( _tcsncmp(gch->ptszText, _T("/me "), 4)==0 && mir_tstrlen(gch->ptszText)>4) { - gce.ptszText = gch->ptszText+4; - gcd.iType = GC_EVENT_ACTION; - } - else { - gce.ptszText = gch->ptszText; - gcd.iType = GC_EVENT_MESSAGE; - } - - if (db_get_ts(NULL, SKYPE_PROTONAME, "Nick", &dbv)) - gce.ptszNick = TranslateT("Me"); - else - gce.ptszNick = dbv.ptszVal; - db_get_ts(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv2); - gce.ptszUID = dbv2.ptszVal; - gce.time = (DWORD)time(NULL); - gce.dwFlags = GCEF_ADDTOLOG; - gce.bIsMe = TRUE; - CallService(MS_GC_EVENT, 0, (LPARAM)&gce); - if (dbv.pszVal) db_free(&dbv); - if (dbv2.pszVal) db_free(&dbv2); - } - break; - case GC_USER_CHANMGR: - InviteUser(gch->pDest->ptszID); - break; - case GC_USER_PRIVMESS: { - MCONTACT hContact = find_contactT(gch->ptszUID); - if (hContact) CallService(MS_MSG_SENDMESSAGE, hContact, 0); - break; - - } - case GC_USER_LOGMENU: - switch(gch->dwData) { - case 10: InviteUser(gch->pDest->ptszID); break; - case 20: KillChatSession(gch->pDest); break; - case 30: - { - TCHAR *ptr, buf[MAX_BUF]; - - ptr = SkypeGetT ("CHAT", (TCHAR*)gch->pDest->ptszID, "TOPIC"); - mir_tstrcpy(buf, ptr); - free(ptr); - if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_INPUTBOX), NULL, InputBoxDlgProc, (LPARAM)&buf)) - SetChatTopic(gch->pDest->ptszID, buf, TRUE); - break; - } - } - break; - case GC_USER_NICKLISTMENU: { - MCONTACT hContact = find_contactT(gch->ptszUID); - - switch(gch->dwData) { - case 10:CallService(MS_USERINFO_SHOWDIALOG, hContact, 0); break; - case 20:CallService(MS_HISTORY_SHOWCONTACTHISTORY, hContact, 0); break; - case 30: KickUser(hContact, gch); break; - case 110: KillChatSession(gch->pDest); break; - } - break; - } - default: - break; - } - - return 0; -} - -int __cdecl GCMenuHook(WPARAM,LPARAM lParam) { - GCMENUITEMS *gcmi= (GCMENUITEMS*) lParam; - DBVARIANT dbv; - TCHAR* szInvite = TranslateT("&Invite user..."); - TCHAR* szLeave = TranslateT("&Leave chat session"); - TCHAR* szTopic = TranslateT("Set &topic..."); - TCHAR* szDetails = TranslateT("User &details"); - TCHAR* szHistory = TranslateT("User &history"); - TCHAR* szKick = TranslateT("&Kick user"); - - static struct gc_item Item_log[] = { - {NULL, 10, MENU_ITEM, FALSE}, - {NULL, 30, MENU_ITEM, FALSE}, - {NULL, 20, MENU_ITEM, FALSE} - }; - static struct gc_item Item_nicklist_me[] = { - {NULL, 20, MENU_ITEM, FALSE}, - {_T(""), 100, MENU_SEPARATOR, FALSE}, - {NULL, 110, MENU_ITEM, FALSE} - }; - static struct gc_item Item_nicklist[] = { - {NULL, 10, MENU_ITEM, FALSE}, - {NULL, 20, MENU_ITEM, FALSE}, - {NULL, 30, MENU_ITEM, FALSE} - }; - - Item_log[0].pszDesc = szInvite; - Item_log[1].pszDesc = szTopic; - Item_log[2].pszDesc = szLeave; - Item_nicklist_me[0].pszDesc = szHistory; - Item_nicklist_me[2].pszDesc = szLeave; - Item_nicklist[0].pszDesc = szDetails; - Item_nicklist[1].pszDesc = szHistory; - Item_nicklist[2].pszDesc = szKick; - - LOG (("GCMenuHook started.")); - if(gcmi) { - if (!_stricmp(gcmi->pszModule, SKYPE_PROTONAME)) { - switch (gcmi->Type) - { - case MENU_ON_LOG: - gcmi->nItems = sizeof(Item_log)/sizeof(Item_log[0]); - gcmi->Item = &Item_log[0]; - LOG (("GCMenuHook: Items in log window: %d", gcmi->nItems)); - break; - case MENU_ON_NICKLIST: - if (db_get_ts(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return -1; - if (!mir_tstrcmp(dbv.ptszVal, gcmi->pszUID)) { - gcmi->nItems = sizeof(Item_nicklist_me)/sizeof(Item_nicklist_me[0]); - gcmi->Item = &Item_nicklist_me[0]; - } else { - gchat_contacts *gcs = GetChat(gcmi->pszID); - gchat_contact *gc = gcs?GetChatContact(gcs, gcmi->pszUID):NULL; - gcmi->nItems = sizeof(Item_nicklist)/sizeof(Item_nicklist[0]); - - Item_nicklist[2].bDisabled = FALSE; - if (gc && !gc->hContact) - { - gcmi->nItems -= 2; - gcmi->Item = &Item_nicklist[2]; - } - else - gcmi->Item = &Item_nicklist[0]; - /* - if (protocol<7) Item_nicklist[2].bDisabled = TRUE; - else { - TCHAR *szChatRole; - if (szChatRole = SkypeGetT ("CHAT", gcmi->pszID, "MYROLE")) { - if (mir_tstrcmp(szChatRole, _T("MASTER")) && mir_tstrcmp(szChatRole, _T("CREATOR"))) - Item_nicklist[2].bDisabled = TRUE; - free (szChatRole); - } - }*/ - - } - db_free(&dbv); - break; - } - } else {LOG (("GCMenuHook: ERROR: Not our protocol."));} - } else {LOG (("GCMenuHook: ERROR: No gcmi"));} - LOG (("GCMenuHook: terminated.")); - return 0; -} - -INT_PTR GCOnLeaveChat(WPARAM wParam,LPARAM) -{ - MCONTACT hContact = (MCONTACT)wParam; - DBVARIANT dbv; - - if (db_get_ts(hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv) == 0) - { - GCDEST gcd = { SKYPE_PROTONAME, dbv.ptszVal, GC_EVENT_CONTROL }; - KillChatSession(&gcd); - db_free(&dbv); - } - return 0; -} - -INT_PTR GCOnJoinChat(WPARAM wParam,LPARAM) -{ - MCONTACT hContact = (MCONTACT)wParam; - DBVARIANT dbv; - - if (db_get_s(hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv) == 0) - { - ChatStart (dbv.pszVal, FALSE); - db_free(&dbv); - } - return 0; -} - -void GCInit(void) -{ - InitializeCriticalSection (&m_GCMutex); -} - -void GCExit(void) -{ - DeleteCriticalSection (&m_GCMutex); - - for (int i=0; i < chatcount; i++) { - free(chats[i].szChatName); - free(chats[i].mJoinedContacts); - } - free(chats); - chats = NULL; - chatcount = 0; -} diff --git a/protocols/SkypeClassic/src/gchat.h b/protocols/SkypeClassic/src/gchat.h deleted file mode 100644 index 91dcef43f4..0000000000 --- a/protocols/SkypeClassic/src/gchat.h +++ /dev/null @@ -1,47 +0,0 @@ -// m_chat users these BaseTSD types, so if we are compiling with an old PSDK, these typedefs
-// are not there, so better define them, just in case...
-#ifndef LongToPtr
-#define DWORD_PTR DWORD
-#endif
-
-#pragma warning (push)
-#pragma warning (disable: 4201) // nonstandard extension used : nameless struct/union
-#include <m_chat.h>
-#pragma warning (pop)
-
-#define MAX_BUF 256 // Buffer for topic-string
-
-typedef struct {
- MCONTACT hContact;
- TCHAR who[33];
- TCHAR szRole[12];
-} gchat_contact;
-
-typedef struct {
- TCHAR* szChatName; // name of chat session
- gchat_contact* mJoinedContacts; // contacts
- int mJoinedCount; // contacts count
-} gchat_contacts;
-
-int ChatInit(WPARAM, LPARAM);
-int __cdecl ChatStart(char *szChatId, BOOL bJustCreate);
-gchat_contacts *GetChat(LPCTSTR szChatId);
-MCONTACT find_chat(LPCTSTR chatname);
-#ifdef _UNICODE
-MCONTACT find_chatA(char *chatname);
-#else
-#define find_chatA find_chat
-#endif
-void RemChatContact(gchat_contacts*, const TCHAR*);
-gchat_contact *GetChatContact(gchat_contacts *gc, const TCHAR *who);
-int AddMembers(char*);
-void AddMembersThread(char *szSkypeMsg);
-void RemChat(TCHAR *szChatId);
-int GCEventHook (WPARAM, LPARAM);
-int GCMenuHook (WPARAM, LPARAM);
-void KillChatSession(GCDEST*);
-INT_PTR GCOnLeaveChat(WPARAM wParam,LPARAM lParam);
-INT_PTR GCOnJoinChat(WPARAM wParam,LPARAM lParam);
-void GCInit(void);
-void GCExit(void);
-void SetChatTopic (const TCHAR *szChatId, TCHAR *szTopic, BOOL bSet);
diff --git a/protocols/SkypeClassic/src/memlist.cpp b/protocols/SkypeClassic/src/memlist.cpp deleted file mode 100644 index 73c07d64d8..0000000000 --- a/protocols/SkypeClassic/src/memlist.cpp +++ /dev/null @@ -1,248 +0,0 @@ -// The omnipresent memory list, WIN32 implementation, thread safe
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include "memlist.h"
-
-#pragma warning (disable: 4706) // assignment within conditional expression
-
-struct _tagLIST
-{
- unsigned int uiCount;
- unsigned int uiCapacity;
- void **apStorage;
- HANDLE hHeap;
- CRITICAL_SECTION cs;
-};
-
-
-TYP_LIST *List_Init(unsigned int uiCapacity)
-{
- HANDLE hHeap = GetProcessHeap();
- TYP_LIST *pstHandle;
-
- pstHandle = (TYP_LIST *)HeapAlloc(hHeap, 0, sizeof(TYP_LIST));
- if (!pstHandle) return NULL;
- pstHandle->uiCount = 0;
- pstHandle->uiCapacity = uiCapacity;
- if (uiCapacity == 0)
- pstHandle->apStorage = NULL;
- else
- {
- pstHandle->apStorage = (void **)HeapAlloc(hHeap, 0, sizeof(void *)*uiCapacity);
- if (!pstHandle->apStorage)
- {
- HeapFree (hHeap, 0, pstHandle);
- return NULL;
- }
- }
- pstHandle->hHeap = hHeap;
- InitializeCriticalSection (&pstHandle->cs);
- return pstHandle;
-}
-
-void List_Exit(TYP_LIST *pstHandle)
-{
- if (pstHandle->apStorage)
- HeapFree (pstHandle->hHeap, 0, pstHandle->apStorage);
- DeleteCriticalSection (&pstHandle->cs);
- HeapFree (pstHandle->hHeap, 0, pstHandle);
-}
-
-BOOL List_Push(TYP_LIST *pstHandle, void *pItem)
-{
- return List_InsertElementAt(pstHandle, pItem,pstHandle->uiCount);
-}
-
-void *List_Pop (TYP_LIST *pstHandle)
-{
- if (pstHandle->uiCount)
- return List_RemoveElementAt(pstHandle ,pstHandle->uiCount-1);
- else return NULL;
-}
-
-BOOL List_InsertElementAt(TYP_LIST *pstHandle, void *pItem, unsigned int uiPos)
-{
- unsigned int uiStep;
- void **apNewStorage;
-
- EnterCriticalSection (&pstHandle->cs);
- if (uiPos > pstHandle->uiCount)
- uiPos = pstHandle->uiCount;
-
- if (pstHandle->uiCount >= pstHandle->uiCapacity)
- {
- uiStep = pstHandle->uiCount*2;
- if (uiStep < 8) uiStep = 8;
-
- if (!pstHandle->apStorage)
- apNewStorage = (void **)HeapAlloc(pstHandle->hHeap, 0, sizeof(void *)*uiStep);
- else
- apNewStorage = (void **)HeapReAlloc (pstHandle->hHeap, 0, pstHandle->apStorage, sizeof(void *)*uiStep);
- if (!apNewStorage)
- {
- LeaveCriticalSection (&pstHandle->cs);
- return FALSE;
- }
- pstHandle->apStorage = apNewStorage;
- pstHandle->uiCapacity = uiStep;
- }
-
- if (uiPos<pstHandle->uiCount)
- memmove (&pstHandle->apStorage[uiPos+1], &pstHandle->apStorage[uiPos], (pstHandle->uiCount-uiPos)*sizeof(void*));
- pstHandle->apStorage[uiPos] = pItem;
- pstHandle->uiCount++;
- LeaveCriticalSection (&pstHandle->cs);
- return TRUE;
-}
-
-void *List_RemoveElementAt(TYP_LIST *pstHandle, unsigned int uiPos)
-{
- void *pRet;
-
- EnterCriticalSection (&pstHandle->cs);
- pRet = pstHandle->apStorage[uiPos];
- if (uiPos<pstHandle->uiCount)
- memmove (&pstHandle->apStorage[uiPos], &pstHandle->apStorage[uiPos+1], (pstHandle->uiCount-uiPos)*sizeof(void*));
- pstHandle->uiCount--;
- LeaveCriticalSection (&pstHandle->cs);
- return pRet;
-}
-
-unsigned int List_Count(TYP_LIST *pstHandle)
-{
- return pstHandle->uiCount;
-}
-
-void *List_ElementAt(TYP_LIST *pstHandle,unsigned int uiPos)
-{
- void *pRet = NULL;
-
- EnterCriticalSection (&pstHandle->cs);
- if (uiPos < pstHandle->uiCount)
- pRet = pstHandle->apStorage[uiPos];
- LeaveCriticalSection (&pstHandle->cs);
- return pRet;
-}
-
-void *List_Top(TYP_LIST *pstHandle)
-{
- if (pstHandle->uiCount)
- return List_ElementAt (pstHandle, pstHandle->uiCount-1);
- else return NULL;
-}
-
-#ifdef _INC_STDLIB
-void List_Sort(TYP_LIST *pstHandle, int (*pFunc)(const void*,const void*))
-{
- EnterCriticalSection (&pstHandle->cs);
- qsort(pstHandle->apStorage,pstHandle->uiCount,sizeof(void *),pFunc);
- LeaveCriticalSection (&pstHandle->cs);
-}
-#endif
-
-
-void List_FreeElements(TYP_LIST *pstHandle)
-{
- void *pEntry;
- HANDLE hHeap = GetProcessHeap();
-
- while (pEntry = List_Pop(pstHandle))
- HeapFree (hHeap, 0, pEntry);
-}
-
-BOOL List_BinarySearch(TYP_LIST *hPList,
- int (*pPFunc)(const void *pstPElement,const void *pstPToFind),
- const void *pstPToFind,int *piPToInsert)
-{
- unsigned int
- iStart,
- iEnd,
- iInd;
- int iRetCompare;
-
- if (hPList == NULL)
- {
- *piPToInsert = 0;
- return FALSE;
- }
-
- iStart = 0;
- if (hPList->uiCount == 0)
- {
- *piPToInsert = 0;
- return FALSE;
- }
- EnterCriticalSection (&hPList->cs);
- iEnd = hPList->uiCount-1;
-
- iRetCompare = (*pPFunc)(hPList->apStorage[0],pstPToFind);
- if (iRetCompare >= 0)
- {
- *piPToInsert = 0;
- LeaveCriticalSection (&hPList->cs);
- return iRetCompare == 0;
- }
-
- iRetCompare = (*pPFunc)(hPList->apStorage[iEnd],pstPToFind);
- if (iRetCompare < 0)
- {
- *piPToInsert = hPList->uiCount;
- LeaveCriticalSection (&hPList->cs);
- return FALSE;
- }
- else if (iRetCompare == 0)
- {
- *piPToInsert = hPList->uiCount-1;
- LeaveCriticalSection (&hPList->cs);
- return TRUE;
- }
-
- // Otherwise C4702: unreachable code below
- #pragma warning (suppress: 4127) // conditional expression is constant
- while(1)
- {
- switch (iEnd-iStart)
- {
- case 0:
- *piPToInsert = iStart;
- LeaveCriticalSection (&hPList->cs);
- return FALSE;
- case 1:
- *piPToInsert = iStart+1;
- LeaveCriticalSection (&hPList->cs);
- return FALSE;
- default:
- iInd = iStart + (iEnd-iStart)/2;
- iRetCompare = (*pPFunc)(hPList->apStorage[iInd],pstPToFind);
- if (iRetCompare == 0)
- {
- *piPToInsert = iInd;
- LeaveCriticalSection (&hPList->cs);
- return TRUE;
- }
- if (iRetCompare < 0)
- iStart = iInd;
- else
- iEnd = iInd;
- break;
- }
- }
-
- LeaveCriticalSection (&hPList->cs);
- return FALSE;
-}
-
-BOOL List_InsertSort(TYP_LIST *hPList,
- int (*pPFunc)(const void *pstPElement,const void *pstPToFind),
- void *pItem)
-{
- int iListInd;
-
- if (!List_BinarySearch(hPList,pPFunc,(void *)pItem,&iListInd))
- {
- return List_InsertElementAt (hPList, pItem, iListInd);
- }
- return FALSE;
-}
-
-
diff --git a/protocols/SkypeClassic/src/memlist.h b/protocols/SkypeClassic/src/memlist.h deleted file mode 100644 index 7c147d37eb..0000000000 --- a/protocols/SkypeClassic/src/memlist.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __MEMLIST_H__
-#define __MEMLIST_H__
-
-// Optional for programs linked against CRT:
-// Remove this if you want a proper plain WIN32-App
-//#include <stdlib.h>
-
-struct _tagLIST;
-typedef struct _tagLIST TYP_LIST;
-
-TYP_LIST *List_Init(unsigned int uiCapacity);
-void List_Exit(TYP_LIST *pstHandle);
-BOOL List_Push(TYP_LIST *pstHandle, void *pItem);
-void *List_Pop (TYP_LIST *pstHandle);
-BOOL List_InsertElementAt(TYP_LIST *pstHandle, void *pItem, unsigned int uiPos);
-void *List_RemoveElementAt(TYP_LIST *pstHandle, unsigned int uiPos);
-unsigned int List_Count(TYP_LIST *pstHandle);
-void *List_ElementAt(TYP_LIST *pstHandle,unsigned int uiPos);
-void *List_Top(TYP_LIST *pstHandle);
-void List_FreeElements(TYP_LIST *pstHandle);
-BOOL List_BinarySearch(TYP_LIST *hPList,
- int (*pPFunc)(const void *pstPElement,const void *pstPToFind),
- const void *pstPToFind,int *piPToInsert);
-BOOL List_InsertSort(TYP_LIST *hPList,
- int (*pPFunc)(const void *pstPElement,const void *pstPToFind),
- void *pItem);
-
-//#ifdef _INC_STDLIB
-void List_Sort(TYP_LIST *pstHandle, int (*pFunc)(const void*,const void*));
-/*#else
-#undef RtlMoveMemory
-NTSYSAPI
-VOID
-NTAPI
-RtlMoveMemory (
- VOID UNALIGNED *Destination,
- CONST VOID UNALIGNED *Source,
- SIZE_T Length
- );
-
-#endif*/
-
-#endif
\ No newline at end of file diff --git a/protocols/SkypeClassic/src/msglist.cpp b/protocols/SkypeClassic/src/msglist.cpp deleted file mode 100644 index 2c33dff807..0000000000 --- a/protocols/SkypeClassic/src/msglist.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include "filexfer.h"
-#include "memlist.h"
-#include "debug.h"
-#include "msglist.h"
-
-#define MSGLIST_TIMEOUT 1800 // Chatmessage references will be kept for 30 minutes
-
-static TYP_LIST *m_hMsgList = NULL;
-
-static int CmpProc(const void *pstPElement,const void *pstPToFind)
-{
- return (DWORD)pstPToFind - ((TYP_MSGLENTRY*)pstPElement)->uMsgNum;
-}
-
-void MsgList_Init(void)
-{
- m_hMsgList = List_Init(128);
-}
-
-void MsgList_FreeEntry(TYP_MSGLENTRY *pEntry)
-{
- if (pEntry->pfts)
- FXFreePFTS(pEntry->pfts);
- HeapFree(GetProcessHeap(), 0, pEntry);
-}
-
-void MsgList_Exit(void)
-{
- if (!m_hMsgList) return;
- TYP_MSGLENTRY *pEntry;
- while (pEntry = (TYP_MSGLENTRY*) List_Pop(m_hMsgList))
- MsgList_FreeEntry(pEntry);
- List_FreeElements (m_hMsgList);
- List_Exit(m_hMsgList);
- m_hMsgList = NULL;
-}
-
-TYP_MSGLENTRY *MsgList_Add(DWORD uMsgNum, MEVENT hEvent)
-{
- TYP_MSGLENTRY *pEntry;
- int iListInd;
- BOOL bFound;
-
- LOG (("MsgList_Add (%d, %08X)", uMsgNum, hEvent));
- if (!m_hMsgList) return FALSE;
- bFound = List_BinarySearch(m_hMsgList,CmpProc,(void *)uMsgNum,&iListInd);
- if (!bFound) pEntry = (TYP_MSGLENTRY*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TYP_MSGLENTRY));
- else pEntry = (TYP_MSGLENTRY*)List_ElementAt (m_hMsgList, iListInd);
- if (!pEntry) return NULL;
- pEntry->uMsgNum = uMsgNum;
- pEntry->hEvent = hEvent;
- pEntry->tEdited = 0;
- time(&pEntry->t);
- if (!bFound) return List_InsertElementAt (m_hMsgList, pEntry, iListInd)?pEntry:NULL;
- return pEntry;
-}
-
-
-TYP_MSGLENTRY *MsgList_FindMessage(DWORD uMsgNum)
-{
- TYP_MSGLENTRY *pEntry;
- int iPos;
-
- LOG (("MsgList_FindEvent (%d)", uMsgNum));
- if (m_hMsgList && List_BinarySearch(m_hMsgList, CmpProc, (void*)uMsgNum, &iPos))
- {
- pEntry = (TYP_MSGLENTRY*)List_ElementAt (m_hMsgList, iPos);
- time(&pEntry->t); // Touch it, so that it doesn't get thrown away too soon
- LOG (("MsgList_FindEvent(%d): %08X", uMsgNum, pEntry->hEvent));
- return pEntry;
- }
- return NULL;
-}
-
-void MsgList_CollectGarbage(void)
-{
- unsigned int i;
- TYP_MSGLENTRY *pEntry;
- time_t t;
-
- if (!m_hMsgList) return;
- time(&t);
- t-=MSGLIST_TIMEOUT;
- for (i=0; i<List_Count(m_hMsgList); i++)
- {
- pEntry = (TYP_MSGLENTRY*)List_ElementAt (m_hMsgList, i);
- if (pEntry->t < t)
- {
- LOG (("MsgList_CollectGarbage throwing out msg %d", pEntry->uMsgNum));
- MsgList_FreeEntry((TYP_MSGLENTRY*)List_RemoveElementAt(m_hMsgList, i--));
- }
- }
-}
-
diff --git a/protocols/SkypeClassic/src/msglist.h b/protocols/SkypeClassic/src/msglist.h deleted file mode 100644 index d5afed9374..0000000000 --- a/protocols/SkypeClassic/src/msglist.h +++ /dev/null @@ -1,16 +0,0 @@ -#include <time.h>
-
-typedef struct {
- DWORD uMsgNum;
- MEVENT hEvent;
- MEVENT hMetaEvent;
- time_t t;
- time_t tEdited;
- void *pfts;
-} TYP_MSGLENTRY;
-
-void MsgList_Init(void);
-void MsgList_Exit(void);
-TYP_MSGLENTRY *MsgList_Add(DWORD uMsgNum, MEVENT hEvent);
-TYP_MSGLENTRY *MsgList_FindMessage(DWORD uMsgNum);
-void MsgList_CollectGarbage(void);
diff --git a/protocols/SkypeClassic/src/msgq.cpp b/protocols/SkypeClassic/src/msgq.cpp deleted file mode 100644 index e1ab0d1998..0000000000 --- a/protocols/SkypeClassic/src/msgq.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/*
- * Implements a simple message queue for send and receive queue.
- * We could use memlist.c, but it's not efficient
- * enough for this purpose (would always memmove on removing first
- * element), therefore it's implemented as tail queue.
- */
-
-#include "skype.h"
-#include "msgq.h"
-#include "debug.h"
-
-
-void MsgQ_Init(TYP_MSGQ *q)
-{
- TAILQ_INIT(&q->l);
- InitializeCriticalSection (&q->cs);
-}
-
-void MsgQ_Exit(TYP_MSGQ *q)
-{
- struct MsgQueue *ptr;
-
- EnterCriticalSection(&q->cs);
- while ((ptr=q->l.tqh_first) != NULL)
- free(MsgQ_RemoveMsg(q, ptr));
- LeaveCriticalSection(&q->cs);
- DeleteCriticalSection (&q->cs);
-}
-
-BOOL MsgQ_Add(TYP_MSGQ *q, char *msg)
-{
- struct MsgQueue *ptr;
-
- if ((ptr=(struct MsgQueue*)malloc(sizeof(struct MsgQueue))) == NULL)
- return FALSE;
- ptr->message = _strdup(msg); // Don't forget to free!
- ptr->tAdded = SkypeTime(NULL);
- SkypeTime(&ptr->tReceived);
- EnterCriticalSection(&q->cs);
- TAILQ_INSERT_TAIL(&q->l, ptr, l);
- //LOG (("MsgQ_Add (%s) @%lu/%ld", msg, ptr->tReceived, ptr->tAdded));
- LeaveCriticalSection(&q->cs);
- return TRUE;
-}
-
-char *MsgQ_RemoveMsg(TYP_MSGQ *q, struct MsgQueue *ptr)
-{
- char *msg;
-
- if (!ptr) return NULL;
- EnterCriticalSection(&q->cs);
- TAILQ_REMOVE(&q->l, ptr, l);
- LeaveCriticalSection(&q->cs);
- msg=ptr->message;
- free(ptr);
- return msg;
-}
-
-char *MsgQ_Get(TYP_MSGQ *q)
-{
- char *msg;
-
- msg=MsgQ_RemoveMsg(q, q->l.tqh_first);
- return msg;
-}
-
-int MsgQ_CollectGarbage(TYP_MSGQ *q, time_t age)
-{
- struct MsgQueue *ptr;
- int i=0;
-
- EnterCriticalSection(&q->cs);
- ptr=q->l.tqh_first;
- while (ptr)
- {
- if (ptr->tAdded && SkypeTime(NULL)-ptr->tAdded>age)
- {
- struct MsgQueue *ptr_;
- LOG(("GarbageCollector throwing out message: %s", ptr->message));
- ptr_=ptr;
- ptr=ptr->l.tqe_next;
- free(MsgQ_RemoveMsg(q, ptr_));
- i++;
- continue;
- }
- ptr=ptr->l.tqe_next;
- }
- LeaveCriticalSection(&q->cs);
- return i;
-}
diff --git a/protocols/SkypeClassic/src/msgq.h b/protocols/SkypeClassic/src/msgq.h deleted file mode 100644 index 4eb666944b..0000000000 --- a/protocols/SkypeClassic/src/msgq.h +++ /dev/null @@ -1,64 +0,0 @@ -#include <time.h>
-
-// ----------------------------------------------------------------------
-// Stolen from *nix sys/queue.h
-// ----------------------------------------------------------------------
-/*
- * Tail queue definitions.
- */
-#define TAILQ_HEAD(name, type) \
-struct name { \
- struct type *tqh_first; /* first element */ \
- struct type **tqh_last; /* addr of last next element */ \
-}
-
-#define TAILQ_ENTRY(type) \
-struct { \
- struct type *tqe_next; /* next element */ \
- struct type **tqe_prev; /* address of previous next element */ \
-}
-
-
-/*
- * Tail queue functions.
- */
-#define TAILQ_INIT(head) { \
- (head)->tqh_first = NULL; \
- (head)->tqh_last = &(head)->tqh_first; \
-}
-
-#define TAILQ_INSERT_TAIL(head, elm, field) { \
- (elm)->field.tqe_next = NULL; \
- (elm)->field.tqe_prev = (head)->tqh_last; \
- *(head)->tqh_last = (elm); \
- (head)->tqh_last = &(elm)->field.tqe_next; \
-}
-
-#define TAILQ_REMOVE(head, elm, field) { \
- if (((elm)->field.tqe_next) != NULL) \
- (elm)->field.tqe_next->field.tqe_prev = \
- (elm)->field.tqe_prev; \
- else \
- (head)->tqh_last = (elm)->field.tqe_prev; \
- *(elm)->field.tqe_prev = (elm)->field.tqe_next; \
-}
-// ----------------------------------------------------------------------
-
-struct MsgQueue {
- TAILQ_ENTRY(MsgQueue) l;
- char *message;
- time_t tAdded;
- time_t tReceived;
-};
-typedef struct
-{
- TAILQ_HEAD(tag_msgq, MsgQueue) l;
- CRITICAL_SECTION cs;
-} TYP_MSGQ;
-
-void MsgQ_Init(TYP_MSGQ *q);
-void MsgQ_Exit(TYP_MSGQ *q);
-BOOL MsgQ_Add(TYP_MSGQ *q, char *msg);
-char *MsgQ_RemoveMsg(TYP_MSGQ *q, struct MsgQueue *ptr);
-char *MsgQ_Get(TYP_MSGQ *q);
-int MsgQ_CollectGarbage(TYP_MSGQ *q, time_t age);
diff --git a/protocols/SkypeClassic/src/pthread.cpp b/protocols/SkypeClassic/src/pthread.cpp deleted file mode 100644 index 12da5a7a4f..0000000000 --- a/protocols/SkypeClassic/src/pthread.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/*
- * $Id: pthread.c,v 1.4 2003/12/19 12:53:36 gena01 Exp $
- *
- * Skype Miranda Plugin
- *
- * Authors: Gennady Feldman (aka Gena01)
- * Laurent Marechal (aka Peorth)
- *
- * Code borrowed for Skype plugin. Fixed to compile on Mingw by G.Feldman
- * Original Copyright (c) 2003 Robert Rainwater
- *
- * This code is under GPL and is based on AIM, MSN and Miranda source code.
- * I want to thank Robert Rainwater and George Hazan for their code and support
- * and for answering some of my questions during development of this plugin.
- */
-
-#include "skype.h"
-
-/* Gena01 - added some defined to fix compilation with mingw gcc */
-/* __try/__finally taken from abiword patch found on the web */
-#if 0
- #include <crtdbg.h>
-#else
-#define __try
-#define __except(x) if (0) /* don't execute handler */
-#define __finally
-
-#define _try __try
-#define _except __except
-#define _finally __finally
-#endif
-
-#include <excpt.h>
-
-struct pthread_arg
-{
- HANDLE hEvent;
- void (*threadcode) (void *);
- void *arg;
-};
-
-void pthread_r(struct pthread_arg *fa)
-{
- void (*callercode) (void *) = fa->threadcode;
- void *arg = fa->arg;
- Thread_Push(0, 0);
- SetEvent(fa->hEvent);
- __try {
- callercode(arg);
- }
- __finally {
- Thread_Pop();
- }
-}
-
-unsigned long pthread_create(pThreadFunc parFunc, void *arg)
-{
- unsigned long rc;
- struct pthread_arg fa;
- fa.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- fa.threadcode = parFunc;
- fa.arg = arg;
- rc = _beginthread((pThreadFunc) pthread_r, 0, &fa);
- if ((unsigned long) -1L != rc) {
- WaitForSingleObject(fa.hEvent, INFINITE);
- }
- CloseHandle(fa.hEvent);
- return rc;
-}
-
diff --git a/protocols/SkypeClassic/src/pthread.h b/protocols/SkypeClassic/src/pthread.h deleted file mode 100644 index 1c9f3e3924..0000000000 --- a/protocols/SkypeClassic/src/pthread.h +++ /dev/null @@ -1,26 +0,0 @@ -/*
- * $Id: pthread.h,v 1.3 2003/10/05 04:03:05 gena01 Exp $
- *
- * Skype Miranda Plugin
- *
- * Authors: Gennady Feldman (aka Gena01)
- * Laurent Marechal (aka Peorth)
- *
- * Code borrowed for Skype plugin. Fixed to compile on Mingw by G.Feldman
- * Original Copyright (c) 2003 Robert Rainwater
- *
- * This code is under GPL and is based on AIM, MSN and Miranda source code.
- * I want to thank Robert Rainwater and George Hazan for their code and support
- * and for answering some of my questions during development of this plugin.
- */
-#ifndef PTHREAD_H
-#define PTHREAD_H
-
-unsigned long pthread_create(void (*threadcode) (void *), void *arg);
-typedef CRITICAL_SECTION pthread_mutex_t;
-#define pthread_mutex_init(pmutex) InitializeCriticalSection(pmutex)
-#define pthread_mutex_destroy(pmutex) DeleteCriticalSection(pmutex)
-#define pthread_mutex_lock(pmutex) EnterCriticalSection(pmutex)
-#define pthread_mutex_unlock(pmutex) LeaveCriticalSection(pmutex)
-
-#endif
diff --git a/protocols/SkypeClassic/src/resource.h b/protocols/SkypeClassic/src/resource.h deleted file mode 100644 index d80e5ce87c..0000000000 --- a/protocols/SkypeClassic/src/resource.h +++ /dev/null @@ -1,126 +0,0 @@ -//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by ..\res\Resource.rc
-//
-#define IDI_SKYPE 102
-#define IDI_ONLINE 104
-#define IDI_OFFLINE 105
-#define IDI_AWAY 128
-#define IDI_CHAT 129
-#define IDI_INVISIBLE 130
-#define IDI_NA 131
-#define IDI_DND 158
-#define IDI_OCCUPIED 159
-#define IDI_ADD 160
-#define IDI_IMPORT 161
-#define IDI_ERRORS 162
-#define IDI_MESSAGE 163
-#define IDI_CALL 164
-#define IDI_CALLSKYPEOUT 165
-#define IDI_HOLD 166
-#define IDI_RESUME 167
-#define IDI_HANGUP 168
-#define IDI_AVATAR 169
-#define IDD_OPTIONS 170
-#define IDI_INVITE 170
-#define IDD_DIAL 171
-#define IDB_CALL 172
-#define IDD_INPUTBOX 172
-#define IDD_CALLSTAT 173
-#define IDD_SETAVATAR 174
-#define IDD_OPT_DEFAULT 175
-#define IDD_OPT_PROXY 176
-#define IDD_SETDETAILS 177
-#define IDD_OPT_ADVANCED 178
-#define IDD_OPT_POPUP 179
-#define IDI_BLOCKCONTACT 182
-#define IDI_PHONE 1002
-#define IDC_SHUTDOWN 1004
-#define IDC_ENABLEMENU 1005
-#define IDC_UNLOADOFFLINE 1006
-#define IDC_USES2S 1007
-#define IDC_HOST 1008
-#define IDC_PORT 1009
-#define IDC_REQPASS 1010
-#define IDC_PASSWORD 1011
-#define IDC_USEPOPUP 1012
-#define IDC_GROUPCHAT 1014
-#define IDC_NOERRORS 1015
-#define IDC_CONNATTEMPTS 1016
-#define IDC_GROUPCHATREAD 1016
-#define IDC_SKYPEOUTSTAT 1018
-#define IDC_NUMBER 1019
-#define IDDIAL 1020
-#define IDC_KEEPSTATE 1021
-#define IDC_CLEANUP 1022
-#define IDC_JOIN 1023
-#define IDC_TIMEZONE 1023
-#define IDC_HOLD 1024
-#define IDC_SHOWDEFAULTAVATAR 1024
-#define IDC_HANGUP 1025
-#define IDC_IGNTZ 1025
-#define IDC_AVATAR 1026
-#define IDC_NOSKYPE3STATS 1026
-#define IDC_SETAVATAR 1027
-#define IDC_SHOWFULLNAME 1027
-#define IDC_DELETEAVATAR 1028
-#define IDC_STARTSKYPE 1029
-#define IDC_NOTRAY 1030
-#define IDC_NOSPLASH 1031
-#define IDC_MINIMIZED 1032
-#define IDC_TEXT 1033
-#define IDC_CUSTOMCOMMAND 1033
-#define IDC_OPTIONSTAB 1034
-#define IDC_REMOVEABLE 1034
-#define IDC_FULLNAME 1035
-#define IDC_DATAPATHO 1035
-#define IDC_BIRTHDAY 1036
-#define IDC_SECONDARY 1036
-#define IDC_SEX 1037
-#define IDC_CITY 1038
-#define IDC_COUNTRY 1039
-#define IDC_PROVINCE 1040
-#define IDC_HOMEPHONE 1041
-#define IDC_OFFICEPHONE 1042
-#define IDC_HOMEPAGE 1043
-#define IDC_SAVEDETAILS 1044
-#define IDC_COMMANDLINE 1045
-#define IDC_DATAPATH 1046
-#define IDC_POPUPINCOMING 1049
-#define IDC_PREVIEW 1050
-#define IDC_POPUPTEXTCOLOR 1051
-#define IDC_POPUPTIME 1052
-#define IDC_POPUPBACKCOLOR 1053
-#define IDC_USEWINCOLORS 1054
-#define IDC_POPUPERROR 1055
-#define IDC_USERNAME 1055
-#define IDC_PREVIEWERR 1056
-#define IDC_EDIT2 1056
-#define IDC_POPUPTIMEERR 1057
-#define IDC_POPUPBACKCOLORERR 1058
-#define IDC_POPUPTEXTCOLORERR 1059
-#define IDC_USEWINCOLORSERR 1060
-#define IDC_SUPPRESSCALLSUMMARYMESSAGE 1061
-#define IDC_AUTODETECTION 1062
-#define IDC_STATIC_HOST 1063
-#define IDC_STATIC_PORT 1064
-#define IDC_BROWSEDP 1065
-#define IDC_BROWSECMDL 1066
-#define IDC_STATIC_POPUPBACKCOLOR 1066
-#define IDC_STATIC_POPUPTEXTCOLOR 1067
-#define IDC_STATIC_POPUPTEXTCOLORERR 1068
-#define IDC_STATIC_POPUPBACKCOLORERR 1069
-#define IDC_STATIC_PATHINFO 1070
-#define IDC_STATIC_RESTART 1071
-#define IDC_NOACK 1072
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 183
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1073
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp deleted file mode 100644 index 809b3803a3..0000000000 --- a/protocols/SkypeClassic/src/skype.cpp +++ /dev/null @@ -1,3296 +0,0 @@ -/*
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program 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 General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-
-*/
-
-#include "skype.h"
-#include "debug.h"
-#include "skypeapi.h"
-#include "skypesvc.h"
-#include "contacts.h"
-#include "utf8.h"
-#include "pthread.h"
-#include "gchat.h"
-#include "m_toptoolbar.h"
-#include "msglist.h"
-#include "memlist.h"
-#include "filexfer.h"
-#include <sys/timeb.h>
-#ifdef _WIN64
-#if (_MSC_VER < 1500)
-#pragma comment (lib, "bufferoverflowU.lib")
-#endif
-#endif
-
-
-POPUPDATAT MessagePopup;
-
-// Exported Globals
-HWND hSkypeWnd = NULL, g_hWnd = NULL, hSkypeWndSecondary = NULL, hForbiddenSkypeWnd = NULL;
-HANDLE SkypeReady, SkypeMsgReceived, hInitChat = NULL, httbButton = NULL, FetchMessageEvent = NULL;
-BOOL SkypeInitialized = FALSE, MirandaShuttingDown = FALSE, PopupServiceExists = FALSE;
-BOOL UseSockets = FALSE, bSkypeOut = FALSE, bProtocolSet = FALSE, bIsImoproxy = FALSE, bHasFileXfer = FALSE;
-char skype_path[MAX_PATH], protocol = 2, *pszProxyCallout = NULL, g_szProtoName[_MAX_FNAME] = "SkypeClassic";
-int SkypeStatus = ID_STATUS_OFFLINE, hSearchThread = -1, receivers = 1;
-long sendwatchers = 0, rcvwatchers = 0;
-UINT ControlAPIAttach, ControlAPIDiscover;
-LONG AttachStatus = -1;
-HINSTANCE hInst;
-HANDLE hProtocolAvatarsFolder;
-char DefaultAvatarsFolder[MAX_PATH + 1];
-int hLangpack = 0;
-
-CRITICAL_SECTION RingAndEndcallMutex, QueryThreadMutex, TimeMutex;
-
-// Module Internal Globals
-HANDLE MessagePumpReady;
-HANDLE hBuddyAdded = NULL;
-HANDLE hMenuAddSkypeContact = NULL;
-
-DWORD msgPumpThreadId = 0;
-#ifdef SKYPEBUG_OFFLN
-HANDLE GotUserstatus;
-#endif
-
-BOOL bModulesLoaded = FALSE;
-char *RequestedStatus = NULL; // To fix Skype-API Statusmode-bug
-char cmdMessage[12] = "MESSAGE", cmdPartner[8] = "PARTNER"; // Compatibility commands
-
-
-
-// Direct assignment of user properties to a DB-Setting
-struct settings_map {
- char *SkypeSetting;
- char *MirandaSetting;
-} m_settings[] = {
- { "LANGUAGE", "Language1" },
- { "PROVINCE", "State" },
- { "CITY", "City" },
- { "PHONE_HOME", "Phone" },
- { "PHONE_OFFICE", "CompanyPhone" },
- { "PHONE_MOBILE", "Cellular" },
- { "HOMEPAGE", "Homepage" },
- { "ABOUT", "About" }
-};
-
-BOOL(WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD) = 0;
-
-HMODULE hUxTheme = 0;
-
-// function pointers, use typedefs for casting to shut up the compiler when using GetProcAddress()
-
-typedef BOOL(WINAPI *PITA)();
-typedef HANDLE(WINAPI *POTD)(HWND, LPCWSTR);
-typedef UINT(WINAPI *PDTB)(HANDLE, HDC, int, int, RECT *, RECT *);
-typedef UINT(WINAPI *PCTD)(HANDLE);
-typedef UINT(WINAPI *PDTT)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, DWORD, RECT *);
-
-PITA pfnIsThemeActive = 0;
-POTD pfnOpenThemeData = 0;
-PDTB pfnDrawThemeBackground = 0;
-PCTD pfnCloseThemeData = 0;
-PDTT pfnDrawThemeText = 0;
-
-#define FIXED_TAB_SIZE 100 // default value for fixed width tabs
-
-typedef struct {
- char msgnum[16];
- BOOL getstatus;
- BOOL bIsRead;
- BOOL bDontMarkSeen;
- BOOL QueryMsgDirection;
- BOOL bUseTimestamp;
- TYP_MSGLENTRY *pMsgEntry;
-} fetchmsg_arg;
-
-typedef struct {
- MCONTACT hContact;
- char szId[16];
-} msgsendwt_arg;
-
-#ifdef USE_REAL_TS
-typedef struct {
- MCONTACT hContact;
- time_t timestamp;
-} arg_dbaddevent;
-arg_dbaddevent m_AddEventArg = {0};
-CRITICAL_SECTION AddEventMutex;
-#endif
-
-/*
- * visual styles support (XP+)
- * returns 0 on failure
- */
-
-int InitVSApi()
-{
- if ((hUxTheme = LoadLibraryA("uxtheme.dll")) == 0)
- return 0;
-
- pfnIsThemeActive = (PITA)GetProcAddress(hUxTheme, "IsThemeActive");
- pfnOpenThemeData = (POTD)GetProcAddress(hUxTheme, "OpenThemeData");
- pfnDrawThemeBackground = (PDTB)GetProcAddress(hUxTheme, "DrawThemeBackground");
- pfnCloseThemeData = (PCTD)GetProcAddress(hUxTheme, "CloseThemeData");
- pfnDrawThemeText = (PDTT)GetProcAddress(hUxTheme, "DrawThemeText");
-
- MyEnableThemeDialogTexture = (BOOL(WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture");
- if (pfnIsThemeActive != 0 && pfnOpenThemeData != 0 && pfnDrawThemeBackground != 0 && pfnCloseThemeData != 0 && pfnDrawThemeText != 0) {
- return 1;
- }
- return 0;
-}
-
-/*
- * unload uxtheme.dll
- */
-
-int FreeVSApi()
-{
- if (hUxTheme != 0)
- FreeLibrary(hUxTheme);
- return 0;
-}
-
-// Plugin Info
-PLUGININFOEX pluginInfo = {
- sizeof(PLUGININFOEX),
- __PLUGIN_NAME,
- PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
- __DESCRIPTION,
- __AUTHOR,
- __AUTHOREMAIL,
- __COPYRIGHT,
- __AUTHORWEB,
- UNICODE_AWARE,
- // {A71F8335-7B87-4432-B8A3-81479431C6F5}
- { 0xa71f8335, 0x7b87, 0x4432, { 0xb8, 0xa3, 0x81, 0x47, 0x94, 0x31, 0xc6, 0xf5 } }
-};
-
-#define MAPDND 1 // Map Occupied to DND status and say that you support it
-//#define MAPNA 1 // Map NA status to Away and say that you support it
-
-/* P R O G R A M */
-
-
-/*
- * ShowMessage
- *
- * Shows a popup, if the popup plugin is enabled.
- * mustShow: 1 -> If Popup-Plugin is not available/disabled, show Message
- * in a Messagewindow
- * If the Popup-Plugin is enabled, let the message stay on
- * screen until someone clicks it away.
- * 0 -> If Popup-Plugin is not available/disabled, skip message
- * Returns 0 on success, -1 on failure
- *
- */
-int ShowMessage(int iconID, TCHAR *lpzText, int mustShow) {
- if (db_get_b(NULL, SKYPE_PROTONAME, "SuppressErrors", 0)) return -1;
-
- if (bModulesLoaded && PopupServiceExists && ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, SKYPE_PROTONAME, "UsePopup", 0) && !MirandaShuttingDown) {
- BOOL showPopup, popupWindowColor;
- unsigned int popupBackColor, popupTextColor;
- int popupTimeSec;
-
- popupTimeSec = db_get_dw(NULL, SKYPE_PROTONAME, "popupTimeSecErr", 4);
- popupTextColor = db_get_dw(NULL, SKYPE_PROTONAME, "popupTextColorErr", GetSysColor(COLOR_WINDOWTEXT));
- popupBackColor = db_get_dw(NULL, SKYPE_PROTONAME, "popupBackColorErr", GetSysColor(COLOR_BTNFACE));
- popupWindowColor = (0 != db_get_b(NULL, SKYPE_PROTONAME, "popupWindowColorErr", TRUE));
- showPopup = (0 != db_get_b(NULL, SKYPE_PROTONAME, "showPopupErr", TRUE));
-
- MessagePopup.lchContact = NULL;
- MessagePopup.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(iconID));
- MessagePopup.colorBack = !popupWindowColor ? popupBackColor : GetSysColor(COLOR_BTNFACE);
- MessagePopup.colorText = !popupWindowColor ? popupTextColor : GetSysColor(COLOR_WINDOWTEXT);
- MessagePopup.iSeconds = popupTimeSec;
- MessagePopup.PluginData = (void *)1;
-
- mir_tstrcpy(MessagePopup.lptzText, lpzText);
-
-#ifdef _UNICODE
- mbstowcs(MessagePopup.lptzContactName, SKYPE_PROTONAME, mir_strlen(SKYPE_PROTONAME) + 1);
-#else
- mir_tstrcpy(MessagePopup.lptzContactName, SKYPE_PROTONAME);
-#endif
-
- if (showPopup)
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&MessagePopup, 0);
-
- return 0;
- }
- else {
-
- if (mustShow == 1) MessageBox(NULL, lpzText, _T("Skype Protocol"), MB_OK | MB_ICONWARNING);
- return 0;
- }
-}
-
-int ShowMessageA(int iconID, char *lpzText, int mustShow) {
- WCHAR *lpwText;
- int iRet;
- size_t len = mbstowcs(NULL, lpzText, mir_strlen(lpzText));
- if (len == -1 || !(lpwText = (WCHAR*)calloc(len + 1, sizeof(WCHAR)))) return -1;
- mbstowcs(lpwText, lpzText, mir_strlen(lpzText));
- iRet = ShowMessage(iconID, lpwText, mustShow);
- free(lpwText);
- return iRet;
-}
-
-// processing Hooks
-
-int HookContactAdded(WPARAM wParam, LPARAM) {
- MCONTACT hContact = (MCONTACT) wParam;
- char *szProto = GetContactProto(hContact);
- if (szProto != NULL && !mir_strcmp(szProto, SKYPE_PROTONAME))
- add_contextmenu(hContact);
- return 0;
-}
-
-int HookContactDeleted(WPARAM wParam, LPARAM) {
- MCONTACT hContact = (MCONTACT) wParam;
- char *szProto = GetContactProto(hContact);
- if (szProto != NULL && !mir_strcmp(szProto, SKYPE_PROTONAME)) {
- DBVARIANT dbv;
- if (db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return 1;
- int retval = SkypeSend("SET USER %s BUDDYSTATUS 1", dbv.pszVal);
- db_free(&dbv);
- if (retval) return 1;
- }
- return 0;
-}
-
-void GetInfoThread(void *arg)
-{
- MCONTACT hContact = (MCONTACT)arg;
- DBVARIANT dbv;
- int i;
- char *ptr;
- BOOL bSetNick = FALSE;
- // All properties are already handled in the WndProc, so we just consume the
- // messages here to do proper ERROR handling
- // If you add something here, be sure to handle it in WndProc, but let it
- // fall through there so that message gets added to the queue in order to be
- // consumed by SkypeGet
- char *pszProps[] = {
- "BIRTHDAY", "COUNTRY", "SEX", "MOOD_TEXT", "TIMEZONE", "IS_VIDEO_CAPABLE" };
-
- LOG(("GetInfoThread started."));
- EnterCriticalSection(&QueryThreadMutex);
- if (db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- {
- LOG(("GetInfoThread terminated, cannot find Skype Name for contact %08X.", hContact));
- LeaveCriticalSection(&QueryThreadMutex);
- return;
- }
-
- if (ptr = SkypeGet("USER", dbv.pszVal, "DISPLAYNAME")) {
- // WndProc sets Nick accordingly
- if (*ptr) bSetNick = TRUE;
- free(ptr);
- }
-
- if (ptr = SkypeGet("USER", dbv.pszVal, "FULLNAME")) {
- if (*ptr && !bSetNick && db_get_b(NULL, SKYPE_PROTONAME, "ShowFullname", 1)) {
- // No Displayname and FULLNAME requested
- db_set_utf(hContact, SKYPE_PROTONAME, "Nick", ptr);
- bSetNick = TRUE;
- }
- free(ptr);
- }
-
- if (!bSetNick) {
- // Still no nick set, so use SKYPE Nickname
- db_set_s(hContact, SKYPE_PROTONAME, "Nick", dbv.pszVal);
- }
-
-
- if (!bIsImoproxy)
- {
- for (i = 0; i < sizeof(pszProps) / sizeof(pszProps[0]); i++)
- if (ptr = SkypeGet("USER", dbv.pszVal, pszProps[i])) free(ptr);
- }
- else {
- if (ptr = SkypeGet("USER", dbv.pszVal, "MOOD_TEXT")) free(ptr);
- }
-
- if (protocol >= 7 || bIsImoproxy) {
- // Notify about the possibility of an avatar
- ACKDATA ack = { 0 };
- ack.cbSize = sizeof(ACKDATA);
- ack.szModule = SKYPE_PROTONAME;
- ack.hContact = hContact;
- ack.type = ACKTYPE_AVATAR;
- ack.result = ACKRESULT_STATUS;
-
- CallService(MS_PROTO_BROADCASTACK, 0, (LPARAM)&ack);
- //if (ptr=SkypeGet ("USER", dbv.pszVal, "RICH_MOOD_TEXT")) free (ptr);
- }
-
- if (!bIsImoproxy)
- {
- for (i = 0; i < sizeof(m_settings) / sizeof(m_settings[0]); i++)
- if (ptr = SkypeGet("USER", dbv.pszVal, m_settings[i].SkypeSetting)) free(ptr);
- }
-
- ProtoBroadcastAck(SKYPE_PROTONAME, hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0);
- LeaveCriticalSection(&QueryThreadMutex);
- db_free(&dbv);
- LOG(("GetInfoThread terminated gracefully."));
-}
-
-time_t SkypeTime(time_t *timer)
-{
- struct _timeb tb;
-
- EnterCriticalSection(&TimeMutex);
- _ftime(&tb);
- if (timer) *timer = tb.time;
- LeaveCriticalSection(&TimeMutex);
- return tb.time;
-}
-
-
-void BasicSearchThread(char *nick) {
- PROTOSEARCHRESULT psr = { 0 };
- char *cmd = NULL, *token = NULL, *ptr = NULL;
- time_t st;
-
- LOG(("BasicSearchThread started."));
- EnterCriticalSection(&QueryThreadMutex);
- SkypeTime(&st);
- if (SkypeSend("SEARCH USERS %s", nick) == 0 && (cmd = SkypeRcvTime("USERS", st, INFINITE))) {
- if (strncmp(cmd, "ERROR", 5)) {
- psr.cbSize = sizeof(psr);
- char *nextoken = 0;
- for (token = strtok_r(cmd + 5, ", ", &nextoken); token; token = strtok_r(NULL, ", ", &nextoken)) {
- psr.nick.t = psr.id.t = _A2T(token);
- psr.lastName.t = NULL;
- psr.firstName.t = NULL;
- psr.email.t = NULL;
- if (ptr = SkypeGet("USER", token, "FULLNAME")) {
- // We cannot use strtok() to seperate first & last name here,
- // because we already use it for parsing the user list
- // So we use our own function
- if (psr.lastName.t = _A2T(strchr(ptr, ' '))) {
- *psr.lastName.t = 0;
- psr.lastName.t++;
- LOG(("BasicSearchThread: lastName=%s", psr.lastName.t));
- }
- psr.firstName.t = _A2T(ptr);
- LOG(("BasicSearchThread: firstName=%s", psr.firstName.t));
- }
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)hSearchThread, (LPARAM)(PROTOSEARCHRESULT*)&psr);
- if (ptr) free(ptr);
- }
- }
- else {
- OUT(cmd);
- }
- free(cmd);
- }
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)hSearchThread, 0);
- free(nick);
- LeaveCriticalSection(&QueryThreadMutex);
- LOG(("BasicSearchThread terminated gracefully."));
- return;
-}
-
-// added by TioDuke
-void GetDisplaynameThread(char *) {
- DBVARIANT dbv;
- char *ptr;
-
- LOG(("GetDisplaynameThread started."));
- if (db_get_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) {
- LOG(("GetDisplaynameThread terminated."));
- return;
- }
- EnterCriticalSection(&QueryThreadMutex);
- if ((ptr = SkypeGet("USER", dbv.pszVal, "FULLNAME"))) {
- if (*ptr) db_set_utf(NULL, SKYPE_PROTONAME, "Nick", ptr);
- free(ptr);
- }
- db_free(&dbv);
- LeaveCriticalSection(&QueryThreadMutex);
- LOG(("GetDisplaynameThread terminated gracefully."));
-}
-
-
-// Starts importing history from Skype
-INT_PTR ImportHistory(WPARAM wParam, LPARAM) {
- MCONTACT hContact = (MCONTACT)wParam;
- DBVARIANT dbv;
- if (db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0)) {
- if (db_get_s(hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv))
- return 0;
- SkypeSend("GET CHAT %s CHATMESSAGES", dbv.pszVal);
- }
- else {
- if (db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- return 0;
- SkypeSend("SEARCH %sS %s", cmdMessage, dbv.pszVal);
- }
- db_free(&dbv);
- return 0;
-}
-
-int SearchFriends(void) {
- char *ptr, *token, *pStat;
- int iRet = 0;
- time_t st;
-
- SkypeTime(&st);
- if (SkypeSend("SEARCH FRIENDS") != -1 && (ptr = SkypeRcvTime("USERS", st, INFINITE)))
- {
- if (strncmp(ptr, "ERROR", 5)) {
- if (ptr[5]) {
- char *nextoken = 0;
- for (token = strtok_r(ptr + 5, ", ", &nextoken); token; token = strtok_r(NULL, ", ", &nextoken)) {
- if (!(pStat = SkypeGet("USER", token, "ONLINESTATUS")))
- {
- iRet = -1;
- break;
- }
- free(pStat);
- }
- }
- }
- else iRet = -1;
- free(ptr);
- }
- else iRet = -1;
- return iRet;
-}
-
-static void QueryUserWaitingAuthorization(char *pszNick, char *pszAuthRq)
-{
- MCONTACT hContact = add_contact(pszNick, PALF_TEMPORARY);
- char *lastname = NULL, *pCurBlob, *authmsg = NULL;
-
- LOG(("Awaiting auth: %s", pszNick));
- PROTORECVEVENT pre = { 0 };
- pre.flags = 0;
- pre.timestamp = (DWORD)SkypeTime(NULL);
-
- CCSDATA ccs = { 0 };
- ccs.szProtoService = PSR_AUTH;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)⪯
-
- /* blob is: */
- //DWORD protocolSpecific MCONTACT hContact
- //ASCIIZ nick, firstName, lastName, e-mail, requestReason
- char *firstname = SkypeGet("USER", pszNick, "FULLNAME");
- if (firstname) {
- if (lastname = strchr(firstname, ' ')) {
- *lastname = 0;
- lastname++;
- }
- }
-
- pre.lParam = sizeof(DWORD)+sizeof(HANDLE)+mir_strlen(pszNick) + 5;
- if (firstname) pre.lParam += mir_strlen(firstname);
- if (lastname) pre.lParam += mir_strlen(lastname);
- if (pszAuthRq) authmsg = strdup(pszAuthRq);
- if (authmsg || ((protocol >= 4 || bIsImoproxy) && (authmsg = SkypeGetID("USER", pszNick, "RECEIVEDAUTHREQUEST"))))
- pre.lParam += mir_strlen(authmsg);
- if (pre.szMessage = pCurBlob = (char *)calloc(1, pre.lParam)) {
- pCurBlob += sizeof(DWORD); // Not used
- memcpy(pCurBlob, &hContact, sizeof(HANDLE)); pCurBlob += sizeof(HANDLE);
-
- sprintf(pCurBlob, "%s%c%s%c%s%c%c%s", pszNick, 0, firstname ? firstname : "", 0, lastname ? lastname : "", 0, 0, authmsg ? authmsg : "");
-
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
- free(pre.szMessage);
- }
- if (firstname) free(firstname);
- if (authmsg) free(authmsg);
- return;
-}
-
-void __cdecl ProcessAuthRq(void *pPmsg) {
- char *nick, *auth;
-
- strtok((char*)pPmsg, " ");
- nick = strtok(NULL, " ");
- strtok(NULL, " ");
- auth = strtok(NULL, "");
- QueryUserWaitingAuthorization(nick, auth);
- free(pPmsg);
-}
-
-void __cdecl SearchUsersWaitingMyAuthorization() {
- if (SkypeSend("#UWA SEARCH USERSWAITINGMYAUTHORIZATION"))
- return;
-
- char *cmd = SkypeRcv("#UWA USERS", INFINITE);
- if (!cmd)
- return;
- if (!strncmp(cmd, "ERROR", 5)) {
- free(cmd);
- return;
- }
-
- char *nextoken = 0, *token = strtok_r(cmd + 10, ", ", &nextoken);
- while (token) {
- QueryUserWaitingAuthorization(token, NULL);
- token = strtok_r(NULL, ", ", &nextoken);
- }
- free(cmd);
- return;
-}
-
-void SearchFriendsThread(char *) {
- if (!SkypeInitialized) return;
- LOG(("SearchFriendsThread started."));
- EnterCriticalSection(&QueryThreadMutex);
- SkypeInitialized = FALSE;
- SearchFriends();
- SkypeInitialized = TRUE;
- LeaveCriticalSection(&QueryThreadMutex);
- LOG(("SearchFriendsThread terminated gracefully."));
-}
-
-void __cdecl SearchRecentChats(void *) {
- if (SkypeSend("#RCH SEARCH RECENTCHATS"))
- return;
- char *cmd = SkypeRcv("#RCH CHATS", INFINITE);
- if (!cmd)
- return;
- if (!strncmp(cmd, "ERROR", 5)) {
- free(cmd);
- return;
- }
-
- char *token, *nextoken = 0;
- for (token = strtok_r(cmd + 10, ", ", &nextoken); token; token = strtok_r(NULL, ", ", &nextoken)) {
- char *pszStatus = SkypeGet("CHAT", token, "STATUS");
-
- if (pszStatus) {
- if (!mir_strcmp(pszStatus, "MULTI_SUBSCRIBED")) {
- // Add chatrooms for active multisubscribed chats
- /*if (!find_chatA(token)) */
- EnterCriticalSection(&QueryThreadMutex);
- ChatStart(token, TRUE);
- char *pszTopic = SkypeGet("CHAT", token, "TOPIC");
- if (pszTopic) {
- if (!*pszTopic) {
- free(pszTopic);
- pszTopic = SkypeGet("CHAT", token, "FRIENDLYNAME");
- }
- TCHAR *psztChatName = make_nonutf_tchar_string((const unsigned char*)token);
- TCHAR *psztTopic = make_tchar_string((const unsigned char*)pszTopic);
- SetChatTopic(psztChatName, psztTopic, FALSE);
- free_nonutf_tchar_string(psztChatName);
- free(psztTopic);
- free(pszTopic);
- }
- LeaveCriticalSection(&QueryThreadMutex);
- }
- free(pszStatus);
- }
- }
- free(cmd);
- return;
-}
-
-
-void __cdecl SkypeSystemInit(char *dummy) {
- static BOOL Initializing = FALSE;
- LOG(("SkypeSystemInit thread started."));
- if (SkypeInitialized || Initializing)
- {
- LOG(("SkypeSystemInit terminated, nothing to do."));
- return;
- }
- Initializing = TRUE;
- // Do initial Skype-Tasks
- logoff_contacts(FALSE);
- // Add friends
-
- // Clear currentuserhandle entries from queue
- while (testfor("CURRENTUSERHANDLE", 0));
- if (SkypeSend(SKYPE_PROTO) == -1 || !testfor("PROTOCOL", INFINITE) ||
- SkypeSend("GET CURRENTUSERHANDLE") == -1 ||
- SkypeSend("GET PRIVILEGE SKYPEOUT") == -1) {
- Initializing = FALSE;
- LOG(("SkypeSystemInit thread stopped with failure."));
- return;
- }
-
- DBVARIANT dbv = { 0 };
- if (db_get_s(NULL, SKYPE_PROTONAME, "LoginUserName", &dbv) == 0)
- {
- if (*dbv.pszVal)
- {
- char *pszUser;
-
- // Username is set in Plugin, therefore we need to match it
- // against CURRENTUSERHANDLE
- if (pszUser = SkypeRcv("CURRENTUSERHANDLE", INFINITE))
- {
- memmove(pszUser, pszUser + 18, mir_strlen(pszUser + 17));
- if (_stricmp(dbv.pszVal, pszUser))
- {
- // Doesn't match, maybe we have a second Skype instance we have to take
- // care of? If in doubt, let's wait a while for it to report its hWnd to us.
- LOG(("Userhandle %s doesn't match username %s from settings", pszUser, dbv.pszVal));
- if (!hSkypeWndSecondary) Sleep(3000);
- if (hSkypeWndSecondary)
- {
- hSkypeWnd = hSkypeWndSecondary;
- hSkypeWndSecondary = NULL;
- Initializing = FALSE;
- while (testfor("CURRENTUSERHANDLE", 0));
- LOG(("Trying to init secondary Skype instance"));
- SkypeSystemInit(dummy);
- }
- else
- {
- hForbiddenSkypeWnd = hSkypeWnd;
-
- // If we need to start Skype as secondary instance, we should do it now
- if (db_get_b(NULL, SKYPE_PROTONAME, "StartSkype", 1) &&
- db_get_b(NULL, SKYPE_PROTONAME, "secondary", 0))
- {
- int oldstatus;
-
- hSkypeWnd = NULL;
- AttachStatus = -1;
- if (g_hWnd) KillTimer(g_hWnd, 1);
- oldstatus = SkypeStatus;
- InterlockedExchange((long *)&SkypeStatus, ID_STATUS_CONNECTING);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldstatus, SkypeStatus);
- ConnectToSkypeAPI(skype_path, 1);
- }
- if (hForbiddenSkypeWnd == hSkypeWnd && !hSkypeWndSecondary)
- {
- int oldstatus;
- char szError[256];
- sprintf(szError,
- Translate("Username '%s' provided by Skype API doesn't match username '%s' in your settings. Please either remove username setting in your configuration or correct it. Will not connect!"),
- pszUser, dbv.pszVal);
- OUTPUTA(szError);
- Initializing = FALSE;
- AttachStatus = -1;
- logoff_contacts(FALSE);
- if (g_hWnd) KillTimer(g_hWnd, 1);
- hSkypeWnd = NULL;
- oldstatus = SkypeStatus;
- InterlockedExchange((long *)&SkypeStatus, ID_STATUS_OFFLINE);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldstatus, SkypeStatus);
- }
- }
- }
- free(pszUser);
- }
- }
- db_free(&dbv);
- if (!Initializing) return;
- }
-
-#ifdef SKYPEBUG_OFFLN
- if (!ResetEvent(GotUserstatus) || SkypeSend("GET USERSTATUS") == -1 ||
- WaitForSingleObject(GotUserstatus, INFINITE) == WAIT_FAILED)
- {
- LOG(("SkypeSystemInit thread stopped with failure."));
- Initializing = FALSE;
- return;
- }
- if (SkypeStatus != ID_STATUS_OFFLINE)
-#endif
- if (SearchFriends() == -1) {
- LOG(("SkypeSystemInit thread stopped with failure."));
- Initializing = FALSE;
- return;
- }
- if (protocol >= 5 || bIsImoproxy) {
- SkypeSend("CREATE APPLICATION libpurple_typing");
- testfor("CREATE APPLICATION libpurple_typing", 2000);
- char *pszErr;
- if (SkypeSend("#FT FILE") == 0 && (pszErr = SkypeRcvTime("#FT ERROR", SkypeTime(NULL), 1000)))
- {
- bHasFileXfer = !strncmp(pszErr+4, "ERROR 510", 9);
- free(pszErr);
- }
- }
- else
- bHasFileXfer = FALSE;
-
- if (protocol >= 5) {
- SearchUsersWaitingMyAuthorization();
- if (db_get_b(NULL, SKYPE_PROTONAME, "UseGroupchat", 0))
- SearchRecentChats(NULL);
- }
- SkypeSend("SEARCH MISSED%sS", cmdMessage);
-
-
-#ifndef SKYPEBUG_OFFLN
- if (SkypeSend("GET USERSTATUS")==-1)
- {
- LOG (("SkypeSystemInit thread stopped with failure."));
- Initializing=FALSE;
- return;
- }
-#endif
- SetTimer(g_hWnd, 1, PING_INTERVAL, NULL);
- SkypeInitialized = TRUE;
- Initializing = FALSE;
- LOG(("SkypeSystemInit thread terminated gracefully."));
- return;
-}
-
-void FirstLaunch(char *) {
- int counter = 0;
-
- LOG(("FirstLaunch thread started."));
- if (!db_get_b(NULL, SKYPE_PROTONAME, "StartSkype", 1) || ConnectToSkypeAPI(skype_path, FALSE) == -1)
- {
- int oldstatus = SkypeStatus;
-
- LOG(("OnModulesLoaded starting offline.."));
- InterlockedExchange((long *)&SkypeStatus, ID_STATUS_OFFLINE);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldstatus, SkypeStatus);
- }
- if (AttachStatus == -1 || AttachStatus == SKYPECONTROLAPI_ATTACH_REFUSED || AttachStatus == SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE) {
- LOG(("FirstLaunch thread stopped because of invalid Attachstatus."));
- return;
- }
-
- // When you launch Skype and Attach is Successfull, it still takes some time
- // until it becomes available for receiving messages.
- // Let's probe this with PINGing
- LOG(("CheckIfApiIsResponding Entering test loop"));
- for (;;) {
- LOG(("Test #%d", counter));
- if (SkypeSend("PING") == -1) counter++; else break;
- if (counter >= 20) {
- OUTPUT(TranslateT("Cannot reach Skype API, plugin disfunct."));
- LOG(("FirstLaunch thread stopped: cannot reach Skype API."));
- return;
- }
- Sleep(500);
- }
- LOG(("CheckIfApiIsResponding: Testing for PONG"));
- testfor("PONG", 2000); // Flush PONG from MsgQueue
-
- pthread_create((pThreadFunc)SkypeSystemInit, NULL);
- LOG(("FirstLaunch thread terminated gracefully."));
-}
-
-int CreateTopToolbarButton(WPARAM, LPARAM) {
- TTBButton ttb = { 0 };
-
- ttb.cbSize = sizeof(ttb);
- ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
- ttb.hIconHandleDn = ttb.hIconHandleUp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_CALL));
- ttb.pszService = SKYPEOUT_CALL;
- ttb.name = Translate("Do a SkypeOut-call");
- if ((int)(TopToolbar_AddButton(&ttb)) == -1) httbButton = 0;
- return 0;
-}
-
-
-int OnModulesLoaded(WPARAM, LPARAM) {
- bModulesLoaded = TRUE;
-
- PopupServiceExists = ServiceExists(MS_POPUP_ADDPOPUPT);
-
- logoff_contacts(FALSE);
-
- HookEventsLoaded();
- GCInit();
-
- add_contextmenu(NULL);
- if (ServiceExists(MS_GC_REGISTER))
- {
- static COLORREF crCols[1] = { 0 };
- char szEvent[MAXMODULELABELLENGTH];
-
- GCREGISTER gcr = { sizeof(gcr) };
- gcr.dwFlags = GC_CHANMGR; // |GC_ACKMSG; // TODO: Not implemented yet
- gcr.ptszDispName = _T("Skype protocol");
- gcr.pszModule = SKYPE_PROTONAME;
- if (CallService(MS_GC_REGISTER, 0, (LPARAM)&gcr))
- OUTPUT(TranslateT("Unable to register with group chat module!"));
-
- _snprintf(szEvent, sizeof(szEvent), "%s\\ChatInit", SKYPE_PROTONAME);
- hInitChat = CreateHookableEvent(szEvent);
- HookEvent(szEvent, ChatInit);
-
- HookEvent(ME_GC_EVENT, GCEventHook);
- HookEvent(ME_GC_BUILDMENU, GCMenuHook);
- CreateServiceFunction(SKYPE_CHATNEW, SkypeChatCreate);
- CreateProtoService(PS_LEAVECHAT, GCOnLeaveChat);
- CreateProtoService(PS_JOINCHAT, GCOnJoinChat);
- }
- // Try folder service first
- hProtocolAvatarsFolder = NULL;
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH))
- {
- char *tmpPath;
-
- if (!ServiceExists(MS_UTILS_REPLACEVARS) || !(tmpPath = Utils_ReplaceVars("%miranda_avatarcache%")))
- tmpPath = PROFILE_PATH;
- mir_snprintf(DefaultAvatarsFolder, SIZEOF(DefaultAvatarsFolder), "%s\\%s", tmpPath, SKYPE_PROTONAME);
- hProtocolAvatarsFolder = (HANDLE)FoldersRegisterCustomPath(SKYPE_PROTONAME, "Avatars Cache", DefaultAvatarsFolder);
- }
-
- if (hProtocolAvatarsFolder == NULL)
- {
- // Use defaults
- CallService(MS_DB_GETPROFILEPATH, (WPARAM)MAX_PATH, (LPARAM)DefaultAvatarsFolder);
- mir_snprintf(DefaultAvatarsFolder, SIZEOF(DefaultAvatarsFolder), "%s\\%s", DefaultAvatarsFolder, SKYPE_PROTONAME);
- CreateDirectoryA(DefaultAvatarsFolder, NULL);
- }
-
- pthread_create((pThreadFunc)FirstLaunch, NULL);
- return 0;
-}
-
-void FetchMessageThread(fetchmsg_arg *pargs) {
- char *who = NULL, *type = NULL, *chat = NULL, *users = NULL, *msg = NULL, *status = NULL;
- char *ptr, *msgptr, szPartnerHandle[32], szBuf[128];
- int direction = 0, msglen = 0;
- DWORD timestamp = 0, lwr = 0;
- CCSDATA ccs = { 0 };
- PROTORECVEVENT pre = { 0 };
- MCONTACT hContact = NULL, hChat = NULL;
- MEVENT hDbEvent;
- DBEVENTINFO dbei = { 0 };
- DBVARIANT dbv = { 0 };
- fetchmsg_arg args;
- BOOL bEmoted = FALSE, isGroupChat = FALSE, bHasPartList = FALSE;
- BOOL bUseGroupChat = db_get_b(NULL, SKYPE_PROTONAME, "UseGroupchat", 0);
-
- if (!pargs) return;
- args = *pargs;
- free(pargs);
-
- sprintf(szPartnerHandle, "%s_HANDLE", cmdPartner);
- pre.lParam = strtoul(args.msgnum, NULL, 10);
- if (args.bIsRead) pre.flags |= PREF_CREATEREAD;
- //pEvent = MsgList_FindMessage(pre.lParam);
-
- // Get Timestamp
- if (!args.pMsgEntry || !args.pMsgEntry->tEdited) {
- timestamp=(DWORD)SkypeTime(NULL);
- /* We normally don't use the real timestamp, if it's not history import.
- * Why? -> Because if you are sending a message while there are still
- * incoming messages that get processed, msgs are inserted into the
- * DB with correct timestamp, but message sending dialog shows garbled
- * messages then because he cannot deal with the situation of incoming
- * messages that are prior to last sent message */
-#ifndef USE_REAL_TS
- if (args.bUseTimestamp)
-#endif
- {
- if (!(ptr=SkypeGet (cmdMessage, args.msgnum, "TIMESTAMP"))) return;
- if (strncmp(ptr, "ERROR", 5)) timestamp=atol(ptr);
- free(ptr);
- }
- }
- else timestamp = (DWORD)(args.pMsgEntry->tEdited);
-
- __try {
- // Get Chatname (also to determine if we need to relay this to a groupchat)
- if (!(chat = SkypeGetErr(cmdMessage, args.msgnum, "CHATNAME"))) __leave;
- if (hChat = find_chatA(chat)) isGroupChat = TRUE;
-
- // Get chat status
- if ((status = SkypeGetErr("CHAT", chat, "STATUS")) &&
- !mir_strcmp(status, "MULTI_SUBSCRIBED")) isGroupChat = TRUE;
-
- // Get chat type
- if (!(type = SkypeGetErr(cmdMessage, args.msgnum, "TYPE"))) __leave;
- bEmoted = mir_strcmp(type, "EMOTED") == 0;
- if (mir_strcmp(type, "MULTI_SUBSCRIBED") == 0) isGroupChat = TRUE;
-
- // Group chat handling
- if (isGroupChat && mir_strcmp(type, "TEXT") && mir_strcmp(type, "SAID") && mir_strcmp(type, "UNKNOWN") && !bEmoted) {
- if (bUseGroupChat) {
- BOOL bAddedMembers = FALSE;
-
- if (!mir_strcmp(type, "SAWMEMBERS") || !mir_strcmp(type, "CREATEDCHATWITH"))
- {
- // We have a new Groupchat
- LOG(("FetchMessageThread CHAT SAWMEMBERS"));
- if (!hChat) ChatStart(chat, FALSE);
- __leave;
- }
- if (!mir_strcmp(type, "KICKED"))
- {
- if (!hChat) __leave;
- GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_KICK };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.dwFlags = GCEF_ADDTOLOG;
- gce.time = timestamp;
-
- if (users = SkypeGetErr(cmdMessage, args.msgnum, "USERS")) {
- CONTACTINFO ci = { 0 };
- ci.hContact = find_contact(users);
- gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)users);
- if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
- gce.ptszStatus = make_nonutf_tchar_string((const unsigned char*)who);
- ci.cbSize = sizeof(ci);
- ci.szProto = SKYPE_PROTONAME;
- ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) gce.ptszNick = ci.pszVal;
- else gce.ptszNick = gce.ptszUID;
-
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- RemChatContact(GetChat(gcd.ptszID), gce.ptszUID);
- free_nonutf_tchar_string((void*)gce.ptszStatus);
- if (ci.pszVal) mir_free(ci.pszVal);
- }
- free_nonutf_tchar_string((void*)gce.ptszUID);
- }
- free_nonutf_tchar_string((void*)gcd.ptszID);
- __leave;
- }
- if (!mir_strcmp(type, "SETROLE"))
- {
- gchat_contact *gcContact;
- char *pszRole;
-
- // FROM_HANDLE - Wer hats gesetzt
- // USERS - Wessen Rolle wurde gesetzt
- // ROLE - Die neue Rolle
- if (!hChat) __leave;
- GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_REMOVESTATUS };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.dwFlags = GCEF_ADDTOLOG;
- gce.time = timestamp;
-
- if (users = SkypeGetErr(cmdMessage, args.msgnum, "USERS")) {
- gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)users);
- if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
- CONTACTINFO ci = { 0 };
- ci.cbSize = sizeof(ci);
- ci.szProto = SKYPE_PROTONAME;
- ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- ci.hContact = find_contact(who);
- if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
- gce.ptszText = _tcsdup(ci.pszVal);
- mir_free(ci.pszVal);
- ci.pszVal = NULL;
- }
- else gce.ptszText = make_tchar_string((const unsigned char*)who);
-
- ci.hContact = find_contact(users);
- if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) gce.ptszNick = ci.pszVal;
- else gce.ptszNick = gce.ptszUID;
-
- if (gcContact = GetChatContact(GetChat(gcd.ptszID), gce.ptszUID))
- {
- gce.ptszStatus = gcContact->szRole;
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- }
- if (pszRole = SkypeGetErr(cmdMessage, args.msgnum, "ROLE")) {
- gce.ptszStatus = make_nonutf_tchar_string((const unsigned char*)pszRole);
- gcd.iType = GC_EVENT_ADDSTATUS;
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- free_nonutf_tchar_string((void*)gce.ptszStatus);
- free(pszRole);
- }
- free((void*)gce.ptszText);
- if (ci.pszVal) mir_free(ci.pszVal);
- }
- free_nonutf_tchar_string((void*)gce.ptszUID);
- }
- free_nonutf_tchar_string((void*)gcd.ptszID);
- __leave;
- }
- if (!mir_strcmp(type, "SETTOPIC"))
- {
- LOG(("FetchMessageThread CHAT SETTOPIC"));
- GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_TOPIC };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.dwFlags = GCEF_ADDTOLOG;
- gce.time = timestamp;
- if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
- CONTACTINFO ci = { 0 };
- ci.hContact = find_contact(who);
- gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
- ci.cbSize = sizeof(ci);
- ci.szProto = SKYPE_PROTONAME;
- ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- if (ci.hContact && !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) gce.ptszNick = ci.pszVal;
- else gce.ptszNick = gce.ptszUID;
-
- if (ptr = SkypeGetErr(cmdMessage, args.msgnum, "BODY")) {
- gce.ptszText = make_tchar_string((const unsigned char*)ptr);
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- free((void*)gce.ptszText);
- free(ptr);
- }
- free_nonutf_tchar_string((void*)gce.ptszUID);
- if (ci.pszVal) mir_free(ci.pszVal);
- }
- free_nonutf_tchar_string((void*)gcd.ptszID);
- if (!args.bDontMarkSeen)
- {
- MsgList_Add((DWORD)pre.lParam, -1);
- SkypeSend("SET %s %s SEEN", cmdMessage, args.msgnum);
- }
- __leave;
- }
- if (!mir_strcmp(type, "LEFT") || (bAddedMembers = mir_strcmp(type, "ADDEDMEMBERS") == 0))
- {
- LOG(("FetchMessageThread CHAT LEFT or ADDEDMEMBERS"));
- if (bAddedMembers) {
- GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), GC_EVENT_ACTION };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.dwFlags = GCEF_ADDTOLOG;
- gce.time = timestamp;
- if (users = SkypeGetErr(cmdMessage, args.msgnum, "USERS")) {
- CMString(FORMAT, _T("%S %s"), users, TranslateT("invited"));
- gce.ptszText = make_tchar_string((const unsigned char*)users);
- if (who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle)) {
- DBVARIANT dbv;
- if (db_get_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0) {
- gce.bIsMe = mir_strcmp(who, dbv.pszVal) == 0;
- db_free(&dbv);
- }
- gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
-
- CONTACTINFO ci = { 0 };
- ci.cbSize = sizeof(ci);
- if (!gce.bIsMe)
- ci.hContact = find_contact(who);
- ci.szProto = SKYPE_PROTONAME;
- ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci))
- gce.ptszNick = ci.pszVal;
- else
- gce.ptszNick = gce.ptszUID;
-
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
- free_nonutf_tchar_string((void*)gce.ptszUID);
- if (ci.pszVal) mir_free(ci.pszVal);
- }
- if (gce.ptszText) free((void*)gce.ptszText);
- }
- free_nonutf_tchar_string((void*)gcd.ptszID);
- }
- if (!args.QueryMsgDirection) SkypeSend("GET CHAT %s MEMBERS", chat);
- __leave;
- }
- }
- __leave;
- }
-
- // Need to get the status?
- if (args.getstatus) {
- char *status;
-
- if (protocol < 4) InterlockedIncrement(&rcvwatchers);
- status = SkypeGetID(cmdMessage, args.msgnum, "STATUS");
- if (protocol < 4) InterlockedDecrement(&rcvwatchers);
- if (!status) __leave;
- if (!mir_strcmp(status, "SENT")) direction = DBEF_SENT;
- free(status);
- }
-
- // Who sent it?
- if (!(who = SkypeGetErr(cmdMessage, args.msgnum, szPartnerHandle))) __leave;
-
- // Get contact handle
- LOG(("FetchMessageThread Finding contact handle"));
- db_get_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv);
- if (dbv.pszVal && !mir_strcmp(who, dbv.pszVal))
- {
- // It's from me.. But to whom?
- // CHATMESSAGE .. USERS doesn't return anything, so we have to query the CHAT-Object
- if (!(ptr = SkypeGetErr("CHAT", chat, "ACTIVEMEMBERS"))) {
- db_free(&dbv);
- __leave;
- }
-
- char *pTok, *nextoken = 0;
- for (pTok = strtok_r(ptr, " ", &nextoken); pTok; pTok = strtok_r(NULL, " ", &nextoken)) {
- if (mir_strcmp(pTok, dbv.pszVal)) break; // Take the first dude in the list who is not me
- }
-
- if (!pTok) {
- free(ptr);
- db_free(&dbv);
- __leave; // We failed
- }
- free(who);
- who = (char *)memmove(ptr, pTok, mir_strlen(pTok) + 1);
- direction = DBEF_SENT;
- }
- db_free(&dbv);
-
- if (!(hContact = find_contact(who))) {
- // Permanent adding of user obsolete, we use the BUDDYSTATUS now (bug #0000005)
- ResetEvent(hBuddyAdded);
- SkypeSend("GET USER %s BUDDYSTATUS", who);
- WaitForSingleObject(hBuddyAdded, INFINITE);
- if (!(hContact = find_contact(who))) {
- // Arrgh, the user has been deleted from contact list.
- // In this case, we add him temp. to receive the msg at least.
- hContact = add_contact(who, PALF_TEMPORARY);
- }
- }
-
- if (mir_strcmp(type, "FILETRANSFER") == 0)
- {
- // Our custom Skypekit FILETRANSFER extension
- bHasFileXfer = TRUE;
- pre.timestamp = timestamp;
- FXHandleRecv(&pre, hContact);
- __leave;
- }
-
- // Text which was sent (on edited msg, BODY may already be in queue, check)
- sprintf(szBuf, "GET %s %s BODY", cmdMessage, args.msgnum);
- if (!args.pMsgEntry || !args.pMsgEntry->tEdited || !(ptr = SkypeRcv(szBuf + 4, 1000)))
- {
- if (SkypeSend(szBuf) == -1 || !(ptr = SkypeRcv(szBuf + 4, INFINITE)))
- __leave;
- }
- if (strncmp(ptr, "ERROR", 5)) {
- msgptr = ptr + mir_strlen(szBuf + 4) + 1;
- bHasPartList = strncmp(msgptr, "<partlist ", 10) == 0;
- if (args.pMsgEntry && args.pMsgEntry->tEdited) {
- // Mark the message as edited
- if (!*msgptr && args.pMsgEntry->hEvent != -1) {
- // Empty message and edited -> Delete event
- if ((int)(hContact = db_event_getContact(args.pMsgEntry->hEvent)) != -1) {
- db_event_delete(hContact, args.pMsgEntry->hEvent);
- free(ptr);
- __leave;
- }
- }
- else {
- msgptr -= 9;
- memcpy(msgptr, "[EDITED] ", 9);
- }
- }
- if (bEmoted && !isGroupChat) {
- CONTACTINFO ci = { 0 };
- int newlen;
- char *pMsg, *pszUTFnick = NULL;
- ci.cbSize = sizeof(ci);
- ci.szProto = SKYPE_PROTONAME;
- ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- if (ci.hContact = hContact) {
- CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci);
- if (ci.pszVal) {
-#ifdef _UNICODE
- pszUTFnick = (char*)make_utf8_string(ci.pszVal);
-#else
- utf8_encode (ci.pszVal, &pszUTFnick);
-#endif
- mir_free(ci.pszVal);
- }
- }
- newlen = int(mir_strlen(msgptr) + (pszUTFnick ? mir_strlen(pszUTFnick) : 0) + 9);
- if (pMsg = (char *)malloc(newlen)) {
- sprintf(pMsg, "** %s%s%s **", (pszUTFnick ? pszUTFnick : ""), (pszUTFnick ? " " : ""), (char*)msgptr);
- free(ptr);
- ptr = msgptr = pMsg;
- }
- if (pszUTFnick) free(pszUTFnick);
- }
-
- if (!isGroupChat) { // I guess Groupchat doesn't support UTF8?
- msg = ptr;
- }
- else {
- // Older version has to decode either UTF8->ANSI or UTF8->UNICODE
- // This could be replaced by mir_getUTFI - functions for Miranda 0.5+ builds, but we stay
- // 0.4 compatible for backwards compatibility. Unfortunately this requires us to link with utf8.c
- if (utf8_decode(msgptr, &msg) == -1) {
- free(ptr);
- __leave;
- }
- msgptr = msg;
- free(ptr);
- }
- msglen = (int)mir_strlen(msgptr) + 1;
- }
- else {
- free(ptr);
- __leave;
- }
- // skype sends some xml statics after a call has finished. Check if thats the case and suppress it if necessary...
- if ((db_get_b(NULL, SKYPE_PROTONAME, "SuppressCallSummaryMessage", 1) &&
- bHasPartList) || msgptr[0] == 0) __leave;
-
- if (isGroupChat && bUseGroupChat) {
- DBVARIANT dbv = { 0 };
-
- LOG(("FetchMessageThread This is a group chat message"));
- if (!hChat) ChatStart(chat, FALSE);
- GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)chat), bEmoted ? GC_EVENT_ACTION : GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
- if ((gce.bIsMe = (direction&DBEF_SENT) ? TRUE : FALSE) && db_get_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0)
- {
- free(who);
- who = _strdup(dbv.pszVal);
- db_free(&dbv);
- }
- gce.ptszUID = make_nonutf_tchar_string((const unsigned char*)who);
- gce.ptszNick = gce.ptszUID;
-
- CONTACTINFO ci = { 0 };
- ci.cbSize = sizeof(ci);
- ci.szProto = SKYPE_PROTONAME;
- ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- ci.hContact = !gce.bIsMe ? hContact : NULL;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci))
- gce.ptszNick = ci.pszVal;
- gce.time = timestamp > 0 ? timestamp : (DWORD)SkypeTime(NULL);
- gce.ptszText = (TCHAR*)(msgptr + msglen);
- gce.dwFlags = GCEF_ADDTOLOG;
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- MsgList_Add((DWORD)pre.lParam, -1); // Mark as groupchat
- if (ci.pszVal) mir_free(ci.pszVal);
- free_nonutf_tchar_string((void*)gce.ptszUID);
- free_nonutf_tchar_string((void*)gcd.ptszID);
-
- // Yes, we have successfully read the msg
- if (!args.bDontMarkSeen)
- SkypeSend("SET %s %s SEEN", cmdMessage, args.msgnum);
- __leave;
- }
-
- if (args.QueryMsgDirection || (direction&DBEF_SENT)) {
- // Check if the timestamp is valid
- dbei.cbSize = sizeof(dbei);
- dbei.cbBlob = 0;
- if (hDbEvent = db_event_first(hContact)) {
- db_event_get(hDbEvent, &dbei);
- lwr = dbei.timestamp;
- }
- dbei.cbSize = sizeof(dbei);
- dbei.cbBlob = 0;
- dbei.timestamp = 0;
- if (hDbEvent = db_event_last(hContact))
- db_event_get(hDbEvent, &dbei);
- LOG(("FetchMessageThread timestamp %ld between %ld and %ld", timestamp, lwr, dbei.timestamp));
- if (timestamp < lwr || (direction&DBEF_SENT)) {
- TYP_MSGLENTRY *pme;
-
- LOG(("FetchMessageThread Adding event"));
- if (!(dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0)))
- dbei.szModule = SKYPE_PROTONAME;
- dbei.cbBlob = msglen;
- dbei.pBlob = (PBYTE)msgptr;
- dbei.timestamp = timestamp > 0 ? timestamp : (DWORD)SkypeTime(NULL);
- dbei.flags = direction;
- if (pre.flags & PREF_CREATEREAD)
- dbei.flags |= DBEF_READ;
- dbei.eventType = EVENTTYPE_MESSAGE;
- pme = MsgList_Add((DWORD)pre.lParam, db_event_add(hContact, &dbei));
-
- // We could call MS_PROTO_CHAINSEND if we want to have MetaContact adding the history for us,
- // however we all know that CCSDATA doesn't contain timestamp-information which is
- // really bad on importing history for example, as all messages would be added with current
- // timestamp. This would cause unreliable jumbled timestamps in metacontact, so we better do this
- // ourself.
- if (db_mc_isSub(hContact)) {
- DWORD dwMetaLink = db_get_dw(hContact, "MetaContacts", "MetaLink", MAXDWORD);
- MCONTACT hMetaContact;
-
- if (dwMetaLink != MAXDWORD && (hMetaContact = GetMetaHandle(dwMetaLink))) {
- dbei.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hMetaContact, 0);
- pme->hMetaEvent = db_event_add(hMetaContact, &dbei);
- }
- }
-
- if (!args.QueryMsgDirection && !args.bDontMarkSeen)
- SkypeSend("SET %s %s SEEN", cmdMessage, args.msgnum);
- }
- }
-
-
- if (!(direction&DBEF_SENT) && (!args.QueryMsgDirection || (args.QueryMsgDirection && timestamp > dbei.timestamp))) {
- LOG(("FetchMessageThread Normal message add..."));
- // Normal message received, process it
- ccs.szProtoService = PSR_MESSAGE;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)⪯
- pre.flags |= direction;
- if (isGroupChat && db_get_b(NULL, SKYPE_PROTONAME, "MarkGroupchatRead", 0))
- pre.flags |= PREF_CREATEREAD;
- pre.timestamp = timestamp > 0 ? timestamp : (DWORD)SkypeTime(NULL);
- pre.szMessage = msgptr;
- CallServiceSync(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
-
- // Yes, we have successfully read the msg
- if (!args.bDontMarkSeen) SkypeSend("SET %s %s SEEN", cmdMessage, args.msgnum);
- }
- }
- __finally {
- if (status) free(status);
- if (msg) free(msg);
- if (users) free(users);
- if (chat) free(chat);
- if (type) free(type);
- if (who) free(who);
- }
-
-}
-
-void FetchMessageThreadSync(fetchmsg_arg *pargs) {
- // Secure this thread with a mutex.
- // This is needed to ensure that we get called after an old msg in the queue has
- // been added so that MsgList_FindEntry will find it.
- WaitForSingleObject(FetchMessageEvent, 30000); // Wait max. 30 sec. for previous message fetch to complete
- if ((pargs->pMsgEntry = MsgList_FindMessage(strtoul(pargs->msgnum, NULL, 10))) && !pargs->pMsgEntry->tEdited) {
- // Better don't do this, as we set the msg as read and with this code, we would
- // mark messages not opened by user as read which isn't that good
- /*
- if (pargs->bIsRead && pMsgEvent->hEvent != INVALID_HANDLE_VALUE)
- {
- MCONTACT hContact;
- if ((int)(hContact = (MCONTACT)CallService (MS_DB_EVENT_GETCONTACT, (WPARAM)pMsgEntry->hEvent, 0)) != -1)
- CallService (MS_DB_EVENT_MARKREAD, hContact, (LPARAM)hDBEvent);
- }
- */
- free(pargs);
- }
- else FetchMessageThread(pargs);
- SetEvent(FetchMessageEvent);
-}
-
-static int MsglCmpProc(const void *pstPElement, const void *pstPToFind)
-{
- return mir_strcmp((char*)((fetchmsg_arg*)pstPElement)->pMsgEntry, (char*)((fetchmsg_arg*)pstPToFind)->pMsgEntry);
-}
-
-void MessageListProcessingThread(char *str) {
- char *token, *nextoken = 0, *chat = NULL;
- fetchmsg_arg *args;
- TYP_LIST *hListMsgs = List_Init(32);
-
- // Frst we need to sort the message timestamps
- for ((token = strtok_r(str+1, ", ", &nextoken)); token; token = strtok_r(NULL, ", ", &nextoken)) {
- if (args = (fetchmsg_arg*)calloc(1, sizeof(fetchmsg_arg) + sizeof(DWORD))) {
- strncpy(args->msgnum, token, sizeof(args->msgnum)-1);
- args->getstatus = TRUE;
- args->bIsRead = *str;
- args->bDontMarkSeen = *str;
- args->QueryMsgDirection = TRUE;
- args->pMsgEntry = (TYP_MSGLENTRY*)SkypeGet("CHATMESSAGE", token, "TIMESTAMP");
- if (!chat) chat = SkypeGet("CHATMESSAGE", token, "CHATNAME");
- if (args->pMsgEntry) List_InsertSort(hListMsgs, MsglCmpProc, args);
- else free(args);
- }
- }
- int nCount = List_Count(hListMsgs);
- for (int i = 0; i < nCount; i++) {
- args = (fetchmsg_arg*)List_ElementAt(hListMsgs, i);
- free(args->pMsgEntry);
- args->pMsgEntry = NULL;
- args->bUseTimestamp = TRUE;
- FetchMessageThreadSync(args);
- }
- if (chat) {
- SkypeSend("GET CHAT %s MEMBERS", chat);
- free(chat);
- }
- List_Exit(hListMsgs);
- free(str);
-}
-
-char *GetCallerHandle(char *szSkypeMsg) {
- return SkypeGet(szSkypeMsg, "PARTNER_HANDLE", "");
-}
-
-
-MCONTACT GetCallerContact(char *szSkypeMsg)
-{
- char *szHandle = GetCallerHandle(szSkypeMsg);
- if (!szHandle)
- return NULL;
- MCONTACT hContact = find_contact(szHandle);
- if (!hContact) {
- // If it's a SkypeOut-contact, PARTNER_HANDLE = SkypeOUT number
- DBVARIANT dbv;
- int tCompareResult;
-
- for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
- if (db_get_s(hContact, SKYPE_PROTONAME, "SkypeOutNr", &dbv)) continue;
- tCompareResult = mir_strcmp(dbv.pszVal, szHandle);
- db_free(&dbv);
- if (tCompareResult) continue; else break;
- }
- }
- free(szHandle);
- if (!hContact) { LOG(("GetCallerContact Not found!")); }
- return hContact;
-}
-
-MCONTACT GetMetaHandle(DWORD dwId)
-{
- for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
- char *szProto = GetContactProto(hContact);
- if (szProto != NULL && !mir_strcmp(szProto, "MetaContacts") &&
- db_get_dw(hContact, "MetaContacts", "MetaID", MAXDWORD) == dwId)
- return hContact;
- }
- return 0;
-}
-
-LRESULT CALLBACK InCallPopUpProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg)
- {
- case WM_COMMAND:
- break;
-
- case WM_CONTEXTMENU:
- SendMessage(hwnd, UM_DESTROYPOPUP, 0, 0);
- break;
- case UM_FREEPLUGINDATA:
- //Here we'd free our own data, if we had it.
- return FALSE;
- case UM_INITPOPUP:
- break;
- case UM_DESTROYPOPUP:
- break;
- case WM_NOTIFY:
- default:
- break;
- }
- return DefWindowProc(hwnd, msg, wParam, lParam);
-}
-
-void RingThread(char *szSkypeMsg) {
- DBVARIANT dbv;
- DBEVENTINFO dbei = { 0 };
- char *ptr = NULL;
-
- // We use a single critical section for the RingThread- and the EndCallThread-functions
- // so that only one function is running at the same time. This is needed, because when
- // a initated and unaccepted call (which is still ringing) is hangup/canceled, skype
- // sends two messages. First "CALL xxx STATUS RINGING" .. second "CALL xx STATUS CANCELED".
- // This starts two independend threads (first: RingThread; second: EndCallThread). Now
- // the two message are processed in reverse order sometimes. This causes the EndCallThread to
- // delete the contacts "CallId" property and after that the RingThread saves the contacts
- // "CallId" again. After that its not possible to call this contact, because the plugin
- // thinks that there is already a call going and the hangup-function isnt working, because
- // skype doesnt accept status-changes for finished calls. The CriticalSection syncronizes
- // the threads and the messages are processed in correct order.
- // Not the best solution, but it works.
- EnterCriticalSection(&RingAndEndcallMutex);
-
- LOG(("RingThread started."));
- if (protocol >= 5) SkypeSend("MINIMIZE");
- MCONTACT hContact = GetCallerContact(szSkypeMsg);
- if (hContact) {
- // Make sure that an answering thread is not already in progress so that we don't get
- // the 'Incoming call' event twice
- if (!db_get_s(hContact, SKYPE_PROTONAME, "CallId", &dbv)) {
- db_free(&dbv);
- LOG(("RingThread terminated."));
- goto l_exitRT;
- }
- db_set_s(hContact, SKYPE_PROTONAME, "CallId", szSkypeMsg);
- }
-
- if (!(ptr = SkypeGet(szSkypeMsg, "TYPE", ""))) {
- LOG(("RingThread terminated."));
- goto l_exitRT;;
- }
-
- if (!strncmp(ptr, "INCOMING", 8)) {
- if (!hContact) {
- char *szHandle = GetCallerHandle(szSkypeMsg);
-
- if (szHandle) {
- if (!(hContact = add_contact(szHandle, PALF_TEMPORARY))) {
- free(szHandle);
- goto l_exitRT;
- }
- db_unset(hContact, "CList", "Hidden");
- db_set_w(hContact, SKYPE_PROTONAME, "Status", (WORD)SkypeStatusToMiranda("SKYPEOUT"));
- db_set_s(hContact, SKYPE_PROTONAME, "SkypeOutNr", szHandle);
- free(szHandle);
- }
- else goto l_exitRT;
- }
- }
-
- dbei.cbSize = sizeof(dbei);
- dbei.eventType = EVENTTYPE_CALL;
- dbei.szModule = SKYPE_PROTONAME;
- dbei.timestamp = (DWORD)SkypeTime(NULL);
- dbei.pBlob = (unsigned char*)Translate("Phone call");
- dbei.cbBlob = (int)mir_strlen((const char*)dbei.pBlob) + 1;
- if (!strncmp(ptr, "INCOMING", 8))
- {
- TCHAR *lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
- if (PopupServiceExists)
- {
- BOOL showPopup, popupWindowColor;
- unsigned int popupBackColor, popupTextColor;
- int popupTimeSec;
- POPUPDATAT InCallPopup;
-
- popupTimeSec = db_get_dw(NULL, SKYPE_PROTONAME, "popupTimeSec", 4);
- popupTextColor = db_get_dw(NULL, SKYPE_PROTONAME, "popupTextColor", GetSysColor(COLOR_WINDOWTEXT));
- popupBackColor = db_get_dw(NULL, SKYPE_PROTONAME, "popupBackColor", GetSysColor(COLOR_BTNFACE));
- popupWindowColor = (0 != db_get_b(NULL, SKYPE_PROTONAME, "popupWindowColor", TRUE));
- showPopup = (0 != db_get_b(NULL, SKYPE_PROTONAME, "showPopup", TRUE));
-
- InCallPopup.lchContact = hContact;
- InCallPopup.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CALL));
- InCallPopup.colorBack = !popupWindowColor ? popupBackColor : GetSysColor(COLOR_BTNFACE);
- InCallPopup.colorText = !popupWindowColor ? popupTextColor : GetSysColor(COLOR_WINDOWTEXT);
- InCallPopup.iSeconds = popupTimeSec;
- InCallPopup.PluginWindowProc = InCallPopUpProc;
- InCallPopup.PluginData = (void *)1;
-
- mir_tstrncpy(InCallPopup.lptzText, TranslateT("Incoming Skype call"), MAX_SECONDLINE);
-
- mir_tstrncpy(InCallPopup.lptzContactName, lpzContactName, MAX_CONTACTNAME);
-
- if (showPopup)
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&InCallPopup, 0);
-
- }
-
- CLISTEVENT cle = { 0 };
- cle.cbSize = sizeof(cle);
- cle.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CALL));
- cle.pszService = SKYPE_ANSWERCALL;
- dbei.flags = DBEF_READ;
- cle.hContact = hContact;
- cle.hDbEvent = db_event_add(hContact, &dbei);
- cle.flags = CLEF_TCHAR;
- TCHAR toolTip[256];
- mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Incoming call from %s"), lpzContactName);
- cle.ptszTooltip = toolTip;
- CallServiceSync(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
- }
- else
- {
- dbei.flags = DBEF_SENT;
- db_event_add(hContact, &dbei);
- }
-
-l_exitRT:
- if (ptr) free(ptr);
- free(szSkypeMsg);
- LeaveCriticalSection(&RingAndEndcallMutex);
-}
-
-void EndCallThread(char *szSkypeMsg) {
- MCONTACT hContact = NULL;
- MEVENT hDbEvent;
- DBEVENTINFO dbei = { 0 };
- DBVARIANT dbv;
-
- // We use a single critical section for the RingThread- and the EndCallThread-functions
- // so that only one function is running at the same time. This is needed, because when
- // a initated and unaccepted call (which is still ringing) is hangup/canceled, skype
- // sends two messages. First "CALL xxx STATUS RINGING" .. second "CALL xx STATUS CANCELED".
- // This starts two independend threads (first: RingThread; second: EndCallThread). Now
- // the two message are processed in reverse order sometimes. This causes the EndCallThread to
- // delete the contacts "CallId" property and after that the RingThread saves the contacts
- // "CallId" again. After that its not possible to call this contact, because the plugin
- // thinks that there is already a call going and the hangup-function isnt working, because
- // skype doesnt accept status-changes for finished calls. The CriticalSection syncronizes
- // the threads and the messages are processed in correct order.
- // Not the best solution, but it works.
- EnterCriticalSection(&RingAndEndcallMutex);
-
- LOG(("EndCallThread started."));
- if (szSkypeMsg) {
- for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
- if (db_get_s(hContact, SKYPE_PROTONAME, "CallId", &dbv)) continue;
- int tCompareResult = mir_strcmp(dbv.pszVal, szSkypeMsg);
- db_free(&dbv);
- if (!tCompareResult)
- break;
- }
- }
- if (hContact)
- {
- db_unset(hContact, SKYPE_PROTONAME, "CallId");
-
- dbei.cbSize = sizeof(dbei);
- hDbEvent = db_event_firstUnread(hContact);
- while (hDbEvent) {
- dbei.cbBlob = 0;
- db_event_get(hDbEvent, &dbei);
- if (!(dbei.flags&(DBEF_SENT | DBEF_READ)) && dbei.eventType == EVENTTYPE_CALL) {
- db_event_markRead(hContact, hDbEvent);
- CallService(MS_CLIST_REMOVEEVENT, hContact, (LPARAM)hDbEvent);
- }
- free(dbei.pBlob);
- hDbEvent = db_event_next(hContact, hDbEvent);
- }
-
- if (!db_get_s(hContact, SKYPE_PROTONAME, "SkypeOutNr", &dbv)) {
- db_free(&dbv);
- if (!mir_strcmp((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0), SKYPE_PROTONAME) &&
- db_get_b(hContact, "CList", "NotOnList", 0)
- )
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
- }
- }
- free(szSkypeMsg);
- LeaveCriticalSection(&RingAndEndcallMutex);
-}
-
-void HoldCallThread(char *szSkypeMsg) {
- LOG(("HoldCallThread started"));
- if (!szSkypeMsg) {
- LOG(("HoldCallThread terminated."));
- return;
- }
- MCONTACT hContact = GetCallerContact(szSkypeMsg);
- if (hContact) {
- db_set_b(hContact, SKYPE_PROTONAME, "OnHold", 1);
- }
- free(szSkypeMsg);
- LOG(("HoldCallThread terminated gracefully"));
-}
-
-void ResumeCallThread(char *szSkypeMsg) {
- LOG(("ResumeCallThread started"));
- if (!szSkypeMsg) {
- LOG(("ResumeCallThread terminated."));
- return;
- }
- MCONTACT hContact = GetCallerContact(szSkypeMsg);
- if (hContact) {
- db_unset(hContact, SKYPE_PROTONAME, "OnHold");
- }
- free(szSkypeMsg);
- LOG(("ResumeCallThread terminated gracefully."));
-}
-
-int SetUserStatus(void) {
- if (RequestedStatus && AttachStatus != -1) {
- if (SkypeSend("SET USERSTATUS %s", RequestedStatus) == -1) return 1;
- }
- return 0;
-}
-
-void LaunchSkypeAndSetStatusThread(void *) {
-
- /* if (!db_get_b(NULL, SKYPE_PROTONAME, "UnloadOnOffline", 0)) {
- logoff_contacts();
- return 1;
- }
- */
- int oldStatus = SkypeStatus;
- static BOOL bLaunching = FALSE;
-
- if (bLaunching) return;
- bLaunching = TRUE;
- LOG(("LaunchSkypeAndSetStatusThread started."));
- InterlockedExchange((long *)&SkypeStatus, ID_STATUS_CONNECTING);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, SkypeStatus);
-
- if (ConnectToSkypeAPI(skype_path, 1) != -1) {
- pthread_create((pThreadFunc)SkypeSystemInit, NULL);
- //InterlockedExchange((long *)&SkypeStatus, newStatus);
- //ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, SkypeStatus);
- SetUserStatus();
- }
-
- LOG(("LaunchSkypeAndSetStatusThread terminated gracefully."));
- bLaunching = FALSE;
-}
-
-LRESULT APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam)
-{
- PCOPYDATASTRUCT CopyData;
- char *ptr, *szSkypeMsg = NULL, *nick, *buf;
- static char *onlinestatus = NULL;
- static BOOL RestoreUserStatus = FALSE;
- int sstat, oldstatus, flag;
- MCONTACT hContact;
- fetchmsg_arg *args;
- static int iReentranceCnt = 0;
-
- iReentranceCnt++;
- switch (message) {
- case WM_COPYDATA:
- LOG(("WM_COPYDATA start"));
- if (hSkypeWnd == (HWND)wParam) {
- char *pData;
- CopyData = (PCOPYDATASTRUCT)lParam;
- pData = (char*)CopyData->lpData;
- while (*pData == ' ') pData++;
- szSkypeMsg = _strdup((char*)pData);
- ReplyMessage(1);
- LOG(("< %s", szSkypeMsg));
-
- if (!strncmp(szSkypeMsg, "CONNSTATUS", 10)) {
- if (!strncmp(szSkypeMsg + 11, "LOGGEDOUT", 9)) {
- SkypeInitialized = FALSE;
- ResetEvent(SkypeReady);
- AttachStatus = -1;
- sstat = ID_STATUS_OFFLINE;
- if (g_hWnd) KillTimer(g_hWnd, 1);
- logoff_contacts(TRUE);
- }
- else
- sstat = SkypeStatusToMiranda(szSkypeMsg + 11);
-
- if (sstat) {
- oldstatus = SkypeStatus;
- InterlockedExchange((long*)&SkypeStatus, sstat);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldstatus, SkypeStatus);
- if (sstat != ID_STATUS_OFFLINE) {
- if (sstat != ID_STATUS_CONNECTING && (oldstatus == ID_STATUS_OFFLINE || oldstatus == ID_STATUS_CONNECTING)) {
-
- SkypeInitialized = FALSE;
- pthread_create((pThreadFunc)SkypeSystemInit, NULL);
- }
- if (db_get_b(NULL, SKYPE_PROTONAME, "KeepState", 0)) RestoreUserStatus = TRUE;
- }
-
- // if (SkypeStatus==ID_STATUS_ONLINE) SkypeSend("SEARCH MISSEDMESSAGES");
- }
- // break;
- }
- if (!strncmp(szSkypeMsg, "USERSTATUS", 10)) {
- // if ((sstat=SkypeStatusToMiranda(szSkypeMsg+11)) && SkypeStatus!=ID_STATUS_CONNECTING) {
- if ((sstat = SkypeStatusToMiranda(szSkypeMsg + 11))) {
- if (RestoreUserStatus && RequestedStatus) {
- RestoreUserStatus = FALSE;
- SkypeSend("SET USERSTATUS %s", RequestedStatus);
- }
- oldstatus = SkypeStatus;
- InterlockedExchange((long*)&SkypeStatus, sstat);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldstatus, sstat);
-#ifdef SKYPEBUG_OFFLN
- if ((oldstatus == ID_STATUS_OFFLINE || oldstatus == ID_STATUS_CONNECTING) &&
- SkypeStatus != ID_STATUS_CONNECTING && SkypeStatus != ID_STATUS_OFFLINE)
- pthread_create((pThreadFunc)SearchFriendsThread, NULL);
-#endif
- }
-#ifdef SKYPEBUG_OFFLN
- SetEvent(GotUserstatus);
-#endif
- break;
- }
- if (!strncmp(szSkypeMsg, "APPLICATION libpurple_typing", 28)) {
- char *nextoken = 0, *p;
-
- if (p = strtok_r(szSkypeMsg + 29, " ", &nextoken))
- {
- if (!mir_strcmp(p, "STREAMS")) {
- char *pStr;
-
- while (p = strtok_r(NULL, " ", &nextoken)) {
- if (pStr = strchr(p, ':')) {
- *pStr = 0;
- if (hContact = find_contact(p)) {
- *pStr = ':';
- db_set_s(hContact, SKYPE_PROTONAME, "Typing_Stream", p);
- }
- }
- }
- }
- else if (!mir_strcmp(p, "DATAGRAM")) {
- if (p = strtok_r(NULL, " ", &nextoken)) {
- char *pStr;
-
- if (pStr = strchr(p, ':')) {
- *pStr = 0;
- if (hContact = find_contact(p)) {
- *pStr = ':';
- db_set_s(hContact, SKYPE_PROTONAME, "Typing_Stream", p);
-
- if (p = strtok_r(NULL, " ", &nextoken)) {
- LPARAM lTyping = PROTOTYPE_CONTACTTYPING_OFF;
-
- if (!mir_strcmp(p, "PURPLE_TYPING")) lTyping = PROTOTYPE_CONTACTTYPING_INFINITE;
- CallService(MS_PROTO_CONTACTISTYPING, hContact, lTyping);
- break;
- }
- }
- }
- }
- }
- }
- }
- if (!strncmp(szSkypeMsg, "USER ", 5)) {
- char *nextoken = 0;
-
- buf = _strdup(szSkypeMsg + 5);
- if ((nick = strtok_r(buf, " ", &nextoken)) && (ptr = strtok_r(NULL, " ", &nextoken)))
- {
- if (mir_strcmp(ptr, "BUDDYSTATUS")) {
- if (!mir_strcmp(ptr, "RECEIVEDAUTHREQUEST")) {
- pthread_create((pThreadFunc)ProcessAuthRq, strdup(szSkypeMsg));
- free(buf);
- break;
- }
-
- if (!(hContact = find_contact(nick)) && mir_strcmp(ptr, "FULLNAME")) {
- SkypeSend("GET USER %s BUDDYSTATUS", nick);
- free(buf);
- break;
- }
-
- if (!mir_strcmp(ptr, "ONLINESTATUS")) {
- if (SkypeStatus != ID_STATUS_OFFLINE)
- {
- db_set_w(hContact, SKYPE_PROTONAME, "Status", (WORD)SkypeStatusToMiranda(ptr + 13));
- if ((WORD)SkypeStatusToMiranda(ptr + 13) != ID_STATUS_OFFLINE)
- {
- LOG(("WndProc Status is not offline so get user info"));
- pthread_create(GetInfoThread, (void*)hContact);
- }
- }
- }
-
- /* We handle the following properties right here in the wndProc, in case that
- * Skype protocol broadcasts them to us.
- *
- * However, we still let them be added to the Message queue im memory, as they
- * may get consumed by GetInfoThread.
- * This is necessary to have a proper error handling in case the property is
- * not supported (i.e. imo2sproxy).
- *
- * If one of the property GETs returns an error, the error-message has to be
- * removed from the message queue, as the error is the answer to the query.
- * If we don't remove the ERRORs from the list, another consumer may see the ERROR
- * as a reply to his query and process it.
- * In case the SKYPE Protocol really broadcasts one of these messages without being
- * requested by GetInfoThread (i.e. MOOD_TEXT), the garbage collector will take
- * care of them and remove them after some time.
- * This may not be the most efficient way, but ensures that we finally do proper
- * error handling.
- */
- if (!mir_strcmp(ptr, "FULLNAME")) {
- char *nm = strtok_r(NULL, " ", &nextoken);
-
- if (nm)
- {
- db_set_utf(hContact, SKYPE_PROTONAME, "FirstName", nm);
- if (!(nm = strtok_r(NULL, "", &nextoken)))
- db_unset(hContact, SKYPE_PROTONAME, "LastName");
- else
- db_set_utf(hContact, SKYPE_PROTONAME, "LastName", nm);
- }
- }
- else if (!mir_strcmp(ptr, "BIRTHDAY")) {
- int y, m, d;
- if (sscanf(ptr + 9, "%04d%02d%02d", &y, &m, &d) == 3) {
- db_set_w(hContact, SKYPE_PROTONAME, "BirthYear", (WORD)y);
- db_set_b(hContact, SKYPE_PROTONAME, "BirthMonth", (BYTE)m);
- db_set_b(hContact, SKYPE_PROTONAME, "BirthDay", (BYTE)d);
- }
- else {
- db_unset(hContact, SKYPE_PROTONAME, "BirthYear");
- db_unset(hContact, SKYPE_PROTONAME, "BirthMonth");
- db_unset(hContact, SKYPE_PROTONAME, "BirthDay");
- }
- }
- else if (!mir_strcmp(ptr, "COUNTRY")) {
- if (ptr[8]) {
- struct CountryListEntry *countries;
- int countryCount;
- CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&countryCount, (LPARAM)&countries);
- for (int i = 0; i < countryCount; i++) {
- if (countries[i].id == 0 || countries[i].id == 0xFFFF) continue;
- if (!_stricmp(countries[i].szName, ptr + 8))
- {
- db_set_w(hContact, SKYPE_PROTONAME, "Country", (BYTE)countries[i].id);
- break;
- }
- }
- }
- else db_unset(hContact, SKYPE_PROTONAME, "Country");
- }
- else if (!mir_strcmp(ptr, "SEX")) {
- if (ptr[4]) {
- BYTE sex = 0;
- if (!_stricmp(ptr + 4, "MALE")) sex = 0x4D;
- if (!_stricmp(ptr + 4, "FEMALE")) sex = 0x46;
- if (sex) db_set_b(hContact, SKYPE_PROTONAME, "Gender", sex);
- }
- else db_unset(hContact, SKYPE_PROTONAME, "Gender");
- }
- else if (!mir_strcmp(ptr, "MOOD_TEXT")) {
- LOG(("WndProc MOOD_TEXT"));
- db_set_utf(hContact, "CList", "StatusMsg", ptr + 10);
- }
- else if (!mir_strcmp(ptr, "TIMEZONE")){
- time_t temp;
- struct tm tms;
- int value = atoi(ptr + 9), tz;
-
- LOG(("WndProc: TIMEZONE %s", nick));
-
- if (value && !db_get_b(NULL, SKYPE_PROTONAME, "IgnoreTimeZones", 0)) {
- temp = SkypeTime(NULL);
- tms = *localtime(&temp);
- //memcpy(&tms,localtime(&temp), sizeof(tm));
- //tms = localtime(&temp)
- tz = (value >= 86400) ? (256 - ((2 * (atoi(ptr + 9) - 86400)) / 3600)) : ((-2 * (atoi(ptr + 9) - 86400)) / 3600);
- if (tms.tm_isdst == 1 && db_get_b(NULL, SKYPE_PROTONAME, "UseTimeZonePatch", 0))
- {
- LOG(("WndProc: Using the TimeZonePatch"));
- db_set_b(hContact, "UserInfo", "Timezone", (BYTE)(tz + 2));
- }
- else
- {
- LOG(("WndProc: Not using the TimeZonePatch"));
- db_set_b(hContact, "UserInfo", "Timezone", (BYTE)(tz + 0));
- }
- }
- else {
- LOG(("WndProc: Deleting the TimeZone in UserInfo Section"));
- db_unset(hContact, "UserInfo", "Timezone");
- }
- }
- else if (!mir_strcmp(ptr, "IS_VIDEO_CAPABLE")){
- if (!_stricmp(ptr + 17, "True"))
- db_set_s(hContact, SKYPE_PROTONAME, "MirVer", "Skype 2.0");
- else
- db_set_s(hContact, SKYPE_PROTONAME, "MirVer", "Skype");
- }
- else if (!mir_strcmp(ptr, "ISBLOCKED")){
- if (!_stricmp(ptr + 10, "True"))
- db_set_b(hContact, SKYPE_PROTONAME, "IsBlocked", 1);
- else
- db_unset(hContact, SKYPE_PROTONAME, "IsBlocked");
- }
- else if (!mir_strcmp(ptr, "RICH_MOOD_TEXT")) {
- db_set_s(hContact, SKYPE_PROTONAME, "MirVer", "Skype 3.0");
- }
- else if (!mir_strcmp(ptr, "DISPLAYNAME")) {
- // Skype Bug? -> If nickname isn't customised in the Skype-App, this won't return anything :-(
- if (ptr[12])
- db_set_utf(hContact, SKYPE_PROTONAME, "Nick", ptr + 12);
- }
- else
- {
- // Other proerties that can be directly assigned to a DB-Value
- for (int i = 0; i < sizeof(m_settings) / sizeof(m_settings[0]); i++) {
- if (!mir_strcmp(ptr, m_settings[i].SkypeSetting)) {
- char *pszProp = ptr + mir_strlen(m_settings[i].SkypeSetting) + 1;
- if (*pszProp)
- db_set_utf(hContact, SKYPE_PROTONAME, m_settings[i].MirandaSetting, pszProp);
- else
- db_unset(hContact, SKYPE_PROTONAME, m_settings[i].MirandaSetting);
- }
- }
- }
- }
- else { // BUDDYSTATUS:
- flag = 0;
- switch (atoi(ptr + 12)) {
- case 1: if (hContact = find_contact(nick)) CallService(MS_DB_CONTACT_DELETE, hContact, 0); break;
- case 0: break;
- case 2: flag = PALF_TEMPORARY;
- case 3: add_contact(nick, flag);
- SkypeSend("GET USER %s ONLINESTATUS", nick);
- break;
- }
- free(buf);
- if (!SetEvent(hBuddyAdded))
- TellError(GetLastError());
- break;
- }
- }
- free(buf);
- }
- if (!strncmp(szSkypeMsg, "CURRENTUSERHANDLE", 17)) { // My username
- DBVARIANT dbv = { 0 };
-
- if (db_get_s(NULL, SKYPE_PROTONAME, "LoginUserName", &dbv) ||
- !*dbv.pszVal || _stricmp(szSkypeMsg + 18, dbv.pszVal) == 0)
- {
- db_set_s(NULL, SKYPE_PROTONAME, SKYPE_NAME, szSkypeMsg + 18);
- db_set_s(NULL, SKYPE_PROTONAME, "Nick", szSkypeMsg + 18);
- pthread_create((pThreadFunc)GetDisplaynameThread, NULL);
- }
- if (dbv.pszVal) db_free(&dbv);
- }
- if (strstr(szSkypeMsg, "AUTOAWAY") || !strncmp(szSkypeMsg, "OPEN ", 5) ||
- (SkypeInitialized && !strncmp(szSkypeMsg, "PONG", 4)) ||
- !strncmp(szSkypeMsg, "MINIMIZE", 8))
- {
- // Currently we do not process these messages
- break;
- }
- if (!strncmp(szSkypeMsg, "CHAT ", 5)) {
- // Currently we only process these notifications
- if (db_get_b(NULL, SKYPE_PROTONAME, "UseGroupchat", 0) &&
- (ptr = strchr(szSkypeMsg, ' ')) && (ptr = strchr(++ptr, ' ')))
- {
- if (strncmp(ptr, " MEMBERS", 8) == 0) {
- LOG(("WndProc AddMembers"));
- pthread_create((pThreadFunc)AddMembersThread, _strdup(szSkypeMsg));
- }
- else
- if (strncmp(ptr, " FRIENDLYNAME ", 14) == 0) {
- // Chat session name
- MCONTACT hContact;
-
- *ptr = 0;
- if (hContact = find_chatA(szSkypeMsg + 5))
- {
- if (db_get_w(hContact, SKYPE_PROTONAME, "Status", ID_STATUS_OFFLINE) !=
- ID_STATUS_OFFLINE)
- {
- GCDEST gcd = { SKYPE_PROTONAME, make_nonutf_tchar_string((const unsigned char*)szSkypeMsg + 5), GC_EVENT_CHANGESESSIONAME };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.ptszText = make_tchar_string((const unsigned char*)ptr + 14);
- if (gce.ptszText) {
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
- db_set_ts(hContact, SKYPE_PROTONAME, "Nick", gce.ptszText);
- free((void*)gce.ptszText);
- }
- free_nonutf_tchar_string((void*)gcd.ptszID);
- }
- }
- *ptr = ' ';
- }
- else if (strncmp(ptr, " CHATMESSAGES ", 14) == 0) {
- size_t iLen = mir_strlen(ptr+14)+1;
- char *pParam = (char*)calloc(iLen+1, 1);
- *pParam=TRUE;
- memcpy(pParam+1, ptr+14, iLen);
- pthread_create((pThreadFunc)MessageListProcessingThread, pParam);
- break;
- }
- }
- }
- if (!strncmp(szSkypeMsg, "CALL ", 5)) {
- // incoming calls are already processed by Skype, so no need for us
- // to do this.
- // However we can give a user the possibility to hang up a call via Miranda's
- // context menu
- if (ptr = strstr(szSkypeMsg, " STATUS ")) {
- ptr[0] = 0; ptr += 8;
- if (!mir_strcmp(ptr, "RINGING") || !mir_strcmp(ptr, "ROUTING")) pthread_create((pThreadFunc)RingThread, _strdup(szSkypeMsg));
- if (!mir_strcmp(ptr, "FAILED") || !mir_strcmp(ptr, "FINISHED") ||
- !mir_strcmp(ptr, "MISSED") || !mir_strcmp(ptr, "REFUSED") ||
- !mir_strcmp(ptr, "BUSY") || !mir_strcmp(ptr, "CANCELLED"))
- pthread_create((pThreadFunc)EndCallThread, _strdup(szSkypeMsg));
- if (!mir_strcmp(ptr, "ONHOLD") || !mir_strcmp(ptr, "LOCALHOLD") ||
- !mir_strcmp(ptr, "REMOTEHOLD")) pthread_create((pThreadFunc)HoldCallThread, _strdup(szSkypeMsg));
- if (!mir_strcmp(ptr, "INPROGRESS")) pthread_create((pThreadFunc)ResumeCallThread, _strdup(szSkypeMsg));
- break;
- }
- else if ((!strstr(szSkypeMsg, "PARTNER_HANDLE") && !strstr(szSkypeMsg, "FROM_HANDLE"))
- && !strstr(szSkypeMsg, "TYPE")) break;
- }
- if (!strncmp(szSkypeMsg, "PRIVILEGE SKYPEOUT", 18)) {
- if (!strncmp(szSkypeMsg + 19, "TRUE", 4)) {
- if (!bSkypeOut) {
- CLISTMENUITEM mi = { 0 };
-
- bSkypeOut = TRUE;
- mi.cbSize = sizeof(mi);
- mi.position = -2000005000;
- mi.flags = 0;
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CALLSKYPEOUT));
- mi.pszContactOwner = SKYPE_PROTONAME;
- mi.pszName = Translate("Do a SkypeOut-call");
- mi.pszService = SKYPEOUT_CALL;
- Menu_AddMainMenuItem(&mi);
- }
-
- }
- else {
- bSkypeOut = FALSE;
- if (httbButton) {
- CallService(MS_TTB_REMOVEBUTTON, (WPARAM)httbButton, 0);
- httbButton = 0;
- }
- }
- break;
- }
- if (!strncmp(szSkypeMsg, "MESSAGES", 8) || !strncmp(szSkypeMsg, "CHATMESSAGES", 12)) {
- char *pMsgs;
- if (mir_strlen(szSkypeMsg) <= (UINT)((pMsgs=strchr(szSkypeMsg, ' ')) - szSkypeMsg + 1))
- {
- LOG(("%s %d %s %d", szSkypeMsg, (UINT)(strchr(szSkypeMsg, ' ') - szSkypeMsg + 1),
- strchr(szSkypeMsg, ' '), mir_strlen(szSkypeMsg)));
- break;
- }
- LOG(("MessageListProcessingThread launched"));
- size_t iLen = mir_strlen(pMsgs)+1;
- char *pParam=(char*)calloc(iLen+1, 1);
- memcpy(pParam+1, pMsgs, iLen);
- pthread_create((pThreadFunc)MessageListProcessingThread, pParam);
- break;
- }
- if (!strncmp(szSkypeMsg, "MESSAGE", 7) || !strncmp(szSkypeMsg, "CHATMESSAGE", 11))
- {
- char *pMsgNum;
- TYP_MSGLENTRY *pEntry;
-
- if ((pMsgNum = strchr(szSkypeMsg, ' ')) && (ptr = strchr(++pMsgNum, ' ')))
- {
- BOOL bFetchMsg = FALSE;
-
- if (strncmp(ptr, " EDITED_TIMESTAMP", 17) == 0) {
- ptr[0] = 0;
- if (pEntry = MsgList_FindMessage(strtoul(pMsgNum, NULL, 10))) {
- pEntry->tEdited = atol(ptr + 18);
- }
- bFetchMsg = TRUE;
- }
- else bFetchMsg = (strncmp(ptr, " STATUS RE", 10) == 0 && !rcvwatchers) ||
- (strncmp(ptr, " STATUS SENT", 12) == 0 && !sendwatchers);
-
- if (bFetchMsg) {
- // If new message is available, fetch it
- ptr[0] = 0;
- if (!(args = (fetchmsg_arg *)calloc(1, sizeof(*args)))) break;
- strncpy(args->msgnum, pMsgNum, sizeof(args->msgnum)-1);
- args->getstatus = FALSE;
- //args->bIsRead = strncmp(ptr+8, "READ", 4) == 0;
- pthread_create((pThreadFunc)FetchMessageThreadSync, args);
- break;
- }
- }
- }
- if (bHasFileXfer && !strncmp(szSkypeMsg, "FILETRANSFER", 12))
- FXHandleMessage(szSkypeMsg+13);
- if (!strncmp(szSkypeMsg, "ERROR 68", 8)) {
- LOG(("We got a sync problem :( -> SendMessage() will try to recover..."));
- break;
- }
- if (!strncmp(szSkypeMsg, "PROTOCOL ", 9)) {
- if ((protocol = (char)atoi(szSkypeMsg + 9)) >= 3) {
- mir_strcpy(cmdMessage, "CHATMESSAGE");
- mir_strcpy(cmdPartner, "FROM");
- }
- bProtocolSet = TRUE;
-
- if (protocol < 5 && !hMenuAddSkypeContact && db_get_b(NULL, SKYPE_PROTONAME, "EnableMenu", 1))
- hMenuAddSkypeContact = add_mainmenu();
- }
- LOG(("SkypeMsgAdd launched"));
- SkypeMsgAdd(szSkypeMsg);
- ReleaseSemaphore(SkypeMsgReceived, receivers, NULL);
- }
- break;
-
- case WM_TIMER:
- if (iReentranceCnt > 1) break;
- if (!bIsImoproxy) SkypeSend("PING");
- SkypeMsgCollectGarbage(MAX_MSG_AGE);
- MsgList_CollectGarbage();
- if (receivers > 1)
- {
- LOG(("Watchdog WARNING: there are still %d receivers waiting for MSGs", receivers));
- }
- break;
-
- case WM_CLOSE:
- PostQuitMessage(0);
- break;
- case WM_DESTROY:
- KillTimer(hWndDlg, 1);
- break;
- case WM_COPYDATALOCAL:
- --iReentranceCnt;
- return WndProc(hWndDlg, WM_COPYDATA, wParam, lParam);
-
- default:
- if (message == ControlAPIAttach) {
- // Skype responds with Attach to the discover-message
- if ((HWND)wParam == hForbiddenSkypeWnd) {
- ResetEvent(SkypeReady);
- break;
- }
- AttachStatus = lParam;
- if (lParam == SKYPECONTROLAPI_ATTACH_SUCCESS) {
- LOG(("AttachStatus success, got hWnd %08X", (HWND)wParam));
-
- if (hSkypeWnd && (HWND)wParam != hSkypeWnd && IsWindow(hSkypeWnd))
- hSkypeWndSecondary = (HWND)wParam;
- else {
- hSkypeWnd = (HWND)wParam; // Skype gave us the communication window handle
- hSkypeWndSecondary = NULL;
- }
- }
- if (AttachStatus != SKYPECONTROLAPI_ATTACH_API_AVAILABLE &&
- AttachStatus != SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE)
- {
- LOG(("Attaching: SkypeReady fired, Attachstatus is %d", AttachStatus));
- SetEvent(SkypeReady);
- }
- AttachStatus = lParam;
- break;
- }
- --iReentranceCnt;
- return DefWindowProc(hWndDlg, message, wParam, lParam);
- }
- LOG(("WM_COPYDATA exit (%08X)", message));
- if (szSkypeMsg) free(szSkypeMsg);
- --iReentranceCnt;
- return 1;
-}
-
-void TellError(DWORD err) {
- LPVOID lpMsgBuf;
-
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL);
- MessageBox(NULL, (TCHAR*)lpMsgBuf, _T("GetLastError"), MB_OK | MB_ICONINFORMATION);
- LocalFree(lpMsgBuf);
- return;
-}
-
-
-// SERVICES //
-INT_PTR SkypeSetStatus(WPARAM wParam, LPARAM lParam)
-{
- int oldStatus, iRet;
- BOOL UseCustomCommand, UnloadOnOffline;
-
- if (MirandaShuttingDown) return 0;
- LOG(("SkypeSetStatus enter"));
- UseCustomCommand = db_get_b(NULL, SKYPE_PROTONAME, "UseCustomCommand", 0);
- UnloadOnOffline = db_get_b(NULL, SKYPE_PROTONAME, "UnloadOnOffline", 0);
-
- //if (!SkypeInitialized && !db_get_b(NULL, SKYPE_PROTONAME, "UnloadOnOffline", 0)) return 0;
-
- // Workaround for Skype status-bug
- if (wParam == ID_STATUS_OFFLINE) logoff_contacts(TRUE);
- if (SkypeStatus == wParam) return 0;
- oldStatus = SkypeStatus;
-
- if (wParam == ID_STATUS_CONNECTING) return 0;
-#ifdef MAPDND
- if (wParam == ID_STATUS_OCCUPIED || wParam == ID_STATUS_ONTHEPHONE) wParam = ID_STATUS_DND;
- if (wParam == ID_STATUS_OUTTOLUNCH) wParam = ID_STATUS_NA;
-#endif
-#ifdef MAPNA
- if (wParam==ID_STATUS_NA) wParam = ID_STATUS_AWAY;
-#endif
-
- RequestedStatus = MirandaStatusToSkype((int)wParam);
-
- /*
- if (SkypeStatus != ID_STATUS_OFFLINE)
- {
- InterlockedExchange((long*)&SkypeStatus, wParam);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, SkypeStatus);
- }
- */
-
- if (wParam == ID_STATUS_OFFLINE && UnloadOnOffline)
- {
- if (UseCustomCommand)
- {
- DBVARIANT dbv;
- if (!db_get_s(NULL, SKYPE_PROTONAME, "CommandLine", &dbv))
- {
- CloseSkypeAPI(dbv.pszVal);
- db_free(&dbv);
- }
- }
- else CloseSkypeAPI(skype_path);
- }
- else if (AttachStatus == -1)
- {
- pthread_create(LaunchSkypeAndSetStatusThread, (void *)wParam);
- return 0;
- }
-
- iRet = SetUserStatus();
- LOG(("SkypeSetStatus exit"));
- return iRet;
-}
-
-void __stdcall SendBroadcast(MCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam)
-{
- ACKDATA ack = { sizeof(ACKDATA) };
- ack.szModule = SKYPE_PROTONAME;
- ack.hContact = hContact;
- ack.type = type;
- ack.result = result;
- ack.hProcess = hProcess;
- ack.lParam = lParam;
- CallService(MS_PROTO_BROADCASTACK, 0, (LPARAM)&ack);
-}
-
-static void __cdecl SkypeGetAwayMessageThread(void *param)
-{
- MCONTACT hContact = (MCONTACT) param;
- DBVARIANT dbv;
- if (!db_get_ts(hContact, "CList", "StatusMsg", &dbv)) {
- SendBroadcast(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal);
- db_free(&dbv);
- }
- else SendBroadcast(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0);
-}
-
-INT_PTR SkypeGetAwayMessage(WPARAM, LPARAM lParam)
-{
- CCSDATA *ccs = (CCSDATA*)lParam;
- pthread_create(SkypeGetAwayMessageThread, (void*)ccs->hContact);
- return 1;
-}
-
-#define POLYNOMIAL (0x488781ED) /* This is the CRC Poly */
-#define TOPBIT (1 << (WIDTH - 1)) /* MSB */
-#define WIDTH 32
-
-static int GetFileHash(char* filename)
-{
- HANDLE hFile = CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
- int remainder = 0, byte, bit;
- char data[1024];
- DWORD dwRead;
-
- if (hFile == INVALID_HANDLE_VALUE) return 0;
-
- do
- {
- // Read file chunk
- dwRead = 0;
- ReadFile(hFile, data, 1024, &dwRead, NULL);
-
- /* loop through each byte of data */
- for (byte = 0; byte < (int)dwRead; ++byte) {
- /* store the next byte into the remainder */
- remainder ^= (data[byte] << (WIDTH - 8));
- /* calculate for all 8 bits in the byte */
- for (bit = 8; bit > 0; --bit) {
- /* check if MSB of remainder is a one */
- if (remainder & TOPBIT)
- remainder = (remainder << 1) ^ POLYNOMIAL;
- else
- remainder = (remainder << 1);
- }
- }
- } while (dwRead == 1024);
-
- CloseHandle(hFile);
-
- return remainder;
-}
-
-static int _GetFileSize(char* filename)
-{
- HANDLE hFile = CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
- if (hFile == INVALID_HANDLE_VALUE)
- return 0;
- int size = GetFileSize(hFile, NULL);
- CloseHandle(hFile);
- return size;
-}
-
-/* RetrieveUserAvatar
- *
- * Purpose: Get a user avatar from skype itself
- * Params : param=(void *)(HANDLE)hContact
- */
-void RetrieveUserAvatar(void *param)
-{
- MCONTACT hContact = (MCONTACT)param;
- if (hContact == NULL)
- return;
-
- char AvatarFile[MAX_PATH + 1], AvatarTmpFile[MAX_PATH + 10], *pszTempFile;
-
- // Mount default ack
- ACKDATA ack = { 0 };
- ack.cbSize = sizeof(ACKDATA);
- ack.szModule = SKYPE_PROTONAME;
- ack.hContact = hContact;
- ack.type = ACKTYPE_AVATAR;
- ack.result = ACKRESULT_FAILED;
-
- PROTO_AVATAR_INFORMATION AI = { 0 };
- AI.cbSize = sizeof(AI);
- AI.hContact = hContact;
-
- // Get skype name
- DBVARIANT dbv;
- if (db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0)
- {
- if (dbv.pszVal)
- {
- // Get filename
- FoldersGetCustomPath(hProtocolAvatarsFolder, AvatarFile, sizeof(AvatarFile), DefaultAvatarsFolder);
- if (!*AvatarFile) mir_strcpy(AvatarFile, DefaultAvatarsFolder);
- mir_snprintf(AvatarTmpFile, SIZEOF(AvatarTmpFile), "AVATAR 1 %s\\%s_tmp.jpg", AvatarFile, dbv.pszVal);
- pszTempFile = AvatarTmpFile + 9;
- mir_snprintf(AvatarFile, SIZEOF(AvatarFile), "%s\\%s.jpg", AvatarFile, dbv.pszVal);
-
- // Just to be sure
- DeleteFileA(pszTempFile);
- HANDLE file = CreateFileA(pszTempFile, 0, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- if (file != INVALID_HANDLE_VALUE)
- {
- CloseHandle(file);
- char *ptr = SkypeGet("USER", dbv.pszVal, AvatarTmpFile);
- if (ptr)
- {
- if (strncmp(ptr, "ERROR", 5) &&
- GetFileAttributesA(pszTempFile) != INVALID_FILE_ATTRIBUTES)
- {
- ack.result = ACKRESULT_SUCCESS;
-
- // Is no avatar image?
- if (!db_get_b(NULL, SKYPE_PROTONAME, "ShowDefaultSkypeAvatar", 0)
- && GetFileHash(pszTempFile) == 0x8d34e05d && _GetFileSize(pszTempFile) == 3751)
- {
- // Has no avatar
- AI.format = PA_FORMAT_UNKNOWN;
- ack.hProcess = (HANDLE)&AI;
- DeleteFileA(AvatarFile);
- }
- else
- {
- // Got it
- MoveFileExA(pszTempFile, AvatarFile, MOVEFILE_REPLACE_EXISTING);
- AI.format = PA_FORMAT_JPEG;
- strncpy(AI.filename, AvatarFile,SIZEOF(AI.filename)-1);
- ack.hProcess = (HANDLE)&AI;
- }
-
- }
- free(ptr);
- }
- DeleteFileA(pszTempFile);
- }
-
- }
- db_free(&dbv);
- }
- CallService(MS_PROTO_BROADCASTACK, 0, (LPARAM)&ack);
-}
-
-
-/* SkypeGetAvatarInfo
- *
- * Purpose: Set user avatar in profile
- * Params : wParam=0
- * lParam=(LPARAM)(const char*)filename
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeGetAvatarInfo(WPARAM wParam, LPARAM lParam)
-{
-
- DBVARIANT dbv;
- PROTO_AVATAR_INFORMATION *AI = (PROTO_AVATAR_INFORMATION*)lParam;
- if (AI->hContact == NULL) // User
- {
- if (!db_get_s(NULL, SKYPE_PROTONAME, "AvatarFile", &dbv))
- {
- mir_strncpy(AI->filename, dbv.pszVal, sizeof(AI->filename));
- db_free(&dbv);
- return GAIR_SUCCESS;
- }
- else
- return GAIR_NOAVATAR;
- }
- else // Contact
- {
- char AvatarFile[MAX_PATH + 1];
-
- if (protocol < 7 && !bIsImoproxy)
- return GAIR_NOAVATAR;
-
- if (wParam & GAIF_FORCE)
- {
- // Request anyway
- pthread_create(RetrieveUserAvatar, (void *)AI->hContact);
- return GAIR_WAITFOR;
- }
-
- if (db_get_s(AI->hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- // No skype name ??
- return GAIR_NOAVATAR;
-
- if (dbv.pszVal == NULL)
- {
- // No skype name ??
- db_free(&dbv);
- return GAIR_NOAVATAR;
- }
-
- // Get filename
- FoldersGetCustomPath(hProtocolAvatarsFolder, AvatarFile, sizeof(AvatarFile), DefaultAvatarsFolder);
- mir_snprintf(AvatarFile, SIZEOF(AvatarFile), "%s\\%s.jpg", AvatarFile, dbv.pszVal);
- db_free(&dbv);
-
- // Check if the file exists
- if (GetFileAttributesA(AvatarFile) == INVALID_FILE_ATTRIBUTES)
- return GAIR_NOAVATAR;
-
- // Return the avatar
- AI->format = PA_FORMAT_JPEG;
- mir_strcpy(AI->filename, AvatarFile);
- return GAIR_SUCCESS;
- }
-}
-
-
-/* SkypeGetAvatarCaps
- *
- * Purpose: Query avatar caps for a protocol
- * Params : wParam=One of AF_*
- * lParam=Depends on wParam
- * Returns: Depends on wParam
- */
-INT_PTR SkypeGetAvatarCaps(WPARAM wParam, LPARAM lParam)
-{
- switch (wParam)
- {
- case AF_MAXSIZE:
- {
- POINT *p = (POINT *)lParam;
- if (p == NULL)
- return -1;
-
- p->x = 96;
- p->y = 96;
- return 0;
- }
- case AF_PROPORTION:
- {
- return PIP_NONE;
- }
- case AF_FORMATSUPPORTED:
- {
- if (lParam == PA_FORMAT_PNG || lParam == PA_FORMAT_JPEG)
- return TRUE;
- else
- return FALSE;
- }
- case AF_ENABLED:
- {
- return TRUE;
- }
- case AF_DONTNEEDDELAYS:
- {
- return FALSE;
- }
- }
- return -1;
-}
-
-
-INT_PTR SkypeGetStatus(WPARAM, LPARAM) {
- return SkypeStatus;
-}
-
-INT_PTR SkypeGetInfo(WPARAM, LPARAM lParam) {
- CCSDATA *ccs = (CCSDATA *)lParam;
- pthread_create(GetInfoThread, (void*)ccs->hContact);
- return 0;
-}
-
-INT_PTR SkypeAddToList(WPARAM wParam, LPARAM lParam) {
- LOG(("SkypeAddToList Adding API function called"));
- PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
- if (psr->cbSize != sizeof(PROTOSEARCHRESULT) || !psr->nick.t) return 0;
- LOG(("SkypeAddToList OK"));
- return (INT_PTR)add_contact(_T2A(psr->nick.t), (DWORD)wParam);
-}
-
-INT_PTR SkypeBasicSearch(WPARAM, LPARAM lParam) {
- LOG(("SkypeBasicSearch %s", (char *)lParam));
- if (!SkypeInitialized) return 0;
- return (hSearchThread = pthread_create((pThreadFunc)BasicSearchThread, _strdup((char *)lParam)));
-}
-
-#ifdef USE_REAL_TS
-static INT_PTR EventAddHook(WPARAM wParam, LPARAM lParam)
-{
- MCONTACT hContact = (MCONTACT)wParam;
- DBEVENTINFO *dbei=(DBEVENTINFO*)lParam;
- if (dbei && hContact == m_AddEventArg.hContact && dbei->eventType==EVENTTYPE_MESSAGE && (dbei->flags & DBEF_SENT) &&
- mir_strcmp(dbei->szModule, SKYPE_PROTONAME) == 0) {
- dbei->timestamp = m_AddEventArg.timestamp;
- }
- return 0;
-}
-#endif
-
-void MessageSendWatchThread(void *a) {
- char *str, *err, *ptr, *nexttoken;
- HANDLE hDBAddEvent = NULL;
- msgsendwt_arg *arg = (msgsendwt_arg*)a;
-
- LOG(("MessageSendWatchThread started."));
-
- if (db_get_b(NULL, SKYPE_PROTONAME, "NoAck", 1))
- {
- ProtoBroadcastAck(SKYPE_PROTONAME, arg->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)1, 0);
- str=NULL;
- }
- else
- str = SkypeRcvMsg(arg->szId, SkypeTime(NULL) - 1, arg->hContact, db_get_dw(NULL, "SRMsg", "MessageTimeout", TIMEOUT_MSGSEND));
-
- InterlockedDecrement(&sendwatchers);
- if (str)
- {
- if (!db_get_b(arg->hContact, SKYPE_PROTONAME, "ChatRoom", 0)) {
- if (err = GetSkypeErrorMsg(str)) {
- ProtoBroadcastAck(SKYPE_PROTONAME, arg->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)1, (LPARAM)Translate(err));
- free(err);
- free(str);
- free(arg);
- LOG(("MessageSendWatchThread terminated."));
- return;
- }
- /* The USE_REAL_TS code would correct our Sent-Timestamp to the real time that the
- * event was sent according to the clock of the machine Skype is running on.
- * However msg-Dialog has problems with this.
- */
-#ifdef USE_REAL_TS
- EnterCriticalSection(&AddEventMutex);
-#endif
- if ((ptr=strtok_r(str, " ", &nexttoken)) && (*ptr!='#' || (ptr=strtok_r(NULL, " ", &nexttoken))) &&
- (ptr=strtok_r(NULL, " ", &nexttoken))) {
- /* Use this to ensure that main thread doesn't pick up sent message */
- MsgList_Add(strtoul(ptr, NULL, 10), -1);
-#ifdef USE_REAL_TS
- if (err=SkypeGet (cmdMessage, ptr, "TIMESTAMP")) {
- m_AddEventArg.hContact = arg->hContact;
- m_AddEventArg.timestamp = atoi(err);
- free(err);
- hDBAddEvent = HookEvent(ME_DB_EVENT_FILTER_ADD,EventAddHook);
- }
-#endif
- }
- ProtoBroadcastAck(SKYPE_PROTONAME, arg->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)1, 0);
-#ifdef USE_REAL_TS
- if (hDBAddEvent) UnhookEvent(hDBAddEvent);
- LeaveCriticalSection(&AddEventMutex);
-#endif
- }
- free(str);
- LOG(("MessageSendWatchThread terminated gracefully."));
- }
- free(arg);
-}
-
-INT_PTR SkypeSendMessage(WPARAM, LPARAM lParam) {
- CCSDATA *ccs = (CCSDATA *)lParam;
- DBVARIANT dbv;
- char *msg = (char *)ccs->lParam, *mymsgcmd = cmdMessage, szId[16] = { 0 };
- static DWORD dwMsgNum = 0;
- BYTE bIsChatroom = 0 != db_get_b(ccs->hContact, SKYPE_PROTONAME, "ChatRoom", 0);
-
- if (bIsChatroom)
- {
- if (db_get_s(ccs->hContact, SKYPE_PROTONAME, "ChatRoomID", &dbv))
- return 0;
- mymsgcmd = "CHATMESSAGE";
- }
- else
- {
- if (db_get_s(ccs->hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- return 0;
- mymsgcmd = "MESSAGE";
- }
-
- if (protocol >= 4) {
- InterlockedIncrement((LONG*)&dwMsgNum);
- sprintf(szId, "#M%d ", dwMsgNum++);
- }
- InterlockedIncrement(&sendwatchers);
- bool sendok = true;
- if (!msg || SkypeSend("%s%s %s %s", szId, mymsgcmd, dbv.pszVal, msg))
- sendok = false;
- db_free(&dbv);
-
- if (sendok) {
- msgsendwt_arg *psendarg = (msgsendwt_arg*)calloc(1, sizeof(msgsendwt_arg));
-
- if (psendarg) {
- psendarg->hContact = ccs->hContact;
- mir_strcpy(psendarg->szId, szId);
- pthread_create(MessageSendWatchThread, psendarg);
- }
- else
- InterlockedDecrement(&sendwatchers);
- return 1;
- }
- else
- InterlockedDecrement(&sendwatchers);
- if (!bIsChatroom)
- ProtoBroadcastAck(SKYPE_PROTONAME, ccs->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)1, (LPARAM)Translate("Connection to Skype lost"));
- return 0;
-}
-
-INT_PTR SkypeRecvMessage(WPARAM, LPARAM lParam)
-{
- DBEVENTINFO dbei = { 0 };
- CCSDATA *ccs = (CCSDATA *)lParam;
- PROTORECVEVENT *pre = (PROTORECVEVENT *)ccs->lParam;
-
- db_unset(ccs->hContact, "CList", "Hidden");
- dbei.cbSize = sizeof(dbei);
- dbei.szModule = SKYPE_PROTONAME;
- dbei.timestamp = pre->timestamp;
- if (pre->flags & PREF_CREATEREAD)
- dbei.flags |= DBEF_READ;
- dbei.flags |= DBEF_UTF;
- dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.cbBlob = (int)mir_strlen(pre->szMessage) + 1;
- dbei.pBlob = (PBYTE)pre->szMessage;
- MsgList_Add((DWORD)pre->lParam, db_event_add(ccs->hContact, &dbei));
- return 0;
-}
-
-INT_PTR SkypeUserIsTyping(WPARAM wParam, LPARAM lParam) {
- if (protocol < 5 && !bIsImoproxy) return 0;
-
- DBVARIANT dbv = { 0 };
- MCONTACT hContact = (MCONTACT)wParam;
- if (db_get_s(hContact, SKYPE_PROTONAME, "Typing_Stream", &dbv)) {
- if (db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv) == 0) {
- char szCmd[256];
- _snprintf(szCmd, sizeof(szCmd),
- "ALTER APPLICATION libpurple_typing CONNECT %s", dbv.pszVal);
- SkypeSend(szCmd);
- db_free(&dbv);
- testfor(szCmd, 2000);
- // TODO: We should somehow cache the typing notify result and send it
- // after we got a connection, but in the meantime this notification won't
- // get sent on first run
- }
- return 0;
- }
-
- char szWhat[128];
- sprintf(szWhat, "ALTER APPLICATION libpurple_typing DATAGRAM %s", dbv.pszVal);
- SkypeSend("%s %s", szWhat,
- (lParam == PROTOTYPE_SELFTYPING_ON ? "PURPLE_TYPING" : "PURPLE_NOT_TYPING"));
- testfor(szWhat, 2000);
- db_free(&dbv);
- return 0;
-}
-
-
-INT_PTR SkypeSendAuthRequest(WPARAM, LPARAM lParam) {
- CCSDATA* ccs = (CCSDATA*)lParam;
- DBVARIANT dbv;
- if (!ccs->lParam || db_get_s(ccs->hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- return 1;
- int retval = SkypeSend("SET USER %s BUDDYSTATUS 2 %s", dbv.pszVal, (char *)ccs->lParam);
- db_free(&dbv);
- if (retval) return 1; else return 0;
-}
-
-INT_PTR SkypeRecvAuth(WPARAM, LPARAM lParam) {
- CCSDATA *ccs = (CCSDATA*)lParam;
- PROTORECVEVENT *pre = (PROTORECVEVENT*)ccs->lParam;
-
- db_unset(ccs->hContact, "CList", "Hidden");
-
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
- dbei.szModule = SKYPE_PROTONAME;
- dbei.timestamp = pre->timestamp;
- dbei.flags = DBEF_UTF | ((pre->flags & PREF_CREATEREAD) ? DBEF_READ : 0);
- dbei.eventType = EVENTTYPE_AUTHREQUEST;
- dbei.cbBlob = (int)pre->lParam;
- dbei.pBlob = (PBYTE)pre->szMessage;
-
- db_event_add(NULL, &dbei);
- return 0;
-}
-
-char *__skypeauth(WPARAM wParam) {
- if (!SkypeInitialized) return NULL;
-
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
- if (((dbei.cbBlob = db_event_getBlobSize(wParam)) == -1 ||
- !(dbei.pBlob = (unsigned char*)malloc(dbei.cbBlob))))
- {
- return NULL;
- }
-
- if (db_event_get(wParam, &dbei) || dbei.eventType != EVENTTYPE_AUTHREQUEST || mir_strcmp(dbei.szModule, SKYPE_PROTONAME))
- {
- free(dbei.pBlob);
- return NULL;
- }
- return (char *)dbei.pBlob;
-}
-
-INT_PTR SkypeAuthAllow(WPARAM wParam, LPARAM) {
- char *pBlob = __skypeauth(wParam);
- if (pBlob)
- {
- int retval = SkypeSend("SET USER %s ISAUTHORIZED TRUE", pBlob + sizeof(DWORD) + sizeof(HANDLE));
- free(pBlob);
- if (!retval) return 0;
- }
- return 1;
-}
-
-INT_PTR SkypeAuthDeny(WPARAM wParam, LPARAM) {
- char *pBlob = __skypeauth(wParam);
- if (pBlob)
- {
- int retval = SkypeSend("SET USER %s ISAUTHORIZED FALSE", pBlob + sizeof(DWORD) + sizeof(HANDLE));
- free(pBlob);
- if (!retval) return 0;
- }
- return 1;
-}
-
-
-INT_PTR SkypeAddToListByEvent(WPARAM wParam, LPARAM) {
- char *pBlob = __skypeauth(wParam);
- if (pBlob)
- {
- MCONTACT hContact = add_contact(pBlob + sizeof(DWORD) + sizeof(HANDLE), LOWORD(wParam));
- free(pBlob);
- if (hContact) return (INT_PTR)hContact;
- }
- return 0;
-}
-
-INT_PTR SkypeRegisterProxy(WPARAM, LPARAM lParam) {
- if (!lParam) {
- free(pszProxyCallout);
- pszProxyCallout = NULL;
- }
- pszProxyCallout = _strdup((char*)lParam);
- bIsImoproxy = TRUE;
- return 0;
-}
-
-
-void CleanupNicknames(char *) {
-
- LOG(("CleanupNicknames Cleaning up..."));
- for (MCONTACT hContact = db_find_first(SKYPE_PROTONAME); hContact != NULL; hContact = db_find_next(hContact,SKYPE_PROTONAME)) {
- if (db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0)
- {
- DBVARIANT dbv;
- if (!db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) {
- DBVARIANT dbv2;
- if (!db_get_s(hContact, SKYPE_PROTONAME, "Nick", &dbv2)) {
- db_unset(hContact, SKYPE_PROTONAME, "Nick");
- GetInfoThread((void*)hContact);
- db_free(&dbv2);
- }
- db_free(&dbv);
- }
- }
- }
- OUTPUT(TranslateT("Cleanup finished."));
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// EnterBitmapFileName - enters a bitmap filename
-
-int __stdcall EnterBitmapFileName(TCHAR *szDest)
-{
- TCHAR szFilter[512];
- BmpFilterGetStrings(szFilter, SIZEOF(szFilter));
-
- *szDest = 0;
- OPENFILENAME ofn = { 0 };
- ofn.lStructSize = sizeof(OPENFILENAME);
- ofn.lpstrFilter = szFilter;
- ofn.lpstrFile = szDest;
- ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- ofn.nMaxFile = MAX_PATH;
- ofn.nMaxFileTitle = MAX_PATH;
- ofn.lpstrDefExt = _T("bmp");
- if (!GetOpenFileName(&ofn))
- return 1;
-
- return ERROR_SUCCESS;
-}
-
-int MirandaExit(WPARAM, LPARAM) {
- MirandaShuttingDown = TRUE;
- return 0;
-}
-
-int OkToExit(WPARAM, LPARAM) {
- // logoff_contacts();
- MirandaShuttingDown = TRUE;
-
- // Trigger all semaphores and events just to be sure that there is no deadlock
- ReleaseSemaphore(SkypeMsgReceived, receivers, NULL);
- SetEvent(SkypeReady);
- SetEvent(MessagePumpReady);
-#ifdef SKYPEBUG_OFFLN
- SetEvent(GotUserstatus);
-#endif
- SetEvent(hBuddyAdded);
-
- SkypeFlush();
- PostMessage(g_hWnd, WM_CLOSE, 0, 0);
- return 0;
-}
-
-
-struct PLUGINDI {
- char **szSettings;
- int dwCount;
-};
-
-// Taken from pluginopts.c and modified
-int EnumOldPluginName(const char *szSetting, LPARAM lParam)
-{
- struct PLUGINDI *pdi = (struct PLUGINDI*)lParam;
- if (pdi && lParam) {
- pdi->szSettings = (char**)realloc(pdi->szSettings, (pdi->dwCount + 1)*sizeof(char*));
- pdi->szSettings[pdi->dwCount++] = _strdup(szSetting);
- }
- return 0;
-}
-
-// Are there any Skype users on list?
-// 1 --> Yes
-// 0 --> No
-int AnySkypeusers(void)
-{
- DBVARIANT dbv;
- int tCompareResult;
-
- // already on list?
- for (MCONTACT hContact = db_find_first();
- hContact != NULL;
- hContact = db_find_next(hContact))
- {
- // GETCONTACTBASEPROTO doesn't work on not loaded protocol, therefore get
- // protocol from DB
- if (db_get_s(hContact, "Protocol", "p", &dbv)) continue;
- tCompareResult = !mir_strcmp(dbv.pszVal, SKYPE_PROTONAME);
- db_free(&dbv);
- if (tCompareResult) return 1;
- }
- return 0;
-}
-
-
-/*void UpgradeName(char *OldName)
-{
-DBCONTACTENUMSETTINGS cns;
-DBCONTACTWRITESETTING cws;
-DBVARIANT dbv;
-MCONTACT hContact=NULL;
-struct PLUGINDI pdi;
-
-LOG(("Updating old database settings if there are any..."));
-cns.pfnEnumProc=EnumOldPluginName;
-cns.lParam=(LPARAM)&pdi;
-cns.szModule=OldName;
-cns.ofsSettings=0;
-
-hContact = db_find_first();
-
-for ( ;; ) {
-memset(&pdi,0,sizeof(pdi));
-CallService(MS_DB_CONTACT_ENUMSETTINGS,hContact,(LPARAM)&cns);
-// Upgrade Protocol settings to new string
-if (pdi.szSettings) {
-int i;
-
-LOG(("We're currently upgrading..."));
-for (i=0;i<pdi.dwCount;i++) {
-if (!db_get_s(hContact, OldName, pdi.szSettings[i], &dbv)) {
-cws.szModule=SKYPE_PROTONAME;
-cws.szSetting=pdi.szSettings[i];
-cws.value=dbv;
-if (!CallService(MS_DB_CONTACT_WRITESETTING,hContact,(LPARAM)&cws))
-db_unset(hContact,OldName,pdi.szSettings[i]);
-db_free(&dbv);
-}
-free(pdi.szSettings[i]);
-}
-free(pdi.szSettings);
-}
-// Upgrade Protocol assignment, if we are not main contact
-if (hContact && !db_get_s(hContact, "Protocol", "p", &dbv)) {
-if (!mir_strcmp(dbv.pszVal, OldName))
-db_set_s(hContact, "Protocol", "p", SKYPE_PROTONAME);
-db_free(&dbv);
-}
-if (!hContact) break;
-hContact = db_find_next(hContact);
-}
-
-db_set_b(NULL, SKYPE_PROTONAME, "UpgradeDone", (BYTE)1);
-return;
-}*/
-
-void __cdecl MsgPump(char *)
-{
- MSG msg;
-
- WNDCLASS WndClass;
-
- // Create window class
- WndClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
- WndClass.lpfnWndProc = (WNDPROC)WndProc;
- WndClass.cbClsExtra = 0;
- WndClass.cbWndExtra = 0;
- WndClass.hInstance = hInst;
- WndClass.hIcon = NULL;
- WndClass.hCursor = NULL;
- WndClass.hbrBackground = NULL;
- WndClass.lpszMenuName = NULL;
- WndClass.lpszClassName = _T("SkypeApiDispatchWindow");
- RegisterClass(&WndClass);
- // Do not check the retval of RegisterClass, because on non-unicode
- // win98 it will fail, as it is a stub that returns false() there
-
- // Create main window
- g_hWnd = CreateWindowEx(WS_EX_APPWINDOW | WS_EX_WINDOWEDGE,
- _T("SkypeApiDispatchWindow"), _T(""), WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX,
- CW_USEDEFAULT, CW_USEDEFAULT, 128, 128, NULL, 0, (HINSTANCE)WndClass.hInstance, 0);
-
- LOG(("Created Dispatch window with handle %08X", (long)g_hWnd));
- if (!g_hWnd) {
- OUTPUT(TranslateT("Cannot create window."));
- TellError(GetLastError());
- SetEvent(MessagePumpReady);
- return;
- }
- ShowWindow(g_hWnd, 0);
- UpdateWindow(g_hWnd);
- msgPumpThreadId = GetCurrentThreadId();
- SetEvent(MessagePumpReady);
-
- LOG(("Messagepump started."));
- while (GetMessage(&msg, NULL, 0, 0) > 0 && !Miranda_Terminated()) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- UnregisterClass(WndClass.lpszClassName, hInst);
- LOG(("Messagepump stopped."));
-}
-
-// DLL Stuff //
-
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirVersion)
-{
- return &pluginInfo;
-}
-
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MUUID_SKYPE_CALL, MIID_LAST };
-
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD/* fdwReason*/, LPVOID /*lpvReserved*/)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
-
-int PreShutdown(WPARAM, LPARAM) {
- PostThreadMessage(msgPumpThreadId, WM_QUIT, 0, 0);
- return 0;
-}
-
-extern "C" int __declspec(dllexport) Load(void)
-{
- DWORD Buffsize;
- HKEY MyKey;
- BOOL SkypeInstalled;
- WSADATA wsaData;
-
- mir_getLP(&pluginInfo);
-
- // RM: commented so it will always use predefined name - or was this really needed?
- ///GetModuleFileNameA( hInst, path, sizeof( path ));
- ///_splitpath (path, NULL, NULL, SKYPE_PROTONAME, NULL);
- ///CharUpperA( SKYPE_PROTONAME );
-
- InitializeCriticalSection(&RingAndEndcallMutex);
- InitializeCriticalSection(&QueryThreadMutex);
- InitializeCriticalSection(&TimeMutex);
-#ifdef USE_REAL_TS
- InitializeCriticalSection(&AddEventMutex);
-#endif
-
-
-#ifdef _DEBUG
- init_debug();
-#endif
-
- LOG(("Load: Skype Plugin loading..."));
-
- // We need to upgrade SKYPE_PROTOCOL internal name to Skype if not already done
- /* if (!db_get_b(NULL, SKYPE_PROTONAME, "UpgradeDone", 0))
- UpgradeName("SKYPE_PROTOCOL");*/
-
- // Initialisation of Skype MsgQueue must be done because of Cleanup in end and
- // Mutex is also initialized here.
- LOG(("SkypeMsgInit initializing Skype MSG-queue"));
- if (SkypeMsgInit() == -1) {
- OUTPUT(TranslateT("Memory allocation error on startup."));
- return 0;
- }
-
- // On first run on new profile, ask user, if he wants to enable the plugin in
- // this profile
- // --> Fixing Issue #0000006 from bugtracker.
- if (!db_get_b(NULL, SKYPE_PROTONAME, "FirstRun", 0)) {
- db_set_b(NULL, SKYPE_PROTONAME, "FirstRun", 1);
- if (AnySkypeusers() == 0) // First run, it seems :)
- if (MessageBox(NULL, TranslateT("This seems to be the first time that you're running the Skype protocol plugin. Do you want to enable the protocol for this Miranda profile? If you chose NO, you can always enable it in the plugin options later."), _T("Welcome!"), MB_ICONQUESTION | MB_YESNO) == IDNO) {
- char path[MAX_PATH], *filename;
- GetModuleFileNameA(hInst, path, sizeof(path));
- if (filename = strrchr(path, '\\') + 1)
- db_set_b(NULL, "PluginDisable", filename, 1);
- return 0;
- }
- }
-
-
- // Check if Skype is installed
- SkypeInstalled = TRUE;
- BOOL UseCustomCommand = (BYTE)db_get_b(NULL, SKYPE_PROTONAME, "UseCustomCommand", 0);
- UseSockets = (BOOL)db_get_b(NULL, SKYPE_PROTONAME, "UseSkype2Socket", 0);
-
- if (!UseSockets && !UseCustomCommand)
- {
- if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Skype\\Phone"), 0, KEY_READ, &MyKey) != ERROR_SUCCESS)
- {
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Skype\\Phone"), 0, KEY_READ, &MyKey) != ERROR_SUCCESS)
- {
- SkypeInstalled = FALSE;
- }
- }
-
- Buffsize = sizeof(skype_path);
-
- if (SkypeInstalled == FALSE || RegQueryValueExA(MyKey, "SkypePath", NULL, NULL, (unsigned char *)skype_path, &Buffsize) != ERROR_SUCCESS)
- {
- //OUTPUT("Skype was not found installed :( \nMaybe you are using portable Skype.");
- RegCloseKey(MyKey);
- skype_path[0] = 0;
- //return 0;
- }
- RegCloseKey(MyKey);
- }
- WSAStartup(MAKEWORD(2, 2), &wsaData);
-
- // Start Skype connection
- if (!(ControlAPIAttach = RegisterWindowMessage(_T("SkypeControlAPIAttach"))) || !(ControlAPIDiscover = RegisterWindowMessage(_T("SkypeControlAPIDiscover"))))
- {
- OUTPUT(TranslateT("Cannot register window message."));
- return 0;
- }
-
- SkypeMsgReceived = CreateSemaphore(NULL, 0, MAX_MSGS, NULL);
- if (!(SkypeReady = CreateEvent(NULL, TRUE, FALSE, NULL)) ||
- !(MessagePumpReady = CreateEvent(NULL, FALSE, FALSE, NULL)) ||
-#ifdef SKYPEBUG_OFFLN
- !(GotUserstatus = CreateEvent(NULL, TRUE, FALSE, NULL)) ||
-#endif
- !(hBuddyAdded = CreateEvent(NULL, FALSE, FALSE, NULL)) ||
- !(FetchMessageEvent = CreateEvent(NULL, FALSE, TRUE, NULL))) {
- OUTPUT(TranslateT("Unable to create mutex!"));
- return 0;
- }
-
- /* Register the module */
- PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
- pd.szName = SKYPE_PROTONAME;
- pd.type = PROTOTYPE_PROTOCOL;
- CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
-
- CreateServices();
- HookEvents();
- InitVSApi();
- MsgList_Init();
-
- HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
-
- // Startup Message-pump
- pthread_create((pThreadFunc)MsgPump, NULL);
- WaitForSingleObject(MessagePumpReady, INFINITE);
- return 0;
-}
-
-
-
-extern "C" int __declspec(dllexport) Unload(void)
-{
- BOOL UseCustomCommand = db_get_b(NULL, SKYPE_PROTONAME, "UseCustomCommand", 0);
- BOOL Shutdown = db_get_b(NULL, SKYPE_PROTONAME, "Shutdown", 0);
-
- LOG(("Unload started"));
-
- if (Shutdown && (skype_path[0] || UseCustomCommand)) {
-
- if (UseCustomCommand)
- {
- DBVARIANT dbv;
- if (!db_get_s(NULL, SKYPE_PROTONAME, "CommandLine", &dbv))
- {
- char szAbsolutePath[MAX_PATH];
-
- TranslateMirandaRelativePathToAbsolute(dbv.pszVal, szAbsolutePath, FALSE);
- _spawnl(_P_NOWAIT, szAbsolutePath, szAbsolutePath, "/SHUTDOWN", NULL);
- LOG(("Unload Sent /shutdown to %s", szAbsolutePath));
- db_free(&dbv);
- }
- }
- else
- {
- _spawnl(_P_NOWAIT, skype_path, skype_path, "/SHUTDOWN", NULL);
- LOG(("Unload Sent /shutdown to %s", skype_path));
- }
-
- }
- SkypeMsgCleanup();
- //WSACleanup();
- FreeVSApi();
- DestroyHookableEvent(hInitChat);
- GCExit();
- MsgList_Exit();
-
- CloseHandle(SkypeReady);
- CloseHandle(SkypeMsgReceived);
-#ifdef SKYPEBUG_OFFLN
- CloseHandle(GotUserstatus);
-#endif
- CloseHandle(MessagePumpReady);
- CloseHandle(hBuddyAdded);
- CloseHandle(FetchMessageEvent);
-
- DeleteCriticalSection(&RingAndEndcallMutex);
- DeleteCriticalSection(&QueryThreadMutex);
-
- SkypeRegisterProxy(0, 0);
- LOG(("Unload: Shutdown complete"));
-#ifdef _DEBUG
- end_debug();
-#endif
-#ifdef USE_REAL_TS
- DeleteCriticalSection(&AddEventMutex);
-#endif
- DeleteCriticalSection(&TimeMutex);
- return 0;
-}
-
diff --git a/protocols/SkypeClassic/src/skype.h b/protocols/SkypeClassic/src/skype.h deleted file mode 100644 index bc4f9b2b67..0000000000 --- a/protocols/SkypeClassic/src/skype.h +++ /dev/null @@ -1,153 +0,0 @@ -#pragma once
-
-#define _CRT_SECURE_NO_DEPRECATE 1
-#define TEXT_LEN 1024
-#define CP_ACP 0
-
-#define code_page CP_ACP;
-#define MIRANDA_CUSTOM_LP
-
-
-// System includes
-#include <stdio.h>
-#include <windows.h>
-#include <commctrl.h>
-#include <process.h>
-#include <time.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <shlobj.h>
-#include <time.h>
-
-#include "resource.h"
-#include "version.h"
-#include "util.h"
-
-
-// Miranda Includes
-#include <newpluginapi.h>
-#include <m_utils.h>
-#include <m_protosvc.h>
-#include <m_protomod.h>
-#include <m_skin.h>
-#include <m_message.h>
-#include <m_database.h>
-#include <m_clist.h>
-#include <m_system.h>
-#include <m_folders.h>
-#include <m_options.h>
-#include <m_langpack.h>
-#include <m_userinfo.h>
-#include <m_avatars.h>
-#include <m_contacts.h>
-#include <m_metacontacts.h>
-#include <m_popup.h>
-#include <m_toptoolbar.h>
-#include <m_protosvc.h>
-#include <m_string.h>
-#include <m_history.h>
-
-
-
-// Program defines
-#define SKYPE_NAME "Username"
-#define SKYPE_PROTO "PROTOCOL 7"
-#define SKYPE_PROTONAME g_szProtoName // Name of our protocol, taken from .DLL name
-#define MAX_MSGS 128 // Maximum messages in queue
-#define MAX_USERLEN 32 // Maximum length of a username in Skype
-#define PING_INTERVAL 10000 // Ping every 10000 msec to see if Skype is still available
-#define USEPOPUP 1 // Use the popup-plugin?
-#define TIMEOUT_MSGSEND 60000 // Stolen from msgdialog.c
-#define MAX_MSG_AGE 30 // Maximum age in seconds before a Message from queue gets trashed
-#define SKYPEBUG_OFFLN 1 // Activate fix for the SkypeAPI Offline-Bug
-
-// Program hooks
-typedef struct {
- char ChatNew[MAXMODULELABELLENGTH];
- char SetAvatar[MAXMODULELABELLENGTH];
- char SendGuiFile[MAXMODULELABELLENGTH];
- char HoldCall[MAXMODULELABELLENGTH];
- char AnswerCall[MAXMODULELABELLENGTH];
- char ImportHistory[MAXMODULELABELLENGTH];
- char AddUser[MAXMODULELABELLENGTH];
- char SkypeOutCallUser[MAXMODULELABELLENGTH];
- char CallHangupUser[MAXMODULELABELLENGTH];
- char CallUser[MAXMODULELABELLENGTH];
- char BlockContact[MAXMODULELABELLENGTH];
-} SKYPE_SVCNAMES;
-#define SKYPE_CALL g_svcNames.CallUser
-#define SKYPE_CALLHANGUP g_svcNames.CallHangupUser
-#define SKYPEOUT_CALL g_svcNames.SkypeOutCallUser
-#define SKYPE_ADDUSER g_svcNames.AddUser
-#define SKYPE_IMPORTHISTORY g_svcNames.ImportHistory
-#define SKYPE_ANSWERCALL g_svcNames.AnswerCall
-#define SKYPE_HOLDCALL g_svcNames.HoldCall
-#define SKYPE_SENDFILE g_svcNames.SendGuiFile
-#define SKYPE_SETAVATAR g_svcNames.SetAvatar
-#define SKYPE_CHATNEW g_svcNames.ChatNew
-#define SKYPE_BLOCKCONTACT g_svcNames.BlockContact
-#define EVENTTYPE_CALL 2000
-
-#define WM_COPYDATALOCAL WM_USER+100 // WM_COPYDATA for local window communication, needed due to Win98 bug
-
-#ifndef __SKYPESVC_C__
-extern SKYPE_SVCNAMES g_svcNames;
-#endif
-
-// Skype API Communication services
-#define PSS_SKYPEAPIMSG "/SendSkypeAPIMsg"
-#define SKYPE_REGPROXY "/RegisterProxySvc"
-
-#define MUUID_SKYPE_CALL { 0x245241eb, 0x178c, 0x4b3f, { 0x91, 0xa, 0x4c, 0x4d, 0xf0, 0xa0, 0xc3, 0xb6 } }
-
-
-// Common used code-pieces
-#define OUTPUT(a) ShowMessage(IDI_ERRORS, a, 1);
-#define OUTPUTA(a) ShowMessageA(IDI_ERRORS, a, 1);
-
-typedef void ( __cdecl* pThreadFunc )( void* );
-
-// Prototypes
-
-void __cdecl SkypeSystemInit(char *);
-void __cdecl MsgPump (char *dummy);
-void PingPong(void);
-void CheckIfApiIsResponding(char *);
-void TellError(DWORD err);
-int ShowMessage(int, TCHAR*, int);
-int ShowMessageA(int iconID, char *lpzText, int mustShow);
-void EndCallThread(char *);
-void GetInfoThread(void *);
-int OnDetailsInit( WPARAM, LPARAM );
-INT_PTR SkypeGetAvatarInfo(WPARAM wParam,LPARAM lParam);
-INT_PTR SkypeGetAvatarCaps(WPARAM wParam,LPARAM lParam);
-INT_PTR SkypeGetAwayMessage(WPARAM wParam,LPARAM lParam);
-int HookContactAdded(WPARAM wParam, LPARAM lParam);
-int HookContactDeleted(WPARAM wParam, LPARAM lParam);
-INT_PTR ImportHistory(WPARAM wParam, LPARAM lParam);
-int CreateTopToolbarButton(WPARAM wParam, LPARAM lParam);
-int OnModulesLoaded(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeSetStatus(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeGetStatus(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeGetInfo(WPARAM wParam,LPARAM lParam);
-INT_PTR SkypeAddToList(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeBasicSearch(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeSendMessage(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeRecvMessage(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeUserIsTyping(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeSendAuthRequest(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeRecvAuth(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeAuthAllow(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeAuthDeny(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeAddToListByEvent(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeRegisterProxy(WPARAM wParam, LPARAM lParam);
-time_t SkypeTime(time_t *timer);
-void MessageSendWatchThread(void*);
-int OkToExit(WPARAM wParam, LPARAM lParam);
-int MirandaExit(WPARAM wParam, LPARAM lParam);
-int __stdcall EnterBitmapFileName(TCHAR *szDest);
-void CleanupNicknames(char *dummy);
-int InitVSApi();
-int FreeVSApi();
-MCONTACT GetMetaHandle(DWORD dwId);
-void LaunchSkypeAndSetStatusThread(void *newStatus);
diff --git a/protocols/SkypeClassic/src/skypeapi.cpp b/protocols/SkypeClassic/src/skypeapi.cpp deleted file mode 100644 index 73bf8d50b3..0000000000 --- a/protocols/SkypeClassic/src/skypeapi.cpp +++ /dev/null @@ -1,1806 +0,0 @@ -/*
- * SkypeAPI - All more or less important functions that deal with Skype
- */
-
-#include "skype.h"
-#include "skypeapi.h"
-#include "utf8.h"
-#include "debug.h"
-#include "contacts.h"
-#include "skypeproxy/skypeproxy.h"
-#include "pthread.h"
-#include "gchat.h"
-#include "alogon.h"
-#include "msgq.h"
-#include <malloc.h>
-
-#include <m_utils.h>
-#include <m_langpack.h>
-#include <m_toptoolbar.h>
-
-
-// Imported Globals
-extern HWND hSkypeWnd, g_hWnd;
-extern BOOL SkypeInitialized, UseSockets, MirandaShuttingDown, bIsImoproxy;
-extern int SkypeStatus, receivers;
-extern HANDLE SkypeReady, SkypeMsgReceived, httbButton;
-extern UINT ControlAPIAttach, ControlAPIDiscover;
-extern LONG AttachStatus;
-extern HINSTANCE hInst;
-extern PLUGININFOEX pluginInfo;
-extern HANDLE hProtocolAvatarsFolder, hHookSkypeApiRcv;
-extern char DefaultAvatarsFolder[MAX_PATH+1], *pszProxyCallout, protocol, g_szProtoName[];
-
-// -> Skype Message Queue functions //
-
-static TYP_MSGQ SkypeMsgs, SkypeSendQueue;
-
-//status_map
-struct status_map {
- int id;
- char *szStat;
-} status_codes[] = {
- {ID_STATUS_AWAY, "AWAY"},
- {ID_STATUS_NA, "NA"},
- {ID_STATUS_DND, "DND"},
- {ID_STATUS_ONLINE, "ONLINE"},
- {ID_STATUS_FREECHAT, "SKYPEME"}, // Unfortunately Skype API tells us userstatus ONLINE, if we are free for chat
- {ID_STATUS_OFFLINE, "OFFLINE"},
- {ID_STATUS_INVISIBLE, "INVISIBLE"},
- {ID_STATUS_CONNECTING, "CONNECTING"},
- {0, NULL}
-};
-
-static mir_cs ConnectMutex, SendMutex;
-static BOOL rcvThreadRunning=FALSE, isConnecting = FALSE;
-static SOCKET ClientSocket=INVALID_SOCKET;
-static HANDLE SkypeMsgToSend=NULL;
-
-static char *m_szSendBuf = NULL;
-static DWORD m_iBufSize = 0;
-static HANDLE m_FileSlots[255]={INVALID_HANDLE_VALUE};
-
-
-static int _ConnectToSkypeAPI(char *path, BOOL bStart);
-
-
-/* SkypeReceivedMessage
- *
- * Purpose: Hook to be called when a message is received, if some caller is
- * using our internal I/O services.
- * Params : wParam - Not used
- * lParam - COPYDATASTRUCT like in WM_COPYDATA
- * Returns: Result from SendMessage
- */
-INT_PTR SkypeReceivedAPIMessage(WPARAM wParam, LPARAM lParam) {
- return SendMessage(g_hWnd, WM_COPYDATALOCAL, (WPARAM)hSkypeWnd, lParam);
-}
-
-/*
- * Skype via Socket --> Skype2Socket connection
- */
-
-static int Recv(SOCKET s, char *buf, int len) {
- int ret,cnt=0;
-
- do
- {
- if ((ret=recv(s,buf,len,0))==SOCKET_ERROR) {
- LOG(("Recv() Socket error"));
- return 0;
- }
- if (ret==0) break;
- cnt+=ret;
- buf+=ret;
- len-=ret;
- } while (len);
- return len?0:cnt;
-}
-
-void rcvThread(char *dummy) {
- unsigned char cmd=0, nSlot;
- unsigned int length;
- char *buf=NULL;
- int rcv;
-
- if (!UseSockets) return;
- rcvThreadRunning=TRUE;
- for ( ;; ) {
- if (ClientSocket==INVALID_SOCKET) {
- rcvThreadRunning=FALSE;
- return;
- }
- LOG(("rcvThread Receiving from socket.."));
- if (!(rcv=Recv(ClientSocket, (char *)&length, sizeof(length))) || length>0x10000000) {
- rcvThreadRunning=FALSE;
- if (rcv==SOCKET_ERROR) {LOG(("rcvThread Socket error"));}
- else {LOG(("rcvThread lost connection, graceful shutdown"));}
- return;
- }
- mir_cslock lck(SendMutex);
- if (length == 0) {
- unsigned short lenfn;
- char szFileName[MAX_PATH], *pszUTFFile=NULL;
-
- // Command mode
- if ((rcv = Recv(ClientSocket, (char*)&cmd, sizeof(cmd)))) {
- switch (cmd)
- {
- case OPEN_SLOT:
- LOG(("rcvThread OPEN_SLOT"));
- if (!(rcv = Recv(ClientSocket, (char*)&lenfn, sizeof(lenfn))) ||
- !(rcv = Recv(ClientSocket, szFileName, lenfn))) {
- LOG(("OPEN_SLOT failed: rcv=0"));
- break;
- }
-
- utf8_decode(szFileName, &pszUTFFile);
- for (nSlot=0; nSlot<sizeof(m_FileSlots)/sizeof(m_FileSlots[0]); nSlot++)
- if (m_FileSlots[nSlot]==INVALID_HANDLE_VALUE)
- break;
- if (nSlot>=sizeof(m_FileSlots)/sizeof(m_FileSlots[0]))
- cmd=0;
- else {
- if ((m_FileSlots[nSlot] = CreateFileA(pszUTFFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) !=INVALID_HANDLE_VALUE)
- nSlot++;
- else
- nSlot=0;
- }
- free(pszUTFFile);
- LOG(("rcvThread OPEN_SLOT(%s) -> %d", szFileName, nSlot));
- if ((rcv=send(ClientSocket, (char *)&nSlot, sizeof(nSlot), 0)) == SOCKET_ERROR || rcv==0) rcv=0;
- else {
- continue;
- }
- break;
- case DATA_SLOT:
- LOG(("rcvThread DATA_SLOT"));
- if (!(rcv=Recv(ClientSocket, (char*)&nSlot, sizeof(nSlot))) || !nSlot ||
- !(rcv=Recv(ClientSocket, (char *)&length, sizeof(length))) || length>0x10000000) {
- LOG(("DATA_SLOT failed: rcv=%d", rcv));
- rcv=0;
- }
- break;
- case CLOSE_SLOT:
- LOG(("rcvThread CLOSE_SLOT"));
- if (!(rcv = Recv(ClientSocket, (char*)&nSlot, sizeof(nSlot)))) {
- LOG(("CLOSE_SLOT failed: rcv=0"));
- break;
- }
- LOG(("rcvThread CLOSE_SLOT(%d)", nSlot));
- CloseHandle(m_FileSlots[nSlot-1]);
- m_FileSlots[nSlot-1]=INVALID_HANDLE_VALUE;
- continue;
- }
- }
- }
- LOG(("rcvThread Received length, recieving message.."));
- if (rcv==0 || !(buf=(char *)calloc(1, length+1)) ||
- !(rcv = Recv(ClientSocket, buf, length))) {
- rcvThreadRunning=FALSE;
- LOG(("rcvThread lost connection, graceful shutdown"));
- free(buf);
- return;
- }
- if (cmd==DATA_SLOT) {
- DWORD dwWritten;
-
- LOG(("Received data packet with %u bytes", length));
- if ((cmd = (char)WriteFile(m_FileSlots[nSlot-1], buf, length, &dwWritten, NULL)) && dwWritten!=length)
- cmd=0;
- //send(ClientSocket, (char *)&cmd, sizeof(cmd), 0);
- } else {
- LOG(("Received message: %s", buf));
-
- COPYDATASTRUCT CopyData;
- CopyData.dwData=0;
- CopyData.lpData=buf;
- CopyData.cbData=(DWORD)mir_strlen(buf)+1;
- if (!SendMessage(g_hWnd, WM_COPYDATALOCAL, (WPARAM)hSkypeWnd, (LPARAM)&CopyData))
- {
- LOG(("SendMessage failed: %08X", GetLastError()));
- }
- }
- free(buf);
- buf = 0;
- }
-}
-
-void sendThread(char *dummy) {
- LRESULT SendResult;
- int oldstatus;
- unsigned int length;
- char *szMsg;
-
- while (SkypeMsgToSend) {
- if (WaitForSingleObject(SkypeMsgToSend, INFINITE) != WAIT_OBJECT_0) return;
- if (!(szMsg = MsgQ_Get(&SkypeSendQueue))) continue;
- length=(unsigned int)mir_strlen(szMsg);
-
- if (UseSockets) {
- mir_cslock lck(SendMutex);
- if (send(ClientSocket, (char *)&length, sizeof(length), 0) != SOCKET_ERROR &&
- send(ClientSocket, szMsg, length, 0) != SOCKET_ERROR) {
- free (szMsg);
- continue;
- }
- SendResult = 0;
- } else {
- COPYDATASTRUCT CopyData;
- CopyData.dwData=0;
- CopyData.lpData=szMsg;
- CopyData.cbData=length+1;
-
- // Internal comm channel
- if (pszProxyCallout) {
- CallService (pszProxyCallout, 0, (LPARAM)&CopyData);
- free(szMsg);
- continue;
- }
-
- // If this didn't work, proceed with normal Skype API
- if (!hSkypeWnd)
- {
- LOG(("SkypeSend: DAMN! No Skype window handle! :("));
- }
- SendResult=SendMessage(hSkypeWnd, WM_COPYDATA, (WPARAM)g_hWnd, (LPARAM)&CopyData);
- LOG(("SkypeSend: SendMessage returned %d", SendResult));
- free(szMsg);
- }
- if (!SendResult) {
- SkypeInitialized=FALSE;
- AttachStatus=-1;
- ResetEvent(SkypeReady);
- if (g_hWnd) KillTimer (g_hWnd, 1);
- if (SkypeStatus!=ID_STATUS_OFFLINE) {
- // Go offline
- logoff_contacts(FALSE);
- oldstatus=SkypeStatus;
- InterlockedExchange((long *)&SkypeStatus, ID_STATUS_OFFLINE);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, SkypeStatus);
- }
- // Reconnect to Skype
- ResetEvent(SkypeReady);
- pthread_create(LaunchSkypeAndSetStatusThread, (void *)ID_STATUS_ONLINE);
- WaitForSingleObject (SkypeReady, 10000);
- // SendMessageTimeout(HWND_BROADCAST, ControlAPIDiscover, (WPARAM)g_hWnd, 0, SMTO_ABORTIFHUNG, 3000, NULL);
- }
- }
-}
-
-
-/*
- * Skype Messagequeue - Implemented as a linked list
- */
-
-/* SkypeMsgInit
- *
- * Purpose: Initializes the Skype Message queue and API
- * Returns: 0 - Success
- * -1 - Memory allocation failure
- */
-int SkypeMsgInit(void) {
-
- MsgQ_Init(&SkypeMsgs);
- MsgQ_Init(&SkypeSendQueue);
- if (SkypeMsgToSend=CreateSemaphore(NULL, 0, MAX_MSGS, NULL)) {
- if (m_szSendBuf = (char*)malloc(m_iBufSize=512)) {
- if (_beginthread(( pThreadFunc )sendThread, 0, NULL)!=-1)
- return 0;
- free(m_szSendBuf);
- }
- CloseHandle (SkypeMsgToSend);
- }
- return -1;
-}
-
-/* SkypeMsgAdd
- *
- * Purpose: Add Message to linked list
- * Params : msg - Message to add to queue
- * Returns: 0 - Success
- * -1 - Memory allocation failure
- */
-int SkypeMsgAdd(char *msg) {
- return MsgQ_Add(&SkypeMsgs, msg)?0:-1;
-}
-
-/* SkypeMsgCleanup
- *
- * Purpose: Clean up the whole MESSagequeue - free() all
- */
-void SkypeMsgCleanup(void) {
- LOG(("SkypeMsgCleanup Cleaning up message queue.."));
- if (receivers>1)
- {
- LOG (("SkypeMsgCleanup Releasing %d receivers", receivers));
- for (int i=0;i<receivers; i++)
- {
- SkypeMsgAdd ("ERROR Semaphore was blocked");
- }
- ReleaseSemaphore (SkypeMsgReceived, receivers, NULL);
- }
- {
- mir_cslock lck(ConnectMutex);
- MsgQ_Exit(&SkypeMsgs);
- }
- CloseHandle(SkypeMsgToSend);
- SkypeMsgToSend=NULL;
- MsgQ_Exit(&SkypeSendQueue);
- if (m_szSendBuf)
- {
- free (m_szSendBuf);
- m_szSendBuf = NULL;
- m_iBufSize = 0;
- }
- LOG(("SkypeMsgCleanup Done."));
-}
-
-/* SkypeMsgGet
- *
- * Purpose: Fetch next message from message queue
- * Returns: The next message
- * Warning: Don't forget to free() return value!
- */
-char *SkypeMsgGet(void) {
- return MsgQ_Get(&SkypeMsgs);
-}
-
-// Message sending routine, for internal use by SkypeSend
-static int __sendMsg(char *szMsg) {
- COPYDATASTRUCT CopyData;
-
- LOG(("> %s", szMsg));
-
- // Fake PING-PONG, as PING-PONG is not supported by Skype2Socket
- if ((UseSockets || bIsImoproxy) && !mir_strcmp(szMsg, "PING")) {
- CopyData.dwData=0;
- CopyData.lpData="PONG";
- CopyData.cbData=5;
- SendMessage(g_hWnd, WM_COPYDATALOCAL, (WPARAM)hSkypeWnd, (LPARAM)&CopyData);
- return 0;
- }
-
- if (UseSockets && (ClientSocket==INVALID_SOCKET)) return -1;
- if (!MsgQ_Add(&SkypeSendQueue, szMsg) || !ReleaseSemaphore(SkypeMsgToSend, 1, NULL))
- return -1;
- return 0;
-}
-
-/* SkypeSend
- *
- * Purpose: Sends the specified message to the Skype API.
- * If it fails, try to reconnect zu the Skype API
- * Params: use like sprintf without first param (dest. buffer)
- * Returns: 0 - Success
- * -1 - Failure
- */
-int SkypeSend(char *szFmt, ...) {
- char *pNewBuf;
- va_list ap;
- size_t iLen;
-
- // 0.0.0.17+ - Build message-String from supplied parameter list
- // so the user doesn't have to care about memory allocation any more.
- // 0.0.0.47+ - No more restrictions apply to the format string.
- // The temporary buffer remains allocated during the session and gets
- // dynamically expanded when needed. This makes sense, as this function
- // is used very often and therefore it is faster to not allocate
- // memory on every send.
- if (!m_szSendBuf && !(m_szSendBuf=(char*)malloc(m_iBufSize=512))) return -1;
- do
- {
- va_start(ap, szFmt);
- iLen = _vsnprintf(m_szSendBuf, m_iBufSize, szFmt, ap);
- va_end(ap);
- if (iLen == -1)
- {
- if (!(pNewBuf = (char*)realloc (m_szSendBuf, m_iBufSize*2)))
- {
- iLen = mir_strlen (m_szSendBuf);
- break;
- }
- m_szSendBuf = pNewBuf;
- m_iBufSize*=2;
- }
- } while (iLen == -1);
-
- return __sendMsg(m_szSendBuf);
-}
-
-/* SkypeRcvTime
- *
- * Purpose: Wait, until either the message "what" is received or maxwait-Time has passed
- * or there was an error and return it
- * Params : what - Wait for this string-part at the beginning of a received string
- * If the first character of the string is NULL, the rest after the NULL
- * character will be searched in the entire received message-string.
- * You can tokenize the string by using NULL characters.
- * You HAVE TO end the string with a extra \0, otherwise the tokenizer
- * will run amok in memory!
- * st - The message timestamp must be newer or equal to st.
- * Set to 0, if you do not need this and want the first message of this
- * kind in the queue.
- * maxwait - Wait this time before returning, if nothing was received,
- * can be INFINITE
- * Returns: The received message containing "what" or a ERROR-Message or NULL if
- * time is up and nothing was received
- * Warning: Don't forget to free() return value!
- */
-char *SkypeRcvTime(char *what, time_t st, DWORD maxwait) {
- char *msg, *token=NULL;
- struct MsgQueue *ptr;
- int j;
- DWORD dwWaitStat;
- BOOL bChatMsg = FALSE, bIsChatMsg = FALSE;
-
- LOG (("SkypeRcv - Requesting answer: %s", what));
- if (what) bChatMsg = strncmp(what, "CHATMESSAGE", 11)==0;
- do {
- EnterCriticalSection(&SkypeMsgs.cs);
- // First, search for the requested message. On second run, also accept an ERROR
- for (j=0; j<2; j++)
- {
- for (ptr=SkypeMsgs.l.tqh_first; ptr; ptr=ptr->l.tqe_next) {
- if (what && what[0]==0) {
- // Tokenizer syntax active
- token=what+1;
- while (*token) {
- if (!strstr (ptr->message, token)) {
- token=NULL;
- break;
- }
- token+=mir_strlen(token)+1;
- }
- }
-
- //if (j==1) {LOG(("SkypeRcv compare %s (%lu) -- %s (%lu)", ptr->message, ptr->tReceived, what, st));}
- if ((st == 0 || ptr->tReceived >= st) &&
- (what==NULL || token || (what[0] && !strncmp(ptr->message, what, mir_strlen(what))) ||
- (bIsChatMsg = (j==1 && bChatMsg && !strncmp(ptr->message, what+4, mir_strlen(what+4)))) ||
- (j==1 && !strncmp(ptr->message, "ERROR", 5))))
- {
- msg=MsgQ_RemoveMsg(&SkypeMsgs, ptr);
- LOG(("<SkypeRcv: %s", msg));
- if (bIsChatMsg) {
- char *pmsg = (char*)realloc(msg, mir_strlen(msg)+5);
- if (pmsg) {
- msg = pmsg;
- memmove (msg+4, msg, mir_strlen(msg)+1);
- memcpy (msg, "CHAT", 4);
- }
-
- // This may be a sign that protocol negotiation failed, so we can try to send
- // our supported protocol version again, just in case... (Skype API bug?)
- //SkypeSend(SKYPE_PROTO);
- }
- LeaveCriticalSection(&SkypeMsgs.cs);
- return msg;
- }
- }
- }
- LeaveCriticalSection(&SkypeMsgs.cs);
- InterlockedIncrement ((long *)&receivers); //receivers++;
- dwWaitStat = WaitForSingleObject(SkypeMsgReceived, maxwait);
- if (receivers>1) InterlockedDecrement ((long *)&receivers); // receivers--;
- if (receivers>1) {LOG (("SkypeRcv: %d receivers still waiting", receivers));}
-
- } while(dwWaitStat == WAIT_OBJECT_0 && !MirandaShuttingDown);
- InterlockedDecrement ((long *)&receivers);
- LOG(("<SkypeRcv: (empty)"));
- return NULL;
-}
-
-char *SkypeRcv(char *what, DWORD maxwait)
-{
- return SkypeRcvTime(what, 0, maxwait);
-}
-
-char *SkypeRcvMsg(char *what, time_t st, MCONTACT hContact, DWORD maxwait)
-{
- char *msg, msgid[32]={0}, *pMsg, *pCurMsg;
- struct MsgQueue *ptr;
- int iLenWhat = (int)mir_strlen(what);
- DWORD dwWaitStat;
- BOOL bIsError, bProcess;
-
- LOG (("SkypeRcvMsg - Requesting answer: %s ", what));
- do {
- EnterCriticalSection(&SkypeMsgs.cs);
- ptr=SkypeMsgs.l.tqh_first;
- while(ptr) {
- //LOG (("SkypeRcvMsg - msg: %s -- %s", ptr->message, what));
- pCurMsg = ptr->message;
- bIsError = FALSE;
- if (*what && !strncmp(pCurMsg, what, iLenWhat)) {
- // Now we received a MESSAGE with an identifier. So this one is definitely for us
- // However the status can be SENDING instead of SENT and next message with this number
- // isn't using the ID anymore, so we have to save the ID as new identifier for message recognition
- pCurMsg+=iLenWhat;
- if ((pMsg = strchr (pCurMsg, ' ')) && (pMsg=strchr (pMsg+1, ' ')))
- strncpy (msgid, pCurMsg, pMsg-pCurMsg);
- else if (strncmp (pCurMsg, "ERROR", 5) == 0) bIsError = TRUE;
- }
-
- if ((*msgid && strncmp (pCurMsg, msgid, mir_strlen(msgid)) == 0) ||
- (!*what && ptr->tReceived >= st &&
- (strncmp(pCurMsg, "MESSAGE", 7) == 0 || strncmp(pCurMsg, "CHATMESSAGE", 11) == 0 )
- ) || bIsError ||
- (ptr->tReceived >= st && ptr->tReceived <=st+1 &&
- (bIsError=(strncmp(pCurMsg, "ERROR 26", 8)==0 || strncmp(pCurMsg, "ERROR 43", 8)==0))
- ) )
- {
- bProcess = bIsError;
- if (!bIsError) {
- if ((pMsg = strchr (pCurMsg, ' ')) && (pMsg=strchr (pMsg+1, ' '))) {
- pMsg++;
- if (strncmp (pMsg, "STATUS ", 7) == 0) {
- pMsg+=7;
- if (mir_strcmp (pMsg, "SENDING") == 0) {
- // Remove dat shit
- struct MsgQueue *ptr_=ptr->l.tqe_next;
-
- free(MsgQ_RemoveMsg(&SkypeMsgs, ptr));
- ptr=ptr_;
- continue;
- }
- bProcess = (mir_strcmp (pMsg, "SENT") == 0 || mir_strcmp (pMsg, "QUEUED") == 0 ||
- mir_strcmp (pMsg, "FAILED") == 0 || mir_strcmp (pMsg, "IGNORED") == 0 ||
- mir_strcmp (pMsg, "SENDING") == 0);
- }
- }
- }
- if (bProcess) {
- msg=MsgQ_RemoveMsg(&SkypeMsgs, ptr);
- LOG(("<SkypeRcv: %s", msg));
- LeaveCriticalSection(&SkypeMsgs.cs);
- return msg;
- }
- }
- ptr=ptr->l.tqe_next;
- }
- LeaveCriticalSection(&SkypeMsgs.cs);
- InterlockedIncrement ((long *)&receivers); //receivers++;
- dwWaitStat = WaitForSingleObject(SkypeMsgReceived, maxwait);
- if (receivers>1) InterlockedDecrement ((long *)&receivers); // receivers--;
- if (receivers>1) {LOG (("SkypeRcvMsg: %d receivers still waiting", receivers));}
-
- } while(dwWaitStat == WAIT_OBJECT_0 && !MirandaShuttingDown);
- InterlockedDecrement ((long *)&receivers);
- LOG(("<SkypeRcvMsg: (empty)"));
- return NULL;
-}
-
-/*
- Introduced in 0.0.0.17
-
- Issues a GET szWhat szWho szProperty and waits until the answer is received
- Returns the answer or NULL on failure
- BEWARE: Don't forget to free() return value!
-
- For example: SkypeGet("USER", dbv.pszVal, "FULLNAME");
-*/
-static char *__SkypeGet(char *szID, char *szWhat, char *szWho, char *szProperty) {
- char *str, *ptr;
- size_t len, len_id;
- time_t st = 0;
-
- st = *szID?0:SkypeTime(NULL);
- str=(char *)_alloca((len=mir_strlen(szWhat)+mir_strlen(szWho)+mir_strlen(szProperty)+(*szWho?2:1)+(len_id=mir_strlen(szID)))+5);
- sprintf(str, "%sGET %s%s%s %s", szID, szWhat, *szWho?" ":"", szWho, szProperty);
- if (__sendMsg(str)) return NULL;
- if (*szProperty) len++;
- if (*szID) {
- sprintf(str, "%s%s%s%s %s", szID, szWhat, *szWho?" ":"", szWho, szProperty);
- ptr = SkypeRcvTime(str, st, INFINITE);
- } else ptr = SkypeRcvTime(str+4, st, INFINITE);
- if (ptr && strncmp (ptr+len_id, "ERROR", 5)) memmove(ptr, ptr+len, mir_strlen(ptr)-len+1);
- LOG(("SkypeGet - Request %s -> Answer %s", str, ptr));
- return ptr;
-}
-
-char *SkypeGetID(char *szWhat, char *szWho, char *szProperty) {
- char szID[16]={0};
- static DWORD dwId = 0;
-
- if (protocol>=4 || bIsImoproxy) sprintf (szID, "#G%d ", dwId++);
- return __SkypeGet (szID, szWhat, szWho, szProperty);
-}
-
-char *SkypeGet(char *szWhat, char *szWho, char *szProperty) {
- return __SkypeGet ("", szWhat, szWho, szProperty);
-}
-
-#ifdef _UNICODE
-WCHAR *SkypeGetW(char *szWhat, WCHAR *szWho, char *szProperty) {
- char *ptszWho = (char*)make_utf8_string(szWho);
- char *pRet = SkypeGet (szWhat, ptszWho, szProperty);
- free (ptszWho);
- if (pRet) {
- WCHAR *ptr = make_unicode_string((const unsigned char*)pRet);
- free (pRet);
- return ptr;
- }
- return NULL;
-}
-#endif
-
-char *SkypeGetErr(char *szWhat, char *szWho, char *szProperty) {
- char *ret = SkypeGet(szWhat, szWho, szProperty);
- if (ret && !strncmp(ret, "ERROR", 5)) {
- free (ret);
- return NULL;
- }
- return ret;
-}
-
-#ifdef _UNICODE
-WCHAR *SkypeGetErrW(char *szWhat, TCHAR *szWho, char *szProperty) {
- WCHAR *ret = SkypeGetW(szWhat, szWho, szProperty);
- if (ret && !_tcsncmp(ret, _T("ERROR"), 5)) {
- free (ret);
- return NULL;
- }
- return ret;
-}
-#endif
-
-char *SkypeGetErrID(char *szWhat, char *szWho, char *szProperty) {
- char *ret = SkypeGetID(szWhat, szWho, szProperty);
- if (ret && !strncmp(ret, "ERROR", 5)) {
- free (ret);
- return NULL;
- }
- return ret;
-}
-
-/* SkypeGetProfile
- *
- * Issues a SET PROFILE szProperty szValue and waits until the answer is received
- * Returns the answer or NULL on failure
- * BEWARE: Don't forget to free() return value!
- *
- * For example: SkypeGetProfile("FULLNAME", "Tweety");
-*/
-char *SkypeGetProfile(char *szProperty) {
- return SkypeGet ("PROFILE", "", szProperty);
-}
-
-/* SkypeSetProfile
- *
- *
-*/
-int SkypeSetProfile(char *szProperty, char *szValue) {
- return SkypeSend("SET PROFILE %s %s", szProperty, szValue);
-}
-
-/* SkypeMsgCollectGarbage
- *
- * Purpose: Runs the garbage collector on the Skype Message-Queue to throw out old
- * messages which may unnecessarily eat up memory.
- * Params : age - Time in seconds. Messages older than this value will be
- * thrown out.
- * Returns: 0 - No messages were thrown out
- * >0 - n messages were thrown out
- */
-int SkypeMsgCollectGarbage(time_t age) {
- return MsgQ_CollectGarbage(&SkypeMsgs, age);
-}
-
-
-/* SkypeCall
- *
- * Purpose: Give a Skype call to the given User in wParam
- * or hangs up existing call
- * (hangUp is moved over to SkypeCallHangup)
- * Params : wParam - Handle to the User to be called
- * lParam - Can be NULL
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeCall(WPARAM wParam, LPARAM lParam) {
- MCONTACT hContact = (MCONTACT) wParam;
- DBVARIANT dbv;
- char *msg=0;
- int res;
-
- if (!db_get_s(hContact, SKYPE_PROTONAME, "CallId", &dbv)) {
- res = -1; // no direct return, because dbv needs to be freed
- } else {
- if (db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return -1;
- msg=(char *)malloc(mir_strlen(dbv.pszVal)+6);
- mir_strcpy(msg, "CALL ");
- mir_strcat(msg, dbv.pszVal);
- res=SkypeSend(msg);
- }
- db_free(&dbv);
- free(msg);
- return res;
-}
-
-/* SkypeCallHangup
- *
- * Prupose: Hangs up the existing call to the given User
- * in wParam.
- *
- * Params : wParam - Handle to the User to be called
- * lParam - Can be NULL
- *
- * Returns: 0 - Success
- * -1 - Failure
- *
- */
-INT_PTR SkypeCallHangup(WPARAM wParam, LPARAM lParam)
-{
- MCONTACT hContact = (MCONTACT) wParam;
- DBVARIANT dbv;
- char *msg=0;
-
- if (!db_get_s(hContact, SKYPE_PROTONAME, "CallId", &dbv)) {
- msg=(char *)malloc(mir_strlen(dbv.pszVal)+21);
- sprintf(msg, "SET %s STATUS FINISHED", dbv.pszVal);
- //sprintf(msg, "ALTER CALL %s HANGUP", dbv.pszVal);
- int res=SkypeSend(msg);
-#if _DEBUG
- db_unset(hContact, SKYPE_PROTONAME, "CallId");
-#endif
- //} else {
- // if (db_get(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return -1;
- // msg=(char *)malloc(mir_strlen(dbv.pszVal)+6);
- // mir_strcpy(msg, "CALL ");
- // mir_strcat(msg, dbv.pszVal);
- // res=SkypeSend(msg);
- return res;
- }
- db_free(&dbv);
- free(msg);
- return -1;
-}
-
-/* FixNumber
- *
- * Purpose: Eliminates all non-numeric chars from the given phonenumber
- * Params : p - Pointer to the buffer with the number
- */
-static void FixNumber(char *p) {
- for (unsigned int i=0;i<=mir_strlen(p);i++)
- if ((p[i]<'0' || p[i]>'9'))
- if (p[i]) {
- memmove(p+i, p+i+1, mir_strlen(p+i));
- i--;
- } else break;
-}
-
-
-/* DialDlgProc
- *
- * Purpose: Dialog procedure for the Dial-Dialog
- */
-static INT_PTR CALLBACK DialDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
- static MCONTACT hContact;
- static unsigned int entries=0;
- BOOL TempAdded=FALSE;
- char number[64], *msg, *ptr=NULL;
-
- switch (uMsg){
- case WM_INITDIALOG:
- hContact=(MCONTACT)lParam;
- Utils_RestoreWindowPosition(hwndDlg, NULL, SKYPE_PROTONAME, "DIALdlg");
- TranslateDialogDefault(hwndDlg);
-
- if (lParam) {
- DBVARIANT dbv;
- BOOL bDialNow=TRUE;
-
- if (!db_get(hContact,"UserInfo","MyPhone1",&dbv)) {
- int j;
- char idstr[16];
-
- // Multiple phone numbers, select one
- bDialNow=FALSE;
- db_free(&dbv);
- for(j=0;;j++) {
- sprintf(idstr,"MyPhone%d",j);
- if(db_get_s(hContact,"UserInfo",idstr,&dbv)) break;
- FixNumber(dbv.pszVal+1); // Leave + alone
- SendDlgItemMessage(hwndDlg,IDC_NUMBER,CB_ADDSTRING,0,(LPARAM)dbv.pszVal);
- db_free(&dbv);
- }
- }
- if (db_get_s(hContact,SKYPE_PROTONAME,"SkypeOutNr",&dbv)) {
- db_get_s(hContact,"UserInfo","MyPhone0",&dbv);
- FixNumber(dbv.pszVal+1);
- }
- SetDlgItemTextA(hwndDlg, IDC_NUMBER, dbv.pszVal);
- db_free(&dbv);
- if (bDialNow) PostMessage(hwndDlg, WM_COMMAND, IDDIAL, 0);
- } else {
- DBVARIANT dbv;
- char number[64];
-
- for (entries=0;entries<MAX_ENTRIES;entries++) {
- sprintf(number, "LastNumber%d", entries);
- if (!db_get_ts(NULL, SKYPE_PROTONAME, number, &dbv)) {
- SendDlgItemMessage(hwndDlg,IDC_NUMBER,CB_ADDSTRING,0,(LPARAM)dbv.ptszVal);
- db_free(&dbv);
- } else break ;
- }
- }
- SetFocus(GetDlgItem(hwndDlg, IDC_NUMBER));
- return TRUE;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDDIAL:
- EnableWindow(GetDlgItem(hwndDlg, IDDIAL), FALSE);
- GetDlgItemTextA(hwndDlg, IDC_NUMBER, number, SIZEOF(number));
- if (!strncmp(number, "00", 2)) {
- memmove(number, number+1, sizeof(number)-1);
- number[0]='+';
- number[sizeof(number)-1] = 0;
- }
- if (!hContact) {
- if (!(hContact=add_contact(number, PALF_TEMPORARY))) {
- DestroyWindow(hwndDlg);
- break;
- }
- db_unset(hContact, "CList", "Hidden");
- db_set_w(hContact, SKYPE_PROTONAME, "Status", (WORD)SkypeStatusToMiranda("SKYPEOUT"));
- if (SendDlgItemMessage(hwndDlg,IDC_NUMBER,CB_FINDSTRING,0,(LPARAM)number)==CB_ERR) {
- char buf[64];
- DBVARIANT dbv;
-
- if (entries>MAX_ENTRIES) entries=MAX_ENTRIES;
- for (int i=entries;i>0;i--) {
- sprintf(buf, "LastNumber%d", i-1);
- if (!db_get_s(NULL, SKYPE_PROTONAME, buf, &dbv)) {
- sprintf(buf, "LastNumber%d", i);
- db_set_s(NULL, SKYPE_PROTONAME, buf, dbv.pszVal);
- db_free(&dbv);
- } else break;
- }
- db_set_s(NULL, SKYPE_PROTONAME, "LastNumber0", number);
- }
- TempAdded=TRUE;
- }
- if (!db_set_s(hContact, SKYPE_PROTONAME, "SkypeOutNr", number)) {
- msg=(char *)malloc(mir_strlen(number)+6);
- mir_strcpy(msg, "CALL ");
- mir_strcat(msg, number);
- if (SkypeSend(msg) || (ptr=SkypeRcv("ERROR", 500))) {
- db_unset(hContact, SKYPE_PROTONAME, "SkypeOutNr");
- if (ptr) {
- OUTPUTA(ptr);
- free(ptr);
- }
- if (TempAdded) CallService(MS_DB_CONTACT_DELETE, hContact, 0);
- }
- free(msg);
- }
- case IDCANCEL:
- DestroyWindow(hwndDlg);
- break;
- }
- break;
- case WM_DESTROY:
- Utils_SaveWindowPosition(hwndDlg, NULL, SKYPE_PROTONAME, "DIALdlg");
- if (httbButton) CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)httbButton, 0);
- break;
- }
- return FALSE;
-}
-
-/* CallstatDlgProc
- *
- * Purpose: Dialog procedure for the CallStatus Dialog
- */
-static INT_PTR CALLBACK CallstatDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
- static int selected;
- static DBVARIANT dbv, dbv2={0};
-
- switch (uMsg){
- case WM_INITDIALOG:
- {
- MCONTACT hContact;
-
- if (!db_get_s((MCONTACT)lParam, SKYPE_PROTONAME, "CallId", &dbv)) {
-
- // Check, if another call is in progress
- for (hContact=db_find_first();hContact != NULL;hContact=db_find_next(hContact)) {
- char *szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, hContact, 0 );
- if (szProto != NULL && !mir_strcmp(szProto, SKYPE_PROTONAME) && hContact != (MCONTACT)lParam &&
- db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0 &&
- !db_get_s(hContact, SKYPE_PROTONAME, "CallId", &dbv2))
- {
- if (db_get_b(hContact, SKYPE_PROTONAME, "OnHold", 0)) {
- db_free(&dbv2);
- continue;
- } else break;
- }
- }
-
- if (dbv2.pszVal)
- {
- char buf[256], buf2[256];
- char *szOtherCaller=(char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,hContact,0);
-
- Utils_RestoreWindowPosition(hwndDlg, NULL, SKYPE_PROTONAME, "CALLSTATdlg");
- TranslateDialogDefault(hwndDlg);
- SendMessage(hwndDlg, WM_COMMAND, IDC_JOIN, 0);
-
- GetWindowTextA(hwndDlg, buf, SIZEOF(buf));
- _snprintf(buf2, sizeof(buf), buf, CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)lParam,0));
- SetWindowTextA(hwndDlg, buf2);
-
- GetDlgItemTextA(hwndDlg, IDC_JOIN, buf, SIZEOF(buf));
- _snprintf(buf2, sizeof(buf), buf, szOtherCaller);
- SetDlgItemTextA(hwndDlg, IDC_JOIN, buf2);
-
- GetDlgItemTextA(hwndDlg, IDC_HOLD, buf, SIZEOF(buf));
- _snprintf(buf2, sizeof(buf), buf, szOtherCaller);
- SetDlgItemTextA(hwndDlg, IDC_HOLD, buf2);
-
- return TRUE;
- }
-
- // No other call in progress, no need for this Dlg., just answer the call
- SkypeSend("SET %s STATUS INPROGRESS", dbv.pszVal);
- testfor ("ERROR", 200);
- db_free(&dbv);
- }
- DestroyWindow(hwndDlg);
- break;
- }
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_JOIN:
- case IDC_HOLD:
- case IDC_HANGUP:
- CheckRadioButton(hwndDlg, IDC_JOIN, IDC_HANGUP, (selected=LOWORD(wParam)));
- break;
- case IDOK:
- {
- char *szIdCall2;
-
- switch (selected) {
- case IDC_JOIN:
- if (szIdCall2=strchr(dbv2.pszVal, ' '))
- SkypeSend("SET %s JOIN_CONFERENCE%s", dbv.pszVal, szIdCall2);
- break;
- case IDC_HOLD:
- SkypeSend("SET %s STATUS ONHOLD", dbv2.pszVal);
- SkypeSend("SET %s STATUS INPROGRESS", dbv.pszVal);
- break;
- case IDC_HANGUP:
- SkypeSend("SET %s STATUS FINISHED", dbv.pszVal);
- break;
- }
-
- db_free(&dbv);
- db_free(&dbv2);
- DestroyWindow(hwndDlg);
- break;
- }
- }
- break;
- case WM_DESTROY:
- Utils_SaveWindowPosition(hwndDlg, NULL, SKYPE_PROTONAME, "CALLSTATdlg");
- break;
- }
- return FALSE;
-}
-
-
-/* SkypeOutCallErrorCheck
- *
- * Purpose: Checks, if an error has occured after call and
- * if so, hangs up the call
- * This procedure is a seperate thread to not block the core
- * while waiting for "ERROR"
- * Params : szCallId - ID of the call
- */
-void SkypeOutCallErrorCheck(char *szCallId) {
- if (testfor("ERROR", 500)) EndCallThread(szCallId);
-}
-
-/* SkypeOutCall
- *
- * Purpose: Give a SkypeOut call to the given User in wParam
- * or hangs up existing call
- * The user's record is searched for Phone-number entries.
- * If there is more than 1 entry, the Dial-Dialog is shown
- * Params : wParam - Handle to the User to be called
- * If NULL, the dial-dialog is shown
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeOutCall(WPARAM wParam, LPARAM lParam) {
- MCONTACT hContact = (MCONTACT) wParam;
- DBVARIANT dbv;
- int res = -1;
-
- if (wParam && !db_get_s(hContact, SKYPE_PROTONAME, "CallId", &dbv)) {
- res=SkypeSend("SET %s STATUS FINISHED", dbv.pszVal);
- pthread_create(( pThreadFunc )SkypeOutCallErrorCheck, _strdup(dbv.pszVal));
- db_free(&dbv);
- } else if (!CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DIAL), NULL, DialDlgProc, (LPARAM)hContact)) return -1;
- return res;
-}
-
-/* SkypeHoldCall
- *
- * Purpose: Put the call to the User given in wParam on Hold or Resumes it
- * Params : wParam - Handle to the User
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeHoldCall(WPARAM wParam, LPARAM lParam) {
- MCONTACT hContact = (MCONTACT) wParam;
- DBVARIANT dbv;
-
- LOG(("SkypeHoldCall started"));
- if (!wParam || db_get_s(hContact, SKYPE_PROTONAME, "CallId", &dbv))
- return -1;
- int retval = SkypeSend ("SET %s STATUS %s", dbv.pszVal,
- db_get_b(hContact, SKYPE_PROTONAME, "OnHold", 0)?"INPROGRESS":"ONHOLD");
- db_free(&dbv);
- return retval;
-}
-
-/* SkypeAnswerCall
- *
- * Purpose: Answer a Skype-call when a user double-clicks on
- * The incoming-call-Symbol. Works for both, Skype and SkypeOut-calls
- * Params : wParam - Not used
- * lParam - CLISTEVENT*
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeAnswerCall(WPARAM wParam, LPARAM lParam) {
-
- LOG(("SkypeAnswerCall started"));
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CALLSTAT), NULL, CallstatDlgProc, (LPARAM)((CLISTEVENT*)lParam)->hContact);
- return 0;
-}
-/* SkypeSetNick
- *
- * Purpose: Set Full Name in profile
- * Params : wParam=0
- * lParam=(LPARAM)(const char*)Nick text
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeSetNick(WPARAM wParam, LPARAM lParam) {
- int retval = -1;
- char *Nick = NULL;
-
- if (wParam & SMNN_UNICODE)
- {
- db_set_ws(0, SKYPE_PROTONAME, "Nick", (WCHAR*)lParam);
- if (AttachStatus == SKYPECONTROLAPI_ATTACH_SUCCESS &&
- !(Nick = (char*)make_utf8_string((WCHAR*)lParam))) return -1;
- }
- else
- {
- db_set_s(0, SKYPE_PROTONAME, "Nick", (char*)lParam);
- if(AttachStatus == SKYPECONTROLAPI_ATTACH_SUCCESS &&
- utf8_encode((const char *)lParam, &Nick) == -1 ) return -1;
- }
- if(AttachStatus == SKYPECONTROLAPI_ATTACH_SUCCESS)
- retval = SkypeSend("SET PROFILE FULLNAME %s", Nick);
- if (Nick) free (Nick);
-
- return retval;
-
-}
-/* SkypeSetAwayMessage
- *
- * Purpose: Set Mood message in profile
- * Params : wParam=status mode
- * lParam=(LPARAM)(const char*)message text
- * Returns: 0 - Success
- * -1 - Failure
- */
-
-INT_PTR SkypeSetAwayMessage(WPARAM wParam, LPARAM lParam) {
- int retval = -1;
- char *Mood = NULL;
-
- if (!lParam) lParam=(LPARAM)"";
- if (!(Mood = (char*)make_utf8_string((WCHAR*)lParam))) return -1;
- db_set_ws(NULL, SKYPE_PROTONAME, "MoodText", (WCHAR*)lParam);
-
- if(AttachStatus == SKYPECONTROLAPI_ATTACH_SUCCESS)
- retval = SkypeSend("SET PROFILE MOOD_TEXT %s", Mood);
- free (Mood);
-
- return retval;
-}
-
-/* SkypeSetAvatar
- *
- * Purpose: Set user avatar in profile
- * Params : wParam=0
- * lParam=(LPARAM)(const char*)filename
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeSetAvatar(WPARAM wParam, LPARAM lParam) {
- char *filename = (char *) lParam, *ext;
- char AvatarFile[MAX_PATH+1], OldAvatarFile[1024];
- char *ptr = NULL;
- int ret;
- char command[500];
- DBVARIANT dbv = {0};
- BOOL hasOldAvatar = (db_get_s(NULL, SKYPE_PROTONAME, "AvatarFile", &dbv) == 0 && dbv.type == DBVT_ASCIIZ);
- size_t len;
-
- if (AttachStatus != SKYPECONTROLAPI_ATTACH_SUCCESS)
- return -3;
-
- if (filename == NULL)
- return -1;
- len = mir_strlen(filename);
- if (len < 4)
- return -1;
-
- ext = &filename[len-4];
- if (_stricmp(ext, ".jpg")==0 || _stricmp(ext-1, ".jpeg")==0)
- ext = "jpg";
- else if (_stricmp(ext, ".png")==0)
- ext = "png";
- else
- return -2;
-
- FoldersGetCustomPath(hProtocolAvatarsFolder, AvatarFile, sizeof(AvatarFile), DefaultAvatarsFolder);
- if (!*AvatarFile) mir_strcpy (AvatarFile, DefaultAvatarsFolder);
- mir_snprintf(AvatarFile, SIZEOF(AvatarFile), "%s\\%s avatar.%s", AvatarFile, SKYPE_PROTONAME, ext);
-
- // Backup old file
- if (hasOldAvatar)
- {
- strncpy(OldAvatarFile, dbv.pszVal, sizeof(OldAvatarFile)-4);
- OldAvatarFile[sizeof(OldAvatarFile)-5] = '\0';
- mir_strcat(OldAvatarFile, "_old");
- DeleteFileA(OldAvatarFile);
- if (!MoveFileA(dbv.pszVal, OldAvatarFile))
- {
- db_free(&dbv);
- return -3;
- }
- }
-
- // Copy new file
- if (!CopyFileA(filename, AvatarFile, FALSE))
- {
- if (hasOldAvatar)
- {
- MoveFileA(OldAvatarFile, dbv.pszVal);
- db_free(&dbv);
- }
- return -3;
- }
-
- // Try to set with skype
- mir_snprintf(command, SIZEOF(command), "SET AVATAR 1 %s", AvatarFile);
- if (SkypeSend(command) || (ptr = SkypeRcv(command+4, INFINITE)) == NULL || !strncmp(ptr, "ERROR", 5))
- {
- DeleteFileA(AvatarFile);
-
- if (hasOldAvatar)
- MoveFileA(OldAvatarFile, dbv.pszVal);
-
- ret = -4;
- }
- else
- {
- if (hasOldAvatar)
- DeleteFileA(OldAvatarFile);
-
- db_set_s(NULL, SKYPE_PROTONAME, "AvatarFile", AvatarFile);
-
- ret = 0;
- }
-
- if (ptr != NULL)
- free(ptr);
-
- if (hasOldAvatar)
- db_free(&dbv);
-
- return ret;
-}
-
-
-/* SkypeSendGuiFile
- *
- * Purpose: Opens the Skype-dialog to send a file
- * Params : wParam - Handle to the User
- * lParam - Not used
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeSendGuiFile(WPARAM wParam, LPARAM) {
- MCONTACT hContact = (MCONTACT) wParam;
- DBVARIANT dbv;
-
- if (!wParam || db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- return -1;
- int retval=SkypeSend("OPEN FILETRANSFER %s", dbv.pszVal);
- db_free(&dbv);
- return retval;
-}
-
-/* SkypeChatCreate
- *
- * Purpose: Creates a groupchat with the user
- * Params : wParam - Handle to the User
- * lParam - Not used
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeChatCreate(WPARAM wParam, LPARAM lParam) {
- DBVARIANT dbv;
- MCONTACT hContact=(MCONTACT)wParam;
- char *ptr, *ptr2;
-
- if (!hContact || db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- return -1;
- // Flush old messages
- while (testfor("\0CHAT \0 STATUS \0", 0));
- if (SkypeSend("CHAT CREATE %s", dbv.pszVal) || !(ptr=SkypeRcv ("\0CHAT \0 STATUS \0", INFINITE)))
- {
- db_free(&dbv);
- return -1;
- }
- db_free(&dbv);
- if (ptr2=strstr (ptr, "STATUS")) {
- *(ptr2-1)=0;
- ChatStart (ptr+5, FALSE);
- }
- free(ptr);
- return 0;
-}
-
-/* SkypeBlockContact
-*
-* Purpose: Blocks/unblocks contact
-*/
-INT_PTR SkypeBlockContact(WPARAM wParam, LPARAM lParam) {
- DBVARIANT dbv;
- MCONTACT hContact = (MCONTACT)wParam;
-
- if (!hContact || db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv))
- return -1;
-
- int iRet = 0;
- if (SkypeSend("SET USER %s ISBLOCKED %s", dbv.pszVal, db_get_b(hContact, SKYPE_PROTONAME, "IsBlocked", 0) ? "FALSE" : "TRUE"))
- iRet = -1;
- db_free(&dbv);
- return iRet;
-}
-
-/* SkypeAdduserDlg
- *
- * Purpose: Show Skype's Add user Dialog
- */
-INT_PTR SkypeAdduserDlg(WPARAM wParam, LPARAM lParam) {
- SkypeSend("OPEN ADDAFRIEND");
- return 0;
-}
-
-/* SkypeFlush
- *
- * Purpose: Flush the Skype Message-List
- */
-void SkypeFlush(void) {
- char *ptr;
-
- while ((ptr=SkypeRcv(NULL, 0))!=NULL) free(ptr);
-}
-
-/* SkypeStatusToMiranda
- *
- * Purpose: Converts the specified Skype-Status mode to the corresponding Miranda-Status mode
- * Params : s - Skype Status
- * Returns: The correct Status
- * 0 - Nothing found
- */
-int SkypeStatusToMiranda(char *s) {
- if (!mir_strcmp("SKYPEOUT", s))
- return db_get_dw(NULL, SKYPE_PROTONAME, "SkypeOutStatusMode", ID_STATUS_ONTHEPHONE);
- for(int i=0; status_codes[i].szStat; i++)
- if (!mir_strcmp(status_codes[i].szStat, s))
- return status_codes[i].id;
- return 0;
-}
-
-/* MirandaStatusToSkype
- *
- * Purpose: Converts the specified Miranda-Status mode to the corresponding Skype-Status mode
- * Params : id - Miranda Status
- * Returns: The correct Status
- * NULL - Nothing found
- */
-char *MirandaStatusToSkype(int id) {
- if (db_get_b(NULL, SKYPE_PROTONAME, "NoSkype3Stats", 0)) {
- switch (id)
- {
- case ID_STATUS_NA: return "AWAY";
- case ID_STATUS_FREECHAT: return "ONLINE";
- }
- }
- for(int i=0; status_codes[i].szStat; i++)
- if (status_codes[i].id==id)
- return status_codes[i].szStat;
- return NULL;
-}
-
-/* GetSkypeErrorMsg
- *
- * Purpose: Get a human-readable Error-Message for the supplied Skype Error-Message
- * Params : str - Skype Error-Message string
- * Returns: Human-readable Error Message or NULL, if nothing was found
- * Warning: Don't forget to free() return value
- */
-char *GetSkypeErrorMsg(char *str) {
- char *pos, *reason, *msg;
-
- LOG (("GetSkypeErrorMsg received error: %s", str));
- if (!strncmp(str, "ERROR", 5)) {
- reason=_strdup(str);
- return reason;
- }
- if ((pos=strstr(str, "FAILURE")) ) {
- switch(atoi(pos+14)) {
- case MISC_ERROR: msg=Translate("Misc. error"); break;
- case USER_NOT_FOUND: msg=Translate("User does not exist, check username"); break;
- case USER_NOT_ONLINE: msg=Translate("Trying to send IM to a user, who is not online"); break;
- case USER_BLOCKED: msg=Translate("IM blocked by recipient"); break;
- case TYPE_UNSUPPORTED: msg=Translate("Type unsupported"); break;
- case SENDER_NOT_FRIEND: msg=Translate("Sending IM message to user, who has not added you to friend list and has chosen 'only people in my friend list can start IM'"); break;
- case SENDER_NOT_AUTHORIZED: msg=Translate("Sending IM message to user, who has not authorized you and has chosen 'only people whom I have authorized can start IM'"); break;
- default: msg=Translate("Unknown error");
- }
- reason=(char *)malloc(mir_strlen(pos)+mir_strlen(msg)+3);
- sprintf (reason, "%s: %s", pos, msg);
- return reason;
- }
- return NULL;
-}
-
-/* testfor
- *
- * Purpose: Wait, until the given Message-Fragment is received from Skype within
- * the given amount of time
- * Params : see SkypeRcv
- * Returns: TRUE - Message was received within the given amount of time
- * FALSE- nope, sorry
- */
-BOOL testfor(char *what, DWORD maxwait) {
- char *res = SkypeRcv(what, maxwait);
- if (res==NULL)
- return FALSE;
- free(res);
- return TRUE;
-}
-
-char SendSkypeproxyCommand(char command) {
- int length=0;
- char reply=0;
-
- BOOL res = send(ClientSocket, (char *)&length, sizeof(length), 0)==SOCKET_ERROR
- || send(ClientSocket, (char *)&command, sizeof(command), 0)==SOCKET_ERROR
- || recv(ClientSocket, (char *)&reply, sizeof(reply), 0)==SOCKET_ERROR;
- if (res)
- return -1;
- else
- return reply;
-}
-
-/* ConnectToSkypeAPI
- *
- * Purpose: Establish a connection to the Skype API
- * Params : path - Path to the Skype application
- * iStart - Need to start skype for status change.
- * 1 = Normal start if Skype not running
- * 2 = Forced startp code execution no matter what
- * Returns: 0 - Connecting succeeded
- * -1 - Something went wrong
- */
-int ConnectToSkypeAPI(char *path, int iStart) {
- static int iRet = -1; // last request result
- static volatile long newRequest = TRUE;
-
- InterlockedExchange(&newRequest, TRUE); // place new request
- mir_cslock lck(ConnectMutex);
- if (iRet == -1 || newRequest)
- {
- iRet = _ConnectToSkypeAPI(path, iStart);
- InterlockedExchange(&newRequest, FALSE); // every thread which is waiting for connect mutex will get our result as well.. but subsequent calls will set this value to true and call _Connect again
- }
- return iRet;
-}
-
-void TranslateMirandaRelativePathToAbsolute(LPCSTR cszPath, LPSTR szAbsolutePath, BOOL fQuoteSpaces) {
- *szAbsolutePath = 0;
- CallService (MS_UTILS_PATHTOABSOLUTE, (WPARAM)(*cszPath ? cszPath : ".\\"), (LPARAM)szAbsolutePath);
- if(fQuoteSpaces && strchr((LPCSTR)szAbsolutePath, ' ')){
- memmove (szAbsolutePath+1, szAbsolutePath, mir_strlen(szAbsolutePath)+1);
- *szAbsolutePath='"';
- mir_strcat (szAbsolutePath, "\"");
- }
-
- TRACEA(szAbsolutePath);
-}
-
-static int my_spawnv(const char *cmdname, const char *const *argv, PROCESS_INFORMATION *pi)
-{
- int i, iLen=0;
- char *CommandLine;
- STARTUPINFOA si={0};
- BOOL bRet;
-
- memset (pi, 0, sizeof(PROCESS_INFORMATION));
- for (i=0; argv[i]; i++)
- iLen += (int)mir_strlen(argv[i])+1;
- if (!(CommandLine = (char*)calloc(1, iLen))) return -1;
- for (i=0; argv[i]; i++) {
- if (i) mir_strcat (CommandLine, " ");
- mir_strcat (CommandLine, argv[i]);
- }
- si.cb = sizeof(si);
-
- bRet = CreateProcessA( cmdname,CommandLine,NULL,NULL,FALSE,0,NULL,NULL,&si,pi);
- free(CommandLine);
- if (!bRet) return -1;
- return (DWORD)pi->hProcess;
-}
-
-static int _ConnectToSkypeAPI(char *path, int iStart) {
- BOOL SkypeLaunched=FALSE;
- BOOL UseCustomCommand = db_get_b(NULL, SKYPE_PROTONAME, "UseCustomCommand", 0);
- int counter=0, i, j, maxattempts=db_get_w(NULL, SKYPE_PROTONAME, "ConnectionAttempts", 10);
- char *args[16], *pFree = NULL;
- char *SkypeOptions[]={"/notray", "/nosplash", "/minimized", "/removable", "/datapath:", "/secondary"};
- const int SkypeDefaults[]={0, 1, 1, 0, 0};
-
- char szAbsolutePath[MAX_PATH];
-
- LOG(("ConnectToSkypeAPI started."));
- if (UseSockets)
- {
- DBVARIANT dbv;
- long inet;
- struct hostent *hp;
-
- LOG(("ConnectToSkypeAPI: Connecting to Skype2socket socket..."));
- if ((ClientSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP))==INVALID_SOCKET) return -1;
-
- if (!db_get_s(NULL, SKYPE_PROTONAME, "Host", &dbv)) {
- if ((inet=inet_addr(dbv.pszVal))==-1) {
- if (hp=gethostbyname(dbv.pszVal))
- memcpy(&inet, hp->h_addr, sizeof(inet));
- else {
- OUTPUT(TranslateT("Cannot resolve host!"));
- db_free(&dbv);
- return -1;
- }
- }
- db_free(&dbv);
- } else {
- OUTPUT(TranslateT("Cannot find valid host to connect to."));
- return -1;
- }
-
- SOCKADDR_IN service;
- service.sin_family = AF_INET;
- service.sin_addr.s_addr = inet;
- service.sin_port = htons((unsigned short)db_get_w(NULL, SKYPE_PROTONAME, "Port", 1401));
-
- if ( connect( ClientSocket, (SOCKADDR*) &service, sizeof(service) ) == SOCKET_ERROR) return -1;
-
- char reply=0;
- if (db_get_b(NULL, SKYPE_PROTONAME, "RequiresPassword", 0) && !db_get_s(NULL, SKYPE_PROTONAME, "Password", &dbv))
- {
- if ((reply=SendSkypeproxyCommand(AUTHENTICATE))==-1) {
- db_free(&dbv);
- return -1;
- }
- if (!reply) {
- OUTPUT(TranslateT("Authentication is not supported/needed for this Skype proxy server. It will be disabled."));
- db_set_b(NULL, SKYPE_PROTONAME, "RequiresPassword", 0);
- } else {
- unsigned int length=(unsigned int)mir_strlen(dbv.pszVal);
- BOOL res = send(ClientSocket, (char *)&length, sizeof(length), 0)==SOCKET_ERROR
- || send(ClientSocket, dbv.pszVal, length, 0)==SOCKET_ERROR
- || recv(ClientSocket, (char *)&reply, sizeof(reply), 0)==SOCKET_ERROR;
- if (res)
- {
- db_free(&dbv);
- return -1;
- }
- if (!reply)
- {
- OUTPUT(TranslateT("Authentication failed for this server, connection was not successful. Verify that your password is correct!"));
- db_free(&dbv);
- return -1;
- }
- }
- db_free(&dbv);
- if ((reply=SendSkypeproxyCommand(CAPABILITIES))==-1) return -1;
- }
- else
- {
- if ((reply=SendSkypeproxyCommand(CAPABILITIES))==-1) return -1;
- if (reply&USE_AUTHENTICATION) {
- OUTPUT(TranslateT("The server you specified requires authentication, but you have not supplied a password for it. Check the Skype plugin settings and try again."));
- return -1;
- }
- }
- if (reply&USE_DATASLOTS) {
- unsigned int length=0;
- char command=MY_CAPABILITIES, caps=USE_DATASLOTS;
-
- // The server can send us datafiles, tell him that we support this
- if ( send(ClientSocket, (char *)&length, sizeof(length), 0)==SOCKET_ERROR
- || send(ClientSocket, (char *)&command, sizeof(command), 0)==SOCKET_ERROR
- || send(ClientSocket, (char *)&caps, sizeof(caps), 0)==SOCKET_ERROR)
- return -1;
- }
-
- if (!rcvThreadRunning)
- if(_beginthread(( pThreadFunc )rcvThread, 0, NULL)==-1) return -1;
-
- AttachStatus=SKYPECONTROLAPI_ATTACH_SUCCESS;
- return 0;
- }
-
- if (pszProxyCallout)
- {
- if (SkypeSend("SET USERSTATUS ONLINE")==-1)
- {
- AttachStatus=SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE;
- return -1;
- }
- for ( ;; ) {
- char *ptr = SkypeRcv ("CONNSTATUS", INFINITE);
- if (!ptr)
- {
- AttachStatus=SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE;
- return -1;
- }
-
- if (mir_strcmp (ptr+11, "CONNECTING"))
- {
- free (ptr);
- break;
- }
- free (ptr);
- }
-
- AttachStatus=SKYPECONTROLAPI_ATTACH_SUCCESS;
- return 0;
- }
-
- do
- {
- int retval;
- /* To initiate communication, Client should broadcast windows message
- ('SkypeControlAPIDiscover') to all windows in the system, specifying its own
- window handle in wParam parameter.
- */
- if (iStart != 2 || counter)
- {
- LOG(("ConnectToSkypeAPI sending discover message.. hWnd=%08X", (long)g_hWnd));
- retval = (int)SendMessageTimeout(HWND_BROADCAST, ControlAPIDiscover, (WPARAM)g_hWnd, 0, SMTO_ABORTIFHUNG, 3000, NULL);
- LOG(("ConnectToSkypeAPI sent discover message returning %d", retval));
- }
-
- /* In response, Skype responds with
- message 'SkypeControlAPIAttach' to the handle specified, and indicates
- connection status
- SkypeReady is set if there is an answer by Skype other than API_AVAILABLE.
- If there is no answer after 3 seconds, launch Skype as it's propably
- not running.
- */
- if (iStart == 2 || (WaitForSingleObject(SkypeReady, 3000)==WAIT_TIMEOUT && AttachStatus!=SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION))
- {
- if (iStart != 2 && g_hWnd==NULL)
- {
- LOG(("ConnectToSkypeAPI: hWnd of SkypeDispatchWindow not yet set.."));
- continue;
- }
- if ((iStart == 2 || !SkypeLaunched) && (path || UseCustomCommand))
- {
- static PROCESS_INFORMATION pi={0};
- DWORD dwExitStatus = 0;
-
- if ((!pi.hProcess || !GetExitCodeProcess(pi.hProcess, &dwExitStatus) || dwExitStatus != STILL_ACTIVE) &&
- (db_get_b(NULL, SKYPE_PROTONAME, "StartSkype", 1) || iStart))
- {
- LOG(("ConnectToSkypeAPI Starting Skype, as it's not running"));
-
- j=1;
- for (i=0; i < SIZEOF(SkypeOptions); i++)
- if (db_get_b(NULL, SKYPE_PROTONAME, SkypeOptions[i]+1, SkypeDefaults[i])) {
- DBVARIANT dbv;
-
- switch (i)
- {
- case 4:
- if(!db_get_s(NULL,SKYPE_PROTONAME,"datapath",&dbv))
- {
- int paramSize;
- TranslateMirandaRelativePathToAbsolute(dbv.pszVal, szAbsolutePath, TRUE);
- paramSize = (int)mir_strlen(SkypeOptions[i]) + (int)mir_strlen(szAbsolutePath);
- pFree = args[j] = (char*)malloc(paramSize + 1);
- sprintf(args[j],"%s%s",SkypeOptions[i],szAbsolutePath);
- db_free(&dbv);
- }
- break;
- case 2:
- args[j++]="/legacylogin";
- default:
- args[j]=SkypeOptions[i];
- break;
- }
- LOG(("Using Skype parameter: %s", args[j]));
- //MessageBox(NULL,"Using Skype parameter: ",args[j],0);
- j++;
- }
- args[j]=NULL;
-
- if(UseCustomCommand)
- {
- DBVARIANT dbv;
-
- if(!db_get_s(NULL,SKYPE_PROTONAME,"CommandLine",&dbv))
- {
- TranslateMirandaRelativePathToAbsolute(dbv.pszVal, szAbsolutePath, FALSE);
- args[0] = (LPSTR)szAbsolutePath;
- LOG(("ConnectToSkypeAPI: Launch skype using command line"));
- if (!*szAbsolutePath || my_spawnv(szAbsolutePath, args, &pi) == -1) {
- LOG(("ConnectToSkypeAPI: Failed to launch skype!"));
- } else {
- WaitForInputIdle((HANDLE)pi.hProcess, 5000);
- setUserNamePassword(pi.dwProcessId);
- }
- db_free(&dbv);
- }
- }
- else
- {
- args[0]=path;
- LOG(("ConnectToSkypeAPI: Launch skype"));
- /*for(int i=0;i<j;i++)
- {
- if(args[i] != NULL)
- LOG("ConnectToSkypeAPI", args[i]);
- }*/
-
- // if there is no skype installed and no custom command line, then exit .. else it crashes
- if (args[0] == NULL || mir_strlen(args[0])==0)
- {
- return -1;
- }
- if (my_spawnv(path, args, &pi) != -1) {
- WaitForInputIdle((HANDLE)pi.hProcess, 5000);
- setUserNamePassword(pi.dwProcessId);
- }
- }
- if (pFree) free(pFree);
- }
- ResetEvent(SkypeReady);
- SkypeLaunched=TRUE;
- LOG(("ConnectToSkypeAPI: Skype process started."));
- // Skype launching iniciated, keep sending Discover messages until it responds.
- continue;
- }
- else
- {
- LOG(("ConnectToSkypeAPI: Check if Skype was launchable.."));
- if (db_get_b(NULL, SKYPE_PROTONAME, "StartSkype", 1) && !(path || UseCustomCommand)) return -1;
- LOG(("Trying to attach: #%d", counter));
- counter++;
- if (counter>=maxattempts && AttachStatus==-1)
- {
- int oldstatus=SkypeStatus;
- InterlockedExchange((long *)&SkypeStatus, (int)ID_STATUS_OFFLINE);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, SkypeStatus);
- OUTPUT(TranslateT("ERROR: Skype not running / too old / not working!"));
- return -1;
- }
- }
- }
- LOG(("Attachstatus %d", AttachStatus));
- } while (AttachStatus==SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE || AttachStatus==SKYPECONTROLAPI_ATTACH_API_AVAILABLE || AttachStatus==-1);
-
- while (AttachStatus==SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION) Sleep(1000);
- LOG(("Attachstatus %d", AttachStatus));
- if (AttachStatus!=SKYPECONTROLAPI_ATTACH_SUCCESS) {
- int oldstatus;
-
- switch(AttachStatus) {
- case SKYPECONTROLAPI_ATTACH_REFUSED:
- OUTPUT(TranslateT("Skype refused the connection :("));
- break;
- case SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE:
- OUTPUT(TranslateT("The Skype API is not available"));
- break;
- default:
- LOG(("ERROR: AttachStatus: %d", AttachStatus));
- OUTPUT(TranslateT("Wheee, Skype won't let me use the API. :("));
- }
- oldstatus=SkypeStatus;
- InterlockedExchange((long *)&SkypeStatus, (int)ID_STATUS_OFFLINE);
- ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldstatus, SkypeStatus);
- return -1;
- }
-
- return 0;
-}
-
-/* CloseSkypeAPI
- * Purpose: Closes existing api connection
- * Params: path - Path to the Skype application; could be NULL when using proxy
- * Returns: always 0
- */
-int CloseSkypeAPI(char *skypePath)
-{
- char szAbsolutePath[MAX_PATH];
-
- logoff_contacts(TRUE);
- if (UseSockets)
- {
- if (ClientSocket != INVALID_SOCKET)
- {
- closesocket(ClientSocket);
- ClientSocket = INVALID_SOCKET;
- }
- }
- else {
- if (!pszProxyCallout)
- {
- if (AttachStatus!=-1)
- {
- // it was crashing when the skype-network-proxy is used (imo2sproxy for imo.im) and skype-path is empty
- // now, with the "UseSockets" check and the skypePath[0] != 0 check its fixed
- if (skypePath != NULL && skypePath[0] != 0) {
- TranslateMirandaRelativePathToAbsolute(skypePath, szAbsolutePath, FALSE);
- _spawnl(_P_NOWAIT, szAbsolutePath, szAbsolutePath, "/SHUTDOWN", NULL);
- }
- }
- }
- }
- SkypeInitialized=FALSE;
- ResetEvent(SkypeReady);
- AttachStatus=-1;
- if (g_hWnd) KillTimer (g_hWnd, 1);
- return 0;
-}
-/* ConnectToSkypeAPI
- *
- * Purpose: Establish a connection to the Skype API
- * Params : path - Path to the Skype application
- * Returns: 0 - Connecting succeeded
- * -1 - Something went wrong
- */
-//int __connectAPI(char *path) {
-// int retval;
-//
-// EnterCriticalSection(&ConnectMutex);
-// if (AttachStatus!=-1) {
-// LeaveCriticalSection(&ConnectMutex);
-// return -1;
-// }
-// InterlockedExchange((long *)&SkypeStatus, ID_STATUS_CONNECTING);
-// ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) ID_STATUS_OFFLINE, SkypeStatus);
-// retval=__connectAPI(path);
-// if (retval==-1) {
-// logoff_contacts();
-// InterlockedExchange((long *)&SkypeStatus, ID_STATUS_OFFLINE);
-// ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) ID_STATUS_CONNECTING, SkypeStatus);
-// }
-// LeaveCriticalSection(&ConnectMutex);
-// return retval;
-//}
diff --git a/protocols/SkypeClassic/src/skypeapi.h b/protocols/SkypeClassic/src/skypeapi.h deleted file mode 100644 index 63bf26e425..0000000000 --- a/protocols/SkypeClassic/src/skypeapi.h +++ /dev/null @@ -1,61 +0,0 @@ -// Skype API defines
-#define SKYPECONTROLAPI_ATTACH_SUCCESS 0
-#define SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION 1
-#define SKYPECONTROLAPI_ATTACH_REFUSED 2
-#define SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE 3
-#define SKYPECONTROLAPI_ATTACH_API_AVAILABLE 0x8001
-
-#define MISC_ERROR 1
-#define USER_NOT_FOUND 2
-#define USER_NOT_ONLINE 3
-#define USER_BLOCKED 4
-#define TYPE_UNSUPPORTED 5
-#define SENDER_NOT_FRIEND 6
-#define SENDER_NOT_AUTHORIZED 7
-
-#define MAX_ENTRIES 128 // Max. 128 number-Entries in Dial-dlg.
-
-
-// Prototypes
-int SkypeMsgInit(void);
-int SkypeMsgAdd(char *msg);
-void SkypeMsgCleanup(void);
-char *SkypeMsgGet(void);
-int SkypeSend(char*, ...);
-char *SkypeRcv(char *what, DWORD maxwait);
-char *SkypeRcvTime(char *what, time_t st, DWORD maxwait);
-char *SkypeRcvMsg(char *what, time_t st, MCONTACT hContact, DWORD maxwait);
-INT_PTR SkypeCall(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeCallHangup(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeOutCall(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeHup(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeHoldCall(WPARAM wParam, LPARAM lParam);
-void SkypeFlush(void);
-int SkypeStatusToMiranda(char *s);
-char *MirandaStatusToSkype(int id);
-char *GetSkypeErrorMsg(char *str);
-BOOL testfor(char *what, DWORD maxwait);
-int ConnectToSkypeAPI(char *path, BOOL bStart);
-int CloseSkypeAPI(char *skypePath);
-INT_PTR SkypeAdduserDlg(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeAnswerCall(WPARAM wParam, LPARAM lParam);
-int SkypeMsgCollectGarbage(time_t age);
-INT_PTR SkypeSendGuiFile(WPARAM wParam, LPARAM);
-INT_PTR SkypeBlockContact(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeSetAvatar(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeSetAwayMessage(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeSetNick(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeChatCreate(WPARAM wParam, LPARAM lParam);
-int SkypeSetProfile(char *szProperty, char *szValue);
-char *SkypeGet(char *szWhat, char *szWho, char *szProperty);
-char *SkypeGetID(char *szWhat, char *szWho, char *szProperty);
-char *SkypeGetErr(char *szWhat, char *szWho, char *szProperty);
-char *SkypeGetErrID(char *szWhat, char *szWho, char *szProperty);
-WCHAR *SkypeGetW(char *szWhat, WCHAR *szWho, char *szProperty);
-WCHAR *SkypeGetErrW(char *szWhat, TCHAR *szWho, char *szProperty);
-#define SkypeGetT SkypeGetW
-#define SkypeGetErrT SkypeGetErrW
-char *SkypeGetProfile(char *szProperty);
-void SetUserNamePassword();
-INT_PTR SkypeAdduserDlg(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeReceivedAPIMessage(WPARAM wParam, LPARAM lParam);
diff --git a/protocols/SkypeClassic/src/skypeopt.cpp b/protocols/SkypeClassic/src/skypeopt.cpp deleted file mode 100644 index ba9f04275f..0000000000 --- a/protocols/SkypeClassic/src/skypeopt.cpp +++ /dev/null @@ -1,929 +0,0 @@ -#include "skype.h"
-#include "skypeopt.h"
-#include "pthread.h"
-#include "gchat.h"
-#include "skypeprofile.h"
-
-#include "uxtheme.h"
-#define HAVE_UXTHEMES
-
-#ifdef SKYPE_AUTO_DETECTION
-#include "ezxml/ezxml.c"
-#endif
-
-#ifdef UNICODE
-#include "utf8.h"
-#endif
-
-#pragma warning (disable: 4706) // assignment within conditional expression
-
-// VC6 SDK defines
-#ifndef BIF_SHAREABLE
-#define BIF_SHAREABLE 0x8000 // sharable resources displayed (remote shares, requires BIF_USENEWUI)
-#endif
-#ifndef BIF_NEWDIALOGSTYLE
-#define BIF_NEWDIALOGSTYLE 0x0040 // Use the new dialog layout with the ability to resize
-#endif // Caller needs to call OleInitialize() before using this API
-#ifndef BIF_NONEWFOLDERBUTTON
-#define BIF_NONEWFOLDERBUTTON 0x0200 // Do not add the "New Folder" button to the dialog. Only applicable with BIF_NEWDIALOGSTYLE.
-#endif
-
-
-extern HINSTANCE hInst;
-extern char protocol, g_szProtoName[];
-extern BOOL SkypeInitialized, bProtocolSet, bIsImoproxy;
-
-BOOL showPopup, showPopupErr, popupWindowColor, popupWindowColorErr;
-unsigned int popupBackColor, popupBackColorErr;
-unsigned int popupTextColor, popupTextColorErr;
-int popupTimeSec, popupTimeSecErr;
-POPUPDATAT InCallPopup;
-POPUPDATAT ErrorPopup;
-
-static SkypeProfile myProfile;
-static HBITMAP hAvatar = NULL;
-
-extern BOOL PopupServiceExists;
-extern BOOL (WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD);
-
-int RegisterOptions(WPARAM wParam, LPARAM)
-{
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
- odp.pszGroup = "Network";
- odp.pszTitle = SKYPE_PROTONAME;
- odp.pfnDlgProc = OptionsDlgProc;
- odp.flags = ODPF_BOLDGROUPS;
- Options_AddPage(wParam, &odp);
-
- if(PopupServiceExists)
- {
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUP);
- odp.pszGroup = "Popups";
- odp.pfnDlgProc = OptPopupDlgProc;
- Options_AddPage(wParam, &odp);
- }
-
- return 0;
-}
-
-INT_PTR CALLBACK OptPopupDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- static RECT r;
-
- switch ( msg )
- {
- case WM_INITDIALOG:
- TranslateDialogDefault( hwnd );
- // Message Popup
- popupTimeSec = db_get_dw(NULL, SKYPE_PROTONAME, "popupTimeSec", 4);
- popupTextColor = db_get_dw(NULL, SKYPE_PROTONAME, "popupTextColor", GetSysColor(COLOR_WINDOWTEXT));
- popupBackColor = db_get_dw(NULL, SKYPE_PROTONAME, "popupBackColor", GetSysColor(COLOR_BTNFACE));
- popupWindowColor = db_get_b(NULL, SKYPE_PROTONAME, "popupWindowColor", FALSE);
- showPopup = db_get_b(NULL, SKYPE_PROTONAME, "showPopup", TRUE);
- // ERROR Message Popup
- popupTimeSecErr = db_get_dw(NULL, SKYPE_PROTONAME, "popupTimeSecErr", 4);
- popupTextColorErr = db_get_dw(NULL, SKYPE_PROTONAME, "popupTextColorErr", GetSysColor(COLOR_WINDOWTEXT));
- popupBackColorErr = db_get_dw(NULL, SKYPE_PROTONAME, "popupBackColorErr", GetSysColor(COLOR_BTNFACE));
- popupWindowColorErr = db_get_b(NULL, SKYPE_PROTONAME, "popupWindowColorErr", FALSE);
- showPopupErr = db_get_b(NULL, SKYPE_PROTONAME, "showPopupErr", TRUE);
-
- EnableWindow(GetDlgItem(hwnd,IDC_USEWINCOLORS),showPopup);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPBACKCOLOR),showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPBACKCOLOR),showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTEXTCOLOR),showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPTEXTCOLOR),showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTIME),showPopup);
- EnableWindow(GetDlgItem(hwnd,IDC_PREVIEW),showPopup);
- EnableWindow(GetDlgItem(hwnd,IDC_USEWINCOLORSERR),showPopupErr);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPBACKCOLORERR),showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPBACKCOLORERR),showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTEXTCOLORERR),showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPTEXTCOLORERR),showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTIMEERR),showPopupErr);
- EnableWindow(GetDlgItem(hwnd,IDC_PREVIEWERR),showPopupErr);
- CheckDlgButton(hwnd, IDC_POPUPINCOMING, showPopup ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_USEWINCOLORS, popupWindowColor ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_POPUPERROR, showPopupErr ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_USEWINCOLORSERR, popupWindowColorErr ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(hwnd, IDC_POPUPTIME, EM_SETLIMITTEXT, 3, 0L);
- SetDlgItemInt(hwnd, IDC_POPUPTIME, popupTimeSec,FALSE);
- SendDlgItemMessage(hwnd, IDC_POPUPTIMEERR, EM_SETLIMITTEXT, 3, 0L);
- SetDlgItemInt(hwnd, IDC_POPUPTIMEERR, popupTimeSecErr,FALSE);
- SendDlgItemMessage(hwnd, IDC_POPUPBACKCOLOR, CPM_SETCOLOUR,0, popupBackColor);
- SendDlgItemMessage(hwnd, IDC_POPUPBACKCOLOR, CPM_SETDEFAULTCOLOUR, 0, GetSysColor(COLOR_BTNFACE));
- SendDlgItemMessage(hwnd, IDC_POPUPTEXTCOLOR, CPM_SETCOLOUR,0, popupTextColor);
- SendDlgItemMessage(hwnd, IDC_POPUPTEXTCOLOR, CPM_SETDEFAULTCOLOUR, 0, GetSysColor(COLOR_WINDOWTEXT));
- SendDlgItemMessage(hwnd, IDC_POPUPBACKCOLORERR, CPM_SETCOLOUR,0, popupBackColorErr);
- SendDlgItemMessage(hwnd, IDC_POPUPBACKCOLORERR, CPM_SETDEFAULTCOLOUR, 0, GetSysColor(COLOR_BTNFACE));
- SendDlgItemMessage(hwnd, IDC_POPUPTEXTCOLORERR, CPM_SETCOLOUR,0, popupTextColorErr);
- SendDlgItemMessage(hwnd, IDC_POPUPTEXTCOLORERR, CPM_SETDEFAULTCOLOUR, 0, GetSysColor(COLOR_WINDOWTEXT));
-
-
- return TRUE;
- break;
-
- case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom)
- {
- case 0:
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- db_set_dw(NULL, SKYPE_PROTONAME, "popupBackColor", popupBackColor);
- db_set_dw(NULL, SKYPE_PROTONAME, "popupTextColor", popupTextColor);
- db_set_dw(NULL, SKYPE_PROTONAME, "popupTimeSec", popupTimeSec);
- db_set_b(NULL, SKYPE_PROTONAME, "popupWindowColor", (BYTE)popupWindowColor);
- db_set_b(NULL, SKYPE_PROTONAME, "showPopup", (BYTE)showPopup);
- db_set_dw(NULL, SKYPE_PROTONAME, "popupBackColorErr", popupBackColorErr);
- db_set_dw(NULL, SKYPE_PROTONAME, "popupTextColorErr", popupTextColorErr);
- db_set_dw(NULL, SKYPE_PROTONAME, "popupTimeSecErr", popupTimeSecErr);
- db_set_b(NULL, SKYPE_PROTONAME, "popupWindowColorErr", (BYTE)popupWindowColorErr);
- db_set_b(NULL, SKYPE_PROTONAME, "showPopupErr", (BYTE)showPopupErr);
- break;
- }
- }
- break;
-
-
-
- case WM_COMMAND:
- switch( LOWORD( wParam ))
- {
- case IDC_PREVIEW:
- {
- MCONTACT hContact;
- TCHAR * lpzContactName;
-
- hContact = db_find_first();
- lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,hContact,GCDNF_TCHAR);
- InCallPopup.lchContact = hContact;
- InCallPopup.lchIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_CALL));
- InCallPopup.colorBack = ! popupWindowColor ? popupBackColor : GetSysColor(COLOR_BTNFACE);
- InCallPopup.colorText = ! popupWindowColor ? popupTextColor : GetSysColor(COLOR_WINDOWTEXT);
- InCallPopup.iSeconds = popupTimeSec;
- InCallPopup.PluginData = (void *)1;
-
- mir_tstrcpy(InCallPopup.lptzText, TranslateT("Incoming Skype call"));
-
- mir_tstrcpy(InCallPopup.lptzContactName, lpzContactName);
-
- CallService(MS_POPUP_ADDPOPUPT,(WPARAM)&InCallPopup,0);
-
-
- break;
- }
- case IDC_PREVIEWERR:
- ErrorPopup.lchContact = NULL;
- ErrorPopup.lchIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_CALL));
- ErrorPopup.colorBack = ! popupWindowColorErr ? popupBackColorErr : GetSysColor(COLOR_BTNFACE);
- ErrorPopup.colorText = ! popupWindowColorErr ? popupTextColorErr : GetSysColor(COLOR_WINDOWTEXT);
- ErrorPopup.iSeconds = popupTimeSecErr;
- ErrorPopup.PluginData = (void *)1;
-
- mir_tstrcpy(ErrorPopup.lptzText, TranslateT("Preview error message"));
-
- mir_tstrcpy(ErrorPopup.lptzContactName, _T("Error Message"));
-
-
- CallService(MS_POPUP_ADDPOPUPT,(WPARAM)&ErrorPopup,0);
-
- break;
-
- case IDC_POPUPTIME:
- case IDC_POPUPTIMEERR:
- {
- BOOL Translated;
- popupTimeSec = GetDlgItemInt(hwnd,IDC_POPUPTIME,&Translated,FALSE);
- popupTimeSecErr = GetDlgItemInt(hwnd,IDC_POPUPTIMEERR,&Translated,FALSE);
- SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
- break;
- }
- case IDC_POPUPTEXTCOLOR:
- case IDC_POPUPBACKCOLOR:
- case IDC_POPUPTEXTCOLORERR:
- case IDC_POPUPBACKCOLORERR:
- popupBackColor = (UINT)SendDlgItemMessage(hwnd,IDC_POPUPBACKCOLOR,CPM_GETCOLOUR,0,0);
- popupTextColor = (UINT)SendDlgItemMessage(hwnd,IDC_POPUPTEXTCOLOR,CPM_GETCOLOUR,0,0);
- popupBackColorErr = (UINT)SendDlgItemMessage(hwnd,IDC_POPUPBACKCOLORERR,CPM_GETCOLOUR,0,0);
- popupTextColorErr = (UINT)SendDlgItemMessage(hwnd,IDC_POPUPTEXTCOLORERR,CPM_GETCOLOUR,0,0);
- SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
- break;
- case IDC_USEWINCOLORS:
- popupWindowColor = (IsDlgButtonChecked(hwnd,IDC_USEWINCOLORS)==BST_CHECKED);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPBACKCOLOR), showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPBACKCOLOR), showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTEXTCOLOR), showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPTEXTCOLOR), showPopup && ! popupWindowColor);
- SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
- break;
- case IDC_POPUPINCOMING:
- showPopup = (IsDlgButtonChecked(hwnd,IDC_POPUPINCOMING)==BST_CHECKED);
- EnableWindow(GetDlgItem(hwnd,IDC_USEWINCOLORS),showPopup);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPBACKCOLOR),showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPBACKCOLOR),showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTEXTCOLOR),showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPTEXTCOLOR),showPopup && ! popupWindowColor);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTIME),showPopup);
- EnableWindow(GetDlgItem(hwnd,IDC_PREVIEW),showPopup);
- SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
- break;
- case IDC_USEWINCOLORSERR:
- popupWindowColorErr = (IsDlgButtonChecked(hwnd,IDC_USEWINCOLORSERR)==BST_CHECKED);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPBACKCOLORERR), showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPBACKCOLORERR), showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTEXTCOLORERR), showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPTEXTCOLORERR), showPopupErr && ! popupWindowColorErr);
- SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
- break;
- case IDC_POPUPERROR:
- showPopupErr = (IsDlgButtonChecked(hwnd,IDC_POPUPERROR)==BST_CHECKED);
- EnableWindow(GetDlgItem(hwnd,IDC_USEWINCOLORSERR),showPopupErr);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPBACKCOLORERR),showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPBACKCOLORERR),showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTEXTCOLORERR),showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_STATIC_POPUPTEXTCOLORERR),showPopupErr && ! popupWindowColorErr);
- EnableWindow(GetDlgItem(hwnd,IDC_POPUPTIMEERR),showPopupErr);
- EnableWindow(GetDlgItem(hwnd,IDC_PREVIEWERR),showPopupErr);
- SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
- break;
- }
-
- break;
-
- case WM_DESTROY:
- break;
- }
-
- return 0;
-}
-
-INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lParam)
-{
- static int iInit = TRUE;
-
- switch(msg)
- {
- case WM_INITDIALOG:
- {
- TCITEM tci;
- RECT rcClient;
- GetClientRect(hwnd, &rcClient);
-
- iInit = TRUE;
- tci.mask = TCIF_PARAM|TCIF_TEXT;
- tci.lParam = (LPARAM)CreateDialog(hInst,MAKEINTRESOURCE(IDD_OPT_DEFAULT), hwnd, OptionsDefaultDlgProc);
- tci.pszText = TranslateT("Skype default");
- TabCtrl_InsertItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), 0, &tci);
- MoveWindow((HWND)tci.lParam,1,28,rcClient.right-5,rcClient.bottom-31,1);
-#ifdef HAVE_UXTHEMES
- if(MyEnableThemeDialogTexture)
- MyEnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB);
-#endif
-
- tci.lParam = (LPARAM)CreateDialog(hInst,MAKEINTRESOURCE(IDD_OPT_ADVANCED),hwnd,OptionsAdvancedDlgProc);
- tci.pszText = TranslateT("Skype advanced");
- TabCtrl_InsertItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), 1, &tci);
- MoveWindow((HWND)tci.lParam,1,28,rcClient.right-5,rcClient.bottom-31,1);
- ShowWindow((HWND)tci.lParam, SW_HIDE);
-#ifdef HAVE_UXTHEMES
- if(MyEnableThemeDialogTexture)
- MyEnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB);
-#endif
-
- tci.lParam = (LPARAM)CreateDialog(hInst,MAKEINTRESOURCE(IDD_OPT_PROXY),hwnd,OptionsProxyDlgProc);
- tci.pszText = TranslateT("Skype proxy");
- TabCtrl_InsertItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), 2, &tci);
- MoveWindow((HWND)tci.lParam,1,28,rcClient.right-5,rcClient.bottom-31,1);
- ShowWindow((HWND)tci.lParam, SW_HIDE);
-#ifdef HAVE_UXTHEMES
- if(MyEnableThemeDialogTexture)
- MyEnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB);
-#endif
-
- iInit = FALSE;
- return FALSE;
- }
-
- case PSM_CHANGED: // used so tabs dont have to call SendMessage(GetParent(GetParent(hwnd)), PSM_CHANGED, 0, 0);
- if(!iInit)
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- break;
- case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- {
- TCITEM tci;
- int i,count;
- tci.mask = TCIF_PARAM;
- count = TabCtrl_GetItemCount(GetDlgItem(hwnd,IDC_OPTIONSTAB));
- for (i=0;i<count;i++)
- {
- TabCtrl_GetItem(GetDlgItem(hwnd,IDC_OPTIONSTAB),i,&tci);
- SendMessage((HWND)tci.lParam,WM_NOTIFY,0,lParam);
- }
- }
- break;
- }
- break;
- case IDC_OPTIONSTAB:
- switch (((LPNMHDR)lParam)->code)
- {
- case TCN_SELCHANGING:
- {
- TCITEM tci;
- tci.mask = TCIF_PARAM;
- TabCtrl_GetItem(GetDlgItem(hwnd,IDC_OPTIONSTAB),TabCtrl_GetCurSel(GetDlgItem(hwnd,IDC_OPTIONSTAB)),&tci);
- ShowWindow((HWND)tci.lParam,SW_HIDE);
- }
- break;
- case TCN_SELCHANGE:
- {
- TCITEM tci;
- tci.mask = TCIF_PARAM;
- TabCtrl_GetItem(GetDlgItem(hwnd,IDC_OPTIONSTAB),TabCtrl_GetCurSel(GetDlgItem(hwnd,IDC_OPTIONSTAB)),&tci);
- ShowWindow((HWND)tci.lParam,SW_SHOW);
- }
- break;
- }
- break;
-
- }
- break;
- }
- return FALSE;
-}
-
-INT_PTR CALLBACK OptionsProxyDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
- const int Skype2SocketControls[]={ IDC_STATIC_HOST, IDC_HOST, IDC_STATIC_PORT, IDC_PORT, IDC_REQPASS, IDC_PASSWORD, IDC_STATIC_RESTART };
- static BOOL initDlg=FALSE;
- DBVARIANT dbv;
-
- switch (uMsg){
- case WM_INITDIALOG:
- initDlg=TRUE;
- TranslateDialogDefault(hwndDlg);
- if (!db_get_s(NULL, SKYPE_PROTONAME, "Host", &dbv)) {
- SetDlgItemTextA(hwndDlg, IDC_HOST, dbv.pszVal);
- db_free(&dbv);
- } else SetDlgItemText(hwndDlg, IDC_HOST, _T("localhost"));
- SendDlgItemMessage(hwndDlg, IDC_PORT, EM_SETLIMITTEXT, 5, 0L);
- SetDlgItemInt(hwndDlg, IDC_PORT, db_get_w(NULL, SKYPE_PROTONAME, "Port", 1401), FALSE);
- CheckDlgButton(hwndDlg, IDC_REQPASS, db_get_b(NULL, SKYPE_PROTONAME, "RequiresPassword", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_USES2S, db_get_b(NULL, SKYPE_PROTONAME, "UseSkype2Socket", 0) ? BST_CHECKED : BST_UNCHECKED);
- if (!db_get_s(NULL, SKYPE_PROTONAME, "Password", &dbv)) {
- SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
- db_free(&dbv);
- }
- SendMessage(hwndDlg, WM_COMMAND, IDC_USES2S, 0);
- SendMessage(hwndDlg, WM_COMMAND, IDC_REQPASS, 0);
- initDlg=FALSE;
- return TRUE;
- case WM_NOTIFY: {
- NMHDR* nmhdr = (NMHDR*)lParam;
-
- switch (nmhdr->code){
- case PSN_APPLY:
- case PSN_KILLACTIVE:
- {
- char buf[1024];
- GetDlgItemTextA(hwndDlg, IDC_HOST, buf, SIZEOF(buf));
- db_set_s(NULL, SKYPE_PROTONAME, "Host", buf);
- db_set_w(NULL, SKYPE_PROTONAME, "Port", (unsigned short)GetDlgItemInt(hwndDlg, IDC_PORT, NULL, FALSE));
- db_set_b(NULL, SKYPE_PROTONAME, "RequiresPassword", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_REQPASS)));
- db_set_b (NULL, SKYPE_PROTONAME, "UseSkype2Socket", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_USES2S)));
- memset(buf, 0, sizeof(buf));
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, buf, SIZEOF(buf));
- db_set_s(NULL, SKYPE_PROTONAME, "Password", buf);
- return TRUE;
- }
- }
- break;
- }
- case WM_COMMAND: {
- switch (LOWORD(wParam)) {
- case IDC_USES2S:
- for (int i=0; i < SIZEOF(Skype2SocketControls); i++)
- EnableWindow(GetDlgItem(hwndDlg, Skype2SocketControls[i]), IsDlgButtonChecked(hwndDlg, LOWORD(wParam)));
- if (IsDlgButtonChecked(hwndDlg, LOWORD(wParam)))
- SendMessage(hwndDlg, WM_COMMAND, IDC_REQPASS, 0);
- break;
- case IDC_REQPASS:
- EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), IsDlgButtonChecked(hwndDlg, LOWORD(wParam)));
- break;
-
- }
- if (!initDlg) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- return 0;
-}
-
-INT_PTR CALLBACK OptionsAdvancedDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
- static BOOL initDlg=FALSE;
- static int statusModes[]={ID_STATUS_OFFLINE,ID_STATUS_ONLINE,ID_STATUS_AWAY,ID_STATUS_NA,ID_STATUS_OCCUPIED,ID_STATUS_DND,ID_STATUS_FREECHAT,ID_STATUS_INVISIBLE,ID_STATUS_OUTTOLUNCH,ID_STATUS_ONTHEPHONE};
-
- switch (uMsg){
- case WM_INITDIALOG: {
- initDlg=TRUE;
-
- TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_ENABLEMENU, db_get_b(NULL, SKYPE_PROTONAME, "EnableMenu", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NOERRORS, db_get_b(NULL, SKYPE_PROTONAME, "SuppressErrors", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_KEEPSTATE, db_get_b(NULL, SKYPE_PROTONAME, "KeepState", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TIMEZONE, db_get_b(NULL, SKYPE_PROTONAME, "UseTimeZonePatch", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_IGNTZ, db_get_b(NULL, SKYPE_PROTONAME, "IgnoreTimeZones", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWDEFAULTAVATAR, db_get_b(NULL, SKYPE_PROTONAME, "ShowDefaultSkypeAvatar", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SUPPRESSCALLSUMMARYMESSAGE, db_get_b(NULL, SKYPE_PROTONAME, "SuppressCallSummaryMessage", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NOSKYPE3STATS, db_get_b(NULL, SKYPE_PROTONAME, "NoSkype3Stats", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWFULLNAME, db_get_b(NULL, SKYPE_PROTONAME, "ShowFullname", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NOACK, db_get_b(NULL, SKYPE_PROTONAME, "NoAck", 1) ? BST_CHECKED : BST_UNCHECKED);
-
- if (ServiceExists(MS_GC_NEWSESSION) && (!bProtocolSet || protocol>=5)) {
- CheckDlgButton(hwndDlg, IDC_GROUPCHAT, db_get_b(NULL, SKYPE_PROTONAME, "UseGroupchat", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_GROUPCHATREAD, db_get_b(NULL, SKYPE_PROTONAME, "MarkGroupchatRead", 0) ? BST_CHECKED : BST_UNCHECKED);
- } else {
- EnableWindow(GetDlgItem(hwndDlg, IDC_GROUPCHAT), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_GROUPCHATREAD), FALSE);
- }
-
-#ifdef USEPOPUP
- if (ServiceExists(MS_POPUP_ADDPOPUPT))
- CheckDlgButton(hwndDlg, IDC_USEPOPUP, db_get_b(NULL, SKYPE_PROTONAME, "UsePopup", 0) ? BST_CHECKED : BST_UNCHECKED);
- else
-#endif
- EnableWindow(GetDlgItem(hwndDlg, IDC_USEPOPUP), FALSE);
-
- int j=db_get_dw(NULL, SKYPE_PROTONAME, "SkypeOutStatusMode", ID_STATUS_ONTHEPHONE);
- for(int i=0;i<sizeof(statusModes)/sizeof(statusModes[0]);i++) {
- int k=SendDlgItemMessage(hwndDlg,IDC_SKYPEOUTSTAT,CB_ADDSTRING,0,(LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,statusModes[i],GSMDF_TCHAR));
- SendDlgItemMessage(hwndDlg,IDC_SKYPEOUTSTAT,CB_SETITEMDATA,k,statusModes[i]);
- if (statusModes[i]==j) SendDlgItemMessage(hwndDlg,IDC_SKYPEOUTSTAT,CB_SETCURSEL,i,0);
- }
- initDlg=FALSE;
- return TRUE;
- }
- case WM_NOTIFY: {
- NMHDR* nmhdr = (NMHDR*)lParam;
-
- switch (nmhdr->code){
- case PSN_APPLY:
- case PSN_KILLACTIVE:
- db_set_b (NULL, SKYPE_PROTONAME, "EnableMenu", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ENABLEMENU)));
- db_set_b (NULL, SKYPE_PROTONAME, "UsePopup", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_USEPOPUP)));
- db_set_b (NULL, SKYPE_PROTONAME, "UseGroupchat", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_GROUPCHAT)));
- db_set_b (NULL, SKYPE_PROTONAME, "MarkGroupchatRead", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_GROUPCHATREAD)));
- db_set_b (NULL, SKYPE_PROTONAME, "SuppressErrors", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NOERRORS)));
- db_set_b (NULL, SKYPE_PROTONAME, "KeepState", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_KEEPSTATE)));
- db_set_dw(NULL, SKYPE_PROTONAME, "SkypeOutStatusMode", SendDlgItemMessage(hwndDlg, IDC_SKYPEOUTSTAT, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_SKYPEOUTSTAT, CB_GETCURSEL, 0, 0), 0));
- db_set_b (NULL, SKYPE_PROTONAME, "UseTimeZonePatch", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_TIMEZONE)));
- db_set_b (NULL, SKYPE_PROTONAME, "IgnoreTimeZones", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IGNTZ)));
- db_set_b (NULL, SKYPE_PROTONAME, "ShowDefaultSkypeAvatar", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SHOWDEFAULTAVATAR)));
- db_set_b (NULL, SKYPE_PROTONAME, "SuppressCallSummaryMessage", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SUPPRESSCALLSUMMARYMESSAGE)));
- db_set_b (NULL, SKYPE_PROTONAME, "NoSkype3Stats", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NOSKYPE3STATS)));
- db_set_b (NULL, SKYPE_PROTONAME, "ShowFullname", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SHOWFULLNAME)));
- db_set_b (NULL, SKYPE_PROTONAME, "NoAck", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NOACK)));
- return TRUE;
- }
- break;
- }
- case WM_COMMAND: {
- switch (LOWORD(wParam)) {
- case IDC_CLEANUP:
- pthread_create(( pThreadFunc )CleanupNicknames, NULL);
- break;
- }
- if (!initDlg) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- return 0;
-}
-
-static int CALLBACK BrowseCallbackProc(HWND hWnd, UINT uMsg, LPARAM, LPARAM lpData)
-{
- switch (uMsg)
- {
- case BFFM_INITIALIZED:
- {
- // Set initial directory.
- wchar_t* wszInitFolder = make_unicode_string((const unsigned char*)lpData);
- SendMessage(hWnd, BFFM_SETSELECTION, TRUE, (LPARAM)wszInitFolder);
- free(wszInitFolder);
- break;
- }
- }
- return 0;
-}
-
-INT_PTR CALLBACK OptionsDefaultDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
- static BOOL initDlg=FALSE;
- static int skypeLaunchControls[]={IDC_NOSPLASH,IDC_MINIMIZED,IDC_NOTRAY,IDC_REMOVEABLE,IDC_SECONDARY,IDC_DATAPATHO,IDC_CUSTOMCOMMAND,IDC_STATIC_PATHINFO};
-
- switch (uMsg){
- case WM_INITDIALOG:
- {
- DBVARIANT dbv;
-
- initDlg = TRUE;
- TranslateDialogDefault(hwndDlg);
-
- BOOL startSkype = db_get_b(NULL, SKYPE_PROTONAME, "StartSkype", 1);
-
- CheckDlgButton(hwndDlg, IDC_STARTSKYPE, startSkype ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NOSPLASH, db_get_b(NULL, SKYPE_PROTONAME, "nosplash", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MINIMIZED, db_get_b(NULL, SKYPE_PROTONAME, "minimized", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NOTRAY, db_get_b(NULL, SKYPE_PROTONAME, "notray", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_REMOVEABLE, db_get_b(NULL, SKYPE_PROTONAME, "removable", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SECONDARY, db_get_b(NULL, SKYPE_PROTONAME, "secondary", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DATAPATHO, db_get_b(NULL, SKYPE_PROTONAME, "datapath:", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHUTDOWN, db_get_b(NULL, SKYPE_PROTONAME, "Shutdown", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_UNLOADOFFLINE, db_get_b(NULL, SKYPE_PROTONAME, "UnloadOnOffline", 0) ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_CUSTOMCOMMAND, db_get_b(NULL, SKYPE_PROTONAME, "UseCustomCommand", 0) ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(hwndDlg, IDC_COMMANDLINE, EM_SETLIMITTEXT, MAX_PATH-1, 0L);
- if(!db_get_s(NULL,SKYPE_PROTONAME,"CommandLine",&dbv))
- {
- SetDlgItemTextA(hwndDlg, IDC_COMMANDLINE, dbv.pszVal);
- db_free(&dbv);
- }
-
- SendDlgItemMessage(hwndDlg, IDC_DATAPATH, EM_SETLIMITTEXT, MAX_PATH-1, 0L);
- if(!db_get_s(NULL,SKYPE_PROTONAME,"datapath",&dbv))
- {
- SetDlgItemTextA(hwndDlg, IDC_DATAPATH, dbv.pszVal);
- db_free(&dbv);
- }
-
- for(int i=0; i < SIZEOF(skypeLaunchControls); i++)
- EnableWindow(GetDlgItem(hwndDlg, skypeLaunchControls[i]), startSkype);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSECMDL), startSkype && IsDlgButtonChecked(hwndDlg, IDC_CUSTOMCOMMAND));
- EnableWindow(GetDlgItem(hwndDlg, IDC_COMMANDLINE), startSkype && IsDlgButtonChecked(hwndDlg, IDC_CUSTOMCOMMAND));
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSEDP), startSkype && IsDlgButtonChecked(hwndDlg, IDC_DATAPATHO));
- EnableWindow(GetDlgItem(hwndDlg, IDC_DATAPATH), startSkype && IsDlgButtonChecked(hwndDlg, IDC_DATAPATHO));
-
- // LoginUserName
- if(!db_get_ts(NULL,SKYPE_PROTONAME,"LoginUserName",&dbv))
- {
- SetDlgItemText(hwndDlg, IDC_USERNAME, dbv.ptszVal);
- db_free(&dbv);
- }
-
- // LoginPassword
- if(!db_get_ts(NULL,SKYPE_PROTONAME,"LoginPassword",&dbv))
- {
- SetDlgItemText(hwndDlg, IDC_PASSWORD, dbv.ptszVal);
- db_free(&dbv);
- }
-
- SendDlgItemMessage(hwndDlg, IDC_CONNATTEMPTS, EM_SETLIMITTEXT, 3, 0L);
- SetDlgItemInt (hwndDlg, IDC_CONNATTEMPTS, db_get_w(NULL, SKYPE_PROTONAME, "ConnectionAttempts", 10), FALSE);
- SendMessage(hwndDlg, WM_COMMAND, IDC_STARTSKYPE, 0);
- initDlg=FALSE;
- return TRUE;
- }
- case WM_NOTIFY: {
- NMHDR* nmhdr = (NMHDR*)lParam;
-
- switch (nmhdr->code){
- case PSN_APPLY:
- case PSN_KILLACTIVE:
- {
- char text[500];
- TCHAR wtext[500];
- char szRelativePath[MAX_PATH];
-
- db_set_b (NULL, SKYPE_PROTONAME, "StartSkype", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STARTSKYPE)));
- db_set_b (NULL, SKYPE_PROTONAME, "nosplash", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NOSPLASH)));
- db_set_b (NULL, SKYPE_PROTONAME, "minimized", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_MINIMIZED)));
- db_set_b (NULL, SKYPE_PROTONAME, "notray", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NOTRAY)));
- db_set_b (NULL, SKYPE_PROTONAME, "Shutdown", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SHUTDOWN)));
- db_set_b (NULL, SKYPE_PROTONAME, "UnloadOnOffline", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_UNLOADOFFLINE)));
- db_set_w (NULL, SKYPE_PROTONAME, "ConnectionAttempts", (unsigned short)GetDlgItemInt(hwndDlg, IDC_CONNATTEMPTS, NULL, FALSE));
- db_set_b (NULL, SKYPE_PROTONAME, "UseCustomCommand", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CUSTOMCOMMAND)));
- db_set_b (NULL, SKYPE_PROTONAME, "datapath:", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_DATAPATHO)));
- db_set_b (NULL, SKYPE_PROTONAME, "removable", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_REMOVEABLE)));
- db_set_b (NULL, SKYPE_PROTONAME, "secondary", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SECONDARY)));
-
- GetDlgItemTextA(hwndDlg,IDC_COMMANDLINE,text,SIZEOF(text));
- strncpy(szRelativePath, text, sizeof(szRelativePath)-1);
- CallService (MS_UTILS_PATHTORELATIVE, (WPARAM)text, (LPARAM)szRelativePath);
- db_set_s(NULL, SKYPE_PROTONAME, "CommandLine", szRelativePath);
-
- GetDlgItemTextA(hwndDlg,IDC_DATAPATH,text,SIZEOF(text));
- strncpy(szRelativePath, text, sizeof(szRelativePath)-1);
- CallService (MS_UTILS_PATHTORELATIVE, (WPARAM)text, (LPARAM)szRelativePath);
- db_set_s(NULL, SKYPE_PROTONAME, "datapath", szRelativePath);
-
- // LoginUserName
- GetDlgItemText(hwndDlg,IDC_USERNAME,wtext,SIZEOF(wtext));
- db_set_ts(NULL, SKYPE_PROTONAME, "LoginUserName", wtext);
-
- // LoginPassword
- GetDlgItemText(hwndDlg,IDC_PASSWORD,wtext,SIZEOF(wtext));
- db_set_ts(NULL, SKYPE_PROTONAME, "LoginPassword", wtext);
-
- return TRUE;
- }
- }
- break;
- }
- case WM_COMMAND: {
- switch (LOWORD(wParam)) {
- case IDC_STARTSKYPE: {
- BOOL startSkype = IsDlgButtonChecked(hwndDlg, IDC_STARTSKYPE);
-
- for (int i = 0; i < SIZEOF(skypeLaunchControls); i ++)
- EnableWindow(GetDlgItem(hwndDlg, skypeLaunchControls[i]), startSkype);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSECMDL), startSkype && IsDlgButtonChecked(hwndDlg, IDC_CUSTOMCOMMAND));
- EnableWindow(GetDlgItem(hwndDlg, IDC_COMMANDLINE), startSkype && IsDlgButtonChecked(hwndDlg, IDC_CUSTOMCOMMAND));
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSEDP), startSkype && IsDlgButtonChecked(hwndDlg, IDC_DATAPATHO));
- EnableWindow(GetDlgItem(hwndDlg, IDC_DATAPATH), startSkype && IsDlgButtonChecked(hwndDlg, IDC_DATAPATHO));
- }
- break;
- case IDC_CLEANUP:
- pthread_create(( pThreadFunc )CleanupNicknames, NULL);
- break;
- case IDC_DATAPATHO:
- EnableWindow(GetDlgItem(hwndDlg, IDC_DATAPATH), IsDlgButtonChecked(hwndDlg, IDC_DATAPATHO));
- EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSEDP), IsDlgButtonChecked(hwndDlg, IDC_DATAPATHO));
- break;
- case IDC_CUSTOMCOMMAND:
- EnableWindow(GetDlgItem(hwndDlg, IDC_COMMANDLINE), IsDlgButtonChecked(hwndDlg, IDC_CUSTOMCOMMAND));
- EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSECMDL), IsDlgButtonChecked(hwndDlg, IDC_CUSTOMCOMMAND));
- break;
- case IDC_BROWSECMDL:
- {
- OPENFILENAMEA ofn={0};
- char szFileName[MAX_PATH];
- char szAbsolutePath[MAX_PATH];
-
- ofn.lStructSize=sizeof(ofn);
- ofn.hwndOwner=hwndDlg;
- ofn.lpstrFilter="Executable files (*.exe)\0*.exe\0All files (*.*)\0*.*\0";
- ofn.nMaxFile=SIZEOF(szFileName);
- ofn.lpstrDefExt="exe";
- ofn.lpstrFile=szFileName;
- ofn.Flags=OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ENABLESIZING;
-
- GetDlgItemTextA(hwndDlg,IDC_COMMANDLINE,szFileName,SIZEOF(szFileName));
- TranslateMirandaRelativePathToAbsolute(szFileName, szAbsolutePath, FALSE);
- mir_strcpy (szFileName, szAbsolutePath);
-
- BOOL gofnResult = GetOpenFileNameA(&ofn);
- if (!gofnResult && CommDlgExtendedError() == FNERR_INVALIDFILENAME){
- mir_strcpy(szFileName, ".\\Skype.exe");
- TranslateMirandaRelativePathToAbsolute(szFileName, szAbsolutePath, FALSE);
- mir_strcpy (szFileName, szAbsolutePath);
- gofnResult = GetOpenFileNameA(&ofn);
- }
-
- if(gofnResult)
- SetDlgItemTextA(hwndDlg, IDC_COMMANDLINE, szFileName);
-
- break;
- }
- case IDC_BROWSEDP:
- {
- char szFileName[MAX_PATH], szAbsolutePath[MAX_PATH];
-
- GetDlgItemTextA (hwndDlg, IDC_DATAPATH, szFileName, SIZEOF(szFileName));
-
- TranslateMirandaRelativePathToAbsolute(szFileName, szAbsolutePath, FALSE);
- BROWSEINFOA bi={0};
- bi.hwndOwner = hwndDlg;
- bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_SHAREABLE | BIF_NEWDIALOGSTYLE | BIF_NONEWFOLDERBUTTON;
- bi.lpfn = BrowseCallbackProc;
- bi.lParam = (LPARAM)szAbsolutePath;
-
- LPITEMIDLIST pidl = SHBrowseForFolderA(&bi);
- if (pidl) {
- if (SHGetPathFromIDListA(pidl, szFileName))
- SetDlgItemTextA(hwndDlg, IDC_DATAPATH, szFileName);
- CoTaskMemFree (pidl);
- }
- break;
- }
-
-#ifdef SKYPE_AUTO_DETECTION
- case IDC_AUTODETECTION:
- DoAutoDetect(hwndDlg);
- break;
-#endif
- }
- if (!initDlg) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// OnDetailsInit - initializes user info dialog pages.
-
-int OnDetailsInit( WPARAM wParam, LPARAM lParam )
-{
- MCONTACT hContact = (MCONTACT)lParam;
-
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.hIcon = NULL;
- odp.hInstance = hInst;
-
- if ( hContact == NULL ) {
- char szTitle[256];
- mir_snprintf(szTitle, SIZEOF( szTitle ), "%s %s", SKYPE_PROTONAME, Translate( "Details" ));
-
- odp.pfnDlgProc = DetailsDlgProc;
- odp.position = 1900000000;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_SETDETAILS);
- odp.pszTitle = szTitle;
- UserInfo_AddPage(wParam, &odp);
- }
-
- return 0;
-}
-
-/*AvatarDlgProc
-*
-* For setting the skype avatar
-*
-*/
-INT_PTR CALLBACK AvatarDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
-{
- static RECT r;
-
- switch ( msg ) {
- case WM_INITDIALOG:
- TranslateDialogDefault( hwndDlg );
-
- hAvatar = NULL;
- if(ServiceExists(MS_AV_GETMYAVATAR)){
- struct avatarCacheEntry *ace = (struct avatarCacheEntry *)CallService(MS_AV_GETMYAVATAR, 0,(LPARAM) SKYPE_PROTONAME);
- if (ace!=NULL) {
- hAvatar = ( HBITMAP )CallService( MS_UTILS_LOADBITMAP, 0, ( LPARAM )ace->szFilename);
- if ( hAvatar != NULL )
- SendDlgItemMessage(hwndDlg, IDC_AVATAR, STM_SETIMAGE, IMAGE_BITMAP, (WPARAM)hAvatar );
- }
- }
-
-
-
- return TRUE;
-
- case WM_COMMAND:
- if ( HIWORD( wParam ) == BN_CLICKED ) {
- switch( LOWORD( wParam )) {
- case IDC_SETAVATAR:
- TCHAR szFileName[ MAX_PATH ];
- if (EnterBitmapFileName(szFileName) != ERROR_SUCCESS)
- return FALSE;
-
- hAvatar = (HBITMAP)CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)szFileName);
- if (hAvatar != NULL){
- SendDlgItemMessage(hwndDlg, IDC_AVATAR, STM_SETIMAGE, IMAGE_BITMAP, (WPARAM)hAvatar);
- CallService(SKYPE_SETAVATAR, 0, ( LPARAM )szFileName);
- }
- break;
-
- case IDC_DELETEAVATAR:
- if ( hAvatar != NULL ) {
- DeleteObject( hAvatar );
- hAvatar = NULL;
- CallService(SKYPE_SETAVATAR, 0, 0);
- }
- db_unset( NULL, SKYPE_PROTONAME, "AvatarFile" );
- InvalidateRect( hwndDlg, NULL, TRUE );
- break;
- } }
- break;
-
- case WM_DESTROY:
- if ( hAvatar != NULL )
- DeleteObject( hAvatar );
- break;
- }
-
- return 0;
-}
-
-/*DetailsDlgProc
-*
-* For setting the skype infos
-*
-*/
-INT_PTR CALLBACK DetailsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
-{
- static int sexM = 0,sexF = 0, sex;
-
- switch ( msg ) {
- case WM_INITDIALOG:
- TranslateDialogDefault( hwndDlg );
-
- memset(&myProfile, 0, sizeof(myProfile));
- SkypeProfile_Load(&myProfile);
- if(SkypeInitialized)
- SkypeProfile_LoadFromSkype(&myProfile);
-
- SendDlgItemMessage(hwndDlg,IDC_SEX,CB_ADDSTRING,0,(LPARAM)_T(""));
- sexM = SendDlgItemMessage(hwndDlg,IDC_SEX,CB_ADDSTRING,0,(LPARAM)TranslateT("MALE"));
- sexF = SendDlgItemMessage(hwndDlg,IDC_SEX,CB_ADDSTRING,0,(LPARAM)TranslateT("FEMALE"));
-
- switch(myProfile.Sex) {
- case 0x4D: SendDlgItemMessage(hwndDlg,IDC_SEX,CB_SETCURSEL, sexM, 0); break;
- case 0x46: SendDlgItemMessage(hwndDlg,IDC_SEX,CB_SETCURSEL, sexF, 0); break;
- }
-
- SetDlgItemText(hwndDlg, IDC_FULLNAME, myProfile.FullName);
- SetDlgItemTextA(hwndDlg, IDC_HOMEPAGE, myProfile.HomePage);
- SetDlgItemTextA(hwndDlg, IDC_HOMEPHONE, myProfile.HomePhone);
- SetDlgItemTextA(hwndDlg, IDC_OFFICEPHONE, myProfile.OfficePhone);
- SetDlgItemText(hwndDlg, IDC_CITY, myProfile.City);
- SetDlgItemText(hwndDlg, IDC_PROVINCE, myProfile.Province);
- DateTime_SetSystemtime (GetDlgItem (hwndDlg, IDC_BIRTHDAY), GDT_VALID, &myProfile.Birthday);
- return TRUE;
-
- case WM_COMMAND:
- if ( HIWORD( wParam ) == BN_CLICKED ) {
- switch( LOWORD( wParam )) {
- case IDC_SAVEDETAILS:
- GetDlgItemText(hwndDlg,IDC_FULLNAME,myProfile.FullName,SIZEOF(myProfile.FullName));
- GetDlgItemTextA(hwndDlg,IDC_HOMEPAGE,myProfile.HomePage,SIZEOF(myProfile.HomePage));
- GetDlgItemTextA(hwndDlg,IDC_HOMEPHONE,myProfile.HomePhone,SIZEOF(myProfile.HomePhone));
- GetDlgItemTextA(hwndDlg,IDC_OFFICEPHONE,myProfile.OfficePhone,SIZEOF(myProfile.OfficePhone));
- GetDlgItemText(hwndDlg,IDC_CITY,myProfile.City,SIZEOF(myProfile.City));
- GetDlgItemText(hwndDlg,IDC_PROVINCE,myProfile.Province,SIZEOF(myProfile.Province));
- sex = SendDlgItemMessage(hwndDlg, IDC_SEX, CB_GETCURSEL, 0, 0);
-
- myProfile.Sex = 0;
- if(sex == sexF) myProfile.Sex = 0x46; else
- if(sex == sexM) myProfile.Sex = 0x4D;
- DateTime_GetSystemtime (GetDlgItem (hwndDlg, IDC_BIRTHDAY), &myProfile.Birthday);
-
- SkypeProfile_Save(&myProfile);
- if(SkypeInitialized)
- SkypeProfile_SaveToSkype(&myProfile);
- break;
- }
- }
- break;
-
- case WM_DESTROY:
- if ( hAvatar != NULL )
- DeleteObject( hAvatar );
- break;
- }
-
- return 0;
-}
-
-#ifdef SKYPE_AUTO_DETECTION
-/**
- * DoAutoDetect
- * @param dlg The default option dialog handle
- */
-void DoAutoDetect(HWND dlg)
-{
- char basePath[MAX_PATH];
- char fileName[MAX_PATH];
- char tmpUser[255];
- ezxml_t f1, acc;
-
- if (FAILED(SHGetFolderPath(dlg,CSIDL_APPDATA,NULL,0,basePath)))
- {
- OUTPUT("Error in retrieving appdata path!");
- return;
- }
-
- mir_strcat(basePath,"\\Skype\\");
- sprintf (fileName, "%s\\shared.xml", basePath);
-
- if (f1 = ezxml_parse_file(fileName))
- {
- if (acc = ezxml_get(f1, "Lib", 0, "Account", 0, "Default", -1))
- {
- if (GetDlgItemTextA(dlg, IDC_USERNAME, tmpUser, SIZEOF(tmpUser)))
- SetDlgItemTextA(dlg, IDC_USERNAME, acc->txt);
- /* Can't find this stuff in current Skype verions??
- sprintf (fileName, "%s\\%s\\config.xml", basePath, acc->txt);
- if ((acc = ezxml_get(f1, "UI", 0, "Messages", 0, "OpenWindowInCompactMode", -1)) && *acc->txt!='0')
- {
- ezxml_set_txt (acc, "0");
- // ezXML doesn't supprot saving yet
- }
- */
- }
- ezxml_free(f1);
- }
- else
- {
- OUTPUT("Failed to open skypes configuration files!");
- return;
- }
-}
-#endif
diff --git a/protocols/SkypeClassic/src/skypeopt.h b/protocols/SkypeClassic/src/skypeopt.h deleted file mode 100644 index 23aa7a5212..0000000000 --- a/protocols/SkypeClassic/src/skypeopt.h +++ /dev/null @@ -1,49 +0,0 @@ -/*
- * RegisterOptions
- *
- * This function tells Miranda to add the configuration section of this plugin in
- * the Options-dialog.
- */
-int RegisterOptions(WPARAM wParam, LPARAM lParam);
-/*
- * OptionsDlgProc
- *
- * This callback function is called, when the options dialog in Miranda is shown
- * The function contains all necessary stuff to process the options in the dialog
- * and store them in the database, when changed, and fill out the settings-dialog
- * correctly according to the current settings
- */
-INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
-INT_PTR CALLBACK OptionsDefaultDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK OptionsAdvancedDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK OptionsProxyDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK OptPopupDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
-/*
-* Procedure to call when the option page is asked
-*
-*/
-int OnDetailsInit( WPARAM wParam, LPARAM lParam );
-
-/*
-* Dialog to change avatar in user details.
-*
-*
-*/
-INT_PTR CALLBACK AvatarDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
-/*
-* Dialog to change infos in user details.
-*
-*
-*/
-INT_PTR CALLBACK DetailsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
-/*
- * Helper functions
- *
- */
-void DoAutoDetect(HWND dlg);
-
-;
\ No newline at end of file diff --git a/protocols/SkypeClassic/src/skypeprofile.cpp b/protocols/SkypeClassic/src/skypeprofile.cpp deleted file mode 100644 index 045a5b7d78..0000000000 --- a/protocols/SkypeClassic/src/skypeprofile.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#pragma warning (disable: 4706) // assignment within conditional expression
-
-#include "skypeprofile.h"
-#include "skypeapi.h"
-#include "utf8.h"
-
-extern char g_szProtoName[];
-
-void SkypeProfile_Save(SkypeProfile *pstProf)
-{
- db_set_b(NULL, SKYPE_PROTONAME, "Gender", pstProf->Sex);
- db_set_s(NULL, SKYPE_PROTONAME, "HomePhone", pstProf->HomePhone);
- db_set_s(NULL, SKYPE_PROTONAME, "OfficePhone", pstProf->OfficePhone);
- db_set_s(NULL, SKYPE_PROTONAME, "HomePage", pstProf->HomePage);
- db_set_ts(NULL, SKYPE_PROTONAME, "Nick", pstProf->FullName);
- db_set_ts(NULL, SKYPE_PROTONAME, "City", pstProf->City);
- db_set_ts(NULL, SKYPE_PROTONAME, "Province", pstProf->Province);
- db_set_w(NULL, SKYPE_PROTONAME, "BirthYear", (WORD)pstProf->Birthday.wYear);
- db_set_b(NULL, SKYPE_PROTONAME, "BirthMonth", (BYTE)pstProf->Birthday.wMonth);
- db_set_b(NULL, SKYPE_PROTONAME, "BirthDay", (BYTE)pstProf->Birthday.wDay);
-}
-
-void SkypeProfile_Load(SkypeProfile *pstProf)
-{
- pstProf->Sex = (BYTE)db_get_b(NULL, SKYPE_PROTONAME, "Gender", 0);
- pstProf->Birthday.wYear = (WORD)db_get_w(NULL, SKYPE_PROTONAME, "BirthYear", 1900);
- pstProf->Birthday.wMonth = (WORD)db_get_b(NULL, SKYPE_PROTONAME, "BirthMonth", 01);
- pstProf->Birthday.wDay = (WORD)db_get_b(NULL, SKYPE_PROTONAME, "BirthDay", 01);
-
- DBVARIANT dbv;
- if(!db_get_ts(NULL,SKYPE_PROTONAME,"Nick",&dbv))
- {
- _tcsncpy_s(pstProf->FullName, dbv.ptszVal, _TRUNCATE);
- db_free(&dbv);
- }
- if(!db_get_s(NULL,SKYPE_PROTONAME,"HomePage",&dbv))
- {
- strncpy_s(pstProf->HomePage, dbv.pszVal, _TRUNCATE);
- db_free(&dbv);
- }
- if(!db_get_ts(NULL,SKYPE_PROTONAME,"Province",&dbv))
- {
- _tcsncpy_s(pstProf->Province, dbv.ptszVal, _TRUNCATE);
- db_free(&dbv);
- }
- if(!db_get_ts(NULL,SKYPE_PROTONAME,"City",&dbv))
- {
- _tcsncpy_s(pstProf->City, dbv.ptszVal, _TRUNCATE);
- db_free(&dbv);
- }
- if(!db_get_s(NULL,SKYPE_PROTONAME,"OfficePhone",&dbv))
- {
- strncpy_s(pstProf->OfficePhone, dbv.pszVal, _TRUNCATE);
- db_free(&dbv);
- }
- if(!db_get_s(NULL,SKYPE_PROTONAME,"HomePhone",&dbv))
- {
- strncpy_s(pstProf->HomePhone, dbv.pszVal, _TRUNCATE);
- db_free(&dbv);
- }
-}
-
-static void LoadSaveSkype(SkypeProfile *pstProf, BOOL bSet)
-{
-#pragma warning (push)
-#pragma warning (disable: 4204) // nonstandard extension used : non-constant aggregate initializer
-#define ENTRY(x,y) {x, pstProf->y, sizeof(pstProf->y)/sizeof(pstProf->y[0]), sizeof(pstProf->y[0])}
- const struct {
- char *pszSetting;
- LPVOID lpDest;
- int iSize;
- char cType;
- } astSettings[] = {
- ENTRY("FULLNAME", FullName),
- ENTRY("PHONE_HOME", HomePhone),
- ENTRY("PHONE_OFFICE", OfficePhone),
- ENTRY("HOMEPAGE", HomePage),
- ENTRY("CITY", City),
- ENTRY("PROVINCE", Province)
- };
-#pragma warning (pop)
-#undef ENTRY
- char *ptr;
- int i;
-
- if (bSet) {
- char *pBuf, szBirthday[16];
- for (i=0; i<sizeof(astSettings)/sizeof(astSettings[0]); i++) {
- if ((astSettings[i].cType == sizeof(char) && utf8_encode((const char*)astSettings[i].lpDest, &pBuf) != -1) ||
- (astSettings[i].cType == sizeof(WCHAR) && (pBuf = (char*)make_utf8_string((const WCHAR*)astSettings[i].lpDest)))) {
- SkypeSetProfile (astSettings[i].pszSetting, pBuf);
- free (pBuf);
- }
- }
- switch (pstProf->Sex)
- {
- case 0x4D: SkypeSetProfile ("SEX", "MALE"); break;
- case 0x46: SkypeSetProfile ("SEX", "FEMALE"); break;
- }
- sprintf (szBirthday, "%04d%02d%02d", pstProf->Birthday.wYear, pstProf->Birthday.wMonth, pstProf->Birthday.wDay);
- SkypeSetProfile ("BIRTHDAY", szBirthday);
- } else {
- for (i=0; i<sizeof(astSettings)/sizeof(astSettings[0]); i++) {
- if (ptr=SkypeGetProfile(astSettings[i].pszSetting)) {
- if (astSettings[i].cType == sizeof(char)) {
- char *pBuf;
- if (utf8_decode (ptr, &pBuf) != -1) {
- strncpy ((char*)astSettings[i].lpDest, pBuf, astSettings[i].iSize);
- free (pBuf);
- }
- } else {
- WCHAR *pBuf;
- if (pBuf = make_unicode_string((const unsigned char*)ptr)) {
- wcsncpy ((WCHAR*)astSettings[i].lpDest, pBuf, astSettings[i].iSize);
- free (pBuf);
- }
- }
- free (ptr);
- }
- }
- if (ptr=SkypeGetProfile("SEX"))
- {
- if (!_stricmp(ptr, "MALE")) pstProf->Sex=0x4D; else
- if (!_stricmp(ptr, "FEMALE")) pstProf->Sex=0x46;
- free (ptr);
- }
- if (ptr=SkypeGetProfile("BIRTHDAY"))
- {
- if (*ptr != '0')
- sscanf(ptr, "%04hd%02hd%02hd", &pstProf->Birthday.wYear, &pstProf->Birthday.wMonth,
- &pstProf->Birthday.wDay);
- free(ptr);
- }
- }
-}
-
-void SkypeProfile_LoadFromSkype(SkypeProfile *pstProf)
-{
- LoadSaveSkype (pstProf, FALSE);
-}
-
-void SkypeProfile_SaveToSkype(SkypeProfile *pstProf)
-{
- LoadSaveSkype (pstProf, TRUE);
-}
\ No newline at end of file diff --git a/protocols/SkypeClassic/src/skypeprofile.h b/protocols/SkypeClassic/src/skypeprofile.h deleted file mode 100644 index f53d3c0e44..0000000000 --- a/protocols/SkypeClassic/src/skypeprofile.h +++ /dev/null @@ -1,30 +0,0 @@ -// System includes
-#include <stdio.h>
-#include <windows.h>
-#include <commctrl.h>
-#include <process.h>
-#include <time.h>
-#include "resource.h"
-#include "skype.h"
-
-// Miranda database access
-#include <newpluginapi.h>
-#include <m_database.h>
-
-typedef struct
-{
- TCHAR FullName[256];
- char HomePhone[256];
- char OfficePhone[256];
- char HomePage[256];
- TCHAR City[256];
- TCHAR Province[256];
- BYTE Sex;
- SYSTEMTIME Birthday;
-} SkypeProfile;
-
-void SkypeProfile_Load(SkypeProfile *pstProf);
-void SkypeProfile_Save(SkypeProfile *pstProf);
-void SkypeProfile_Free(SkypeProfile *pstProf);
-void SkypeProfile_LoadFromSkype(SkypeProfile *pstProf);
-void SkypeProfile_SaveToSkype(SkypeProfile *pstProf);
diff --git a/protocols/SkypeClassic/src/skypeproxy/skypeproxy.c b/protocols/SkypeClassic/src/skypeproxy/skypeproxy.c deleted file mode 100644 index 200b79632a..0000000000 --- a/protocols/SkypeClassic/src/skypeproxy/skypeproxy.c +++ /dev/null @@ -1,651 +0,0 @@ -/*
-
-Purpose
-=======
-This program opens a connection on a local TCP/IP port and sends/
-receives Skype-API calls on it so that you can remote-control
-Skype over a network.
-Note, that there are currently NO SECURITY mechanisms, so don't
-use this over an untrusted network!
-
-Author
-======
-This program was written by leecher in 2005 (mailto:leecher@dose.0wnz.at)
-Please give feedback at http://forum.skype.com/viewtopic.php?t=16187
-
-Protocol
-========
-Basic protocol structure
-------------------------
-Sender and receiver have the same protocol:
-
- [(UINT)Length of message][(char[])Message]
-
-The Length is so that you can malloc() enough space for the data buffer
-to receive the next message.
-
-A special case is, if the [Length of message] is 0. In this case the
-client tells the server that he wants to switch to command mode.
-
-Command mode
-------------
-The server expects
-
- [(char)Command]
-
-next. Currently the following commands are supported:
-
- CAPABILITIES - returns the Server's capabilities
- AUTHENTICATE - Starts the authentication process
-
-CAPABILITIES
-------------
-The server returns
-
- [(char)Capabilities]
-
-where this currently can be the following:
-
- USE_AUTHENTICATION - The server supports and requires authentication
-
-AUTHENTICATE
-------------
-The server returns
-
- [(char)0x01]
-
-if authentication is supported AND needed (skypeproxy started with -k switch) or
-
- [(char)0x00]
-
-if this is not the case.
-If 0x01 was returned the server next expects a normal message
-(see "Basic protocol structure) containing the password.
-If the authentication was successful, the server replies with
-
- [(char)0x01]
-
-otherwise with
-
- [(char)0x00]
-
-PLEASE NOTE THAT THE AUTHENTICATION CURRENTLY IS PLAIN TEXT. SO DON'T
-USE THIS PROGRAM OVER AN UNTRUSTED NETWORK, OTHERWISE THERE MAY BE THE
-POSSIBILITY THAT SOMEONE SNIFFS YOUR PASSWORD!
-
-Code example
-------------
-
-SOCKET MySocket;
-
-int SendPacket(char *szSkypeMessage) {
- unsigned int length=strlen(szSkypeMsg);
-
- if (send(MySocket, (char *)&length, sizeof(length), 0)==SOCKET_ERROR ||
- send(MySocket, szSkypeMsg, length, 0)==SOCKET_ERROR)
- return -1;
- return 0;
-}
-
-// don't forget to free() the return value on my Heap!!
-char *ReceivePacket(void) {
- unsigned int lenght, received;
- char *buf;
-
- if ((received=recv(MySocket, (char *)&length, sizeof(length), 0))==SOCKET_ERROR ||
- received==0)
- return NULL;
- if (!(buf=calloc(1, length+1))) return NULL;
- if (recv(MySocket, buf, length, 0)==SOCKET_ERROR) {
- free(buf);
- return NULL;
- }
- return buf;
-}
-
-
-License
-=======
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program 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 General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-History
-========
-V1.0alpha - First preview release
-V1.0 - Implemented killing & restarting Skype process when it dies
- - BUGFIX: SendMessage() is a blocking call, if Skype hangs our app hangs too -> Fixed
- - Added command line parsing.
- - Renamed from Skype2Socket to skypeproxy
- - Added authentication feature.
-*/
-
-#include <stdio.h>
-#include <process.h>
-#include <windows.h>
-#include <signal.h>
-#include "skypeproxy.h"
-
-UINT ControlAPIAttach, ControlAPIDiscover;
-HWND hSkypeWnd=NULL, hWnd;
-HANDLE SkypeReady, ServerThreadBye;
-LONG AttachStatus=-1;
-int exitcode=EXIT_SUCCESS;
-char skype_path[MAX_PATH], *password=NULL;
-BYTE WatchDog=1;
-BOOL WatchDogRunning=FALSE, Authenticated=FALSE;
-SOCKET ListenSocket, AcceptSocket;
-
-
-void bail_out(int i) {
- OUTPUT("Got termination signal, bailing out.");
- if (i==1) exitcode=EXIT_FAILURE;
- PostMessage(hWnd, WM_QUIT, 0, 0);
-}
-
-BOOL CALLBACK TerminateAppEnum( HWND hwnd, LPARAM lParam ) {
- DWORD dwID ;
-
- GetWindowThreadProcessId(hwnd, &dwID) ;
- if(dwID == (DWORD)lParam)
- PostMessage(hwnd, WM_CLOSE, 0, 0) ; // May you be so kind to quit, please?
-
- return TRUE ;
-}
-
-/* ConnectToSkypeAPI
- *
- * Purpose: Establish a connection to the Skype API
- * Params : ForceRestart - Kill Skype if it's running before restarting
- * Returns: 0 - Connecting succeeded
- * -1 - Something went wrong
- */
-void ConnectToSkypeAPI(void *ForceRestart) {
- BOOL SkypeLaunched=FALSE;
- int counter=0, i, j;
- char *args[5];
- char *SkypeOptions[]={"/notray", "/nosplash", "/minimized"};
- char *szFuncName="ConnectToSkypeAPI";
-
- ResetEvent(SkypeReady);
- AttachStatus=-1;
- if ((BOOL)ForceRestart) {
- HANDLE hProc;
- DWORD dwPID=0;
-
- if (!hSkypeWnd) {
- OUTPUT("I can't kill Skype, as I don't even have its window handle!");
- return;
- }
- GetWindowThreadProcessId(hSkypeWnd, &dwPID);
- LOG(("%s: Shutting down Skype as it was not behaving the way it should...", szFuncName));
- if (hProc = OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, dwPID)) {
-
- // Try to shutdown Skype the nice way by asking it to close
- EnumWindows((WNDENUMPROC)TerminateAppEnum, (LPARAM) dwPID);
-
- if(WaitForSingleObject(hProc, 10000)!=WAIT_OBJECT_0) {
- // Try it the hard way by killing it
- LOG(("%s: I tried it the nice way, but you were not listening! Now DIIIIEEE!", szFuncName));
- if (!TerminateProcess(hProc,0)) {
- OUTPUT("Argh, process refused to die, it's too mighty for me, I've given up");
- CloseHandle(hProc);
- return;
- }
- LOG(("%s: Process killed! >:)", szFuncName));
- }
- CloseHandle(hProc);
- }
- }
- do {
- /* To initiate communication, Client should broadcast windows message
- ('SkypeControlAPIDiscover') to all windows in the system, specifying its own
- window handle in wParam parameter.
- */
- LOG(("%s: Sending discover message..", szFuncName));
- SendMessageTimeout(HWND_BROADCAST, ControlAPIDiscover, (WPARAM)hWnd, 0, SMTO_ABORTIFHUNG, 3000, NULL);
- LOG(("%s: Discover message sent, waiting for Skype to become ready..", szFuncName));
-
- /* In response, Skype responds with
- message 'SkypeControlAPIAttach' to the handle specified, and indicates
- connection status
- SkypeReady is set if there is an answer by Skype other than API_AVAILABLE.
- If there is no answer after 3 seconds, launch Skype as it's propably
- not running.
- */
- if (WaitForSingleObject(SkypeReady, 3000)==WAIT_TIMEOUT &&
- AttachStatus!=SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION)
- {
- if (hWnd==NULL) {
- LOG(("%s: hWnd of SkypeDispatchWindow not yet set..", szFuncName));
- continue;
- }
- if (!SkypeLaunched && skype_path) {
- LOG(("%s: Starting Skype, as it's not running", szFuncName));
- args[0]=skype_path;
- j=1;
- for (i=0; i<3; i++) {
- args[j]=SkypeOptions[i];
- LOG(("%s: Using Skype parameter: ", szFuncName, args[j]));
- j++;
- }
- args[j]=NULL;
- _spawnv(_P_NOWAIT, skype_path, args);
- ResetEvent(SkypeReady);
- SkypeLaunched=TRUE;
- LOG(("%s: Skype process started.", szFuncName));
- // Skype launching iniciated, keep sending Discover messages until it responds.
- continue;
- } else {
- LOG(("%s: Check if Skype was launchable..", szFuncName));
- if (!skype_path) {
- OUTPUT("There was no correct path for Skype application");
- bail_out(1);
- return;
- }
- LOG("%s: Trying to attach: #%d", szFuncName, counter));
- counter++;
- if (counter==5) {
- OUTPUT("ERROR: Skype not running / too old / working!");
- bail_out(1);
- return;
- }
- }
- }
- LOG(("%s: Attachstatus %d", szFuncName, AttachStatus));
- } while (AttachStatus==SKYPECONTROLAPI_ATTACH_API_AVAILABLE || AttachStatus==-1);
-
- while (AttachStatus==SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION) Sleep(1000);
- LOG(("%s: Attachstatus %d", szFuncName, AttachStatus));
- if (AttachStatus!=SKYPECONTROLAPI_ATTACH_SUCCESS) {
- switch(AttachStatus) {
- case SKYPECONTROLAPI_ATTACH_REFUSED:
- OUTPUT("Skype refused the connection :(");
- break;
- case SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE:
- OUTPUT("The Skype API is not available");
- break;
- default:
- LOG(("%s: ERROR: AttachStatus: %d", szFuncName, AttachStatus));
- OUTPUT("Wheee, Skype won't let me use the API. :(");
- }
- bail_out(1);
- return;
- }
- OUTPUT("Attached to Skype successfully.");
- if (!WatchDogRunning)
- if (_beginthread(WatchDogTimer, 0, NULL)==-1) {
- OUTPUT("Cannot start Watchdog.");
- bail_out(1);
- }
- return;
-}
-
-void SkypeSend(char *szMsg) {
- COPYDATASTRUCT CopyData;
- int count=0;
-
- if (!hSkypeWnd) {
- LOG(("SkypeSend: DAMN! No Skype window handle! :("));
- return;
- }
- if (mir_strcmp(szMsg, "PING")) {LOG(("> %s", szMsg));}
- CopyData.dwData=0;
- CopyData.lpData=szMsg;
- CopyData.cbData=strlen(szMsg)+1;
- while (!SendMessageTimeout(hSkypeWnd, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&CopyData, SMTO_ABORTIFHUNG, 3000, NULL)) {
- count++;
- LOG(("SkypeSend: failed, try #%d", count));
- if (count==5) {
- OUTPUT("Sending message to Skype failed too often.");
- OUTPUT("Skype may have died unexpectedly, I will try to restart it.");
- ConnectToSkypeAPI((void *)TRUE);
- OUTPUT("Restart complete. Trying to deliver message one more time.");
- if (!SendMessageTimeout(hSkypeWnd, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&CopyData, SMTO_ABORTIFHUNG, 3000, NULL)) {
- OUTPUT("It still failed. Skype seems to be completely f*cked up. I've given up. Bye..");
- bail_out(1);
- break;
- } else {
- OUTPUT("Now it worked! :)");
- break;
- }
- }
- Sleep(1000);
- }
-}
-
-void ServerThread(char *dummy) {
- unsigned int length, received;
- char *buf, command, reply;
-
- LOG(("ServerThread started"));
- AcceptSocket=INVALID_SOCKET;
- while( AcceptSocket == INVALID_SOCKET) {
- if ((AcceptSocket = accept( ListenSocket, NULL, NULL ))==INVALID_SOCKET) {
- LOG(("ServerThread: Byebye..."));
- SetEvent(ServerThreadBye);
- bail_out(1);
- return;
- }
- OUTPUT("Connection by client");
- while(1) {
- if ((received=recv(AcceptSocket, (char *)&length, sizeof(length), 0))==SOCKET_ERROR ||
- received==0)
- {
- OUTPUT("Connection was closed by client. See ya soon! :)");
- break;
- }
- // Command mode
- if (length==0) {
- reply=0;
- if (recv(AcceptSocket, (char *)&command, 1, 0)==SOCKET_ERROR) {
- OUTPUT("Connection to client was lost.");
- break;
- }
-#ifdef USE_AUTHENTICATION
- if (command==AUTHENTICATE)
- if (password) reply=0x01; // Ok, go ahead
- else command=0;
-#endif
- if (command==CAPABILITIES)
- reply=password?USE_AUTHENTICATION:0;
-
- if (send(AcceptSocket, (char *)&reply, 1, 0)==SOCKET_ERROR) {
- OUTPUT("Connection to client was lost.");
- break;
- }
- continue;
- }
- // Normal Skype API-call
- if (!(buf=calloc(1, length+1))) {
- OUTPUT("Out of memory error while allocating buffer space.");
- break;
- }
- if (recv(AcceptSocket, buf, length, 0)==SOCKET_ERROR) {
- OUTPUT("Connection to client was lost.");
- free(buf);
- break;
- }
- switch (command) {
-#ifdef USE_AUTHENTICATION
- case 0x01: // Compare hash
- if (password && !mir_strcmp(password, buf)) Authenticated=TRUE;
- else Authenticated=FALSE;
- if (Authenticated) {
- OUTPUT("User authenticated succesfully.");
- reply=1;
- } else {
- OUTPUT("User authentication failed!! (Intruder?)");
- reply=0;
- }
- if (send(AcceptSocket, (char *)&reply, 1, 0)==SOCKET_ERROR) {
- OUTPUT("Connection to client was lost.");
- break;
- }
- command=0;
- break;
-#endif
- default:
-#ifdef USE_AUTHENTICATION
- if (password && !Authenticated) break;
-#endif
- SkypeSend(buf);
- }
- command=0;
- free(buf);
- }
- AcceptSocket=INVALID_SOCKET;
-#ifdef USE_AUTHENTICATION
- Authenticated=FALSE;
-#endif
- }
-}
-
-
-void WatchDogTimer(char *dummy) {
- LOG(("WatchDogTimer started"));
- WatchDogRunning=TRUE;
- while (1) {
- Sleep(PING_INTERVAL);
- if (!WatchDog) {
- OUTPUT("Ouch.. It seems that Skype has died unexpectedly. Trying to restart.");
- ConnectToSkypeAPI((void *)TRUE);
- }
- WatchDog=0;
- SkypeSend("PING");
- }
-}
-
-LONG APIENTRY WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
-{
- PCOPYDATASTRUCT CopyData;
- char *szSkypeMsg=NULL;
-
- switch (message)
- {
- case WM_COPYDATA:
-// LOG("WM_COPYDATA", "start");
- if(hSkypeWnd==(HWND)wParam) {
- CopyData=(PCOPYDATASTRUCT)lParam;
- szSkypeMsg=strdup(CopyData->lpData);
- ReplyMessage(1);
- if (!mir_strcmp(szSkypeMsg, "PONG")) {
- WatchDog=1;
- break;
- } // Hide PING-PONG
- LOG(("< %s", szSkypeMsg));
- if (!mir_strcmp(szSkypeMsg, "USERSTATUS LOGGEDOUT")) {
- OUTPUT("Skype shut down gracefully. I'll leave too, bye.. :)");
- bail_out(1);
- }
-#ifdef USE_AUTHENTICATION
- if (password && !Authenticated) break;
-#endif
- if (AcceptSocket!=INVALID_SOCKET) {
- unsigned int length=strlen(szSkypeMsg);
-
- if (send(AcceptSocket, (char *)&length, sizeof(length), 0)==SOCKET_ERROR ||
- send(AcceptSocket, szSkypeMsg, length, 0)==SOCKET_ERROR)
- OUTPUT("Cannot send to client :(");
- }
- }
- break;
-
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
-
- default:
- if(message==ControlAPIAttach) {
- // Skype responds with Attach to the discover-message
- AttachStatus=lParam;
- if (AttachStatus==SKYPECONTROLAPI_ATTACH_SUCCESS)
- hSkypeWnd=(HWND)wParam; // Skype gave us the communication window handle
- if (AttachStatus!=SKYPECONTROLAPI_ATTACH_API_AVAILABLE)
- SetEvent(SkypeReady);
- break;
- }
- return (DefWindowProc(hWnd, message, wParam, lParam));
- }
-// LOG("WM_COPYDATA", "exit");
- if (szSkypeMsg) free(szSkypeMsg);
- return 1;
-}
-
-
-void TellError(DWORD err) {
- LPVOID lpMsgBuf;
-
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL);
- MessageBox( NULL, lpMsgBuf, "GetLastError", MB_OK|MB_ICONINFORMATION );
- LocalFree( lpMsgBuf );
- return;
-}
-
-int main(int argc, char *argv[]) {
- DWORD Buffsize;
- HKEY MyKey;
- BOOL SkypeInstalled=TRUE;
- MSG Message;
- WNDCLASS WndClass;
- SOCKADDR_IN service;
- WSADATA wsaData;
- int ExitCode=STILL_ACTIVE;
- unsigned short BindPort=1401;
- char BindIP[16]="0.0.0.0";
-
- printf("Skypeproxy V1.0, by leecher 2005 <leecher@dose.0wnz.at>\n\n");
-
- if (argc>1) {
- int i;
-
- if (!mir_strcmpi(argv[1], "-h") || !mir_strcmpi(argv[1], "--help") || !mir_strcmpi(argv[1], "/?")) {
- printf("Usage: %s [-i BindIP] [-p BindPort]", argv[0]);
-#ifdef USE_AUTHENTICATION
- printf(" [-k Password]");
-#endif
- printf("\n\n");
- return EXIT_SUCCESS;
- }
- for (i=0;i<argc;i++) {
- if (!mir_strcmpi(argv[i], "-i") && argc>i+1)
- strncpy(BindIP, argv[i+1], sizeof(BindIP));
- if (!mir_strcmpi(argv[i], "-p") && argc>i+1)
- if (!(BindPort=atoi(argv[i+1]))) {
- OUTPUT("ERROR: Cannot convert port to int. bye..");
- return EXIT_FAILURE;
- }
-#ifdef USE_AUTHENTICATION
- if (!mir_strcmpi(argv[i], "-k") && argc>i+1)
- password=strdup(argv[i+1]);
-#endif
- }
- }
-
- if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Skype\\Phone", 0, KEY_READ, &MyKey)!=ERROR_SUCCESS ||
- RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Skype\\Phone", 0, KEY_READ, &MyKey)!=ERROR_SUCCESS)
- SkypeInstalled=FALSE;
- Buffsize=sizeof(skype_path);
- if (SkypeInstalled==FALSE ||
- RegQueryValueEx(MyKey, "SkypePath", NULL, NULL, skype_path, &Buffsize)!=ERROR_SUCCESS) {
- OUTPUT("Skype was not found on this machine :(");
- RegCloseKey(MyKey);
- skype_path[0]=0;
- return EXIT_FAILURE;
- }
- RegCloseKey(MyKey);
-
- if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) {
- OUTPUT("Error at loading windows sockets.");
- return EXIT_FAILURE;
- }
-
- if ((ListenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {
- printf("* Error at creating socket(): Error %d", WSAGetLastError());
- return EXIT_FAILURE;
- }
-
- service.sin_family = AF_INET;
- service.sin_addr.s_addr = inet_addr(BindIP);
- service.sin_port = htons(BindPort);
-
- printf("* Binding to interface %s, Port %d..", BindIP, BindPort);
- if (bind( ListenSocket, (SOCKADDR*) &service, sizeof(service)) == SOCKET_ERROR ||
- listen( ListenSocket, 1 ) == SOCKET_ERROR)
- {
- OUTPUT("Failed.");
- closesocket(ListenSocket);
- return EXIT_FAILURE;
- }
- printf("OK\n");
-
-
- if (!(ControlAPIAttach=RegisterWindowMessage("SkypeControlAPIAttach")) ||
- !(ControlAPIDiscover=RegisterWindowMessage("SkypeControlAPIDiscover"))) {
- OUTPUT("Cannot register Windows message.");
- closesocket(ListenSocket);
- return EXIT_FAILURE;
- }
-
- // Create window class
- hSkypeWnd=NULL;
- WndClass.style = CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS;
- WndClass.lpfnWndProc = (WNDPROC)WndProc;
- WndClass.cbClsExtra = 0;
- WndClass.cbWndExtra = 0;
- WndClass.hInstance = NULL;
- WndClass.hIcon = NULL;
- WndClass.hCursor = NULL;
- WndClass.hbrBackground = NULL;
- WndClass.lpszMenuName = NULL;
- WndClass.lpszClassName = "SkypeApiDispatchWindow";
- RegisterClass(&WndClass);
- // Do not check the retval of RegisterClass, because on non-unicode
- // win98 it will fail, as it is a stub that returns false() there
-
- // Create main window
- hWnd=CreateWindowEx( WS_EX_APPWINDOW|WS_EX_WINDOWEDGE,
- "SkypeApiDispatchWindow", "", WS_BORDER|WS_SYSMENU|WS_MINIMIZEBOX,
- CW_USEDEFAULT, CW_USEDEFAULT, 128, 128, NULL, 0, (HINSTANCE)WndClass.hInstance, 0);
-
- if (!hWnd) {
- OUTPUT("Cannot create window.");
- TellError(GetLastError());
- closesocket(ListenSocket);
- CloseHandle(WndClass.hInstance);
- return EXIT_FAILURE;
- }
- ShowWindow(hWnd, 0);
- UpdateWindow(hWnd);
-
- if (!(SkypeReady=CreateEvent(NULL, TRUE, FALSE, NULL)) ||
- !(ServerThreadBye=CreateEvent(NULL, TRUE, FALSE, NULL))) {
- OUTPUT("Unable to create Mutex!");
- closesocket(ListenSocket);
- CloseHandle(WndClass.hInstance);
- return EXIT_FAILURE;
- }
-
- if (_beginthread(ConnectToSkypeAPI, 0, (void *)FALSE)==-1 ||
- _beginthread(ServerThread, 0, NULL)==-1) {
- OUTPUT("Cannot create thread. Bye..");
- closesocket(ListenSocket);
- CloseHandle(WndClass.hInstance);
- CloseHandle(SkypeReady);
- return EXIT_FAILURE;
- }
-
- signal(SIGINT, &bail_out);
- LOG(("Startup: Messagepump started.\nPress CTRL+C to terminate\n"));
-
- while (GetMessage(&Message, hWnd, 0, 0))
- {
- TranslateMessage(&Message);
- DispatchMessage(&Message);
- }
-
- LOG(("Shutdown: Messagepump stopped"));
-
- if (password) free(password);
- if (AcceptSocket != INVALID_SOCKET) closesocket(AcceptSocket);
- closesocket(ListenSocket);
- LOG(("Shutdown: Waiting for serverthread to quit..."));
- if (WaitForSingleObject(ServerThreadBye, 3000)==WAIT_TIMEOUT)
- {OUTPUT("Serverthread didn't terminate correctly, shutting down anyway...");}
- else
- {LOG(("ServerThread terminated"));}
- CloseHandle(WndClass.hInstance);
- CloseHandle(SkypeReady);
- return exitcode;
-}
\ No newline at end of file diff --git a/protocols/SkypeClassic/src/skypeproxy/skypeproxy.h b/protocols/SkypeClassic/src/skypeproxy/skypeproxy.h deleted file mode 100644 index 75a5de42ab..0000000000 --- a/protocols/SkypeClassic/src/skypeproxy/skypeproxy.h +++ /dev/null @@ -1,11 +0,0 @@ -/*** Program settings ***/
-#define USE_AUTHENTICATION 0x01 // Program supports authentication -> Comment to disable!
-#define USE_DATASLOTS 0x02 // Supports Commands >=3
-
-/*** Commands ***/
-#define AUTHENTICATE 0x01
-#define CAPABILITIES 0x02
-#define MY_CAPABILITIES 0x03
-#define OPEN_SLOT 0x04
-#define DATA_SLOT 0x05
-#define CLOSE_SLOT 0x06
diff --git a/protocols/SkypeClassic/src/skypeproxy/skypeproxy_int.h b/protocols/SkypeClassic/src/skypeproxy/skypeproxy_int.h deleted file mode 100644 index f40b0b0e81..0000000000 --- a/protocols/SkypeClassic/src/skypeproxy/skypeproxy_int.h +++ /dev/null @@ -1,32 +0,0 @@ -#include "skypeproxy.h"
-
-/*** Skype API ***/
-//Messages
-#define SKYPECONTROLAPI_ATTACH_SUCCESS 0
-#define SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION 1
-#define SKYPECONTROLAPI_ATTACH_REFUSED 2
-#define SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE 3
-#define SKYPECONTROLAPI_ATTACH_API_AVAILABLE 0x8001
-
-// Errors
-#define MISC_ERROR 1
-#define USER_NOT_FOUND 2
-#define USER_NOT_ONLINE 3
-#define USER_BLOCKED 4
-#define TYPE_UNSUPPORTED 5
-#define SENDER_NOT_FRIEND 6
-#define SENDER_NOT_AUTHORIZED 7
-
-
-/*** Debugging macros ***/
-#define OUTPUT(a) printf("* %s\n", a);
-#define LOG(x) printf x
-
-/*** Program settings ***/
-#define PING_INTERVAL 10000 // Ping every 10000 msec to see if Skype is still available
-
-/*** Sockets ***/
-#pragma comment(lib, "ws2_32")
-
-/*** Prototypes ***/
-void WatchDogTimer(void *);
\ No newline at end of file diff --git a/protocols/SkypeClassic/src/skypesvc.cpp b/protocols/SkypeClassic/src/skypesvc.cpp deleted file mode 100644 index 1d1d2821bf..0000000000 --- a/protocols/SkypeClassic/src/skypesvc.cpp +++ /dev/null @@ -1,175 +0,0 @@ -#define __SKYPESVC_C__
-#include "skype.h"
-#include "skypesvc.h"
-#include "skypeapi.h"
-#include "skypeopt.h"
-#include "contacts.h"
-#include "filexfer.h"
-
-// Exports
-SKYPE_SVCNAMES g_svcNames;
-
-//From skype.c
-extern BOOL bHasFileXfer;
-extern char protocol, g_szProtoName[];
-extern HINSTANCE hInst;
-
-void CreateProtoService(const char* szService, MIRANDASERVICE svc)
-{
- char str[MAXMODULELABELLENGTH];
- _snprintf(str, sizeof(str), "%s%s", SKYPE_PROTONAME, szService);
- CreateServiceFunction(str, svc);
-}
-
-#define CreateServiceName(srvce) _snprintf (g_svcNames.##srvce, sizeof(g_svcNames.##srvce), "%s/"#srvce, SKYPE_PROTONAME);
-
-void CreateServices(void)
-{
- CreateServiceName(ChatNew);
- CreateServiceName(SetAvatar);
- CreateServiceName(SendGuiFile);
- CreateServiceName(HoldCall);
- CreateServiceName(AnswerCall);
- CreateServiceName(ImportHistory);
- CreateServiceName(AddUser);
- CreateServiceName(SkypeOutCallUser);
- CreateServiceName(CallHangupUser);
- CreateServiceName(CallUser);
- CreateServiceName(BlockContact);
-
- CreateServiceFunction(SKYPE_CALL, SkypeCall);
- CreateServiceFunction(SKYPE_CALLHANGUP, SkypeCallHangup);
- CreateServiceFunction(SKYPEOUT_CALL, SkypeOutCall);
- CreateServiceFunction(SKYPE_HOLDCALL, SkypeHoldCall);
- CreateServiceFunction(SKYPE_ADDUSER, SkypeAdduserDlg);
- CreateServiceFunction(SKYPE_IMPORTHISTORY, ImportHistory);
- CreateServiceFunction(SKYPE_ANSWERCALL, SkypeAnswerCall);
- CreateServiceFunction(SKYPE_SENDFILE, SkypeSendGuiFile);
- CreateServiceFunction(SKYPE_SETAVATAR, SkypeSetAvatar);
- CreateServiceFunction(SKYPE_BLOCKCONTACT, SkypeBlockContact);
-
- CreateProtoService(PS_GETCAPS, SkypeGetCaps);
- CreateProtoService(PS_GETNAME, SkypeGetName);
- CreateProtoService(PS_LOADICON, SkypeLoadIcon);
- CreateProtoService(PS_SETSTATUS, SkypeSetStatus);
- CreateProtoService(PS_GETSTATUS, SkypeGetStatus);
- CreateProtoService(PS_ADDTOLIST, SkypeAddToList);
- CreateProtoService(PS_ADDTOLISTBYEVENT, SkypeAddToListByEvent);
- CreateProtoService(PS_BASICSEARCH, SkypeBasicSearch);
- CreateProtoService(PS_SEARCHBYEMAIL, SkypeBasicSearch);
-
- CreateProtoService(PSS_GETINFO, SkypeGetInfo);
- CreateProtoService(PSS_MESSAGE, SkypeSendMessage);
- CreateProtoService(PSR_MESSAGE, SkypeRecvMessage);
- CreateProtoService(PSS_USERISTYPING, SkypeUserIsTyping);
- CreateProtoService(PSS_AUTHREQUEST, SkypeSendAuthRequest);
- CreateProtoService(PSR_AUTH, SkypeRecvAuth);
- CreateProtoService(PS_AUTHALLOW, SkypeAuthAllow);
- CreateProtoService(PS_AUTHDENY, SkypeAuthDeny);
- CreateProtoService(PSR_FILE, SkypeRecvFile);
-
- CreateProtoService(PSS_FILEALLOW, SkypeFileAllow);
- CreateProtoService(PSS_FILEDENY, SkypeFileCancel);
- CreateProtoService(PSS_FILECANCEL, SkypeFileCancel);
- CreateProtoService(PSS_FILE, SkypeSendFile);
-
- CreateProtoService(PS_GETAVATARINFO, SkypeGetAvatarInfo);
- CreateProtoService(PS_GETAVATARCAPS, SkypeGetAvatarCaps);
- CreateProtoService(PS_GETMYAVATAR, SkypeGetAvatar);
- CreateProtoService(PS_SETMYAVATAR, SkypeSetAvatar);
-
- CreateProtoService(PS_SETAWAYMSG, SkypeSetAwayMessage);
- CreateProtoService(PSS_GETAWAYMSG, SkypeGetAwayMessage);
- CreateProtoService(PS_SETMYNICKNAME, SkypeSetNick);
-
- CreateProtoService(PSS_SKYPEAPIMSG, SkypeReceivedAPIMessage);
- CreateProtoService(SKYPE_REGPROXY, SkypeRegisterProxy);
-}
-
-void HookEvents(void)
-{
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
-
- //HookEvent(ME_CLIST_DOUBLECLICKED, ClistDblClick);
- HookEvent(ME_OPT_INITIALISE, RegisterOptions);
- HookEvent(ME_DB_CONTACT_ADDED,HookContactAdded);
- HookEvent(ME_DB_CONTACT_DELETED, HookContactDeleted );
- HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- HookEvent(ME_SYSTEM_OKTOEXIT, MirandaExit);
- HookEvent(ME_SYSTEM_PRESHUTDOWN, OkToExit);
-}
-
-void HookEventsLoaded(void)
-{
- // We cannot check for the TTB-service before this event gets fired... :-/
- HookEvent(ME_TTB_MODULELOADED, CreateTopToolbarButton);
- HookEvent(ME_USERINFO_INITIALISE, OnDetailsInit );
-}
-
-INT_PTR SkypeGetCaps(WPARAM wParam, LPARAM)
-{
- INT_PTR ret = 0;
-
- switch (wParam) {
- case PFLAGNUM_1:
- ret = PF1_BASICSEARCH | PF1_IM | PF1_MODEMSG | PF1_SEARCHBYEMAIL; // | PF1_AUTHREQ;
- if (protocol>=5) ret |= PF1_ADDSEARCHRES;
- if (bHasFileXfer) ret |= PF1_FILE;
- return ret;
-
- case PFLAGNUM_2:
- ret = PF2_ONLINE | PF2_SHORTAWAY | PF2_INVISIBLE | PF2_HEAVYDND;
-#ifdef MAPDND
- ret |= PF2_LIGHTDND | PF2_HEAVYDND;
-#endif
- if (!db_get_b(NULL, SKYPE_PROTONAME, "NoSkype3Stats", 0))
- ret |= PF2_LONGAWAY | PF2_FREECHAT;
- ret |= Proto_Status2Flag(db_get_dw(NULL, SKYPE_PROTONAME, "SkypeOutStatusMode", ID_STATUS_ONTHEPHONE));
- return ret;
-
- case PFLAGNUM_3:
- return PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE | PF2_IDLE;
- case PFLAGNUM_4:
- return PF4_FORCEAUTH | PF4_FORCEADDED | PF4_AVATARS | PF4_SUPPORTTYPING;
- case PFLAGNUM_5:
- return Proto_Status2Flag(db_get_dw(NULL, SKYPE_PROTONAME, "SkypeOutStatusMode", ID_STATUS_ONTHEPHONE));
- case PFLAG_UNIQUEIDTEXT:
- return (INT_PTR)Translate("Skype ID");
- case PFLAG_UNIQUEIDSETTING:
- return (INT_PTR) SKYPE_NAME;
- default:
- return 0;
- }
-}
-
-INT_PTR SkypeGetName(WPARAM wParam, LPARAM lParam)
-{
- if (lParam)
- {
- strncpy((char *)lParam, SKYPE_PROTONAME, wParam);
- return 0; // Success
- }
- return 1; // Failure
-}
-
-
-INT_PTR SkypeLoadIcon(WPARAM wParam,LPARAM)
-{
- UINT id;
-
- switch(wParam&0xFFFF) {
- case PLI_PROTOCOL: id=IDI_SKYPE; break; // IDI_MAIN is the main icon for the protocol
- default: return 0;
- }
- return (INT_PTR)LoadImage(hInst,MAKEINTRESOURCE(id),IMAGE_ICON,GetSystemMetrics(wParam&PLIF_SMALL?SM_CXSMICON:SM_CXICON),GetSystemMetrics(wParam&PLIF_SMALL?SM_CYSMICON:SM_CYICON),0);
-}
-
-INT_PTR SkypeGetAvatar(WPARAM wParam,LPARAM lParam)
-{
- DBVARIANT dbv;
- if (!db_get_s(NULL,SKYPE_PROTONAME, "AvatarFile", &dbv)){
- mir_strncpy((char*)wParam, dbv.pszVal, (int)lParam);
- db_free(&dbv);
- }
- return 0;
-}
diff --git a/protocols/SkypeClassic/src/skypesvc.h b/protocols/SkypeClassic/src/skypesvc.h deleted file mode 100644 index 6f67837bde..0000000000 --- a/protocols/SkypeClassic/src/skypesvc.h +++ /dev/null @@ -1,23 +0,0 @@ -#include <stdio.h>
-#include <windows.h>
-#include <commctrl.h>
-#include <process.h>
-#include <time.h>
-#include "resource.h"
-
-void CreateProtoService(const char* szService, MIRANDASERVICE svc);
-void HookEvents(void);
-void HookEventsLoaded(void);
-void CreateServices(void);
-INT_PTR SkypeLoadIcon(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeGetName(WPARAM wParam, LPARAM lParam);
-INT_PTR SkypeGetCaps(WPARAM wParam, LPARAM lParam);
-/* SkypeGetAvatar
- *
- * Purpose: Return the avatar file name
- * Params : wParam=0
- * lParam=0
- * Returns: 0 - Success
- * -1 - Failure
- */
-INT_PTR SkypeGetAvatar(WPARAM wParam,LPARAM lParam);
\ No newline at end of file diff --git a/protocols/SkypeClassic/src/utf8.cpp b/protocols/SkypeClassic/src/utf8.cpp deleted file mode 100644 index 32a77231b3..0000000000 --- a/protocols/SkypeClassic/src/utf8.cpp +++ /dev/null @@ -1,334 +0,0 @@ -/*
- * Copyright (C) 2001 Peter Harris <peter.harris@hummingbird.com>
- * Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*
- * Convert a string between UTF-8 and the locale's charset.
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "utf8.h"
-
-#ifdef _WIN32
-
- /* Thanks to Peter Harris <peter.harris@hummingbird.com> for this win32
- * code.
- */
-
-#include <stdio.h>
-#include <windows.h>
-
-unsigned char *make_utf8_string(const wchar_t *unicode)
-{
- int size = 0, index = 0, out_index = 0;
- unsigned char *out;
- unsigned short c;
-
- /* first calculate the size of the target string */
- c = unicode[index++];
- while(c) {
- if(c < 0x0080) {
- size += 1;
- } else if(c < 0x0800) {
- size += 2;
- } else {
- size += 3;
- }
- c = unicode[index++];
- }
-
- out = (unsigned char *) malloc(size + 1);
- if (out == NULL)
- return NULL;
- index = 0;
-
- c = unicode[index++];
- while(c)
- {
- if(c < 0x080) {
- out[out_index++] = (unsigned char)c;
- } else if(c < 0x800) {
- #pragma warning (suppress: 4244) // conversion from 'int' to 'unsigned char', possible loss of data
- out[out_index++] = 0xc0 | (c >> 6);
- out[out_index++] = 0x80 | (c & 0x3f);
- } else {
- out[out_index++] = 0xe0 | (c >> 12);
- out[out_index++] = 0x80 | ((c >> 6) & 0x3f);
- out[out_index++] = 0x80 | (c & 0x3f);
- }
- c = unicode[index++];
- }
- out[out_index] = 0x00;
-
- return out;
-}
-
-wchar_t *make_unicode_string(const unsigned char *utf8)
-{
- int size = 0, index = 0, out_index = 0;
- wchar_t *out;
- unsigned char c;
-
- /* first calculate the size of the target string */
- c = utf8[index++];
- while(c) {
- if((c & 0x80) == 0) {
- index += 0;
- } else if((c & 0xe0) == 0xe0) {
- index += 2;
- } else {
- index += 1;
- }
- size += 1;
- c = utf8[index++];
- }
-
- out = (wchar_t *) malloc((size + 1) * sizeof(wchar_t));
- if (out == NULL)
- return NULL;
- index = 0;
-
- c = utf8[index++];
- while(c)
- {
- if((c & 0x80) == 0) {
- out[out_index++] = c;
- } else if((c & 0xe0) == 0xe0) {
- out[out_index] = (c & 0x1F) << 12;
- c = utf8[index++];
- out[out_index] |= (c & 0x3F) << 6;
- c = utf8[index++];
- out[out_index++] |= (c & 0x3F);
- } else {
- out[out_index] = (c & 0x3F) << 6;
- c = utf8[index++];
- out[out_index++] |= (c & 0x3F);
- }
- c = utf8[index++];
- }
- out[out_index] = 0;
-
- return out;
-}
-
-int utf8_encode(const char *from, char **to)
-{
- wchar_t *unicode;
- int wchars, err;
-
- wchars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from, strlen(from), NULL, 0);
-
- if(wchars == 0)
- {
-// fprintf(stderr, "Unicode translation error %d\n"), GetLastError();
- return -1;
- }
-
- unicode = (wchar_t *) calloc(wchars + 1, sizeof(unsigned short));
- if(unicode == NULL)
- {
-// fprintf(stderr, "Out of memory processing string to UTF8\n");
- return -1;
- }
-
- err = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from, strlen(from), unicode, wchars);
- if(err != wchars)
- {
- free(unicode);
-// fprintf(stderr, "Unicode translation error %d\n"), GetLastError();
- return -1;
- }
-
- /* On NT-based windows systems, we could use WideCharToMultiByte(), but
- * MS doesn't actually have a consistent API across win32.
- */
- *to = (char *) make_utf8_string(unicode);
-
- free(unicode);
- return 0;
-}
-
-int utf8_decode(const char *from, char **to)
-{
- wchar_t *unicode;
- int chars, err;
-// LPCPINFO lpCPInfo;
-
- /* On NT-based windows systems, we could use MultiByteToWideChar(CP_UTF8), but
- * MS doesn't actually have a consistent API across win32.
- */
- unicode = make_unicode_string( (const unsigned char *)from);
- if(unicode == NULL)
- {
- fprintf(stderr, "Out of memory processing string from UTF8 to UNICODE16\n");
- return -1;
- }
-
- //if(GetCPInfo(CP_ACP,lpCPInfo))
- {
-
- chars = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, unicode, -1, NULL, 0, NULL, NULL);
- }
- /*else
- {
- chars = WideCharToMultiByte(GetConsoleCP(), WC_COMPOSITECHECK, unicode, -1, NULL, 0, NULL, NULL);
- }*/
-
- if(chars == 0)
- {
- fprintf(stderr, "Unicode translation error %ld\n", GetLastError());
- free(unicode);
- return -1;
- }
-
- *to = (char *) calloc(chars + 1, sizeof(unsigned char));
- if(*to == NULL)
- {
- fprintf(stderr, "Out of memory processing string to local charset\n");
- free(unicode);
- return -1;
- }
-
- //err = WideCharToMultiByte(GetConsoleCP(), WC_COMPOSITECHECK, unicode, -1, *to, chars, NULL, NULL);
- err = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, unicode, -1, *to, chars, NULL, NULL);
- if(err != chars)
- {
- fprintf(stderr, "Unicode translation error %ld\n", GetLastError());
- free(unicode);
- free(*to);
- *to = NULL;
- return -1;
- }
-
- free(unicode);
- return 0;
-}
-
-#ifndef _UNICODE
-char *make_tchar_string(const unsigned char *utf8) {
- char *ret;
- if (utf8_decode((const char*)utf8, &ret)==-1) return NULL;
- return ret;
-}
-#endif
-
-#else /* End win32. Rest is for real operating systems */
-
-
-#ifdef HAVE_LANGINFO_CODESET
-#include <langinfo.h>
-#endif
-
-int iconvert(const char *fromcode, const char *tocode,
- const char *from, size_t fromlen,
- char **to, size_t *tolen);
-
-static char *current_charset = "BIG-5"; /* means "US-ASCII" */
-
-void convert_set_charset(const char *charset)
-{
-
- if (!charset)
- charset = getenv("CHARSET");
-
-#ifdef HAVE_LANGINFO_CODESET
- if (!charset)
- charset = nl_langinfo(CODESET);
-#endif
-
- free(current_charset);
- current_charset = 0;
- if (charset && *charset)
- current_charset = _strdup(charset);
-}
-
-static int convert_buffer(const char *fromcode, const char *tocode,
- const char *from, size_t fromlen,
- char **to, size_t *tolen)
-{
- int ret = -1;
-
-#ifdef HAVE_ICONV
- ret = iconvert(fromcode, tocode, from, fromlen, to, tolen);
- if (ret != -1)
- return ret;
-#endif
-
-#ifndef HAVE_ICONV /* should be ifdef USE_CHARSET_CONVERT */
- ret = charset_convert(fromcode, tocode, from, fromlen, to, tolen);
- if (ret != -1)
- return ret;
-#endif
-
- return ret;
-}
-
-static int convert_string(const char *fromcode, const char *tocode,
- const char *from, char **to, char replace)
-{
- int ret;
- size_t fromlen;
- char *s;
-
- fromlen = mir_tstrlen(from);
- ret = convert_buffer(fromcode, tocode, from, fromlen, to, 0);
- if (ret == -2)
- return -1;
- if (ret != -1)
- return ret;
-
- s = malloc(fromlen + 1);
- if (!s)
- return -1;
- mir_tstrcpy(s, from);
- *to = s;
- for (; *s; s++)
- if (*s & ~0x7f)
- *s = replace;
- return 3;
-}
-
-int utf8_encode(const char *from, char **to)
-{
- char *charset;
-
- if (!current_charset)
- convert_set_charset(0);
- charset = current_charset ? current_charset : "US-ASCII";
- return convert_string(charset, "UTF-8", from, to, '#');
-}
-
-int utf8_decode(const char *from, char **to)
-{
- char *charset;
-
- if(*from == 0) {
- *to = malloc(1);
- **to = 0;
- return 1;
- }
-
- if (!current_charset)
- convert_set_charset(0);
- charset = current_charset ? current_charset : "US-ASCII";
- return convert_string("UTF-8", charset, from, to, '?');
-}
-
-#endif
diff --git a/protocols/SkypeClassic/src/utf8.h b/protocols/SkypeClassic/src/utf8.h deleted file mode 100644 index 70c533deca..0000000000 --- a/protocols/SkypeClassic/src/utf8.h +++ /dev/null @@ -1,47 +0,0 @@ -/*
- * Convert a string between UTF-8 and the locale's charset.
- * Invalid bytes are replaced by '#', and characters that are
- * not available in the target encoding are replaced by '?'.
- *
- * If the locale's charset is not set explicitly then it is
- * obtained using nl_langinfo(CODESET), where available, the
- * environment variable CHARSET, or assumed to be US-ASCII.
- *
- * Return value of conversion functions:
- *
- * -1 : memory allocation failed
- * 0 : data was converted exactly
- * 1 : valid data was converted approximately (using '?')
- * 2 : input was invalid (but still converted, using '#')
- * 3 : unknown encoding (but still converted, using '?')
- */
-
-#ifndef __UTF8_H
-#define __UTF8_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void convert_set_charset(const char *charset);
-
-int utf8_encode(const char *from, char **to);
-int utf8_decode(const char *from, char **to);
-wchar_t *make_unicode_string(const unsigned char *utf8);
-unsigned char *make_utf8_string(const wchar_t *unicode);
-#ifdef _UNICODE
-#define make_tchar_string make_unicode_string
-// Helpers for strings that only can contain 7bit chars to not make unneccessary memory allocation
-#define make_nonutf_tchar_string(x) make_tchar_string(x)
-#define free_nonutf_tchar_string(x) if(x) free(x);
-#else
-char *make_tchar_string(const unsigned char *utf8);
-#define make_nonutf_tchar_string(x) (char*)x
-#define free_nonutf_tchar_string(x)
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __UTF8_H */
diff --git a/protocols/SkypeClassic/src/util.cpp b/protocols/SkypeClassic/src/util.cpp deleted file mode 100644 index ce5ad9c756..0000000000 --- a/protocols/SkypeClassic/src/util.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include <stdlib.h>
-
-char * __cdecl strtok_r (
- char * string,
- const char * control,
- char **nextoken
- )
-{
- unsigned char *str;
- const unsigned char *ctrl = (const unsigned char*)control;
-
- unsigned char map[32];
- int count;
-
- /* Clear control map */
- for (count = 0; count < 32; count++)
- map[count] = 0;
-
- /* Set bits in delimiter table */
- do {
- map[*ctrl >> 3] |= (1 << (*ctrl & 7));
- } while (*ctrl++);
-
- /* Initialize str. If string is NULL, set str to the saved
- * pointer (i.e., continue breaking tokens out of the string
- * from the last strtok call) */
- if (string)
- str = (unsigned char*)string;
- else
- str = (unsigned char*)(*nextoken);
-
- /* Find beginning of token (skip over leading delimiters). Note that
- * there is no token iff this loop sets str to point to the terminal
- * null (*str == '\0') */
- while ( (map[*str >> 3] & (1 << (*str & 7))) && *str )
- str++;
-
- string = (char*)str;
-
- /* Find the end of the token. If it is not the end of the string,
- * put a null there. */
- for ( ; *str ; str++ )
- if ( map[*str >> 3] & (1 << (*str & 7)) ) {
- *str++ = '\0';
- break;
- }
-
- /* Update nextoken (or the corresponding field in the per-thread data
- * structure */
- *nextoken = (char*)str;
-
- /* Determine if a token has been found. */
- if ( string == (char*)str )
- return NULL;
- else
- return string;
-}
diff --git a/protocols/SkypeClassic/src/util.h b/protocols/SkypeClassic/src/util.h deleted file mode 100644 index 181f5d1878..0000000000 --- a/protocols/SkypeClassic/src/util.h +++ /dev/null @@ -1,7 +0,0 @@ -char * __cdecl strtok_r (
- char * string,
- const char * control,
- char **nextoken
- );
-
-void TranslateMirandaRelativePathToAbsolute(LPCSTR cszPath, LPSTR szAbsolutePath, BOOL fQuoteSpaces);
diff --git a/protocols/SkypeClassic/src/version.h b/protocols/SkypeClassic/src/version.h deleted file mode 100644 index 924d46bc23..0000000000 --- a/protocols/SkypeClassic/src/version.h +++ /dev/null @@ -1,14 +0,0 @@ -#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 0
-#define __RELEASE_NUM 0
-#define __BUILD_NUM 56
-
-#include <stdver.h>
-
-#define __PLUGIN_NAME "Skype protocol (Classic)"
-#define __FILENAME "SkypeClassic.dll"
-#define __DESCRIPTION "Skype protocol support for Miranda NG. Classic implementation which requires running original Skype client."
-#define __AUTHOR "leecher, tweety, jls17"
-#define __AUTHOREMAIL "leecher@dose.0wnz.at; tweety@user.berlios.de"
-#define __AUTHORWEB "http://miranda-ng.org/p/SkypeClassic/"
-#define __COPYRIGHT "© 2004-2014 leecher, tweety"
|