From 789ba90877324825f572cacdbe03bdc26a645b35 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Tue, 17 Nov 2009 23:12:10 +0200 Subject: new file: commonheaders.h new file: constants.h new file: init.c new file: main.c new file: main.h new file: options.c new file: resource.h new file: utilities.c new file: watrack_mpd.rc new file: watrack_mpd.vcproj --- watrack_mpd/commonheaders.h | 38 +++ watrack_mpd/constants.h | 1 + watrack_mpd/init.c | 87 ++++++ watrack_mpd/main.c | 22 ++ watrack_mpd/main.h | 35 +++ watrack_mpd/options.c | 22 ++ watrack_mpd/resource.h | 27 ++ watrack_mpd/utilities.c | 109 +++++++ watrack_mpd/watrack_mpd.rc | 116 ++++++++ watrack_mpd/watrack_mpd.vcproj | 660 +++++++++++++++++++++++++++++++++++++++++ 10 files changed, 1117 insertions(+) create mode 100755 watrack_mpd/commonheaders.h create mode 100755 watrack_mpd/constants.h create mode 100755 watrack_mpd/init.c create mode 100755 watrack_mpd/main.c create mode 100755 watrack_mpd/main.h create mode 100755 watrack_mpd/options.c create mode 100755 watrack_mpd/resource.h create mode 100755 watrack_mpd/utilities.c create mode 100755 watrack_mpd/watrack_mpd.rc create mode 100755 watrack_mpd/watrack_mpd.vcproj diff --git a/watrack_mpd/commonheaders.h b/watrack_mpd/commonheaders.h new file mode 100755 index 0000000..3f9606f --- /dev/null +++ b/watrack_mpd/commonheaders.h @@ -0,0 +1,38 @@ +// Copyright © 2008 sss, chaos.persei +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include +#include +#include + + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "resource.h" + +#include "main.h" +#include "constants.h" +#include "m_dos.h" diff --git a/watrack_mpd/constants.h b/watrack_mpd/constants.h new file mode 100755 index 0000000..e46841b --- /dev/null +++ b/watrack_mpd/constants.h @@ -0,0 +1 @@ +#define szModuleName "Watrack_MPD" diff --git a/watrack_mpd/init.c b/watrack_mpd/init.c new file mode 100755 index 0000000..e59127d --- /dev/null +++ b/watrack_mpd/init.c @@ -0,0 +1,87 @@ +// Copyright © 2009 sss +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "commonheaders.h" + + +#define PLUGIN_NAME "Watrack_MPD" + +HINSTANCE hInst; +PLUGINLINK *pluginLink; +static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam); +extern char *date(); + + +PLUGININFOEX pluginInfo={ + sizeof(PLUGININFOEX), + 0, + PLUGIN_MAKE_VERSION(0,0,0,6), + "Music Player Daemon support for watrack", + "sss, others..", + "sss123next@list.ru", + "© 2009 sss, others...", + "http://sss.chaoslab.ru:81/tracker/mim_plugs/", + 1, //unicode + 0, //doesn't replace anything built-in + { 0x420ccb93, 0x589f, 0x40e5, { 0x80, 0xa1, 0x91, 0xdb, 0x18, 0xf1, 0xc5, 0xbd } } + +}; + +BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) +{ + hInst=hinstDLL; + return TRUE; +} + +__declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +{ + { + static char plugname[52]; + strcpy(plugname, PLUGIN_NAME" ["); + strcat(plugname, date()); + strcat(plugname, " "); + strcat(plugname, __TIME__); + strcat(plugname, "]"); + pluginInfo.shortName = plugname; + } + return &pluginInfo; +} + +static const MUUID interfaces[] = {MIID_SERVICEMODE, MIID_LAST}; +__declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) +{ + return interfaces; +} + +int __declspec(dllexport) Load(PLUGINLINK *link) +{ + pluginLink=link; + HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded); + mir_getMMI(&mmi); + mir_getUTFI(&utfi); + return 0; +} + +static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) +{ + return 0; +} + + +int __declspec(dllexport) Unload(void) +{ + return 0; +} \ No newline at end of file diff --git a/watrack_mpd/main.c b/watrack_mpd/main.c new file mode 100755 index 0000000..b754f8d --- /dev/null +++ b/watrack_mpd/main.c @@ -0,0 +1,22 @@ +// Copyright © 2008 sss, chaos.persei +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + + + +#include "commonheaders.h" + + diff --git a/watrack_mpd/main.h b/watrack_mpd/main.h new file mode 100755 index 0000000..fab2245 --- /dev/null +++ b/watrack_mpd/main.h @@ -0,0 +1,35 @@ +// Copyright © 2008 sss, chaos.persei +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +DWORD __stdcall DosFunction(LPVOID lp); +HANDLE CreateThreadEx(pThreadFuncEx AFunc, void* arg, DWORD* pThreadID); +TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, TCHAR* szDef); +int DosOptInit(WPARAM, LPARAM); +unsigned int MsgRate; +unsigned int MsgSize; +unsigned int MsgNumber; +unsigned int CharCount; +BOOL CustomMessage; +BOOL ForOnline; +BOOL ClientBased; +TCHAR* MsgText; +struct MM_INTERFACE mmi; +struct UTF8_INTERFACE utfi; +const TCHAR *stristr( const TCHAR *str, const TCHAR *substr); +void ModifyMenuOnStart(HANDLE hContact); +void ModifyMenuOnStop(HANDLE hContact); + diff --git a/watrack_mpd/options.c b/watrack_mpd/options.c new file mode 100755 index 0000000..d1cff16 --- /dev/null +++ b/watrack_mpd/options.c @@ -0,0 +1,22 @@ +// Copyright © 2008 sss, chaos.persei +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "commonheaders.h" +#include + + + + diff --git a/watrack_mpd/resource.h b/watrack_mpd/resource.h new file mode 100755 index 0000000..b245ff4 --- /dev/null +++ b/watrack_mpd/resource.h @@ -0,0 +1,27 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by dos.rc +// +#define IDD_OPT_DOS 104 +#define IDC_FOR_ONLINE 1003 +#define IDC_MSG_NUMBER 1004 +#define IDC_MSG_TEXT 1005 +#define IDC_MSG_RATE 1006 +#define IDC_ENABLE_CUSTOM_MESSAGE 1007 +#define IDC_FOR_ONLINE2 1008 +#define IDC_CLIENT_BASED 1008 +#define IDC_MESSAGE_SIZE 1009 +#define IDC_MSG_SIZE 1009 +#define IDC_MSG_SIZE2 1010 +#define IDC_CHAR_COUNT 1010 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1011 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/watrack_mpd/utilities.c b/watrack_mpd/utilities.c new file mode 100755 index 0000000..2a8fe0b --- /dev/null +++ b/watrack_mpd/utilities.c @@ -0,0 +1,109 @@ +// Copyright © 2008 sss, chaos.persei +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include "commonheaders.h" + +HANDLE CreateThreadEx(pThreadFuncEx AFunc, void* arg, DWORD* pThreadID) +{ + FORK_THREADEX_PARAMS params; + DWORD dwThreadId; + HANDLE hThread; + + params.pFunc = AFunc; + params.arg = arg; + params.iStackSize = 0; + params.threadID = &dwThreadId; + hThread = (HANDLE)CallService(MS_SYSTEM_FORK_THREAD_EX, 0, (LPARAM)¶ms); + if (pThreadID) + *pThreadID = dwThreadId; + + return hThread; +} + +TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, TCHAR* szDef) +{ + DBVARIANT dbv = {DBVT_DELETED}; + TCHAR* szRes; + if (DBGetContactSettingTString(hContact, szModule, szSetting, &dbv)) + return _tcsdup(szDef); + if(dbv.pszVal) + szRes = _tcsdup(dbv.ptszVal); + DBFreeVariant(&dbv); + return szRes; +} + +// case-insensitive _tcsstr +#define NEWTSTR_ALLOCA(A) (A==NULL)?NULL:_tcscpy((TCHAR*)alloca(sizeof(TCHAR)*(_tcslen(A)+1)),A) +const TCHAR *stristr( const TCHAR *str, const TCHAR *substr) +{ + TCHAR *p; + TCHAR *str_up = NEWTSTR_ALLOCA(str); + TCHAR *substr_up = NEWTSTR_ALLOCA(substr); + + CharUpperBuff(str_up, lstrlen(str_up)); + CharUpperBuff(substr_up, lstrlen(substr_up)); + + p = _tcsstr(str_up, substr_up); + return p ? (str + (p - str_up)) : NULL; +} + +char *date() +{ + static char d[11]; + char *tmp = __DATE__, m[4], mn[3] = "01"; + m[0]=tmp[0]; + m[1]=tmp[1]; + m[2]=tmp[2]; + if(strstr(m,"Jan")) + strcpy(mn,"01"); + else if(strstr(m,"Feb")) + strcpy(mn,"02"); + else if(strstr(m,"Mar")) + strcpy(mn,"03"); + else if(strstr(m,"Apr")) + strcpy(mn,"04"); + else if(strstr(m,"May")) + strcpy(mn,"05"); + else if(strstr(m,"Jun")) + strcpy(mn,"06"); + else if(strstr(m,"Jul")) + strcpy(mn,"07"); + else if(strstr(m,"Aug")) + strcpy(mn,"08"); + else if(strstr(m,"Sep")) + strcpy(mn,"09"); + else if(strstr(m,"Oct")) + strcpy(mn,"10"); + else if(strstr(m,"Nov")) + strcpy(mn,"11"); + else if(strstr(m,"Dec")) + strcpy(mn,"12"); + d[0]=tmp[7]; + d[1]=tmp[8]; + d[2]=tmp[9]; + d[3]=tmp[10]; + d[4]='.'; + d[5]=mn[0]; + d[6]=mn[1]; + d[7]='.'; + if (tmp[4] == ' ') + d[8] = '0'; + else + d[8]=tmp[4]; + d[9]=tmp[5]; + return d; +} diff --git a/watrack_mpd/watrack_mpd.rc b/watrack_mpd/watrack_mpd.rc new file mode 100755 index 0000000..df9c41f --- /dev/null +++ b/watrack_mpd/watrack_mpd.rc @@ -0,0 +1,116 @@ +// 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 + +///////////////////////////////////////////////////////////////////////////// +// Russian resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) +#ifdef _WIN32 +LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT +#pragma code_page(1251) +#endif //_WIN32 + +#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 + +#endif // Russian resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// +IDD_OPT_DOS DIALOGEX 0, 0, 268, 214 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +FONT 8, "MS Shell Dlg", 400, 0, 0x0 +BEGIN + CONTROL "Send only to online contacts",IDC_FOR_ONLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,106,106,10 + EDITTEXT IDC_MSG_NUMBER,155,13,40,14,ES_AUTOHSCROLL + EDITTEXT IDC_MSG_TEXT,109,32,145,14,ES_AUTOHSCROLL + EDITTEXT IDC_MSG_RATE,155,58,40,14,ES_AUTOHSCROLL + CONTROL "Send custom message:",IDC_ENABLE_CUSTOM_MESSAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,34,98,8 + LTEXT "Message rate (ms):",IDC_STATIC,7,61,88,8 + EDITTEXT IDC_MSG_SIZE,155,75,40,14,ES_AUTOHSCROLL + LTEXT "Message size (bytes):",IDC_STATIC,7,78,75,8 + LTEXT "Number of messgaes (0 for infinite):",IDC_STATIC,7,14,121,8 + CONTROL "Client based method",IDC_CLIENT_BASED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,117,81,10 + LTEXT "Random characters count:",IDC_STATIC,7,92,110,8 + EDITTEXT IDC_CHAR_COUNT,155,91,40,12,ES_AUTOHSCROLL +END + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_OPT_DOS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 261 + TOPMARGIN, 7 + BOTTOMMARGIN, 207 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/watrack_mpd/watrack_mpd.vcproj b/watrack_mpd/watrack_mpd.vcproj new file mode 100755 index 0000000..8ec6ac4 --- /dev/null +++ b/watrack_mpd/watrack_mpd.vcproj @@ -0,0 +1,660 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3