From b1a65d2ed1a74b0c4700f61e93232a3b0a32d3aa Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Thu, 12 Jun 2014 19:25:54 +0000 Subject: Smileyadd deprecated header moved git-svn-id: http://svn.miranda-ng.org/main/trunk@9440 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ExternalAPI/m_smileyadd_deprecated.h | 108 ---------------------- plugins/SmileyAdd/src/general.h | 1 - plugins/SmileyAdd/src/main.cpp | 4 - plugins/SmileyAdd/src/services.cpp | 131 ++------------------------- plugins/SmileyAdd/src/smileyroutines.cpp | 2 +- 5 files changed, 9 insertions(+), 237 deletions(-) delete mode 100644 plugins/ExternalAPI/m_smileyadd_deprecated.h (limited to 'plugins') diff --git a/plugins/ExternalAPI/m_smileyadd_deprecated.h b/plugins/ExternalAPI/m_smileyadd_deprecated.h deleted file mode 100644 index ff9feb93ce..0000000000 --- a/plugins/ExternalAPI/m_smileyadd_deprecated.h +++ /dev/null @@ -1,108 +0,0 @@ -/* -Miranda SmileyAdd Plugin -Copyright (C) 2005 - 2009 Boris Krasnovskiy -Copyright (C) 2003 - 2004 Rein-Peter de Boer - -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 version 2 -of the License. - -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, see . -*/ - - - - -//find smileys in unicode text -//wParam = (WPARAM) 0; not used -//lParam = (LPARAM) (SMADD_PARSEW*) &smgp; //pointer to SMADD_PARSEW -typedef struct -{ - int cbSize; //size of the structure - const char* Protocolname; //protocol to use... if you have defined a protocol, u can - //use your own protocol name. Smiley add wil automatically - //select the smileypack that is defined for your protocol. - //Or, use "Standard" for standard smiley set. Or "ICQ", "MSN" - //if you prefer those icons. - //If not found or NULL: "Standard" will be used - wchar_t* str; //String to parse - HICON SmileyIcon; //RETURN VALUE: the Icon handle is responsibility of the reciever - //it must be destroyed with DestroyIcon when not needed. - unsigned startChar; //Starting smiley character - //Because of iterative nature of the API caller should set this - //parameter to correct value - unsigned size; //Number of characters in smiley (0 if not found) - //Because of iterative nature of the API caller should set this - //parameter to correct value -} SMADD_PARSEW; - -#define MS_SMILEYADD_PARSEW "SmileyAdd/ParseW" - - -//find smiley in text, API could be called iterativly, on each iteration the remainder -//of the string after last smiley processed -//wParam = (WPARAM) 0; not used -//lParam = (LPARAM) (SMADD_PARSE*) &smgp; //pointer to SMADD_PARSE -//return: TRUE if API succeeded (all parameters were valid) , FALSE if not. -typedef struct -{ - int cbSize; //size of the structure - const char* Protocolname; //protocol to use... if you have defined a protocol, u can - //use your own protocol name. Smiley add wil automatically - //select the smileypack that is defined for your protocol. - //Or, use "Standard" for standard smiley set. Or "ICQ", "MSN" - //if you prefer those icons. - //If not found or NULL: "Standard" will be used - char* str; //String to parse - HICON SmileyIcon; //RETURN VALUE: the Icon handle is responsibility of the reciever - //it must be destroyed with DestroyIcon when not needed. - unsigned startChar; //Starting smiley character - //Because of iterative nature of the API caller should set this - //parameter to correct value - unsigned size; //Number of characters in smiley (0 if not found) - //Because of iterative nature of the API caller should set this - //parameter to correct value -} SMADD_PARSE; - -#define MS_SMILEYADD_PARSE "SmileyAdd/Parse" - - -//get button smiley icon -//wParam = (WPARAM) 0; not used -//lParam = (LPARAM) (SMADD_INFO*) &smgi; //pointer to SMADD_INFO -//return: TRUE if API succeeded (all parameters were valid) , FALSE if not. -#define MS_SMILEYADD_GETINFO "SmileyAdd/GetInfo" - - -//find smiley, this API have been supreceeded with MS_SMILEYADD_PARSE[W] -//wParam = (WPARAM) 0; not used -//lParam = (LPARAM) (SMADD_GETICON*) &smgi; //pointer to SMADD_GETICON -//return: TRUE if SmileySequence starts with a smiley, FALSE if not -typedef struct -{ - int cbSize; //size of the structure - char* Protocolname; // " " - char* SmileySequence; //character string containing the smiley - HICON SmileyIcon; //RETURN VALUE: this is filled with the icon handle... - //do not destroy! - int Smileylength; //length of the smiley that is found. -} SMADD_GETICON; - -#define MS_SMILEYADD_GETSMILEYICON "SmileyAdd/GetSmileyIcon" - -#define SMADD_SHOWSEL_SIZE_V1 32 -#define SMADD_SHOWSEL_SIZE_V2 36 - -#define SMADD_RICHEDIT_SIZE_V1 16 -#define SMADD_RICHEDIT_SIZE_V2 24 - -#define SMADD_INFO_SIZE_V1 20 - -#define SMADD_BATCHPARSE_SIZE_V1 24 diff --git a/plugins/SmileyAdd/src/general.h b/plugins/SmileyAdd/src/general.h index 5abb9aeddd..7497c25396 100644 --- a/plugins/SmileyAdd/src/general.h +++ b/plugins/SmileyAdd/src/general.h @@ -64,7 +64,6 @@ along with this program. If not, see . #include #include -#include #include #include "regexp\wcpattern.h" diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index 82e90f56bc..30d45f33fc 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -107,18 +107,14 @@ extern "C" __declspec(dllexport) int Load(void) //create the smiley services CreateServiceFunction(MS_SMILEYADD_REPLACESMILEYS, ReplaceSmileysCommand); - CreateServiceFunction(MS_SMILEYADD_GETSMILEYICON, GetSmileyIconCommand); CreateServiceFunction(MS_SMILEYADD_SHOWSELECTION, ShowSmileySelectionCommand); - CreateServiceFunction(MS_SMILEYADD_GETINFO, GetInfoCommand); CreateServiceFunction(MS_SMILEYADD_GETINFO2, GetInfoCommand2); - CreateServiceFunction(MS_SMILEYADD_PARSE, ParseText); CreateServiceFunction(MS_SMILEYADD_REGISTERCATEGORY, RegisterPack); CreateServiceFunction(MS_SMILEYADD_BATCHPARSE, ParseTextBatch); CreateServiceFunction(MS_SMILEYADD_BATCHFREE, FreeTextBatch); CreateServiceFunction(MS_SMILEYADD_CUSTOMCATMENU, CustomCatMenu); CreateServiceFunction(MS_SMILEYADD_RELOAD, ReloadPack); CreateServiceFunction(MS_SMILEYADD_LOADCONTACTSMILEYS, LoadContactSmileys); - CreateServiceFunction(MS_SMILEYADD_PARSEW, ParseTextW); return 0; } diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index 776c07415e..0a591ae1ab 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -73,7 +73,7 @@ SmileyPackType* GetSmileyPack(const char* proto, MCONTACT hContact, SmileyPackCT INT_PTR ReplaceSmileysCommand(WPARAM, LPARAM lParam) { SMADD_RICHEDIT3* smre = (SMADD_RICHEDIT3*) lParam; - if (smre == NULL || smre->cbSize < SMADD_RICHEDIT_SIZE_V1) + if (smre == NULL) return FALSE; SMADD_RICHEDIT3 smrec = {0}; @@ -98,9 +98,9 @@ INT_PTR ShowSmileySelectionCommand(WPARAM, LPARAM lParam) { SMADD_SHOWSEL3* smaddInfo = (SMADD_SHOWSEL3*) lParam; - if (smaddInfo == NULL || smaddInfo->cbSize < SMADD_SHOWSEL_SIZE_V1) return FALSE; - HWND parent = smaddInfo->cbSize > SMADD_SHOWSEL_SIZE_V1 ? smaddInfo->hwndParent : NULL; - MCONTACT hContact = smaddInfo->cbSize > SMADD_SHOWSEL_SIZE_V2 ? smaddInfo->hContact : NULL; + if (smaddInfo == NULL) return FALSE; + HWND parent = smaddInfo->hwndParent; + MCONTACT hContact = smaddInfo->hContact; SmileyToolWindowParam *stwp = new SmileyToolWindowParam; stwp->pSmileyPack = GetSmileyPack(smaddInfo->Protocolname, hContact); @@ -119,43 +119,11 @@ INT_PTR ShowSmileySelectionCommand(WPARAM, LPARAM lParam) return TRUE; } -INT_PTR GetSmileyIconCommand(WPARAM, LPARAM lParam) -{ - SMADD_GETICON* smre = (SMADD_GETICON*) lParam; - - if (smre == NULL || smre->cbSize < sizeof(SMADD_GETICON)) return FALSE; - - SmileyPackType* SmileyPack = GetSmileyPack(smre->Protocolname); - - if (SmileyPack == NULL || IsBadStringPtrA(smre->SmileySequence, MAX_SMILEY_LENGTH)) { - smre->SmileyIcon = NULL; - smre->Smileylength = 0; - return FALSE; - } - - unsigned start, size; - SmileyType* sml; - FindSmileyInText(SmileyPack, A2T_SM(smre->SmileySequence), start, size, &sml); - - if (size == 0 || start != 0) - { - smre->SmileyIcon = NULL; - smre->Smileylength = 0; - } - else - { - smre->SmileyIcon = sml->GetIcon(); - smre->Smileylength = size; - } - - return TRUE; -} - static int GetInfoCommandE(SMADD_INFO2* smre, bool retDup) { - if (smre == NULL || smre->cbSize < SMADD_INFO_SIZE_V1) return FALSE; - MCONTACT hContact = smre->cbSize > SMADD_INFO_SIZE_V1 ? smre->hContact : NULL; + if (smre == NULL) return FALSE; + MCONTACT hContact = smre->hContact; SmileyPackType* SmileyPack = GetSmileyPack(smre->Protocolname, hContact); @@ -193,96 +161,13 @@ INT_PTR GetInfoCommand2(WPARAM, LPARAM lParam) } -INT_PTR ParseText(WPARAM, LPARAM lParam) -{ - SMADD_PARSE* smre = (SMADD_PARSE*) lParam; - - if (smre == NULL || smre->cbSize < sizeof(SMADD_PARSE)) return FALSE; - - SmileyPackType* SmileyPack = GetSmileyPack(smre->Protocolname); - - if (SmileyPack == NULL) - { - smre->SmileyIcon = NULL; - smre->size = 0; - return FALSE; - } - - unsigned strtChrOff = smre->startChar + smre->size; - char* workstr = smre->str + strtChrOff; - - if (strtChrOff > 1024 || IsBadStringPtrA(workstr, 10)) - { - smre->SmileyIcon = NULL; - smre->size = 0; - return FALSE; - } - - SmileyType* sml; - FindSmileyInText(SmileyPack, A2T_SM(workstr), smre->startChar, smre->size, &sml); - - if (smre->size == 0) - { - smre->SmileyIcon = NULL; - } - else - { - smre->SmileyIcon = sml->GetIconDup(); - smre->startChar += strtChrOff; - } - - return TRUE; -} - - -INT_PTR ParseTextW(WPARAM, LPARAM lParam) -{ - SMADD_PARSEW* smre = (SMADD_PARSEW*) lParam; - - if (smre == NULL || smre->cbSize < sizeof(SMADD_PARSEW)) return FALSE; - - SmileyPackType* SmileyPack = GetSmileyPack(smre->Protocolname); - - if (SmileyPack == NULL) - { - smre->SmileyIcon = NULL; - smre->size = 0; - return FALSE; - } - - unsigned strtChrOff = smre->startChar + smre->size; - wchar_t* workstr = smre->str + strtChrOff; - - if (strtChrOff > 1024 || IsBadStringPtrW(workstr, 10)) - { - smre->SmileyIcon = NULL; - smre->size = 0; - return FALSE; - } - - SmileyType* sml; - FindSmileyInText(SmileyPack, workstr, smre->startChar, smre->size, &sml); - - if (smre->size == 0) - { - smre->SmileyIcon = NULL; - } - else - { - smre->SmileyIcon = sml->GetIconDup(); - smre->startChar += strtChrOff; - } - - return TRUE; -} - INT_PTR ParseTextBatch(WPARAM, LPARAM lParam) { SMADD_BATCHPARSE2* smre = (SMADD_BATCHPARSE2*) lParam; - if (smre == NULL || smre->cbSize < SMADD_BATCHPARSE_SIZE_V1) return FALSE; - MCONTACT hContact = smre->cbSize > SMADD_BATCHPARSE_SIZE_V1 ? smre->hContact : NULL; + if (smre == NULL) return FALSE; + MCONTACT hContact = smre->hContact; SmileyPackCType* smcp = NULL; SmileyPackType* SmileyPack = GetSmileyPack(smre->Protocolname, hContact, diff --git a/plugins/SmileyAdd/src/smileyroutines.cpp b/plugins/SmileyAdd/src/smileyroutines.cpp index cdabaa712a..268a65cef4 100644 --- a/plugins/SmileyAdd/src/smileyroutines.cpp +++ b/plugins/SmileyAdd/src/smileyroutines.cpp @@ -67,7 +67,7 @@ void LookupAllSmileys(SmileyPackType* smileyPack, SmileyPackCType* smileyCPack, memset(csmlit, 0, smlsz * sizeof(int)); long numCharsSoFar = 0; - int smloff = 0; + size_t smloff = 0; while (true) { int firstSml = -1; -- cgit v1.2.3