From ca1b8a4ec3a67600723ce5a4e0836889d6925dbe Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 30 Jan 2019 19:00:30 +0300 Subject: SMS plugin deprecated due to missing sms support in ICQ-WIM --- .../src/AdditionalFunctions/InterlockedFunctions.h | 119 --- plugins/SMS/src/AdditionalFunctions/ListMT.h | 288 ------ .../SMS/src/AdditionalFunctions/MemoryCompare.h | 32 - .../SMS/src/AdditionalFunctions/MemoryFindByte.h | 13 - plugins/SMS/src/SMSConstans.h | 87 -- plugins/SMS/src/SMS_svc.cpp | 124 --- plugins/SMS/src/functions.cpp | 517 ---------- plugins/SMS/src/main.cpp | 130 --- plugins/SMS/src/options.cpp | 101 -- plugins/SMS/src/receive.cpp | 272 ----- plugins/SMS/src/recvdlg.cpp | 246 ----- plugins/SMS/src/recvdlg.h | 11 - plugins/SMS/src/resource.h | 70 -- plugins/SMS/src/send.cpp | 82 -- plugins/SMS/src/senddlg.cpp | 1084 -------------------- plugins/SMS/src/senddlg.h | 36 - plugins/SMS/src/stdafx.cxx | 18 - plugins/SMS/src/stdafx.h | 127 --- plugins/SMS/src/version.h | 13 - 19 files changed, 3370 deletions(-) delete mode 100644 plugins/SMS/src/AdditionalFunctions/InterlockedFunctions.h delete mode 100644 plugins/SMS/src/AdditionalFunctions/ListMT.h delete mode 100644 plugins/SMS/src/AdditionalFunctions/MemoryCompare.h delete mode 100644 plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h delete mode 100644 plugins/SMS/src/SMSConstans.h delete mode 100644 plugins/SMS/src/SMS_svc.cpp delete mode 100644 plugins/SMS/src/functions.cpp delete mode 100644 plugins/SMS/src/main.cpp delete mode 100644 plugins/SMS/src/options.cpp delete mode 100644 plugins/SMS/src/receive.cpp delete mode 100644 plugins/SMS/src/recvdlg.cpp delete mode 100644 plugins/SMS/src/recvdlg.h delete mode 100644 plugins/SMS/src/resource.h delete mode 100644 plugins/SMS/src/send.cpp delete mode 100644 plugins/SMS/src/senddlg.cpp delete mode 100644 plugins/SMS/src/senddlg.h delete mode 100644 plugins/SMS/src/stdafx.cxx delete mode 100644 plugins/SMS/src/stdafx.h delete mode 100644 plugins/SMS/src/version.h (limited to 'plugins/SMS/src') diff --git a/plugins/SMS/src/AdditionalFunctions/InterlockedFunctions.h b/plugins/SMS/src/AdditionalFunctions/InterlockedFunctions.h deleted file mode 100644 index d0f0dfcbc5..0000000000 --- a/plugins/SMS/src/AdditionalFunctions/InterlockedFunctions.h +++ /dev/null @@ -1,119 +0,0 @@ -#if !defined(AFX_INTERLOCKED_FUNCTIONS__H__INCLUDED_) -#define AFX_INTERLOCKED_FUNCTIONS__H__INCLUDED_ - -#ifdef InterlockedCompareExchange -#ifndef InterlockedAnd -LONG FORCEINLINE InterlockedAnd(LONG volatile *Destination,LONG Value) -{ - LONG Old; - - do - { - Old=*Destination; - }while(InterlockedCompareExchange(Destination,(Old&Value),Old)!=Old); -return(Old); -} -#endif //InterlockedAnd - - -#ifndef InterlockedOr -LONG FORCEINLINE InterlockedOr(LONG volatile *Destination,LONG Value) -{ - LONG Old; - - do - { - Old=*Destination; - }while(InterlockedCompareExchange(Destination,(Old|Value),Old)!=Old); -return(Old); -} -#endif //InterlockedOr - - -#ifndef InterlockedXor -LONG FORCEINLINE InterlockedXor(LONG volatile *Destination,LONG Value) -{ - LONG Old; - - do - { - Old=*Destination; - }while(InterlockedCompareExchange(Destination,(Old^Value),Old)!=Old); -return(Old); -} -#endif //InterlockedXor -#endif //InterlockedCompareExchange - - - - - -#ifdef InterlockedCompareExchange64 -#ifndef InterlockedAnd64 -LONGLONG FORCEINLINE InterlockedAnd64(LONGLONG volatile *Destination,LONGLONG Value) -{ - LONGLONG Old; - - do - { - Old=*Destination; - }while(InterlockedCompareExchange64(Destination,(Old&Value),Old)!=Old); -return(Old); -} -#endif //InterlockedAnd64 - - -#ifndef InterlockedOr64 -LONGLONG FORCEINLINE InterlockedOr64(LONGLONG volatile *Destination,LONGLONG Value) -{ - LONGLONG Old; - - do - { - Old=*Destination; - }while(InterlockedCompareExchange64(Destination,(Old|Value),Old)!=Old); -return(Old); -} -#endif //InterlockedOr64 - - -#ifndef InterlockedXor64 -LONGLONG FORCEINLINE InterlockedXor64(LONGLONG volatile *Destination,LONGLONG Value) -{ - LONGLONG Old; - - do - { - Old=*Destination; - }while(InterlockedCompareExchange64(Destination,(Old^Value),Old)!=Old); -return(Old); -} -#endif //InterlockedXor64 -#endif //InterlockedCompareExchange64 - - - - - -#ifndef InterlockedIncrementPointer -#if defined(_WIN64) -#define InterlockedIncrementPointer(lpAddend) (LPVOID)InterlockedIncrement64((LONGLONG volatile*)lpAddend) -#else -#define InterlockedIncrementPointer(lpAddend) (LPVOID)InterlockedIncrement((LONG volatile*)lpAddend) -#endif -#endif //InterlockedIncrementPointer - - -#ifndef InterlockedDecrementPointer -#if defined(_WIN64) -#define InterlockedDecrementPointer(lpAddend) (LPVOID)InterlockedDecrement64((LONGLONG volatile*)lpAddend) -#else -#define InterlockedDecrementPointer(lpAddend) (LPVOID)InterlockedDecrement((LONG volatile*)lpAddend) -#endif -#endif //InterlockedDecrementPointer - - - - - -#endif // !defined(AFX_INTERLOCKED_FUNCTIONS__H__INCLUDED_) diff --git a/plugins/SMS/src/AdditionalFunctions/ListMT.h b/plugins/SMS/src/AdditionalFunctions/ListMT.h deleted file mode 100644 index 964ea5d09f..0000000000 --- a/plugins/SMS/src/AdditionalFunctions/ListMT.h +++ /dev/null @@ -1,288 +0,0 @@ -#if !defined(AFX_LIST_MT__H__INCLUDED_) -#define AFX_LIST_MT__H__INCLUDED_ - -// структура для работы со списком, элемент списка -typedef struct _LIST_MT_ITEM -{ -#ifdef __cplusplus - _LIST_MT_ITEM *plmtiPrev; // *предыдущий элемент в списке - _LIST_MT_ITEM *plmtiNext; // *следующий элемент в списке -#else - LPVOID *plmtiPrev; // *предыдущий элемент в списке - LPVOID *plmtiNext; // *следующий элемент в списке -#endif - LPVOID lpData; // указатель на данные, связанные с элементом списка - LPVOID lpListMT; // указатель на заголовок списка, см структуру ниже -}LIST_MT_ITEM, *PLIST_MT_ITEM, *LPLIST_MT_ITEM; -typedef CONST PLIST_MT_ITEM PCLIST_MT_ITEM, LPCLIST_MT_ITEM; - - -// структура для работы со списком, заголовок списка -typedef struct _LIST_MT -{ - size_t nCount; // *колличество элементов в списке - PLIST_MT_ITEM plmtiFirst; // *указывает на первый элемент в списке - PLIST_MT_ITEM plmtiLast; // *указывает на последний элемент в списке - CRITICAL_SECTION cs; // *section for exclysive access to List -}LIST_MT, *PLIST_MT, *LPLIST_MT; -typedef CONST PLIST_MT PCLIST_MT, LPCLIST_MT; - - -// структура для работы с итератором -typedef struct _LIST_MT_ITERATOR -{ - PLIST_MT_ITEM plmtListMTItem; -}LIST_MT_ITERATOR, *PLIST_MT_ITERATOR, *LPLIST_MT_ITERATOR; -//typedef LIST_MT_ITEM LIST_MT_ITERATOR, *PLIST_MT_ITERATOR, *LPLIST_MT_ITERATOR; -typedef CONST PLIST_MT_ITERATOR PCLIST_MT_ITERATOR, LPCLIST_MT_ITERATOR; - - - - -__inline DWORD ListMTInitialize(PCLIST_MT pclmtListMT,DWORD dwSpinCount) -{ - DWORD dwRetErrorCode; - - if (InitializeCriticalSectionAndSpinCount(&pclmtListMT->cs,((dwSpinCount)? (dwSpinCount | 0x80000000):0L))) - { - InterlockedExchangePointer((volatile PVOID*)&pclmtListMT->nCount,NULL); - pclmtListMT->plmtiFirst=NULL; - pclmtListMT->plmtiLast=NULL; - dwRetErrorCode=NO_ERROR; - }else{ - dwRetErrorCode=GetLastError(); - } -return(dwRetErrorCode); -} - - -__inline void ListMTDestroy(PCLIST_MT pclmtListMT) -{ - InterlockedExchangePointer((volatile PVOID*)&pclmtListMT->nCount,NULL); - pclmtListMT->plmtiFirst=NULL; - pclmtListMT->plmtiLast=NULL; - DeleteCriticalSection(&pclmtListMT->cs); -} - - -__inline BOOL ListMTTryLock(PCLIST_MT pclmtListMT) -{ - return(TryEnterCriticalSection(&pclmtListMT->cs)); -} - - -__inline void ListMTLock(PCLIST_MT pclmtListMT) -{ - EnterCriticalSection(&pclmtListMT->cs); -} - - -__inline void ListMTUnLock(PCLIST_MT pclmtListMT) -{ - LeaveCriticalSection(&pclmtListMT->cs); -} - - -__inline size_t ListMTGetCount(PCLIST_MT pclmtListMT) -{ - return((size_t)InterlockedCompareExchangePointer((LPVOID*)&pclmtListMT->nCount,NULL,NULL)); -} - - -__inline size_t ListMTItemAdd(PCLIST_MT pclmtListMT,PCLIST_MT_ITEM pclmtListMTItem,LPVOID lpData) -{ - size_t dwRet=(size_t)InterlockedIncrementPointer(&pclmtListMT->nCount);//pclmtListMT->nCount++; - pclmtListMTItem->lpData=lpData; - pclmtListMTItem->lpListMT=pclmtListMT; - - if (pclmtListMT->plmtiLast) - {// add node to end of list - pclmtListMTItem->plmtiPrev=pclmtListMT->plmtiLast; - pclmtListMTItem->plmtiNext=NULL; - pclmtListMT->plmtiLast->plmtiNext=pclmtListMTItem; - pclmtListMT->plmtiLast=pclmtListMTItem; - }else{// add the first node to the linked list - pclmtListMTItem->plmtiPrev=NULL; - pclmtListMTItem->plmtiNext=NULL; - pclmtListMT->plmtiFirst=pclmtListMTItem; - pclmtListMT->plmtiLast=pclmtListMTItem; - } - -return(dwRet); -} - - -__inline DWORD ListMTItemDelete(PCLIST_MT pclmtListMT,PCLIST_MT_ITEM pclmtListMTItem) -{ - DWORD dwRetErrorCode; - - if (pclmtListMTItem->lpListMT==pclmtListMT && pclmtListMT) - {// Данный элемент принадлежит к этому списку, можно удалить. - PLIST_MT_ITEM plmtiPrevNode=pclmtListMTItem->plmtiPrev,plmtiNextNode=pclmtListMTItem->plmtiNext; - - if (plmtiPrevNode || plmtiNextNode) - { - if (plmtiPrevNode && plmtiNextNode==NULL) - {// This is the start node in the list to delete - // отключился последний подключившийся - plmtiPrevNode->plmtiNext=NULL; - pclmtListMT->plmtiLast=plmtiPrevNode; - }else{ - if (plmtiPrevNode==NULL && plmtiNextNode) - {// This is the end node in the list to delete - // отключился первый подключившийся - plmtiNextNode->plmtiPrev=NULL; - pclmtListMT->plmtiFirst=plmtiNextNode; - }else{// оключился клиент не первый и не последний - //if (plmtiPrev && plmtiNext) - {// Neither start node nor end node in the list - plmtiPrevNode->plmtiNext=plmtiNextNode; - plmtiNextNode->plmtiPrev=plmtiPrevNode; - } - } - } - }else{// This is the only node in the list to delete - pclmtListMT->plmtiFirst=NULL; - pclmtListMT->plmtiLast=NULL; - } - - pclmtListMTItem->lpListMT=NULL; - InterlockedDecrementPointer(&pclmtListMT->nCount);// pclmtListMT->nCount--; - dwRetErrorCode=NO_ERROR; - }else{// попытались удалить элемент не относящийся к данному списку - dwRetErrorCode=ERROR_INVALID_HANDLE; - } -return(dwRetErrorCode); -} - - -__inline LPVOID ListMTItemDataGet(PCLIST_MT_ITEM pclmtListMTItem) -{ - return(pclmtListMTItem->lpData); -} - - -__inline void ListMTItemDataSet(PCLIST_MT_ITEM pclmtListMTItem, LPVOID lpData) -{ - pclmtListMTItem->lpData=lpData; -} - - -__inline DWORD ListMTItemGetFirst(PCLIST_MT pclmtListMT,PLIST_MT_ITEM *pplmtListMTItem,LPVOID *plpData) -{// если нужно гарантировать эксклюзивный доступ, то есть ListMTLock и ListMTUnLock - DWORD dwRetErrorCode; - - if (pclmtListMT->plmtiFirst) - { - if (pplmtListMTItem) (*pplmtListMTItem)=pclmtListMT->plmtiFirst; - if (plpData) (*plpData)=pclmtListMT->plmtiFirst->lpData; - dwRetErrorCode=NO_ERROR; - }else{ - dwRetErrorCode=ERROR_NO_MORE_ITEMS; - } -return(dwRetErrorCode); -} - - -__inline DWORD ListMTItemGetLast(PCLIST_MT pclmtListMT,PLIST_MT_ITEM *pplmtListMTItem,LPVOID *plpData) -{// если нужно гарантировать эксклюзивный доступ, то есть ListMTLock и ListMTUnLock - DWORD dwRetErrorCode; - - if (pclmtListMT->plmtiLast) - { - if (pplmtListMTItem) (*pplmtListMTItem)=pclmtListMT->plmtiLast; - if (plpData) (*plpData)=pclmtListMT->plmtiLast->lpData; - dwRetErrorCode=NO_ERROR; - }else{ - dwRetErrorCode=ERROR_NO_MORE_ITEMS; - } -return(dwRetErrorCode); -} - - - -__inline void ListMTItemSwap(PCLIST_MT pclmtListMT,PCLIST_MT_ITEM pclmtListMTItem1,PCLIST_MT_ITEM pclmtListMTItem2) -{// поменять два элемента списка местами, даже если они из разных списков - - if (pclmtListMTItem1!=pclmtListMTItem2) - {// это разные элементы списка - PLIST_MT_ITEM lpTemp; - - lpTemp=pclmtListMTItem1->plmtiPrev; - if ((pclmtListMTItem1->plmtiPrev=pclmtListMTItem2->plmtiPrev)==NULL) - {// pclmtListMTItem2 был первым, обновляем заголвок листа, теперь первый pclmtListMTItem1 - pclmtListMT->plmtiFirst=pclmtListMTItem1; - } - - if ((pclmtListMTItem2->plmtiPrev=lpTemp)==NULL) - {// pclmtListMTItem1 был первым, обновляем заголвок листа, теперь первый pclmtListMTItem2 - pclmtListMT->plmtiFirst=pclmtListMTItem2; - } - - - lpTemp=pclmtListMTItem1->plmtiNext; - if ((pclmtListMTItem1->plmtiNext=pclmtListMTItem2->plmtiNext)==NULL) - {// pclmtListMTItem2 был последним, обновляем заголвок листа, теперь последний pclmtListMTItem1 - pclmtListMT->plmtiLast=pclmtListMTItem1; - } - - if ((pclmtListMTItem2->plmtiNext=lpTemp)==NULL) - {// pclmtListMTItem1 был последним, обновляем заголвок листа, теперь последний pclmtListMTItem2 - pclmtListMT->plmtiLast=pclmtListMTItem2; - } - } -} - - -__inline BOOL ListMTIteratorMoveFirst(PCLIST_MT pclmtListMT,PCLIST_MT_ITERATOR pclmtiIterator) -{// если нужно гарантировать эксклюзивный доступ, то есть ListMTLock и ListMTUnLock - return((pclmtiIterator->plmtListMTItem=pclmtListMT->plmtiFirst)? TRUE:FALSE); -} - - -__inline BOOL ListMTIteratorMoveLast(PCLIST_MT pclmtListMT,PCLIST_MT_ITERATOR pclmtiIterator) -{// если нужно гарантировать эксклюзивный доступ, то есть ListMTLock и ListMTUnLock - return((pclmtiIterator->plmtListMTItem=pclmtListMT->plmtiLast)? TRUE:FALSE); -} - - -__inline BOOL ListMTIteratorMovePrev(PCLIST_MT_ITERATOR pclmtiIterator) -{// если нужно гарантировать эксклюзивный доступ, то есть ListMTLock и ListMTUnLock - BOOL bRet=FALSE; - - if (pclmtiIterator->plmtListMTItem) - { - if (pclmtiIterator->plmtListMTItem=pclmtiIterator->plmtListMTItem->plmtiPrev) bRet=TRUE; - } -return(bRet); -} - - -__inline BOOL ListMTIteratorMoveNext(PCLIST_MT_ITERATOR pclmtiIterator) -{// если нужно гарантировать эксклюзивный доступ, то есть ListMTLock и ListMTUnLock - BOOL bRet=FALSE; - - if (pclmtiIterator->plmtListMTItem) - { - if (pclmtiIterator->plmtListMTItem=pclmtiIterator->plmtListMTItem->plmtiNext) bRet=TRUE; - } -return(bRet); -} - - -__inline DWORD ListMTIteratorGet(PCLIST_MT_ITERATOR pclmtiIterator,PLIST_MT_ITEM *pplmtListMTItem,LPVOID *plpData) -{// если нужно гарантировать эксклюзивный доступ, то есть ListMTLock и ListMTUnLock - DWORD dwRetErrorCode; - - if (pclmtiIterator->plmtListMTItem) - { - if (pplmtListMTItem) (*pplmtListMTItem)=pclmtiIterator->plmtListMTItem; - if (plpData) (*plpData)=pclmtiIterator->plmtListMTItem->lpData; - dwRetErrorCode=NO_ERROR; - }else{ - dwRetErrorCode=ERROR_NO_MORE_ITEMS; - } -return(dwRetErrorCode); -} - -#endif // !defined(AFX_LIST_MT__H__INCLUDED_) diff --git a/plugins/SMS/src/AdditionalFunctions/MemoryCompare.h b/plugins/SMS/src/AdditionalFunctions/MemoryCompare.h deleted file mode 100644 index c9d58a3b6f..0000000000 --- a/plugins/SMS/src/AdditionalFunctions/MemoryCompare.h +++ /dev/null @@ -1,32 +0,0 @@ -#if !defined(AFX_MEMORYCOMPARE__H__INCLUDED_) -#define AFX_MEMORYCOMPARE__H__INCLUDED_ - -__inline DWORD MemoryCompare(LPCVOID lpcSource1,size_t dwSource1Size,LPCVOID lpcSource2,size_t dwSource2Size) -{ - if (dwSource1Size == dwSource2Size) { - if (lpcSource1 == lpcSource2) - return CSTR_EQUAL; - - if (lpcSource1 && lpcSource2) { -#ifdef _INC_MEMORY - return 2 + memcmp(lpcSource1,lpcSource2,dwSource1Size)); -#else - size_t dwDiffPosition; - - //dwDiffPosition=RtlCompareMemory(lpcSource1,lpcSource2,dwSource1Size); - for(dwDiffPosition=0; (dwDiffPosition(*((BYTE*)(((size_t)lpcSource2)+dwDiffPosition)))) - return CSTR_GREATER_THAN; - - return CSTR_LESS_THAN; -#endif - } - return (lpcSource1) ? CSTR_GREATER_THAN : CSTR_LESS_THAN; - } - return (dwSource1Size < dwSource2Size) ? CSTR_LESS_THAN : CSTR_GREATER_THAN; -} - -#endif // !defined(AFX_MEMORYCOMPARE__H__INCLUDED_) diff --git a/plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h b/plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h deleted file mode 100644 index e2efab157a..0000000000 --- a/plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h +++ /dev/null @@ -1,13 +0,0 @@ -#if !defined(AFX_MEMORYFINDBYTE__H__INCLUDED_) -#define AFX_MEMORYFINDBYTE__H__INCLUDED_ - -__inline LPVOID MemoryFindByte(size_t dwFrom,LPCVOID lpcSource,size_t dwSourceSize,unsigned char chWhatFind) -{ - if (lpcSource && dwSourceSize) - if (dwFrom < dwSourceSize) - return memchr((BYTE*)lpcSource + dwFrom, chWhatFind, dwSourceSize-dwFrom); - - return nullptr; -} - -#endif // !defined(AFX_MEMORYFINDBYTE__H__INCLUDED_) diff --git a/plugins/SMS/src/SMSConstans.h b/plugins/SMS/src/SMSConstans.h deleted file mode 100644 index fb40a680b2..0000000000 --- a/plugins/SMS/src/SMSConstans.h +++ /dev/null @@ -1,87 +0,0 @@ -#if !defined(AFX_SMS_CONSTANS_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_) -#define AFX_SMS_CONSTANS_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_ - -#define MODULENAME "SMSPlugin" -#define PROTOCOL_NAMEW L"SMSPlugin" -#define PROTOCOL_NAME_LEN (sizeof(MODULENAME)-1) -#define PROTOCOL_NAME_SIZE sizeof(MODULENAME) -#define PROTOCOL_DISPLAY_NAME_ORIG "SMS" - -#define TIMEOUT_MSGSEND 60000 // send sms timeout -#define MIN_SMS_DBEVENT_LEN 4 // для фильтрации событий авторизации от джабер плагина -#define MAX_PHONE_LEN MAX_PATH -#define PHONES_MIN_COUNT 4 //internal // количество элементов обязательно проверяемых при извлечении email адреса из инфы юзера - -#define SMS_DEFAULT_ -#define SMS_DEFAULT_SIGNATUREPOS FALSE -#define SMS_DEFAULT_SHOWACK TRUE -#define SMS_DEFAULT_USESIGNATURE TRUE -#define SMS_DEFAULT_AUTOPOP FALSE -#define SMS_DEFAULT_SAVEWINPOS FALSE - - - -// -#define ICQEVENTTYPE_SMSCONFIRMATION 3001 - - -//Fonts definitions -//#define SRMMMOD "SRMM" -#define SRMMMOD "TabSRMM_Fonts" - -#define FONTF_BOLD 1 -#define FONTF_ITALIC 2 -struct FontOptionsList -{ - COLORREF defColour; - wchar_t* szDefFace; - BYTE defStyle; - char defSize; -} - -static fontOptionsList[] = { - { RGB(106, 106, 106), L"Arial", 0, -12}, -}; - - -#define MSGFONTID_MYMSG 0 -#define MSGFONTID_YOURMSG 2 -#define MSGFONTID_MESSAGEAREA 16 - - -#define SRMSGSET_BKGCOLOUR "BkgColour" -#define SRMSGSET_INPBKGCOLOUR "inputbg" -#define SRMSGDEFSET_BKGCOLOUR GetSysColor(COLOR_WINDOW) -#define FONTF_BOLD 1 -#define FONTF_ITALIC 2 - - - -//Decleration of functions that used when user hit miranda for new message/confirmation -int ReadAckSMS(WPARAM wParam,LPARAM lParam); -int ReadMsgSMS(WPARAM wParam,LPARAM lParam); -int SendSMSMenuCommand(WPARAM wParam,LPARAM lParam); - - - -#define SMS_READ "/ReadSms" -#define SMS_READ_ACK "/ReadSmsAck" -#define SMS_SEND "/SendSMS" -#define SMS_SEND_STR LPGENW("Send &SMS...") -#define SMS_SEND_CM_STR LPGENW("&SMS Message") - -// структура содержащая информацию о сервисах/функциях -struct SERVICE_ITEM -{ - LPSTR lpszName; // имя сервиса, оно же имя в иколибе - LPVOID lpFunc; // функция вызываемая -}; - -static const SERVICE_ITEM siPluginServices[] = -{ - { SMS_READ, ReadMsgSMS }, - { SMS_READ_ACK, ReadAckSMS }, - { SMS_SEND, SendSMSMenuCommand }, -}; - -#endif // !defined(AFX_SMS_CONSTANS_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_) diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp deleted file mode 100644 index 9bd92063ec..0000000000 --- a/plugins/SMS/src/SMS_svc.cpp +++ /dev/null @@ -1,124 +0,0 @@ -#include "stdafx.h" - -int LoadServices(void) -{ - char szServiceFunction[MAX_PATH], *pszServiceFunctionName; - - memcpy(szServiceFunction, MODULENAME, PROTOCOL_NAME_SIZE); - pszServiceFunctionName = szServiceFunction + PROTOCOL_NAME_LEN; - - // Service creation - for (auto &it : siPluginServices) { - memcpy(pszServiceFunctionName, it.lpszName, (mir_strlen(it.lpszName) + 1)); - CreateServiceFunction(szServiceFunction, (MIRANDASERVICE)it.lpFunc); - } - return 0; -} - - -int LoadModules(void) -{ - char szServiceFunction[MAX_PATH]; - mir_snprintf(szServiceFunction, "%s%s", MODULENAME, SMS_SEND); - - CMenuItem mi(&g_plugin); - - SET_UID(mi, 0x3ce387db, 0xbaac, 0x490f, 0xac, 0xab, 0x8c, 0xf7, 0xe9, 0xcd, 0x86, 0xa1); - mi.position = 300050000; - mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_SMS); - mi.name.w = SMS_SEND_STR; - mi.pszService = szServiceFunction; - mi.flags = CMIF_UNICODE; - Menu_AddMainMenuItem(&mi); - - SET_UID(mi, 0x736e4cff, 0x769e, 0x45dc, 0x8b, 0x78, 0x83, 0xf9, 0xe4, 0xbb, 0x81, 0x9e); - mi.position = -2000070000; - mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_SMS); - mi.name.w = SMS_SEND_CM_STR; - mi.pszService = szServiceFunction; - mi.flags = CMIF_UNICODE; - ssSMSSettings.hContactMenuItems[0] = Menu_AddContactMenuItem(&mi); - - g_plugin.addSound("RecvSMSMsg", PROTOCOL_NAMEW, LPGENW("Incoming SMS Message")); - g_plugin.addSound("RecvSMSConfirmation", PROTOCOL_NAMEW, LPGENW("Incoming SMS Confirmation")); - - RefreshAccountList(NULL, NULL); - return 0; -} - -int SmsRebuildContactMenu(WPARAM wParam, LPARAM) -{ - Menu_ShowItem(ssSMSSettings.hContactMenuItems[0], GetContactPhonesCount(wParam) != 0); - return 0; -} - -//This function called when user clicked Menu. -int SendSMSMenuCommand(WPARAM wParam, LPARAM) -{ - HWND hwndSendSms; - - // user clicked on the "SMS Message" on one of the users - if (wParam) { - hwndSendSms = SendSMSWindowIsOtherInstanceHContact(wParam); - if (hwndSendSms) - SetFocus(hwndSendSms); - else - hwndSendSms = SendSMSWindowAdd(wParam); - } - // user clicked on the "SMS Send" in the Main Menu - else { - hwndSendSms = SendSMSWindowAdd(NULL); - EnableWindow(GetDlgItem(hwndSendSms, IDC_NAME), TRUE); - EnableWindow(GetDlgItem(hwndSendSms, IDC_SAVENUMBER), FALSE); - - for (auto &hContact : Contacts()) { - if (GetContactPhonesCount(hContact)) { - SendDlgItemMessage(hwndSendSms, IDC_NAME, CB_ADDSTRING, 0, (LPARAM)Clist_GetContactDisplayName(hContact)); - SendSMSWindowSMSContactAdd(hwndSendSms, hContact); - } - } - } - return 0; -} - -// This function used to popup a read SMS window after the user clicked on the received SMS message. -int ReadMsgSMS(WPARAM, LPARAM lParam) -{ - CLISTEVENT *cle = (CLISTEVENT*)lParam; - - DBEVENTINFO dbei = {}; - if ((dbei.cbBlob = db_event_getBlobSize(((CLISTEVENT*)lParam)->hDbEvent)) == -1) - return 1; - dbei.pBlob = (PBYTE)_alloca(dbei.cbBlob); - - if (db_event_get(cle->hDbEvent, &dbei) == 0) - if (dbei.eventType == ICQEVENTTYPE_SMS || dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION) - if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN) { - if (RecvSMSWindowAdd(cle->hContact, ICQEVENTTYPE_SMS, nullptr, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) { - db_event_markRead(cle->hContact, cle->hDbEvent); - return 0; - } - } - return 1; -} - -// This function used to popup a read SMS window after the user clicked on the received SMS confirmation. -int ReadAckSMS(WPARAM, LPARAM lParam) -{ - CLISTEVENT *cle = (CLISTEVENT*)lParam; - - DBEVENTINFO dbei = {}; - if ((dbei.cbBlob = db_event_getBlobSize(cle->hDbEvent)) == -1) - return 1; - dbei.pBlob = (PBYTE)_alloca(dbei.cbBlob); - - if (db_event_get(cle->hDbEvent, &dbei) == 0) - if (dbei.eventType == ICQEVENTTYPE_SMS || dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION) - if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN) { - if (RecvSMSWindowAdd(cle->hContact, ICQEVENTTYPE_SMSCONFIRMATION, nullptr, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) { - db_event_delete(cle->hContact, cle->hDbEvent); - return 0; - } - } - return 1; -} diff --git a/plugins/SMS/src/functions.cpp b/plugins/SMS/src/functions.cpp deleted file mode 100644 index a89dd2a1ce..0000000000 --- a/plugins/SMS/src/functions.cpp +++ /dev/null @@ -1,517 +0,0 @@ -#include "stdafx.h" - -BOOL DB_GetStaticStringW(MCONTACT hContact, LPSTR lpszModule, LPSTR lpszValueName, LPWSTR lpwszRetBuff, size_t dwRetBuffSize, size_t *pdwRetBuffSize) -{// sizes in wchars - BOOL bRet = FALSE; - size_t dwReadedStringLen; - DBVARIANT dbv = { 0 }; - if (db_get_ws(hContact, lpszModule, lpszValueName, &dbv) == 0) { - dwReadedStringLen = mir_wstrlen(dbv.pwszVal); - if (lpwszRetBuff && (dwRetBuffSize > dwReadedStringLen)) { - memcpy(lpwszRetBuff, dbv.pszVal, (dwReadedStringLen*sizeof(WCHAR)));//include null terminated - (*((WCHAR*)(lpwszRetBuff + dwReadedStringLen))) = 0; - bRet = TRUE; - } - else { - if (lpwszRetBuff && dwRetBuffSize >= sizeof(WCHAR)) (*((WCHAR*)lpwszRetBuff)) = 0; - } - if (pdwRetBuffSize) (*pdwRetBuffSize) = dwReadedStringLen; - - db_free(&dbv); - } - else { - if (lpwszRetBuff && dwRetBuffSize >= sizeof(WCHAR)) (*((WCHAR*)lpwszRetBuff)) = 0; - if (pdwRetBuffSize) (*pdwRetBuffSize) = 0; - } - return(bRet); -} - -LPSTR GetModuleName(MCONTACT hContact) -{ - LPSTR lpszRet; - - if (hContact) { - lpszRet = GetContactProto(hContact); - if (lpszRet == nullptr) - lpszRet = MODULENAME; - } - else lpszRet = MODULENAME; - - return lpszRet; -} - -void EnableControlsArray(HWND hWndDlg, WORD *pwControlsList, size_t dwControlsListCount, BOOL bEnabled) -{ - for (size_t i = 0; i < dwControlsListCount; i++) EnableWindow(GetDlgItem(hWndDlg, pwControlsList[i]), bEnabled); -} - -//This function gets a Cellular string szPhone and clean it from symbools. -size_t CopyNumberA(LPSTR lpszOutBuff, LPSTR lpszBuff, size_t dwLen) -{ - BYTE btChar; - LPBYTE lpbOutBuff = (LPBYTE)lpszOutBuff, lpbInBuff = (LPBYTE)lpszBuff; - - for (size_t i = 0; i < dwLen; i++) { - btChar = (*lpbInBuff++); - if (btChar >= '0' && btChar <= '9') (*lpbOutBuff++) = btChar; - } - (*lpbOutBuff) = 0; - - return((lpbOutBuff - (LPBYTE)lpszOutBuff)); -} - -size_t CopyNumberW(LPWSTR lpcOutBuff, LPWSTR lpcBuff, size_t dwLen) -{ - WCHAR wChar; - LPWSTR lpwszOutBuff = lpcOutBuff, lpwszInBuff = lpcBuff; - - for (size_t i = 0; i < dwLen; i++) { - wChar = (*lpwszInBuff++); - if (wChar >= '0' && wChar <= '9') (*lpwszOutBuff++) = wChar; - } - (*lpwszOutBuff) = 0; - - return((lpwszOutBuff - lpcOutBuff)); -} - - -bool IsPhoneW(LPWSTR lpwszString, size_t dwStringLen) -{ - if (dwStringLen <= 1) - return false; - - for (size_t i = 0; i < dwStringLen; i++) { - WCHAR wChar = (*lpwszString++); - if (wChar<'0' || wChar>'9') - if (wChar != '+' && wChar != 'S' && wChar != 'M' && wChar != ' ' && wChar != '(' && wChar != ')') - return false; - } - return true; -} - - -DWORD GetContactPhonesCountParam(MCONTACT hContact, LPSTR lpszModule, LPSTR lpszValueName) -{ - DWORD dwRet = 0; - char szBuff[MAX_PATH]; - WCHAR wszPhone[MAX_PHONE_LEN]; - size_t i, dwPhoneSize; - - if (DB_GetStaticStringW(hContact, lpszModule, lpszValueName, wszPhone, _countof(wszPhone), &dwPhoneSize)) - if (IsPhoneW(wszPhone, dwPhoneSize)) - dwRet++; - - for (i = 0; i <= PHONES_MIN_COUNT; i++) { - mir_snprintf(szBuff, "%s%ld", lpszValueName, i); - if (DB_GetStaticStringW(hContact, lpszModule, szBuff, wszPhone, _countof(wszPhone), &dwPhoneSize)) - if (IsPhoneW(wszPhone, dwPhoneSize)) - dwRet++; - } - return dwRet; -} - - -DWORD GetContactPhonesCount(MCONTACT hContact) -{ - DWORD dwRet = 0; - LPSTR lpszProto = GetContactProto(hContact); - if (lpszProto) { - dwRet += GetContactPhonesCountParam(hContact, lpszProto, "Phone"); - dwRet += GetContactPhonesCountParam(hContact, lpszProto, "Cellular"); - dwRet += GetContactPhonesCountParam(hContact, lpszProto, "Fax"); - } - dwRet += GetContactPhonesCountParam(hContact, "UserInfo", "MyPhone"); - dwRet += GetContactPhonesCountParam(hContact, "UserInfo", "Phone"); - dwRet += GetContactPhonesCountParam(hContact, "UserInfo", "Cellular"); - dwRet += GetContactPhonesCountParam(hContact, "UserInfo", "Fax"); - return dwRet; -} - - -BOOL IsContactPhoneParam(MCONTACT hContact, LPSTR lpszModule, LPSTR lpszValueName, LPWSTR lpwszPhone, size_t dwPhoneSize) -{ - char szBuff[MAX_PATH]; - WCHAR wszPhoneLocal[MAX_PHONE_LEN]; - size_t i, dwPhoneSizeLocal; - - if (DB_GetStaticStringW(hContact, lpszModule, lpszValueName, wszPhoneLocal, _countof(wszPhoneLocal), &dwPhoneSizeLocal)) - if (IsPhoneW(wszPhoneLocal, dwPhoneSizeLocal)) { - dwPhoneSizeLocal = CopyNumberW(wszPhoneLocal, wszPhoneLocal, dwPhoneSizeLocal); - if (MemoryCompare(wszPhoneLocal, dwPhoneSizeLocal, lpwszPhone, dwPhoneSize) == CSTR_EQUAL) - return TRUE; - } - - for (i = 0; i <= PHONES_MIN_COUNT; i++) { - mir_snprintf(szBuff, "%s%ld", lpszValueName, i); - if (DB_GetStaticStringW(hContact, lpszModule, szBuff, wszPhoneLocal, _countof(wszPhoneLocal), &dwPhoneSizeLocal)) { - if (IsPhoneW(wszPhoneLocal, dwPhoneSizeLocal)) { - dwPhoneSizeLocal = CopyNumberW(wszPhoneLocal, wszPhoneLocal, dwPhoneSizeLocal); - if (MemoryCompare(wszPhoneLocal, dwPhoneSizeLocal, lpwszPhone, dwPhoneSize) == CSTR_EQUAL) - return TRUE; - } - } - } - return FALSE; -} - - -BOOL IsContactPhone(MCONTACT hContact, LPWSTR lpwszPhone, size_t dwPhoneSize) -{ - BOOL bRet = FALSE; - WCHAR wszPhoneLocal[MAX_PHONE_LEN]; - - size_t dwPhoneSizeLocal = CopyNumberW(wszPhoneLocal, lpwszPhone, dwPhoneSize); - LPSTR lpszProto = GetContactProto(hContact); - if (lpszProto) { - bRet = IsContactPhoneParam(hContact, lpszProto, "Phone", wszPhoneLocal, dwPhoneSizeLocal); - if (bRet == FALSE) bRet = IsContactPhoneParam(hContact, lpszProto, "Cellular", wszPhoneLocal, dwPhoneSizeLocal); - if (bRet == FALSE) bRet = IsContactPhoneParam(hContact, lpszProto, "Fax", wszPhoneLocal, dwPhoneSizeLocal); - } - if (bRet == FALSE) bRet = IsContactPhoneParam(hContact, "UserInfo", "MyPhone", wszPhoneLocal, dwPhoneSizeLocal); - if (bRet == FALSE) bRet = IsContactPhoneParam(hContact, "UserInfo", "Phone", wszPhoneLocal, dwPhoneSizeLocal); - if (bRet == FALSE) bRet = IsContactPhoneParam(hContact, "UserInfo", "Cellular", wszPhoneLocal, dwPhoneSizeLocal); - if (bRet == FALSE) bRet = IsContactPhoneParam(hContact, "UserInfo", "Fax", wszPhoneLocal, dwPhoneSizeLocal); - - return bRet; -} - - -//This function get a string cellular number and return the HANDLE of the contact that has this -//number in the miranda phonebook (and marked as an SMS able) at the User Details. -//If no one has this number function returns NULL. -MCONTACT HContactFromPhone(LPWSTR lpwszPhone, size_t dwPhoneSize) -{ - if (lpwszPhone && dwPhoneSize) { - //check not already on list - for (auto &hContact : Contacts()) - if (IsContactPhone(hContact, lpwszPhone, dwPhoneSize)) - return hContact; - } - - return NULL; -} - - -BOOL GetDataFromMessage(LPSTR lpszMessage, size_t dwMessageSize, DWORD *pdwEventType, LPWSTR lpwszPhone, size_t dwPhoneSize, size_t *pdwPhoneSizeRet, UINT *piIcon) -{ - BOOL bRet = FALSE; - - DWORD dwEventTypeRet = 0; - size_t dwPhoneSizeRet = 0; - UINT iIconRet = 0; - - if (lpszMessage && dwMessageSize) { - if (MemoryCompare(lpszMessage, 10, "SMS From: ", 10) == CSTR_EQUAL) { - LPSTR lpsz = (LPSTR)strstr(lpszMessage + 10, "\r\n"); - if (lpsz) { - if (lpwszPhone && dwPhoneSize) { - dwPhoneSizeRet = MultiByteToWideChar(CP_UTF8, 0, (lpszMessage + 10), (int)min((size_t)(lpsz - (lpszMessage + 10)), dwPhoneSize), lpwszPhone, (int)dwPhoneSize); - dwPhoneSizeRet = CopyNumberW(lpwszPhone, lpwszPhone, dwPhoneSizeRet); - } - } - iIconRet = 0; - dwEventTypeRet = ICQEVENTTYPE_SMS; - bRet = TRUE; - } - else if (MemoryCompare(lpszMessage, 23, "SMS Confirmation From: ", 23) == CSTR_EQUAL) { - LPSTR lpsz = (LPSTR)strstr(lpszMessage + 23, "\r\n"); - if (lpsz) { - if (lpwszPhone && dwPhoneSize) { - dwPhoneSizeRet = MultiByteToWideChar(CP_UTF8, 0, (lpszMessage + 23), (int)min((size_t)(lpsz - (lpszMessage + 23)), dwPhoneSize), lpwszPhone, (int)dwPhoneSize); - dwPhoneSizeRet = CopyNumberW(lpwszPhone, lpwszPhone, dwPhoneSizeRet); - } - - lpsz += 2; - if (MemoryCompare(lpsz, 24, "SMS was sent succesfully", 24) == CSTR_EQUAL) - iIconRet = IDI_SMSSENT; - else - iIconRet = IDI_SMSNOTSENT; - } - dwEventTypeRet = ICQEVENTTYPE_SMSCONFIRMATION; - bRet = TRUE; - } - } - - if (pdwPhoneSizeRet) *pdwPhoneSizeRet = dwPhoneSizeRet; - if (pdwEventType) *pdwEventType = dwEventTypeRet; - if (piIcon) *piIcon = iIconRet; - - return bRet; -} - -BOOL GetXMLFieldEx(LPSTR lpszXML, size_t dwXMLSize, LPSTR *plpszData, size_t *pdwDataSize, const char *tag1, ...) -{ - BOOL bRet = FALSE; - int thisLevel = 0; - LPSTR lpszFindTag = (LPSTR)tag1, lpszTagEnd = lpszXML, lpszDataStart = nullptr; - - va_list va; - va_start(va, tag1); - while (TRUE) { - LPSTR lpszTagStart = (LPSTR)MemoryFindByte(lpszTagEnd - lpszXML, lpszXML, dwXMLSize, '<'); - if (!lpszTagStart) - break; - - lpszTagEnd = (LPSTR)MemoryFindByte(lpszTagStart - lpszXML, lpszXML, dwXMLSize, '>'); - if (!lpszTagEnd) - break; - - lpszTagStart++; - lpszTagEnd--; - if ((*((BYTE*)lpszTagStart)) == '/') { - if (--thisLevel < 0) { - if (lpszDataStart) { - if (plpszData) (*plpszData) = lpszDataStart; - if (pdwDataSize) (*pdwDataSize) = ((lpszTagStart - 1) - lpszDataStart); - bRet = TRUE; - } - break; - } - } - else { - if (++thisLevel == 1) - if (CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszFindTag, -1, lpszTagStart, ((lpszTagEnd + 1) - lpszTagStart)) == CSTR_EQUAL) { - lpszFindTag = va_arg(va, LPSTR); - if (lpszFindTag == nullptr) lpszDataStart = (lpszTagEnd + 2); - thisLevel = 0; - } - } - } - va_end(va); - return bRet; -} - - -BOOL GetXMLFieldExBuff(LPSTR lpszXML, size_t dwXMLSize, LPSTR lpszBuff, size_t dwBuffSize, size_t *pdwBuffSizeRet, const char *tag1, ...) -{ - BOOL bRet = FALSE; - int thisLevel = 0; - LPSTR lpszFindTag = (LPSTR)tag1, lpszTagStart, lpszTagEnd = lpszXML, lpszDataStart = nullptr; - va_list va; - - - va_start(va, tag1); - while (TRUE) { - lpszTagStart = (LPSTR)MemoryFindByte((lpszTagEnd - lpszXML), lpszXML, dwXMLSize, '<'); - if (lpszTagStart) { - lpszTagEnd = (LPSTR)MemoryFindByte((lpszTagStart - lpszXML), lpszXML, dwXMLSize, '>'); - if (lpszTagEnd) { - lpszTagStart++; - lpszTagEnd--; - if ((*((BYTE*)lpszTagStart)) == '/') { - if (--thisLevel < 0) { - if (lpszDataStart) { - size_t dwBuffSizeRet = min((dwBuffSize - 2), (size_t)((lpszTagStart - 1) - lpszDataStart)); - if (lpszBuff && dwBuffSize) memcpy(lpszBuff, lpszDataStart, dwBuffSizeRet); (*((WORD*)(lpszBuff + dwBuffSizeRet))) = 0; - if (pdwBuffSizeRet) (*pdwBuffSizeRet) = dwBuffSizeRet; - bRet = TRUE; - } - break; - } - } - else { - if (++thisLevel == 1) - if (CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszFindTag, -1, lpszTagStart, ((lpszTagEnd + 1) - lpszTagStart)) == CSTR_EQUAL) { - lpszFindTag = va_arg(va, LPSTR); - if (lpszFindTag == nullptr) lpszDataStart = (lpszTagEnd + 2); - thisLevel = 0; - } - } - } - else { - break; - } - } - else { - break; - } - } - va_end(va); - - - if (bRet == FALSE) { - if (lpszBuff) (*((WORD*)lpszBuff)) = 0; - if (pdwBuffSizeRet) (*pdwBuffSizeRet) = 0; - } - - return(bRet); -} - -DWORD ReplaceInBuff(LPVOID lpInBuff, size_t dwInBuffSize, size_t dwReplaceItemsCount, LPVOID *plpInReplaceItems, size_t *pdwInReplaceItemsCounts, LPVOID *plpOutReplaceItems, size_t *pdwOutReplaceItemsCounts, LPVOID lpOutBuff, size_t dwOutBuffSize, size_t *pdwOutBuffSize) -{ - DWORD dwRetErrorCode = NO_ERROR; - LPBYTE *plpszFound, lpszMessageConvertedCur, lpszMessageCur, lpszMessageCurPrev, lpszMessageConvertedMax; - size_t i, dwFirstFoundedIndex = 0, dwFoundedCount = 0, dwMemPartToCopy; - - plpszFound = (LPBYTE*)MEMALLOC((sizeof(LPBYTE)*dwReplaceItemsCount)); - - lpszMessageCurPrev = (LPBYTE)lpInBuff; - lpszMessageConvertedCur = (LPBYTE)lpOutBuff; - lpszMessageConvertedMax = (((LPBYTE)lpOutBuff) + dwOutBuffSize); - - // looking for in first time - for (i = 0; i < dwReplaceItemsCount; i++) { - plpszFound[i] = (LPBYTE)strstr((LPCSTR)lpInBuff + (lpszMessageCurPrev - (LPBYTE)lpInBuff), (LPCSTR)plpInReplaceItems[i]); - if (plpszFound[i]) - dwFoundedCount++; - } - - while (dwFoundedCount) { - // looking for first to replace - for (i = 0; i < dwReplaceItemsCount; i++) - if (plpszFound[i] && (plpszFound[i] < plpszFound[dwFirstFoundedIndex] || plpszFound[dwFirstFoundedIndex] == nullptr)) - dwFirstFoundedIndex = i; - - // in founded - if (plpszFound[dwFirstFoundedIndex]) { - dwMemPartToCopy = (plpszFound[dwFirstFoundedIndex] - lpszMessageCurPrev); - if (lpszMessageConvertedMax > (lpszMessageConvertedCur + (dwMemPartToCopy + pdwInReplaceItemsCounts[dwFirstFoundedIndex]))) { - memcpy(lpszMessageConvertedCur, lpszMessageCurPrev, dwMemPartToCopy); lpszMessageConvertedCur += dwMemPartToCopy; - memcpy(lpszMessageConvertedCur, plpOutReplaceItems[dwFirstFoundedIndex], pdwOutReplaceItemsCounts[dwFirstFoundedIndex]); lpszMessageConvertedCur += pdwOutReplaceItemsCounts[dwFirstFoundedIndex]; - lpszMessageCurPrev = (plpszFound[dwFirstFoundedIndex] + pdwInReplaceItemsCounts[dwFirstFoundedIndex]); - - for (i = 0; i < dwReplaceItemsCount; i++) {// loking for in next time - if (plpszFound[i] && plpszFound[i] < lpszMessageCurPrev) { - dwFoundedCount--; - plpszFound[i] = (LPBYTE)strstr((LPCSTR)lpInBuff + (lpszMessageCurPrev - (LPBYTE)lpInBuff), (LPCSTR)plpInReplaceItems[i]); - if (plpszFound[i]) dwFoundedCount++; - } - } - } - else { - dwRetErrorCode = ERROR_BUFFER_OVERFLOW; - DebugBreak(); - break; - } - } - else {// сюда по идее никогда не попадём, на всякий случай. - DebugBreak(); - break; - } - } - lpszMessageCur = (((LPBYTE)lpInBuff) + dwInBuffSize); - memcpy(lpszMessageConvertedCur, lpszMessageCurPrev, (lpszMessageCur - lpszMessageCurPrev)); lpszMessageConvertedCur += (lpszMessageCur - lpszMessageCurPrev); - (*((WORD*)lpszMessageConvertedCur)) = 0; - - MEMFREE(plpszFound); - - if (pdwOutBuffSize) (*pdwOutBuffSize) = (lpszMessageConvertedCur - ((LPBYTE)lpOutBuff)); - - return(dwRetErrorCode); -} - - -static const LPTSTR lpszXMLTags[] = { TEXT("'"), TEXT("""), TEXT("&"), TEXT("<"), TEXT(">") }; -static const size_t dwXMLTagsCount[] = { (6 * sizeof(wchar_t)), (6 * sizeof(wchar_t)), (5 * sizeof(wchar_t)), (4 * sizeof(wchar_t)), (4 * sizeof(wchar_t)) }; -static const LPTSTR lpszXMLSymbols[] = { TEXT("\'"), TEXT("\""), TEXT("&"), TEXT("<"), TEXT(">") }; -static const size_t dwXMLSymbolsCount[] = { sizeof(wchar_t), sizeof(wchar_t), sizeof(wchar_t), sizeof(wchar_t), sizeof(wchar_t) }; - -//Decode XML coded string. The function translate special xml code into standard characters. -DWORD DecodeXML(LPTSTR lptszMessage, size_t dwMessageSize, LPTSTR lptszMessageConverted, size_t dwMessageConvertedBuffSize, size_t *pdwMessageConvertedSize) -{ - DWORD dwRet = ReplaceInBuff(lptszMessage, (dwMessageSize*sizeof(wchar_t)), _countof(lpszXMLTags), (LPVOID*)lpszXMLTags, (size_t*)dwXMLTagsCount, (LPVOID*)lpszXMLSymbols, (size_t*)dwXMLSymbolsCount, lptszMessageConverted, (dwMessageConvertedBuffSize*sizeof(wchar_t)), pdwMessageConvertedSize); - - if (pdwMessageConvertedSize) (*pdwMessageConvertedSize) /= sizeof(wchar_t); - return(dwRet); -} - -//Encode XML coded string. The function translate special saved xml characters into special characters. -DWORD EncodeXML(LPTSTR lptszMessage, size_t dwMessageSize, LPTSTR lptszMessageConverted, size_t dwMessageConvertedBuffSize, size_t *pdwMessageConvertedSize) -{ - DWORD dwRet = ReplaceInBuff(lptszMessage, (dwMessageSize*sizeof(wchar_t)), _countof(lpszXMLTags), (LPVOID*)lpszXMLSymbols, (size_t*)dwXMLSymbolsCount, (LPVOID*)lpszXMLTags, (size_t*)dwXMLTagsCount, lptszMessageConverted, (dwMessageConvertedBuffSize*sizeof(wchar_t)), pdwMessageConvertedSize); - - if (pdwMessageConvertedSize) (*pdwMessageConvertedSize) /= sizeof(wchar_t); - return(dwRet); -} - - -//(Taken from Miranda-IM source code:) -BYTE MsgDlgGetFontDefaultCharset(const wchar_t*) -{ - return(DEFAULT_CHARSET); -} - - -void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) -{ - int style; - char str[MAX_PATH]; - DBVARIANT dbv; - - if (colour) { - mir_snprintf(str, "Font%dCol", i); - (*colour) = db_get_dw(0, SRMMMOD, str, fontOptionsList[0].defColour); - } - - if (lf) { - if (db_get_ws(0, SRMMMOD, str, &dbv)) { - mir_wstrncpy(lf->lfFaceName, fontOptionsList[0].szDefFace, _countof(lf->lfFaceName)); - } - else { - mir_wstrncpy(lf->lfFaceName, dbv.pwszVal, _countof(lf->lfFaceName)); - db_free(&dbv); - } - - mir_snprintf(str, "Font%dSize", i); - lf->lfHeight = (char)db_get_b(0, SRMMMOD, str, fontOptionsList[0].defSize); - lf->lfWidth = 0; - lf->lfEscapement = 0; - lf->lfOrientation = 0; - mir_snprintf(str, "Font%dSty", i); - style = db_get_b(0, SRMMMOD, str, fontOptionsList[0].defStyle); - lf->lfWeight = style&FONTF_BOLD ? FW_BOLD : FW_NORMAL; - lf->lfItalic = style&FONTF_ITALIC ? 1 : 0; - lf->lfUnderline = 0; - lf->lfStrikeOut = 0; - mir_snprintf(str, "Font%dSet", i); - lf->lfCharSet = db_get_b(0, SRMMMOD, str, MsgDlgGetFontDefaultCharset(lf->lfFaceName)); - lf->lfOutPrecision = OUT_DEFAULT_PRECIS; - lf->lfClipPrecision = CLIP_DEFAULT_PRECIS; - lf->lfQuality = DEFAULT_QUALITY; - lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; - mir_snprintf(str, "Font%d", i); - } -} - -LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) { - case WM_CHAR: - if (wParam == '\n' && GetKeyState(VK_CONTROL) & 0x8000) { - PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0); - return 0; - } - } - - return mir_callNextSubclass(hwnd, MessageSubclassProc, message, wParam, lParam); -} - -//This function refresh account list. -//It called when SMS plugin loaded and upon change in the account list. -int RefreshAccountList(WPARAM, LPARAM) -{ - int dwAccCount = 0, dwSMSAccountsCount = 0; - PROTOACCOUNT **ppaAccounts; - Proto_EnumAccounts((int*)&dwAccCount, &ppaAccounts); - - FreeAccountList(); - ssSMSSettings.ppaSMSAccounts = (PROTOACCOUNT**)MEMALLOC((dwAccCount*sizeof(LPVOID))); - if (ssSMSSettings.ppaSMSAccounts) - for (int i = 0; i < dwAccCount; i++) - if (ppaAccounts[i]->IsEnabled()) - if (ProtoServiceExists(ppaAccounts[i]->szModuleName, MS_ICQ_SENDSMS)) - ssSMSSettings.ppaSMSAccounts[dwSMSAccountsCount++] = ppaAccounts[i]; - - ssSMSSettings.dwSMSAccountsCount = dwSMSAccountsCount; - SendSMSWindowsUpdateAllAccountLists(); - - return 0; -} - -//This function free the global account list. -//This function should be called before list refresh or when SMS plugin unloaded. -void FreeAccountList() -{ - MEMFREE(ssSMSSettings.ppaSMSAccounts); - ssSMSSettings.dwSMSAccountsCount = 0; -} diff --git a/plugins/SMS/src/main.cpp b/plugins/SMS/src/main.cpp deleted file mode 100644 index 1e55334bfa..0000000000 --- a/plugins/SMS/src/main.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* -Miranda-IM SMS Plugin -Copyright (C) 2001-2 Richard Hughes -Copyright (C) 2007-19 Rozhuk Ivan - -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 was the original words. -This plugin was modified by Ariel Shulman (NuKe007). -For any comments, problems, etc. contact me at Miranda-IM forums or E-Mail or ICQ. -All the information needed you can find at www.nuke007.tk -Enjoy the code and use it smartly! -*/ - -#include "stdafx.h" - -CMPlugin g_plugin; - -SMS_SETTINGS ssSMSSettings; - -///////////////////////////////////////////////////////////////////////////////////////// - -PLUGININFOEX pluginInfoEx = -{ - sizeof(PLUGININFOEX), - __PLUGIN_NAME, - PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), - __DESCRIPTION, - __AUTHOR, - __COPYRIGHT, - __AUTHORWEB, - UNICODE_AWARE, - // {CF97FD5D-B911-47A8-AF03-D21968B5B894} - {0xcf97fd5d, 0xb911, 0x47a8, {0xaf, 0x3, 0xd2, 0x19, 0x68, 0xb5, 0xb8, 0x94}} -}; - -CMPlugin::CMPlugin() : - PLUGIN(MODULENAME, pluginInfoEx) -{} - -///////////////////////////////////////////////////////////////////////////////////////// - -static void VersionConversions() -{ - WCHAR wsztm[MAX_PATH]; - - if (DB_SMS_GetStaticStringW(NULL, "UseSignature", wsztm, _countof(wsztm), nullptr)) - DB_SMS_SetByte(NULL, "UseSignature", (wsztm[0] == '0')); - else - DB_SMS_SetByte(NULL, "UseSignature", SMS_DEFAULT_USESIGNATURE); - - if (DB_SMS_GetStaticStringW(NULL, "SignaturePos", wsztm, _countof(wsztm), nullptr)) - DB_SMS_SetByte(NULL, "SignaturePos", (wsztm[0] == '0')); - else - DB_SMS_SetByte(NULL, "SignaturePos", SMS_DEFAULT_SIGNATUREPOS); - - if (DB_SMS_GetStaticStringW(NULL, "ShowACK", wsztm, _countof(wsztm), nullptr)) - DB_SMS_SetByte(NULL, "ShowACK", (wsztm[0] == '0')); - else - DB_SMS_SetByte(NULL, "ShowACK", SMS_DEFAULT_SHOWACK); -} - -static int OnModulesLoaded(WPARAM, LPARAM) -{ - VersionConversions(); - LoadModules(); - return 0; -} - -static int OnPreShutdown(WPARAM, LPARAM) -{ - RecvSMSWindowDestroy(); - SendSMSWindowDestroy(); - FreeAccountList(); - return 0; -} - -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID) -{ - switch(dwReason) { - case DLL_PROCESS_ATTACH: - memset(&ssSMSSettings, 0, sizeof(ssSMSSettings)); - ssSMSSettings.hInstance = hInstance; - ssSMSSettings.hHeap = HeapCreate(0, 0, 0); - DisableThreadLibraryCalls((HMODULE)hInstance); - break; - - case DLL_PROCESS_DETACH: - HeapDestroy(ssSMSSettings.hHeap); - ssSMSSettings.hHeap = nullptr; - - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - break; - } - - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////////////////// - -int CMPlugin::Load() -{ - HookEvent(ME_CLIST_PREBUILDCONTACTMENU, SmsRebuildContactMenu); - HookEvent(ME_DB_EVENT_ADDED, handleNewMessage); - HookEvent(ME_OPT_INITIALISE, OptInitialise); - HookEvent(ME_PROTO_ACK, handleAckSMS); - HookEvent(ME_PROTO_ACCLISTCHANGED, RefreshAccountList); - HookEvent(ME_SYSTEM_MODULESLOADED,OnModulesLoaded); - HookEvent(ME_SYSTEM_PRESHUTDOWN,OnPreShutdown); - - SendSMSWindowInitialize(); - RecvSMSWindowInitialize(); - - LoadServices(); - return 0; -} diff --git a/plugins/SMS/src/options.cpp b/plugins/SMS/src/options.cpp deleted file mode 100644 index cc47652bf5..0000000000 --- a/plugins/SMS/src/options.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* -Miranda-IM SMS Plugin -Copyright (C) 2001-2002 Richard Hughes -Copyright (C) 2007-18 Rozhuk Ivan - -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 was the original words. -This plugin was modified by Ariel Shulman (NuKe007). -For any comments, problems, etc. contact me at Miranda-IM forums or E-Mail or ICQ. -All the information needed you can find at www.nuke007.tk -Enjoy the code and use it smartly! -*/ - -#include "stdafx.h" - -WORD wSMSSignControlsList[] = { IDC_BEGIN, IDC_END, IDC_SIGNATURE, IDC_SIGNGROUP }; - -INT_PTR CALLBACK DlgProcEditorOptions(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - wchar_t tszSign[1024]; - - switch(msg){ - case WM_INITDIALOG: - TranslateDialogDefault(hWndDlg); - - if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,_countof(tszSign),nullptr)==FALSE) - mir_snwprintf(tszSign, TranslateT("From %s:\r\n\r\n"), Clist_GetContactDisplayName(0)); - - SetDlgItemText(hWndDlg,IDC_SIGNATURE,tszSign); - { - BOOL bUseSign = DB_SMS_GetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE); - CheckDlgButton(hWndDlg, IDC_USESIGNATURE, bUseSign ? BST_CHECKED : BST_UNCHECKED); - EnableControlsArray(hWndDlg,(WORD*)&wSMSSignControlsList,_countof(wSMSSignControlsList),bUseSign); - - BOOL bSignBebefore=DB_SMS_GetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS); - CheckDlgButton(hWndDlg, IDC_BEGIN, bSignBebefore ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hWndDlg, IDC_END, (!bSignBebefore) ? BST_CHECKED : BST_UNCHECKED); - } - - CheckDlgButton(hWndDlg, IDC_SHOWACK, DB_SMS_GetByte(NULL, "ShowACK", SMS_DEFAULT_SHOWACK) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hWndDlg, IDC_AUTOPOP, DB_SMS_GetByte(NULL, "AutoPopup", SMS_DEFAULT_AUTOPOP) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hWndDlg, IDC_SAVEWINPOS, DB_SMS_GetByte(NULL, "SavePerContact", SMS_DEFAULT_SAVEWINPOS) ? BST_CHECKED : BST_UNCHECKED); - return TRUE; - - case WM_COMMAND: - SendMessage(GetParent(hWndDlg),PSM_CHANGED,0,0); - switch(LOWORD(wParam)){ - case IDC_USESIGNATURE: - EnableControlsArray(hWndDlg,(WORD*)&wSMSSignControlsList,_countof(wSMSSignControlsList),IsDlgButtonChecked(hWndDlg,IDC_USESIGNATURE)); - break; - } - break; - - case WM_NOTIFY: - switch(((LPNMHDR)lParam)->idFrom){ - case 0: - switch (((LPNMHDR)lParam)->code){ - case PSN_APPLY: - GetDlgItemText(hWndDlg,IDC_SIGNATURE,tszSign,_countof(tszSign)); - DB_SMS_SetStringW(NULL,"Signature",tszSign); - - DB_SMS_SetByte(NULL,"UseSignature",IsDlgButtonChecked(hWndDlg,IDC_USESIGNATURE)); - DB_SMS_SetByte(NULL,"SignaturePos",IsDlgButtonChecked(hWndDlg,IDC_BEGIN)); - DB_SMS_SetByte(NULL,"ShowACK",IsDlgButtonChecked(hWndDlg,IDC_SHOWACK)); - DB_SMS_SetByte(NULL,"AutoPopup",IsDlgButtonChecked(hWndDlg,IDC_AUTOPOP)); - DB_SMS_SetByte(NULL,"SavePerContact",IsDlgButtonChecked(hWndDlg,IDC_SAVEWINPOS)); - return TRUE; - } - } - break; - } - return FALSE; -} - -int OptInitialise(WPARAM wParam,LPARAM) -{ - OPTIONSDIALOGPAGE odp = {}; - odp.position = 910000000; - odp.szGroup.a = LPGEN("Events"); - odp.flags = ODPF_BOLDGROUPS; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SMSPLUGIN); - odp.szTitle.a = PROTOCOL_DISPLAY_NAME_ORIG; - odp.pfnDlgProc = DlgProcEditorOptions; - g_plugin.addOptions(wParam, &odp); - return 0; -} - diff --git a/plugins/SMS/src/receive.cpp b/plugins/SMS/src/receive.cpp deleted file mode 100644 index e696150a6c..0000000000 --- a/plugins/SMS/src/receive.cpp +++ /dev/null @@ -1,272 +0,0 @@ -/* -Miranda-IM SMS Plugin -Copyright (C) 2001-2 Richard Hughes -Copyright (C) 2007-19 Rozhuk Ivan - -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 was the original words. -This plugin was modified by Ariel Shulman (NuKe007). -For any comments, problems, etc. contact me at Miranda-IM forums or E-Mail or ICQ. -All the information needed you can find at www.nuke007.tk -Enjoy the code and use it smartly! -*/ - -#include "stdafx.h" - -// This function handles the ACK received from that hooked. -int handleAckSMS(WPARAM wParam, LPARAM lParam) -{ - if (!lParam) - return 0; - if (((ACKDATA*)lParam)->type != ICQACKTYPE_SMS) - return 0; - - char szPhone[MAX_PHONE_LEN] = { 0 }; - wchar_t tszPhone[MAX_PHONE_LEN] = { 0 }; - LPSTR lpszXML = (LPSTR)((ACKDATA*)lParam)->lParam, lpszData, lpszPhone; - size_t dwXMLSize = 0, dwDataSize, dwPhoneSize; - ACKDATA *ack = ((ACKDATA*)lParam); - - if (lpszXML) - dwXMLSize = mir_strlen(lpszXML); - - if (GetXMLFieldEx(lpszXML, dwXMLSize, &lpszData, &dwDataSize, "sms_message", "text", NULL)) { - if (GetXMLFieldEx(lpszXML, dwXMLSize, &lpszPhone, &dwPhoneSize, "sms_message", "sender", NULL)) { - LPSTR lpszMessageUTF; - size_t dwBuffLen, dwMessageXMLEncodedSize, dwMessageXMLDecodedSize; - DBEVENTINFO dbei = {}; - - dwBuffLen = (dwDataSize + MAX_PATH); - dbei.pBlob = (LPBYTE)MEMALLOC((dwBuffLen + dwPhoneSize)); - LPWSTR lpwszMessageXMLEncoded = (LPWSTR)MEMALLOC((dwBuffLen*sizeof(WCHAR))); - LPWSTR lpwszMessageXMLDecoded = (LPWSTR)MEMALLOC((dwBuffLen*sizeof(WCHAR))); - if (dbei.pBlob && lpwszMessageXMLEncoded && lpwszMessageXMLDecoded) { - dwMessageXMLEncodedSize = MultiByteToWideChar(CP_UTF8, 0, lpszData, (int)dwDataSize, lpwszMessageXMLEncoded, (int)dwBuffLen); - DecodeXML(lpwszMessageXMLEncoded, dwMessageXMLEncodedSize, lpwszMessageXMLDecoded, dwBuffLen, &dwMessageXMLDecodedSize); - lpszMessageUTF = (LPSTR)lpwszMessageXMLEncoded; - WideCharToMultiByte(CP_UTF8, 0, lpwszMessageXMLDecoded, (int)dwMessageXMLDecodedSize, lpszMessageUTF, (int)dwBuffLen, nullptr, nullptr); - - dwPhoneSize = CopyNumberA(szPhone, lpszPhone, dwPhoneSize); - dwPhoneSize = MultiByteToWideChar(CP_UTF8, 0, szPhone, (int)dwPhoneSize, tszPhone, MAX_PHONE_LEN); - MCONTACT hContact = HContactFromPhone(tszPhone, dwPhoneSize); - - dbei.szModule = GetModuleName(hContact); - dbei.timestamp = time(0); - dbei.flags = DBEF_UTF; - dbei.eventType = ICQEVENTTYPE_SMS; - dbei.cbBlob = (mir_snprintf((LPSTR)dbei.pBlob, ((dwBuffLen + dwPhoneSize)), "SMS From: +%s\r\n%s", szPhone, lpszMessageUTF) + sizeof(DWORD)); - //dbei.pBlob=(LPBYTE)lpszBuff; - (*((DWORD*)(dbei.pBlob + (dbei.cbBlob - sizeof(DWORD))))) = 0; - MEVENT hResult = db_event_add(hContact, &dbei); - if (hContact == NULL) { - if (RecvSMSWindowAdd(NULL, ICQEVENTTYPE_SMS, tszPhone, dwPhoneSize, (LPSTR)dbei.pBlob, dbei.cbBlob)) { - db_event_markRead(hContact, hResult); - Skin_PlaySound("RecvSMSMsg"); - } - } - } - MEMFREE(lpwszMessageXMLDecoded); - MEMFREE(lpwszMessageXMLEncoded); - MEMFREE(dbei.pBlob); - } - } - else - if (GetXMLFieldEx(lpszXML, dwXMLSize, &lpszData, &dwDataSize, "sms_delivery_receipt", "delivered", NULL)) { - if (GetXMLFieldEx(lpszXML, dwXMLSize, &lpszPhone, &dwPhoneSize, "sms_delivery_receipt", "destination", NULL)) { - dwPhoneSize = CopyNumberA(szPhone, lpszPhone, dwPhoneSize); - dwPhoneSize = MultiByteToWideChar(CP_UTF8, 0, szPhone, (int)dwPhoneSize, tszPhone, MAX_PHONE_LEN); - MCONTACT hContact = HContactFromPhone(tszPhone, dwPhoneSize); - - DBEVENTINFO dbei = {}; - dbei.szModule = GetModuleName(hContact); - dbei.timestamp = time(0); - dbei.flags = DBEF_UTF; - dbei.eventType = ICQEVENTTYPE_SMSCONFIRMATION; - if (CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszData, (int)dwDataSize, "yes", 3) == CSTR_EQUAL) { - dbei.cbBlob = (MAX_PHONE_LEN + MAX_PATH); - dbei.pBlob = (PBYTE)MEMALLOC(dbei.cbBlob); - if (dbei.pBlob) dbei.cbBlob = (mir_snprintf((LPSTR)dbei.pBlob, dbei.cbBlob, "SMS Confirmation From: +%s\r\nSMS was sent succesfully", szPhone) + 4); - } - else { - if (GetXMLFieldEx(lpszXML, dwXMLSize, &lpszData, &dwDataSize, "sms_delivery_receipt", "error", "params", "param", NULL) == FALSE) { - lpszData = ""; - dwDataSize = 0; - } - dbei.cbBlob = (int)(MAX_PHONE_LEN + MAX_PATH + dwDataSize); - dbei.pBlob = (PBYTE)MEMALLOC(dbei.cbBlob); - if (dbei.pBlob) { - dbei.cbBlob = mir_snprintf((LPSTR)dbei.pBlob, dbei.cbBlob, "SMS Confirmation From: +%s\r\nSMS was not sent succesfully: ", szPhone); - memcpy((dbei.pBlob + dbei.cbBlob), lpszData, dwDataSize); - dbei.cbBlob += (int)(dwDataSize + sizeof(DWORD)); - (*((DWORD*)(dbei.pBlob + (dbei.cbBlob - sizeof(DWORD))))) = 0; - } - } - - if (dbei.pBlob) { - if (hContact) - db_event_add(hContact, &dbei); - else - RecvSMSWindowAdd(NULL, ICQEVENTTYPE_SMSCONFIRMATION, tszPhone, dwPhoneSize, (LPSTR)dbei.pBlob, dbei.cbBlob); - - MEMFREE(dbei.pBlob); - } - } - } - else - if ((ack->result == ACKRESULT_FAILED) || GetXMLFieldEx(lpszXML, dwXMLSize, &lpszData, &dwDataSize, "sms_response", "deliverable", NULL)) { - HWND hWndDlg = SendSMSWindowHwndByHProcessGet(ack->hProcess); - if (hWndDlg) { - char szNetwork[MAX_PATH]; - - KillTimer(hWndDlg, wParam); - GetXMLFieldExBuff(lpszXML, dwXMLSize, szNetwork, sizeof(szNetwork), nullptr, "sms_response", "network", NULL); - - if (ack->result == ACKRESULT_FAILED || CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszData, (int)dwDataSize, "no", 2) == CSTR_EQUAL) { - char szBuff[1024]; - wchar_t tszErrorMessage[1028]; - LPSTR lpszErrorDescription; - - if (SendSMSWindowMultipleGet(hWndDlg)) { - TVITEM tvi; - tvi.mask = TVIF_TEXT; - tvi.hItem = SendSMSWindowHItemSendGet(hWndDlg); - tvi.pszText = tszPhone; - tvi.cchTextMax = _countof(tszPhone); - TreeView_GetItem(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), &tvi); - } - else GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, _countof(szPhone)); - - if (ack->result == ACKRESULT_FAILED) - lpszErrorDescription = lpszXML; - else { - lpszErrorDescription = szBuff; - GetXMLFieldExBuff(lpszXML, dwXMLSize, szBuff, sizeof(szBuff), nullptr, "sms_response", "error", "params", "param", NULL); - } - - mir_snwprintf(tszErrorMessage, TranslateT("SMS message didn't send by %S to %s because: %S"), szNetwork, tszPhone, lpszErrorDescription); - ShowWindow(hWndDlg, SW_SHOWNORMAL); - EnableWindow(hWndDlg, FALSE); - HWND hwndTimeOut = CreateDialog(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_SENDSMSTIMEDOUT), hWndDlg, SMSTimedOutDlgProc); - SetDlgItemText(hwndTimeOut, IDC_STATUS, tszErrorMessage); - } - else { - SendSMSWindowDBAdd(hWndDlg); - if (SendSMSWindowMultipleGet(hWndDlg)) { - if (SendSMSWindowNextHItemGet(hWndDlg, SendSMSWindowHItemSendGet(hWndDlg))) { - SendSMSWindowAsSentSet(hWndDlg); - SendSMSWindowHItemSendSet(hWndDlg, SendSMSWindowNextHItemGet(hWndDlg, SendSMSWindowHItemSendGet(hWndDlg))); - SendSMSWindowNext(hWndDlg); - } - else SendSMSWindowRemove(hWndDlg); - } - else { - if (CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszData, (int)dwDataSize, "yes", 3) == CSTR_EQUAL || - CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszData, (int)dwDataSize, "smtp", 4) == CSTR_EQUAL) { - char szSource[MAX_PATH], szMessageID[MAX_PATH]; - - if (DB_SMS_GetByte(NULL, "ShowACK", SMS_DEFAULT_SHOWACK)) { - HWND hwndAccepted = CreateDialog(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_SENDSMSACCEPT), hWndDlg, SMSAcceptedDlgProc); - if (CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszData, (int)dwDataSize, "yes", 3) == CSTR_EQUAL) { - GetXMLFieldExBuff(lpszXML, dwXMLSize, szSource, sizeof(szSource), nullptr, "sms_response", "source", NULL); - GetXMLFieldExBuff(lpszXML, dwXMLSize, szMessageID, sizeof(szMessageID), nullptr, "sms_response", "message_id", NULL); - } - else { - SetDlgItemText(hwndAccepted, IDC_ST_SOURCE, TranslateT("From:")); - SetDlgItemText(hwndAccepted, IDC_ST_MESSAGEID, TranslateT("To:")); - GetXMLFieldExBuff(lpszXML, dwXMLSize, szSource, sizeof(szSource), nullptr, "sms_response", "from", NULL); - GetXMLFieldExBuff(lpszXML, dwXMLSize, szMessageID, sizeof(szMessageID), nullptr, "sms_response", "to", NULL); - } - SetDlgItemTextA(hwndAccepted, IDC_NETWORK, szNetwork); - SetDlgItemTextA(hwndAccepted, IDC_SOURCE, szSource); - SetDlgItemTextA(hwndAccepted, IDC_MESSAGEID, szMessageID); - } - else SendSMSWindowRemove(hWndDlg); - } - else SendSMSWindowRemove(hWndDlg); - } - } - } - } - return 0; -} - -//Handles new SMS messages added to the database -int handleNewMessage(WPARAM hContact, LPARAM hDbEvent) -{ - char szServiceFunction[MAX_PATH], *pszServiceFunctionName; - wchar_t szToolTip[MAX_PATH]; - DBEVENTINFO dbei = {}; - - if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == -1) - return 0; - - dbei.pBlob = (PBYTE)MEMALLOC(dbei.cbBlob); - if (!dbei.pBlob) - return 0; - memcpy(szServiceFunction, MODULENAME, PROTOCOL_NAME_SIZE); - pszServiceFunctionName = szServiceFunction + PROTOCOL_NAME_LEN; - - if (db_event_get(hDbEvent, &dbei) == 0) - if ((dbei.flags & DBEF_SENT) == 0) - if (dbei.eventType == ICQEVENTTYPE_SMS) { - if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN) { - Skin_PlaySound("RecvSMSMsg"); - if (DB_SMS_GetByte(NULL, "AutoPopup", 0)) { - if (RecvSMSWindowAdd(hContact, ICQEVENTTYPE_SMS, nullptr, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) - db_event_markRead(hContact, hDbEvent); - } - else { - memcpy(pszServiceFunctionName, SMS_READ, sizeof(SMS_READ)); - mir_snwprintf(szToolTip, TranslateT("SMS Message from %s"), Clist_GetContactDisplayName(hContact)); - - CLISTEVENT cle = {}; - cle.flags = CLEF_UNICODE; - cle.hContact = hContact; - cle.hDbEvent = hDbEvent; - cle.hIcon = Skin_LoadIcon(SKINICON_OTHER_SMS); - cle.pszService = szServiceFunction; - cle.szTooltip.w = szToolTip; - g_clistApi.pfnAddEvent(&cle); - } - } - } - else if (dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION) { - Skin_PlaySound("RecvSMSConfirmation"); - if (DB_SMS_GetByte(NULL, "AutoPopup", 0)) { - if (RecvSMSWindowAdd(hContact, ICQEVENTTYPE_SMSCONFIRMATION, nullptr, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) - db_event_delete(hContact, hDbEvent); - } - else { - UINT iIcon; - if (GetDataFromMessage((LPSTR)dbei.pBlob, dbei.cbBlob, nullptr, nullptr, 0, nullptr, &iIcon)) { - memcpy(pszServiceFunctionName, SMS_READ_ACK, sizeof(SMS_READ_ACK)); - mir_snwprintf(szToolTip, TranslateT("SMS Confirmation from %s"), Clist_GetContactDisplayName(hContact)); - - CLISTEVENT cle = {}; - cle.flags = CLEF_UNICODE; - cle.hContact = hContact; - cle.hDbEvent = hDbEvent; - cle.hIcon = (HICON)LoadImage(ssSMSSettings.hInstance, MAKEINTRESOURCE(iIcon), IMAGE_ICON, 0, 0, LR_SHARED); - cle.pszService = szServiceFunction; - cle.szTooltip.w = szToolTip; - g_clistApi.pfnAddEvent(&cle); - } - } - } - MEMFREE(dbei.pBlob); - return 0; -} diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp deleted file mode 100644 index 9dfa15f10a..0000000000 --- a/plugins/SMS/src/recvdlg.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/* -Miranda-IM SMS Plugin -Copyright (C) 2001-2 Richard Hughes -Copyright (C) 2007-19 Rozhuk Ivan - -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 was the original words. -This plugin was modified by Ariel Shulman (NuKe007). -For any comments, problems, etc. contact me at Miranda-IM forums or E-Mail or ICQ. -All the information needed you can find at www.nuke007.tk -Enjoy the code and use it smartly! -*/ - -#include "stdafx.h" - -//Defnition needed to the SMS window list -typedef struct -{ - LIST_MT_ITEM lmtListMTItem; - HWND hWnd; - HBRUSH hBkgBrush; - MCONTACT hContact; -} RECV_SMS_WINDOW_DATA; - -INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam); -#define GET_WINDOW_DATA(hWndDlg) ((RECV_SMS_WINDOW_DATA*)GetWindowLongPtr(hWndDlg,GWLP_USERDATA)) - -DWORD RecvSMSWindowInitialize() -{ - DWORD dwRetErrorCode; - - dwRetErrorCode = ListMTInitialize(&ssSMSSettings.lmtRecvSMSWindowsListMT, 0); - return(dwRetErrorCode); -} - -//This function destroy all SMS receive windows -void RecvSMSWindowDestroy() -{ - RECV_SMS_WINDOW_DATA *prswdWindowData; - - ListMTLock(&ssSMSSettings.lmtRecvSMSWindowsListMT); - while (ListMTItemGetFirst(&ssSMSSettings.lmtRecvSMSWindowsListMT, nullptr, (LPVOID*)&prswdWindowData) == NO_ERROR) {// цикл - RecvSMSWindowRemove(prswdWindowData->hWnd); - } - ListMTUnLock(&ssSMSSettings.lmtRecvSMSWindowsListMT); - ListMTDestroy(&ssSMSSettings.lmtRecvSMSWindowsListMT); -} - - -INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - RECV_SMS_WINDOW_DATA *prswdWindowData = GET_WINDOW_DATA(hWndDlg); - - switch (message) { - case WM_INITDIALOG: - TranslateDialogDefault(hWndDlg); //Translate intially - bid - - prswdWindowData = (RECV_SMS_WINDOW_DATA*)lParam; - SetWindowLongPtr(hWndDlg, GWLP_USERDATA, (LONG_PTR)lParam); - - mir_subclassWindow(GetDlgItem(hWndDlg, IDC_MESSAGE), MessageSubclassProc); - { - LOGFONT lf; - HFONT hFont = (HFONT)SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0); - if (hFont && hFont != (HFONT)SendDlgItemMessage(hWndDlg, IDOK, WM_GETFONT, 0, 0)) DeleteObject(hFont); - LoadMsgDlgFont(MSGFONTID_YOURMSG, &lf, nullptr); - hFont = CreateFontIndirect(&lf); - SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0)); - - COLORREF colour = db_get_dw(0, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR); - prswdWindowData->hBkgBrush = CreateSolidBrush(colour); - } - - // def pos - if (Utils_RestoreWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? prswdWindowData->hContact : NULL), MODULENAME, "recv")) - SetWindowPos(hWndDlg, nullptr, 200, 200, 400, 350, SWP_NOZORDER); - - InvalidateRect(GetDlgItem(hWndDlg, IDC_MESSAGE), nullptr, FALSE); - break; - - case WM_CTLCOLORSTATIC: - if ((HWND)lParam == GetDlgItem(hWndDlg, IDC_MESSAGE)) { - COLORREF colour; - - LoadMsgDlgFont(MSGFONTID_YOURMSG, nullptr, &colour); - SetTextColor((HDC)wParam, colour); - SetBkColor((HDC)wParam, db_get_dw(0, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR)); - return (INT_PTR)prswdWindowData->hBkgBrush; - } - break; - - case WM_GETMINMAXINFO: - ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 300; - ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = 230; - break; - - case WM_SIZE: - RECT rcWin; - GetWindowRect(hWndDlg, &rcWin); - { - int cx = rcWin.right - rcWin.left - 10; - int cy = rcWin.bottom - rcWin.top - 10; - SetWindowPos(GetDlgItem(hWndDlg, IDC_MESSAGE), nullptr, 0, 0, cx - 14, cy - 112, SWP_NOZORDER | SWP_NOMOVE); - SetWindowPos(GetDlgItem(hWndDlg, IDC_NAME), nullptr, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE); - SetWindowPos(GetDlgItem(hWndDlg, IDC_NUMBER), nullptr, cx - (cx * 35) / 100 - 11, 5, (cx * 35) / 100, 20, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_NUMBER), nullptr, cx - (cx * 35) / 100 - 58, 5, 40, 20, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_READNEXT), nullptr, cx - 87, cy - 60, 80, 25, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDOK), nullptr, cx / 2 - 87, cy - 60, 80, 25, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDCANCEL), nullptr, cx / 2 + 7, cy - 60, 80, 25, SWP_NOZORDER); - } - RedrawWindow(hWndDlg, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDOK: - { - WCHAR wszPhone[MAX_PHONE_LEN]; - MCONTACT hContact = HContactFromPhone(wszPhone, GetDlgItemText(hWndDlg, IDC_NUMBER, wszPhone, _countof(wszPhone))); - HWND hwndSendSms = SendSMSWindowIsOtherInstanceHContact(hContact); - if (hwndSendSms) - SetFocus(hwndSendSms); - else { - hwndSendSms = SendSMSWindowAdd(prswdWindowData->hContact); - SetDlgItemText(hwndSendSms, IDC_ADDRESS, wszPhone); - } - } // fallthrough - case IDCANCEL: - RecvSMSWindowRemove(hWndDlg); - break; - } - break; - - case WM_CLOSE: - DeleteObject(prswdWindowData->hBkgBrush); - RecvSMSWindowRemove(hWndDlg); - break; - } - - return FALSE; -} - -//SMS Receive window list functions - -//This function create a new SMS receive window, and insert it to the list. -//The function gets void and return the window HWND -HWND RecvSMSWindowAdd(MCONTACT hContact, DWORD dwEventType, LPWSTR lpwszPhone, size_t dwPhoneSize, LPSTR lpszMessage, size_t dwMessageSize) -{ - HWND hRet = nullptr; - - if ((dwPhoneSize + dwMessageSize) <= MIN_SMS_DBEVENT_LEN) - return nullptr; - - LPWSTR lpwszMessage; - lpwszMessage = (LPWSTR)MEMALLOC(((dwMessageSize + MAX_PATH) * sizeof(WCHAR))); - if (!lpwszMessage) - return nullptr; - - RECV_SMS_WINDOW_DATA *prswdWindowData; - - prswdWindowData = (RECV_SMS_WINDOW_DATA*)MEMALLOC(sizeof(RECV_SMS_WINDOW_DATA)); - if (prswdWindowData) { - prswdWindowData->hContact = hContact; - prswdWindowData->hWnd = CreateDialogParam(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_RECVSMS), nullptr, RecvSmsDlgProc, (LPARAM)prswdWindowData); - if (prswdWindowData->hWnd) { - HICON hIcon; - WCHAR wszTitle[MAX_PATH] = { 0 }, wszPhoneLocal[MAX_PHONE_LEN] = { 0 }; - UINT iIcon; - LPWSTR lpwszContactDisplayName, lpwszTitlepart; - - ListMTLock(&ssSMSSettings.lmtRecvSMSWindowsListMT); - ListMTItemAdd(&ssSMSSettings.lmtRecvSMSWindowsListMT, &prswdWindowData->lmtListMTItem, prswdWindowData); - ListMTUnLock(&ssSMSSettings.lmtRecvSMSWindowsListMT); - - switch (dwEventType) { - case ICQEVENTTYPE_SMS: - lpwszTitlepart = TranslateT("Received SMS"); - hIcon = Skin_LoadIcon(SKINICON_OTHER_SMS); - break; - case ICQEVENTTYPE_SMSCONFIRMATION: - lpwszTitlepart = TranslateT("Received SMS Confirmation"); - GetDataFromMessage(lpszMessage, dwMessageSize, nullptr, nullptr, 0, nullptr, &iIcon); - hIcon = (HICON)LoadImage(ssSMSSettings.hInstance, MAKEINTRESOURCE(iIcon), IMAGE_ICON, 0, 0, LR_SHARED); - break; - default: - lpwszTitlepart = L"Unknown event type"; - hIcon = nullptr; - } - - wszPhoneLocal[0] = '+'; - if (dwPhoneSize) - dwPhoneSize = CopyNumberW((wszPhoneLocal + 1), lpwszPhone, dwPhoneSize); - else { - GetDataFromMessage(lpszMessage, dwMessageSize, nullptr, (wszPhoneLocal + 1), (_countof(wszPhoneLocal) - 1), &dwPhoneSize, nullptr); - dwPhoneSize++; - } - - lpwszContactDisplayName = Clist_GetContactDisplayName(hContact); - mir_snwprintf(wszTitle, L"%s - %s", lpwszContactDisplayName, lpwszTitlepart); - MultiByteToWideChar(CP_UTF8, 0, lpszMessage, (int)dwMessageSize, lpwszMessage, (int)dwMessageSize + MAX_PATH); - - SetWindowText(prswdWindowData->hWnd, wszTitle); - SetDlgItemText(prswdWindowData->hWnd, IDC_NAME, lpwszContactDisplayName); - SetDlgItemText(prswdWindowData->hWnd, IDC_NUMBER, wszPhoneLocal); - SetDlgItemText(prswdWindowData->hWnd, IDC_MESSAGE, lpwszMessage); - SendMessage(prswdWindowData->hWnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon); - - SetFocus(GetDlgItem(prswdWindowData->hWnd, IDC_MESSAGE)); - hRet = prswdWindowData->hWnd; - } - else MEMFREE(prswdWindowData); - } - MEMFREE(lpwszMessage); - return(hRet); -} - -//This function close the SMS receive window that given, and remove it from the list. -//The function gets the HWND of the window that should be removed and return void -void RecvSMSWindowRemove(HWND hWndDlg) -{ - RECV_SMS_WINDOW_DATA *prswdWindowData = GET_WINDOW_DATA(hWndDlg); - - if (prswdWindowData) { - Utils_SaveWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? prswdWindowData->hContact : NULL), MODULENAME, "recv"); - - ListMTLock(&ssSMSSettings.lmtRecvSMSWindowsListMT); - ListMTItemDelete(&ssSMSSettings.lmtRecvSMSWindowsListMT, &prswdWindowData->lmtListMTItem); - ListMTUnLock(&ssSMSSettings.lmtRecvSMSWindowsListMT); - MEMFREE(prswdWindowData); - } - DestroyWindow(hWndDlg); -} diff --git a/plugins/SMS/src/recvdlg.h b/plugins/SMS/src/recvdlg.h deleted file mode 100644 index 26fb6bb47a..0000000000 --- a/plugins/SMS/src/recvdlg.h +++ /dev/null @@ -1,11 +0,0 @@ -#if !defined(AFX_SMS_RECVDLG_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_) -#define AFX_SMS_RECVDLG_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_ - -DWORD RecvSMSWindowInitialize (); -void RecvSMSWindowDestroy (); -HWND RecvSMSWindowAdd (MCONTACT hContact,DWORD dwEventType,LPWSTR lpwszPhone,size_t dwPhoneSize,LPSTR lpszMessage,size_t dwMessageSize); -void RecvSMSWindowRemove (HWND hWndDlg); - - - -#endif // !defined(AFX_SMS_RECVDLG_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_) diff --git a/plugins/SMS/src/resource.h b/plugins/SMS/src/resource.h deleted file mode 100644 index 3a7e98455d..0000000000 --- a/plugins/SMS/src/resource.h +++ /dev/null @@ -1,70 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by resource.rc -// -#define IDD_SENDSMS 102 -#define IDR_CONTEXT 104 -#define IDD_RECVSMS 109 -#define IDI_SMSNOTSENT 110 -#define IDI_SMSSENT 111 -#define IDD_SMSTIMEDOUT 112 -#define IDD_SENDSMSTIMEDOUT 113 -#define IDI_HALFTICK 119 -#define IDD_SENDSMSACCEPT 120 -#define IDD_OPT_SMSPLUGIN 234 -#define IDC_ADDRESS 1000 -#define IDC_EDIT 1001 -#define IDC_ADDRESS2 1001 -#define IDC_ACCOUNTS 1001 -#define IDC_MESSAGE 1002 -#define IDC_STATUS 1003 -#define IDC_NUMBER 1004 -#define IDC_NAME 1005 -#define IDC_ADD 1006 -#define IDC_DELETE 1008 -#define IDC_SIGNATURE 1008 -#define IDC_LIST 1009 -#define IDC_COUNT 1010 -#define IDC_TEXT 1011 -#define IDC_MSGTYPE 1012 -#define IDC_MSGTIME 1013 -#define IDC_BEGIN 1017 -#define IDC_END 1018 -#define IDC_SAVENUMBER 1020 -#define IDC_MULTIPLE 1025 -#define IDC_ADDNUMBER 1029 -#define IDC_ST_CHARS 1033 -#define IDC_ST_ENTERMESSAGE 1034 -#define IDC_ST_TO 1035 -#define IDC_ST_ADDRESS 1036 -#define IDC_ST_NUMBER 1037 -#define IDC_NUMBERSLIST 1038 -#define IDC_MESSAGEID 1039 -#define IDC_SOURCE 1040 -#define IDC_NETWORK 1041 -#define IDC_SHOWACK 1044 -#define IDC_NOSHOWACK 1045 -#define IDC_AUTOPOP 1045 -#define IDC_READNEXT 1046 -#define IDC_SAVEWINPOS 1046 -#define IDC_USESIGNATURE 1047 -#define IDC_SIGNGROUP 1048 -#define IDC_ST_MESSAGEID 1049 -#define IDC_ST_NETWORK 1050 -#define IDC_ST_SOURCE 1051 -#define IDC_HISTORY 1080 -#define IDM_VIEWMSG 40001 -#define IDM_VIEWACK 40002 -#define IDM_VIEWRCPT 40003 -#define IDC_STATIC -1 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 121 -#define _APS_NEXT_COMMAND_VALUE 40004 -#define _APS_NEXT_CONTROL_VALUE 1053 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/plugins/SMS/src/send.cpp b/plugins/SMS/src/send.cpp deleted file mode 100644 index e563d6cf52..0000000000 --- a/plugins/SMS/src/send.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* -Miranda-IM SMS Plugin -Copyright (C) 2001-2 Richard Hughes -Copyright (C) 2007-19 Rozhuk Ivan - -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 was the original words. -This plugin was modified by Ariel Shulman (NuKe007). -For any comments, problems, etc. contact me at Miranda-IM forums or E-Mail or ICQ. -All the information needed you can find at www.nuke007.tk -Enjoy the code and use it smartly! -*/ - -#include "stdafx.h" - -//This function gets HWND of the window, the number, and the message. -void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwPhoneSize,LPWSTR lpwszMessage,size_t dwMessageSize) -{ - if ( !ssSMSSettings.ppaSMSAccounts || dwModuleIndex == -1 || dwModuleIndex >= ssSMSSettings.dwSMSAccountsCount) - return; - - LPSTR lpszMessageUTF; - LPWSTR lpwszMessageXMLEncoded; - size_t dwMessageUTFBuffSize, dwMessageXMLEncodedSize, dwBuffSize; - DBEVENTINFO *pdbei; - - dwMessageXMLEncodedSize = ((dwMessageSize + MAX_PATH) * sizeof(WCHAR) * 6); - lpwszMessageXMLEncoded = (LPWSTR)MEMALLOC(dwMessageXMLEncodedSize); - if ( !lpwszMessageXMLEncoded) - return; - - EncodeXML(lpwszMessage, dwMessageSize, lpwszMessageXMLEncoded, (dwMessageXMLEncodedSize / sizeof(WCHAR)), &dwMessageXMLEncodedSize); - - dwMessageUTFBuffSize = (dwMessageXMLEncodedSize + MAX_PATH); - lpszMessageUTF = (LPSTR)MEMALLOC(dwMessageUTFBuffSize); - if (lpszMessageUTF) - { - dwBuffSize = (dwPhoneSize + MAX_PATH+WideCharToMultiByte(CP_UTF8, 0, lpwszMessage, (int)dwMessageSize, lpszMessageUTF, (int)dwMessageUTFBuffSize, nullptr, nullptr)); - pdbei = (DBEVENTINFO*)MEMALLOC((sizeof(DBEVENTINFO) + dwBuffSize)); - if (pdbei) - { - char szPhone[MAX_PHONE_LEN]; - LPSTR lpszBuff = (LPSTR)(pdbei + 1); - HANDLE hProcess; - - WideCharToMultiByte(CP_UTF8, 0, lpwszPhone, (int)dwPhoneSize, szPhone, MAX_PHONE_LEN, nullptr, nullptr); - dwPhoneSize=CopyNumberA(szPhone, szPhone, dwPhoneSize); - - pdbei->timestamp = time(0); - pdbei->flags = (DBEF_SENT | DBEF_UTF); - pdbei->eventType = ICQEVENTTYPE_SMS; - pdbei->cbBlob = (mir_snprintf(lpszBuff, dwBuffSize, "SMS To: +%s\r\n%s", szPhone, lpszMessageUTF) + 4); - pdbei->pBlob = (PBYTE)lpszBuff; - SendSMSWindowDbeiSet(hWndDlg, pdbei); - - char *szProto = ssSMSSettings.ppaSMSAccounts[dwModuleIndex]->szModuleName; - if (ProtoServiceExists(szProto, MS_ICQ_SENDSMS)) { - WideCharToMultiByte(CP_UTF8, 0, lpwszMessageXMLEncoded, (int)dwMessageXMLEncodedSize, lpszMessageUTF, (int)dwMessageUTFBuffSize, nullptr, nullptr); - hProcess = (HANDLE)CallProtoService(szProto, MS_ICQ_SENDSMS, (WPARAM)szPhone, (LPARAM)lpszMessageUTF); - SendSMSWindowHProcessSet(hWndDlg, hProcess); - } - else MEMFREE(pdbei); - } - MEMFREE(lpszMessageUTF); - } - MEMFREE(lpwszMessageXMLEncoded); -} - diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp deleted file mode 100644 index 01b37171e8..0000000000 --- a/plugins/SMS/src/senddlg.cpp +++ /dev/null @@ -1,1084 +0,0 @@ -/* -Miranda-IM SMS Plugin -Copyright (C) 2001-2 Richard Hughes -Copyright (C) 2007-19 Rozhuk Ivan - -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 was the original words. -This plugin was modified by Ariel Shulman (NuKe007). -For any comments, problems, etc. contact me at Miranda-IM forums or E-Mail or ICQ. -All the information needed you can find at www.nuke007.tk -Enjoy the code and use it smartly! -*/ - -#include "stdafx.h" - -#define TIMERID_MSGSEND 0 -#define TIMEDOUT_CANCEL 0 -#define TIMEDOUT_RETRY 1 -#define DM_TIMEOUTDECIDED (WM_USER+18) - - -//Defnition needed to the SMS window list -typedef struct -{ - LIST_MT_ITEM lmtListMTItem; - HWND hWnd; - HBRUSH hBkgBrush; - HANDLE hProcess; - MCONTACT hContact; - MCONTACT hMyContact; - HTREEITEM hItemSend; - BOOL bMultiple; - size_t dwContactsListCount; - MCONTACT *phContactsList; - DBEVENTINFO *pdbei; -} SEND_SMS_WINDOW_DATA; - -void AddContactPhonesToCombo(HWND hWnd, MCONTACT hContact); -void SendSMSWindowFillTreeView(HWND hWnd); -size_t GetSMSMessageLenMax(HWND hWndDlg); - -#define GET_WINDOW_DATA(hWndDlg) ((SEND_SMS_WINDOW_DATA*)GetWindowLongPtr(hWndDlg,GWLP_USERDATA)) - -DWORD SendSMSWindowInitialize() -{ - return ListMTInitialize(&ssSMSSettings.lmtSendSMSWindowsListMT, 0); -} - -void SendSMSWindowDestroy() -{ - SEND_SMS_WINDOW_DATA *psswdWindowData; - - ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT); - while (ListMTItemGetFirst(&ssSMSSettings.lmtSendSMSWindowsListMT, nullptr, (LPVOID*)&psswdWindowData) == NO_ERROR) - SendSMSWindowRemove(psswdWindowData->hWnd); - - ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT); - ListMTDestroy(&ssSMSSettings.lmtSendSMSWindowsListMT); -} - -INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg); - - switch (message) { - case WM_INITDIALOG: - TranslateDialogDefault(hWndDlg); //Translate intially - bid - ////////AddWinHandle(GetDlgItem(hWndDlg,IDC_MESSAGE)); - - psswdWindowData = (SEND_SMS_WINDOW_DATA*)lParam; - SetWindowLongPtr(hWndDlg, GWLP_USERDATA, (LONG_PTR)lParam); - - mir_subclassWindow(GetDlgItem(hWndDlg, IDC_MESSAGE), MessageSubclassProc); - - Window_SetSkinIcon_IcoLib(hWndDlg, SKINICON_OTHER_SMS); - SendDlgItemMessage(hWndDlg, IDC_HISTORY, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_HISTORY)); - { - HICON hIcon; - HIMAGELIST hIml = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 30); - TreeView_SetImageList(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), hIml, TVSIL_NORMAL); - hIcon = Skin_LoadIcon(SKINICON_OTHER_NOTICK); - ImageList_AddIcon(hIml, hIcon); - hIcon = Skin_LoadIcon(SKINICON_OTHER_TICK); - ImageList_AddIcon(hIml, hIcon); - hIcon = (HICON)LoadImage(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDI_HALFTICK), IMAGE_ICON, 0, 0, LR_SHARED); - ImageList_AddIcon(hIml, hIcon); - } - { - LOGFONT lf; - HFONT hFont = (HFONT)SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0); - if (hFont && hFont != (HFONT)SendDlgItemMessage(hWndDlg, IDOK, WM_GETFONT, 0, 0)) DeleteObject(hFont); - LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, nullptr); - hFont = CreateFontIndirect(&lf); - SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0)); - - COLORREF colour = db_get_dw(0, SRMMMOD, SRMSGSET_INPBKGCOLOUR, SRMSGDEFSET_BKGCOLOUR); - psswdWindowData->hBkgBrush = CreateSolidBrush(colour); - } - { - HWND hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, TEXT(""), WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, GetModuleHandle(nullptr), nullptr); - TOOLINFO ti; - memset(&ti, 0, sizeof(ti)); - ti.cbSize = sizeof(ti); - ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; - ti.uId = (UINT_PTR)GetDlgItem(hWndDlg, IDC_HISTORY); - ti.lpszText = TranslateT("View User's History"); - SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM)&ti); - ti.uId = (UINT_PTR)GetDlgItem(hWndDlg, IDC_ADDNUMBER); - ti.lpszText = TranslateT("Add Number To The Multiple List"); - SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM)&ti); - ti.uId = (UINT_PTR)GetDlgItem(hWndDlg, IDC_SAVENUMBER); - ti.lpszText = TranslateT("Save Number To The User's Details Phonebook"); - SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM)&ti); - ti.uId = (UINT_PTR)GetDlgItem(hWndDlg, IDC_MULTIPLE); - ti.lpszText = TranslateT("Show/Hide Multiple List"); - SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM)&ti); - ti.uId = (UINT_PTR)GetDlgItem(hWndDlg, IDC_COUNT); - ti.lpszText = TranslateT("Shows How Much Chars You've Typed"); - SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM)&ti); - } - { - RECT rcWin, rcList; - GetWindowRect(hWndDlg, &rcWin); - GetWindowRect(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), &rcList); - SetWindowPos(hWndDlg, nullptr, rcWin.left, rcWin.top, rcWin.right - rcWin.left - (rcList.right - rcList.left) - 10, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); - } - - SendSMSWindowUpdateAccountList(hWndDlg); - - { - wchar_t tszSign[1024]; - size_t dwSignLen = 0; - - if (DB_SMS_GetByte(NULL, "UseSignature", SMS_DEFAULT_USESIGNATURE)) - if (DB_SMS_GetStaticStringW(NULL, "Signature", tszSign, _countof(tszSign), &dwSignLen)) { - SetDlgItemText(hWndDlg, IDC_MESSAGE, tszSign); - - if (DB_SMS_GetByte(NULL, "SignaturePos", SMS_DEFAULT_SIGNATUREPOS)) - SendDlgItemMessage(hWndDlg, IDC_MESSAGE, EM_SETSEL, dwSignLen, dwSignLen); - EnableWindow(GetDlgItem(hWndDlg, IDOK), dwSignLen != 0); - } - - mir_snwprintf(tszSign, L"%d/%d", dwSignLen, GetSMSMessageLenMax(hWndDlg)); - SetDlgItemText(hWndDlg, IDC_COUNT, tszSign); - } - - if (Utils_RestoreWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? psswdWindowData->hMyContact : NULL), MODULENAME, "send")) {// def pos - SetWindowPos(hWndDlg, nullptr, 200, 200, 400, 350, SWP_NOZORDER); - } - InvalidateRect(GetDlgItem(hWndDlg, IDC_MESSAGE), nullptr, FALSE); - return TRUE; - case WM_GETMINMAXINFO: - if (psswdWindowData->bMultiple) { - ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 461; - ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = 230; - } - else { - ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 300; - ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = 230; - } - break; - case WM_SIZE: - { - int cx, cy; - RECT rcWin; - GetWindowRect(hWndDlg, &rcWin); - if (psswdWindowData->bMultiple) { - cx = rcWin.right - rcWin.left - 181; - cy = rcWin.bottom - rcWin.top; - } - else { - cx = rcWin.right - rcWin.left; - cy = rcWin.bottom - rcWin.top; - } - cx -= 10; /* XXX: fix window sizes for aero. */ - cy -= 10; - SetWindowPos(GetDlgItem(hWndDlg, IDC_MESSAGE), nullptr, 0, 0, cx - 14, cy - 132, SWP_NOZORDER | SWP_NOMOVE); - SetWindowPos(GetDlgItem(hWndDlg, IDC_NAME), nullptr, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE); - SetWindowPos(GetDlgItem(hWndDlg, IDC_ACCOUNTS), nullptr, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE); - SetWindowPos(GetDlgItem(hWndDlg, IDC_ADDRESS), nullptr, cx - (cx * 35) / 100 - 11, 5, (cx * 35) / 100, 20, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_ADDRESS), nullptr, cx - (cx * 35) / 100 - 68, 5, 50, 20, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_MULTIPLE), nullptr, cx - ((cx * 35) / 100 + 35) / 2 - 11, 30, ((cx * 35) / 100 + 35) / 2, 20, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_SAVENUMBER), nullptr, cx - (cx * 35) / 100 - 58, 30, ((cx * 35) / 100 + 35) / 2, 20, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_HISTORY), nullptr, 0, 0, 20, 20, SWP_NOZORDER | SWP_NOMOVE); - SetWindowPos(GetDlgItem(hWndDlg, IDC_COUNT), nullptr, cx - 61, 52, 50, 15, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_CHARS), nullptr, cx - 106, 52, 40, 15, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_ADDNUMBER), nullptr, cx, 5, 170, 20, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), nullptr, cx, 25, 170, cy - 90, SWP_NOZORDER); - //SetWindowPos(GetDlgItem(hWndDlg,IDC_REMOVENUMBER),0,cx,cy - 110 + 25,170,20,SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDOK), nullptr, cx / 2 - 87, cy - 60, 80, 25, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDCANCEL), nullptr, cx / 2 + 7, cy - 60, 80, 25, SWP_NOZORDER); - RedrawWindow(hWndDlg, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE); - } - break; - case WM_TIMER: - if (wParam == TIMERID_MSGSEND) { - HWND hwndTimeOut; - wchar_t tszMessage[1028], tszPhone[MAX_PHONE_LEN]; - - if (psswdWindowData->bMultiple) { - TVITEM tvi; - tvi.mask = TVIF_TEXT; - tvi.hItem = SendSMSWindowHItemSendGet(hWndDlg); - tvi.pszText = tszPhone; - tvi.cchTextMax = _countof(tszPhone); - TreeView_GetItem(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), &tvi); - } - else { - GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, _countof(tszPhone)); - } - mir_snwprintf(tszMessage, TranslateT("The SMS message send to %s timed out."), tszPhone); - KillTimer(hWndDlg, wParam); - ShowWindow(hWndDlg, SW_SHOWNORMAL); - EnableWindow(hWndDlg, FALSE); - hwndTimeOut = CreateDialog(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_SENDSMSTIMEDOUT), hWndDlg, SMSTimedOutDlgProc); - SetDlgItemText(hwndTimeOut, IDC_STATUS, tszMessage); - } - break; - case WM_CTLCOLOREDIT: - if ((HWND)lParam == GetDlgItem(hWndDlg, IDC_MESSAGE)) { - COLORREF colour; - - LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, nullptr, &colour); - SetTextColor((HDC)wParam, colour); - SetBkColor((HDC)wParam, db_get_dw(0, SRMMMOD, SRMSGSET_INPBKGCOLOUR, SRMSGDEFSET_BKGCOLOUR)); - return((INT_PTR)psswdWindowData->hBkgBrush); - } - break; - case DM_TIMEOUTDECIDED: - EnableWindow(hWndDlg, TRUE); - switch (wParam) { - case TIMEDOUT_CANCEL: - if (psswdWindowData->bMultiple) { - if (SendSMSWindowNextHItemGet(hWndDlg, psswdWindowData->hItemSend)) { - psswdWindowData->hItemSend = SendSMSWindowNextHItemGet(hWndDlg, psswdWindowData->hItemSend); - SendSMSWindowNext(hWndDlg); - } - else { - SendSMSWindowRemove(hWndDlg); - } - } - else { - EnableWindow(GetDlgItem(hWndDlg, IDOK), TRUE); - SendDlgItemMessage(hWndDlg, IDC_MESSAGE, EM_SETREADONLY, FALSE, 0); - EnableWindow(GetDlgItem(hWndDlg, IDC_ACCOUNTS), TRUE); - EnableWindow(GetDlgItem(hWndDlg, IDC_ADDRESS), TRUE); - EnableWindow(GetDlgItem(hWndDlg, IDC_SAVENUMBER), TRUE); - EnableWindow(GetDlgItem(hWndDlg, IDC_MULTIPLE), TRUE); - EnableWindow(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), TRUE); - if (psswdWindowData->hMyContact == NULL) EnableWindow(GetDlgItem(hWndDlg, IDC_NAME), TRUE); - SetFocus(GetDlgItem(hWndDlg, IDC_MESSAGE)); - psswdWindowData->hItemSend = nullptr; - } - break; - case TIMEDOUT_RETRY: - { - wchar_t tszPhone[MAX_PHONE_LEN]; - size_t dwPhoneSize; - - size_t dwMessageSize = GET_DLG_ITEM_TEXT_LENGTH(hWndDlg, IDC_MESSAGE); - LPTSTR lpwszMessage = (LPTSTR)MEMALLOC(((dwMessageSize + 4)*sizeof(wchar_t))); - if (lpwszMessage) { - if (psswdWindowData->bMultiple) { - TVITEM tvi; - tvi.mask = TVIF_TEXT; - tvi.hItem = psswdWindowData->hItemSend; - tvi.pszText = tszPhone; - tvi.cchTextMax = _countof(tszPhone); - TreeView_GetItem(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), &tvi); - dwPhoneSize = mir_wstrlen(tszPhone); - } - else dwPhoneSize = GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, _countof(tszPhone)); - - dwMessageSize = GetDlgItemText(hWndDlg, IDC_MESSAGE, lpwszMessage, (int)dwMessageSize + 2); - SendSMSWindowNumberSet(hWndDlg, tszPhone, dwPhoneSize); - StartSmsSend(hWndDlg, SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_GETCURSEL, 0, 0), tszPhone, dwPhoneSize, lpwszMessage, dwMessageSize); - MEMFREE(lpwszMessage); - } - } - SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, nullptr); - break; - } - break; - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_MULTIPLE: - SendSMSWindowMultipleSet(hWndDlg, !psswdWindowData->bMultiple); - break; - - case IDC_ADDNUMBER: - { - wchar_t tszPhone[MAX_PHONE_LEN]; - if (IsPhoneW(tszPhone, GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, _countof(tszPhone)))) { - TVINSERTSTRUCT tvis = {}; - tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; - tvis.hInsertAfter = TVI_SORT; - tvis.item.pszText = tszPhone; - TreeView_InsertItem(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), &tvis); - } - else MessageBox(hWndDlg, TranslateT("The phone number should start with a + and consist of numbers, spaces, brackets and hyphens only."), TranslateT("Invalid Phone Number"), MB_OK); - } - break; - - case IDC_HISTORY: - CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)psswdWindowData->hMyContact, 0); - break; - - case IDOK: - if ((size_t)GET_DLG_ITEM_TEXT_LENGTH(hWndDlg, IDC_MESSAGE) > GetSMSMessageLenMax(hWndDlg)) { - MessageBox(hWndDlg, TranslateT("Message is too long, press OK to continue."), TranslateT("Error - Message too long"), MB_OK); - } - else { - if (psswdWindowData->bMultiple) { - HTREEITEM hItem = SendSMSWindowNextHItemGet(hWndDlg, TreeView_GetRoot(GetDlgItem(hWndDlg, IDC_NUMBERSLIST))); - if (hItem) { - psswdWindowData->hItemSend = hItem; - EnableWindow(GetDlgItem(hWndDlg, IDOK), FALSE); - EnableWindow(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), FALSE); - EnableWindow(GetDlgItem(hWndDlg, IDC_SAVENUMBER), FALSE); - EnableWindow(GetDlgItem(hWndDlg, IDC_NAME), FALSE); - EnableWindow(GetDlgItem(hWndDlg, IDC_MULTIPLE), FALSE); - EnableWindow(GetDlgItem(hWndDlg, IDC_ADDNUMBER), FALSE); - //EnableWindow(GetDlgItem(hWndDlg,IDC_REMOVENUMBER),FALSE); - SendDlgItemMessage(hWndDlg, IDC_MESSAGE, EM_SETREADONLY, TRUE, 0); - EnableWindow(GetDlgItem(hWndDlg, IDC_ACCOUNTS), FALSE); - EnableWindow(GetDlgItem(hWndDlg, IDC_ADDRESS), FALSE); - SendSMSWindowNext(hWndDlg); - } - else { - MessageBox(hWndDlg, TranslateT("There must be numbers in the list first."), TranslateT("No Numbers"), MB_OK); - } - } - else { - wchar_t tszPhone[MAX_PHONE_LEN]; - size_t dwPhoneSize = GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, _countof(tszPhone)); - if (IsPhoneW(tszPhone, dwPhoneSize)) { - size_t dwMessageSize = GET_DLG_ITEM_TEXT_LENGTH(hWndDlg, IDC_MESSAGE); - LPTSTR lpwszMessage = (LPTSTR)MEMALLOC((dwMessageSize + 4)*sizeof(WCHAR)); - if (lpwszMessage) { - dwMessageSize = GetDlgItemText(hWndDlg, IDC_MESSAGE, lpwszMessage, (int)dwMessageSize + 2); - SendSMSWindowNumberSet(hWndDlg, tszPhone, dwPhoneSize); - EnableWindow(GetDlgItem(hWndDlg, IDOK), FALSE); - EnableWindow(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), FALSE); - EnableWindow(GetDlgItem(hWndDlg, IDC_SAVENUMBER), FALSE); - EnableWindow(GetDlgItem(hWndDlg, IDC_NAME), FALSE); - EnableWindow(GetDlgItem(hWndDlg, IDC_MULTIPLE), FALSE); - EnableWindow(GetDlgItem(hWndDlg, IDC_ACCOUNTS), FALSE); - EnableWindow(GetDlgItem(hWndDlg, IDC_ADDRESS), FALSE); - SendDlgItemMessage(hWndDlg, IDC_MESSAGE, EM_SETREADONLY, TRUE, 0); - StartSmsSend(hWndDlg, SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_GETCURSEL, 0, 0), tszPhone, dwPhoneSize, lpwszMessage, dwMessageSize); - SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, nullptr); - - MEMFREE(lpwszMessage); - } - } - else { - MessageBox(hWndDlg, TranslateT("Valid phone numbers are of the form '+(country code)(phone number)'. The contents of the phone number portion is dependent on the national layout of phone numbers, but often omits the leading zero."), TranslateT("Invalid phone number"), MB_OK); - SetFocus(GetDlgItem(hWndDlg, IDC_ADDRESS)); - SendDlgItemMessage(hWndDlg, IDC_ADDRESS, CB_SETEDITSEL, 0, MAKELPARAM(0, -1)); - } - } - } - break; - case IDCANCEL: - DeleteObject((HFONT)SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0)); - KillTimer(GetParent(hWndDlg), TIMERID_MSGSEND); - SendSMSWindowRemove(hWndDlg); - break; - case IDC_MESSAGE: - if (HIWORD(wParam) == EN_CHANGE) { - wchar_t tszBuff[MAX_PATH]; - size_t dwMessageSize = GET_DLG_ITEM_TEXT_LENGTH(hWndDlg, IDC_MESSAGE); - - EnableWindow(GetDlgItem(hWndDlg, IDOK), dwMessageSize != 0); - mir_snwprintf(tszBuff, L"%d/%d", dwMessageSize, GetSMSMessageLenMax(hWndDlg)); - SetDlgItemText(hWndDlg, IDC_COUNT, tszBuff); - } - break; - case IDC_SAVENUMBER: - { - BOOL bCont = TRUE; - char szBuff[MAX_PATH]; - wchar_t tszPhone[MAX_PHONE_LEN]; - DBVARIANT dbv; - - size_t dwPhoneSize = GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, (_countof(tszPhone) - 4)); - if (IsPhoneW(tszPhone, dwPhoneSize)) { - if (IsContactPhone(psswdWindowData->hMyContact, tszPhone, dwPhoneSize) == FALSE) { - mir_wstrcat(tszPhone, L" SMS"); - for (DWORD i = 0; bCont; i++) { - mir_snprintf(szBuff, "MyPhone%d", i); - if (db_get(psswdWindowData->hMyContact, "UserInfo", szBuff, &dbv)) - bCont = FALSE; - db_free(&dbv); - } - DB_SetStringW(psswdWindowData->hMyContact, "UserInfo", szBuff, tszPhone); - } - } - else { - MessageBox(hWndDlg, TranslateT("The phone number should start with a + and consist of numbers, spaces, brackets and hyphens only."), TranslateT("Invalid Phone Number"), MB_OK); - } - } - break; - case IDC_NAME: - if (HIWORD(wParam) == CBN_SELCHANGE) { - SendDlgItemMessage(hWndDlg, IDC_ADDRESS, CB_RESETCONTENT, 0, 0); - if (SendDlgItemMessage(hWndDlg, IDC_NAME, CB_GETCURSEL, 0, 0)) { - MCONTACT hContact = SendSMSWindowSMSContactGet(hWndDlg, (SendDlgItemMessage(hWndDlg, IDC_NAME, CB_GETCURSEL, 0, 0) - 1)); - if (hContact) AddContactPhonesToCombo(hWndDlg, hContact); - } - } - break; - } - break; - case WM_NOTIFY: - switch (((NMHDR*)lParam)->idFrom) { - case IDC_NUMBERSLIST: - switch (((NMHDR*)lParam)->code) { - case NM_CLICK: - { - int iImage, iSame = 1; - HWND hWndTree = GetDlgItem(hWndDlg, IDC_NUMBERSLIST); - TVITEM tvi = { 0 }; - HTREEITEM hParent; - TVHITTESTINFO hti = { 0 }; - - hti.pt.x = (short)LOWORD(GetMessagePos()); - hti.pt.y = (short)HIWORD(GetMessagePos()); - ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt); - - if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) - if (hti.flags&TVHT_ONITEMICON) { - tvi.mask = (TVIF_IMAGE | TVIF_SELECTEDIMAGE); - tvi.hItem = hti.hItem; - TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); - iImage = tvi.iImage = tvi.iSelectedImage = !tvi.iImage; - TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); - - if (TreeView_GetParent(hWndTree, hti.hItem)) { - hParent = TreeView_GetParent(hWndTree, hti.hItem); - for (tvi.hItem = TreeView_GetChild(hWndTree, hParent); tvi.hItem; tvi.hItem = TreeView_GetNextSibling(hWndTree, tvi.hItem)) { - TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); - if (tvi.iImage != iImage) { - iSame = 0; - break; - } - } - tvi.hItem = hParent; - tvi.iImage = tvi.iSelectedImage = ((iSame == 1) ? iImage : 2); - TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); - } - else { - for (tvi.hItem = TreeView_GetChild(hWndTree, hti.hItem); tvi.hItem; tvi.hItem = TreeView_GetNextSibling(hWndTree, tvi.hItem)) { - TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); - tvi.iImage = tvi.iSelectedImage = iImage; - TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); - } - } - } - } - break; - } - } - break; - case WM_CLOSE: - DeleteObject((HFONT)SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0)); - DeleteObject(psswdWindowData->hBkgBrush); - ////////RemWinHandle(GetDlgItem(hWndDlg,IDC_MESSAGE)); - KillTimer(GetParent(hWndDlg), TIMERID_MSGSEND); - SendSMSWindowRemove(hWndDlg); - break; - } - return FALSE; -} - -INT_PTR CALLBACK SMSTimedOutDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM) -{ - switch (msg) { - case WM_INITDIALOG: - { - RECT rc, rcParent; - TranslateDialogDefault(hWndDlg); - GetWindowRect(hWndDlg, &rc); - GetWindowRect(GetParent(hWndDlg), &rcParent); - SetWindowPos(hWndDlg, nullptr, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE); - KillTimer(GetParent(hWndDlg), TIMERID_MSGSEND); - } - return TRUE; - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDOK: - SendMessage(GetParent(hWndDlg), DM_TIMEOUTDECIDED, TIMEDOUT_RETRY, 0); - DestroyWindow(hWndDlg); - break; - case IDCANCEL: - SendMessage(GetParent(hWndDlg), DM_TIMEOUTDECIDED, TIMEDOUT_CANCEL, 0); - DestroyWindow(hWndDlg); - break; - } - break; - } - return FALSE; -} - -INT_PTR CALLBACK SMSAcceptedDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM) -{ - switch (msg) { - case WM_INITDIALOG: - TranslateDialogDefault(hWndDlg); - { - RECT rc, rcParent; - GetWindowRect(hWndDlg, &rc); - GetWindowRect(GetParent(hWndDlg), &rcParent); - SetWindowPos(hWndDlg, nullptr, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE); - } - return TRUE; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDOK: - SendSMSWindowRemove(GetParent(hWndDlg)); - DestroyWindow(hWndDlg); - break; - } - break; - } - return FALSE; -} - -//SMS Send window list functions - -//This function create a new SMS send window, and insert it to the list. -//The function gets void and return the window HWND -HWND SendSMSWindowAdd(MCONTACT hContact) -{ - HWND hRet = nullptr; - SEND_SMS_WINDOW_DATA *psswdWindowData = (SEND_SMS_WINDOW_DATA*)MEMALLOC(sizeof(SEND_SMS_WINDOW_DATA)); - if (!psswdWindowData) - return nullptr; - psswdWindowData->hMyContact = hContact; - psswdWindowData->hWnd = CreateDialogParam(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_SENDSMS), nullptr, SendSmsDlgProc, (LPARAM)psswdWindowData); - if (psswdWindowData->hWnd) { - ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT); - ListMTItemAdd(&ssSMSSettings.lmtSendSMSWindowsListMT, &psswdWindowData->lmtListMTItem, psswdWindowData); - ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT); - - LPTSTR lptszContactDisplayName = Clist_GetContactDisplayName(hContact); - wchar_t tszTitle[MAX_PATH]; - mir_snwprintf(tszTitle, L"%s - %s", lptszContactDisplayName, TranslateT("Send SMS")); - SetWindowText(psswdWindowData->hWnd, tszTitle); - SendDlgItemMessage(psswdWindowData->hWnd, IDC_NAME, CB_ADDSTRING, 0, (LPARAM)lptszContactDisplayName); - SendDlgItemMessage(psswdWindowData->hWnd, IDC_NAME, CB_SETCURSEL, 0, 0); - AddContactPhonesToCombo(psswdWindowData->hWnd, hContact); - SetFocus(GetDlgItem(psswdWindowData->hWnd, IDC_MESSAGE)); - hRet = psswdWindowData->hWnd; - } - else MEMFREE(psswdWindowData); - return hRet; -} - -//This function close the SMS send window that given, and remove it from the list. -//The function gets the HWND of the window that should be removed and return void -void SendSMSWindowRemove(HWND hWndDlg) -{ - SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg); - - if (psswdWindowData) { - DB_SMS_SetDword(NULL, "LastProto", SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_GETCURSEL, 0, 0)); - SendSMSWindowMultipleSet(hWndDlg, FALSE); - Utils_SaveWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? psswdWindowData->hMyContact : NULL), MODULENAME, "send"); - - ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT); - ListMTItemDelete(&ssSMSSettings.lmtSendSMSWindowsListMT, &psswdWindowData->lmtListMTItem); - ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT); - SendSMSWindowSMSContactsRemove(hWndDlg); - MEMFREE(psswdWindowData->pdbei); - MEMFREE(psswdWindowData); - } - DestroyWindow(hWndDlg); -} - -//This function return the contact HANDLE for the given to the SMS send window. -//The function gets the HWND of the window and return the HANDLE of the contact. -MCONTACT SendSMSWindowHContactGet(HWND hWndDlg) -{ - MCONTACT hRet = NULL; - SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg); - - if (psswdWindowData) hRet = psswdWindowData->hMyContact; - return(hRet); -} - -//This function set the contact info of the person we send him the in the given to the SMS send window. -//The function gets the HWND of the window and the HANDLE of the contact and return void -void SendSMSWindowHContactSet(HWND hWndDlg, MCONTACT hContact) -{ - SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg); - if (psswdWindowData) psswdWindowData->hMyContact = hContact; -} - -//This function return the HWND of a SMS send window that have the same process as given. -//The function gets the HANDLE of a process and return the HWND of the SMS send window that has -//the same process -HWND SendSMSWindowHwndByHProcessGet(HANDLE hProcess) -{ - HWND hRet = nullptr; - SEND_SMS_WINDOW_DATA *psswdWindowData; - LIST_MT_ITERATOR lmtiIterator; - - ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT); - ListMTIteratorMoveFirst(&ssSMSSettings.lmtSendSMSWindowsListMT, &lmtiIterator); - do {// цикл - if (ListMTIteratorGet(&lmtiIterator, nullptr, (LPVOID*)&psswdWindowData) == NO_ERROR) - if (psswdWindowData->hProcess == hProcess) { - hRet = psswdWindowData->hWnd; - break; - } - } while (ListMTIteratorMoveNext(&lmtiIterator)); - ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT); - return(hRet); -} - -//This function set the process info of the send procedure we sent with the given SMS send window. -//The function gets the HWND of the window and the HANDLE of the process and return void -void SendSMSWindowHProcessSet(HWND hWndDlg, HANDLE hProcess) -{ - SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg); - if (psswdWindowData) psswdWindowData->hProcess = hProcess; -} - -// -BOOL SendSMSWindowMultipleGet(HWND hWndDlg) -{ - BOOL bRet = FALSE; - SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg); - - if (psswdWindowData) bRet = psswdWindowData->bMultiple; - return(bRet); -} - -// -void SendSMSWindowMultipleSet(HWND hWndDlg, BOOL bMultiple) -{ - SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg); - - if (!psswdWindowData) - return; - if (psswdWindowData->bMultiple == bMultiple) - return; - - RECT rcWin, rcList; - WINDOWPLACEMENT wp; - - psswdWindowData->bMultiple = bMultiple; - wp.length = sizeof(WINDOWPLACEMENT); - GetWindowRect(hWndDlg, &rcWin); - GetWindowRect(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), &rcList); - GetWindowPlacement(hWndDlg, &wp); - - if (bMultiple) { - SendSMSWindowFillTreeView(hWndDlg); - - EnableWindow(GetDlgItem(hWndDlg, IDC_SAVENUMBER), FALSE); - SetDlgItemText(hWndDlg, IDC_MULTIPLE, TranslateT("<< Single")); - if (wp.showCmd == SW_MAXIMIZE) SetWindowPos(hWndDlg, nullptr, 0, 0, rcWin.right - rcWin.left - (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); - SetWindowPos(hWndDlg, nullptr, rcWin.left, rcWin.top, rcWin.right - rcWin.left + (rcList.right - rcList.left) + 11, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); - } - else { - if (psswdWindowData->hMyContact) AddContactPhonesToCombo(hWndDlg, psswdWindowData->hMyContact); - - EnableWindow(GetDlgItem(hWndDlg, IDC_SAVENUMBER), TRUE); - SetDlgItemText(hWndDlg, IDC_MULTIPLE, TranslateT("Multiple >>")); - SetWindowPos(hWndDlg, nullptr, rcWin.left, rcWin.top, rcWin.right - rcWin.left - (rcList.right - rcList.left) - 11, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); - if (wp.showCmd == SW_MAXIMIZE) SetWindowPos(hWndDlg, nullptr, 0, 0, rcWin.right - rcWin.left + (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); - } -} - -// -void SendSMSWindowNumberSet(HWND hWndDlg, LPWSTR lpwszPhone, size_t dwPhoneSize) -{ - SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg); - - if (psswdWindowData) - if (psswdWindowData->bMultiple) { - psswdWindowData->hContact = psswdWindowData->hMyContact; - } - else { - psswdWindowData->hContact = HContactFromPhone(lpwszPhone, dwPhoneSize); - } -} - -// -void SendSMSWindowAsSentSet(HWND) -{ - // LVITEM lvi; - // char szPhone[MAX_PHONE_LEN]; - // lvi.mask=LVIF_TEXT|LVIF_IMAGE; - // lvi.iItem=GetSendSMSWindowSMSSend(hWndDlg) - 1; - // lvi.iSubItem=0; - // ListView_GetItemText(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),GetSendSMSWindowSMSSend(hWndDlg) - 1,0,szPhone,_countof(szPhone)); - // lvi.pszText=szPhone; - // lvi.iImage=2; - // ListView_SetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&lvi); - // ListView_RedrawItems(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),0,ListView_GetItemCount(GetDlgItem(hWndDlg,IDC_NUMBERSLIST)) - 1); -} - -//This function set the databsae info of the sent message we sent with the SMS send window. -//The function gets the HWND of the window and the DBEI of the database information of the message -//and return void -void SendSMSWindowDbeiSet(HWND hWndDlg, DBEVENTINFO *pdbei) -{ - SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg); - if (psswdWindowData) psswdWindowData->pdbei = pdbei; -} - -//This function get a HWND of SMS send window and add its database information into Miranda-IM database -//The function gets the HWND of the window and return void -//and return void -void SendSMSWindowDBAdd(HWND hWndDlg) -{ - SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg); - if (psswdWindowData) { - psswdWindowData->pdbei->szModule = GetModuleName(psswdWindowData->hContact); - db_event_add(psswdWindowData->hContact, psswdWindowData->pdbei); - MEMFREE(psswdWindowData->pdbei); - } -} - -// -void SendSMSWindowHItemSendSet(HWND hWndDlg, HTREEITEM hItemSend) -{ - SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg); - if (psswdWindowData) - psswdWindowData->hItemSend = hItemSend; -} - -// -HTREEITEM SendSMSWindowHItemSendGet(HWND hWndDlg) -{ - HTREEITEM hRet = nullptr; - SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg); - - if (psswdWindowData) hRet = psswdWindowData->hItemSend; - return hRet; -} - -// -HTREEITEM SendSMSWindowNextHItemGet(HWND hWndDlg, HTREEITEM hItem) -{ - int isFound = 0; - HWND hWndTree = GetDlgItem(hWndDlg, IDC_NUMBERSLIST); - TVITEM tvi; - HTREEITEM hItemNext, hItemChild; - - if (hItem == TreeView_GetRoot(hWndTree)) isFound = 1; - - for (hItemNext = TreeView_GetRoot(hWndTree); hItemNext; hItemNext = TreeView_GetNextSibling(hWndTree, hItemNext)) { - if ((hItem == hItemNext) && (hItem != TreeView_GetRoot(hWndTree))) { - isFound = 1; - continue; - } - - tvi.mask = (TVIF_IMAGE | TVIF_SELECTEDIMAGE); - tvi.hItem = hItemNext; - tvi.iImage = 0; - tvi.iSelectedImage = 0; - TreeView_GetItem(hWndTree, &tvi); - - if (tvi.iImage || tvi.iSelectedImage) - if (TreeView_GetChild(hWndTree, hItemNext)) { - for (hItemChild = TreeView_GetChild(hWndTree, hItemNext); hItemChild; hItemChild = TreeView_GetNextSibling(hWndTree, hItemChild)) { - if (hItem == hItemChild) { - isFound = 1; - continue; - } - - tvi.mask = (TVIF_IMAGE | TVIF_SELECTEDIMAGE); - tvi.hItem = hItemChild; - tvi.iImage = 0; - tvi.iSelectedImage = 0; - TreeView_GetItem(hWndTree, &tvi); - - if (tvi.iImage || tvi.iSelectedImage) - if (isFound) { - return(hItemChild); - } - else { - continue; - } - } - } - else { - if (isFound) { - return(hItemNext); - } - else { - continue; - } - } - } - return(nullptr); -} - -//This function get the HANDLE of an user. if there is already a SMS send window for this contact -//it return its HWND else the function return NULL. -//The function gets the HANDLE of a contact and return HWND -HWND SendSMSWindowIsOtherInstanceHContact(MCONTACT hContact) -{ - HWND hRet = nullptr; - SEND_SMS_WINDOW_DATA *psswdWindowData; - LIST_MT_ITERATOR lmtiIterator; - - ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT); - ListMTIteratorMoveFirst(&ssSMSSettings.lmtSendSMSWindowsListMT, &lmtiIterator); - do {// цикл - if (ListMTIteratorGet(&lmtiIterator, nullptr, (LPVOID*)&psswdWindowData) == NO_ERROR) - if (psswdWindowData->hMyContact == hContact) { - hRet = psswdWindowData->hWnd; - break; - } - } while (ListMTIteratorMoveNext(&lmtiIterator)); - ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT); - return(hRet); -} - - -// -void SendSMSWindowNext(HWND hWndDlg) -{ - wchar_t tszPhone[MAX_PHONE_LEN]; - size_t dwPhoneSize, dwMessageSize; - TVITEM tvi = { 0 }; - - dwMessageSize = GET_DLG_ITEM_TEXT_LENGTH(hWndDlg, IDC_MESSAGE); - LPTSTR lptszMessage = (LPTSTR)MEMALLOC(((dwMessageSize + 4)*sizeof(wchar_t))); - if (!lptszMessage) - return; - - dwMessageSize = GetDlgItemText(hWndDlg, IDC_MESSAGE, lptszMessage, (int)dwMessageSize + 2); - - // if (SendSMSWindowNextHItemGet(hWndDlg,SendSMSWindowHItemSendGet(hWndDlg))==NULL) SendSMSWindowMultipleSet(hWndDlg,FALSE); - tvi.mask = TVIF_TEXT; - tvi.hItem = SendSMSWindowHItemSendGet(hWndDlg); - tvi.pszText = tszPhone; - tvi.cchTextMax = _countof(tszPhone); - TreeView_GetItem(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), &tvi); - TreeView_SelectItem(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), tvi.hItem); - dwPhoneSize = mir_wstrlen(tszPhone); - SendSMSWindowNumberSet(hWndDlg, tszPhone, dwPhoneSize); - StartSmsSend(hWndDlg, SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_GETCURSEL, 0, 0), tszPhone, dwPhoneSize, lptszMessage, dwMessageSize); - SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, nullptr); - MEMFREE(lptszMessage); -} - - -////////////////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////////////////// -//This function gets a HANDLE of a contact and add it to a list. -void SendSMSWindowSMSContactAdd(HWND hWndDlg, MCONTACT hContact) -{ - SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg); - - if (!psswdWindowData) - return; - - psswdWindowData->dwContactsListCount++; - if (psswdWindowData->phContactsList) - psswdWindowData->phContactsList = (MCONTACT*)MEMREALLOC(psswdWindowData->phContactsList, (sizeof(HANDLE)*psswdWindowData->dwContactsListCount)); - else - psswdWindowData->phContactsList = (MCONTACT*)MEMALLOC((sizeof(HANDLE)*psswdWindowData->dwContactsListCount)); - - *(psswdWindowData->phContactsList + psswdWindowData->dwContactsListCount - 1) = hContact; -} - -//This function gets the number of the given contact in the combo list and return its contact. -MCONTACT SendSMSWindowSMSContactGet(HWND hWndDlg, size_t iNum) -{ - SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg); - - if (psswdWindowData) - return (*((psswdWindowData->phContactsList) + iNum)); - - return NULL; -} - -void SendSMSWindowSMSContactsRemove(HWND hWndDlg) -{ - SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg); - - if (psswdWindowData) { - MEMFREE(psswdWindowData->phContactsList); - psswdWindowData->dwContactsListCount = 0; - } -} - -void SendSMSWindowUpdateAccountList(HWND hWndDlg) -{ - if (ssSMSSettings.ppaSMSAccounts && ssSMSSettings.dwSMSAccountsCount) { - size_t i, dwCurSel; - - dwCurSel = SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_GETCURSEL, 0, 0); - if (dwCurSel == -1) dwCurSel = DB_SMS_GetDword(NULL, "LastProto", 0); - if (dwCurSel == -1) dwCurSel = 0; - - SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_RESETCONTENT, 0, 0); - for (i = 0; i < ssSMSSettings.dwSMSAccountsCount; i++) { - SendDlgItemMessageA(hWndDlg, IDC_ACCOUNTS, CB_ADDSTRING, 0, (LPARAM)ssSMSSettings.ppaSMSAccounts[i]->szModuleName); - } - SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_SETCURSEL, (WPARAM)dwCurSel, 0); - } -} - - -void SendSMSWindowsUpdateAllAccountLists() -{ - SEND_SMS_WINDOW_DATA *psswdWindowData; - LIST_MT_ITERATOR lmtiIterator; - - ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT); - ListMTIteratorMoveFirst(&ssSMSSettings.lmtSendSMSWindowsListMT, &lmtiIterator); - do {// цикл - if (ListMTIteratorGet(&lmtiIterator, nullptr, (LPVOID*)&psswdWindowData) == NO_ERROR) { - SendSMSWindowUpdateAccountList(psswdWindowData->hWnd); - } - } while (ListMTIteratorMoveNext(&lmtiIterator)); - ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT); -} -////////////////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////////////////// - - - - -void AddContactPhonesToComboToListParam(MCONTACT hContact, LPSTR lpszModule, LPSTR lpszValueName, HWND hWndList) -{ - char szBuff[MAX_PATH]; - wchar_t tszPhone[MAX_PHONE_LEN], tszPhoneRaw[MAX_PHONE_LEN]; - size_t i, dwPhoneSize; - - if (DB_GetStaticStringW(hContact, lpszModule, lpszValueName, tszPhoneRaw, _countof(tszPhoneRaw), &dwPhoneSize)) { - tszPhone[0] = '+'; - dwPhoneSize = CopyNumberW(tszPhone + 1, tszPhoneRaw, dwPhoneSize); - if (IsPhoneW(tszPhone, dwPhoneSize)) { - if (SendMessage(hWndList, CB_FINDSTRING, -1, (LPARAM)tszPhone) == CB_ERR) SendMessage(hWndList, CB_ADDSTRING, 0, (LPARAM)tszPhone); - } - } - - for (i = 0; TRUE; i++) { - mir_snprintf(szBuff, "%s%ld", lpszValueName, i); - if (DB_GetStaticStringW(hContact, lpszModule, szBuff, tszPhoneRaw, _countof(tszPhoneRaw), &dwPhoneSize)) { - tszPhone[0] = '+'; - dwPhoneSize = CopyNumberW(tszPhone + 1, tszPhoneRaw, dwPhoneSize); - if (IsPhoneW(tszPhone, dwPhoneSize)) { - if (SendMessage(hWndList, CB_FINDSTRING, -1, (LPARAM)tszPhone) == CB_ERR) SendMessage(hWndList, CB_ADDSTRING, 0, (LPARAM)tszPhone); - } - } - else { - if (i > PHONES_MIN_COUNT) break; - } - } -} - - -void AddContactPhonesToCombo(HWND hWnd, MCONTACT hContact) -{ - HWND hWndList = GetDlgItem(hWnd, IDC_ADDRESS); - SendDlgItemMessage(hWnd, IDC_ADDRESS, CB_RESETCONTENT, 0, 0); - - LPSTR lpszProto = GetContactProto(hContact); - if (lpszProto) { - AddContactPhonesToComboToListParam(hContact, lpszProto, "Phone", hWndList); - AddContactPhonesToComboToListParam(hContact, lpszProto, "Cellular", hWndList); - AddContactPhonesToComboToListParam(hContact, lpszProto, "Fax", hWndList); - } - AddContactPhonesToComboToListParam(hContact, "UserInfo", "MyPhone", hWndList); - AddContactPhonesToComboToListParam(hContact, "UserInfo", "Phone", hWndList); - AddContactPhonesToComboToListParam(hContact, "UserInfo", "Cellular", hWndList); - AddContactPhonesToComboToListParam(hContact, "UserInfo", "Fax", hWndList); - - SendDlgItemMessage(hWnd, IDC_ADDRESS, CB_SETCURSEL, 0, 0); -} - - - -void AddContactPhonesToTreeViewParam(MCONTACT hContact, LPSTR lpszModule, LPSTR lpszValueName, HWND hWndList, HTREEITEM *phParent) -{ - char szBuff[MAX_PATH]; - wchar_t tszPhone[MAX_PHONE_LEN], tszPhoneRaw[MAX_PHONE_LEN]; - size_t i, dwPhoneSize; - TVINSERTSTRUCT tvis = {}; - - if (phParent) tvis.hParent = (*phParent); - tvis.item.mask = (TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE); - tvis.hInsertAfter = TVI_SORT; - tvis.item.iImage = tvis.item.iSelectedImage = 0; - - if (DB_GetStaticStringW(hContact, lpszModule, lpszValueName, tszPhoneRaw, _countof(tszPhoneRaw), &dwPhoneSize)) { - tszPhone[0] = '+'; - dwPhoneSize = CopyNumberW(tszPhone + 1, tszPhoneRaw, dwPhoneSize); - if (IsPhoneW(tszPhone, dwPhoneSize)) { - if (tvis.hParent == nullptr) { - tvis.item.pszText = Clist_GetContactDisplayName(hContact); - tvis.hParent = TreeView_InsertItem(hWndList, &tvis); - } - tvis.item.pszText = tszPhone; - TreeView_InsertItem(hWndList, &tvis); - } - } - - for (i = 0; TRUE; i++) { - mir_snprintf(szBuff, "%s%ld", lpszValueName, i); - if (DB_GetStaticStringW(hContact, lpszModule, szBuff, tszPhoneRaw, _countof(tszPhoneRaw), &dwPhoneSize)) { - tszPhone[0] = '+'; - dwPhoneSize = CopyNumberW(tszPhone + 1, tszPhoneRaw, dwPhoneSize); - if (IsPhoneW(tszPhone, dwPhoneSize)) { - if (tvis.hParent == nullptr) { - tvis.item.pszText = Clist_GetContactDisplayName(hContact); - tvis.hParent = TreeView_InsertItem(hWndList, &tvis); - } - tvis.item.pszText = tszPhone; - TreeView_InsertItem(hWndList, &tvis); - } - } - else { - if (i > PHONES_MIN_COUNT) break; - } - } - if (phParent) (*phParent) = tvis.hParent; -} - - -void SendSMSWindowFillTreeView(HWND hWnd) -{ - HWND hWndTreeView = GetDlgItem(hWnd, IDC_NUMBERSLIST); - TreeView_DeleteAllItems(hWndTreeView); - - for (auto &hContact : Contacts()) { - HTREEITEM hParent = nullptr; - LPSTR lpszProto = GetContactProto(hContact); - if (lpszProto) { - AddContactPhonesToTreeViewParam(hContact, lpszProto, "Phone", hWndTreeView, &hParent); - AddContactPhonesToTreeViewParam(hContact, lpszProto, "Cellular", hWndTreeView, &hParent); - AddContactPhonesToTreeViewParam(hContact, lpszProto, "Fax", hWndTreeView, &hParent); - } - AddContactPhonesToTreeViewParam(hContact, "UserInfo", "MyPhone", hWndTreeView, &hParent); - AddContactPhonesToTreeViewParam(hContact, "UserInfo", "Phone", hWndTreeView, &hParent); - AddContactPhonesToTreeViewParam(hContact, "UserInfo", "Cellular", hWndTreeView, &hParent); - AddContactPhonesToTreeViewParam(hContact, "UserInfo", "Fax", hWndTreeView, &hParent); - } -} - - -size_t GetSMSMessageLenMax(HWND hWndDlg) -{ - size_t dwMessageSize, dwLenght = 160; - - dwMessageSize = GET_DLG_ITEM_TEXT_LENGTH(hWndDlg, IDC_MESSAGE); - LPTSTR lptszMessage = (LPTSTR)MEMALLOC(((dwMessageSize + 4)*sizeof(wchar_t))); - if (lptszMessage) { - dwMessageSize = GetDlgItemText(hWndDlg, IDC_MESSAGE, lptszMessage, (int)dwMessageSize + 2); - if (dwMessageSize != WideCharToMultiByte(CP_UTF8, 0, lptszMessage, (int)dwMessageSize, nullptr, 0, nullptr, nullptr)) - dwLenght = 70; - MEMFREE(lptszMessage); - } - return(dwLenght); -} diff --git a/plugins/SMS/src/senddlg.h b/plugins/SMS/src/senddlg.h deleted file mode 100644 index 4a98b9e019..0000000000 --- a/plugins/SMS/src/senddlg.h +++ /dev/null @@ -1,36 +0,0 @@ -#if !defined(AFX_SMS_SENDDLG_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_) -#define AFX_SMS_SENDDLG_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_ - -DWORD SendSMSWindowInitialize(); -void SendSMSWindowDestroy(); - -//Declaration of SMS send window list -INT_PTR CALLBACK SMSAcceptedDlgProc(HWND hWndDlg,UINT msg,WPARAM wParam,LPARAM lParam); -INT_PTR CALLBACK SMSTimedOutDlgProc(HWND hWndDlg,UINT msg,WPARAM wParam,LPARAM lParam); - -HTREEITEM SendSMSWindowHItemSendGet(HWND hWndDlg); -HTREEITEM SendSMSWindowNextHItemGet(HWND hWndDlg,HTREEITEM hItem); - -HWND SendSMSWindowAdd(MCONTACT hContact); -void SendSMSWindowRemove(HWND hWndDlg); -MCONTACT SendSMSWindowHContactGet(HWND hWndDlg); -void SendSMSWindowHContactSet(HWND hWndDlg,MCONTACT hContact); -HWND SendSMSWindowHwndByHProcessGet(HANDLE hProcess); -void SendSMSWindowHProcessSet(HWND hWndDlg,HANDLE hProcess); -BOOL SendSMSWindowMultipleGet(HWND hWndDlg); -void SendSMSWindowMultipleSet(HWND hWndDlg,BOOL bMultiple); -void SendSMSWindowNumberSet(HWND hWndDlg,LPWSTR lpwszPhone,size_t dwPhoneSize); -void SendSMSWindowAsSentSet(HWND hWndDlg); -void SendSMSWindowDbeiSet(HWND hWndDlg,DBEVENTINFO *pdbei); -void SendSMSWindowDBAdd(HWND hWndDlg); -void SendSMSWindowHItemSendSet(HWND hWndDlg,HTREEITEM hItemSend); -HWND SendSMSWindowIsOtherInstanceHContact(MCONTACT hContact); -void SendSMSWindowNext(HWND hWndDlg); - -void SendSMSWindowSMSContactAdd(HWND hWndDlg,MCONTACT hContact); -MCONTACT SendSMSWindowSMSContactGet(HWND hWndDlg,size_t iNum); -void SendSMSWindowSMSContactsRemove(HWND hWndDlg); -void SendSMSWindowUpdateAccountList(HWND hWndDlg); -void SendSMSWindowsUpdateAllAccountLists(); - -#endif // !defined(AFX_SMS_SENDDLG_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_) diff --git a/plugins/SMS/src/stdafx.cxx b/plugins/SMS/src/stdafx.cxx deleted file mode 100644 index d33e44d684..0000000000 --- a/plugins/SMS/src/stdafx.cxx +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright (C) 2012-19 Miranda NG team (https://miranda-ng.org) - -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 . -*/ - -#include "stdafx.h" \ No newline at end of file diff --git a/plugins/SMS/src/stdafx.h b/plugins/SMS/src/stdafx.h deleted file mode 100644 index 87197e6a7b..0000000000 --- a/plugins/SMS/src/stdafx.h +++ /dev/null @@ -1,127 +0,0 @@ -#ifndef _COMMON_H -#define _COMMON_H - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#define VC_EXTRALEAN - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "AdditionalFunctions/InterlockedFunctions.h" -#include "AdditionalFunctions/ListMT.h" -#include "AdditionalFunctions/MemoryCompare.h" -#include "AdditionalFunctions/MemoryFindByte.h" -#include "resource.h" -#include "version.h" -#include "recvdlg.h" -#include "SMSConstans.h" -#include "senddlg.h" - -struct CMPlugin : public PLUGIN -{ - CMPlugin(); - - int Load() override; -}; - -// структура содержащая информацию по построению меню или расширенных иконок -struct GUI_DISPLAY_ITEM -{ - LPSTR lpszName; // имя сервиса, оно же имя в иколибе - LPWSTR lpwszDescr; // текстовое описание отображаемое юзеру - LONG defIcon; // иконка из ресурсов - LPVOID lpFunc; // функция вызываемая меню -}; - -#define MAIN_MENU_ITEMS_COUNT 1 -#define CONTACT_MENU_ITEMS_COUNT 1 - -struct SMS_SETTINGS -{ - HANDLE hHeap; - HINSTANCE hInstance; - - HGENMENU hMainMenuItems[MAIN_MENU_ITEMS_COUNT+1]; - HGENMENU hContactMenuItems[CONTACT_MENU_ITEMS_COUNT+1]; - - LIST_MT lmtSendSMSWindowsListMT; - LIST_MT lmtRecvSMSWindowsListMT; - - PROTOACCOUNT **ppaSMSAccounts; - size_t dwSMSAccountsCount; -}; - -extern SMS_SETTINGS ssSMSSettings; - -#define MEMALLOC(Size) HeapAlloc(ssSMSSettings.hHeap,HEAP_ZERO_MEMORY,(Size+sizeof(size_t))) -#define MEMREALLOC(Mem,Size) HeapReAlloc(ssSMSSettings.hHeap,(HEAP_ZERO_MEMORY),(LPVOID)Mem,(Size+sizeof(size_t))) -#define MEMFREE(Mem) if (Mem) {HeapFree(ssSMSSettings.hHeap,0,(LPVOID)Mem);Mem=NULL;} - -#define GET_DLG_ITEM_TEXT_LENGTH(hDlg,nIDDlgItem) SendDlgItemMessage(hDlg,nIDDlgItem,WM_GETTEXTLENGTH,NULL,NULL) -#define GET_CURRENT_COMBO_DATA(hWndDlg,ControlID) SendDlgItemMessage(hWndDlg,ControlID,CB_GETITEMDATA,SendDlgItemMessage(hWndDlg,ControlID,CB_GETCURSEL,0,0),0) - -#define DB_SMS_DeleteValue(Contact,valueName) db_unset(Contact,MODULENAME,valueName) -#define DB_SMS_GetDword(Contact,valueName,parDefltValue) db_get_dw(Contact,MODULENAME,valueName,parDefltValue) -#define DB_SMS_SetDword(Contact,valueName,parValue) db_set_dw(Contact,MODULENAME,valueName,parValue) -#define DB_SMS_GetWord(Contact,valueName,parDefltValue) db_get_w(Contact,MODULENAME,valueName,parDefltValue) -#define DB_SMS_SetWord(Contact,valueName,parValue) db_set_w(Contact,MODULENAME,valueName,parValue) -#define DB_SMS_GetByte(Contact,valueName,parDefltValue) db_get_b(Contact,MODULENAME,valueName,parDefltValue) -#define DB_SMS_SetByte(Contact,valueName,parValue) db_set_b(Contact,MODULENAME,valueName,parValue) -BOOL DB_GetStaticStringW(MCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpszRetBuff,size_t dwRetBuffSize,size_t *pdwRetBuffSize); -#define DB_SMS_GetStaticStringW(Contact,ValueName,Ret,RetBuffSize,pRetBuffSize) DB_GetStaticStringW(Contact,MODULENAME,ValueName,Ret,RetBuffSize,pRetBuffSize) -#define DB_SetStringW(Contact,Module,valueName,parValue) db_set_ws(Contact,Module,valueName,parValue) -#define DB_SMS_SetStringW(Contact,valueName,parValue) db_set_ws(Contact,MODULENAME,valueName,parValue) - -LRESULT CALLBACK MessageSubclassProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam); - -LPSTR GetModuleName(MCONTACT hContact); -void EnableControlsArray(HWND hWndDlg,WORD *pwControlsList,size_t dwControlsListCount,BOOL bEnabled); - -// Declaration of function that returns received string with only numbers -size_t CopyNumberA(LPSTR lpszOutBuff,LPSTR lpszBuff,size_t dwLen); -size_t CopyNumberW(LPWSTR lpcOutBuff,LPWSTR lpcBuff,size_t dwLen); -bool IsPhoneW(LPWSTR lpwszString,size_t dwStringLen); -DWORD GetContactPhonesCount(MCONTACT hContact); -BOOL IsContactPhone(MCONTACT hContact,LPWSTR lpwszPhone,size_t dwPhoneSize); - -// Declaration of function that returns HANDLE of contact by his cellular number -MCONTACT HContactFromPhone(LPWSTR lpwszPhone,size_t dwPhoneSize); -BOOL GetDataFromMessage(LPSTR lpszMessage,size_t dwMessageSize,DWORD *pdwEventType,LPWSTR lpwszPhone,size_t dwPhoneSize,size_t *pdwPhoneSizeRet,UINT *piIcon); - -// Declaration of function that gets a XML string and return the asked tag. -BOOL GetXMLFieldEx(LPSTR lpszXML,size_t dwXMLSize,LPSTR *plpszData,size_t *pdwDataSize,const char *tag1,...); -BOOL GetXMLFieldExBuff(LPSTR lpszXML,size_t dwXMLSize,LPSTR lpszBuff,size_t dwBuffSize,size_t *pdwBuffSizeRet,const char *tag1,...); -DWORD DecodeXML(LPTSTR lptszMessage,size_t dwMessageSize,LPTSTR lptszMessageConverted,size_t dwMessageConvertedBuffSize,size_t *pdwMessageConvertedSize); -DWORD EncodeXML(LPTSTR lptszMessage,size_t dwMessageSize,LPTSTR lptszMessageConverted,size_t dwMessageConvertedBuffSize,size_t *pdwMessageConvertedSize); -void LoadMsgDlgFont(int i,LOGFONT *lf,COLORREF *colour); -int RefreshAccountList(WPARAM eventCode,LPARAM lParam); -void FreeAccountList(); - -int OptInitialise(WPARAM wParam,LPARAM lParam); - -int LoadServices(); -int LoadModules(); - -int handleAckSMS(WPARAM wParam,LPARAM lParam); -int handleNewMessage(WPARAM wParam,LPARAM lParam); - -// Declaration of Menu SMS send click function -int SmsRebuildContactMenu(WPARAM wParam,LPARAM lParam); - -void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwPhoneSize,LPWSTR lpwszMessage,size_t dwMessageSize); - -#endif diff --git a/plugins/SMS/src/version.h b/plugins/SMS/src/version.h deleted file mode 100644 index 4269279f7d..0000000000 --- a/plugins/SMS/src/version.h +++ /dev/null @@ -1,13 +0,0 @@ -#define __MAJOR_VERSION 0 -#define __MINOR_VERSION 2 -#define __RELEASE_NUM 5 -#define __BUILD_NUM 3 - -#include - -#define __PLUGIN_NAME "SMS" -#define __FILENAME "SMS.dll" -#define __DESCRIPTION "Send SMS text messages to mobile phones through the IM networks." -#define __AUTHOR "Richard Hughes, Improved by Ariel Shulman, rewritten by Rozhuk Ivan" -#define __AUTHORWEB "https://miranda-ng.org/p/SMS/" -#define __COPYRIGHT "© 2001-02 Richard Hughes, 2003 Ariel Shulman, 2007-19 Rozhuk Ivan" -- cgit v1.2.3