From d3087e6da133a1c0b7e6e63f4e6f54c027b9f58c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 4 Jun 2015 13:10:57 +0000 Subject: unified project for MSN git-svn-id: http://svn.miranda-ng.org/main/trunk@13997 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- bin10/mir_dev.sln | 2 +- bin10/mir_full.sln | 2 +- bin10/mir_full_pro.sln | 2 +- bin10/miranda32.sln | 2 +- bin12/mir_dev.sln | 2 +- bin12/mir_full.sln | 2 +- bin12/miranda32.sln | 2 +- protocols/MSN/msn.vcxproj | 33 ++ protocols/MSN/msn.vcxproj.filters | 4 + protocols/MSN/msn_10.vcxproj | 261 --------- protocols/MSN/msn_10.vcxproj.filters | 151 ------ protocols/MSN/msn_12.vcxproj | 263 --------- protocols/MSN/msn_12.vcxproj.filters | 151 ------ protocols/MSN/src/msn.cpp | 2 +- protocols/MSN/src/msn_auth.cpp | 2 +- protocols/MSN/src/msn_avatar.cpp | 2 +- protocols/MSN/src/msn_chat.cpp | 2 +- protocols/MSN/src/msn_commands.cpp | 6 +- protocols/MSN/src/msn_contact.cpp | 2 +- protocols/MSN/src/msn_errors.cpp | 2 +- protocols/MSN/src/msn_ftold.cpp | 2 +- protocols/MSN/src/msn_global.h | 992 ---------------------------------- protocols/MSN/src/msn_http.cpp | 2 +- protocols/MSN/src/msn_libstr.cpp | 4 +- protocols/MSN/src/msn_links.cpp | 2 +- protocols/MSN/src/msn_lists.cpp | 2 +- protocols/MSN/src/msn_mail.cpp | 2 +- protocols/MSN/src/msn_menu.cpp | 2 +- protocols/MSN/src/msn_mime.cpp | 2 +- protocols/MSN/src/msn_misc.cpp | 27 +- protocols/MSN/src/msn_msgqueue.cpp | 2 +- protocols/MSN/src/msn_msgsplit.cpp | 2 +- protocols/MSN/src/msn_natdetect.cpp | 2 +- protocols/MSN/src/msn_opts.cpp | 2 +- protocols/MSN/src/msn_p2p.cpp | 2 +- protocols/MSN/src/msn_p2ps.cpp | 2 +- protocols/MSN/src/msn_proto.cpp | 2 +- protocols/MSN/src/msn_skypeab.cpp | 2 +- protocols/MSN/src/msn_soapab.cpp | 2 +- protocols/MSN/src/msn_soapstore.cpp | 2 +- protocols/MSN/src/msn_srv.cpp | 2 +- protocols/MSN/src/msn_ssl.cpp | 2 +- protocols/MSN/src/msn_std.cpp | 2 +- protocols/MSN/src/msn_svcs.cpp | 2 +- protocols/MSN/src/msn_switchboard.cpp | 2 +- protocols/MSN/src/msn_threads.cpp | 2 +- protocols/MSN/src/msn_ws.cpp | 2 +- protocols/MSN/src/stdafx.cpp | 18 - protocols/MSN/src/stdafx.cxx | 18 + protocols/MSN/src/stdafx.h | 992 ++++++++++++++++++++++++++++++++++ 50 files changed, 1100 insertions(+), 1894 deletions(-) create mode 100644 protocols/MSN/msn.vcxproj create mode 100644 protocols/MSN/msn.vcxproj.filters delete mode 100644 protocols/MSN/msn_10.vcxproj delete mode 100644 protocols/MSN/msn_10.vcxproj.filters delete mode 100644 protocols/MSN/msn_12.vcxproj delete mode 100644 protocols/MSN/msn_12.vcxproj.filters delete mode 100644 protocols/MSN/src/msn_global.h delete mode 100644 protocols/MSN/src/stdafx.cpp create mode 100644 protocols/MSN/src/stdafx.cxx create mode 100644 protocols/MSN/src/stdafx.h diff --git a/bin10/mir_dev.sln b/bin10/mir_dev.sln index dcc6575399..ec20d3d13a 100644 --- a/bin10/mir_dev.sln +++ b/bin10/mir_dev.sln @@ -35,7 +35,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ICQ", "..\protocols\IcqOsca EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Jabber", "..\protocols\JabberG\jabber.vcxproj", "{33276462-8313-4192-8306-13717ECCA60A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSN", "..\protocols\MSN\msn_10.vcxproj", "{7B0F213E-C15E-4219-8AE5-49DD3D3D553D}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSN", "..\protocols\MSN\msn.vcxproj", "{7B0F213E-C15E-4219-8AE5-49DD3D3D553D}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Clist_nicer", "..\plugins\Clist_nicer\clist_nicer_10.vcxproj", "{3C42510C-A29E-4A53-899C-203BFA874E0B}" EndProject diff --git a/bin10/mir_full.sln b/bin10/mir_full.sln index 87f570cc7d..72090f4658 100644 --- a/bin10/mir_full.sln +++ b/bin10/mir_full.sln @@ -35,7 +35,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ICQ", "..\protocols\IcqOsca EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Jabber", "..\protocols\JabberG\jabber.vcxproj", "{33276462-8313-4192-8306-13717ECCA60A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSN", "..\protocols\MSN\msn_10.vcxproj", "{7B0F213E-C15E-4219-8AE5-49DD3D3D553D}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSN", "..\protocols\MSN\msn.vcxproj", "{7B0F213E-C15E-4219-8AE5-49DD3D3D553D}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Clist_nicer", "..\plugins\Clist_nicer\clist_nicer_10.vcxproj", "{3C42510C-A29E-4A53-899C-203BFA874E0B}" EndProject diff --git a/bin10/mir_full_pro.sln b/bin10/mir_full_pro.sln index 3bb6827b28..7016b77ab5 100644 --- a/bin10/mir_full_pro.sln +++ b/bin10/mir_full_pro.sln @@ -35,7 +35,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ICQ", "..\protocols\IcqOsca EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Jabber", "..\protocols\JabberG\jabber.vcxproj", "{33276462-8313-4192-8306-13717ECCA60A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSN", "..\protocols\MSN\msn_10.vcxproj", "{7B0F213E-C15E-4219-8AE5-49DD3D3D553D}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSN", "..\protocols\MSN\msn.vcxproj", "{7B0F213E-C15E-4219-8AE5-49DD3D3D553D}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Clist_nicer", "..\plugins\Clist_nicer\clist_nicer_10.vcxproj", "{3C42510C-A29E-4A53-899C-203BFA874E0B}" EndProject diff --git a/bin10/miranda32.sln b/bin10/miranda32.sln index e43c1faa0e..5cc66399b0 100644 --- a/bin10/miranda32.sln +++ b/bin10/miranda32.sln @@ -33,7 +33,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ICQ", "..\protocols\IcqOsca EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Jabber", "..\protocols\JabberG\jabber.vcxproj", "{33276462-8313-4192-8306-13717ECCA60A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSN", "..\protocols\MSN\msn_10.vcxproj", "{7B0F213E-C15E-4219-8AE5-49DD3D3D553D}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSN", "..\protocols\MSN\msn.vcxproj", "{7B0F213E-C15E-4219-8AE5-49DD3D3D553D}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Clist_nicer", "..\plugins\clist_nicer\clist_nicer_10.vcxproj", "{3C42510C-A29E-4A53-899C-203BFA874E0B}" EndProject diff --git a/bin12/mir_dev.sln b/bin12/mir_dev.sln index 02e647501f..a7d9effd67 100644 --- a/bin12/mir_dev.sln +++ b/bin12/mir_dev.sln @@ -37,7 +37,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ICQ", "..\protocols\IcqOsca EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Jabber", "..\protocols\JabberG\jabber.vcxproj", "{33276462-8313-4192-8306-13717ECCA60A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSN", "..\protocols\MSN\msn_12.vcxproj", "{7B0F213E-C15E-4219-8AE5-49DD3D3D553D}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSN", "..\protocols\MSN\msn.vcxproj", "{7B0F213E-C15E-4219-8AE5-49DD3D3D553D}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Clist_nicer", "..\plugins\Clist_nicer\clist_nicer_12.vcxproj", "{3C42510C-A29E-4A53-899C-203BFA874E0B}" EndProject diff --git a/bin12/mir_full.sln b/bin12/mir_full.sln index 8f84593b0c..09f104ad86 100644 --- a/bin12/mir_full.sln +++ b/bin12/mir_full.sln @@ -37,7 +37,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ICQ", "..\protocols\IcqOsca EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Jabber", "..\protocols\JabberG\jabber.vcxproj", "{33276462-8313-4192-8306-13717ECCA60A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSN", "..\protocols\MSN\msn_12.vcxproj", "{7B0F213E-C15E-4219-8AE5-49DD3D3D553D}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSN", "..\protocols\MSN\msn.vcxproj", "{7B0F213E-C15E-4219-8AE5-49DD3D3D553D}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Clist_nicer", "..\plugins\Clist_nicer\clist_nicer_12.vcxproj", "{3C42510C-A29E-4A53-899C-203BFA874E0B}" EndProject diff --git a/bin12/miranda32.sln b/bin12/miranda32.sln index f42745c45c..8c58594ebf 100644 --- a/bin12/miranda32.sln +++ b/bin12/miranda32.sln @@ -35,7 +35,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ICQ", "..\protocols\IcqOsca EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Jabber", "..\protocols\JabberG\jabber.vcxproj", "{33276462-8313-4192-8306-13717ECCA60A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSN", "..\protocols\MSN\msn_12.vcxproj", "{7B0F213E-C15E-4219-8AE5-49DD3D3D553D}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSN", "..\protocols\MSN\msn.vcxproj", "{7B0F213E-C15E-4219-8AE5-49DD3D3D553D}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Clist_nicer", "..\plugins\clist_nicer\clist_nicer_12.vcxproj", "{3C42510C-A29E-4A53-899C-203BFA874E0B}" EndProject diff --git a/protocols/MSN/msn.vcxproj b/protocols/MSN/msn.vcxproj new file mode 100644 index 0000000000..e481ff9d5c --- /dev/null +++ b/protocols/MSN/msn.vcxproj @@ -0,0 +1,33 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + MSN + {7B0F213E-C15E-4219-8AE5-49DD3D3D553D} + + + + + + + Sync + + + diff --git a/protocols/MSN/msn.vcxproj.filters b/protocols/MSN/msn.vcxproj.filters new file mode 100644 index 0000000000..a8ab01c0e5 --- /dev/null +++ b/protocols/MSN/msn.vcxproj.filters @@ -0,0 +1,4 @@ + + + + diff --git a/protocols/MSN/msn_10.vcxproj b/protocols/MSN/msn_10.vcxproj deleted file mode 100644 index f00b7fdd97..0000000000 --- a/protocols/MSN/msn_10.vcxproj +++ /dev/null @@ -1,261 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - MSN - {7B0F213E-C15E-4219-8AE5-49DD3D3D553D} - - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - true - - - - Disabled - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;MSN_EXPORTS;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - true - Fast - Use - msn_global.h - Level3 - EditAndContinue - 4996;%(DisableSpecificWarnings) - false - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include;..\..\include\msapi - - - ws2_32.lib;comctl32.lib;Rpcrt4.lib;%(AdditionalDependencies) - true - false - $(IntDir)$(TargetName).lib - Windows - 0x19000000 - $(ProfileDir)..\..\bin10\lib - - - - - Disabled - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;MSN_EXPORTS;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - true - Fast - Use - msn_global.h - 4996;%(DisableSpecificWarnings) - Level3 - false - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include;..\..\include\msapi - - - ws2_32.lib;comctl32.lib;Rpcrt4.lib;%(AdditionalDependencies) - type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) - true - false - $(IntDir)$(TargetName).lib - Windows - 0x19000000 - $(ProfileDir)..\..\bin10\lib - - - - - Full - OnlyExplicitInline - Size - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;MSN_EXPORTS;%(PreprocessorDefinitions) - true - false - false - true - Fast - Use - msn_global.h - Level3 - 4996;%(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include;..\..\include\msapi - - - /PDBALTPATH:%_PDB% - ws2_32.lib;comctl32.lib;Rpcrt4.lib;%(AdditionalDependencies) - type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) - true - true - true - 0x19000000 - false - $(IntDir)$(TargetName).lib - Windows - $(ProfileDir)..\..\bin10\lib - - - - - Full - OnlyExplicitInline - Size - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;MSN_EXPORTS;%(PreprocessorDefinitions) - true - false - false - true - Fast - Use - msn_global.h - Level3 - 4996;%(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include;..\..\include\msapi - - - /PDBALTPATH:%_PDB% - ws2_32.lib;comctl32.lib;Rpcrt4.lib;%(AdditionalDependencies) - type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) - true - true - true - 0x19000000 - false - $(IntDir)$(TargetName).lib - Windows - $(ProfileDir)..\..\bin10\lib - - - - - NotUsing - - - NotUsing - - - - - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/protocols/MSN/msn_10.vcxproj.filters b/protocols/MSN/msn_10.vcxproj.filters deleted file mode 100644 index b9585f0393..0000000000 --- a/protocols/MSN/msn_10.vcxproj.filters +++ /dev/null @@ -1,151 +0,0 @@ - - - - - {f9e2dbb2-638e-4619-a597-b259fe9cb28c} - cpp;c;cxx;rc;def;r;odl;idl;hpj;bat - - - {851bc859-759a-4ee2-a998-896565b85abc} - ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - - - {a696658a-8e44-4b58-b62e-1afe9b41c748} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Resource Files - - - Resource Files - - - - - Resource Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/protocols/MSN/msn_12.vcxproj b/protocols/MSN/msn_12.vcxproj deleted file mode 100644 index 1d13b54708..0000000000 --- a/protocols/MSN/msn_12.vcxproj +++ /dev/null @@ -1,263 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - MSN - {7B0F213E-C15E-4219-8AE5-49DD3D3D553D} - - - - DynamicLibrary - Unicode - true - v120_xp - - - DynamicLibrary - Unicode - v120_xp - - - DynamicLibrary - Unicode - true - v120_xp - - - DynamicLibrary - Unicode - v120_xp - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - true - - - - Disabled - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;MSN_EXPORTS;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - true - Fast - Use - msn_global.h - Level4 - EditAndContinue - 4996;%(DisableSpecificWarnings) - false - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include;..\..\include\msapi - - - ws2_32.lib;comctl32.lib;Rpcrt4.lib;%(AdditionalDependencies) - true - false - $(IntDir)$(TargetName).lib - Windows - 0x19000000 - $(ProfileDir)..\..\bin12\lib - false - - - - - Disabled - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;MSN_EXPORTS;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - true - Fast - Use - msn_global.h - 4996;%(DisableSpecificWarnings) - Level4 - false - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include;..\..\include\msapi - - - ws2_32.lib;comctl32.lib;Rpcrt4.lib;%(AdditionalDependencies) - type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) - true - false - $(IntDir)$(TargetName).lib - Windows - 0x19000000 - $(ProfileDir)..\..\bin12\lib - - - - - Full - OnlyExplicitInline - Size - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;MSN_EXPORTS;%(PreprocessorDefinitions) - true - false - false - true - Fast - Use - msn_global.h - Level4 - 4996;%(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include;..\..\include\msapi - - - ws2_32.lib;comctl32.lib;Rpcrt4.lib;%(AdditionalDependencies) - type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) - true - true - true - 0x19000000 - false - $(IntDir)$(TargetName).lib - Windows - $(ProfileDir)..\..\bin12\lib - - - - - Full - OnlyExplicitInline - Size - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;MSN_EXPORTS;%(PreprocessorDefinitions) - true - false - false - true - Fast - Use - msn_global.h - Level4 - 4996;%(DisableSpecificWarnings) - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include;..\..\include\msapi - - - ws2_32.lib;comctl32.lib;Rpcrt4.lib;%(AdditionalDependencies) - type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) - true - true - true - 0x19000000 - false - $(IntDir)$(TargetName).lib - Windows - $(ProfileDir)..\..\bin12\lib - - - - - NotUsing - - - NotUsing - - - - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/protocols/MSN/msn_12.vcxproj.filters b/protocols/MSN/msn_12.vcxproj.filters deleted file mode 100644 index b9585f0393..0000000000 --- a/protocols/MSN/msn_12.vcxproj.filters +++ /dev/null @@ -1,151 +0,0 @@ - - - - - {f9e2dbb2-638e-4619-a597-b259fe9cb28c} - cpp;c;cxx;rc;def;r;odl;idl;hpj;bat - - - {851bc859-759a-4ee2-a998-896565b85abc} - ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - - - {a696658a-8e44-4b58-b62e-1afe9b41c748} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Resource Files - - - Resource Files - - - - - Resource Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/protocols/MSN/src/msn.cpp b/protocols/MSN/src/msn.cpp index 1ddd57cb59..eec8390b96 100644 --- a/protocols/MSN/src/msn.cpp +++ b/protocols/MSN/src/msn.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" #include "version.h" diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index ac3640694f..325c903a94 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" #include "des.h" diff --git a/protocols/MSN/src/msn_avatar.cpp b/protocols/MSN/src/msn_avatar.cpp index 9ca0fbadc3..9df3cdee08 100644 --- a/protocols/MSN/src/msn_avatar.cpp +++ b/protocols/MSN/src/msn_avatar.cpp @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" void CMsnProto::AvatarQueue_Init() diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 4078b1bc65..396cb4aae2 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -21,7 +21,7 @@ along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" #include diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 35af58d3aa..8ee67673a7 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" void CMsnProto::MSN_SetMirVer(MCONTACT hContact, DWORD dwValue, bool always) @@ -463,7 +463,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) if (fileSize) { filetransfer* ft = new filetransfer(this); - char *pszFile; + char *pszFile = ""; ezxml_t originalName, desc; ft->std.hContact = hContact; @@ -903,7 +903,7 @@ LBL_InvalidCommand: } HReadBuffer buf(info, 0); - char* msgBody = (char*)buf.surelyRead(atol(data.strMsgBytes)); + buf.surelyRead(atol(data.strMsgBytes)); if (!bSentBND) { diff --git a/protocols/MSN/src/msn_contact.cpp b/protocols/MSN/src/msn_contact.cpp index 0683a6a628..b79ddcb6af 100644 --- a/protocols/MSN/src/msn_contact.cpp +++ b/protocols/MSN/src/msn_contact.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" MCONTACT CMsnProto::MSN_HContactFromEmail(const char* wlid, const char* msnNick, bool addIfNeeded, bool temporary) diff --git a/protocols/MSN/src/msn_errors.cpp b/protocols/MSN/src/msn_errors.cpp index 2a5752f9f7..e3a40a247c 100644 --- a/protocols/MSN/src/msn_errors.cpp +++ b/protocols/MSN/src/msn_errors.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" int CMsnProto::MSN_HandleErrors(ThreadData* info, char* cmdString) diff --git a/protocols/MSN/src/msn_ftold.cpp b/protocols/MSN/src/msn_ftold.cpp index aab87a0629..c5f6c3025b 100644 --- a/protocols/MSN/src/msn_ftold.cpp +++ b/protocols/MSN/src/msn_ftold.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" #ifdef OBSOLETE diff --git a/protocols/MSN/src/msn_global.h b/protocols/MSN/src/msn_global.h deleted file mode 100644 index 1ce626523e..0000000000 --- a/protocols/MSN/src/msn_global.h +++ /dev/null @@ -1,992 +0,0 @@ -/* -Plugin of Miranda IM for communicating with users of the MSN Messenger protocol. - -Copyright (c) 2012-2014 Miranda NG Team -Copyright (c) 2006-2011 Boris Krasnovskiy. -Copyright (c) 2003-2005 George Hazan. -Copyright (c) 2002-2003 Richard Hughes (original version). - -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, see . -*/ - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "m_proto_listeningto.h" -#include "m_folders.h" -#include "m_metacontacts.h" - -#include "ezxml.h" - -#include "resource.h" - -///////////////////////////////////////////////////////////////////////////////////////// -// MSN error codes - -#define ERR_SYNTAX_ERROR 200 -#define ERR_INVALID_PARAMETER 201 -#define ERR_INVALID_FEDERATED_USER 203 -#define ERR_UNROUTABLE_USER 204 -#define ERR_INVALID_USER 205 -#define ERR_FQDN_MISSING 206 -#define ERR_ALREADY_LOGIN 207 -#define ERR_INVALID_USERNAME 208 -#define ERR_INVALID_FRIENDLY_NAME 209 -#define ERR_LIST_FULL 210 -#define ERR_ALREADY_THERE 215 -#define ERR_NOT_ON_LIST 216 -#define ERR_NOT_ONLINE 217 -#define ERR_ALREADY_IN_THE_MODE 218 -#define ERR_ALREADY_IN_OPPOSITE_LIST 219 -#define ERR_NOT_ACCEPTING_PAGES 220 -#define ERR_INVALID_MSISDN 232 -#define ERR_UNKNOWN_MSISDN 233 -#define ERR_UNKNOWN_KEITAI_DOMAIN 234 -#define ERR_INVALID_XML_DATA 240 -#define ERR_DETAILED_ERR_IN_PAYLOAD 241 -#define ERR_SWITCHBOARD_FAILED 280 -#define ERR_NOTIFY_XFR_FAILED 281 -#define ERR_UNKNOWN_P2P_APP 282 -#define ERR_UNKNOWN_UUN_APP 283 -#define ERR_MESSAGE_TOO_LONG 285 -#define ERR_SMS_JUST_OUT_OF_FUNDS 290 -#define ERR_REQUIRED_FIELDS_MISSING 300 -#define ERR_NOT_LOGGED_IN 302 -#define ERR_ADDRESS_BOOK 403 -#define ERR_SMS_SUBSCRIPTION_REQUIRED 413 -#define ERR_SMS_SUBSCRIPTION_DISABLED 414 -#define ERR_SMS_OUT_OF_FUNDS 415 -#define ERR_SMS_DISABLED_MARKET 416 -#define ERR_SMS_DISABLED_GLOBAL 417 -#define ERR_TRY_AGAIN_LATER 418 -#define ERR_NO_MARKET_SPECIFIED 419 -#define ERR_INTERNAL_SERVER 500 -#define ERR_DB_SERVER 501 -#define ERR_UPSDOWN 504 -#define ERR_LIST_UNAVAILABLE 508 -#define ERR_PAGE_MODE_MESSAGE 509 -#define ERR_FILE_OPERATION 510 -#define ERR_DETAILED_ERR 511 -#define ERR_MEMORY_ALLOC 520 -#define ERR_OIM_NOT_SUPPORTED 537 -#define ERR_SMS_ACCOUNT_MUTED 550 -#define ERR_SMS_ACCOUNT_DISABLED 551 -#define ERR_SMS_ACCOUNT_MAXED 552 -#define ERR_SMS_INTERNAL_SERVER 580 -#define ERR_SMS_CARRIER_INVALID 590 -#define ERR_SMS_CARRIER_NO_ROUTE 591 -#define ERR_SMS_CARRIER_ERRORED 592 -#define ERR_SMS_ADDRESS_MAPPING_FULL 593 -#define ERR_SMS_INCORRECT_SOURCE_CTRY 594 -#define ERR_SMS_MOBILE_CACHE_FULL 595 -#define ERR_SMS_INCORRECT_FORMAT 596 -#define ERR_SMS_INVALID_TEXT 597 -#define ERR_SMS_MESSAGE_TOO_LONG 598 -#define ERR_SERVER_BUSY 600 -#define ERR_SERVER_UNAVAILABLE 601 -#define ERR_PEER_NS_DOWN 602 -#define ERR_DB_CONNECT 603 -#define ERR_SERVER_GOING_DOWN 604 -#define ERR_PAGING_UNAVAILABLE 606 -#define ERR_CREATE_CONNECTION 707 -#define ERR_INVALID_LOCALE 710 -#define ERR_BLOCKING_WRITE 711 -#define ERR_SESSION_OVERLOAD 712 -#define ERR_USER_TOO_ACTIVE 713 -#define ERR_TOO_MANY_SESSIONS 714 -#define ERR_NOT_EXPECTED 715 -#define ERR_BAD_FRIEND_FILE 717 -#define ERR_USER_RESTRICTED 718 -#define ERR_SESSION_FEDERATED 719 -#define ERR_USER_FEDERATED 726 -#define ERR_ROAMING_LOGOFF 733 -#define ERR_TOO_MANY_ENDPOINTS 734 -#define ERR_RATE_LIMIT_EXCEEDED 800 -#define ERR_PER_USER_LOGIN_LIMIT_EXCEED 803 -#define ERR_AUTHENTICATION_FAILED 911 -#define ERR_NOT_ALLOWED_WHEN_OFFLINE 913 -#define ERR_ACCOUNT_COMPROMISED 915 -#define ERR_NOT_ACCEPTING_NEW_USERS 920 -#define ERR_TIMEDOUT 921 -#define ERR_CHILD_WITHOUT_FULL_CONSENT 923 -#define ERR_EMAIL_ADDRESS_NOT_VERIFIED 924 -#define ERR_MGED_USER_LTD_ACC_WRONG_CLNT 926 -#define ERR_MGED_USER_ACCESS_DENIED 927 -#define ERR_AUTH 928 -#define ERR_DOMAIN_RESERVED 931 -#define ERR_INVALID_CONTACT_LIST 933 -#define ERR_INVALID_SIGNATURE 935 - -///////////////////////////////////////////////////////////////////////////////////////// -// Global definitions - -#define MSN_MAX_EMAIL_LEN 128 -#define MSN_GUID_LEN 40 - -#define MSN_PACKETS_COMBINE 7 -#define MSN_DEFAULT_PORT 443 -#define MSN_DEFAULT_GATEWAY_PORT 443 -const char MSN_DEFAULT_LOGIN_SERVER[] = "s.gateway.messenger.live.com"; -const char MSN_DEFAULT_GATEWAY[] = "geo.gateway.messenger.live.com"; -const char MSN_USER_AGENT[] = NETLIB_USER_AGENT; - -#define MSN_BLOCK "/BlockCommand" -#define MSN_INVITE "/InviteCommand" -#define MSN_NETMEETING "/NetMeeting" -#define MSN_VIEW_PROFILE "/ViewProfile" - -#define MS_GOTO_INBOX "/GotoInbox" -#define MS_EDIT_PROFILE "/EditProfile" -#define MS_EDIT_ALERTS "/EditAlerts" -#define MS_SET_NICKNAME_UI "/SetNicknameUI" - -extern const char sttVoidUid[]; - -///////////////////////////////////////////////////////////////////////////////////////// -// MSN plugin functions - -struct CMsnProto; - -#define MSN_ALLOW_MSGBOX 1 -#define MSN_ALLOW_ENTER 2 -#define MSN_HOTMAIL_POPUP 4 -#define MSN_SHOW_ERROR 8 -#define MSN_ALERT_POPUP 16 - -void HtmlDecode(char* str); -char* HtmlEncode(const char* str); -bool txtParseParam (const char* szData, const char* presearch, const char* start, const char* finish, char* param, const int size); -void stripBBCode(char* src); -void stripColorCode(char* src); -void stripHTML(char* str); -void parseWLID(char* wlid, char** net, char** email, char** inst); - -char* GetGlobalIp(void); - -template void UrlDecode(chartype* str); - -void __cdecl MSN_ConnectionProc(HANDLE hNewConnection, DWORD dwRemoteIP, void*); - -char* MSN_GetAvatarHash(char* szContext, char** pszUrl = NULL); -bool MSN_MsgWndExist(MCONTACT hContact); - -#define MSN_SendNickname(a) MSN_SendNicknameUtf(UTF8(a)) - -unsigned MSN_GenRandom(void); - -void MSN_InitContactMenu(void); -void MSN_RemoveContactMenus(void); - -HANDLE GetIconHandle(int iconId); -HICON LoadIconEx(const char* name, bool big = false); -void ReleaseIconEx(const char* name, bool big = false); - -void MsnInitIcons(void); - -int sttDivideWords(char* parBuffer, int parMinItems, char** parDest); -void MSN_MakeDigest(const char* chl, char* dgst); -char* getNewUuid(void); -time_t IsoToUnixTime(const char *stamp); -time_t MsnTSToUnixtime(const char *pszTS); - -TCHAR* EscapeChatTags(const TCHAR* pszText); -TCHAR* UnEscapeChatTags(TCHAR* str_in); - -void overrideStr(TCHAR*& dest, const TCHAR* src, bool unicode, const TCHAR* def = NULL); - -char* arrayToHex(BYTE* data, size_t datasz); - -inline unsigned short _htons(unsigned short s) -{ - return s>>8|s<<8; -} - -inline unsigned long _htonl(unsigned long s) -{ - return s<<24|(s&0xff00)<<8|((s>>8)&0xff00)|s>>24; -} - -inline unsigned __int64 _htonl64(unsigned __int64 s) -{ - return (unsigned __int64)_htonl(s & 0xffffffff) << 32 | _htonl(s >> 32); -} - -///////////////////////////////////////////////////////////////////////////////////////// -// Popup interface - -typedef struct _tag_PopupData -{ - unsigned flags; - char* url; - TCHAR* title; - TCHAR* text; - CMsnProto* proto; -} PopupData; - -struct STRLIST : public LIST -{ - static int compare(const char* p1, const char* p2) - { return _stricmp(p1, p2); } - - STRLIST() : LIST(2, compare) {} - ~STRLIST() { destroy(); } - - void destroy( void ) - { - for (int i=0; i < count; i++) - mir_free(items[i]); - - List_Destroy((SortedList*)this); - } - - int insertn(const char* p) { return insert(mir_strdup(p)); } - - int remove(int idx) - { - mir_free(items[idx]); - return List_Remove((SortedList*)this, idx); - } - - int remove(const char* p) - { - int idx; - return List_GetIndex((SortedList*)this, (char*)p, &idx) == 1 ? remove(idx) : -1; - } -}; - - -///////////////////////////////////////////////////////////////////////////////////////// -// MIME headers processing - -class MimeHeaders -{ -public: - - MimeHeaders(); - MimeHeaders(unsigned); - ~MimeHeaders(); - - void clear(void); - char* decodeMailBody(char* msgBody); - const char* find(const char* fieldName); - char* flipStr(const char* src, size_t len, char* dest); - size_t getLength(void); - char* readFromBuffer(char* src); - char* writeToBuffer(char* dest); - - void addString(const char* name, const char* szValue, unsigned flags = 0); - void addLong(const char* name, long lValue, unsigned flags = 0); - void addULong(const char* name, unsigned lValue); - void addBool(const char* name, bool lValue); - - const char* operator[](const char* fieldName) { return find(fieldName); } - - static wchar_t* decode(const char* val); - -private: - typedef struct tag_MimeHeader - { - const char* name; - const char* value; - unsigned flags; - } MimeHeader; - - unsigned mCount; - unsigned mAllocCount; - MimeHeader* mVals; - - unsigned allocSlot(void); -}; - -///////////////////////////////////////////////////////////////////////////////////////// -// File transfer helper - -struct ThreadData; - -struct HReadBuffer -{ - HReadBuffer(ThreadData* info, int iStart = 0); - ~HReadBuffer(); - - BYTE* surelyRead(size_t parBytes); - - ThreadData* owner; - BYTE* buffer; - size_t totalDataSize; - size_t startOffset; -}; - -enum TInfoType -{ - SERVER_NOTIFICATION, - SERVER_SWITCHBOARD, - SERVER_FILETRANS, - SERVER_P2P_DIRECT, - SERVER_HTTP -}; - - - -struct filetransfer -{ - filetransfer(CMsnProto* prt); - ~filetransfer(void); - - void close(void); - void complete(void); - int create(void); - int openNext(void); - - CMsnProto* proto; - - PROTOFILETRANSFERSTATUS std; - - bool bCanceled; // flag to interrupt a transfer - bool bCompleted; // was a FT ever completed? - bool bAccepted; // was a FT ever completed? - - int fileId; // handle of file being transferring (r/w) - - HANDLE hLockHandle; - HANDLE hResumeEvt; - - ThreadData *info; - TInfoType tType; - TInfoType tTypeReq; - time_t ts; - clock_t nNotify; - unsigned cf; - - bool p2p_waitack; // wait for ack - bool p2p_isV2; // P2P V2 - - unsigned p2p_sessionid; // session id - unsigned p2p_acksessid; // acknowledged session id - unsigned p2p_sendmsgid; // send message id - unsigned p2p_byemsgid; // bye message id - unsigned p2p_ackID; // number of ack's state - unsigned p2p_appID; // application id: 1 = avatar, 2 = file transfer - unsigned p2p_type; // application id: 1 = avatar, 2 = file transfer, 3 = custom emoticon - char* p2p_branch; // header Branch: field - char* p2p_callID; // header Call-ID: field - char* p2p_dest; // destination e-mail address - char* p2p_object; // MSN object for a transfer - - //---- receiving a file - char* szInvcookie; // cookie for receiving - - unsigned __int64 lstFilePtr; -}; - -struct directconnection -{ - directconnection(const char* CallID, const char* Wlid); - ~directconnection(); - - char* calcHashedNonce(UUID* nonce); - char* mNonceToText(void); - char* mNonceToHash(void) { return calcHashedNonce(mNonce); } - void xNonceToBin(UUID* nonce); - - UUID* mNonce; - char* xNonce; - - char* callId; - char* wlid; - - time_t ts; - - bool useHashedNonce; - bool bAccepted; - - CMsnProto* proto; -}; - - -#pragma pack(1) - -typedef struct _tag_HFileContext -{ - unsigned len; - unsigned ver; - unsigned __int64 dwSize; - unsigned type; - wchar_t wszFileName[MAX_PATH]; - char unknown[30]; - unsigned id; - char unknown2[64]; -} HFileContext; - -struct P2PB_Header -{ - virtual char* parseMsg(char *buf) = 0; - virtual char* createMsg(char *buf, const char* wlid, CMsnProto *ppro) = 0; - virtual bool isV2Hdr(void) = 0; - virtual void logHeader(CMsnProto *ppro) = 0; -}; - -struct P2P_Header : P2PB_Header -{ - unsigned mSessionID; - unsigned mID; - unsigned __int64 mOffset; - unsigned __int64 mTotalSize; - unsigned mPacketLen; - unsigned mFlags; - unsigned mAckSessionID; - unsigned mAckUniqueID; - unsigned __int64 mAckDataSize; - - P2P_Header() { memset(&mSessionID, 0, 48); } - P2P_Header(char *buf) { parseMsg(buf); } - - char* parseMsg(char *buf) { memcpy(&mSessionID, buf, 48); return buf + 48; } - char* createMsg(char *buf, const char* wlid, CMsnProto *ppro); - bool isV2Hdr(void) { return false; } - void logHeader(CMsnProto *ppro); -} ; - -struct P2PV2_Header : P2PB_Header -{ - unsigned mSessionID; - unsigned mID; - const char* mCap; - unsigned __int64 mRemSize; - unsigned mPacketLen; - unsigned mPacketNum; - unsigned mAckUniqueID; - unsigned char mOpCode; - unsigned char mTFCode; - - P2PV2_Header() { memset(&mSessionID, 0, ((char*)&mTFCode - (char*)&mSessionID) + sizeof(mTFCode)); } - P2PV2_Header(char *buf) { parseMsg(buf); } - - char* parseMsg(char *buf); - char* createMsg(char *buf, const char* wlid, CMsnProto *ppro); - bool isV2Hdr(void) { return true; } - void logHeader(CMsnProto *ppro); -}; - -#pragma pack() - -bool p2p_IsDlFileOk(filetransfer* ft); - -///////////////////////////////////////////////////////////////////////////////////////// -// Thread handling functions and datatypes - -#define MSG_DISABLE_HDR 1 -#define MSG_REQUIRE_ACK 2 -#define MSG_RTL 4 -#define MSG_OFFLINE 8 -#define MSG_CONTACT 16 -#define MSG_NUDGE 32 - -struct CMsnProto; -typedef void (__cdecl CMsnProto::*MsnThreadFunc)(void*); - -/* Groupchat threadlist entry. As there is no more SB in MSNP21+, - * this is no longer in ThreadData and there are no more new - * Threads, but for code compatibility, we still have ThreadData - * as a "main connection" - */ -struct GCUserItem -{ - char WLID[MSN_MAX_EMAIL_LEN]; - TCHAR role[8]; - BYTE btag; -}; - -struct GCThreadData -{ - GCThreadData(); - ~GCThreadData(); - - LIST mJoinedContacts; - GCUserItem* mCreator; - GCUserItem* mMe; - TCHAR mChatID[MSN_MAX_EMAIL_LEN]; - int netId; // from mChatID - char szEmail[MSN_MAX_EMAIL_LEN]; // frim mChatID -}; - -struct ThreadData -{ - ThreadData(); - ~ThreadData(); - - STRLIST mJoinedContactsWLID; - STRLIST mJoinedIdentContactsWLID; - char* mInitialContactWLID; - - TInfoType mType; // thread type - MsnThreadFunc mFunc; // thread entry point - char mServer[80]; // server name - char mState[128]; // state on XFR - - HANDLE s; // NetLib connection for the thread - HANDLE mIncomingBoundPort; // Netlib listen for the thread - HANDLE hWaitEvent; - WORD mIncomingPort; - TCHAR mChatID[10]; - bool mIsMainThread; - clock_t mWaitPeriod; - - CMsnProto* proto; - - //----| for gateways |---------------------------------------------------------------- - char mSessionID[50]; // Gateway session ID - char mGatewayIP[80]; // Gateway IP address - int mGatewayTimeout; - bool sessionClosed; - bool termPending; - bool gatewayType; - - //----| for switchboard servers only |------------------------------------------------ - bool firstMsgRecv; - int mCaller; - char mCookie[130]; // for switchboard servers only - LONG mTrid; // current message ID - UINT mTimerId; // typing notifications timer id - - //----| for file transfers only |----------------------------------------------------- - filetransfer* mMsnFtp; // file transfer block - bool mBridgeInit; - - //----| internal data buffer |-------------------------------------------------------- - int mBytesInData; // bytes available in data buffer - char *mData; // data buffer for connection - size_t mDataSize; - - //----| methods |--------------------------------------------------------------------- - void applyGatewayData(HANDLE hConn, bool isPoll); - void getGatewayUrl(char* dest, int destlen, bool isPoll); - void processSessionData(const char* xMsgr, const char* xHost); - void startThread(MsnThreadFunc , CMsnProto *prt); - - int send(const char data[], size_t datalen); - int recv(char* data, size_t datalen); - - void resetTimeout(bool term = false); - bool isTimeout(void); - - void sendTerminate(void); - void sendCaps(void); - int sendMessage(int msgType, const char* email, int netId, const char* msg, int parFlags); - int sendRawMessage(int msgType, const char* data, int datLen); - int sendPacket(const char* cmd, const char* fmt, ...); - int sendPacketPayload(const char* cmd, const char *param, const char* fmt, ...); - - int contactJoined(const char* email); - int contactLeft(const char* email); - MCONTACT getContactHandle(void); -}; - - -///////////////////////////////////////////////////////////////////////////////////////// -// MSN P2P session support - -#define MSN_APPID_AVATAR 1 -#define MSN_APPID_AVATAR2 12 -#define MSN_APPID_FILE 2 -#define MSN_APPID_WEBCAM 4 -#define MSN_APPID_MEDIA_SHARING 35 -#define MSN_APPID_IMAGE 33 - -#define MSN_APPID_CUSTOMSMILEY 3 -#define MSN_APPID_CUSTOMANIMATEDSMILEY 4 - -#define MSN_TYPEID_FTPREVIEW 0 -#define MSN_TYPEID_FTNOPREVIEW 1 -#define MSN_TYPEID_CUSTOMSMILEY 2 -#define MSN_TYPEID_DISPLAYPICT 3 -#define MSN_TYPEID_BKGNDSHARING 4 -#define MSN_TYPEID_BKGNDIMG 5 -#define MSN_TYPEID_WINK 8 - - - -inline bool IsChatHandle(MCONTACT hContact) { return (INT_PTR)hContact < 0; } - - -///////////////////////////////////////////////////////////////////////////////////////// -// Message queue - -#define MSGQUE_RAW 1 - -struct MsgQueueEntry -{ - char* wlid; - char* message; - filetransfer* ft; - STRLIST* cont; - int msgType; - int msgSize; - int seq; - int allocatedToThread; - time_t ts; - int flags; -}; - -///////////////////////////////////////////////////////////////////////////////////////// -// Avatars' queue - -struct AvatarQueueEntry -{ - MCONTACT hContact; - char *pszUrl; - - __forceinline AvatarQueueEntry(MCONTACT _contact, LPCSTR _url) : - hContact(_contact), - pszUrl( mir_strdup(_url)) - {} - - __forceinline ~AvatarQueueEntry() - { mir_free(pszUrl); - } -}; - -///////////////////////////////////////////////////////////////////////////////////////// -// User lists - -template< class T > int CompareId(const T* p1, const T* p2) -{ - return _stricmp(p1->id, p2->id); -} - -struct ServerGroupItem -{ - char* id; - char* name; // in UTF8 -}; - -struct MsnPlace -{ - char *id; - unsigned cap1; - unsigned cap2; - unsigned p2pMsgId; - unsigned short p2pPktNum; - - ~MsnPlace() { mir_free(id); } -}; - -struct MsnContact -{ - char *email; - char *invite; - char *nick; - MCONTACT hContact; - int list; - int netId; - int p2pMsgId; - unsigned cap1; - unsigned cap2; - - OBJLIST places; - - MsnContact() : places(1, CompareId) {} - ~MsnContact() { mir_free(email); mir_free(nick); mir_free(invite); } -}; - -#define cap_OnlineViaMobile 0x00000001 -#define cap_OnlineMSN8User 0x00000002 -#define cap_SupportsGifInk 0x00000004 -#define cap_SupportsIsfInk 0x00000008 -#define cap_WebCamDetected 0x00000010 -#define cap_SupportsChunking 0x00000020 -#define cap_MobileEnabled 0x00000040 -#define cap_WebWatchEnabled 0x00000080 -#define cap_SupportsActivities 0x00000100 -#define cap_OnlineViaWebIM 0x00000200 -#define cap_MobileDevice 0x00000400 -#define cap_OnlineViaTGW 0x00000800 -#define cap_HasSpace 0x00001000 -#define cap_IsMceUser 0x00002000 -#define cap_SupportsDirectIM 0x00004000 -#define cap_SupportsWinks 0x00008000 -#define cap_SupportsSharedSearch 0x00010000 -#define cap_IsBot 0x00020000 -#define cap_SupportsVoiceIM 0x00040000 -#define cap_SupportsSChannel 0x00080000 -#define cap_SupportsSipInvite 0x00100000 -#define cap_SupportsMultipartyMedia 0x00200000 -#define cap_SupportsSDrive 0x00400000 -#define cap_SupportsPageModeMessaging 0x00800000 -#define cap_HasOneCare 0x01000000 -#define cap_SupportsTurn 0x02000000 -#define cap_SupportsP2PBootstrap 0x04000000 -#define cap_UsingAlias 0x08000000 - -#define capex_IsSmsOnly 0x00000001 -#define capex_SupportsVoiceOverMsnp 0x00000002 -#define capex_SupportsUucpSipStack 0x00000004 -#define capex_SupportsApplicationMsg 0x00000008 -#define capex_RTCVideoEnabled 0x00000010 -#define capex_SupportsPeerToPeerV2 0x00000020 -#define capex_IsAuthWebIMUser 0x00000040 -#define capex_Supports1On1ViaGroup 0x00000080 -#define capex_SupportsOfflineIM 0x00000100 -#define capex_SupportsSharingVideo 0x00000200 -#define capex_SupportsNudges 0x00000400 -#define capex_CircleVoiceIMEnabled 0x00000800 -#define capex_SharingEnabled 0x00001000 -#define capex_MobileSuspendIMFanoutDisable 0x00002000 -#define capex_SupportsP2PMixerRelay 0x00008000 -#define capex_ConvWindowFileTransfer 0x00020000 -#define capex_VideoCallSupports16x9 0x00040000 -#define capex_SupportsP2PEnveloping 0x00080000 -#define capex_YahooIMDisabled 0x00400000 -#define capex_SIPTunnelVersion2 0x00800000 -#define capex_VoiceClipSupportsWMAFormat 0x01000000 -#define capex_VoiceClipSupportsCircleIM 0x02000000 -#define capex_SupportsSocialNewsObjectTypes 0x04000000 -#define capex_CustomEmoticonsCapable 0x08000000 -#define capex_SupportsUTF8MoodMessages 0x10000000 -#define capex_FTURNCapable 0x20000000 -#define capex_SupportsP4Activity 0x40000000 -#define capex_SupportsChats 0x80000000 - -#define capexex_SupportsMissedConversations 0x00000001 -#define capexex_SupportsShortCircuit 0x00000020 - -#define NETID_UNKNOWN 0 -#define NETID_MSN 1 -#define NETID_LCS 2 -#define NETID_ALIAS 3 -#define NETID_MOB 4 -#define NETID_DOMAIN 5 -#define NETID_SINK 6 -#define NETID_CONTACT 7 -#define NETID_SKYPE 8 -#define NETID_CIRCLE 9 -#define NETID_TMPCIRCLE 10 -#define NETID_CID 11 -#define NETID_APPID 12 -#define NETID_CONNECT 13 -#define NETID_REMOTE 14 -#define NETID_SMTP 16 -#define NETID_LVIDSINK 17 -#define NETID_MULTICAST 18 -#define NETID_THREAD 19 -#define NETID_1TO1TEXT 21 -#define NETID_GROUPTEXT 22 -#define NETID_BOT 28 -#define NETID_YAHOO 32 -#define NETID_PUBSUBTPC 33 -#define NETID_PUBSUBSUB 34 -#define NETID_WNSSID 35 - -#define LIST_FL 0x0001 -#define LIST_AL 0x0002 -#define LIST_BL 0x0004 -#define LIST_RL 0x0008 -#define LIST_PL 0x0010 -#define LIST_LL 0x0080 - -#define LIST_REMOVE 0x0100 -#define LIST_REMOVENH 0x0300 - -///////////////////////////////////////////////////////////////////////////////////////// -// MSN plugin options - -typedef struct _tag_MYOPTIONS -{ - bool EnableSounds; - - bool ShowErrorsAsPopups; - bool SlowSend; - bool ManageServer; - - char szEmail[MSN_MAX_EMAIL_LEN]; - int netId; - char szMachineGuid[MSN_GUID_LEN]; - char szMachineGuidP2P[MSN_GUID_LEN]; -} -MYOPTIONS; - -///////////////////////////////////////////////////////////////////////////////////////// -// Windows error class - -struct TWinErrorCode -{ - WINAPI TWinErrorCode(); - WINAPI ~TWinErrorCode(); - - char* WINAPI getText(); - - long mErrorCode; - char* mErrorText; -}; - -///////////////////////////////////////////////////////////////////////////////////////// -// External variables - -#define MSN_NUM_MODES 9 - -const char msnProtChallenge[] = "YMM8C_H7KCQ2S_KL"; -const char msnProductID[] = "PROD0090YUAUV{2B"; -const char msnAppID[] = "F6D2794D-501F-443A-ADBE-8F1490FF30FD"; -const int msnP24Ver = 2; -const char msnStoreAppId[] = "Skype"; -const char msnProductVer[] = "0/6.16.0.105/259/"; -const char msnProtID[] = "MSNP24"; - -extern HINSTANCE hInst; - -/////////////////////////////////////////////////////////////////////////////// -// UTF8 encode helper - -class UTFEncoder -{ -private: - char* m_body; - -public: - UTFEncoder(const char* pSrc) : - m_body(mir_utf8encode(pSrc)) {} - - UTFEncoder(const wchar_t* pSrc) : - m_body(mir_utf8encodeW(pSrc)) {} - - ~UTFEncoder() { mir_free(m_body); } - const char* str() const { return m_body; } -}; - -#define UTF8(A) UTFEncoder(A).str() - - -typedef enum _tag_ConEnum -{ - conUnknown, - conDirect, - conUnknownNAT, - conIPRestrictNAT, - conPortRestrictNAT, - conSymmetricNAT, - conFirewall, - conISALike -} ConEnum; - -#pragma pack(1) -typedef struct _tag_UDPProbePkt -{ - unsigned char version; - unsigned char serviceCode; - unsigned short clientPort; - unsigned clientIP; - unsigned short discardPort; - unsigned short testPort; - unsigned testIP; - unsigned trId; -} UDPProbePkt; -#pragma pack() - -extern const char* conStr[]; - -typedef struct _tag_MyConnectionType -{ - unsigned intIP; - unsigned extIP; - ConEnum udpConType; - ConEnum tcpConType; - unsigned weight; - bool upnpNAT; - bool icf; - - const IN_ADDR GetMyExtIP(void) { return *((PIN_ADDR)&extIP); } - const char* GetMyExtIPStr(void) { return inet_ntoa(GetMyExtIP()); } - const char* GetMyUdpConStr(void) { return conStr[udpConType]; } - void SetUdpCon(const char* str); - void CalculateWeight(void); -} MyConnectionType; - -struct chunkedmsg -{ - char* id; - char* msg; - size_t size; - size_t recvsz; - bool bychunk; - - chunkedmsg(const char* tid, const size_t totsz, const bool bychunk); - ~chunkedmsg(); - - void add(const char* msg, size_t offset, size_t portion); - bool get(char*& tmsg, size_t& tsize); -}; - -struct DeleteParam -{ - CMsnProto *proto; - MCONTACT hContact; -}; - -INT_PTR CALLBACK DlgDeleteContactUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - -struct InviteChatParam -{ - TCHAR* id; - MCONTACT hContact; - CMsnProto* ppro; - - InviteChatParam(const TCHAR* id, MCONTACT hContact, CMsnProto* ppro) - : id(mir_tstrdup(id)), hContact(hContact), ppro(ppro) {} - - ~InviteChatParam() - { mir_free(id); } -}; - -INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); \ No newline at end of file diff --git a/protocols/MSN/src/msn_http.cpp b/protocols/MSN/src/msn_http.cpp index 67200c11d0..d8e679ed6b 100644 --- a/protocols/MSN/src/msn_http.cpp +++ b/protocols/MSN/src/msn_http.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" static ThreadData* FindThreadConn(HANDLE hConn) diff --git a/protocols/MSN/src/msn_libstr.cpp b/protocols/MSN/src/msn_libstr.cpp index 78e9c66584..741ccb41b6 100644 --- a/protocols/MSN/src/msn_libstr.cpp +++ b/protocols/MSN/src/msn_libstr.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" static TCHAR* a2tf(const TCHAR* str, bool unicode) { @@ -331,6 +331,8 @@ TCHAR* UnEscapeChatTags(TCHAR* str_in) return str_in; } +#pragma comment(lib, "Rpcrt4.lib") + char* getNewUuid(void) { UUID id; diff --git a/protocols/MSN/src/msn_links.cpp b/protocols/MSN/src/msn_links.cpp index 066b8795ca..ad6489416d 100644 --- a/protocols/MSN/src/msn_links.cpp +++ b/protocols/MSN/src/msn_links.cpp @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" #include diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp index c9504c8011..b58e6c36a8 100644 --- a/protocols/MSN/src/msn_lists.cpp +++ b/protocols/MSN/src/msn_lists.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" #include "m_smileyadd.h" diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp index eb4242b1d7..87587e24d0 100644 --- a/protocols/MSN/src/msn_mail.cpp +++ b/protocols/MSN/src/msn_mail.cpp @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" static const char oimRecvUrl[] = "https://rsi.hotmail.com/rsi/rsi.asmx"; diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index 9cb69338a9..4ce5d8a9e7 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" static HGENMENU hBlockMenuItem, hLiveSpaceMenuItem, hNetmeetingMenuItem, hChatInviteMenuItem, hOpenInboxMenuItem; diff --git a/protocols/MSN/src/msn_mime.cpp b/protocols/MSN/src/msn_mime.cpp index 9d70aeba6e..1b5651794d 100644 --- a/protocols/MSN/src/msn_mime.cpp +++ b/protocols/MSN/src/msn_mime.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" ///////////////////////////////////////////////////////////////////////////////////////// // constructors and destructor diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index a0657fec04..6298102415 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" #include "version.h" @@ -432,7 +432,7 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha if ((parFlags & MSG_DISABLE_HDR) == 0) { char tFontName[100], tFontStyle[3], *pszMsgType, *pszContType; - DWORD tFontColor; + DWORD tFontColor = 0; if (parFlags & MSG_CONTACT) { pszMsgType = "RichText/Contacts"; @@ -471,10 +471,7 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha tFontColor = db_get_dw(NULL, "SRMsg", "Font0Col", 0); } - else { - tFontColor = 0; - tFontStyle[0] = 0; - } + else tFontStyle[0] = 0; #ifdef OBSOLETE if (parFlags & MSG_OFFLINE) @@ -495,17 +492,13 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha pszNick = dbv.pszVal; buf.AppendFormat( - "Messaging: 2.0\r\n" - "Client-Message-ID: %llu\r\n" - "Message-Type: %s\r\n" - "IM-Display-Name: %s\r\n" - "Content-Type: %s\r\n" - "Content-Length: %d\r\n", - msgid, - pszMsgType, - pszNick, - pszContType, - mir_strlen(parMsg)); + "Messaging: 2.0\r\n" + "Client-Message-ID: %llu\r\n" + "Message-Type: %s\r\n" + "IM-Display-Name: %s\r\n" + "Content-Type: %s\r\n" + "Content-Length: %d\r\n", + msgid, pszMsgType, pszNick, pszContType, mir_strlen(parMsg)); if (*tFontName) buf.AppendFormat("X-MMS-IM-Format: FN=%s; EF=%s; CO=%x; CS=0; PF=31%s\r\n", tFontName, tFontStyle, tFontColor, (parFlags & MSG_RTL) ? ";RL=1" : ""); diff --git a/protocols/MSN/src/msn_msgqueue.cpp b/protocols/MSN/src/msn_msgqueue.cpp index a8f3ebab2c..3a73f16271 100644 --- a/protocols/MSN/src/msn_msgqueue.cpp +++ b/protocols/MSN/src/msn_msgqueue.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" #ifdef OBSOLETE diff --git a/protocols/MSN/src/msn_msgsplit.cpp b/protocols/MSN/src/msn_msgsplit.cpp index 5f887a8585..efc1a42b39 100644 --- a/protocols/MSN/src/msn_msgsplit.cpp +++ b/protocols/MSN/src/msn_msgsplit.cpp @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" chunkedmsg::chunkedmsg(const char* tid, const size_t totsz, const bool tbychunk) diff --git a/protocols/MSN/src/msn_natdetect.cpp b/protocols/MSN/src/msn_natdetect.cpp index 3920feeaf9..5458b2853b 100644 --- a/protocols/MSN/src/msn_natdetect.cpp +++ b/protocols/MSN/src/msn_natdetect.cpp @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" #include #ifdef OBSOLETE diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index 83fbd42411..0df5ac0502 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" #include diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp index ef844191b4..12568c3e52 100644 --- a/protocols/MSN/src/msn_p2p.cpp +++ b/protocols/MSN/src/msn_p2p.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" #include "m_smileyadd.h" diff --git a/protocols/MSN/src/msn_p2ps.cpp b/protocols/MSN/src/msn_p2ps.cpp index 7d288f9e2f..1f94ed323d 100644 --- a/protocols/MSN/src/msn_p2ps.cpp +++ b/protocols/MSN/src/msn_p2ps.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" #ifdef OBSOLETE diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 9e8603def2..7cd17188fd 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" static const COLORREF crCols[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; diff --git a/protocols/MSN/src/msn_skypeab.cpp b/protocols/MSN/src/msn_skypeab.cpp index a30f0fe357..2b2d5dccc9 100644 --- a/protocols/MSN/src/msn_skypeab.cpp +++ b/protocols/MSN/src/msn_skypeab.cpp @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" #include diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp index e33a5d3ae8..48afb659bd 100644 --- a/protocols/MSN/src/msn_soapab.cpp +++ b/protocols/MSN/src/msn_soapab.cpp @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" static const char abReqHdr[] = "SOAPAction: http://www.msn.com/webservices/AddressBook/%s\r\n"; diff --git a/protocols/MSN/src/msn_soapstore.cpp b/protocols/MSN/src/msn_soapstore.cpp index b6bd4193b2..0b5db5c419 100644 --- a/protocols/MSN/src/msn_soapstore.cpp +++ b/protocols/MSN/src/msn_soapstore.cpp @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" static const char storeReqHdr[] = diff --git a/protocols/MSN/src/msn_srv.cpp b/protocols/MSN/src/msn_srv.cpp index 55826d5c59..c16d3ede40 100644 --- a/protocols/MSN/src/msn_srv.cpp +++ b/protocols/MSN/src/msn_srv.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/MSN/src/msn_ssl.cpp b/protocols/MSN/src/msn_ssl.cpp index a2fdb581b3..20964a1b23 100644 --- a/protocols/MSN/src/msn_ssl.cpp +++ b/protocols/MSN/src/msn_ssl.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" char* CMsnProto::getSslResult(char** parUrl, const char* parAuthInfo, const char* hdrs, unsigned& status) diff --git a/protocols/MSN/src/msn_std.cpp b/protocols/MSN/src/msn_std.cpp index 8950d469cb..c609a54391 100644 --- a/protocols/MSN/src/msn_std.cpp +++ b/protocols/MSN/src/msn_std.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp index 3ca83db2b0..b509b243f8 100644 --- a/protocols/MSN/src/msn_svcs.cpp +++ b/protocols/MSN/src/msn_svcs.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" extern int avsPresent; diff --git a/protocols/MSN/src/msn_switchboard.cpp b/protocols/MSN/src/msn_switchboard.cpp index 8bb2ab2c1a..ccef888bf5 100644 --- a/protocols/MSN/src/msn_switchboard.cpp +++ b/protocols/MSN/src/msn_switchboard.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" #ifdef OBSOLETE diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp index a28e381196..4cd7eb197a 100644 --- a/protocols/MSN/src/msn_threads.cpp +++ b/protocols/MSN/src/msn_threads.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/MSN/src/msn_ws.cpp b/protocols/MSN/src/msn_ws.cpp index 79c35ed56d..b887850164 100644 --- a/protocols/MSN/src/msn_ws.cpp +++ b/protocols/MSN/src/msn_ws.cpp @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "msn_global.h" +#include "stdafx.h" #include "msn_proto.h" //======================================================================================= diff --git a/protocols/MSN/src/stdafx.cpp b/protocols/MSN/src/stdafx.cpp deleted file mode 100644 index 8bf30e2bfd..0000000000 --- a/protocols/MSN/src/stdafx.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright (C) 2012-15 Miranda NG team (http://miranda-ng.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 version 2 -of the License. - -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, see . -*/ - -#include "msn_global.h" \ No newline at end of file diff --git a/protocols/MSN/src/stdafx.cxx b/protocols/MSN/src/stdafx.cxx new file mode 100644 index 0000000000..8aab1386be --- /dev/null +++ b/protocols/MSN/src/stdafx.cxx @@ -0,0 +1,18 @@ +/* +Copyright (C) 2012-15 Miranda NG team (http://miranda-ng.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 version 2 +of the License. + +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, see . +*/ + +#include "stdafx.h" \ No newline at end of file diff --git a/protocols/MSN/src/stdafx.h b/protocols/MSN/src/stdafx.h new file mode 100644 index 0000000000..1ce626523e --- /dev/null +++ b/protocols/MSN/src/stdafx.h @@ -0,0 +1,992 @@ +/* +Plugin of Miranda IM for communicating with users of the MSN Messenger protocol. + +Copyright (c) 2012-2014 Miranda NG Team +Copyright (c) 2006-2011 Boris Krasnovskiy. +Copyright (c) 2003-2005 George Hazan. +Copyright (c) 2002-2003 Richard Hughes (original version). + +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, see . +*/ + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "m_proto_listeningto.h" +#include "m_folders.h" +#include "m_metacontacts.h" + +#include "ezxml.h" + +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////////////////// +// MSN error codes + +#define ERR_SYNTAX_ERROR 200 +#define ERR_INVALID_PARAMETER 201 +#define ERR_INVALID_FEDERATED_USER 203 +#define ERR_UNROUTABLE_USER 204 +#define ERR_INVALID_USER 205 +#define ERR_FQDN_MISSING 206 +#define ERR_ALREADY_LOGIN 207 +#define ERR_INVALID_USERNAME 208 +#define ERR_INVALID_FRIENDLY_NAME 209 +#define ERR_LIST_FULL 210 +#define ERR_ALREADY_THERE 215 +#define ERR_NOT_ON_LIST 216 +#define ERR_NOT_ONLINE 217 +#define ERR_ALREADY_IN_THE_MODE 218 +#define ERR_ALREADY_IN_OPPOSITE_LIST 219 +#define ERR_NOT_ACCEPTING_PAGES 220 +#define ERR_INVALID_MSISDN 232 +#define ERR_UNKNOWN_MSISDN 233 +#define ERR_UNKNOWN_KEITAI_DOMAIN 234 +#define ERR_INVALID_XML_DATA 240 +#define ERR_DETAILED_ERR_IN_PAYLOAD 241 +#define ERR_SWITCHBOARD_FAILED 280 +#define ERR_NOTIFY_XFR_FAILED 281 +#define ERR_UNKNOWN_P2P_APP 282 +#define ERR_UNKNOWN_UUN_APP 283 +#define ERR_MESSAGE_TOO_LONG 285 +#define ERR_SMS_JUST_OUT_OF_FUNDS 290 +#define ERR_REQUIRED_FIELDS_MISSING 300 +#define ERR_NOT_LOGGED_IN 302 +#define ERR_ADDRESS_BOOK 403 +#define ERR_SMS_SUBSCRIPTION_REQUIRED 413 +#define ERR_SMS_SUBSCRIPTION_DISABLED 414 +#define ERR_SMS_OUT_OF_FUNDS 415 +#define ERR_SMS_DISABLED_MARKET 416 +#define ERR_SMS_DISABLED_GLOBAL 417 +#define ERR_TRY_AGAIN_LATER 418 +#define ERR_NO_MARKET_SPECIFIED 419 +#define ERR_INTERNAL_SERVER 500 +#define ERR_DB_SERVER 501 +#define ERR_UPSDOWN 504 +#define ERR_LIST_UNAVAILABLE 508 +#define ERR_PAGE_MODE_MESSAGE 509 +#define ERR_FILE_OPERATION 510 +#define ERR_DETAILED_ERR 511 +#define ERR_MEMORY_ALLOC 520 +#define ERR_OIM_NOT_SUPPORTED 537 +#define ERR_SMS_ACCOUNT_MUTED 550 +#define ERR_SMS_ACCOUNT_DISABLED 551 +#define ERR_SMS_ACCOUNT_MAXED 552 +#define ERR_SMS_INTERNAL_SERVER 580 +#define ERR_SMS_CARRIER_INVALID 590 +#define ERR_SMS_CARRIER_NO_ROUTE 591 +#define ERR_SMS_CARRIER_ERRORED 592 +#define ERR_SMS_ADDRESS_MAPPING_FULL 593 +#define ERR_SMS_INCORRECT_SOURCE_CTRY 594 +#define ERR_SMS_MOBILE_CACHE_FULL 595 +#define ERR_SMS_INCORRECT_FORMAT 596 +#define ERR_SMS_INVALID_TEXT 597 +#define ERR_SMS_MESSAGE_TOO_LONG 598 +#define ERR_SERVER_BUSY 600 +#define ERR_SERVER_UNAVAILABLE 601 +#define ERR_PEER_NS_DOWN 602 +#define ERR_DB_CONNECT 603 +#define ERR_SERVER_GOING_DOWN 604 +#define ERR_PAGING_UNAVAILABLE 606 +#define ERR_CREATE_CONNECTION 707 +#define ERR_INVALID_LOCALE 710 +#define ERR_BLOCKING_WRITE 711 +#define ERR_SESSION_OVERLOAD 712 +#define ERR_USER_TOO_ACTIVE 713 +#define ERR_TOO_MANY_SESSIONS 714 +#define ERR_NOT_EXPECTED 715 +#define ERR_BAD_FRIEND_FILE 717 +#define ERR_USER_RESTRICTED 718 +#define ERR_SESSION_FEDERATED 719 +#define ERR_USER_FEDERATED 726 +#define ERR_ROAMING_LOGOFF 733 +#define ERR_TOO_MANY_ENDPOINTS 734 +#define ERR_RATE_LIMIT_EXCEEDED 800 +#define ERR_PER_USER_LOGIN_LIMIT_EXCEED 803 +#define ERR_AUTHENTICATION_FAILED 911 +#define ERR_NOT_ALLOWED_WHEN_OFFLINE 913 +#define ERR_ACCOUNT_COMPROMISED 915 +#define ERR_NOT_ACCEPTING_NEW_USERS 920 +#define ERR_TIMEDOUT 921 +#define ERR_CHILD_WITHOUT_FULL_CONSENT 923 +#define ERR_EMAIL_ADDRESS_NOT_VERIFIED 924 +#define ERR_MGED_USER_LTD_ACC_WRONG_CLNT 926 +#define ERR_MGED_USER_ACCESS_DENIED 927 +#define ERR_AUTH 928 +#define ERR_DOMAIN_RESERVED 931 +#define ERR_INVALID_CONTACT_LIST 933 +#define ERR_INVALID_SIGNATURE 935 + +///////////////////////////////////////////////////////////////////////////////////////// +// Global definitions + +#define MSN_MAX_EMAIL_LEN 128 +#define MSN_GUID_LEN 40 + +#define MSN_PACKETS_COMBINE 7 +#define MSN_DEFAULT_PORT 443 +#define MSN_DEFAULT_GATEWAY_PORT 443 +const char MSN_DEFAULT_LOGIN_SERVER[] = "s.gateway.messenger.live.com"; +const char MSN_DEFAULT_GATEWAY[] = "geo.gateway.messenger.live.com"; +const char MSN_USER_AGENT[] = NETLIB_USER_AGENT; + +#define MSN_BLOCK "/BlockCommand" +#define MSN_INVITE "/InviteCommand" +#define MSN_NETMEETING "/NetMeeting" +#define MSN_VIEW_PROFILE "/ViewProfile" + +#define MS_GOTO_INBOX "/GotoInbox" +#define MS_EDIT_PROFILE "/EditProfile" +#define MS_EDIT_ALERTS "/EditAlerts" +#define MS_SET_NICKNAME_UI "/SetNicknameUI" + +extern const char sttVoidUid[]; + +///////////////////////////////////////////////////////////////////////////////////////// +// MSN plugin functions + +struct CMsnProto; + +#define MSN_ALLOW_MSGBOX 1 +#define MSN_ALLOW_ENTER 2 +#define MSN_HOTMAIL_POPUP 4 +#define MSN_SHOW_ERROR 8 +#define MSN_ALERT_POPUP 16 + +void HtmlDecode(char* str); +char* HtmlEncode(const char* str); +bool txtParseParam (const char* szData, const char* presearch, const char* start, const char* finish, char* param, const int size); +void stripBBCode(char* src); +void stripColorCode(char* src); +void stripHTML(char* str); +void parseWLID(char* wlid, char** net, char** email, char** inst); + +char* GetGlobalIp(void); + +template void UrlDecode(chartype* str); + +void __cdecl MSN_ConnectionProc(HANDLE hNewConnection, DWORD dwRemoteIP, void*); + +char* MSN_GetAvatarHash(char* szContext, char** pszUrl = NULL); +bool MSN_MsgWndExist(MCONTACT hContact); + +#define MSN_SendNickname(a) MSN_SendNicknameUtf(UTF8(a)) + +unsigned MSN_GenRandom(void); + +void MSN_InitContactMenu(void); +void MSN_RemoveContactMenus(void); + +HANDLE GetIconHandle(int iconId); +HICON LoadIconEx(const char* name, bool big = false); +void ReleaseIconEx(const char* name, bool big = false); + +void MsnInitIcons(void); + +int sttDivideWords(char* parBuffer, int parMinItems, char** parDest); +void MSN_MakeDigest(const char* chl, char* dgst); +char* getNewUuid(void); +time_t IsoToUnixTime(const char *stamp); +time_t MsnTSToUnixtime(const char *pszTS); + +TCHAR* EscapeChatTags(const TCHAR* pszText); +TCHAR* UnEscapeChatTags(TCHAR* str_in); + +void overrideStr(TCHAR*& dest, const TCHAR* src, bool unicode, const TCHAR* def = NULL); + +char* arrayToHex(BYTE* data, size_t datasz); + +inline unsigned short _htons(unsigned short s) +{ + return s>>8|s<<8; +} + +inline unsigned long _htonl(unsigned long s) +{ + return s<<24|(s&0xff00)<<8|((s>>8)&0xff00)|s>>24; +} + +inline unsigned __int64 _htonl64(unsigned __int64 s) +{ + return (unsigned __int64)_htonl(s & 0xffffffff) << 32 | _htonl(s >> 32); +} + +///////////////////////////////////////////////////////////////////////////////////////// +// Popup interface + +typedef struct _tag_PopupData +{ + unsigned flags; + char* url; + TCHAR* title; + TCHAR* text; + CMsnProto* proto; +} PopupData; + +struct STRLIST : public LIST +{ + static int compare(const char* p1, const char* p2) + { return _stricmp(p1, p2); } + + STRLIST() : LIST(2, compare) {} + ~STRLIST() { destroy(); } + + void destroy( void ) + { + for (int i=0; i < count; i++) + mir_free(items[i]); + + List_Destroy((SortedList*)this); + } + + int insertn(const char* p) { return insert(mir_strdup(p)); } + + int remove(int idx) + { + mir_free(items[idx]); + return List_Remove((SortedList*)this, idx); + } + + int remove(const char* p) + { + int idx; + return List_GetIndex((SortedList*)this, (char*)p, &idx) == 1 ? remove(idx) : -1; + } +}; + + +///////////////////////////////////////////////////////////////////////////////////////// +// MIME headers processing + +class MimeHeaders +{ +public: + + MimeHeaders(); + MimeHeaders(unsigned); + ~MimeHeaders(); + + void clear(void); + char* decodeMailBody(char* msgBody); + const char* find(const char* fieldName); + char* flipStr(const char* src, size_t len, char* dest); + size_t getLength(void); + char* readFromBuffer(char* src); + char* writeToBuffer(char* dest); + + void addString(const char* name, const char* szValue, unsigned flags = 0); + void addLong(const char* name, long lValue, unsigned flags = 0); + void addULong(const char* name, unsigned lValue); + void addBool(const char* name, bool lValue); + + const char* operator[](const char* fieldName) { return find(fieldName); } + + static wchar_t* decode(const char* val); + +private: + typedef struct tag_MimeHeader + { + const char* name; + const char* value; + unsigned flags; + } MimeHeader; + + unsigned mCount; + unsigned mAllocCount; + MimeHeader* mVals; + + unsigned allocSlot(void); +}; + +///////////////////////////////////////////////////////////////////////////////////////// +// File transfer helper + +struct ThreadData; + +struct HReadBuffer +{ + HReadBuffer(ThreadData* info, int iStart = 0); + ~HReadBuffer(); + + BYTE* surelyRead(size_t parBytes); + + ThreadData* owner; + BYTE* buffer; + size_t totalDataSize; + size_t startOffset; +}; + +enum TInfoType +{ + SERVER_NOTIFICATION, + SERVER_SWITCHBOARD, + SERVER_FILETRANS, + SERVER_P2P_DIRECT, + SERVER_HTTP +}; + + + +struct filetransfer +{ + filetransfer(CMsnProto* prt); + ~filetransfer(void); + + void close(void); + void complete(void); + int create(void); + int openNext(void); + + CMsnProto* proto; + + PROTOFILETRANSFERSTATUS std; + + bool bCanceled; // flag to interrupt a transfer + bool bCompleted; // was a FT ever completed? + bool bAccepted; // was a FT ever completed? + + int fileId; // handle of file being transferring (r/w) + + HANDLE hLockHandle; + HANDLE hResumeEvt; + + ThreadData *info; + TInfoType tType; + TInfoType tTypeReq; + time_t ts; + clock_t nNotify; + unsigned cf; + + bool p2p_waitack; // wait for ack + bool p2p_isV2; // P2P V2 + + unsigned p2p_sessionid; // session id + unsigned p2p_acksessid; // acknowledged session id + unsigned p2p_sendmsgid; // send message id + unsigned p2p_byemsgid; // bye message id + unsigned p2p_ackID; // number of ack's state + unsigned p2p_appID; // application id: 1 = avatar, 2 = file transfer + unsigned p2p_type; // application id: 1 = avatar, 2 = file transfer, 3 = custom emoticon + char* p2p_branch; // header Branch: field + char* p2p_callID; // header Call-ID: field + char* p2p_dest; // destination e-mail address + char* p2p_object; // MSN object for a transfer + + //---- receiving a file + char* szInvcookie; // cookie for receiving + + unsigned __int64 lstFilePtr; +}; + +struct directconnection +{ + directconnection(const char* CallID, const char* Wlid); + ~directconnection(); + + char* calcHashedNonce(UUID* nonce); + char* mNonceToText(void); + char* mNonceToHash(void) { return calcHashedNonce(mNonce); } + void xNonceToBin(UUID* nonce); + + UUID* mNonce; + char* xNonce; + + char* callId; + char* wlid; + + time_t ts; + + bool useHashedNonce; + bool bAccepted; + + CMsnProto* proto; +}; + + +#pragma pack(1) + +typedef struct _tag_HFileContext +{ + unsigned len; + unsigned ver; + unsigned __int64 dwSize; + unsigned type; + wchar_t wszFileName[MAX_PATH]; + char unknown[30]; + unsigned id; + char unknown2[64]; +} HFileContext; + +struct P2PB_Header +{ + virtual char* parseMsg(char *buf) = 0; + virtual char* createMsg(char *buf, const char* wlid, CMsnProto *ppro) = 0; + virtual bool isV2Hdr(void) = 0; + virtual void logHeader(CMsnProto *ppro) = 0; +}; + +struct P2P_Header : P2PB_Header +{ + unsigned mSessionID; + unsigned mID; + unsigned __int64 mOffset; + unsigned __int64 mTotalSize; + unsigned mPacketLen; + unsigned mFlags; + unsigned mAckSessionID; + unsigned mAckUniqueID; + unsigned __int64 mAckDataSize; + + P2P_Header() { memset(&mSessionID, 0, 48); } + P2P_Header(char *buf) { parseMsg(buf); } + + char* parseMsg(char *buf) { memcpy(&mSessionID, buf, 48); return buf + 48; } + char* createMsg(char *buf, const char* wlid, CMsnProto *ppro); + bool isV2Hdr(void) { return false; } + void logHeader(CMsnProto *ppro); +} ; + +struct P2PV2_Header : P2PB_Header +{ + unsigned mSessionID; + unsigned mID; + const char* mCap; + unsigned __int64 mRemSize; + unsigned mPacketLen; + unsigned mPacketNum; + unsigned mAckUniqueID; + unsigned char mOpCode; + unsigned char mTFCode; + + P2PV2_Header() { memset(&mSessionID, 0, ((char*)&mTFCode - (char*)&mSessionID) + sizeof(mTFCode)); } + P2PV2_Header(char *buf) { parseMsg(buf); } + + char* parseMsg(char *buf); + char* createMsg(char *buf, const char* wlid, CMsnProto *ppro); + bool isV2Hdr(void) { return true; } + void logHeader(CMsnProto *ppro); +}; + +#pragma pack() + +bool p2p_IsDlFileOk(filetransfer* ft); + +///////////////////////////////////////////////////////////////////////////////////////// +// Thread handling functions and datatypes + +#define MSG_DISABLE_HDR 1 +#define MSG_REQUIRE_ACK 2 +#define MSG_RTL 4 +#define MSG_OFFLINE 8 +#define MSG_CONTACT 16 +#define MSG_NUDGE 32 + +struct CMsnProto; +typedef void (__cdecl CMsnProto::*MsnThreadFunc)(void*); + +/* Groupchat threadlist entry. As there is no more SB in MSNP21+, + * this is no longer in ThreadData and there are no more new + * Threads, but for code compatibility, we still have ThreadData + * as a "main connection" + */ +struct GCUserItem +{ + char WLID[MSN_MAX_EMAIL_LEN]; + TCHAR role[8]; + BYTE btag; +}; + +struct GCThreadData +{ + GCThreadData(); + ~GCThreadData(); + + LIST mJoinedContacts; + GCUserItem* mCreator; + GCUserItem* mMe; + TCHAR mChatID[MSN_MAX_EMAIL_LEN]; + int netId; // from mChatID + char szEmail[MSN_MAX_EMAIL_LEN]; // frim mChatID +}; + +struct ThreadData +{ + ThreadData(); + ~ThreadData(); + + STRLIST mJoinedContactsWLID; + STRLIST mJoinedIdentContactsWLID; + char* mInitialContactWLID; + + TInfoType mType; // thread type + MsnThreadFunc mFunc; // thread entry point + char mServer[80]; // server name + char mState[128]; // state on XFR + + HANDLE s; // NetLib connection for the thread + HANDLE mIncomingBoundPort; // Netlib listen for the thread + HANDLE hWaitEvent; + WORD mIncomingPort; + TCHAR mChatID[10]; + bool mIsMainThread; + clock_t mWaitPeriod; + + CMsnProto* proto; + + //----| for gateways |---------------------------------------------------------------- + char mSessionID[50]; // Gateway session ID + char mGatewayIP[80]; // Gateway IP address + int mGatewayTimeout; + bool sessionClosed; + bool termPending; + bool gatewayType; + + //----| for switchboard servers only |------------------------------------------------ + bool firstMsgRecv; + int mCaller; + char mCookie[130]; // for switchboard servers only + LONG mTrid; // current message ID + UINT mTimerId; // typing notifications timer id + + //----| for file transfers only |----------------------------------------------------- + filetransfer* mMsnFtp; // file transfer block + bool mBridgeInit; + + //----| internal data buffer |-------------------------------------------------------- + int mBytesInData; // bytes available in data buffer + char *mData; // data buffer for connection + size_t mDataSize; + + //----| methods |--------------------------------------------------------------------- + void applyGatewayData(HANDLE hConn, bool isPoll); + void getGatewayUrl(char* dest, int destlen, bool isPoll); + void processSessionData(const char* xMsgr, const char* xHost); + void startThread(MsnThreadFunc , CMsnProto *prt); + + int send(const char data[], size_t datalen); + int recv(char* data, size_t datalen); + + void resetTimeout(bool term = false); + bool isTimeout(void); + + void sendTerminate(void); + void sendCaps(void); + int sendMessage(int msgType, const char* email, int netId, const char* msg, int parFlags); + int sendRawMessage(int msgType, const char* data, int datLen); + int sendPacket(const char* cmd, const char* fmt, ...); + int sendPacketPayload(const char* cmd, const char *param, const char* fmt, ...); + + int contactJoined(const char* email); + int contactLeft(const char* email); + MCONTACT getContactHandle(void); +}; + + +///////////////////////////////////////////////////////////////////////////////////////// +// MSN P2P session support + +#define MSN_APPID_AVATAR 1 +#define MSN_APPID_AVATAR2 12 +#define MSN_APPID_FILE 2 +#define MSN_APPID_WEBCAM 4 +#define MSN_APPID_MEDIA_SHARING 35 +#define MSN_APPID_IMAGE 33 + +#define MSN_APPID_CUSTOMSMILEY 3 +#define MSN_APPID_CUSTOMANIMATEDSMILEY 4 + +#define MSN_TYPEID_FTPREVIEW 0 +#define MSN_TYPEID_FTNOPREVIEW 1 +#define MSN_TYPEID_CUSTOMSMILEY 2 +#define MSN_TYPEID_DISPLAYPICT 3 +#define MSN_TYPEID_BKGNDSHARING 4 +#define MSN_TYPEID_BKGNDIMG 5 +#define MSN_TYPEID_WINK 8 + + + +inline bool IsChatHandle(MCONTACT hContact) { return (INT_PTR)hContact < 0; } + + +///////////////////////////////////////////////////////////////////////////////////////// +// Message queue + +#define MSGQUE_RAW 1 + +struct MsgQueueEntry +{ + char* wlid; + char* message; + filetransfer* ft; + STRLIST* cont; + int msgType; + int msgSize; + int seq; + int allocatedToThread; + time_t ts; + int flags; +}; + +///////////////////////////////////////////////////////////////////////////////////////// +// Avatars' queue + +struct AvatarQueueEntry +{ + MCONTACT hContact; + char *pszUrl; + + __forceinline AvatarQueueEntry(MCONTACT _contact, LPCSTR _url) : + hContact(_contact), + pszUrl( mir_strdup(_url)) + {} + + __forceinline ~AvatarQueueEntry() + { mir_free(pszUrl); + } +}; + +///////////////////////////////////////////////////////////////////////////////////////// +// User lists + +template< class T > int CompareId(const T* p1, const T* p2) +{ + return _stricmp(p1->id, p2->id); +} + +struct ServerGroupItem +{ + char* id; + char* name; // in UTF8 +}; + +struct MsnPlace +{ + char *id; + unsigned cap1; + unsigned cap2; + unsigned p2pMsgId; + unsigned short p2pPktNum; + + ~MsnPlace() { mir_free(id); } +}; + +struct MsnContact +{ + char *email; + char *invite; + char *nick; + MCONTACT hContact; + int list; + int netId; + int p2pMsgId; + unsigned cap1; + unsigned cap2; + + OBJLIST places; + + MsnContact() : places(1, CompareId) {} + ~MsnContact() { mir_free(email); mir_free(nick); mir_free(invite); } +}; + +#define cap_OnlineViaMobile 0x00000001 +#define cap_OnlineMSN8User 0x00000002 +#define cap_SupportsGifInk 0x00000004 +#define cap_SupportsIsfInk 0x00000008 +#define cap_WebCamDetected 0x00000010 +#define cap_SupportsChunking 0x00000020 +#define cap_MobileEnabled 0x00000040 +#define cap_WebWatchEnabled 0x00000080 +#define cap_SupportsActivities 0x00000100 +#define cap_OnlineViaWebIM 0x00000200 +#define cap_MobileDevice 0x00000400 +#define cap_OnlineViaTGW 0x00000800 +#define cap_HasSpace 0x00001000 +#define cap_IsMceUser 0x00002000 +#define cap_SupportsDirectIM 0x00004000 +#define cap_SupportsWinks 0x00008000 +#define cap_SupportsSharedSearch 0x00010000 +#define cap_IsBot 0x00020000 +#define cap_SupportsVoiceIM 0x00040000 +#define cap_SupportsSChannel 0x00080000 +#define cap_SupportsSipInvite 0x00100000 +#define cap_SupportsMultipartyMedia 0x00200000 +#define cap_SupportsSDrive 0x00400000 +#define cap_SupportsPageModeMessaging 0x00800000 +#define cap_HasOneCare 0x01000000 +#define cap_SupportsTurn 0x02000000 +#define cap_SupportsP2PBootstrap 0x04000000 +#define cap_UsingAlias 0x08000000 + +#define capex_IsSmsOnly 0x00000001 +#define capex_SupportsVoiceOverMsnp 0x00000002 +#define capex_SupportsUucpSipStack 0x00000004 +#define capex_SupportsApplicationMsg 0x00000008 +#define capex_RTCVideoEnabled 0x00000010 +#define capex_SupportsPeerToPeerV2 0x00000020 +#define capex_IsAuthWebIMUser 0x00000040 +#define capex_Supports1On1ViaGroup 0x00000080 +#define capex_SupportsOfflineIM 0x00000100 +#define capex_SupportsSharingVideo 0x00000200 +#define capex_SupportsNudges 0x00000400 +#define capex_CircleVoiceIMEnabled 0x00000800 +#define capex_SharingEnabled 0x00001000 +#define capex_MobileSuspendIMFanoutDisable 0x00002000 +#define capex_SupportsP2PMixerRelay 0x00008000 +#define capex_ConvWindowFileTransfer 0x00020000 +#define capex_VideoCallSupports16x9 0x00040000 +#define capex_SupportsP2PEnveloping 0x00080000 +#define capex_YahooIMDisabled 0x00400000 +#define capex_SIPTunnelVersion2 0x00800000 +#define capex_VoiceClipSupportsWMAFormat 0x01000000 +#define capex_VoiceClipSupportsCircleIM 0x02000000 +#define capex_SupportsSocialNewsObjectTypes 0x04000000 +#define capex_CustomEmoticonsCapable 0x08000000 +#define capex_SupportsUTF8MoodMessages 0x10000000 +#define capex_FTURNCapable 0x20000000 +#define capex_SupportsP4Activity 0x40000000 +#define capex_SupportsChats 0x80000000 + +#define capexex_SupportsMissedConversations 0x00000001 +#define capexex_SupportsShortCircuit 0x00000020 + +#define NETID_UNKNOWN 0 +#define NETID_MSN 1 +#define NETID_LCS 2 +#define NETID_ALIAS 3 +#define NETID_MOB 4 +#define NETID_DOMAIN 5 +#define NETID_SINK 6 +#define NETID_CONTACT 7 +#define NETID_SKYPE 8 +#define NETID_CIRCLE 9 +#define NETID_TMPCIRCLE 10 +#define NETID_CID 11 +#define NETID_APPID 12 +#define NETID_CONNECT 13 +#define NETID_REMOTE 14 +#define NETID_SMTP 16 +#define NETID_LVIDSINK 17 +#define NETID_MULTICAST 18 +#define NETID_THREAD 19 +#define NETID_1TO1TEXT 21 +#define NETID_GROUPTEXT 22 +#define NETID_BOT 28 +#define NETID_YAHOO 32 +#define NETID_PUBSUBTPC 33 +#define NETID_PUBSUBSUB 34 +#define NETID_WNSSID 35 + +#define LIST_FL 0x0001 +#define LIST_AL 0x0002 +#define LIST_BL 0x0004 +#define LIST_RL 0x0008 +#define LIST_PL 0x0010 +#define LIST_LL 0x0080 + +#define LIST_REMOVE 0x0100 +#define LIST_REMOVENH 0x0300 + +///////////////////////////////////////////////////////////////////////////////////////// +// MSN plugin options + +typedef struct _tag_MYOPTIONS +{ + bool EnableSounds; + + bool ShowErrorsAsPopups; + bool SlowSend; + bool ManageServer; + + char szEmail[MSN_MAX_EMAIL_LEN]; + int netId; + char szMachineGuid[MSN_GUID_LEN]; + char szMachineGuidP2P[MSN_GUID_LEN]; +} +MYOPTIONS; + +///////////////////////////////////////////////////////////////////////////////////////// +// Windows error class + +struct TWinErrorCode +{ + WINAPI TWinErrorCode(); + WINAPI ~TWinErrorCode(); + + char* WINAPI getText(); + + long mErrorCode; + char* mErrorText; +}; + +///////////////////////////////////////////////////////////////////////////////////////// +// External variables + +#define MSN_NUM_MODES 9 + +const char msnProtChallenge[] = "YMM8C_H7KCQ2S_KL"; +const char msnProductID[] = "PROD0090YUAUV{2B"; +const char msnAppID[] = "F6D2794D-501F-443A-ADBE-8F1490FF30FD"; +const int msnP24Ver = 2; +const char msnStoreAppId[] = "Skype"; +const char msnProductVer[] = "0/6.16.0.105/259/"; +const char msnProtID[] = "MSNP24"; + +extern HINSTANCE hInst; + +/////////////////////////////////////////////////////////////////////////////// +// UTF8 encode helper + +class UTFEncoder +{ +private: + char* m_body; + +public: + UTFEncoder(const char* pSrc) : + m_body(mir_utf8encode(pSrc)) {} + + UTFEncoder(const wchar_t* pSrc) : + m_body(mir_utf8encodeW(pSrc)) {} + + ~UTFEncoder() { mir_free(m_body); } + const char* str() const { return m_body; } +}; + +#define UTF8(A) UTFEncoder(A).str() + + +typedef enum _tag_ConEnum +{ + conUnknown, + conDirect, + conUnknownNAT, + conIPRestrictNAT, + conPortRestrictNAT, + conSymmetricNAT, + conFirewall, + conISALike +} ConEnum; + +#pragma pack(1) +typedef struct _tag_UDPProbePkt +{ + unsigned char version; + unsigned char serviceCode; + unsigned short clientPort; + unsigned clientIP; + unsigned short discardPort; + unsigned short testPort; + unsigned testIP; + unsigned trId; +} UDPProbePkt; +#pragma pack() + +extern const char* conStr[]; + +typedef struct _tag_MyConnectionType +{ + unsigned intIP; + unsigned extIP; + ConEnum udpConType; + ConEnum tcpConType; + unsigned weight; + bool upnpNAT; + bool icf; + + const IN_ADDR GetMyExtIP(void) { return *((PIN_ADDR)&extIP); } + const char* GetMyExtIPStr(void) { return inet_ntoa(GetMyExtIP()); } + const char* GetMyUdpConStr(void) { return conStr[udpConType]; } + void SetUdpCon(const char* str); + void CalculateWeight(void); +} MyConnectionType; + +struct chunkedmsg +{ + char* id; + char* msg; + size_t size; + size_t recvsz; + bool bychunk; + + chunkedmsg(const char* tid, const size_t totsz, const bool bychunk); + ~chunkedmsg(); + + void add(const char* msg, size_t offset, size_t portion); + bool get(char*& tmsg, size_t& tsize); +}; + +struct DeleteParam +{ + CMsnProto *proto; + MCONTACT hContact; +}; + +INT_PTR CALLBACK DlgDeleteContactUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + +struct InviteChatParam +{ + TCHAR* id; + MCONTACT hContact; + CMsnProto* ppro; + + InviteChatParam(const TCHAR* id, MCONTACT hContact, CMsnProto* ppro) + : id(mir_tstrdup(id)), hContact(hContact), ppro(ppro) {} + + ~InviteChatParam() + { mir_free(id); } +}; + +INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); \ No newline at end of file -- cgit v1.2.3