diff options
| -rw-r--r-- | plugins/CmdLine/MimCmd/MimCmd.cpp | 40 | ||||
| -rw-r--r-- | plugins/CmdLine/MimCmd/MimCmd.vcxproj | 37 | ||||
| -rw-r--r-- | plugins/CmdLine/MimCmd/MimCmd.vcxproj.filters | 10 | ||||
| -rw-r--r-- | plugins/CmdLine/MimCmd/commands.cpp | 2 | ||||
| -rw-r--r-- | plugins/CmdLine/MimCmd/commands.h | 2 | ||||
| -rw-r--r-- | plugins/CmdLine/MimCmd/common.h | 10 | ||||
| -rw-r--r-- | plugins/CmdLine/MimCmd/langpack.cpp | 377 | ||||
| -rw-r--r-- | plugins/CmdLine/MimCmd/langpack.h | 92 | ||||
| -rw-r--r-- | plugins/CmdLine/hooked_events.h | 2 | ||||
| -rw-r--r-- | plugins/CmdLine/mimcmd_data.h | 6 | ||||
| -rw-r--r-- | plugins/CmdLine/mimcmd_handlers.h | 3 | ||||
| -rw-r--r-- | plugins/CmdLine/mimcmd_ipc.h | 2 | ||||
| -rw-r--r-- | plugins/CmdLine/services.h | 2 | ||||
| -rw-r--r-- | plugins/CmdLine/utils.h | 1 | 
14 files changed, 63 insertions, 523 deletions
diff --git a/plugins/CmdLine/MimCmd/MimCmd.cpp b/plugins/CmdLine/MimCmd/MimCmd.cpp index 2709d6c034..cfd0e9b835 100644 --- a/plugins/CmdLine/MimCmd/MimCmd.cpp +++ b/plugins/CmdLine/MimCmd/MimCmd.cpp @@ -19,10 +19,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */
  #include "common.h"
 +#include "..\utils.h"
 +#include "..\version.h"
 -//why ??
 -//Who's using it ?
 -PLUGINLINK *pluginLink;
 +int hLangpack = 0;
 +
 +int lpprintf(const char *format, ...)
 +{
 +	va_list va;
 +	va_start(va, format);
 +	const int MAX_SIZE = 16192;
 +	char buffer[MAX_SIZE] = {0};
 +	int len = _vsnprintf(buffer, MAX_SIZE - 1, format, va);
 +	buffer[MAX_SIZE - 1] = 0;
 +	va_end(va);
 +	CharToOemBuff(buffer, buffer, len);
 +	printf("%s", buffer);
 +
 +	return len;
 +}
  char *GetProgramName(char *programName, int size)
  {
 @@ -36,7 +51,7 @@ char *GetProgramName(char *programName, int size)  	else{
  		STRNCPY(programName, name, size);
  	}
 -	
 +
  	return programName;
  }
 @@ -44,7 +59,7 @@ void PrintUsage()  {
  	char name[128];
  	GetProgramName(name, sizeof(name));
 -	
 +
  	lpprintf(Translate("%s usage:\n"), name);
  	lpprintf(Translate("%s <command> [<param> [, <param> ..]]\n"), name);
  	lpprintf(Translate("This will tell Miranda to run the specified command. The commands can have zero, one or more parameters. Use '%s help' to get a list of possible commands.\n"), name);
 @@ -57,7 +72,7 @@ void ShowVersion()  	char message[1024];
  	GetProgramName(name, sizeof(name));
  	mir_snprintf(message, sizeof(message), Translate("%s version %s"), name, __VERSION_STRING);
 -	
 +
  	lpprintf("%s\n", message);
  }
 @@ -67,14 +82,13 @@ int main(int argc, char *argv[])  	if ((argc == 2) && (strcmp(argv[1], "-v") == 0))
  	{
  		ShowVersion();
 -		
 +
  		return 0;
  	}
 -	
 -	if ((InitClient()) || (ConnectToMiranda()) || (GetKnownCommands()) || (LoadLangPackModule(sdCmdLine->mimFolder)))
 +
 +	if ((InitClient()) || (ConnectToMiranda()) || (GetKnownCommands()) || (LoadLangPackModule()))
  	{
 -		LoadLangPackModule(".");
 -		lpprintf(Translate("Could not create connection with Miranda or could not retrieve list of known commands.\n"));
 +		lpprintf("Could not create connection with Miranda or could not retrieve list of known commands.\n");
  		error = MIMRES_NOMIRANDA;
  	}
  	else{
 @@ -92,14 +106,12 @@ int main(int argc, char *argv[])  			else{
  				lpprintf(Translate("Unknown command '%s'.\n"), argv[1]);
  			}
 -			
 +
  			DestroyKnownCommands();
  			DisconnectFromMiranda();
  			DestroyClient();
 -			LangPackShutdown();
  		}
  	}
  	return error;
  }
 -
 diff --git a/plugins/CmdLine/MimCmd/MimCmd.vcxproj b/plugins/CmdLine/MimCmd/MimCmd.vcxproj index f4f14a4859..a5e0a44959 100644 --- a/plugins/CmdLine/MimCmd/MimCmd.vcxproj +++ b/plugins/CmdLine/MimCmd/MimCmd.vcxproj @@ -71,19 +71,22 @@    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
      <ClCompile>
        <Optimization>Disabled</Optimization>
 -      <AdditionalIncludeDirectories>..\;..\..\..\include;..\..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 +      <AdditionalIncludeDirectories>..\..\..\include;..\..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
        <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
        <MinimalRebuild>true</MinimalRebuild>
        <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
        <WarningLevel>Level3</WarningLevel>
        <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
 +      <PrecompiledHeader>Use</PrecompiledHeader>
 +      <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
      </ClCompile>
      <Link>
        <GenerateDebugInformation>true</GenerateDebugInformation>
 -      <SubSystem>Windows</SubSystem>
 +      <SubSystem>Console</SubSystem>
        <RandomizedBaseAddress>false</RandomizedBaseAddress>
        <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
 +      <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
      </Link>
      <ResourceCompile>
        <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 @@ -93,18 +96,21 @@    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
      <ClCompile>
        <Optimization>Disabled</Optimization>
 -      <AdditionalIncludeDirectories>..\;..\..\..\include;..\..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 +      <AdditionalIncludeDirectories>..\..\..\include;..\..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
        <PreprocessorDefinitions>WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
        <MinimalRebuild>true</MinimalRebuild>
        <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
        <WarningLevel>Level3</WarningLevel>
 +      <PrecompiledHeader>Use</PrecompiledHeader>
 +      <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
      </ClCompile>
      <Link>
        <GenerateDebugInformation>true</GenerateDebugInformation>
 -      <SubSystem>Windows</SubSystem>
 +      <SubSystem>Console</SubSystem>
        <RandomizedBaseAddress>false</RandomizedBaseAddress>
        <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
 +      <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
      </Link>
      <ResourceCompile>
        <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 @@ -113,19 +119,22 @@    </ItemDefinitionGroup>
    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
      <ClCompile>
 -      <AdditionalIncludeDirectories>..\;..\..\..\include;..\..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 +      <AdditionalIncludeDirectories>..\..\..\include;..\..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
        <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
        <WarningLevel>Level3</WarningLevel>
        <Optimization>Full</Optimization>
        <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
 +      <PrecompiledHeader>Use</PrecompiledHeader>
 +      <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
      </ClCompile>
      <Link>
        <GenerateDebugInformation>true</GenerateDebugInformation>
 -      <SubSystem>Windows</SubSystem>
 +      <SubSystem>Console</SubSystem>
        <OptimizeReferences>true</OptimizeReferences>
        <EnableCOMDATFolding>true</EnableCOMDATFolding>
        <RandomizedBaseAddress>false</RandomizedBaseAddress>
        <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
 +      <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
      </Link>
      <ResourceCompile>
        <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 @@ -134,19 +143,22 @@    </ItemDefinitionGroup>
    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
      <ClCompile>
 -      <AdditionalIncludeDirectories>..\;..\..\..\include;..\..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 +      <AdditionalIncludeDirectories>..\..\..\include;..\..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
        <PreprocessorDefinitions>WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
        <WarningLevel>Level3</WarningLevel>
        <Optimization>Full</Optimization>
        <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
 +      <PrecompiledHeader>Use</PrecompiledHeader>
 +      <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
      </ClCompile>
      <Link>
        <GenerateDebugInformation>true</GenerateDebugInformation>
 -      <SubSystem>Windows</SubSystem>
 +      <SubSystem>Console</SubSystem>
        <OptimizeReferences>true</OptimizeReferences>
        <EnableCOMDATFolding>true</EnableCOMDATFolding>
        <RandomizedBaseAddress>false</RandomizedBaseAddress>
        <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
 +      <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
      </Link>
      <ResourceCompile>
        <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 @@ -155,14 +167,17 @@    </ItemDefinitionGroup>
    <ItemGroup>
      <ClCompile Include="commands.cpp" />
 -    <ClCompile Include="langpack.cpp" />
 -    <ClCompile Include="MimCmd.cpp" />
 +    <ClCompile Include="MimCmd.cpp">
 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
 +    </ClCompile>
      <ClCompile Include="..\mimcmd_ipc.cpp" />
    </ItemGroup>
    <ItemGroup>
      <ClInclude Include="commands.h" />
      <ClInclude Include="common.h" />
 -    <ClInclude Include="langpack.h" />
      <ClInclude Include="resource.h" />
    </ItemGroup>
    <ItemGroup>
 diff --git a/plugins/CmdLine/MimCmd/MimCmd.vcxproj.filters b/plugins/CmdLine/MimCmd/MimCmd.vcxproj.filters index 607cc932f8..11c62edbef 100644 --- a/plugins/CmdLine/MimCmd/MimCmd.vcxproj.filters +++ b/plugins/CmdLine/MimCmd/MimCmd.vcxproj.filters @@ -18,9 +18,6 @@      <ClCompile Include="commands.cpp">
        <Filter>Source Files</Filter>
      </ClCompile>
 -    <ClCompile Include="langpack.cpp">
 -      <Filter>Source Files</Filter>
 -    </ClCompile>
      <ClCompile Include="MimCmd.cpp">
        <Filter>Source Files</Filter>
      </ClCompile>
 @@ -32,13 +29,10 @@      <ClInclude Include="commands.h">
        <Filter>Header Files</Filter>
      </ClInclude>
 -    <ClInclude Include="common.h">
 -      <Filter>Header Files</Filter>
 -    </ClInclude>
 -    <ClInclude Include="langpack.h">
 +    <ClInclude Include="resource.h">
        <Filter>Header Files</Filter>
      </ClInclude>
 -    <ClInclude Include="resource.h">
 +    <ClInclude Include="common.h">
        <Filter>Header Files</Filter>
      </ClInclude>
    </ItemGroup>
 diff --git a/plugins/CmdLine/MimCmd/commands.cpp b/plugins/CmdLine/MimCmd/commands.cpp index b04b9ba7ba..bae47b089c 100644 --- a/plugins/CmdLine/MimCmd/commands.cpp +++ b/plugins/CmdLine/MimCmd/commands.cpp @@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 -#include "commands.h"
 +#include "common.h"
  inline char *STRNCPY(char *output, const char *input, size_t size)
  {
 diff --git a/plugins/CmdLine/MimCmd/commands.h b/plugins/CmdLine/MimCmd/commands.h index 04cc640f48..4c60b49565 100644 --- a/plugins/CmdLine/MimCmd/commands.h +++ b/plugins/CmdLine/MimCmd/commands.h @@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #ifndef M_MIMCMD_COMMANDS_H
  #define M_MIMCMD_COMMANDS_H
 -#include "common.h"
 -
  extern PCommand knownCommands;
  extern int cKnownCommands;
 diff --git a/plugins/CmdLine/MimCmd/common.h b/plugins/CmdLine/MimCmd/common.h index 5a66323778..47ecfc2ec6 100644 --- a/plugins/CmdLine/MimCmd/common.h +++ b/plugins/CmdLine/MimCmd/common.h @@ -18,13 +18,19 @@ along with this program; if not, write to the Free Software  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 +#define _CRT_SECURE_NO_WARNINGS
 +
  #include <stdio.h>
  #include <windows.h>
  #include <string.h>
  #define NO_MIMCMD_COMMANDS
 -#include "mimcmd_data.h"
 +#include <m_system.h>
 +#include <newpluginapi.h>
 +#include <m_langpack.h>
 +
  #include "mimcmd_ipc.h"
  #include "commands.h"
 -#include "langpack.h"
\ No newline at end of file +
 +int lpprintf(const char *format, ...);
 diff --git a/plugins/CmdLine/MimCmd/langpack.cpp b/plugins/CmdLine/MimCmd/langpack.cpp deleted file mode 100644 index 096431f95b..0000000000 --- a/plugins/CmdLine/MimCmd/langpack.cpp +++ /dev/null @@ -1,377 +0,0 @@ -/*
 -CmdLine plugin for Miranda IM
 -
 -Copyright © 2007 Cristian Libotean
 -
 -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.
 -*/
 -
 -//this code is mostly taken from Miranda's langpack module.
 -
 -/*
 -
 -Miranda IM: the free IM client for Microsoft* Windows*
 -
 -Copyright 2000-2007 Miranda ICQ/IM project, 
 -all portions of this codebase are copyrighted to the people 
 -listed in contributors.txt.
 -
 -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 "langpack.h"
 -
 -static __inline int mir_snprintf(char *buffer, size_t count, const char* fmt, ...) {
 -	va_list va;
 -	int len;
 -
 -	va_start(va, fmt);
 -	len = _vsnprintf(buffer, count-1, fmt, va);
 -	va_end(va);
 -	buffer[count-1] = 0;
 -	return len;
 -}
 -
 -int lpprintf(const char *format, ...)
 -{
 -	va_list va;
 -	va_start(va, format);
 -	const int MAX_SIZE = 16192;
 -	char buffer[MAX_SIZE] = {0};
 -	int len = _vsnprintf(buffer, MAX_SIZE - 1, format, va);
 -	buffer[MAX_SIZE - 1] = 0;
 -	va_end(va);
 -	CharToOemBuff(buffer, buffer, len);
 -	printf("%s", buffer);
 -	
 -	return len;
 -}
 -
 -static void TrimString(char *str)
 -{
 -	int len,start;
 -	len=lstrlenA(str);
 -	while(str[0] && (unsigned char)str[len-1]<=' ') str[--len]=0;
 -	for(start=0;str[start] && (unsigned char)str[start]<=' ';start++);
 -	MoveMemory(str,str+start,len-start+1);
 -}
 -
 -static void TrimStringSimple(char *str) 
 -{
 -	if (str[lstrlenA(str)-1] == '\n') str[lstrlenA(str)-1] = '\0';
 -	if (str[lstrlenA(str)-1] == '\r') str[lstrlenA(str)-1] = '\0';
 -}
 -
 -static int IsEmpty(char *str)
 -{
 -	int i = 0;
 -
 -	while (str[i])
 -	{
 -		if (str[i]!=' '&&str[i]!='\r'&&str[i]!='\n')
 -			return 0;
 -		i++;
 -	}
 -	return 1;
 -}
 -
 -static void ConvertBackslashes(char *str)
 -{
 -	char *pstr;
 -	
 -	for(pstr=str;*pstr;pstr=CharNextA(pstr)) {
 -		if(*pstr=='\\') {
 -			switch(pstr[1]) {
 -case 'n': *pstr='\n'; break;
 -case 't': *pstr='\t'; break;
 -case 'r': *pstr='\r'; break;
 -default: *pstr=pstr[1]; break;
 -			}
 -			MoveMemory(pstr+1,pstr+2,lstrlenA(pstr+2)+1);
 -		}
 -	}
 -}
 -
 -static DWORD LangPackHash(const char *szStr)
 -{
 -#if defined _M_IX86 && !defined _NUMEGA_BC_FINALCHECK && !defined __GNUC__
 -	__asm {				//this is mediocrely optimised, but I'm sure it's good enough
 -		xor  edx,edx
 -		mov  esi,szStr
 -		xor  cl,cl
 -lph_top:
 -		xor  eax,eax
 -		and  cl,31
 -		mov  al,[esi]
 -		inc  esi
 -		test al,al
 -		jz   lph_end
 -		rol  eax,cl
 -		add  cl,5
 -		xor  edx,eax
 -		jmp  lph_top
 -lph_end:
 -		mov  eax,edx
 -	}
 -#else
 -	DWORD hash=0;
 -	int i;
 -	int shift=0;
 -	for(i=0;szStr[i];i++) {
 -		hash^=szStr[i]<<shift;
 -		if(shift>24) hash^=(szStr[i]>>(32-shift))&0x7F;
 -		shift=(shift+5)&0x1F;
 -	}
 -	return hash;
 -#endif
 -}
 -
 -static DWORD LangPackHashW(const char *szStr)
 -{
 -#if defined _M_IX86 && !defined _NUMEGA_BC_FINALCHECK && !defined __GNUC__
 -	__asm {				//this is mediocrely optimised, but I'm sure it's good enough
 -		xor  edx,edx
 -		mov  esi,szStr
 -		xor  cl,cl
 -lph_top:
 -		xor  eax,eax
 -		and  cl,31
 -		mov  al,[esi]
 -		inc  esi
 -		inc  esi
 -		test al,al
 -		jz   lph_end
 -		rol  eax,cl
 -		add  cl,5
 -		xor  edx,eax
 -		jmp  lph_top
 -lph_end:
 -		mov  eax,edx
 -	}
 -#else
 -	DWORD hash=0;
 -	int i;
 -	int shift=0;
 -	for(i=0;szStr[i];i+=2) {
 -		hash^=szStr[i]<<shift;
 -		if(shift>24) hash^=(szStr[i]>>(32-shift))&0x7F;
 -		shift=(shift+5)&0x1F;
 -	}
 -	return hash;
 -#endif
 -}
 -
 -static int SortLangPackHashesProc(struct LangPackEntry *arg1,struct LangPackEntry *arg2)
 -{
 -	if(arg1->englishHash<arg2->englishHash) return -1;
 -	if(arg1->englishHash>arg2->englishHash) return 1;
 -	/* both source strings of the same hash (may not be the same string thou) put
 -	the one that was written first to be found first */
 -	if(arg1->linePos<arg2->linePos) return -1;
 -	if(arg1->linePos>arg2->linePos) return 1;
 -	return 0;
 -}
 -
 -
 -static int SortLangPackHashesProc2(struct LangPackEntry *arg1,struct LangPackEntry *arg2)
 -{
 -	if(arg1->englishHash<arg2->englishHash) return -1;
 -	if(arg1->englishHash>arg2->englishHash) return 1;
 -	return 0;
 -}
 -
 -static int LoadLangPack(const TCHAR *szLangPack)
 -{
 -	FILE *fp;
 -	char line[4096];
 -	char *pszColon;
 -	char *pszLine;
 -	int entriesAlloced;
 -	int startOfLine=0;
 -	unsigned int linePos=1;
 -	USHORT langID;
 -	
 -	lstrcpy(langPack.filename,szLangPack);
 -	fp = _tfopen(szLangPack,_T("rt"));
 -	if(fp==NULL) return 1;
 -	fgets(line,SIZEOF(line),fp);
 -	TrimString(line);
 -	if(lstrcmpA(line,"Miranda Language Pack Version 1")) {fclose(fp); return 2;}
 -	//headers
 -	while(!feof(fp)) {
 -		startOfLine=ftell(fp);
 -		if(fgets(line,SIZEOF(line),fp)==NULL) break;
 -		TrimString(line);
 -		if(IsEmpty(line) || line[0]==';' || line[0]==0) continue;
 -		if(line[0]=='[') break;
 -		pszColon=strchr(line,':');
 -		if(pszColon==NULL) {fclose(fp); return 3;}
 -		*pszColon=0;
 -		if(!lstrcmpA(line,"Language")) {mir_snprintf(langPack.language,sizeof(langPack.language),"%s",pszColon+1); TrimString(langPack.language);}
 -		else if(!lstrcmpA(line,"Last-Modified-Using")) {mir_snprintf(langPack.lastModifiedUsing,sizeof(langPack.lastModifiedUsing),"%s",pszColon+1); TrimString(langPack.lastModifiedUsing);}
 -		else if(!lstrcmpA(line,"Authors")) {mir_snprintf(langPack.authors,sizeof(langPack.authors),"%s",pszColon+1); TrimString(langPack.authors);}
 -		else if(!lstrcmpA(line,"Author-email")) {mir_snprintf(langPack.authorEmail,sizeof(langPack.authorEmail),"%s",pszColon+1); TrimString(langPack.authorEmail);}
 -		else if(!lstrcmpA(line, "Locale")) {
 -			char szBuf[20], *stopped;
 -
 -			TrimString(pszColon + 1);
 -			langID = (USHORT)strtol(pszColon + 1, &stopped, 16);
 -			langPack.localeID = MAKELCID(langID, 0);
 -			GetLocaleInfoA(langPack.localeID, LOCALE_IDEFAULTANSICODEPAGE, szBuf, 10);
 -			szBuf[5] = 0;                       // codepages have max. 5 digits
 -			langPack.defaultANSICp = atoi(szBuf);
 -		}
 -	}
 -	//body
 -	fseek(fp,startOfLine,SEEK_SET);
 -	entriesAlloced=0;
 -	while(!feof(fp)) {
 -		if(fgets(line,SIZEOF(line),fp)==NULL) break;
 -		if(IsEmpty(line) || line[0]==';' || line[0]==0) continue;
 -		TrimStringSimple(line);
 -		ConvertBackslashes(line);
 -		if(line[0]=='[' && line[lstrlenA(line)-1]==']') {
 -			if(langPack.entryCount && langPack.entry[langPack.entryCount-1].local==NULL) {
 -				if(langPack.entry[langPack.entryCount-1].english!=NULL) free(langPack.entry[langPack.entryCount-1].english);
 -				langPack.entryCount--;
 -			}
 -			pszLine = line+1;
 -			line[lstrlenA(line)-1]='\0';
 -			//TrimStringSimple(line);
 -			if(++langPack.entryCount>entriesAlloced) {
 -				entriesAlloced+=128;
 -				langPack.entry=(struct LangPackEntry*)realloc(langPack.entry,sizeof(struct LangPackEntry)*entriesAlloced);
 -			}
 -			langPack.entry[langPack.entryCount-1].english=NULL;
 -			langPack.entry[langPack.entryCount-1].englishHash=LangPackHash(pszLine);
 -			langPack.entry[langPack.entryCount-1].local=NULL;
 -			langPack.entry[langPack.entryCount-1].wlocal = NULL;
 -			langPack.entry[langPack.entryCount-1].linePos=linePos++;
 -		}
 -		else if(langPack.entryCount) {
 -			struct LangPackEntry* E = &langPack.entry[langPack.entryCount-1];
 -
 -			if(E->local==NULL) {
 -				E->local=_strdup(line);
 -				{
 -					size_t iNeeded = MultiByteToWideChar(langPack.defaultANSICp, 0, line, -1, 0, 0);
 -					E->wlocal = (wchar_t *)malloc((int) ((iNeeded+1) * sizeof(wchar_t)));
 -					MultiByteToWideChar(langPack.defaultANSICp, 0, line, -1, E->wlocal, (int) iNeeded);
 -				}
 -			}
 -			else {
 -				E->local=(char*)realloc(E->local,lstrlenA(E->local)+lstrlenA(line)+2);
 -				lstrcatA(E->local,"\n");
 -				lstrcatA(E->local,line);
 -				{
 -					size_t iNeeded = MultiByteToWideChar(langPack.defaultANSICp, 0, line, -1, 0, 0);
 -					size_t iOldLen = wcslen(E->wlocal);
 -					E->wlocal = (wchar_t*)realloc(E->wlocal, ( sizeof(wchar_t) * ( iOldLen + iNeeded + 2)));
 -					wcscat(E->wlocal, L"\n");
 -					MultiByteToWideChar( langPack.defaultANSICp, 0, line, -1, E->wlocal + iOldLen+1, (int) iNeeded);
 -				}
 -			}
 -		}
 -	}
 -	qsort(langPack.entry,langPack.entryCount,sizeof(struct LangPackEntry),(int(*)(const void*,const void*))SortLangPackHashesProc);
 -	fclose(fp);
 -	return 0;
 -}
 -
 -char *LangPackTranslateString(const char *szEnglish, const int W)
 -{
 -	struct LangPackEntry key,*entry;
 -
 -	if ( langPack.entryCount == 0 || szEnglish == NULL ) return (char*)szEnglish;
 -
 -
 -	key.englishHash = W ? LangPackHashW(szEnglish) : LangPackHash(szEnglish);
 -	entry=(struct LangPackEntry*)bsearch(&key,langPack.entry,langPack.entryCount,sizeof(struct LangPackEntry),(int(*)(const void*,const void*))SortLangPackHashesProc2);
 -	if(entry==NULL) return (char*)szEnglish;
 -	while(entry>langPack.entry)
 -	{
 -		entry--;
 -		if(entry->englishHash!=key.englishHash) {
 -			entry++;
 -			return W ? (char *)entry->wlocal : entry->local;
 -		}
 -	}
 -	return W ? (char *)entry->wlocal : entry->local;
 -}
 -
 -int LangPackGetDefaultCodePage()
 -{
 -	return (langPack.defaultANSICp == 0) ? CP_ACP : langPack.defaultANSICp;
 -}
 -
 -int LangPackGetDefaultLocale()
 -{
 -	return (langPack.localeID == 0) ? LOCALE_USER_DEFAULT : langPack.localeID;
 -}
 -
 -int LangPackShutdown()
 -{
 -	int i;
 -	for(i=0;i<langPack.entryCount;i++) {
 -		if(langPack.entry[i].english!=NULL) free(langPack.entry[i].english);
 -		if(langPack.entry[i].local!=NULL) { free(langPack.entry[i].local); }
 -		if(langPack.entry[i].wlocal!=NULL) { free(langPack.entry[i].wlocal); }
 -	}
 -	if(langPack.entryCount) {
 -		free(langPack.entry);
 -		langPack.entry=0;
 -		langPack.entryCount=0;
 -	}
 -	
 -	return 0;
 -}
 -
 -int LoadLangPackModule(char *mirandaPath)
 -{
 -	HANDLE hFind;
 -	TCHAR szSearch[MAX_PATH],*str2,szLangPack[MAX_PATH];
 -	WIN32_FIND_DATA fd;
 -
 -	ZeroMemory(&langPack,sizeof(langPack));
 -	
 -	strncpy(szSearch, mirandaPath, SIZEOF(szSearch));
 -	szSearch[SIZEOF(szSearch) - 1] = 0;
 -	strcat(szSearch, "\\");
 -	
 -	str2=_tcsrchr(szSearch,'\\');
 -	if(str2!=NULL) *str2=0;
 -	else str2=szSearch;
 -	lstrcat( szSearch, _T("\\langpack_*.txt"));
 -	hFind = FindFirstFile( szSearch, &fd );
 -	if( hFind != INVALID_HANDLE_VALUE ) {
 -		lstrcpy(str2+1,fd.cFileName);
 -		lstrcpy(szLangPack,szSearch);
 -		FindClose(hFind);
 -		LoadLangPack(szLangPack);
 -	}
 -	
 -	return 0;
 -}
\ No newline at end of file diff --git a/plugins/CmdLine/MimCmd/langpack.h b/plugins/CmdLine/MimCmd/langpack.h deleted file mode 100644 index 15d6b301b5..0000000000 --- a/plugins/CmdLine/MimCmd/langpack.h +++ /dev/null @@ -1,92 +0,0 @@ -/*
 -CmdLine plugin for Miranda IM
 -
 -Copyright © 2007 Cristian Libotean
 -
 -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.
 -*/
 -
 -//this code is mostly taken from Miranda's langpack module.
 -
 -/*
 -
 -Miranda IM: the free IM client for Microsoft* Windows*
 -
 -Copyright 2000-2007 Miranda ICQ/IM project, 
 -all portions of this codebase are copyrighted to the people 
 -listed in contributors.txt.
 -
 -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.
 -*/
 -
 -#ifndef M_MIMCMD_LANGPACK_H
 -#define M_MIMCMD_LANGPACK_H
 -
 -#include <windows.h>
 -#include <stdio.h>
 -#include <stdarg.h>
 -#include <tchar.h>
 -#include <locale.h>
 -
 -
 -#define SIZEOF(X) (sizeof(X)/sizeof(X[0]))
 -
 -struct LangPackEntry {
 -	unsigned linePos;
 -	DWORD englishHash;
 -	char *english;	  //not currently used, the hash does everything
 -	char *local;
 -	wchar_t *wlocal;
 -};
 -
 -struct LangPackStruct {
 -	TCHAR filename[MAX_PATH];
 -	char  language[64];
 -	char  lastModifiedUsing[64];
 -	char  authors[256];
 -	char  authorEmail[128];
 -	struct LangPackEntry *entry;
 -	int entryCount;
 -	LCID localeID;
 -	DWORD defaultANSICp;
 -} static langPack = {0};
 -
 -#ifdef Translate
 -#undef Translate
 -#define Translate(s) LangPackTranslateString(s, 0)
 -#endif
 -
 -char *LangPackTranslateString(const char *szEnglish, const int W);
 -int LangPackGetDefaultCodePage();
 -int LangPackGetDefaultLocale();
 -
 -int LangPackShutdown();
 -int LoadLangPackModule(char *mirandaPath);
 -
 -int lpprintf(const char *format, ...);
 -
 -#endif
\ No newline at end of file diff --git a/plugins/CmdLine/hooked_events.h b/plugins/CmdLine/hooked_events.h index 2498638400..11b9fea363 100644 --- a/plugins/CmdLine/hooked_events.h +++ b/plugins/CmdLine/hooked_events.h @@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #ifndef M_CMDLINE_HOOKED_EVENTS_H
  #define M_CMDLINE_HOOKED_EVENTS_H
 -#include "commonheaders.h"
 -
  extern HANDLE hModulesLoaded;
  extern HANDLE hOptionsInitialise;
  extern HANDLE hShutdown;
 diff --git a/plugins/CmdLine/mimcmd_data.h b/plugins/CmdLine/mimcmd_data.h index d8570548f8..2ef39bc4dd 100644 --- a/plugins/CmdLine/mimcmd_data.h +++ b/plugins/CmdLine/mimcmd_data.h @@ -21,12 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #ifndef M_MIMCMD_DATA_H
  #define M_MIMCMD_DATA_H
 -#ifndef MIRANDA_VER
 -#define MIRANDA_VER 0x0400
 -#endif
 -
 -#include "commonheaders.h"
 -
  #define COMMAND_SIZE  64
  #define HELP_SIZE   1024
  #define REPLY_SIZE  8096
 diff --git a/plugins/CmdLine/mimcmd_handlers.h b/plugins/CmdLine/mimcmd_handlers.h index 3446445d58..565c7e3ec5 100644 --- a/plugins/CmdLine/mimcmd_handlers.h +++ b/plugins/CmdLine/mimcmd_handlers.h @@ -21,9 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #ifndef M_MIMCMD_HANDLERS_H
  #define M_MIMCMD_HANDLERS_H
 -#include <stdio.h>
 -
 -#include "commonheaders.h"
  #include "mimcmd_data.h"
  //aditional services
 diff --git a/plugins/CmdLine/mimcmd_ipc.h b/plugins/CmdLine/mimcmd_ipc.h index 3b845c030a..d12a4a993f 100644 --- a/plugins/CmdLine/mimcmd_ipc.h +++ b/plugins/CmdLine/mimcmd_ipc.h @@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #ifndef M_MIMCMD_IPC_H
  #define M_MIMCMD_IPC_H
 -#include <windows.h>
 -
  #include "mimcmd_data.h"
  #define SHAREDMEM_NAME          "MirandaCmdLine|SharedMem"
 diff --git a/plugins/CmdLine/services.h b/plugins/CmdLine/services.h index 07f6ffaeec..b4beb1d44b 100644 --- a/plugins/CmdLine/services.h +++ b/plugins/CmdLine/services.h @@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #ifndef M_CMDLINE_SERVICES_H
  #define M_CMDLINE_SERVICES_H
 -#include "commonheaders.h"
 -#include "mimcmd_data.h"
  #include "mimcmd_handlers.h"
  int InitServices();
 diff --git a/plugins/CmdLine/utils.h b/plugins/CmdLine/utils.h index 70bdb84fad..22b4721cfa 100644 --- a/plugins/CmdLine/utils.h +++ b/plugins/CmdLine/utils.h @@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #define M_CMDLINE_UTILS_H
  #include <stdarg.h>
 -#include "commonheaders.h"
  //#define USE_LOG
  #define LOG_FILE "cmdline.log"
  | 
