From c015ec458520935c407aa1b2ce1d004c5c5c8a61 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Tue, 15 Apr 2014 08:46:04 +0000 Subject: ICQCorp adopted - needs Unicode fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@8980 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/ICQCorp/src/corp.cpp | 118 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 protocols/ICQCorp/src/corp.cpp (limited to 'protocols/ICQCorp/src/corp.cpp') diff --git a/protocols/ICQCorp/src/corp.cpp b/protocols/ICQCorp/src/corp.cpp new file mode 100644 index 0000000000..ef8bff0dd8 --- /dev/null +++ b/protocols/ICQCorp/src/corp.cpp @@ -0,0 +1,118 @@ +/* + ICQ Corporate protocol plugin for Miranda IM. + Copyright (C) 2003-2005 Eugene Tarasenko + + 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 "corp.h" + +/////////////////////////////////////////////////////////////////////////////// + +HINSTANCE hInstance; +char protoName[64]; +int hLangpack; + +PLUGININFOEX pluginInfo = +{ + sizeof(PLUGININFOEX), + __PLUGIN_NAME, + PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), + __DESCRIPTION, + __AUTHOR, + __AUTHOREMAIL, + __COPYRIGHT, + __AUTHORWEB, + UNICODE_AWARE +}; + +/////////////////////////////////////////////////////////////////////////////// + +BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD reason, LPVOID lpReserved) +{ + hInstance = hModule; + if (reason == DLL_PROCESS_ATTACH) DisableThreadLibraryCalls(hModule); + return TRUE; +} + +/////////////////////////////////////////////////////////////////////////////// + +extern "C" __declspec(dllexport) int Unload() +{ + UnloadServices(); + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +extern "C" __declspec(dllexport) int Load() +{ + mir_getLP(&pluginInfo); + + PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE }; + pd.szName = protoName; + pd.type = PROTOTYPE_PROTOCOL; + + char fileName[MAX_PATH]; + WIN32_FIND_DATA findData; + + GetModuleFileName(hInstance, fileName, MAX_PATH); + FindClose(FindFirstFile(fileName, &findData)); + findData.cFileName[strlen(findData.cFileName) - 4] = 0; + strcpy(protoName, findData.cFileName); + + CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); + + LoadServices(); + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD Version) +{ + return &pluginInfo; +} + +/////////////////////////////////////////////////////////////////////////////// + +#ifdef _DEBUG +void T(char *format, ...) +{ + char buffer[8196], bufferTime[64]; + va_list list; + SYSTEMTIME t; + + va_start(list, format); + vsprintf(buffer, format, list); + va_end(list); + + GetLocalTime(&t); + sprintf(bufferTime, "%.2d:%.2d:%.2d.%.3d ", t.wHour, t.wMinute, t.wSecond, t.wMilliseconds); + + static HANDLE hFile = INVALID_HANDLE_VALUE; + DWORD result; + + if (hFile == INVALID_HANDLE_VALUE) + { + hFile = CreateFile("ICQ Corp.log", GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, 0, NULL); + SetFilePointer(hFile, 0, 0, FILE_END); + } + WriteFile(hFile, bufferTime, (DWORD)strlen(bufferTime), &result, NULL); + WriteFile(hFile, buffer, (DWORD)strlen(buffer), &result, NULL); +} +#endif + +/////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3