From fc70234c12fc3f9825484bdba094f306d0779c88 Mon Sep 17 00:00:00 2001 From: sje Date: Sun, 1 Jul 2007 11:21:23 +0000 Subject: format text, incoming & outgoing updater support encrypt password in db git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@229 4f64403b-2f21-0410-a795-97e2b3489a10 --- MySpace/MySpace.cpp | 35 ++++ MySpace/MySpace.sln | 26 --- MySpace/MySpace.vcproj | 531 ----------------------------------------------- MySpace/MySpace_8.vcproj | 8 + MySpace/common.h | 1 + MySpace/options.cpp | 11 +- MySpace/proto.cpp | 8 +- MySpace/server_con.cpp | 4 + MySpace/version.h | 4 +- 9 files changed, 66 insertions(+), 562 deletions(-) delete mode 100644 MySpace/MySpace.sln delete mode 100644 MySpace/MySpace.vcproj (limited to 'MySpace') diff --git a/MySpace/MySpace.cpp b/MySpace/MySpace.cpp index aa229b5..6121fa3 100644 --- a/MySpace/MySpace.cpp +++ b/MySpace/MySpace.cpp @@ -37,12 +37,16 @@ extern "C" BOOL APIENTRY DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvRe } extern "C" __declspec (dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) { + if (mirandaVersion < PLUGIN_MAKE_VERSION(0, 7, 0, 30)) + return 0; return &pluginInfo; } // uncomment this for pre 0.7 compatibility extern "C" __declspec (dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion) { + if (mirandaVersion < PLUGIN_MAKE_VERSION(0, 7, 0, 30)) + return 0; pluginInfo.cbSize = sizeof(PLUGININFO); return (PLUGININFO*)&pluginInfo; } @@ -54,6 +58,37 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) } int ModulesLoaded(WPARAM wParam, LPARAM lParam) { + if(ServiceExists(MS_UPDATE_REGISTER)) { + // register with updater + Update update = {0}; + char szVersion[16]; + + update.cbSize = sizeof(Update); + + update.szComponentName = pluginInfo.shortName; + update.pbVersion = (BYTE *)CreateVersionString(pluginInfo.version, szVersion); + update.cpbVersion = strlen((char *)update.pbVersion); + + update.szUpdateURL = UPDATER_AUTOREGISTER; + + // these are the three lines that matter - the archive, the page containing the version string, and the text (or data) + // before the version that we use to locate it on the page + // (note that if the update URL and the version URL point to standard file listing entries, the backend xml + // data will be used to check for updates rather than the actual web page - this is not true for beta urls) +#ifdef _UNICODE + update.szBetaUpdateURL = "http://www.scottellis.com.au/miranda_plugins/MySpace.zip"; + update.szBetaVersionURL = "http://www.scottellis.com.au/miranda_plugins/ver_MySpace.html"; +#else + update.szBetaUpdateURL = "http://www.scottellis.com.au/miranda_plugins/MySpace_ansi.zip"; + update.szBetaVersionURL = "http://www.scottellis.com.au/miranda_plugins/ver_MySpace_ansi.html"; +#endif + update.pbBetaVersionPrefix = (BYTE *)"MySpace version "; + + update.cpbBetaVersionPrefix = strlen((char *)update.pbBetaVersionPrefix); + + CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update); + } + InitNetlib(); InitMenu(); diff --git a/MySpace/MySpace.sln b/MySpace/MySpace.sln deleted file mode 100644 index 688791b..0000000 --- a/MySpace/MySpace.sln +++ /dev/null @@ -1,26 +0,0 @@ - -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 deleted file mode 100644 index 0a5889f..0000000 --- a/MySpace/MySpace.vcproj +++ /dev/null @@ -1,531 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MySpace/MySpace_8.vcproj b/MySpace/MySpace_8.vcproj index 0a5889f..5b4cacb 100644 --- a/MySpace/MySpace_8.vcproj +++ b/MySpace/MySpace_8.vcproj @@ -344,6 +344,10 @@ /> + + @@ -394,6 +398,10 @@ RelativePath=".\common.h" > + + diff --git a/MySpace/common.h b/MySpace/common.h index 6ba2650..4a4f3de 100644 --- a/MySpace/common.h +++ b/MySpace/common.h @@ -47,6 +47,7 @@ #include #include +#include //////////// // included for backward compatibility diff --git a/MySpace/options.cpp b/MySpace/options.cpp index cf592d8..e8ee938 100644 --- a/MySpace/options.cpp +++ b/MySpace/options.cpp @@ -10,6 +10,10 @@ void LoadOptions() { _tcsncpy(options.email, dbv.ptszVal, 256); DBFreeVariant(&dbv); } + if(!DBGetContactSettingTString(0, MODULE, "password", &dbv)) { + _tcsncpy(options.pw, dbv.ptszVal, 256); + CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)(256 * sizeof(TCHAR)), (LPARAM)options.pw); + } else if(!DBGetContactSettingTString(0, MODULE, "pw", &dbv)) { _tcsncpy(options.pw, dbv.ptszVal, 256); DBFreeVariant(&dbv); @@ -28,7 +32,12 @@ void LoadOptions() { void SaveOptions() { DBWriteContactSettingTString(0, MODULE, "email", options.email); - DBWriteContactSettingTString(0, MODULE, "pw", options.pw); + + //DBWriteContactSettingTString(0, MODULE, "pw", options.pw); + TCHAR buff[256]; + _tcsncpy(buff, options.pw, 256); + CallService(MS_DB_CRYPT_ENCODESTRING, (WPARAM)(256 * sizeof(TCHAR)), (LPARAM)buff); + DBWriteContactSettingTString(0, MODULE, "password", buff); DBWriteContactSettingByte(0, MODULE, "sound", options.sound ? 1 : 0); DBWriteContactSettingByte(0, MODULE, "privacy_mode", (BYTE)options.privacy_mode); diff --git a/MySpace/proto.cpp b/MySpace/proto.cpp index b2f03d9..21fb0af 100644 --- a/MySpace/proto.cpp +++ b/MySpace/proto.cpp @@ -2,6 +2,7 @@ #include "proto.h" #include "server_con.h" #include "resource.h" +#include "formatting.h" #define FAILED_MESSAGE_HANDLE 99998 @@ -123,7 +124,7 @@ static DWORD CALLBACK sttFakeAckMessageFailed( LPVOID param ) int ProtoSendMessage(WPARAM wParam, LPARAM lParam) { CCSDATA *ccs = (CCSDATA *) lParam; char *message = (char *)ccs->lParam; - char msg_utf[MAX_MESSAGE_SIZE]; + char msg_utf[MAX_MESSAGE_SIZE], msg_fmt[MAX_MESSAGE_SIZE]; int uid; if((uid = DBGetContactSettingDword(ccs->hContact, MODULE, "UID", 0)) == 0 || status == ID_STATUS_OFFLINE) { @@ -153,13 +154,16 @@ int ProtoSendMessage(WPARAM wParam, LPARAM lParam) { } msg_utf[MAX_MESSAGE_SIZE-1] = 0; + entitize(msg_utf, MAX_MESSAGE_SIZE); + mir_snprintf(msg_fmt, MAX_MESSAGE_SIZE, "

%s

", msg_utf); + ClientNetMessage msg; msg.add_int("bm", 1); msg.add_int("sesskey", sesskey); msg.add_int("t", uid); msg.add_int("f", my_uid); msg.add_int("cv", CLIENT_VER); - msg.add_string("msg", msg_utf); + msg.add_string("msg", msg_fmt); SendMessage(msg); HANDLE hEvent; diff --git a/MySpace/server_con.cpp b/MySpace/server_con.cpp index 35e7da1..56560d6 100644 --- a/MySpace/server_con.cpp +++ b/MySpace/server_con.cpp @@ -4,6 +4,7 @@ #include "arc4.h" #include "options.h" #include "nick_dialog.h" +#include "formatting.h" #include @@ -399,6 +400,9 @@ void __cdecl ServerThreadFunc(void*) { } char text[MAX_MESSAGE_SIZE]; if(msg.get_string("msg", text, MAX_MESSAGE_SIZE)) { + strip_tags(text); + unentitize(text); + PROTORECVEVENT pre = {0}; pre.flags = PREF_UTF; pre.szMessage = text; diff --git a/MySpace/version.h b/MySpace/version.h index d9c3688..36db18d 100644 --- a/MySpace/version.h +++ b/MySpace/version.h @@ -4,8 +4,8 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 0 -#define __RELEASE_NUM 0 -#define __BUILD_NUM 1 +#define __RELEASE_NUM 1 +#define __BUILD_NUM 0 #define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM #define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM -- cgit v1.2.3