diff options
63 files changed, 2286 insertions, 0 deletions
diff --git a/MySpace/Debug (Unicode)/BuildLog.htm b/MySpace/Debug (Unicode)/BuildLog.htm Binary files differnew file mode 100644 index 0000000..8cc6727 --- /dev/null +++ b/MySpace/Debug (Unicode)/BuildLog.htm diff --git a/MySpace/Debug (Unicode)/MySpace.dll b/MySpace/Debug (Unicode)/MySpace.dll Binary files differnew file mode 100644 index 0000000..de8eb45 --- /dev/null +++ b/MySpace/Debug (Unicode)/MySpace.dll diff --git a/MySpace/Debug (Unicode)/MySpace.dll.intermediate.manifest b/MySpace/Debug (Unicode)/MySpace.dll.intermediate.manifest new file mode 100644 index 0000000..cdaa604 --- /dev/null +++ b/MySpace/Debug (Unicode)/MySpace.dll.intermediate.manifest @@ -0,0 +1,3 @@ +<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
+<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
+</assembly>
diff --git a/MySpace/Debug (Unicode)/MySpace.exp b/MySpace/Debug (Unicode)/MySpace.exp Binary files differnew file mode 100644 index 0000000..b04813d --- /dev/null +++ b/MySpace/Debug (Unicode)/MySpace.exp diff --git a/MySpace/Debug (Unicode)/MySpace.ilk b/MySpace/Debug (Unicode)/MySpace.ilk Binary files differnew file mode 100644 index 0000000..3f58702 --- /dev/null +++ b/MySpace/Debug (Unicode)/MySpace.ilk diff --git a/MySpace/Debug (Unicode)/MySpace.lib b/MySpace/Debug (Unicode)/MySpace.lib Binary files differnew file mode 100644 index 0000000..665454a --- /dev/null +++ b/MySpace/Debug (Unicode)/MySpace.lib diff --git a/MySpace/Debug (Unicode)/MySpace.obj b/MySpace/Debug (Unicode)/MySpace.obj Binary files differnew file mode 100644 index 0000000..856c965 --- /dev/null +++ b/MySpace/Debug (Unicode)/MySpace.obj diff --git a/MySpace/Debug (Unicode)/MySpace.pch b/MySpace/Debug (Unicode)/MySpace.pch Binary files differnew file mode 100644 index 0000000..e446ff6 --- /dev/null +++ b/MySpace/Debug (Unicode)/MySpace.pch diff --git a/MySpace/Debug (Unicode)/MySpace.pdb b/MySpace/Debug (Unicode)/MySpace.pdb Binary files differnew file mode 100644 index 0000000..2205025 --- /dev/null +++ b/MySpace/Debug (Unicode)/MySpace.pdb diff --git a/MySpace/Debug (Unicode)/NetMessage.obj b/MySpace/Debug (Unicode)/NetMessage.obj Binary files differnew file mode 100644 index 0000000..5ea42fc --- /dev/null +++ b/MySpace/Debug (Unicode)/NetMessage.obj diff --git a/MySpace/Debug (Unicode)/common.obj b/MySpace/Debug (Unicode)/common.obj Binary files differnew file mode 100644 index 0000000..fa18f52 --- /dev/null +++ b/MySpace/Debug (Unicode)/common.obj diff --git a/MySpace/Debug (Unicode)/menu.obj b/MySpace/Debug (Unicode)/menu.obj Binary files differnew file mode 100644 index 0000000..2d334d9 --- /dev/null +++ b/MySpace/Debug (Unicode)/menu.obj diff --git a/MySpace/Debug (Unicode)/mt.dep b/MySpace/Debug (Unicode)/mt.dep new file mode 100644 index 0000000..578b055 --- /dev/null +++ b/MySpace/Debug (Unicode)/mt.dep @@ -0,0 +1 @@ +Manifest resource last updated at 2:33:18.68 on Thu 28/06/2007
diff --git a/MySpace/Debug (Unicode)/net.obj b/MySpace/Debug (Unicode)/net.obj Binary files differnew file mode 100644 index 0000000..fc0bada --- /dev/null +++ b/MySpace/Debug (Unicode)/net.obj diff --git a/MySpace/Debug (Unicode)/options.obj b/MySpace/Debug (Unicode)/options.obj Binary files differnew file mode 100644 index 0000000..4c7a648 --- /dev/null +++ b/MySpace/Debug (Unicode)/options.obj diff --git a/MySpace/Debug (Unicode)/proto.obj b/MySpace/Debug (Unicode)/proto.obj Binary files differnew file mode 100644 index 0000000..13ee2e6 --- /dev/null +++ b/MySpace/Debug (Unicode)/proto.obj diff --git a/MySpace/Debug (Unicode)/resource.res b/MySpace/Debug (Unicode)/resource.res Binary files differnew file mode 100644 index 0000000..7d09e64 --- /dev/null +++ b/MySpace/Debug (Unicode)/resource.res diff --git a/MySpace/Debug (Unicode)/server_con.obj b/MySpace/Debug (Unicode)/server_con.obj Binary files differnew file mode 100644 index 0000000..0cda072 --- /dev/null +++ b/MySpace/Debug (Unicode)/server_con.obj diff --git a/MySpace/Debug (Unicode)/vc80.idb b/MySpace/Debug (Unicode)/vc80.idb Binary files differnew file mode 100644 index 0000000..fd75275 --- /dev/null +++ b/MySpace/Debug (Unicode)/vc80.idb diff --git a/MySpace/Debug (Unicode)/vc80.pdb b/MySpace/Debug (Unicode)/vc80.pdb Binary files differnew file mode 100644 index 0000000..2926416 --- /dev/null +++ b/MySpace/Debug (Unicode)/vc80.pdb diff --git a/MySpace/MySpace.cpp b/MySpace/MySpace.cpp new file mode 100644 index 0000000..39540df --- /dev/null +++ b/MySpace/MySpace.cpp @@ -0,0 +1,87 @@ +/* Replace "dll.h" with the name of your header */
+#include "common.h"
+#include "version.h"
+#include "resource.h"
+#include "options.h"
+#include "proto.h"
+#include "net.h"
+#include "menu.h"
+
+///////////////////////////////////////////////
+// Common Plugin Stuff
+///////////////////////////////////////////////
+HINSTANCE hInst;
+PLUGINLINK *pluginLink;
+HANDLE mainThread;
+
+PLUGININFOEX pluginInfo={
+ sizeof(PLUGININFOEX),
+ __PLUGIN_NAME,
+ PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
+ __DESC,
+ __AUTHOR,
+ __AUTHOREMAIL,
+ __COPYRIGHT,
+ __AUTHORWEB,
+ UNICODE_AWARE,
+ 0,
+ { 0xA0D1D7B2, 0x6B1, 0x437D, { 0x84, 0x91, 0xA7, 0x46, 0x58, 0xB9, 0x63, 0x70 } }
+};
+
+
+extern "C" BOOL APIENTRY DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) {
+ hInst=hinstDLL;
+ return TRUE;
+}
+
+extern "C" __declspec (dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) {
+ return &pluginInfo;
+}
+
+
+// uncomment this for pre 0.7 compatibility
+extern "C" __declspec (dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion) {
+ pluginInfo.cbSize = sizeof(PLUGININFO);
+ return (PLUGININFO*)&pluginInfo;
+}
+
+static const MUUID interfaces[] = {MIID_PROTOCOL, MIID_LAST};
+extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
+{
+ return interfaces;
+}
+
+int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
+ InitNetlib();
+ InitMenu();
+
+ return 0;
+}
+
+HANDLE hModulesLoaded;
+extern "C" __declspec (dllexport) int Load(PLUGINLINK *link) {
+ DuplicateHandle( GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &mainThread, THREAD_SET_CONTEXT, FALSE, 0 );
+
+ pluginLink=link;
+
+ InitOptions();
+
+ /////////////
+ ////// init protocol
+ RegisterProto();
+ CreateProtoServices();
+
+ // hook modules loaded
+ hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+ return 0;
+}
+
+extern "C" __declspec (dllexport) int Unload(void) {
+ UnhookEvent(hModulesLoaded);
+ DeinitMenu();
+ DeinitNetlib();
+ DeinitProto();
+ DeinitOptions();
+
+ return 0;
+}
diff --git a/MySpace/MySpace.rc b/MySpace/MySpace.rc new file mode 100644 index 0000000..8d49b6f --- /dev/null +++ b/MySpace/MySpace.rc @@ -0,0 +1,127 @@ +// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Neutral (Default) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD)
+#ifdef _WIN32
+LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_OPT1 DIALOGEX 0, 0, 246, 179
+STYLE DS_SETFONT | WS_POPUP
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+ GROUPBOX "MySpace",IDC_STATIC,26,17,201,89
+ RTEXT "E-mail:",IDC_STATIC,40,39,54,8
+ RTEXT "Password:",IDC_STATIC,35,72,59,8
+ EDITTEXT IDC_ED_EMAIL,113,36,89,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_ED_PW,113,68,89,14,ES_PASSWORD | ES_AUTOHSCROLL
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_MENU ICON "menu.ico"
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_OPT1, DIALOG
+ BEGIN
+ VERTGUIDE, 94
+ VERTGUIDE, 113
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // Neutral (Default) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (Australia) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON_PROTO ICON "icon1.ico"
+#endif // English (Australia) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/MySpace/MySpace.sln b/MySpace/MySpace.sln new file mode 100644 index 0000000..688791b --- /dev/null +++ b/MySpace/MySpace.sln @@ -0,0 +1,26 @@ +
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MySpace", "MySpace.vcproj", "{EC43AA96-F631-49D9-944D-2B08571D1B66}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug (Unicode)|Win32 = Debug (Unicode)|Win32
+ Debug|Win32 = Debug|Win32
+ Release (Unicode)|Win32 = Release (Unicode)|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {EC43AA96-F631-49D9-944D-2B08571D1B66}.Debug (Unicode)|Win32.ActiveCfg = Debug (Unicode)|Win32
+ {EC43AA96-F631-49D9-944D-2B08571D1B66}.Debug (Unicode)|Win32.Build.0 = Debug (Unicode)|Win32
+ {EC43AA96-F631-49D9-944D-2B08571D1B66}.Debug|Win32.ActiveCfg = Debug|Win32
+ {EC43AA96-F631-49D9-944D-2B08571D1B66}.Debug|Win32.Build.0 = Debug|Win32
+ {EC43AA96-F631-49D9-944D-2B08571D1B66}.Release (Unicode)|Win32.ActiveCfg = Release (Unicode)|Win32
+ {EC43AA96-F631-49D9-944D-2B08571D1B66}.Release (Unicode)|Win32.Build.0 = Release (Unicode)|Win32
+ {EC43AA96-F631-49D9-944D-2B08571D1B66}.Release|Win32.ActiveCfg = Release|Win32
+ {EC43AA96-F631-49D9-944D-2B08571D1B66}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/MySpace/MySpace.vcproj b/MySpace/MySpace.vcproj new file mode 100644 index 0000000..e0af73a --- /dev/null +++ b/MySpace/MySpace.vcproj @@ -0,0 +1,514 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="MySpace"
+ ProjectGUID="{EC43AA96-F631-49D9-944D-2B08571D1B66}"
+ RootNamespace="MySpace"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../include"
+ PreprocessorDefinitions="_DEBUG;_WINDOWS;_USERDLL"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="common.h"
+ DebugInformationFormat="3"
+ DisableSpecificWarnings="4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../include"
+ PreprocessorDefinitions="NDEBUG;_WINDOWS;_USERDLL"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="common.h"
+ DisableSpecificWarnings="4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="2"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug (Unicode)|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../include"
+ PreprocessorDefinitions="_DEBUG;_WINDOWS;_USERDLL;UNICODE;_UNICODE"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="common.h"
+ DebugInformationFormat="3"
+ DisableSpecificWarnings="4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release (Unicode)|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../include"
+ PreprocessorDefinitions="NDEBUG;_WINDOWS;_USERDLL;UNICODE;_UNICODE"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="common.h"
+ DisableSpecificWarnings="4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="2"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\common.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug (Unicode)|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release (Unicode)|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\menu.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\MySpace.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\net.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\NetMessage.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\options.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\proto.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\collection.h"
+ >
+ </File>
+ <File
+ RelativePath=".\common.h"
+ >
+ </File>
+ <File
+ RelativePath=".\menu.h"
+ >
+ </File>
+ <File
+ RelativePath=".\net.h"
+ >
+ </File>
+ <File
+ RelativePath=".\NetMessage.h"
+ >
+ </File>
+ <File
+ RelativePath=".\options.h"
+ >
+ </File>
+ <File
+ RelativePath=".\proto.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ </File>
+ <File
+ RelativePath=".\server_con.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\server_con.h"
+ >
+ </File>
+ <File
+ RelativePath=".\version.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ <File
+ RelativePath=".\icon1.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\menu.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\MySpace.rc"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug (Unicode)|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release (Unicode)|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\resource.rc"
+ >
+ </File>
+ <File
+ RelativePath=".\version.rc"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug (Unicode)|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release (Unicode)|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\readme.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/MySpace/NetMessage.cpp b/MySpace/NetMessage.cpp new file mode 100644 index 0000000..92ce21e --- /dev/null +++ b/MySpace/NetMessage.cpp @@ -0,0 +1,214 @@ +#include "common.h"
+#include "NetMessage.h"
+#include <cstdlib>
+
+NMString::NMString(): text(0) {
+}
+
+NMString::NMString(const NMString &other) {
+ int len = strlen(other.text) + 1;
+ text = new char[len + 1];
+ mir_snprintf(text, len, "%s", other.text);
+}
+
+NMString::NMString(char *t) {
+ int len = strlen(t) + 1;
+ text = new char[len + 1];
+ mir_snprintf(text, len, "%s", t);
+}
+
+const bool NMString::operator<(const NMString &other) const {
+ return strcmp(text, other.text) < 0;
+}
+
+const bool NMString::operator==(const NMString &other) const {
+ return strcmp(text, other.text) == 0;
+}
+
+NMString &NMString::operator=(const NMString &other) {
+ if(text) delete[] text;
+
+ int len = strlen(other.text) + 1;
+ text = new char[len + 1];
+ mir_snprintf(text, len, "%s", other.text);
+
+ return *this;
+}
+
+NMString::~NMString() {
+ delete[] text;
+}
+
+NetMessage::NetMessage(): Map<NMString, NMString>() {
+}
+
+NetMessage::~NetMessage()
+{
+}
+
+//static
+char *NetMessage::unescape_inplace(char *val) {
+ int read_pos = 0, write_pos = 0, len = strlen(val);
+ while(read_pos < len) {
+ if(val[read_pos] == '/' && read_pos + 1 < len) {
+ read_pos++;
+ if(val[read_pos] == '1') val[write_pos++] = '/';
+ else if(val[read_pos] == '2') val[write_pos++] = '\\';
+ else val[write_pos++] = '?';
+ read_pos++;
+ } else {
+ val[write_pos++] = val[read_pos++];
+ }
+ }
+ val[write_pos] = 0;
+
+ return val;
+}
+
+int NetMessage::parse(char *data, int size) {
+ int pos = 0;
+ bool finished = false;
+ char *key, *value;
+ int start, end = 0;
+ while(end < size && !finished) {
+ start = end + 1;
+ end = start;
+ while(end < size && data[end] != '\\') end++;
+ if(end < size) {
+ data[end] = 0;
+ key = &data[start];
+
+ start = end + 1;
+ end = start;
+ while(end < size && data[end] != '\\') end++;
+ if(end < size) {
+ data[end] = 0;
+ value = &data[start];
+ } else
+ value = 0;
+ } else {
+ key = value = 0;
+ }
+
+ if(key && strcmp(key, "final") == 0)
+ finished = true;
+ else if(key && value)
+ put(NMString(key), NMString(value));
+ }
+ return pos;
+}
+
+bool NetMessage::get_string(char *key, char *buff, int buffsize) {
+ NMString val;
+ if(get(NMString(key), val)) {
+ mir_snprintf(buff, buffsize, "%s", val.text);
+ unescape_inplace(buff);
+ return true;
+ }
+ return false;
+}
+
+bool NetMessage::get_data(char *key, char *buff, int *size) {
+ NMString val;
+ if(get(NMString(key), val)) {
+ NETLIBBASE64 nbd = {0};
+ nbd.pszEncoded = val.text;
+ nbd.cchEncoded = strlen(nbd.pszEncoded);
+ nbd.pbDecoded = (BYTE *)buff;
+ nbd.cbDecoded = *size;
+
+ //*size = Netlib_GetBase64DecodedBufferSize(nbd.cchEncoded);
+ CallService(MS_NETLIB_BASE64DECODE, 0, (LPARAM)&nbd);
+ *size = nbd.cbDecoded;
+
+ return true;
+ }
+ return false;
+}
+
+int NetMessage::get_int(char *key) {
+ NMString val;
+ if(get(NMString(key), val)) {
+ return atoi(val.text);
+ }
+ return 0;
+}
+
+ClientNetMessage::ClientNetMessage(): LinkedList< KeyValue >() {
+}
+
+ClientNetMessage::~ClientNetMessage() {
+}
+
+void ClientNetMessage::add_string(char *key, char *buff) {
+ char *temp = escape(buff);
+ KeyValue dat = KeyValue(NMString(key), NMString(temp));
+ delete temp;
+ add(dat);
+}
+
+void ClientNetMessage::add_data(char *key, char *data, int size) {
+ int len = Netlib_GetBase64EncodedBufferSize(size);
+ char *buff = new char[len];
+
+ NETLIBBASE64 nbd = {0};
+ nbd.pszEncoded = buff;
+ nbd.cchEncoded = len;
+ nbd.pbDecoded = (BYTE *)data;
+ nbd.cbDecoded = size;
+
+ //*size = Netlib_GetBase64DecodedBufferSize(nbd.cchEncoded);
+ CallService(MS_NETLIB_BASE64ENCODE, 0, (LPARAM)&nbd);
+
+ KeyValue dat = KeyValue(NMString(key), NMString(buff));
+ add(dat);
+}
+
+void ClientNetMessage::add_int(char *key, int i) {
+ char buff[254];
+ KeyValue dat(NMString(key), NMString(_itoa(i, buff, 10)));
+ add(dat);
+}
+
+//static
+char *ClientNetMessage::escape(char *val) {
+ int len = strlen(val);
+ char *buff = new char[len * 2 + 1];
+ int read_pos = 0, write_pos = 0;
+ while(read_pos < len) {
+ if(val[read_pos] == '/') {
+ buff[write_pos++] = '/';
+ buff[write_pos++] = '1';
+ read_pos++;
+ } else if(val[read_pos] == '\\') {
+ buff[write_pos++] = '/';
+ buff[write_pos++] = '2';
+ read_pos++;
+ } else {
+ buff[write_pos++] = val[read_pos++];
+ }
+ }
+ buff[write_pos] = 0;
+ return buff;
+}
+
+int ClientNetMessage::make_packet(char *buff, int size) {
+ int pos = 0, key_len, val_len, len;
+ for(Iterator i = start(); i.has_val() && pos < size; i.next()) {
+ KeyValue v = i.val();
+
+ key_len = strlen(v.first.text);
+ val_len = strlen(v.second.text);
+ len = key_len + val_len + 2;
+
+ if(size - pos - len > 0)
+ mir_snprintf(buff + pos, size - pos, "\\%s\\%s", v.first.text, v.second.text);
+ pos += len;
+ }
+
+ if(size - pos > 7) {
+ mir_snprintf(buff + pos, size - pos, "\\final\\");
+ pos += 7;
+ }
+ return pos;
+}
diff --git a/MySpace/NetMessage.h b/MySpace/NetMessage.h new file mode 100644 index 0000000..8261302 --- /dev/null +++ b/MySpace/NetMessage.h @@ -0,0 +1,58 @@ +#ifndef _NET_MESSAGE_INC
+#define _NET_MESSAGE_INC
+
+#include "collection.h"
+
+class NMString {
+public:
+ NMString();
+ NMString(const NMString &other);
+ NMString(char *t);
+ virtual ~NMString();
+
+ const bool operator<(const NMString &other) const;
+ const bool operator==(const NMString &other) const;
+ NMString &operator=(const NMString &other);
+
+ char *text;
+};
+
+class NetMessage: public Map<NMString, NMString> {
+public:
+ NetMessage();
+ virtual ~NetMessage();
+
+ int parse(char *data, int size);
+
+ bool get_string(char *key, char *buff, int buffsize);
+ bool get_data(char *key, char *buff, int *size);
+ int get_int(char *key);
+
+ static char *unescape_inplace(char *val);
+};
+
+class KeyValue: public Pair<NMString, NMString> {
+public:
+ KeyValue(const NMString &k, const NMString &v): Pair<NMString, NMString>(k, v) {}
+ KeyValue &operator=(const KeyValue &other) {
+ first = other.first;
+ second = other.second;
+ return *this;
+ }
+};
+
+class ClientNetMessage: public LinkedList< KeyValue > {
+public:
+ ClientNetMessage();
+ virtual ~ClientNetMessage();
+
+ int ClientNetMessage::make_packet(char *buff, int size);
+
+ void add_string(char *key, char *buff);
+ void add_data(char *key, char *buff, int size);
+ void add_int(char *key, int i);
+
+ static char *escape(char *val);
+};
+
+#endif
diff --git a/MySpace/Release (Unicode)/BuildLog.htm b/MySpace/Release (Unicode)/BuildLog.htm Binary files differnew file mode 100644 index 0000000..79110e3 --- /dev/null +++ b/MySpace/Release (Unicode)/BuildLog.htm diff --git a/MySpace/Release (Unicode)/MySpace.dll b/MySpace/Release (Unicode)/MySpace.dll Binary files differnew file mode 100644 index 0000000..633c8b0 --- /dev/null +++ b/MySpace/Release (Unicode)/MySpace.dll diff --git a/MySpace/Release (Unicode)/MySpace.dll.intermediate.manifest b/MySpace/Release (Unicode)/MySpace.dll.intermediate.manifest new file mode 100644 index 0000000..cdaa604 --- /dev/null +++ b/MySpace/Release (Unicode)/MySpace.dll.intermediate.manifest @@ -0,0 +1,3 @@ +<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
+<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
+</assembly>
diff --git a/MySpace/Release (Unicode)/MySpace.exp b/MySpace/Release (Unicode)/MySpace.exp Binary files differnew file mode 100644 index 0000000..4336728 --- /dev/null +++ b/MySpace/Release (Unicode)/MySpace.exp diff --git a/MySpace/Release (Unicode)/MySpace.lib b/MySpace/Release (Unicode)/MySpace.lib Binary files differnew file mode 100644 index 0000000..5437b22 --- /dev/null +++ b/MySpace/Release (Unicode)/MySpace.lib diff --git a/MySpace/Release (Unicode)/MySpace.obj b/MySpace/Release (Unicode)/MySpace.obj Binary files differnew file mode 100644 index 0000000..7922084 --- /dev/null +++ b/MySpace/Release (Unicode)/MySpace.obj diff --git a/MySpace/Release (Unicode)/MySpace.pch b/MySpace/Release (Unicode)/MySpace.pch Binary files differnew file mode 100644 index 0000000..f8c2c06 --- /dev/null +++ b/MySpace/Release (Unicode)/MySpace.pch diff --git a/MySpace/Release (Unicode)/NetMessage.obj b/MySpace/Release (Unicode)/NetMessage.obj Binary files differnew file mode 100644 index 0000000..de8bd1d --- /dev/null +++ b/MySpace/Release (Unicode)/NetMessage.obj diff --git a/MySpace/Release (Unicode)/common.obj b/MySpace/Release (Unicode)/common.obj Binary files differnew file mode 100644 index 0000000..91d691f --- /dev/null +++ b/MySpace/Release (Unicode)/common.obj diff --git a/MySpace/Release (Unicode)/menu.obj b/MySpace/Release (Unicode)/menu.obj Binary files differnew file mode 100644 index 0000000..b67d9f0 --- /dev/null +++ b/MySpace/Release (Unicode)/menu.obj diff --git a/MySpace/Release (Unicode)/mt.dep b/MySpace/Release (Unicode)/mt.dep new file mode 100644 index 0000000..695ee7c --- /dev/null +++ b/MySpace/Release (Unicode)/mt.dep @@ -0,0 +1 @@ +Manifest resource last updated at 2:33:18.06 on Thu 28/06/2007
diff --git a/MySpace/Release (Unicode)/net.obj b/MySpace/Release (Unicode)/net.obj Binary files differnew file mode 100644 index 0000000..ea5cbf0 --- /dev/null +++ b/MySpace/Release (Unicode)/net.obj diff --git a/MySpace/Release (Unicode)/options.obj b/MySpace/Release (Unicode)/options.obj Binary files differnew file mode 100644 index 0000000..2dd6522 --- /dev/null +++ b/MySpace/Release (Unicode)/options.obj diff --git a/MySpace/Release (Unicode)/proto.obj b/MySpace/Release (Unicode)/proto.obj Binary files differnew file mode 100644 index 0000000..33a3a48 --- /dev/null +++ b/MySpace/Release (Unicode)/proto.obj diff --git a/MySpace/Release (Unicode)/resource.res b/MySpace/Release (Unicode)/resource.res Binary files differnew file mode 100644 index 0000000..7d09e64 --- /dev/null +++ b/MySpace/Release (Unicode)/resource.res diff --git a/MySpace/Release (Unicode)/server_con.obj b/MySpace/Release (Unicode)/server_con.obj Binary files differnew file mode 100644 index 0000000..a0c7129 --- /dev/null +++ b/MySpace/Release (Unicode)/server_con.obj diff --git a/MySpace/Release (Unicode)/vc80.idb b/MySpace/Release (Unicode)/vc80.idb Binary files differnew file mode 100644 index 0000000..3fa746c --- /dev/null +++ b/MySpace/Release (Unicode)/vc80.idb diff --git a/MySpace/collection.h b/MySpace/collection.h new file mode 100644 index 0000000..e02cedf --- /dev/null +++ b/MySpace/collection.h @@ -0,0 +1,546 @@ +template<class T> class Collection {
+protected:
+ unsigned long count;
+public:
+ Collection(): count(0) {}
+
+ virtual void clear() = 0;
+ virtual void add(T &val) = 0;
+ virtual const bool remove(T &val) = 0;
+
+ const unsigned long size() const {return count;}
+};
+
+template<class T> class Node {
+public:
+ T val;
+
+ Node(T &v): val(v) {}
+ virtual ~Node() {}
+};
+
+template<class T> class ListNode: public Node<T> {
+public:
+ ListNode<T> *next, *prev;
+
+ ListNode(T &v): Node<T>(v), next(0), prev(0) {}
+ virtual ~ListNode() {
+ if(next) next->prev = prev;
+ if(prev) prev->next = next;
+ }
+};
+
+template<class T> class LinkedList: public Collection<T> {
+protected:
+ ListNode<T> *head, *tail;
+
+public:
+ class Iterator {
+ friend class LinkedList<T>;
+ protected:
+ ListNode<T> *n;
+ Iterator(ListNode<T> *start): n(start) {}
+ public:
+ Iterator(const Iterator &other): n(other.n) {}
+
+ virtual T &val() {return n->val;}
+ virtual void next() {if(n) n = n->next;}
+ virtual void prev() {if(n) n = n->prev;}
+ virtual const bool has_val() {return (n ? true : false); }
+ };
+
+ LinkedList(): Collection<T>(), head(0), tail(0) {};
+ LinkedList(const LinkedList<T> &other): Collection<T>(), head(0), tail(0) {
+ for(Iterator i = other.start(); i.has_val(); i.next())
+ add(i.val());
+ }
+ virtual ~LinkedList() {clear();}
+
+ LinkedList<T> &operator=(const LinkedList<T> &other) {
+ clear();
+ for(Iterator i = other.start(); i.has_val(); i.next())
+ add(i.val());
+ return *this;
+ }
+
+ virtual void clear() {
+ ListNode<T> *n;
+ while(head) {
+ n = head;
+ head = head->next;
+ delete n;
+ }
+ tail = 0;
+ Collection<T>::count = 0;
+ }
+
+ virtual Iterator start() const {return Iterator(head);}
+
+ virtual void add_front(T &val) {
+ ListNode<T> *n = new ListNode<T>(val);
+ n->next = head;
+ if(head) head->prev = n;
+ head = n;
+ if(!tail) tail = n;
+ Collection<T>::count++;
+ }
+
+ virtual void add(T &val) {
+ ListNode<T> *n = new ListNode<T>(val);
+ n->prev = tail;
+ if(tail) tail->next = n;
+ tail = n;
+ if(!head) head = n;
+ Collection<T>::count++;
+ }
+
+ virtual const bool remove(T &val) {
+ ListNode<T> *n = head;
+ while(n) {
+ if(n->val == val) {
+ if(n == head) head = head->next;
+ if(n == tail) tail = tail->prev;
+
+ delete n;
+ Collection<T>::count--;
+ return true;
+ } else
+ n = n->next;
+ }
+
+ return false;
+ }
+
+ // queue/stack functions
+ // stack - use push/pop
+ // queue - use push_back/pop
+ virtual void push(T &val) {
+ add_front(val);
+ }
+
+ virtual void push(T val) {
+ add_front(val);
+ }
+
+ virtual void push_back(T &val) {
+ add(val);
+ }
+
+ virtual const bool pop(T &val) {
+ if(!head) return false;
+
+ ListNode<T> *n = head;
+ if(head) {
+ head = head->next;
+ if(n == tail) tail = 0;
+ val = n->val;
+ delete n;
+ Collection<T>::count--;
+ return true;
+ } else
+ return false;
+ }
+};
+
+template<class T> class DynamicArray: public Collection<T> {
+protected:
+ T *ar;
+
+ unsigned long initial, limit, increment;
+
+public:
+ class Iterator {
+ friend class DynamicArray<T>;
+ protected:
+ T *ar;
+ unsigned long count;
+ unsigned long pos;
+ Iterator(T *a, const int c, unsigned long p): ar(a), count(c), pos(p) {}
+ public:
+ Iterator(const Iterator &other): ar(other.ar), count(other.count), pos(other.pos) {}
+
+ virtual T &val() {return ar[pos];}
+ virtual void next() {pos++;}
+ virtual void prev() {pos--;}
+ virtual const bool has_val() {return pos < count; }
+ };
+
+ DynamicArray(unsigned long init = 0, unsigned long inc = 1): Collection<T>(), ar(0), initial(init), limit(init), increment(inc) {
+ if(limit) ar = (T *)malloc(limit * sizeof(T));
+ }
+ virtual ~DynamicArray() {if(ar) free(ar);}
+
+ virtual void clear() {
+ Collection<T>::count = 0;
+ limit = initial;
+ if(limit) ar = (T *)realloc(ar, limit * sizeof(T));
+ else free(ar);
+ }
+
+ virtual Iterator start() {return Iterator(ar, Collection<T>::count, 0);}
+
+ virtual void add(T &val) {
+ if(Collection<T>::count == limit) {
+ limit += increment;
+ ar = (T *)realloc(ar, limit * sizeof(T));
+ ar[Collection<T>::count++] = val;
+ } else
+ ar[Collection<T>::count++] = val;
+ }
+
+ virtual const bool remove(T &val) {
+ for(unsigned long i = 0; i < Collection<T>::count; i++) {
+ if(ar[i] == val) {
+ memmove(ar + i, ar + i + 1, (Collection<T>::count - i) * sizeof(T));
+ Collection<T>::count--;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ virtual const bool remove(const unsigned long index) {
+ if(index >= Collection<T>::count) return false;
+
+ memmove(ar + index, ar + index + 1, (Collection<T>::count - index) * sizeof(T));
+ Collection<T>::count--;
+ return true;
+ }
+
+ virtual const bool insert(T &val, const unsigned long index) {
+ if(index > Collection<T>::count) return false;
+
+ if(Collection<T>::count == limit) {
+ limit += increment;
+ ar = (T *)realloc(ar, limit * sizeof(T));
+ }
+
+ if(index < Collection<T>::count)
+ memmove(ar + index + 1, ar + index, (Collection<T>::count - index) * sizeof(T));
+
+ ar[index] = val;
+ Collection<T>::count++;
+ return true;
+ }
+
+ virtual T &operator[](const int index) {
+ return ar[index];
+ }
+
+ const bool index_of(const T &val, unsigned long &index) {
+ for(int i = 0; i < Collection<T>::count; i++) {
+ if(ar[index] == val) {
+ index = i;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // stack functions
+ virtual const bool pop(T &val) {
+ if(Collection<T>::count) {
+ val = ar[Collection<T>::count -1];
+ remove(Collection<T>::count -1);
+ return true;
+ }
+ return false;
+ }
+
+ virtual void push(T &val) {
+ add(val);
+ }
+};
+
+template<class T> class SortedDynamicArray: public DynamicArray<T> {
+public:
+ SortedDynamicArray(unsigned long init = 0, unsigned long inc = 1): DynamicArray<T>(init, inc) {}
+ virtual ~SortedDynamicArray() {}
+
+ const bool get_index(T &val, unsigned long &index) {
+ unsigned long low = 0;
+ unsigned long high = Collection<T>::count-1;
+
+ while( high < Collection<T>::count && low <= high )
+ {
+ unsigned long i = ( low+high )/2;
+ if ( DynamicArray<T>::ar[i] == val )
+ { index = i;
+ return true;
+ } else
+ if (DynamicArray<T>::ar[i] < val)
+ low = i+1;
+ else
+ high = i-1;
+ }
+
+ index = low;
+ return false;
+ }
+
+ virtual void add(T &val) {
+ unsigned long index;
+ get_index(val, index);
+ insert(val, index);
+ }
+};
+
+template<class T> class TreeNode: public Node<T> {
+public:
+ TreeNode<T> *parent, *left, *right;
+
+ TreeNode(T &v, TreeNode<T> *par): Node<T>(v), parent(par), left(0), right(0) {}
+ virtual ~TreeNode() {
+ if(parent) {
+ if(parent->left == this) parent->left = 0;
+ else parent->right = 0;
+ }
+ }
+};
+
+template<class T> class BinaryTree: public Collection<T> {
+protected:
+
+ TreeNode<T> *root;
+
+ TreeNode<T> *delete_node(TreeNode<T> *n) {
+ if(n->left && n->right) {
+ //if(rand() & 1) { // ?
+ TreeNode<T> *minmax = n->left;
+ while(minmax->right) minmax = minmax->right;
+ //} else {
+ // Node *minmax = current->right;
+ // while(minmax->left) minmax = minmax->left;
+ //}
+ n->val = minmax->val;
+ delete_node(minmax);
+ Collection<T>::count--;
+ return n;
+ } else if(n->right) {
+ if(n->parent) {
+ if(n->parent->left = n) n->parent->left = n->right;
+ else n->parent->right = n->right;
+ } else
+ root = n->right;
+ n->right->parent = n->parent;
+ } else if(n->left) {
+ if(n->parent) {
+ if(n->parent->left = n) n->parent->left = n->left;
+ else n->parent->right = n->left;
+ } else
+ root = n->left;
+ n->left->parent = n->parent;
+ } else {
+ if(n == root) root = 0;
+ }
+ delete n;
+ Collection<T>::count--;
+ return 0;
+ }
+
+ void insert_node(TreeNode<T> *n) {
+ TreeNode<T> *current = root, *parent = 0;
+ while(current) {
+ parent = current;
+ if(n->val < current->val)
+ current = current->left;
+ else
+ current = current->right;
+ }
+
+ if(parent) {
+ if(n->val < parent->val) {
+ parent->left = n;
+ n->parent = parent;
+ } else {
+ parent->right = n;
+ n->parent = parent;
+ }
+ } else
+ root = n;
+
+ }
+
+public:
+ class Iterator {
+ friend class BinaryTree<T>;
+ protected:
+
+ class EvalNode {
+ public:
+ bool evaluate;
+ TreeNode<T> *node;
+
+ EvalNode(): evaluate(false), node(0) {}
+ EvalNode(const bool eval, TreeNode<T> *n): evaluate(eval), node(n) {}
+ const bool operator==(const EvalNode &other) const {return node == other.node;}
+ EvalNode &operator=(const EvalNode &other) {evaluate = other.evaluate; node = other.node; return *this;}
+
+ };
+
+ TreeNode<T> *n;
+ LinkedList<EvalNode> stack;
+
+
+ Iterator(TreeNode<T> *start): n(0) {
+ if(start) {
+ stack.push(EvalNode(true, start));
+ next();
+ }
+ }
+
+ public:
+ Iterator(const Iterator &other):n(other.n), stack(other.stack) {}
+ virtual ~Iterator() {}
+
+ virtual T &val() {return n->val;}
+ virtual void next() {
+ EvalNode en;
+ bool popped = false;
+ while((popped = stack.pop(en)) && en.evaluate) {
+ if(en.node->right) stack.push(EvalNode(true, en.node->right));
+ stack.push(EvalNode(false, en.node));
+ if(en.node->left) stack.push(EvalNode(true, en.node->left));
+ }
+
+ n = (popped ? en.node : 0);
+ }
+ virtual const bool has_val() {return (n ? true : false);}
+ };
+
+ BinaryTree(): Collection<T>(), root(0) {};
+ BinaryTree(BinaryTree<T> &other): Collection<T>(), root(0) {
+ for(Iterator i = other.start(); i.has_val(); i.next())
+ add(i.val());
+ }
+ virtual ~BinaryTree() {clear();}
+
+ BinaryTree &operator=(BinaryTree<T> &other) {
+ clear();
+ for(Iterator i = other.start(); i.has_val(); i.next())
+ add(i.val());
+ return *this;
+ }
+
+ virtual void clear() {
+ TreeNode<T> *current = root, *parent = 0;
+ while(current) {
+ if(current->left) current = current->left;
+ else if(current->right) current = current->right;
+ else {
+ parent = current->parent;
+ delete current;
+ current = parent;
+ }
+ }
+
+ root = 0;
+ Collection<T>::count = 0;
+ }
+
+ void add(T &val) {
+ TreeNode<T> *n = new TreeNode<T>(val, 0);
+ insert_node(n);
+ Collection<T>::count++;
+ }
+
+ const bool remove(T &val) {
+ TreeNode<T> *current = root;
+ while(current) {
+ if(current->val == val)
+ break;
+ else if(val < current->val)
+ current = current->left;
+ else
+ current = current->right;
+ }
+
+ if(current) {
+ delete_node(current);
+ return true;
+ }
+
+ return false;
+ }
+
+ Iterator start() {return Iterator(root);}
+};
+
+template<class A, class B> class Pair {
+public:
+ A first;
+ B second;
+
+ Pair(const A &f): first(f) {}
+ Pair(const A &f, const B &s): first(f), second(s) {}
+ Pair(Pair<A,B> &other): first(other.first), second(other.second) {}
+ virtual ~Pair() {}
+
+ const bool operator<(const Pair<A,B> &other) const {return first < other.first;}
+ const bool operator==(const Pair<A,B> &other) const {return first == other.first;}
+ Pair<A,B> &operator=(const Pair<A,B> &other) {first = other.first; second = other.second; return *this;}
+};
+
+template<class A, class B> class Map: public BinaryTree< Pair< A, B > > {
+protected:
+
+ const TreeNode<Pair< A, B > > *find(A &val) const {
+ TreeNode<Pair< A, B > > *n = BinaryTree< Pair< A, B > >::root;
+ while(n) {
+ if(n->val.first == val)
+ return n;
+ else if(val < n->val.first)
+ n = n->left;
+ else
+ n = n->right;
+
+ }
+ return 0;
+ }
+public:
+ Map(): BinaryTree< Pair<A,B> >() {}
+ virtual ~Map() {}
+
+ void put(A &key, B &value) {
+ add(Pair<A,B>(key, value));
+ }
+
+ const bool get(A &key, B &val) const {
+ const TreeNode<Pair< A, B > > *n = find(key);
+ if(n) {
+ val = n->val.second;
+ return true;
+ } else
+ return false;
+ }
+
+ B &operator[](A &key) {
+ TreeNode<Pair< A, B > > *n = find(key);
+ if(n)
+ return n->val.second;
+ else {
+ Pair< A, B > p(key);
+ TreeNode<Pair< A, B > > *n = new TreeNode<Pair< A, B > >(p, 0);
+ insert_node(n);
+ Collection< Pair< A, B > >::count++;
+ return n->val.second;
+ }
+ }
+
+ const bool exists(A &key) const {
+ const TreeNode<Pair< A, B > > *n = find(key);
+ if(n) {
+ return true;
+ } else
+ return false;
+ }
+
+ const bool remove(A &key) {
+ TreeNode<Pair< A, B > > *n = find(key);
+ if(n) {
+ delete_node(n);
+ return true;
+ } else
+ return false;
+ }
+};
diff --git a/MySpace/common.cpp b/MySpace/common.cpp new file mode 100644 index 0000000..3324856 --- /dev/null +++ b/MySpace/common.cpp @@ -0,0 +1 @@ +#include "common.h"
diff --git a/MySpace/common.h b/MySpace/common.h new file mode 100644 index 0000000..f80037c --- /dev/null +++ b/MySpace/common.h @@ -0,0 +1,67 @@ +#ifndef _COMMON_INC
+#define _COMMON_INC
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Allow use of features specific to Windows XP or later.
+#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
+#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later.
+#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE.
+#endif
+
+#if defined( UNICODE ) && !defined( _UNICODE )
+#define _UNICODE
+#endif
+
+#include <tchar.h>
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+
+#include <windows.h>
+#include <commctrl.h>
+
+#define MIRANDA_VER 0x0700
+
+#include <newpluginapi.h>
+#include <m_system.h>
+#include <m_database.h>
+#include <m_langpack.h>
+#include <m_options.h>
+#include <m_protomod.h>
+#include <m_protosvc.h>
+#include <stdio.h> // for m_utils
+#include <winsock2.h> // for FD_SETSIZE
+#include <m_netlib.h>
+#include <m_clist.h>
+
+#include <m_popup.h>
+
+////////////
+// included for backward compatibility
+#ifndef CMIF_UNICODE
+#define CMIF_UNICODE 512 //will return TCHAR* instead of char*
+#if defined( _UNICODE )
+ #define CMIF_TCHAR CMIF_UNICODE //will return TCHAR* instead of char*
+#else
+ #define CMIF_TCHAR 0 //will return char*, as usual
+#endif
+#endif
+////////////
+
+#define MODULE "MySpace"
+
+extern HINSTANCE hInst;
+extern PLUGINLINK *pluginLink;
+extern HANDLE mainThread;
+
+#endif
diff --git a/MySpace/icon1.ico b/MySpace/icon1.ico Binary files differnew file mode 100644 index 0000000..881674b --- /dev/null +++ b/MySpace/icon1.ico diff --git a/MySpace/menu.cpp b/MySpace/menu.cpp new file mode 100644 index 0000000..42c8ca9 --- /dev/null +++ b/MySpace/menu.cpp @@ -0,0 +1,75 @@ +#include "common.h"
+#include "menu.h"
+#include "resource.h"
+
+HANDLE hMenuMain = 0, hServiceMenuMain = 0;
+
+int MainMenuService(WPARAM wParam, LPARAM lParam) {
+ // TODO: add code here that executes when the menu item is chosen
+
+ // e.g. modify main menu item - see m_clist.h
+ //CLISTMENUITEM menu = {0};
+ //menu.cbSize=sizeof(menu);
+ //menu.flags = CMIM_NAME | CMIF_TCHAR;
+ //menu.ptszName = (char *)TranslateT("Changed menu text");
+ //CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuMain, (LPARAM)&menu);
+
+ return 0;
+}
+
+HANDLE hMenuContact = 0, hServiceMenuContact = 0, hEventMenuBuild = 0;
+
+int ContactMenuService(WPARAM wParam, LPARAM lParam) {
+ HANDLE hContact = (HANDLE)wParam;
+ // TODO: add code here that executes when the menu item is chosen
+
+ // e.g. you could modify the menu item here - see below
+ return 0;
+}
+
+// this function is called when the contact's menu is about to be shown - you can e.g.
+// modify the menu here using the MS_CLIST_MODIFYMENUITEM service
+int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) {
+ HANDLE hContact = (HANDLE)wParam;
+ // TODO: add code here that executes when the menu is constructed
+
+ // e.g. modify menu item - see m_clist.h
+ //CLISTMENUITEM menu = {0};
+ //menu.cbSize=sizeof(menu);
+ //menu.flags = CMIM_NAME | CMIF_TCHAR;
+ //menu.ptszName = (char *)TranslateT("Changed menu text");
+ //CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuContact, (LPARAM)&menu);
+
+ return 0;
+}
+
+void InitMenu() {
+ CLISTMENUITEM menu = {0};
+ menu.cbSize=sizeof(menu);
+
+ menu.flags = CMIM_ALL | CMIF_TCHAR;
+ menu.hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON_PROTO), IMAGE_ICON, 0, 0, 0);
+
+ // main menu item
+ hServiceMenuMain = CreateServiceFunction(MODULE "/MainMenu", MainMenuService);
+ menu.ptszName = TranslateT(MODULE);
+ menu.pszService = MODULE "/MainMenu";
+ menu.position = 0;
+ hMenuMain = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&menu);
+
+ // contact menu item
+ hServiceMenuContact = CreateServiceFunction(MODULE "/ContactMenu", ContactMenuService);
+ menu.ptszName = TranslateT(MODULE);
+ menu.pszService = MODULE "/ContactMenu";
+ menu.position = 0;
+ menu.flags = CMIF_NOTOFFLINE; // only show for not-offline contacts
+ hMenuContact = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&menu);
+
+ hEventMenuBuild = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
+}
+
+void DeinitMenu() {
+ UnhookEvent(hEventMenuBuild);
+ DestroyServiceFunction(hServiceMenuContact);
+ DestroyServiceFunction(hServiceMenuMain);
+}
\ No newline at end of file diff --git a/MySpace/menu.h b/MySpace/menu.h new file mode 100644 index 0000000..0add0ed --- /dev/null +++ b/MySpace/menu.h @@ -0,0 +1,7 @@ +#ifndef _MENU_INC
+#define _MENU_INC
+
+void InitMenu();
+void DeinitMenu();
+
+#endif
diff --git a/MySpace/menu.ico b/MySpace/menu.ico Binary files differnew file mode 100644 index 0000000..94f62a2 --- /dev/null +++ b/MySpace/menu.ico diff --git a/MySpace/net.cpp b/MySpace/net.cpp new file mode 100644 index 0000000..812c551 --- /dev/null +++ b/MySpace/net.cpp @@ -0,0 +1,20 @@ +#include "common.h"
+#include "net.h"
+
+HANDLE hNetlibUser = 0;
+
+void InitNetlib() {
+ NETLIBUSER nl_user = {0};
+ nl_user.cbSize = sizeof(nl_user);
+ nl_user.szSettingsModule = MODULE;
+ nl_user.flags = NUF_OUTGOING | NUF_HTTPCONNS;
+ nl_user.szDescriptiveName = MODULE;
+
+ hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nl_user);
+}
+
+void DeinitNetlib() {
+ if(hNetlibUser)
+ CallService(MS_NETLIB_CLOSEHANDLE, (WPARAM)hNetlibUser, 0);
+}
+
diff --git a/MySpace/net.h b/MySpace/net.h new file mode 100644 index 0000000..886a19b --- /dev/null +++ b/MySpace/net.h @@ -0,0 +1,10 @@ +#ifndef _NET_INC
+#define _NET_INC
+
+// uncomment this if you need access elsewhere
+extern HANDLE hNetlibUser;
+
+void InitNetlib();
+void DeinitNetlib();
+
+#endif
\ No newline at end of file diff --git a/MySpace/options.cpp b/MySpace/options.cpp new file mode 100644 index 0000000..0da55b7 --- /dev/null +++ b/MySpace/options.cpp @@ -0,0 +1,89 @@ +#include "common.h"
+#include "options.h"
+#include "resource.h"
+
+Options options = {0};
+
+void LoadOptions() {
+ DBVARIANT dbv;
+ if(!DBGetContactSettingTString(0, MODULE, "email", &dbv)) {
+ _tcsncpy(options.email, dbv.ptszVal, 256);
+ DBFreeVariant(&dbv);
+ }
+ if(!DBGetContactSettingTString(0, MODULE, "pw", &dbv)) {
+ _tcsncpy(options.pw, dbv.ptszVal, 256);
+ DBFreeVariant(&dbv);
+ }
+}
+
+void SaveOptions() {
+ DBWriteContactSettingTString(0, MODULE, "email", options.email);
+ DBWriteContactSettingTString(0, MODULE, "pw", options.pw);
+}
+
+BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
+ static HANDLE hItemAll;
+
+ switch ( msg ) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault( hwndDlg );
+ SetDlgItemText(hwndDlg, IDC_ED_EMAIL, options.email);
+ SetDlgItemText(hwndDlg, IDC_ED_PW, options.pw);
+ return FALSE;
+ case WM_COMMAND:
+ if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) {
+ switch( LOWORD( wParam )) {
+ case IDC_ED_EMAIL:
+ case IDC_ED_PW:
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
+ }
+ break;
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code)
+ {
+ case PSN_APPLY:
+ GetDlgItemText(hwndDlg, IDC_ED_EMAIL, options.email, 256);
+ GetDlgItemText(hwndDlg, IDC_ED_PW, options.pw, 256);
+
+ SaveOptions();
+ }
+ break;
+ }
+ break;
+ }
+
+ return 0;
+}
+
+int OptInit(WPARAM wParam, LPARAM lParam) {
+ OPTIONSDIALOGPAGE odp = { 0 };
+ odp.cbSize = sizeof(odp);
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.flags |= ODPF_TCHAR;
+ odp.position = -790000000;
+ odp.hInstance = hInst;
+
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT1);
+ odp.ptszTitle = TranslateT(MODULE);
+ odp.ptszGroup = TranslateT("Network");
+ odp.ptszTab = TranslateT("Account");
+ odp.nIDBottomSimpleControl = 0;
+ odp.pfnDlgProc = DlgProcOpts;
+ CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+
+ return 0;
+}
+
+HANDLE hEventOptInit;
+void InitOptions() {
+ hEventOptInit = HookEvent(ME_OPT_INITIALISE, OptInit);
+ LoadOptions();
+}
+
+void DeinitOptions() {
+ UnhookEvent(hEventOptInit);
+}
diff --git a/MySpace/options.h b/MySpace/options.h new file mode 100644 index 0000000..2aea34c --- /dev/null +++ b/MySpace/options.h @@ -0,0 +1,14 @@ +#ifndef _OPTIONS_INC
+#define _OPTIONS_INC
+
+typedef struct {
+ TCHAR email[256];
+ TCHAR pw[256];
+} Options;
+
+extern Options options;
+
+void InitOptions();
+void DeinitOptions();
+
+#endif
diff --git a/MySpace/proto.cpp b/MySpace/proto.cpp new file mode 100644 index 0000000..4b3aa00 --- /dev/null +++ b/MySpace/proto.cpp @@ -0,0 +1,153 @@ +#include "common.h"
+#include "proto.h"
+#include "server_con.h"
+#include "resource.h"
+
+#define MAX_MESSAGE_SIZE 1024
+
+int GetCaps(WPARAM wParam,LPARAM lParam) {
+ int ret = 0;
+ switch (wParam) {
+ case PFLAGNUM_1:
+ //ret = PF1_IM | PF1_BASICSEARCH | PF1_ADDSEARCHRES | PF1_MODEMSG | PF1_FILE | PF1_CHAT;
+ ret = PF1_IM;// | PF1_BASICSEARCH | PF1_EXTSEARCHUI | PF1_ADDSEARCHRES | PF1_MODEMSG | PF1_FILE | PF1_CHAT;
+ break;
+ case PFLAGNUM_2:
+ ret = PF2_ONLINE;// | PF2_SHORTAWAY | PF2_HEAVYDND;
+ break;
+ case PFLAGNUM_3:
+ //ret = PF2_ONLINE;// | PF2_SHORTAWAY | PF2_HEAVYDND;
+ break;
+ case PFLAGNUM_4:
+ //ret = PF4_SUPPORTTYPING;
+ break;
+ case PFLAG_UNIQUEIDTEXT:
+ ret = (int) Translate("UserID");
+ break;
+ case PFLAG_MAXLENOFMESSAGE:
+ ret = MAX_MESSAGE_SIZE;
+ break;
+ case PFLAG_UNIQUEIDSETTING:
+ ret = (int) "UID";
+ break;
+ }
+ return ret;
+}
+
+int GetName(WPARAM wParam,LPARAM lParam) {
+ mir_snprintf((char *)lParam, wParam, "%s", MODULE);
+ return 0;
+}
+
+int LoadIcon(WPARAM wParam,LPARAM lParam) {
+
+ UINT id;
+ switch (wParam & 0xFFFF)
+ {
+ case PLI_PROTOCOL:
+ id = IDI_ICON_PROTO;
+ break;
+ case PLI_ONLINE:
+ id = IDI_ICON_PROTO;
+ break;
+ case PLI_OFFLINE:
+ id = IDI_ICON_PROTO;
+ break;
+ default:
+ return (int) (HICON) NULL;
+ }
+
+ return (int) LoadImage(hInst, MAKEINTRESOURCE(id), IMAGE_ICON,
+ GetSystemMetrics(wParam & PLIF_SMALL ? SM_CXSMICON : SM_CXICON),
+ GetSystemMetrics(wParam & PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
+ return 0;
+}
+
+int GetInfo(WPARAM wParam,LPARAM lParam) {
+ return 0;
+}
+
+int SetStatus(WPARAM wParam,LPARAM lParam) {
+ if(wParam != ID_STATUS_OFFLINE)
+ InitServerConnection();
+ else
+ DeinitServerConnection();
+ return 0;
+}
+
+int GetStatus(WPARAM wParam,LPARAM lParam) {
+ return status;
+}
+
+int ProtoSendMessage(WPARAM wParam, LPARAM lParam) {
+ CCSDATA *ccs = (CCSDATA *) lParam;
+ char *message = (char *)ccs->lParam;
+
+ // TODO: process 'message' and/or 'messagew' below
+ if(ccs->wParam & PREF_UNICODE) {
+ wchar_t *messagew = (wchar_t *)&message[strlen(message)+1];
+ } else if(ccs->wParam & PREF_UTF) {
+ // message is utf8 encoded - you can use mir_utf8decode (m_system.h) to make it wide
+ } else {
+ }
+
+ return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+}
+
+int ProtoSendMessageW(WPARAM wParam, LPARAM lParam) {
+ CCSDATA *ccs = (CCSDATA *) lParam;
+ ccs->wParam |= PREF_UNICODE;
+
+ return ProtoSendMessage(wParam, lParam);
+}
+
+int ProtoRecvMessage(WPARAM wParam, LPARAM lParam) {
+ CCSDATA *ccs = (CCSDATA *) lParam;
+ PROTORECVEVENT *pre = (PROTORECVEVENT *) ccs->lParam;
+
+ char *message = pre->szMessage;
+
+ // TODO: process 'message' and/or 'messagew' below
+ if(pre->flags & PREF_UNICODE) {
+ wchar_t *messagew = (wchar_t *)&message[strlen(message)+1];
+ } else if(pre->flags & PREF_UTF) {
+ // message is utf8 encoded - you can use mir_utf8decode (m_system.h) to make it wide
+ }
+
+ return CallService(MS_PROTO_CHAINRECV, wParam, lParam);
+}
+
+
+
+void RegisterProto() {
+ PROTOCOLDESCRIPTOR pd = {0};
+ pd.cbSize = sizeof(pd);
+ pd.szName = MODULE;
+ pd.type = PROTOTYPE_PROTOCOL;
+ CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
+}
+
+#define NUM_FILTER_SERVICES 9
+HANDLE hServices[NUM_FILTER_SERVICES];
+
+void CreateProtoServices() {
+ // create our services
+ int i = 0;
+ hServices[i++] = CreateProtoServiceFunction(MODULE, PSS_MESSAGE, ProtoSendMessage);
+ hServices[i++] = CreateProtoServiceFunction(MODULE, PSS_MESSAGE"W", ProtoSendMessageW);
+ hServices[i++] = CreateProtoServiceFunction(MODULE, PSR_MESSAGE, ProtoRecvMessage);
+
+ hServices[i++] = CreateProtoServiceFunction(MODULE, PS_GETCAPS, GetCaps);
+ hServices[i++] = CreateProtoServiceFunction(MODULE, PS_GETNAME, GetName);
+ hServices[i++] = CreateProtoServiceFunction(MODULE, PS_LOADICON,LoadIcon);
+ hServices[i++] = CreateProtoServiceFunction(MODULE, PSS_GETINFO,GetInfo);
+ hServices[i++] = CreateProtoServiceFunction(MODULE, PS_SETSTATUS, SetStatus);
+ hServices[i++] = CreateProtoServiceFunction(MODULE, PS_GETSTATUS, GetStatus);
+
+ // remember to modify the NUM_FILTER_SERVICES #define above if you add more services!
+}
+
+void DeinitProto() {
+ for(int i = 0; i < NUM_FILTER_SERVICES; i++)
+ DestroyServiceFunction(hServices[i]);
+}
\ No newline at end of file diff --git a/MySpace/proto.h b/MySpace/proto.h new file mode 100644 index 0000000..d45c485 --- /dev/null +++ b/MySpace/proto.h @@ -0,0 +1,8 @@ +#ifndef _PROTO_INC
+#define _PROTO_INC
+
+void RegisterProto();
+void CreateProtoServices();
+void DeinitProto();
+
+#endif
diff --git a/MySpace/readme.txt b/MySpace/readme.txt new file mode 100644 index 0000000..d649f60 --- /dev/null +++ b/MySpace/readme.txt @@ -0,0 +1,47 @@ +========================================================================
+ Miranda Plugin : MySpace Project Overview
+========================================================================
+
+Miranda Plugin has created this MySpace project for you as a starting point.
+
+This file contains a summary of what you will find in each of the files that make up your project.
+
+MySpace.vcproj
+ This is the main project file for projects generated using an Application Wizard.
+ It contains information about the version of the product that generated the file, and
+ information about the platforms, configurations, and project features selected with the
+ Application Wizard.
+
+MySpace.cpp
+ Main plugin file. Contains the functions necessary for the plugin to load.
+
+MySpace.rc
+ Project resources - this is the the only resource file that should require editing on your part!
+ This file contains for example the options dialog page.
+
+version.h
+ Version information
+
+version.rc
+ Version resource - do not edit!
+
+common.h
+ Common includes - also acts as the procompiled header file for the project.
+
+common.cpp
+ Just includes the common.h header file.
+
+resource.h
+ Resource defines
+
+resource.rc
+ Binds together the version and plugin resources - do not edit!
+
+options.cpp
+options.h
+ These files contain the dialog procedure for the options page, and placeholders for options including save and load routines.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/MySpace/resource.h b/MySpace/resource.h new file mode 100644 index 0000000..a9d9bb1 --- /dev/null +++ b/MySpace/resource.h @@ -0,0 +1,21 @@ +//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by MySpace.rc
+//
+#define IDD_OPT1 109
+#define IDI_MENU 110
+#define IDI_ICON1 120
+#define IDI_ICON_PROTO 120
+#define IDC_ED_EMAIL 1001
+#define IDC_ED_PW 1002
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 121
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1002
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/MySpace/resource.rc b/MySpace/resource.rc new file mode 100644 index 0000000..949b789 --- /dev/null +++ b/MySpace/resource.rc @@ -0,0 +1,2 @@ +#include "version.rc"
+#include "MySpace.rc"
diff --git a/MySpace/server_con.cpp b/MySpace/server_con.cpp new file mode 100644 index 0000000..f3c6d79 --- /dev/null +++ b/MySpace/server_con.cpp @@ -0,0 +1,124 @@ +#include "common.h"
+#include "server_con.h"
+#include "net.h"
+
+#include "NetMessage.h"
+
+#define SERVER_READ_BUFFER_SIZE (1024 * 32)
+
+int status = ID_STATUS_OFFLINE;
+bool server_running = false, server_stop = false;
+HANDLE server_connection = 0;
+
+void CALLBACK sttMainThreadStatusCallback( ULONG dwParam ) {
+ if(status != dwParam) {
+ int previous_status = status;
+ status = dwParam;
+ ProtoBroadcastAck(MODULE,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS, (HANDLE)previous_status, status);
+ }
+}
+
+int waitcallback(unsigned int *timeout) {
+ PUShowMessage("waitcallback", SM_NOTIFY);
+ return server_stop ? 0 : 1;
+}
+
+int try_ports[9] = {1863, 6660,6661,6662,6665,6668,6669,80,0443};
+
+void __cdecl ServerThreadFunc(void*) {
+ NETLIBOPENCONNECTION conn_data = {0};
+ conn_data.cbSize = sizeof(NETLIBOPENCONNECTION);
+ conn_data.flags = NLOCF_V2;
+ conn_data.szHost = "im.myspace.akadns.net";
+ conn_data.wPort = DBGetContactSettingDword(0, MODULE, "LastPort", try_ports[0]);
+ conn_data.timeout = 10;
+ conn_data.waitcallback = waitcallback;
+
+ QueueUserAPC(sttMainThreadStatusCallback, mainThread, ID_STATUS_CONNECTING);
+
+ server_running = true;
+
+ char *recv_buffer = new char[SERVER_READ_BUFFER_SIZE];
+ int bytes = 0;
+ char mt[256];
+ int tries = 0;
+ bool login = true;
+
+ while(!Miranda_Terminated() && !server_stop) {
+ if(login) {
+ if(server_connection) Netlib_CloseHandle(server_connection);
+ server_connection = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlibUser, (LPARAM)&conn_data);
+ }
+ bytes = Netlib_Recv(server_connection, (char *)recv_buffer, SERVER_READ_BUFFER_SIZE, MSG_DUMPASTEXT);
+
+ if(bytes == 0) {
+ PUShowMessage("Connection closed", SM_NOTIFY);
+ if(login && tries < 9) {
+ conn_data.wPort = try_ports[tries++];
+ } else
+ break;
+ } else if(bytes == SOCKET_ERROR) {
+ PUShowMessage("Socket ERROR", SM_NOTIFY);
+ break;
+ } else {
+ if(login) {
+ login = false;
+ QueueUserAPC(sttMainThreadStatusCallback, mainThread, ID_STATUS_ONLINE);
+ }
+
+ mir_snprintf(mt, 256, "recvd %d bytes", bytes);
+ PUShowMessage(mt, SM_NOTIFY);
+
+ NetMessage msg;
+ msg.parse(recv_buffer, bytes);
+ if(msg.exists(NMString("lc"))) {
+ NMString val;
+ msg.get(NMString("lc"), val);
+ mir_snprintf(mt, 256, "Login message: type is %s", val.text);
+ PUShowMessage(mt, SM_NOTIFY);
+ // challenge/response:
+ //
+ } else if(msg.exists(NMString("persistr"))) {
+ NMString cmd, dsn, lid;
+ msg.get(NMString("cmd"), cmd);
+ msg.get(NMString("dsn"), dsn);
+ msg.get(NMString("lid"), lid);
+ mir_snprintf(mt, 256, "Perist message: type is %s,%s,%s", cmd.text, dsn.text, lid.text);
+ PUShowMessage(mt, SM_NOTIFY);
+ }
+ }
+ }
+ if(server_connection) {
+ Netlib_CloseHandle(server_connection);
+ server_connection = 0;
+ }
+ delete recv_buffer;
+
+ QueueUserAPC(sttMainThreadStatusCallback, mainThread, ID_STATUS_OFFLINE);
+ server_running = false;
+}
+
+void StartThread() {
+ if(!server_running) {
+ server_stop = false;
+ mir_forkthread(ServerThreadFunc, 0);
+ }
+}
+
+void StopThread() {
+ if(server_running) {
+ server_stop = true;
+ if(server_connection) {
+ Netlib_CloseHandle(server_connection);
+ server_connection = 0;
+ }
+ }
+}
+
+void InitServerConnection() {
+ StartThread();
+}
+
+void DeinitServerConnection() {
+ StopThread();
+}
diff --git a/MySpace/server_con.h b/MySpace/server_con.h new file mode 100644 index 0000000..e051f87 --- /dev/null +++ b/MySpace/server_con.h @@ -0,0 +1,9 @@ +#ifndef _SERVER_CON_INC
+#define _SERVER_CON_INC
+
+extern int status;
+
+void InitServerConnection();
+void DeinitServerConnection();
+
+#endif
diff --git a/MySpace/version.h b/MySpace/version.h new file mode 100644 index 0000000..d9c3688 --- /dev/null +++ b/MySpace/version.h @@ -0,0 +1,26 @@ +// Set the version number here - it will affect the version resource and the version field of the pluginInfo structure
+// (Be careful that you don't have the resource file open when you change this and rebuild, otherwise the changes may not
+// take effect within the version resource)
+
+#define __MAJOR_VERSION 0
+#define __MINOR_VERSION 0
+#define __RELEASE_NUM 0
+#define __BUILD_NUM 1
+
+#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
+#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
+#define __STRINGIFY(x) #x
+#define __VERSION_STRING __STRINGIFY(__FILEVERSION_STRING_DOTS)
+
+#ifdef _UNICODE
+#define __PLUGIN_NAME "MySpace (Unicode)"
+#else
+#define __PLUGIN_NAME "MySpace"
+#endif
+#define __FILENAME "MySpace.dll"
+
+#define __DESC "MySpace IM protocol"
+#define __AUTHOR "Scott Ellis"
+#define __AUTHOREMAIL "mail@scottellis.com.au"
+#define __AUTHORWEB "http://www.scottellis.com.au"
+#define __COPYRIGHT "© 2007 Scott Ellis"
diff --git a/MySpace/version.rc b/MySpace/version.rc new file mode 100644 index 0000000..0bb7a49 --- /dev/null +++ b/MySpace/version.rc @@ -0,0 +1,33 @@ +
+#include <windows.h>
+#include "version.h"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION __FILEVERSION_STRING
+ PRODUCTVERSION __FILEVERSION_STRING
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "000004b0"
+ BEGIN
+ VALUE "Author", __AUTHOR
+ VALUE "FileDescription", __DESC
+ VALUE "InternalName", __PLUGIN_NAME
+ VALUE "LegalCopyright", __COPYRIGHT
+ VALUE "OriginalFilename", __FILENAME
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0, 1200
+ END
+END
|