diff options
32 files changed, 5826 insertions, 0 deletions
diff --git a/plugins/SMS/!clear.bat b/plugins/SMS/!clear.bat new file mode 100644 index 0000000000..f35ebe94fd --- /dev/null +++ b/plugins/SMS/!clear.bat @@ -0,0 +1,36 @@ +@echo off
+
+del .\*.aps /q
+del .\*.clw /q
+del .\*.ncb /q
+rem del .\*.opt /q
+del .\*.plg /q
+
+del .\Release\*.obj /q
+del .\Release\*.pch /q
+del .\Release\*.pdb /q
+del .\Release\*.idb /q
+del .\Release\*.res /q
+del .\Release\*.exp /q
+del .\Release\*.sbr /q
+del .\Release\*.map /q
+del .\Release\*.cod /q
+
+del .\debug\*.obj /q
+del .\debug\*.pch /q
+del .\debug\*.pdb /q
+del .\debug\*.idb /q
+del .\debug\*.res /q
+del .\debug\*.ilk /q
+del .\debug\*.exp /q
+del .\debug\*.sbr /q
+del .\debug\*.asm /q
+del .\debug\*.cod /q
+del .\debug\*.map /q
+del .\debug\*.opt /q
+del .\debug\*._xe /q
+del .\debug\*.pbi /q
+del .\debug\*.pbo /q
+del .\debug\*.pbt /q
+del .\debug\*.map /q
+del .\debug\*.cod /q
diff --git a/plugins/SMS/AdditionalFunctions/BuffToLowerCase.h b/plugins/SMS/AdditionalFunctions/BuffToLowerCase.h new file mode 100644 index 0000000000..d2bb7a6671 --- /dev/null +++ b/plugins/SMS/AdditionalFunctions/BuffToLowerCase.h @@ -0,0 +1,56 @@ +#if !defined(AFX_BUFFTOLOWERCASE__H__INCLUDED_)
+#define AFX_BUFFTOLOWERCASE__H__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+
+__inline DWORD BuffToLowerCase(LPCVOID lpcOutBuff,LPCVOID lpcBuff,SIZE_T dwLen)
+{
+ DWORD dwRetErrorCode=NO_ERROR;
+
+ __asm
+ {
+ mov ecx,dwLen
+ test ecx,ecx
+ jz short end_func
+
+ push ebx // сохраняем регистр
+ push edi // сохраняем регистр
+ push esi // сохраняем регистр
+ mov esi,lpcBuff
+ mov edi,lpcOutBuff
+ mov bl,'A'
+ mov bh,'Z'
+ mov ah,32
+ cld
+
+ lowcaseloop:
+ lodsb
+ cmp al,bl
+ jl short savebyte
+ cmp al,bh
+ jg short savebyte
+ or al,ah
+
+ savebyte:
+ stosb
+
+ dec ecx
+ jnz short lowcaseloop
+
+ pop esi // восстанавливаем содержимое регистра
+ pop edi // восстанавливаем содержимое регистра
+ pop ebx // восстанавливаем содержимое регистра
+ end_func:
+ }
+
+return(dwRetErrorCode);
+}
+
+
+
+
+#endif // !defined(AFX_BUFFTOLOWERCASE__H__INCLUDED_)
\ No newline at end of file diff --git a/plugins/SMS/AdditionalFunctions/DebugFunctions.h b/plugins/SMS/AdditionalFunctions/DebugFunctions.h new file mode 100644 index 0000000000..8b21d1bc5a --- /dev/null +++ b/plugins/SMS/AdditionalFunctions/DebugFunctions.h @@ -0,0 +1,101 @@ +#if !defined(AFX_DEBUG_FUNCTIONS__H__INCLUDED_)
+#define AFX_DEBUG_FUNCTIONS__H__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#ifndef szCRLF
+#define szCRLF TEXT("\r\n")
+#endif
+//////////////////////////////////////////////////////////////////////////
+////////////////////////////DebugPrint////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// DebugBuildPrint(Helo world);
+// Отображение текста в Debug окне во время отладки
+#ifdef _DEBUG
+ #define DebugPrintA(szText) OutputDebugStringA((szText))
+ #define DebugPrintW(szText) OutputDebugStringW((szText))
+ #define DebugPrintCRLFA(szText) OutputDebugStringA((szText));OutputDebugStringA("\r\n")
+ #define DebugPrintCRLFW(szText) OutputDebugStringW((szText));OutputDebugStringW(L"\r\n")
+#else
+ #define DebugPrintA(szText)
+ #define DebugPrintW(szText)
+ #define DebugPrintCRLFA(szText)
+ #define DebugPrintCRLFW(szText)
+#endif //_DEBUG
+
+
+#ifdef UNICODE
+ #define DebugPrint DebugPrintW
+ #define DebugPrintCRLF DebugPrintCRLFW
+#else
+ #define DebugPrint DebugPrintA
+ #define DebugPrintCRLF DebugPrintCRLFA
+#endif
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
+////////////////////////////DebugBuildPrint///////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// #pragma DebugBuildPrint(Helo world);
+// Отображение сообщений в Build окне во время компиляции
+#ifdef _DEBUG
+ #pragma warning(disable:4081)
+ #define chSTR2(x) #x
+ #define chSTR(x) chSTR2(x)
+ #define DebugBuildPrint(szText) message(__FILE__ "(" chSTR(__LINE__) "): " #szText)
+ #pragma warning(default:4081)
+#else
+ #define DebugBuildPrint(szText)
+#endif //_DEBUG
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
+////////////////////////////DebugBufferFill///////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// DebugBufferFill(szString,sizeof(szString));
+// Полностью заполняет переданный буффер символом "A", применяется
+// для выходного буффера на входе в функцию.
+#ifdef _DEBUG
+ #define DebugBufferFill(lpBuffer,dwSize) memset(lpBuffer,'A',dwSize)
+#else
+ #define DebugBufferFill(lpBuffer,dwSize)
+#endif //_DEBUG
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
+////////////////////////////DebugBreak////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// DebugBreak();
+// Точка останова, более удобная альтернатива API
+#if defined(_DEBUG) && defined(_X86_)
+ #define DebugBreak() _asm{int 3}
+#else
+ #define DebugBreak()
+#endif //_DEBUG
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+
+
+
+
+
+
+#endif // !defined(AFX_DEBUG_FUNCTIONS__H__INCLUDED_)
diff --git a/plugins/SMS/AdditionalFunctions/InterlockedFunctions.h b/plugins/SMS/AdditionalFunctions/InterlockedFunctions.h new file mode 100644 index 0000000000..3fb008b216 --- /dev/null +++ b/plugins/SMS/AdditionalFunctions/InterlockedFunctions.h @@ -0,0 +1,127 @@ +#if !defined(AFX_INTERLOCKED_FUNCTIONS__H__INCLUDED_)
+#define AFX_INTERLOCKED_FUNCTIONS__H__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+
+
+
+#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/AdditionalFunctions/ListMT.h b/plugins/SMS/AdditionalFunctions/ListMT.h new file mode 100644 index 0000000000..7cf1e81808 --- /dev/null +++ b/plugins/SMS/AdditionalFunctions/ListMT.h @@ -0,0 +1,328 @@ +#if !defined(AFX_LIST_MT__H__INCLUDED_)
+#define AFX_LIST_MT__H__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+#include <InterlockedFunctions.h>
+
+#if defined(_MSC_VER)
+#if _MSC_VER >= 800
+#if _MSC_VER >= 1200
+#pragma warning(push)
+#endif
+#pragma warning(disable:4312) // warning C4312: 'type cast' : conversion from 'LONG' to 'PVOID' of greater size
+#endif
+#endif
+
+
+// структура для работы со списком, элемент списка
+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 (_WIN32_WINNT >= 0x0403)
+ if (InitializeCriticalSectionAndSpinCount(&pclmtListMT->cs,((dwSpinCount)? (dwSpinCount | 0x80000000):0L)))
+#else
+ InitializeCriticalSection(&pclmtListMT->cs);
+ if (TRUE)
+#endif
+ {
+ InterlockedExchangePointer(&pclmtListMT->nCount,NULL);
+ pclmtListMT->plmtiFirst=NULL;
+ pclmtListMT->plmtiLast=NULL;
+ dwRetErrorCode=NO_ERROR;
+ }else{
+ dwRetErrorCode=GetLastError();
+ }
+return(dwRetErrorCode);
+}
+
+
+__inline void ListMTDestroy(PCLIST_MT pclmtListMT)
+{
+ InterlockedExchangePointer(&pclmtListMT->nCount,NULL);
+ pclmtListMT->plmtiFirst=NULL;
+ pclmtListMT->plmtiLast=NULL;
+ DeleteCriticalSection(&pclmtListMT->cs);
+}
+
+
+__inline BOOL ListMTTryLock(PCLIST_MT pclmtListMT)
+{
+#if (_WIN32_WINNT >= 0x0400)
+ return(TryEnterCriticalSection(&pclmtListMT->cs));
+#else
+ return(FALSE);
+#endif
+}
+
+
+__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);
+}
+
+
+
+#if defined(_MSC_VER)
+#if _MSC_VER >= 800
+#if _MSC_VER >= 1200
+#pragma warning(pop)
+#else
+#pragma warning(default:4312) // warning C4312: 'type cast' : conversion from 'LONG' to 'PVOID' of greater size
+#endif
+#endif
+#endif
+
+
+
+#endif // !defined(AFX_LIST_MT__H__INCLUDED_)
diff --git a/plugins/SMS/AdditionalFunctions/MemoryCompare.h b/plugins/SMS/AdditionalFunctions/MemoryCompare.h new file mode 100644 index 0000000000..de663c6d8a --- /dev/null +++ b/plugins/SMS/AdditionalFunctions/MemoryCompare.h @@ -0,0 +1,177 @@ +#if !defined(AFX_MEMORYCOMPARE__H__INCLUDED_)
+#define AFX_MEMORYCOMPARE__H__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+// If the string pointed to by lpString1 is less than the string pointed
+// to by lpString2, the return value is negative.
+// If the string pointed to by lpString1 is greater than the string pointed
+// to by lpString2, the return value is positive.
+// If the strings are equal, the return value is zero.
+//
+// lpString1<lpString2 >> ret=1=CSTR_LESS_THAN
+// lpString1=lpString2 >> ret=2=CSTR_EQUAL
+// lpString1>lpString2 >> ret=3=CSTR_GREATER_THAN
+
+
+/*__inline DWORD MemoryCompare(LPCVOID lpcSource1,SIZE_T dwSource1Size,LPCVOID lpcSource2,SIZE_T dwSource2Size)
+{
+ DWORD dwRet;
+
+ __asm
+ {
+ mov ecx,dwSource1Size //; ecx = Source string 1 Size
+ cmp ecx,dwSource2Size //; сверяем длинны участков памяти
+ jg short greater_than
+ jl short less_than
+ test ecx,ecx
+ jz short equal //; NULL=NULL
+
+ mov esi,lpcSource1 //; edi = Source string 1
+ mov edi,lpcSource2 //; esi = Source string 2
+ cmp edi,esi //; сверяем указатели на участки памяти
+ je short equal //; это один и тотже участок, они естественно равны
+
+ test esi,esi //; lpcSource1=NULL, lpcSource1<lpcSource2
+ jz short less_than //; CSTR_LESS_THAN
+
+ test edi,edi //; lpcSource2=NULL, lpcSource1>lpcSource2
+ jz short greater_than //; CSTR_GREATER_THAN
+
+ //cld //; сканируя в прямом направлении
+
+ repe cmpsb //; цикл сравнения.
+ cmp_loop:
+ //sub ecx,4
+ //jz short equal
+
+ //inc esi
+ //inc edi
+ //mov al,byte ptr [esi]
+ //cmpsd
+ //cmp al,byte ptr [edi]
+ //je short cmp_loop
+ jg short greater_than
+ jl short less_than
+
+ equal: //; если мы попали сюда, значит, они
+ mov dwRet,CSTR_EQUAL //; совпадают (match)
+ jmp end_func
+ less_than: //; не совпадают
+ mov dwRet,CSTR_LESS_THAN
+ jmp end_func
+ greater_than:
+ mov dwRet,CSTR_GREATER_THAN
+
+ end_func:
+ }
+return(dwRet);
+}//*/
+
+__inline DWORD MemoryCompare(LPCVOID lpcSource1,SIZE_T dwSource1Size,LPCVOID lpcSource2,SIZE_T dwSource2Size)
+{
+ DWORD dwRet;
+
+ if (dwSource1Size==dwSource2Size)
+ {
+ if (lpcSource1==lpcSource2)
+ {
+ dwRet=CSTR_EQUAL;
+ }else{
+ if (lpcSource1 && lpcSource2)
+ {
+#ifdef _INC_MEMORY
+ dwRet=(2+memcmp(lpcSource1,lpcSource2,dwSource1Size));
+#else
+ SIZE_T dwDiffPosition;
+
+ //dwDiffPosition=RtlCompareMemory(lpcSource1,lpcSource2,dwSource1Size);
+ for(dwDiffPosition=0; (dwDiffPosition<dwSource1Size) && (((const BYTE*)lpcSource1)[dwDiffPosition]==((const BYTE*)lpcSource2)[dwDiffPosition]); dwDiffPosition++);
+ if (dwDiffPosition==dwSource1Size)
+ {
+ dwRet=CSTR_EQUAL;
+ }else{
+ if ((*((BYTE*)(((SIZE_T)lpcSource1)+dwDiffPosition)))>(*((BYTE*)(((SIZE_T)lpcSource2)+dwDiffPosition))))
+ {
+ dwRet=CSTR_GREATER_THAN;
+ }else{
+ dwRet=CSTR_LESS_THAN;
+ }
+ }
+#endif
+ }else{
+ if (lpcSource1)
+ {//lpcSource2==NULL
+ dwRet=CSTR_GREATER_THAN;
+ }else{//lpcSource1==NULL
+ dwRet=CSTR_LESS_THAN;
+ }
+ }
+ }
+ }else{
+ if (dwSource1Size<dwSource2Size)
+ {
+ dwRet=CSTR_LESS_THAN;
+ }else{
+ dwRet=CSTR_GREATER_THAN;
+ }
+ }
+return(dwRet);
+}//*/
+
+
+/*
+__inline DWORD MemoryCompareEx(LPCVOID lpcSource1,SIZE_T dwSource1Size,LPCVOID lpcSource2,SIZE_T dwSource2Size,SIZE_T *pdwDiffPosition)
+{
+ DWORD dwRet;
+
+ if (dwSource1Size==dwSource2Size)
+ {
+ if (lpcSource1==lpcSource2)
+ {
+ dwRet=CSTR_EQUAL;
+ }else{
+ if (lpcSource1 && lpcSource2)
+ {
+ SIZE_T dwDiffPosition;
+
+ dwDiffPosition=RtlCompareMemory(lpcSource1,lpcSource2,dwSource1Size);
+ if (dwDiffPosition==dwSource1Size)
+ {
+ dwRet=CSTR_EQUAL;
+ }else{
+ if ((*((BYTE*)(((SIZE_T)lpcSource1)+dwDiffPosition)))>(*((BYTE*)(((SIZE_T)lpcSource2)+dwDiffPosition))))
+ {
+ dwRet=CSTR_GREATER_THAN;
+ }else{
+ dwRet=CSTR_LESS_THAN;
+ }
+ }
+
+ if (pdwDiffPosition) (*pdwDiffPosition)=dwDiffPosition;
+ }else{
+ if (lpcSource1)
+ {//lpcSource2==NULL
+ dwRet=CSTR_GREATER_THAN;
+ }else{//lpcSource1==NULL
+ dwRet=CSTR_LESS_THAN;
+ }
+ }
+ }
+ }else{
+ if (dwSource1Size<dwSource2Size)
+ {
+ dwRet=CSTR_LESS_THAN;
+ }else{
+ dwRet=CSTR_GREATER_THAN;
+ }
+ }
+return(dwRet);
+}
+*/
+
+
+#endif // !defined(AFX_MEMORYCOMPARE__H__INCLUDED_)
diff --git a/plugins/SMS/AdditionalFunctions/MemoryFind.h b/plugins/SMS/AdditionalFunctions/MemoryFind.h new file mode 100644 index 0000000000..dbc5f1a2d1 --- /dev/null +++ b/plugins/SMS/AdditionalFunctions/MemoryFind.h @@ -0,0 +1,81 @@ +#if !defined(AFX_MEMORYFIND__H__INCLUDED_)
+#define AFX_MEMORYFIND__H__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+__inline LPVOID MemoryFind(SIZE_T dwFrom,LPCVOID lpcSource,SIZE_T dwSourceSize,LPCVOID lpcWhatFind,SIZE_T dwWhatFindSize)
+{
+ LPVOID lpRet=NULL;
+
+ __asm
+ {
+ push ebx // сохраняем регистр
+ push edi // сохраняем регистр
+ push esi // сохраняем регистр
+
+ mov ecx,dwSourceSize //; ecx = Source string Size
+ test ecx,ecx // is size unknown?
+ jz short end_func
+
+ mov edx,dwWhatFindSize //; edx = WhatFind string Size
+ test edx,edx // is size unknown?
+ jz short end_func
+
+ mov ebx,dwFrom // ebx - start pos in Source string
+ mov edi,lpcSource //; edi = Source string
+ mov esi,lpcWhatFind //; esi = WhatFind string
+
+ cmp ebx,ecx // проверка ecx(=len)=>ulFrom
+ jae short end_func
+
+ add edi,ebx // сдвигаем начало на ulFrom(нач смещен)
+ sub ecx,ebx // уменьшаем длинну SourceSize на ulFrom(нач смещен)
+
+ cmp ecx,edx // проверка NEWSourceSize ??? ulWhatFindSize
+ je short begin_memorycompare // NEWulSourceSize==ulWhatFindSize, Source ??? WhatFind
+ jl short end_func // NEWulSourceSize<ulWhatFindSize, => Source!=WhatFind
+
+ sub ecx,edx // уменьшаем длинну SourceSize на ulWhatFindSize
+ inc ecx
+
+ mov al,[esi] //; al=search byte
+ dec edi
+ cld //; сканируя в прямом направлении
+
+ find_loop:
+ test ecx,ecx
+ jz short end_func
+ inc edi
+ repne scasb //; find that byte
+ dec edi //; di points to byte which stopped scan
+
+ cmp [edi],al //; see if we have a hit
+ jne short end_func //; yes, point to byte
+
+ begin_memorycompare:
+ push esi
+ push edi
+ push ecx
+ mov ecx,edx //; ulWhatFindSize байтов (CX используется в REPE),
+ repe cmpsb //; сравниваем их.
+ pop ecx
+ pop edi
+ pop esi
+ jne short find_loop //; признак ZF = 0, если сравниваемые
+ //; строки не совпадают (mismatch) match:
+ //; если мы попали сюда, значит, они
+ //; совпадают (match)
+ mov lpRet,edi //; ax=pointer to byte
+ end_func:
+
+ pop esi // восстанавливаем содержимое регистра
+ pop edi // восстанавливаем содержимое регистра
+ pop ebx // восстанавливаем содержимое регистра
+ }
+return(lpRet);
+}
+
+
+#endif // !defined(AFX_MEMORYFIND__H__INCLUDED_)
diff --git a/plugins/SMS/AdditionalFunctions/MemoryFindByte.h b/plugins/SMS/AdditionalFunctions/MemoryFindByte.h new file mode 100644 index 0000000000..0dcc1f91a6 --- /dev/null +++ b/plugins/SMS/AdditionalFunctions/MemoryFindByte.h @@ -0,0 +1,71 @@ +#if !defined(AFX_MEMORYFINDBYTE__H__INCLUDED_)
+#define AFX_MEMORYFINDBYTE__H__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+
+__inline LPVOID MemoryFindByte(SIZE_T dwFrom,LPCVOID lpcSource,SIZE_T dwSourceSize,unsigned char chWhatFind)
+{
+ LPVOID lpRet=NULL;
+
+ if (lpcSource && dwSourceSize)
+ {
+ if (dwFrom<dwSourceSize)
+ {
+ lpRet=memchr((LPCVOID)(((SIZE_T)lpcSource)+dwFrom),chWhatFind,(dwSourceSize-dwFrom));
+ }
+ }
+return(lpRet);
+}
+
+
+
+__inline LPVOID MemoryFindByteReverse(SIZE_T dwFrom,LPCVOID lpcSource,SIZE_T dwSourceSize,unsigned char chWhatFind)
+{
+ LPVOID lpRet=NULL;
+
+ __asm
+ {
+ push ebx // сохраняем регистр
+ push edi // сохраняем регистр
+ push esi // сохраняем регистр
+
+ mov ecx,dwSourceSize
+ test ecx,ecx //; проверка входного параметра, он !=0
+ je short end_func
+
+ mov edi,lpcSource //; di = string
+ test edi,edi //; проверка входного параметра, он !=0
+ jz short end_func
+
+ mov eax,dwFrom
+
+/////////////////////////////////////////////
+ cmp eax,ecx //; проверка ecx(=len)=>dwFrom
+ jae short end_func
+
+ std //; count 'up' on string this time
+ sub ecx,eax //; уменьшаем длинну на dwFrom(нач смещен)
+ add edi,ecx //; сдвигаем начало на dwSourceSize(на конец)
+ mov al,chWhatFind //; al=search byte
+ repne scasb //; find that byte
+ inc edi //; di points to byte which stopped scan
+ cmp [edi],al //; see if we have a hit
+ jne short end_func //; yes, point to byte
+ mov lpRet,edi //; ax=pointer to byte
+ end_func:
+
+ cld
+ pop esi // восстанавливаем содержимое регистра
+ pop edi // восстанавливаем содержимое регистра
+ pop ebx // восстанавливаем содержимое регистра
+ }
+return(lpRet);
+}
+
+
+
+#endif // !defined(AFX_MEMORYFINDBYTE__H__INCLUDED_)
diff --git a/plugins/SMS/SMS.def b/plugins/SMS/SMS.def new file mode 100644 index 0000000000..3ec70ac7bb --- /dev/null +++ b/plugins/SMS/SMS.def @@ -0,0 +1,8 @@ +LIBRARY SMS
+
+EXPORTS
+ MirandaPluginInfo @1
+ MirandaPluginInfoEx @2
+ MirandaPluginInterfaces @3
+ Load @4
+ Unload @5
diff --git a/plugins/SMS/SMSConstans.h b/plugins/SMS/SMSConstans.h new file mode 100644 index 0000000000..ddaddc3df7 --- /dev/null +++ b/plugins/SMS/SMSConstans.h @@ -0,0 +1,108 @@ +#if !defined(AFX_SMS_CONSTANS_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_)
+#define AFX_SMS_CONSTANS_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_
+
+
+
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+
+// {CF97FD5D-B911-47a8-AF03-D21968B5B894}
+#define SMS_GUID { 0xcf97fd5d, 0xb911, 0x47a8, { 0xaf, 0x3, 0xd2, 0x19, 0x68, 0xb5, 0xb8, 0x94 } }
+
+
+#define MIN_MIR_VER_VERSION_DWORD PLUGIN_MAKE_VERSION(0,8,0,0)
+
+
+#define PLUGIN_VERSION_DWORD PLUGIN_MAKE_VERSION(0,2,5,3)
+#define PROTOCOL_NAMEA "SMSPlugin"
+#define PROTOCOL_NAMEW TEXT(PROTOCOL_NAMEA)
+#define PROTOCOL_NAME_LEN (sizeof(PROTOCOL_NAMEA)-1)
+#define PROTOCOL_NAME_SIZE sizeof(PROTOCOL_NAMEA)
+#define PROTOCOL_DISPLAY_NAME_ORIG "SMS"
+#define PROTOCOL_DISPLAY_NAME_ORIGW TEXT(PROTOCOL_DISPLAY_NAME_ORIG)
+
+
+
+
+#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_PLUGIN_UPDATER_ID 4187 //появляется после первого выкладывания на сайт
+
+
+
+#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 defenitions
+//#define SRMMMOD "SRMM"
+#define SRMMMOD "TabSRMM_Fonts"
+
+#define FONTF_BOLD 1
+#define FONTF_ITALIC 2
+struct FontOptionsList
+{
+ COLORREF defColour;
+ TCHAR* szDefFace;
+ BYTE defStyle;
+ char defSize;
+}
+
+static fontOptionsList[] = {
+ { RGB(106, 106, 106), _T("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 L"Send &SMS..."
+#define SMS_SEND_CM_STR L"&SMS Message"
+
+
+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/SMS_svc.cpp b/plugins/SMS/SMS_svc.cpp new file mode 100644 index 0000000000..24e6d1ad2f --- /dev/null +++ b/plugins/SMS/SMS_svc.cpp @@ -0,0 +1,243 @@ +#include "main.h"
+
+
+
+int LoadServices(void)
+{
+ CHAR szServiceFunction[MAX_PATH],*pszServiceFunctionName;
+
+ CopyMemory(szServiceFunction,PROTOCOL_NAMEA,PROTOCOL_NAME_SIZE);
+ pszServiceFunctionName=szServiceFunction+PROTOCOL_NAME_LEN;
+
+ // Service creation
+ for (SIZE_T i=0;i<SIZEOF(siPluginServices);i++)
+ {
+ CopyMemory(pszServiceFunctionName,siPluginServices[i].lpszName,(lstrlenA(siPluginServices[i].lpszName)+1));
+ CreateServiceFunction(szServiceFunction,(MIRANDASERVICE)siPluginServices[i].lpFunc);
+ }
+return(0);
+}
+
+
+int LoadModules(void)
+{
+ ssSMSSettings.hHookOptInitialize=HookEvent(ME_OPT_INITIALISE,OptInitialise);
+ ssSMSSettings.hHookRebuildCMenu=HookEvent(ME_CLIST_PREBUILDCONTACTMENU,SmsRebuildContactMenu);
+ ssSMSSettings.hHookProtoAck=HookEvent(ME_PROTO_ACK,handleAckSMS);
+ ssSMSSettings.hHookDbAdd=HookEvent(ME_DB_EVENT_ADDED,handleNewMessage);
+ ssSMSSettings.hHookAccListChanged=HookEvent(ME_PROTO_ACCLISTCHANGED,RefreshAccountList);
+
+
+ CLISTMENUITEM mi={0};
+ CHAR szServiceFunction[MAX_PATH];
+
+ mir_snprintf(szServiceFunction,sizeof(szServiceFunction),"%s%s",PROTOCOL_NAMEA,SMS_SEND);
+
+ mi.cbSize=sizeof(mi);
+ mi.position=300050000;
+ mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_SMS);
+ mi.ptszName=SMS_SEND_STR;
+ mi.pszService=szServiceFunction;
+ mi.flags=(CMIF_UNICODE);
+ CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+
+ mi.position=-2000070000;
+ mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_SMS);
+ mi.ptszName=SMS_SEND_CM_STR;
+ mi.pszService=szServiceFunction;
+ mi.flags=(CMIF_UNICODE);
+ ssSMSSettings.hContactMenuItems[0]=(HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+
+
+
+ SkinAddNewSoundEx("RecvSMSMsg",PROTOCOL_NAMEA,Translate("Incoming SMS Message"));
+ SkinAddNewSoundEx("RecvSMSConfirmation",PROTOCOL_NAMEA,Translate("Incoming SMS Confirmation"));
+
+
+ RefreshAccountList(NULL,NULL);
+
+ RestoreUnreadMessageAlerts();
+
+return(0);
+}
+
+
+void UnloadModules()
+{
+ // Main menu destroy
+ //CListDestroyMenu(gdiMenuItems,SIZEOF(gdiMenuItems));
+ //ZeroMemory(masMraSettings.hMainMenuItems,sizeof(masMraSettings.hMainMenuItems));
+
+ // Contact menu destroy
+ //CListDestroyMenu(gdiContactMenuItems,(SIZEOF(gdiContactMenuItems) - ((masMraSettings.heNudgeReceived==NULL)? 0:1)));
+ //ZeroMemory(masMraSettings.hContactMenuItems,sizeof(masMraSettings.hContactMenuItems));
+
+ if (ssSMSSettings.hHookAccListChanged) {UnhookEvent(ssSMSSettings.hHookAccListChanged); ssSMSSettings.hHookAccListChanged=NULL;}
+ if (ssSMSSettings.hHookDbAdd) {UnhookEvent(ssSMSSettings.hHookDbAdd); ssSMSSettings.hHookDbAdd=NULL;}
+ if (ssSMSSettings.hHookProtoAck) {UnhookEvent(ssSMSSettings.hHookProtoAck); ssSMSSettings.hHookProtoAck=NULL;}
+ if (ssSMSSettings.hHookRebuildCMenu) {UnhookEvent(ssSMSSettings.hHookRebuildCMenu); ssSMSSettings.hHookRebuildCMenu=NULL;}
+ if (ssSMSSettings.hHookOptInitialize) {UnhookEvent(ssSMSSettings.hHookOptInitialize); ssSMSSettings.hHookOptInitialize=NULL;}
+
+ //IconsUnLoad();
+
+}
+
+
+void UnloadServices()
+{
+ CHAR szServiceFunction[MAX_PATH],*pszServiceFunctionName;
+
+ CopyMemory(szServiceFunction,PROTOCOL_NAMEA,PROTOCOL_NAME_SIZE);
+ pszServiceFunctionName=szServiceFunction+PROTOCOL_NAME_LEN;
+
+ // destroy plugin services
+ for (SIZE_T i=0;i<SIZEOF(siPluginServices);i++)
+ {
+ CopyMemory(pszServiceFunctionName,siPluginServices[i].lpszName,(lstrlenA(siPluginServices[i].lpszName)+1));
+ DestroyServiceFunction(szServiceFunction);
+ }
+}
+
+
+
+int SmsRebuildContactMenu(WPARAM wParam,LPARAM lParam)
+{
+ CListShowMenuItem(ssSMSSettings.hContactMenuItems[0],(BOOL)GetContactPhonesCount((HANDLE)wParam));
+return(0);
+}
+
+
+//This function called when user clicked Menu.
+int SendSMSMenuCommand(WPARAM wParam,LPARAM lParam)
+{
+ HWND hwndSendSms;
+
+ if (wParam)
+ {// user clicked on the "SMS Message" on one of the users
+ hwndSendSms=SendSMSWindowIsOtherInstanceHContact((HANDLE)wParam);
+ if (hwndSendSms)
+ {
+ SetFocus(hwndSendSms);
+ }else{
+ hwndSendSms=SendSMSWindowAdd((HANDLE)wParam);
+ }
+ }else{// user clicked on the "SMS Send" in the Main Menu
+ hwndSendSms=SendSMSWindowAdd(NULL);
+ EnableWindow(GetDlgItem(hwndSendSms,IDC_NAME),TRUE);
+ EnableWindow(GetDlgItem(hwndSendSms,IDC_SAVENUMBER),FALSE);
+
+ for(HANDLE hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);hContact!=NULL;hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
+ {
+ if (GetContactPhonesCount(hContact))
+ {
+ SEND_DLG_ITEM_MESSAGEW(hwndSendSms,IDC_NAME,CB_ADDSTRING,0,(LPARAM)GetContactNameW(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 wParam,LPARAM lParam)
+{
+ int iRet=1;
+ DBEVENTINFO dbei={0};
+
+ dbei.cbSize=sizeof(dbei);
+ if ((dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)((CLISTEVENT*)lParam)->hDbEvent,0))!=-1)
+ {
+ dbei.pBlob=(PBYTE)MEMALLOC(dbei.cbBlob);
+ if (dbei.pBlob)
+ {
+ if (CallService(MS_DB_EVENT_GET,(WPARAM)((CLISTEVENT*)lParam)->hDbEvent,(LPARAM)&dbei)==0)
+ if (dbei.eventType==ICQEVENTTYPE_SMS || dbei.eventType==ICQEVENTTYPE_SMSCONFIRMATION)
+ if (dbei.cbBlob>MIN_SMS_DBEVENT_LEN)
+ {
+ if (RecvSMSWindowAdd(((CLISTEVENT*)lParam)->hContact,ICQEVENTTYPE_SMS,NULL,0,(LPSTR)dbei.pBlob,dbei.cbBlob))
+ {
+ CallService(MS_DB_EVENT_MARKREAD,(WPARAM)((CLISTEVENT*)lParam)->hContact,(LPARAM)((CLISTEVENT*)lParam)->hDbEvent);
+ iRet=0;
+ }
+ }
+ MEMFREE(dbei.pBlob);
+ }
+ }
+return(iRet);
+}
+
+//This function used to popup a read SMS window after the user clicked on the received SMS confirmation.
+int ReadAckSMS(WPARAM wParam,LPARAM lParam)
+{
+ int iRet=1;
+ DBEVENTINFO dbei={0};
+
+ dbei.cbSize=sizeof(dbei);
+ if ((dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)((CLISTEVENT*)lParam)->hDbEvent,0))!=-1)
+ {
+ dbei.pBlob=(PBYTE)MEMALLOC(dbei.cbBlob);
+ if (dbei.pBlob)
+ {
+ if (CallService(MS_DB_EVENT_GET,(WPARAM)((CLISTEVENT*)lParam)->hDbEvent,(LPARAM)&dbei)==0)
+ if (dbei.eventType==ICQEVENTTYPE_SMS || dbei.eventType==ICQEVENTTYPE_SMSCONFIRMATION)
+ if (dbei.cbBlob>MIN_SMS_DBEVENT_LEN)
+ {
+ if (RecvSMSWindowAdd(((CLISTEVENT*)lParam)->hContact,ICQEVENTTYPE_SMSCONFIRMATION,NULL,0,(LPSTR)dbei.pBlob,dbei.cbBlob))
+ {
+ CallService(MS_DB_EVENT_DELETE,(WPARAM)((CLISTEVENT*)lParam)->hContact,(LPARAM)((CLISTEVENT*)lParam)->hDbEvent);
+ iRet=0;
+ }
+ }
+ MEMFREE(dbei.pBlob);
+ }
+ }
+return(iRet);
+}
+
+void RestoreUnreadMessageAlerts(void)
+{
+ DBEVENTINFO dbei={0};
+ HANDLE hDbEvent,hContact;
+
+ dbei.cbSize=sizeof(dbei);
+ for(hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);hContact!=NULL;hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
+ for(hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD,(WPARAM)hContact,0);hDbEvent!=NULL;hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDNEXT,(WPARAM)hDbEvent,0))
+ {
+ dbei.cbBlob=0;
+ if (CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei)==0)
+ if ((dbei.flags&(DBEF_SENT|DBEF_READ))==0 && ((dbei.eventType==ICQEVENTTYPE_SMS) || (dbei.eventType==ICQEVENTTYPE_SMSCONFIRMATION)))
+ if (dbei.cbBlob>MIN_SMS_DBEVENT_LEN)
+ {
+ handleNewMessage((WPARAM)hContact,(LPARAM)hDbEvent);
+ }
+ }
+
+ hContact=NULL;
+ for(hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD,(WPARAM)hContact,0);hDbEvent!=NULL;hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDNEXT,(WPARAM)hDbEvent,0))
+ {
+ dbei.cbBlob=0;
+ if (CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei)==0)
+ if ((dbei.flags&(DBEF_SENT|DBEF_READ))==0 && ((dbei.eventType==ICQEVENTTYPE_SMS) || (dbei.eventType==ICQEVENTTYPE_SMSCONFIRMATION)))
+ if (dbei.cbBlob>MIN_SMS_DBEVENT_LEN)
+ {
+ handleNewMessage((WPARAM)hContact,(LPARAM)hDbEvent);
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/SMS/functions.cpp b/plugins/SMS/functions.cpp new file mode 100644 index 0000000000..aebafa42d8 --- /dev/null +++ b/plugins/SMS/functions.cpp @@ -0,0 +1,761 @@ +#include "main.h"
+
+
+
+
+
+BOOL DB_GetStaticStringW(HANDLE 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};
+ DBCONTACTGETSETTING sVal={0};
+
+ dbv.type=DBVT_WCHAR;
+ sVal.pValue=&dbv;
+ sVal.szModule=lpszModule;
+ sVal.szSetting=lpszValueName;
+ if (CallService(MS_DB_CONTACT_GETSETTING_STR,(WPARAM)hContact,(LPARAM)&sVal)==0)
+ {
+ dwReadedStringLen=lstrlenW(dbv.pwszVal);
+ if (lpwszRetBuff && (dwRetBuffSize>dwReadedStringLen))
+ {
+ CopyMemory(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;
+
+ DBFreeVariant(&dbv);
+ }else{
+ if (lpwszRetBuff && dwRetBuffSize>=sizeof(WCHAR)) (*((WCHAR*)lpwszRetBuff))=0;
+ if (pdwRetBuffSize) (*pdwRetBuffSize)=0;
+ }
+return(bRet);
+}
+
+
+BOOL DB_SetStringExW(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpwszValue,SIZE_T dwValueSize)
+{
+ BOOL bRet=FALSE;
+
+ if (lpwszValue && dwValueSize)
+ {
+ LPWSTR lpwszValueLocal=(LPWSTR)MEMALLOC(((dwValueSize+MAX_PATH)*sizeof(WCHAR)));
+
+ if (lpwszValueLocal)
+ {
+ DBCONTACTWRITESETTING cws={0};
+
+ cws.szModule=lpszModule;
+ cws.szSetting=lpszValueName;
+ cws.value.type=DBVT_WCHAR;
+ cws.value.pwszVal=(WCHAR*)lpwszValueLocal;
+ CopyMemory(lpwszValueLocal,lpwszValue,(dwValueSize*sizeof(WCHAR)));
+ bRet=(CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws)==0);
+
+ MEMFREE(lpwszValueLocal);
+ }
+ }else{
+ bRet=TRUE;
+ DBDeleteContactSetting(hContact,lpszModule,lpszValueName);
+ }
+return(bRet);
+}
+
+
+LPSTR GetModuleName(HANDLE hContact)
+{
+ LPSTR lpszRet;
+
+ if (hContact)
+ {
+ lpszRet=(LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
+ if (lpszRet==NULL) lpszRet=PROTOCOL_NAMEA;
+ }else{
+ lpszRet=PROTOCOL_NAMEA;
+ }
+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);
+}
+
+
+void CListShowMenuItem(HANDLE hMenuItem,BOOL bShow)
+{
+ CLISTMENUITEM mi={0};
+
+ mi.cbSize=sizeof(mi);
+ mi.flags=CMIM_FLAGS;
+ if (bShow==FALSE) mi.flags|=CMIF_HIDDEN;
+
+ CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hMenuItem,(LPARAM)&mi);
+}
+
+
+//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)
+{
+ BOOL bRet;
+
+ if (dwStringLen>1)
+ {// country code
+ WCHAR wChar;
+
+ bRet=TRUE;
+ for(SIZE_T i=0;i<dwStringLen;i++)
+ {
+ wChar=(*lpwszString++);
+ if (wChar<'0' || wChar>'9')
+ if (wChar!='+' && wChar!='S' && wChar!='M' && wChar!=' ' && wChar!='(' && wChar!=')')
+ {
+ bRet=FALSE;
+ break;
+ }
+ }
+ }else{
+ bRet=FALSE;
+ }
+return(bRet);
+}
+
+
+
+DWORD GetContactPhonesCountParam(HANDLE 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,SIZEOF(wszPhone),&dwPhoneSize))
+ {
+ if (IsPhoneW(wszPhone,dwPhoneSize)) dwRet++;
+ }
+
+ for (i=0;TRUE;i++)
+ {
+ mir_snprintf(szBuff,sizeof(szBuff),"%s%ld",lpszValueName,i);
+ if (DB_GetStaticStringW(hContact,lpszModule,szBuff,wszPhone,SIZEOF(wszPhone),&dwPhoneSize))
+ {
+ if (IsPhoneW(wszPhone,dwPhoneSize)) dwRet++;
+ }else{
+ if (i>PHONES_MIN_COUNT) break;
+ }
+ }
+return(dwRet);
+}
+
+
+DWORD GetContactPhonesCount(HANDLE hContact)
+{
+ DWORD dwRet=0;
+ LPSTR lpszProto;
+
+ lpszProto=(LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
+ 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(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpwszPhone,SIZE_T dwPhoneSize)
+{
+ BOOL bRet=FALSE;
+ char szBuff[MAX_PATH];
+ WCHAR wszPhoneLocal[MAX_PHONE_LEN];
+ SIZE_T i,dwPhoneSizeLocal;
+
+ if (DB_GetStaticStringW(hContact,lpszModule,lpszValueName,wszPhoneLocal,SIZEOF(wszPhoneLocal),&dwPhoneSizeLocal))
+ if (IsPhoneW(wszPhoneLocal,dwPhoneSizeLocal))
+ {
+ dwPhoneSizeLocal=CopyNumberW(wszPhoneLocal,wszPhoneLocal,dwPhoneSizeLocal);
+ if (MemoryCompare(wszPhoneLocal,dwPhoneSizeLocal,lpwszPhone,dwPhoneSize)==CSTR_EQUAL)
+ {
+ bRet=TRUE;
+ }
+ }
+
+ for (i=0;bRet==FALSE;i++)
+ {
+ mir_snprintf(szBuff,sizeof(szBuff),"%s%ld",lpszValueName,i);
+ if (DB_GetStaticStringW(hContact,lpszModule,szBuff,wszPhoneLocal,SIZEOF(wszPhoneLocal),&dwPhoneSizeLocal))
+ {
+ if (IsPhoneW(wszPhoneLocal,dwPhoneSizeLocal))
+ {
+ dwPhoneSizeLocal=CopyNumberW(wszPhoneLocal,wszPhoneLocal,dwPhoneSizeLocal);
+ if (MemoryCompare(wszPhoneLocal,dwPhoneSizeLocal,lpwszPhone,dwPhoneSize)==CSTR_EQUAL)
+ {
+ bRet=TRUE;
+ break;
+ }
+ }
+ }else{
+ if (i>PHONES_MIN_COUNT) break;
+ }
+ }
+return(bRet);
+}
+
+
+BOOL IsContactPhone(HANDLE hContact,LPWSTR lpwszPhone,SIZE_T dwPhoneSize)
+{
+ BOOL bRet=FALSE;
+ WCHAR wszPhoneLocal[MAX_PHONE_LEN];
+ LPSTR lpszProto;
+ SIZE_T dwPhoneSizeLocal;
+
+ dwPhoneSizeLocal=CopyNumberW(wszPhoneLocal,lpwszPhone,dwPhoneSize);
+ lpszProto=(LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
+ if (lpszProto)
+ {
+ if (bRet==FALSE) 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.
+HANDLE HContactFromPhone(LPWSTR lpwszPhone,SIZE_T dwPhoneSize)
+{
+ HANDLE hContact=NULL;
+
+ if (lpwszPhone && dwPhoneSize)
+ {
+ //check not already on list
+ for(hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);hContact!=NULL;hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
+ {
+ if (IsContactPhone(hContact,lpwszPhone,dwPhoneSize)) break;
+ }
+ }
+return(hContact);
+}
+
+
+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)
+ {
+ LPSTR lpsz;
+
+ if (MemoryCompare(lpszMessage,10,"SMS From: ",10)==CSTR_EQUAL)
+ {
+ lpsz=(LPSTR)MemoryFind(10,lpszMessage,dwMessageSize,"\r\n",2);
+ if (lpsz)
+ {
+ if (lpwszPhone && dwPhoneSize)
+ {
+ dwPhoneSizeRet=MultiByteToWideChar(CP_UTF8,0,(lpszMessage+10),min((SIZE_T)(lpsz-(lpszMessage+10)),dwPhoneSize),lpwszPhone,dwPhoneSize);
+ dwPhoneSizeRet=CopyNumberW(lpwszPhone,lpwszPhone,dwPhoneSizeRet);
+ }
+ }
+ iIconRet=0;
+ dwEventTypeRet=ICQEVENTTYPE_SMS;
+ bRet=TRUE;
+ }else
+ if (MemoryCompare(lpszMessage,23,"SMS Confirmation From: ",23)==CSTR_EQUAL)
+ {
+ lpsz=(LPSTR)MemoryFind(23,lpszMessage,dwMessageSize,"\r\n",2);
+ if (lpsz)
+ {
+ if (lpwszPhone && dwPhoneSize)
+ {
+ dwPhoneSizeRet=MultiByteToWideChar(CP_UTF8,0,(lpszMessage+23),min((SIZE_T)(lpsz-(lpszMessage+23)),dwPhoneSize),lpwszPhone,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,lpszTagStart,lpszTagEnd=lpszXML,lpszDataStart=NULL;
+ 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)
+ {
+ 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==NULL) lpszDataStart=(lpszTagEnd+2);
+ thisLevel=0;
+ }
+ }
+ }else{
+ break;
+ }
+ }else{
+ break;
+ }
+ }
+ 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=NULL;
+ 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) CopyMemory(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==NULL) 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);
+}
+
+
+/*BOOL GetXMLFieldExW(LPWSTR lpwszXML,SIZE_T dwXMLSize,LPWSTR *plpwszData,SIZE_T *pdwDataSize,const WCHAR *tag1,...)
+{
+ BOOL bRet=FALSE;
+ int thisLevel=0;
+ LPWSTR lpwszFindTag=(LPWSTR)tag1,lpwszTagStart,lpwszTagEnd=lpwszXML,lpwszDataStart=NULL;
+ va_list va;
+
+ va_start(va,tag1);
+ while(TRUE)
+ {
+ lpwszTagStart=(LPWSTR)MemoryFind((lpwszTagEnd-lpwszXML),lpwszXML,dwXMLSize,L"<",2);
+ if (lpwszTagStart)
+ {
+ lpwszTagEnd=(LPWSTR)MemoryFind((lpwszTagStart-lpwszXML),lpwszXML,dwXMLSize,L">",2);
+ if (lpwszTagEnd)
+ {
+ lpwszTagStart++;
+ lpwszTagEnd--;
+ if ((*((WORD*)lpwszTagStart))==(*((WORD*)"/")))
+ {
+ if (--thisLevel<0)
+ {
+ if (lpwszDataStart)
+ {
+ if (plpwszData) (*plpwszData)=lpwszDataStart;
+ if (pdwDataSize) (*pdwDataSize)=((lpwszTagStart-1)-lpwszDataStart);
+ bRet=TRUE;
+ }
+ break;
+ }
+ }else{
+ if (++thisLevel==1)
+ if (CompareStringW(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),NORM_IGNORECASE,lpwszFindTag,-1,lpwszTagStart,((lpwszTagEnd+1)-lpwszTagStart))==CSTR_EQUAL)
+ {
+ lpwszFindTag=va_arg(va,LPWSTR);
+ if (lpwszFindTag==NULL) lpwszDataStart=(lpwszTagEnd+2);
+ thisLevel=0;
+ }
+ }
+ }else{
+ break;
+ }
+ }else{
+ break;
+ }
+ }
+ va_end(va);
+return(bRet);
+}
+
+
+BOOL GetXMLFieldExBuffW(LPWSTR lpwszXML,SIZE_T dwXMLSize,LPWSTR lpwszBuff,SIZE_T dwBuffSize,SIZE_T *pdwBuffSizeRet,const WCHAR *tag1,...)
+{
+ BOOL bRet;
+ LPWSTR lpwszData;
+ SIZE_T dwDataSize;
+
+ if ((bRet=GetXMLFieldExW(lpwszXML,dwXMLSize,&lpwszData,&dwDataSize,tag1)))
+ {
+ SIZE_T dwBuffSizeRet=min((dwBuffSize-2),dwDataSize);
+
+ if (lpwszBuff && dwBuffSize) CopyMemory(lpwszBuff,lpwszData,dwBuffSizeRet);(*((WORD*)(lpwszBuff+dwBuffSizeRet)))=0;
+ if (pdwBuffSizeRet) (*pdwBuffSizeRet)=dwBuffSizeRet;
+ }else{
+ if (lpwszBuff) (*((WORD*)lpwszBuff))=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 *plpszFounded,lpszMessageConvertedCur,lpszMessageCur,lpszMessageCurPrev,lpszMessageConvertedMax;
+ SIZE_T i,dwFirstFoundedIndex=0,dwFoundedCount=0,dwMemPartToCopy;
+
+#ifdef _DEBUG //check tables
+ for(i=0;i<dwReplaceItemsCount;i++)
+ {
+ if (lstrlen((LPTSTR)plpInReplaceItems[i])!=(pdwInReplaceItemsCounts[i]/sizeof(TCHAR))) DebugBreak();
+ if (lstrlen((LPTSTR)plpOutReplaceItems[i])!=(pdwOutReplaceItemsCounts[i]/sizeof(TCHAR))) DebugBreak();
+ }
+#endif
+
+ plpszFounded=(LPBYTE*)MEMALLOC((sizeof(LPBYTE)*dwReplaceItemsCount));
+
+ lpszMessageCurPrev=(LPBYTE)lpInBuff;
+ lpszMessageConvertedCur=(LPBYTE)lpOutBuff;
+ lpszMessageConvertedMax=(((LPBYTE)lpOutBuff)+dwOutBuffSize);
+ for(i=0;i<dwReplaceItemsCount;i++)
+ {// loking for in first time
+ plpszFounded[i]=(LPBYTE)MemoryFind((lpszMessageCurPrev-(LPBYTE)lpInBuff),lpInBuff,dwInBuffSize,plpInReplaceItems[i],pdwInReplaceItemsCounts[i]);
+ if (plpszFounded[i]) dwFoundedCount++;
+ }
+
+ while(dwFoundedCount)
+ {
+ for(i=0;i<dwReplaceItemsCount;i++)
+ {// looking for first to replace
+ if (plpszFounded[i] && (plpszFounded[i]<plpszFounded[dwFirstFoundedIndex] || plpszFounded[dwFirstFoundedIndex]==NULL)) dwFirstFoundedIndex=i;
+ }
+
+ if (plpszFounded[dwFirstFoundedIndex])
+ {// in founded
+ dwMemPartToCopy=(plpszFounded[dwFirstFoundedIndex]-lpszMessageCurPrev);
+ if (lpszMessageConvertedMax>(lpszMessageConvertedCur+(dwMemPartToCopy+pdwInReplaceItemsCounts[dwFirstFoundedIndex])))
+ {
+ CopyMemory(lpszMessageConvertedCur,lpszMessageCurPrev,dwMemPartToCopy);lpszMessageConvertedCur+=dwMemPartToCopy;
+ CopyMemory(lpszMessageConvertedCur,plpOutReplaceItems[dwFirstFoundedIndex],pdwOutReplaceItemsCounts[dwFirstFoundedIndex]);lpszMessageConvertedCur+=pdwOutReplaceItemsCounts[dwFirstFoundedIndex];
+ lpszMessageCurPrev=(plpszFounded[dwFirstFoundedIndex]+pdwInReplaceItemsCounts[dwFirstFoundedIndex]);
+
+ for(i=0;i<dwReplaceItemsCount;i++)
+ {// loking for in next time
+ if (plpszFounded[i] && plpszFounded[i]<lpszMessageCurPrev)
+ {
+ dwFoundedCount--;
+ plpszFounded[i]=(LPBYTE)MemoryFind((lpszMessageCurPrev-(LPBYTE)lpInBuff),lpInBuff,dwInBuffSize,plpInReplaceItems[i],pdwInReplaceItemsCounts[i]);
+ if (plpszFounded[i]) dwFoundedCount++;
+ }
+ }
+ }else{
+ dwRetErrorCode=ERROR_BUFFER_OVERFLOW;
+ DebugBreak();
+ break;
+ }
+ }else{// сюда по идее никогда не попадём, на всякий случай.
+ DebugBreak();
+ break;
+ }
+ }
+ lpszMessageCur=(((LPBYTE)lpInBuff)+dwInBuffSize);
+ CopyMemory(lpszMessageConvertedCur,lpszMessageCurPrev,(lpszMessageCur-lpszMessageCurPrev));lpszMessageConvertedCur+=(lpszMessageCur-lpszMessageCurPrev);
+ (*((WORD*)lpszMessageConvertedCur))=0;
+
+ MEMFREE(plpszFounded);
+
+ if (pdwOutBuffSize) (*pdwOutBuffSize)=(lpszMessageConvertedCur-((LPBYTE)lpOutBuff));
+
+return(dwRetErrorCode);
+}
+
+
+static const LPTSTR lpszXMLTags[] ={TEXT("'"), TEXT("""), TEXT("&"), TEXT("<"), TEXT(">")};
+static const SIZE_T dwXMLTagsCount[] ={(6*sizeof(TCHAR)), (6*sizeof(TCHAR)), (5*sizeof(TCHAR)), (4*sizeof(TCHAR)), (4*sizeof(TCHAR))};
+static const LPTSTR lpszXMLSymbols[] ={TEXT("\'"), TEXT("\""), TEXT("&"), TEXT("<"), TEXT(">")};
+static const SIZE_T dwXMLSymbolsCount[] ={sizeof(TCHAR), sizeof(TCHAR), sizeof(TCHAR), sizeof(TCHAR), sizeof(TCHAR)};
+
+//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(TCHAR)),SIZEOF(lpszXMLTags),(LPVOID*)lpszXMLTags,(SIZE_T*)dwXMLTagsCount,(LPVOID*)lpszXMLSymbols,(SIZE_T*)dwXMLSymbolsCount,lptszMessageConverted,(dwMessageConvertedBuffSize*sizeof(TCHAR)),pdwMessageConvertedSize);
+
+ if (pdwMessageConvertedSize) (*pdwMessageConvertedSize)/=sizeof(TCHAR);
+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(TCHAR)),SIZEOF(lpszXMLTags),(LPVOID*)lpszXMLSymbols,(SIZE_T*)dwXMLSymbolsCount,(LPVOID*)lpszXMLTags,(SIZE_T*)dwXMLTagsCount,lptszMessageConverted,(dwMessageConvertedBuffSize*sizeof(TCHAR)),pdwMessageConvertedSize);
+
+ if (pdwMessageConvertedSize) (*pdwMessageConvertedSize)/=sizeof(TCHAR);
+return(dwRet);
+}
+
+
+//(Taken from Miranda-IM source code:)
+BYTE MsgDlgGetFontDefaultCharset(const TCHAR* szFont)
+{
+ return(DEFAULT_CHARSET);
+}
+
+
+void LoadMsgDlgFont(int i,LOGFONT *lf,COLORREF *colour)
+{
+ int style;
+ char str[MAX_PATH];
+ DBVARIANT dbv;
+
+ if (colour)
+ {
+ mir_snprintf(str,sizeof(str),"Font%dCol",i);
+ (*colour)=DBGetContactSettingDword(NULL,SRMMMOD,str,fontOptionsList[0].defColour);
+ }
+
+ if (lf)
+ {
+ if (DBGetContactSetting(NULL,SRMMMOD,str,&dbv))
+ {
+ lstrcpyn(lf->lfFaceName,fontOptionsList[0].szDefFace,SIZEOF(lf->lfFaceName));
+ }else{
+ lstrcpyn(lf->lfFaceName,dbv.ptszVal,SIZEOF(lf->lfFaceName));
+ DBFreeVariant(&dbv);
+ }
+
+ mir_snprintf(str,sizeof(str),"Font%dSize",i);
+ lf->lfHeight=(char)DBGetContactSettingByte(NULL,SRMMMOD,str,fontOptionsList[0].defSize);
+ lf->lfWidth=0;
+ lf->lfEscapement=0;
+ lf->lfOrientation=0;
+ mir_snprintf(str,sizeof(str),"Font%dSty",i);
+ style=DBGetContactSettingByte(NULL,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,sizeof(str),"Font%dSet",i);
+ lf->lfCharSet=DBGetContactSettingByte(NULL,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,sizeof(str),"Font%d",i);
+ }
+}
+
+
+LRESULT CALLBACK MessageSubclassProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
+{
+ LRESULT lrRet=0;
+ WNDPROC OldMessageEditProc=(WNDPROC)GetWindowLongPtr(hwnd,GWL_USERDATA);
+
+ switch(message){
+ case WM_CHAR:
+ if (wParam=='\n' && GetKeyState(VK_CONTROL)&0x8000)
+ {
+ PostMessage(GetParent(hwnd),WM_COMMAND,IDOK,0);
+ return(0);
+ }
+ break;
+ }
+
+ if (OldMessageEditProc) lrRet=CallWindowProc(OldMessageEditProc,hwnd,message,wParam,lParam);
+
+return(lrRet);
+}
+
+
+
+
+//This function refresh account list.
+//It called when SMS plugin loaded and upon change in the account list.
+int RefreshAccountList(WPARAM eventCode,LPARAM lParam)
+{
+ SIZE_T dwAccCount=0,i,dwSMSAccountsCount=0;
+ PROTOACCOUNT **ppaAccounts;
+
+ ProtoEnumAccounts((int*)&dwAccCount,&ppaAccounts);
+
+ FreeAccountList();
+ ssSMSSettings.ppaSMSAccounts=(PROTOACCOUNT**)MEMALLOC((dwAccCount*sizeof(LPVOID)));
+ if (ssSMSSettings.ppaSMSAccounts)
+ {
+ char szServiceName[MAX_PATH];
+
+ for (i=0;i<dwAccCount;i++)
+ {
+ if (IsAccountEnabled(ppaAccounts[i]))
+ {
+ mir_snprintf(szServiceName,sizeof(szServiceName),"%s%s",ppaAccounts[i]->szModuleName,MS_ICQ_SENDSMS);
+ if (ServiceExists(szServiceName))
+ {
+ 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;
+}
+
+//This function check if the module is in the account list that supports sms sending in miranda.
+/*BOOL IsModuleInAccountList(LPSTR lpszModule)
+{
+ BOOL bRet=FALSE;
+
+ if (ssSMSSettings.ppaSMSAccounts && ssSMSSettings.dwSMSAccountsCount)
+ {
+ for(SIZE_T i=0;i<ssSMSSettings.dwSMSAccountsCount;i++)
+ {
+ if (CompareStringA(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),NORM_IGNORECASE,ssSMSSettings.ppaSMSAccounts[i]->szModuleName,-1,lpszModule,-1)==CSTR_EQUAL)
+ {
+ bRet=TRUE;
+ break;
+ }
+ }
+ }
+return(bRet);
+}//*/
+
diff --git a/plugins/SMS/langpack_sms.txt b/plugins/SMS/langpack_sms.txt new file mode 100644 index 0000000000..376dff2c65 --- /dev/null +++ b/plugins/SMS/langpack_sms.txt @@ -0,0 +1,119 @@ +Miranda Language Pack Version 1
+Language: English (UK) for Multi-Status Msgs
+Locale: 0809
+Last-Modified-Using: Miranda 0.2.1.0
+Authors: bid, NuKe007
+Author-email: electrodudez@yahoo.com, nuke007@nuke007.tk
+Plugins-included: SMS
+
+
+; !!!SMS by Nuke007!!!
+; The name of this file should be langpack_sms.txt and be in the miranda directory!
+; Under all the [STRING] put your desired text to replace, and in all places that has %d, %s, /r, /n please keep them, because it could cause problem
+
+[Send &SMS...]
+
+[&SMS Message]
+
+[Can't load SMS Plugin, ICQ protocol must be loaded.]
+
+[SMS Plugin Error]
+
+[Unknown]
+
+; Don't forget the %d, and this could be in other langpack files.
+[Custom %d]
+
+[Send SMS]
+
+[From %s on ICQ:\r\n\r\n]
+
+[Events]
+
+[SMS Plugin]
+
+[Multiple >>]
+
+[<< Single]
+
+[SMS message didn't send by ICQ to %s because:\r\n]
+
+[SMS Confirmation from %s]
+
+[SMS Message from %s]
+
+[Incoming SMS Message]
+
+[View User's History]
+
+[Add Number To The Multiple List]
+
+[Save Number To The User's Details Phonebook]
+
+[Show/Hide Multiple List]
+
+[Shows How Much Chars You've Typed]
+
+[The SMS message send to %s timed out.]
+
+[The phone number should start with a + and consist of numbers, spaces, brackets and hyphens only.]
+
+[Invalid Phone Number]
+
+[Error - Message too long]
+
+[Message is too long, press OK to continue.]
+
+[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.]
+
+[No Numbers]
+
+[There must be numbers in the list first.]
+
+[Signature:]
+
+[Put signature at the:]
+
+[Begining]
+
+[End]
+
+[Show server notifications:]
+
+[Yes]
+
+[No]
+
+[To:]
+
+[Number:]
+
+[Enter message:]
+
+[&Send]
+
+[&Close]
+
+[Chars:]
+
+[Save number]
+
+[Add number to list]
+
+[From:]
+
+[Message received:]
+
+[&Reply]
+
+[Message ID:]
+
+[Network:]
+
+[Source:]
+
+[&Ok]
+
+[&Try again]
+
+[&Cancel]
\ No newline at end of file diff --git a/plugins/SMS/main.cpp b/plugins/SMS/main.cpp new file mode 100644 index 0000000000..ac230164eb --- /dev/null +++ b/plugins/SMS/main.cpp @@ -0,0 +1,298 @@ +/*
+Miranda-IM SMS Plugin
+Copyright (C) 2001-2 Richard Hughes
+Copyright (C) 2007-8 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 "main.h"
+
+
+
+
+
+extern "C" __declspec(naked) void __cdecl _chkstk()
+{
+ #define _PAGESIZE_ 4096
+
+ __asm
+ {
+ push ecx
+
+ ; Calculate new TOS.
+
+ lea ecx, [esp] + 8 - 4 ; TOS before entering function + size for ret value
+ sub ecx, eax ; new TOS
+
+ ; Handle allocation size that results in wraparound.
+ ; Wraparound will result in StackOverflow exception.
+
+ sbb eax, eax ; 0 if CF==0, ~0 if CF==1
+ not eax ; ~0 if TOS did not wrapped around, 0 otherwise
+ and ecx, eax ; set to 0 if wraparound
+
+ mov eax, esp ; current TOS
+ and eax, not ( _PAGESIZE_ - 1) ; Round down to current page boundary
+
+ cs10:
+ cmp ecx, eax ; Is new TOS
+ jb short cs20 ; in probed page?
+ mov eax, ecx ; yes.
+ pop ecx
+ xchg esp, eax ; update esp
+ mov eax, dword ptr [eax] ; get return address
+ mov dword ptr [esp], eax ; and put it at new TOS
+ ret
+
+ ; Find next lower page and probe
+ cs20:
+ sub eax, _PAGESIZE_ ; decrease by PAGESIZE
+ test dword ptr [eax],eax ; probe page.
+ jmp short cs10
+
+ }
+}//
+
+
+extern "C" void __declspec(naked) __cdecl _aulldiv()
+{// http://tamiaode.3322.org/svn/ntldr/trunk/source/ntldr/ia32/x86stub.cpp
+ __asm
+ {
+ push ebx
+ push esi
+
+ mov eax,[esp + 24]
+ or eax,eax
+ jnz short L1
+
+ mov ecx,[esp + 20]
+ mov eax,[esp + 16]
+ xor edx,edx
+ div ecx
+ mov ebx,eax
+ mov eax,[esp + 12]
+ div ecx
+ mov edx,ebx
+ jmp short L2
+
+ L1:
+ mov ecx,eax
+ mov ebx,[esp + 20]
+ mov edx,[esp + 14]
+ mov eax,[esp + 12]
+
+ L3:
+ shr ecx,1
+ rcr ebx,1
+ shr edx,1
+ rcr eax,1
+ or ecx,ecx
+ jnz short L3
+ div ebx
+ mov esi,eax
+
+ mul dword ptr [esp + 24]
+ mov ecx,eax
+ mov eax,[esp + 20]
+ mul esi
+ add edx,ecx
+ jc short L4
+
+ cmp edx,[esp + 16]
+ ja short L4
+ jb short L5
+ cmp eax,[esp + 12]
+ jbe short L5
+ L4:
+ dec esi
+ L5:
+ xor edx,edx
+ mov eax,esi
+
+ L2:
+
+ pop esi
+ pop ebx
+
+ ret 16
+ }
+}//
+
+
+
+
+
+MM_INTERFACE mmi;
+PLUGINLINK *pluginLink;
+SMS_SETTINGS ssSMSSettings;
+
+
+PLUGININFOEX pluginInfoEx={
+ sizeof(PLUGININFOEX),
+ PROTOCOL_DISPLAY_NAME_ORIG" (Unicode)",
+ PLUGIN_VERSION_DWORD,
+ "Send SMS text messages to mobile phones through the IM networks ("__DATE__" "__TIME__")",
+ "Richard Hughes, Improved by Ariel Shulman, rewritten by Rozhuk Ivan",
+ "Rozhuk_I@mail.ru",
+ "© 2001-2 Richard Hughes, 2003 Ariel Shulman, 2007-2009 Rozhuk Ivan (Rozhuk_I@mail.ru)",
+ "http://miranda-icq.sourceforge.net/",
+ UNICODE_AWARE, //not transient
+ 0, //doesn't replace anything built-in
+ // {70AC2AC9-85C6-4624-9B05-24733FEBB052}
+ SMS_GUID
+};
+
+
+static const MUUID interfaces[]={SMS_GUID,MIID_LAST};
+
+
+
+int OnModulesLoaded (WPARAM wParam,LPARAM lParam);
+int OnPreShutdown (WPARAM wParam,LPARAM lParam);
+void VersionConversions();
+
+
+
+BOOL WINAPI DllMain(HINSTANCE hInstance,DWORD dwReason,LPVOID lpvReserved)
+{
+ switch(dwReason){
+ case DLL_PROCESS_ATTACH:
+ ZeroMemory(&ssSMSSettings,sizeof(ssSMSSettings));
+ ssSMSSettings.hInstance=hInstance;
+ ssSMSSettings.hHeap=HeapCreate(0,0,0);//GetProcessHeap();
+ DisableThreadLibraryCalls((HMODULE)hInstance);
+ break;
+ case DLL_PROCESS_DETACH:
+ HeapDestroy(ssSMSSettings.hHeap);
+ ssSMSSettings.hHeap=NULL;
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ break;
+ }
+return(TRUE);
+}
+
+__declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+{
+ if (mirandaVersion<MIN_MIR_VER_VERSION_DWORD)
+ {
+ MessageBox(NULL,TEXT("Pleace, update your Miranda IM, SMS will not load with this version."),NULL,(MB_OK|MB_ICONERROR));
+ return(NULL);
+ }
+return(&pluginInfoEx);
+}
+
+__declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion)
+{
+return((PLUGININFO*)MirandaPluginInfoEx(mirandaVersion));
+}
+
+
+__declspec(dllexport) const MUUID* MirandaPluginInterfaces()
+{
+return(interfaces);
+}
+
+
+
+int __declspec(dllexport) Load(PLUGINLINK *link)
+{
+ pluginLink=link;
+ mir_getMMI(&mmi);
+
+ ssSMSSettings.hHookModulesLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,OnModulesLoaded);
+ ssSMSSettings.hHookPreShutdown=HookEvent(ME_SYSTEM_PRESHUTDOWN,OnPreShutdown);
+
+ SendSMSWindowInitialize();
+ RecvSMSWindowInitialize();
+
+ LoadServices();
+
+return(0);
+}
+
+int __declspec(dllexport) Unload(void)
+{
+ UnloadServices();
+
+ if (ssSMSSettings.hHookPreShutdown) {UnhookEvent(ssSMSSettings.hHookPreShutdown); ssSMSSettings.hHookPreShutdown=NULL;}
+ if (ssSMSSettings.hHookModulesLoaded) {UnhookEvent(ssSMSSettings.hHookModulesLoaded); ssSMSSettings.hHookModulesLoaded=NULL;}
+
+ SecureZeroMemory(pluginLink,sizeof(pluginLink));
+ SecureZeroMemory(&mmi,sizeof(pluginLink));
+
+return(0);
+}
+
+
+int OnModulesLoaded(WPARAM wParam,LPARAM lParam)
+{
+ VersionConversions();
+
+ LoadModules();
+
+ CallService(MS_UPDATE_REGISTERFL,(WPARAM)SMS_PLUGIN_UPDATER_ID,(LPARAM)&pluginInfoEx);
+
+return(0);
+}
+
+
+int OnPreShutdown(WPARAM wParam,LPARAM lParam)
+{
+ UnloadModules();
+
+ RecvSMSWindowDestroy();
+ SendSMSWindowDestroy();
+ FreeAccountList();
+
+return(0);
+}
+
+
+
+void VersionConversions()
+{
+ WCHAR wsztm[MAX_PATH];
+
+ if (DB_SMS_GetStaticStringW(NULL,"UseSignature",wsztm,SIZEOF(wsztm),NULL))
+ {
+ DB_SMS_SetByte(NULL,"UseSignature",(wsztm[0]=='0'));
+ }else{
+ DB_SMS_SetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE);
+ }
+
+ if (DB_SMS_GetStaticStringW(NULL,"SignaturePos",wsztm,SIZEOF(wsztm),NULL))
+ {
+ DB_SMS_SetByte(NULL,"SignaturePos",(wsztm[0]=='0'));
+ }else{
+ DB_SMS_SetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS);
+ }
+
+ if (DB_SMS_GetStaticStringW(NULL,"ShowACK",wsztm,SIZEOF(wsztm),NULL))
+ {
+ DB_SMS_SetByte(NULL,"ShowACK",(wsztm[0]=='0'));
+ }else{
+ DB_SMS_SetByte(NULL,"ShowACK",SMS_DEFAULT_SHOWACK);
+ }
+
+}
\ No newline at end of file diff --git a/plugins/SMS/main.h b/plugins/SMS/main.h new file mode 100644 index 0000000000..8becfefb44 --- /dev/null +++ b/plugins/SMS/main.h @@ -0,0 +1,236 @@ +#ifndef _MAIN_H
+#define _MAIN_H
+
+
+
+
+#define _USE_32BIT_TIME_T
+#define _CRT_SECURE_NO_WARNINGS
+
+#define UNICODE
+#define _UNICODE
+
+#ifdef NDEBUG
+ #pragma optimize("gsy",on)
+ #pragma comment(linker,"/subsystem:Windows,5")
+ #pragma comment(linker,"/version:5")
+
+ #pragma comment(linker,"/nodefaultlib")
+ //#pragma comment(linker,"/GS")
+ //#pragma comment(linker,"/merge:.rdata=.text /merge:.data=.text")
+ //#pragma comment(linker,"/verbose")
+ //#pragma comment(linker,"/noentry")
+ #pragma comment(linker,"/ENTRY:DllMain")
+
+#endif //_DEBUG*/
+
+ //#pragma comment(linker,"/nodefaultlib")
+ //#pragma comment(linker,"/noentry")
+ //#pragma comment(linker,"/ENTRY:DllMain")
+
+#define CRTDLL
+
+#define MIRANDA_VER 0x0800
+
+
+#include "resource.h"
+#include <windows.h>
+#include <commctrl.h>
+#include <stdio.h>
+#include <time.h>
+#ifdef NDEBUG
+ #include <..\minicrt\minicrt.h>
+#else
+ #include <..\minicrt\timefuncs.h>
+#endif //_DEBUG*/
+
+#include <ListMT.h>
+#include <DebugFunctions.h>
+#include <MemoryCompare.h>
+#include <MemoryFind.h>
+#include <MemoryFindByte.h>
+#include <BuffToLowerCase.h>
+#include "newpluginapi.h"
+#include "m_database.h"
+#include "m_clist.h"
+#include "m_langpack.h"
+#include "m_history.h"
+#include "m_protomod.h"
+#include "m_autoreplacer.h"
+#include "resource.h"
+#include "m_skin.h"
+#include "m_protosvc.h"
+#include "m_icq.h"
+#include "m_protosvc.h"
+#include "m_system.h"
+#include "m_utils.h"
+#include "m_options.h"
+#include "m_updater.h"
+#include "win2k.h"
+
+
+// структура содержащая информацию по построению меню или расширеных иконок
+struct GUI_DISPLAY_ITEM
+{
+ LPSTR lpszName; // имя сервиса, оно же имя в иколибе
+ LPWSTR lpwszDescr; // текстовое описание отображаемое юзеру
+ LONG defIcon; // иконка из ресурсов
+ LPVOID lpFunc; // функция вызываемая меню
+};
+
+
+// структура содержащая информацию о сервисах/функциях
+struct SERVICE_ITEM
+{
+ LPSTR lpszName; // имя сервиса, оно же имя в иколибе
+ LPVOID lpFunc; // функция вызываемая
+};
+
+
+
+
+#include "SMSConstans.h"
+#include "senddlg.h"
+#include "recvdlg.h"
+
+
+
+#define MAIN_MENU_ITEMS_COUNT 1
+#define CONTACT_MENU_ITEMS_COUNT 1
+
+
+typedef struct
+{
+ HANDLE hHeap;
+ HINSTANCE hInstance;
+
+ //HANDLE hMainMenuIcons[MAIN_MENU_ITEMS_COUNT+1];
+ HANDLE hMainMenuItems[MAIN_MENU_ITEMS_COUNT+1];
+
+ //HANDLE hContactMenuIcons[CONTACT_MENU_ITEMS_COUNT+1];
+ HANDLE hContactMenuItems[CONTACT_MENU_ITEMS_COUNT+1];
+
+ HANDLE hHookModulesLoaded;
+ HANDLE hHookPreShutdown;
+ HANDLE hHookOptInitialize;
+ HANDLE hHookRebuildCMenu;
+ HANDLE hHookDbAdd;
+ HANDLE hHookProtoAck;
+ HANDLE hHookAccListChanged;
+
+ LIST_MT lmtSendSMSWindowsListMT;
+ LIST_MT lmtRecvSMSWindowsListMT;
+
+ PROTOACCOUNT **ppaSMSAccounts;
+ SIZE_T dwSMSAccountsCount;
+
+} SMS_SETTINGS;
+
+
+
+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 SEND_DLG_ITEM_MESSAGEW(hDlg,nIDDlgItem,Msg,wParam,lParam) SendMessageW(GetDlgItem(hDlg,nIDDlgItem),Msg,wParam,lParam)
+#define SEND_DLG_ITEM_MESSAGEA(hDlg,nIDDlgItem,Msg,wParam,lParam) SendMessageA(GetDlgItem(hDlg,nIDDlgItem),Msg,wParam,lParam)
+#define SEND_DLG_ITEM_MESSAGE(hDlg,nIDDlgItem,Msg,wParam,lParam) SendMessage(GetDlgItem(hDlg,nIDDlgItem),Msg,wParam,lParam)
+
+#define IS_DLG_BUTTON_CHECKED(hDlg,nIDDlgItem) SEND_DLG_ITEM_MESSAGE(hDlg,nIDDlgItem,BM_GETCHECK,NULL,NULL)
+#define CHECK_DLG_BUTTON(hDlg,nIDDlgItem,uCheck) SEND_DLG_ITEM_MESSAGE(hDlg,nIDDlgItem,BM_SETCHECK,(WPARAM)uCheck,NULL)
+
+#define SET_DLG_ITEM_TEXTW(hDlg,nIDDlgItem,lpString) SEND_DLG_ITEM_MESSAGEW(hDlg,nIDDlgItem,WM_SETTEXT,0,(LPARAM)lpString)
+#define SET_DLG_ITEM_TEXTA(hDlg,nIDDlgItem,lpString) SEND_DLG_ITEM_MESSAGEA(hDlg,nIDDlgItem,WM_SETTEXT,0,(LPARAM)lpString)
+#define SET_DLG_ITEM_TEXT(hDlg,nIDDlgItem,lpString) SEND_DLG_ITEM_MESSAGE(hDlg,nIDDlgItem,WM_SETTEXT,0,(LPARAM)lpString)
+
+#define GET_DLG_ITEM_TEXTW(hDlg,nIDDlgItem,lpString,nMaxCount) SEND_DLG_ITEM_MESSAGEW(hDlg,nIDDlgItem,WM_GETTEXT,(WPARAM)nMaxCount,(LPARAM)lpString)
+#define GET_DLG_ITEM_TEXTA(hDlg,nIDDlgItem,lpString,nMaxCount) SEND_DLG_ITEM_MESSAGEA(hDlg,nIDDlgItem,WM_GETTEXT,(WPARAM)nMaxCount,(LPARAM)lpString)
+#define GET_DLG_ITEM_TEXT(hDlg,nIDDlgItem,lpString,nMaxCount) SEND_DLG_ITEM_MESSAGE(hDlg,nIDDlgItem,WM_GETTEXT,(WPARAM)nMaxCount,(LPARAM)lpString)
+
+#define GET_DLG_ITEM_TEXT_LENGTH(hDlg,nIDDlgItem) SEND_DLG_ITEM_MESSAGE(hDlg,nIDDlgItem,WM_GETTEXTLENGTH,NULL,NULL)
+#define GET_WINDOW_TEXT_LENGTH(hDlg) SendMessage(hDlg,WM_GETTEXTLENGTH,NULL,NULL)
+
+#define GET_CURRENT_COMBO_DATA(hWndDlg,ControlID) SEND_DLG_ITEM_MESSAGE(hWndDlg,ControlID,CB_GETITEMDATA,SEND_DLG_ITEM_MESSAGE(hWndDlg,ControlID,CB_GETCURSEL,0,0),0)
+
+
+
+
+#define GetContactNameA(Contact) (LPSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)Contact,0)
+#define GetContactNameW(Contact) (LPWSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)Contact,GCDNF_UNICODE)
+
+#define DB_SMS_DeleteValue(Contact,valueName) DBDeleteContactSetting(Contact,PROTOCOL_NAMEA,valueName)
+#define DB_SMS_GetDword(Contact,valueName,parDefltValue) DBGetContactSettingDword(Contact,PROTOCOL_NAMEA,valueName,parDefltValue)
+#define DB_SMS_SetDword(Contact,valueName,parValue) DBWriteContactSettingDword(Contact,PROTOCOL_NAMEA,valueName,parValue)
+#define DB_SMS_GetWord(Contact,valueName,parDefltValue) DBGetContactSettingWord(Contact,PROTOCOL_NAMEA,valueName,parDefltValue)
+#define DB_SMS_SetWord(Contact,valueName,parValue) DBWriteContactSettingWord(Contact,PROTOCOL_NAMEA,valueName,parValue)
+#define DB_SMS_GetByte(Contact,valueName,parDefltValue) DBGetContactSettingByte(Contact,PROTOCOL_NAMEA,valueName,parDefltValue)
+#define DB_SMS_SetByte(Contact,valueName,parValue) DBWriteContactSettingByte(Contact,PROTOCOL_NAMEA,valueName,parValue)
+BOOL DB_GetStaticStringW(HANDLE 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,PROTOCOL_NAMEA,ValueName,Ret,RetBuffSize,pRetBuffSize)
+BOOL DB_SetStringExW(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpwszValue,SIZE_T dwValueSize);
+#define DB_SetStringW(Contact,Module,valueName,parValue) DBWriteContactSettingWString(Contact,Module,valueName,parValue)
+#define DB_SMS_SetStringW(Contact,valueName,parValue) DBWriteContactSettingWString(Contact,PROTOCOL_NAMEA,valueName,parValue)
+#define DB_SMS_SetStringExW(Contact,valueName,parValue,parValueSize) DB_SetStringExW(Contact,PROTOCOL_NAMEA,valueName,parValue,parValueSize)
+
+
+LPSTR GetModuleName (HANDLE hContact);
+void EnableControlsArray (HWND hWndDlg,WORD *pwControlsList,SIZE_T dwControlsListCount,BOOL bEnabled);
+void CListShowMenuItem (HANDLE hMenuItem,BOOL bShow);
+//Decleration 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 (HANDLE hContact);
+BOOL IsContactPhone (HANDLE hContact,LPWSTR lpwszPhone,SIZE_T dwPhoneSize);
+//Decleration of function that returns HANDLE of contact by his cellular number
+HANDLE 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);
+//Decleration 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,...);
+//BOOL GetXMLFieldExW (LPWSTR lpwszXML,SIZE_T dwXMLSize,LPWSTR *plpwszData,SIZE_T *pdwDataSize,const WCHAR *tag1,...);
+//BOOL GetXMLFieldExBuffW (LPWSTR lpwszXML,SIZE_T dwXMLSize,LPWSTR lpwszBuff,SIZE_T dwBuffSize,SIZE_T *pdwBuffSizeRet,const WCHAR *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);
+LRESULT CALLBACK MessageSubclassProc (HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
+int RefreshAccountList (WPARAM eventCode,LPARAM lParam);
+void FreeAccountList ();
+//BOOL IsModuleInAccountList (LPSTR lpszModule);
+
+
+
+
+int OptInitialise (WPARAM wParam,LPARAM lParam);
+
+int LoadServices ();
+int LoadModules ();
+void UnloadModules ();
+void UnloadServices ();
+
+int handleAckSMS(WPARAM wParam,LPARAM lParam);
+int handleNewMessage(WPARAM wParam,LPARAM lParam);
+void RestoreUnreadMessageAlerts();
+
+//Decleration 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
\ No newline at end of file diff --git a/plugins/SMS/options.cpp b/plugins/SMS/options.cpp new file mode 100644 index 0000000000..dd52602484 --- /dev/null +++ b/plugins/SMS/options.cpp @@ -0,0 +1,116 @@ +/*
+Miranda-IM SMS Plugin
+Copyright (C) 2001-2002 Richard Hughes
+Copyright (C) 2007-2009 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 "main.h"
+
+
+
+WORD wSMSSignControlsList[]={
+ IDC_BEGIN,
+ IDC_END,
+ IDC_SIGNATURE,
+ IDC_SIGNGROUP
+};
+
+
+BOOL CALLBACK DlgProcEditorOptions(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch(msg){
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hWndDlg);
+ {
+ WCHAR wszSign[1024];
+ BOOL bSignBebefore,bUseSign;
+
+ if (DB_SMS_GetStaticStringW(NULL,"Signature",wszSign,SIZEOF(wszSign),NULL)==FALSE)
+ {
+ mir_sntprintf(wszSign,SIZEOF(wszSign),TranslateW(L"From %s:\r\n\r\n"),GetContactNameW(NULL));
+ }
+ SET_DLG_ITEM_TEXTW(hWndDlg,IDC_SIGNATURE,wszSign);
+
+ bUseSign=DB_SMS_GetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE);
+ CHECK_DLG_BUTTON(hWndDlg,IDC_USESIGNATURE,bUseSign);
+ EnableControlsArray(hWndDlg,(WORD*)&wSMSSignControlsList,SIZEOF(wSMSSignControlsList),bUseSign);
+
+ bSignBebefore=DB_SMS_GetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS);
+ CHECK_DLG_BUTTON(hWndDlg,IDC_BEGIN,bSignBebefore);
+ CHECK_DLG_BUTTON(hWndDlg,IDC_END,(!bSignBebefore));
+
+ CHECK_DLG_BUTTON(hWndDlg,IDC_SHOWACK,DB_SMS_GetByte(NULL,"ShowACK",SMS_DEFAULT_SHOWACK));
+ CHECK_DLG_BUTTON(hWndDlg,IDC_AUTOPOP,DB_SMS_GetByte(NULL,"AutoPopup",SMS_DEFAULT_AUTOPOP));
+ CHECK_DLG_BUTTON(hWndDlg,IDC_SAVEWINPOS,DB_SMS_GetByte(NULL,"SavePerContact",SMS_DEFAULT_SAVEWINPOS));
+ }
+ return(TRUE);
+ case WM_COMMAND:
+ SendMessage(GetParent(hWndDlg),PSM_CHANGED,0,0);
+ switch(LOWORD(wParam)){
+ case IDC_USESIGNATURE:
+ EnableControlsArray(hWndDlg,(WORD*)&wSMSSignControlsList,SIZEOF(wSMSSignControlsList),IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_USESIGNATURE));
+ break;
+ }
+ break;
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom){
+ case 0:
+ switch (((LPNMHDR)lParam)->code){
+ case PSN_APPLY:
+ {
+ WCHAR wszSign[1024];
+
+ GET_DLG_ITEM_TEXTW(hWndDlg,IDC_SIGNATURE,wszSign,SIZEOF(wszSign));
+ DB_SMS_SetStringW(NULL,"Signature",wszSign);
+
+ DB_SMS_SetByte(NULL,"UseSignature",IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_USESIGNATURE));
+ DB_SMS_SetByte(NULL,"SignaturePos",IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_BEGIN));
+ DB_SMS_SetByte(NULL,"ShowACK",IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_SHOWACK));
+ DB_SMS_SetByte(NULL,"AutoPopup",IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_AUTOPOP));
+ DB_SMS_SetByte(NULL,"SavePerContact",IS_DLG_BUTTON_CHECKED(hWndDlg,IDC_SAVEWINPOS));
+ }
+ return(TRUE);
+ }
+ break;
+ }
+ break;
+ }
+return(FALSE);
+}
+
+int OptInitialise(WPARAM wParam,LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp={0};
+
+ odp.cbSize=sizeof(odp);
+ odp.position=910000000;
+ odp.hInstance=ssSMSSettings.hInstance;
+ odp.ptszGroup=TranslateW(L"Events");
+ odp.flags=(ODPF_BOLDGROUPS|ODPF_UNICODE);
+ odp.pszTemplate=MAKEINTRESOURCEA(IDD_OPT_SMSPLUGIN);
+ odp.ptszTitle=PROTOCOL_DISPLAY_NAME_ORIGW;
+ odp.pfnDlgProc=DlgProcEditorOptions;
+ CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+return(0);
+}
+
diff --git a/plugins/SMS/readme.txt b/plugins/SMS/readme.txt new file mode 100644 index 0000000000..3fe787fec8 --- /dev/null +++ b/plugins/SMS/readme.txt @@ -0,0 +1,49 @@ +SMS плагин для Miranda IM
+
+
+2001-2002 Richard Hughes
+2003 Ariel Shulman
+2007-2009 Rozhuk Ivan (Ivan 83)
+
+
+ Плагин предназначен для отправки SMS сообщений через миранду
+с использованием ICQ, MRA и других протоколов поддерживающих отправку SMS.
+
+ Эта версия плагина была переписана почти полностью, сохранены без изменений
+только диалоги и часть коментариев.
+
+
+Home page: http://www.rozhuk.org.ru/forum/index.php?topic=3.0
+
+
+
+
+Change Log:
+
+Version 0.2.5.3 // 02.11.2009
+ - Поддержка Updater плагина
+
+Version 0.2.5.2 // 01.11.2009
+ - Unicode версия
+ - Поддержка мультиакаунтов
+ - Добавлены настройки
+ - Внутренние изменения
+ - Частично используются иконки из миранды (Main Icons)
+ - Исправлены недочёты при обработке XML
+ - Улучшен алгоритм подсчёта "оставшихся" символов
+
+Version 0.2.5.1 // 26.10.2009
+ - В диалоге отправки автоматически выбирается первый номер телефона из списка
+ - Настройки шрифтов и цветов фона берутся от TabSRMM
+ - Уменьшен размер плагина
+ - Устранены утечки ресурсов
+ - Устранено появление ложных пустых сообщений от джабер протокола
+
+Version 0.2.5.0 // 17.03.2008
+ - Добавлена совместимость с новым ядром (GUID идентификатор)
+
+Version 0.2.4.9
+ - Полностью переписан код: оптимизирован, устранены утечки памяти
+ - Добавленна возможность выбора потокола для отправки сообщений
+ - Автоподстановка номера при ответе
+ - Мелкие исправлени
\ No newline at end of file diff --git a/plugins/SMS/receive.cpp b/plugins/SMS/receive.cpp new file mode 100644 index 0000000000..24a1df5be5 --- /dev/null +++ b/plugins/SMS/receive.cpp @@ -0,0 +1,310 @@ +/*
+Miranda-IM SMS Plugin
+Copyright (C) 2001-2 Richard Hughes
+Copyright (C) 2007-2009 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 "main.h"
+
+
+
+//This function handles the ACK received from that hooked.
+int handleAckSMS(WPARAM wParam,LPARAM lParam)
+{
+ if (lParam)
+ if (((ACKDATA*)lParam)->type==ICQACKTYPE_SMS)
+ {
+ char szPhone[MAX_PHONE_LEN]={0};
+ WCHAR wszPhone[MAX_PHONE_LEN]={0};
+ LPSTR lpszXML=(LPSTR)((ACKDATA*)lParam)->lParam,lpszData,lpszPhone;
+ SIZE_T dwXMLSize=lstrlenA(lpszXML),dwDataSize,dwPhoneSize;
+ ACKDATA *ack=((ACKDATA*)lParam);
+
+ if (GetXMLFieldEx(lpszXML,dwXMLSize,&lpszData,&dwDataSize,"sms_message","text",NULL))
+ {
+ if (GetXMLFieldEx(lpszXML,dwXMLSize,&lpszPhone,&dwPhoneSize,"sms_message","sender",NULL))
+ {
+ LPSTR lpszMessageUTF;
+ LPWSTR lpwszMessageXMLEncoded,lpwszMessageXMLDecoded;
+ SIZE_T dwBuffLen,dwMessageXMLEncodedSize,dwMessageXMLDecodedSize;
+ HANDLE hContact;
+ DBEVENTINFO dbei={0};
+
+ dwBuffLen=(dwDataSize+MAX_PATH);
+ dbei.pBlob=(LPBYTE)MEMALLOC((dwBuffLen+dwPhoneSize));
+ lpwszMessageXMLEncoded=(LPWSTR)MEMALLOC((dwBuffLen*sizeof(WCHAR)));
+ lpwszMessageXMLDecoded=(LPWSTR)MEMALLOC((dwBuffLen*sizeof(WCHAR)));
+ if (dbei.pBlob && lpwszMessageXMLEncoded && lpwszMessageXMLDecoded)
+ {
+ dwMessageXMLEncodedSize=MultiByteToWideChar(CP_UTF8,0,lpszData,dwDataSize,lpwszMessageXMLEncoded,dwBuffLen);
+ DecodeXML(lpwszMessageXMLEncoded,dwMessageXMLEncodedSize,lpwszMessageXMLDecoded,dwBuffLen,&dwMessageXMLDecodedSize);
+ lpszMessageUTF=(LPSTR)lpwszMessageXMLEncoded;
+ WideCharToMultiByte(CP_UTF8,0,lpwszMessageXMLDecoded,dwMessageXMLDecodedSize,lpszMessageUTF,dwBuffLen,NULL,NULL);
+
+ dwPhoneSize=CopyNumberA(szPhone,lpszPhone,dwPhoneSize);
+ dwPhoneSize=MultiByteToWideChar(CP_UTF8,0,szPhone,dwPhoneSize,wszPhone,MAX_PHONE_LEN);
+ hContact=HContactFromPhone(wszPhone,dwPhoneSize);
+
+ dbei.cbSize=sizeof(dbei);
+ dbei.szModule=GetModuleName(hContact);
+ dbei.timestamp=time(NULL);
+ 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;
+ CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&dbei);
+ if (hContact==NULL)
+ {
+ if (RecvSMSWindowAdd(NULL,ICQEVENTTYPE_SMS,wszPhone,dwPhoneSize,(LPSTR)dbei.pBlob,dbei.cbBlob))
+ {
+ CallService(MS_DB_EVENT_MARKREAD,(WPARAM)hContact,(LPARAM)&dbei);
+ SkinPlaySound("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))
+ {
+ HANDLE hContact;
+ DBEVENTINFO dbei={0};
+
+ dwPhoneSize=CopyNumberA(szPhone,lpszPhone,dwPhoneSize);
+ dwPhoneSize=MultiByteToWideChar(CP_UTF8,0,szPhone,dwPhoneSize,wszPhone,MAX_PHONE_LEN);
+ hContact=HContactFromPhone(wszPhone,dwPhoneSize);
+
+ dbei.cbSize=sizeof(dbei);
+ dbei.szModule=GetModuleName(hContact);
+ dbei.timestamp=time(NULL);
+ dbei.eventType=ICQEVENTTYPE_SMSCONFIRMATION;
+ if (CompareStringA(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),NORM_IGNORECASE,lpszData,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=(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);
+ CopyMemory((dbei.pBlob+dbei.cbBlob),lpszData,dwDataSize);
+ dbei.cbBlob+=(dwDataSize+sizeof(DWORD));
+ (*((DWORD*)(dbei.pBlob+(dbei.cbBlob-sizeof(DWORD)))))=0;
+ }
+ }
+
+ if (dbei.pBlob)
+ {
+ if (hContact)
+ {
+ CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&dbei);
+ }else{
+ RecvSMSWindowAdd(NULL,ICQEVENTTYPE_SMSCONFIRMATION,wszPhone,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),NULL,"sms_response","network",NULL);
+
+ if (ack->result==ACKRESULT_FAILED || CompareStringA(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),NORM_IGNORECASE,lpszData,dwDataSize,"no",2)==CSTR_EQUAL)
+ {
+ HWND hwndTimeOut;
+ char szBuff[1024];
+ WCHAR wszErrorMessage[1028];
+ LPSTR lpszErrorDescription;
+
+ if (SendSMSWindowMultipleGet(hWndDlg))
+ {
+ TVITEM tvi;
+ tvi.mask=TVIF_TEXT;
+ tvi.hItem=SendSMSWindowHItemSendGet(hWndDlg);
+ tvi.pszText=wszPhone;
+ tvi.cchTextMax=SIZEOF(wszPhone);
+ TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi);
+ }else{
+ GET_DLG_ITEM_TEXTW(hWndDlg,IDC_ADDRESS,wszPhone,SIZEOF(szPhone));
+ }
+
+ if (ack->result==ACKRESULT_FAILED)
+ {
+ lpszErrorDescription=lpszXML;
+ }else{
+ lpszErrorDescription=szBuff;
+ GetXMLFieldExBuff(lpszXML,dwXMLSize,szBuff,sizeof(szBuff),NULL,"sms_response","error","params","param",NULL);
+ }
+
+ mir_sntprintf(wszErrorMessage,SIZEOF(wszErrorMessage),TranslateW(L"SMS message didn't send by %S to %s because: %S"),szNetwork,wszPhone,lpszErrorDescription);
+ ShowWindow(hWndDlg,SW_SHOWNORMAL);
+ EnableWindow(hWndDlg,FALSE);
+ hwndTimeOut=CreateDialog(ssSMSSettings.hInstance,MAKEINTRESOURCE(IDD_SENDSMSTIMEDOUT),hWndDlg,SMSTimedOutDlgProc);
+ SET_DLG_ITEM_TEXTW(hwndTimeOut,IDC_STATUS,wszErrorMessage);
+ }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,dwDataSize,"yes",3)==CSTR_EQUAL || CompareStringA(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),NORM_IGNORECASE,lpszData,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,dwDataSize,"yes",3)==CSTR_EQUAL)
+ {
+ GetXMLFieldExBuff(lpszXML,dwXMLSize,szSource,sizeof(szSource),NULL,"sms_response","source",NULL);
+ GetXMLFieldExBuff(lpszXML,dwXMLSize,szMessageID,sizeof(szMessageID),NULL,"sms_response","message_id",NULL);
+ }else{
+ SET_DLG_ITEM_TEXTW(hwndAccepted,IDC_ST_SOURCE,TranslateW(L"From:"));
+ SET_DLG_ITEM_TEXTW(hwndAccepted,IDC_ST_MESSAGEID,TranslateW(L"To:"));
+ GetXMLFieldExBuff(lpszXML,dwXMLSize,szSource,sizeof(szSource),NULL,"sms_response","from",NULL);
+ GetXMLFieldExBuff(lpszXML,dwXMLSize,szMessageID,sizeof(szMessageID),NULL,"sms_response","to",NULL);
+ }
+ SET_DLG_ITEM_TEXTA(hwndAccepted,IDC_NETWORK,szNetwork);
+ SET_DLG_ITEM_TEXTA(hwndAccepted,IDC_SOURCE,szSource);
+ SET_DLG_ITEM_TEXTA(hwndAccepted,IDC_MESSAGEID,szMessageID);
+ }else{
+ SendSMSWindowRemove(hWndDlg);
+ }
+ }else{
+ SendSMSWindowRemove(hWndDlg);
+ }
+ }
+ }
+ }
+ }
+ }
+return(0);
+}
+
+//Handles new SMS messages added to the database
+int handleNewMessage(WPARAM wParam,LPARAM lParam)
+{
+ CHAR szServiceFunction[MAX_PATH],*pszServiceFunctionName;
+ WCHAR szToolTip[MAX_PATH];
+ HANDLE hContact=(HANDLE)wParam,hDbEvent=(HANDLE)lParam;
+ CLISTEVENT cle={0};
+ DBEVENTINFO dbei={0};
+
+ dbei.cbSize=sizeof(dbei);
+ if ((dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE,lParam,0))!=-1)
+ {
+ dbei.pBlob=(PBYTE)MEMALLOC(dbei.cbBlob);
+ if (dbei.pBlob)
+ {
+ CopyMemory(szServiceFunction,PROTOCOL_NAMEA,PROTOCOL_NAME_SIZE);
+ pszServiceFunctionName=szServiceFunction+PROTOCOL_NAME_LEN;
+
+ if (CallService(MS_DB_EVENT_GET,lParam,(LPARAM)&dbei)==0)
+ if ((dbei.flags&DBEF_SENT)==0)
+ if (dbei.eventType==ICQEVENTTYPE_SMS)
+ {
+ if (dbei.cbBlob>MIN_SMS_DBEVENT_LEN)
+ {
+ SkinPlaySound("RecvSMSMsg");
+ if (DB_SMS_GetByte(NULL,"AutoPopup",0))
+ {
+ if (RecvSMSWindowAdd(hContact,ICQEVENTTYPE_SMS,NULL,0,(LPSTR)dbei.pBlob,dbei.cbBlob))
+ {
+ CallService(MS_DB_EVENT_MARKREAD,(WPARAM)hContact,(LPARAM)&dbei);
+ }
+ }else{
+ CopyMemory(pszServiceFunctionName,SMS_READ,sizeof(SMS_READ));
+
+ cle.cbSize=sizeof(cle);
+ cle.flags=CLEF_UNICODE;
+ cle.hContact=hContact;
+ cle.hDbEvent=hDbEvent;
+ cle.hIcon=LoadSkinnedIcon(SKINICON_OTHER_SMS);
+ cle.pszService=szServiceFunction;
+ mir_sntprintf(szToolTip,SIZEOF(szToolTip),TranslateW(L"SMS Message from %s"),GetContactNameW(hContact));
+ cle.ptszTooltip=szToolTip;
+ CallService(MS_CLIST_ADDEVENT,0,(LPARAM)&cle);
+ }
+ }
+ }else
+ if (dbei.eventType==ICQEVENTTYPE_SMSCONFIRMATION)
+ {
+ SkinPlaySound("RecvSMSConfirmation");
+ if (DB_SMS_GetByte(NULL,"AutoPopup",0))
+ {
+ if (RecvSMSWindowAdd(hContact,ICQEVENTTYPE_SMSCONFIRMATION,NULL,0,(LPSTR)dbei.pBlob,dbei.cbBlob))
+ {
+ CallService(MS_DB_EVENT_DELETE,(WPARAM)hContact,(LPARAM)&dbei);
+ }
+ }else{
+ UINT iIcon;
+
+ if (GetDataFromMessage((LPSTR)dbei.pBlob,dbei.cbBlob,NULL,NULL,0,NULL,&iIcon))
+ {
+ CopyMemory(pszServiceFunctionName,SMS_READ_ACK,sizeof(SMS_READ_ACK));
+
+ cle.cbSize=sizeof(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;
+ mir_sntprintf(szToolTip,SIZEOF(szToolTip),TranslateW(L"SMS Confirmation from %s"),GetContactNameW(hContact));
+ cle.ptszTooltip=szToolTip;
+ CallService(MS_CLIST_ADDEVENT,0,(LPARAM)&cle);
+ }
+ }
+ }
+ MEMFREE(dbei.pBlob);
+ }
+ }
+return(0);
+}
+
+
diff --git a/plugins/SMS/recvdlg.cpp b/plugins/SMS/recvdlg.cpp new file mode 100644 index 0000000000..ec3998edfc --- /dev/null +++ b/plugins/SMS/recvdlg.cpp @@ -0,0 +1,269 @@ +/*
+Miranda-IM SMS Plugin
+Copyright (C) 2001-2 Richard Hughes
+Copyright (C) 2007-2009 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 "main.h"
+#include "recvdlg.h"
+
+//Defnition needed to the SMS window list
+typedef struct
+{
+ LIST_MT_ITEM lmtListMTItem;
+ HWND hWnd;
+ HBRUSH hBkgBrush;
+ HANDLE hContact;
+} RECV_SMS_WINDOW_DATA;
+
+
+
+BOOL CALLBACK RecvSmsDlgProc (HWND hWndDlg,UINT message,WPARAM wParam,LPARAM lParam);
+#define GET_WINDOW_DATA(hWndDlg) ((RECV_SMS_WINDOW_DATA*)GetWindowLongPtr(hWndDlg,GWL_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,NULL,(LPVOID*)&prswdWindowData)==NO_ERROR)
+ {// цикл
+ RecvSMSWindowRemove(prswdWindowData->hWnd);
+ }
+ ListMTUnLock(&ssSMSSettings.lmtRecvSMSWindowsListMT);
+ ListMTDestroy(&ssSMSSettings.lmtRecvSMSWindowsListMT);
+}
+
+
+BOOL 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,GWL_USERDATA,(LONG_PTR)lParam);
+
+ {
+ WNDPROC OldEditWndProc;
+
+ OldEditWndProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hWndDlg,IDC_MESSAGE),GWL_WNDPROC,(LONG_PTR)MessageSubclassProc);
+ SetWindowLongPtr(GetDlgItem(hWndDlg,IDC_MESSAGE),GWL_USERDATA,(LONG_PTR)OldEditWndProc);
+ }
+
+ {
+ HFONT hFont;
+ LOGFONT lf;
+ hFont=(HFONT)SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,WM_GETFONT,0,0);
+ if (hFont && hFont!=(HFONT)SEND_DLG_ITEM_MESSAGE(hWndDlg,IDOK,WM_GETFONT,0,0)) DeleteObject(hFont);
+ LoadMsgDlgFont(MSGFONTID_YOURMSG,&lf,NULL);
+ hFont=CreateFontIndirect(&lf);
+ SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(TRUE,0));
+
+ COLORREF colour=DBGetContactSettingDword(NULL,SRMMMOD,SRMSGSET_BKGCOLOUR,SRMSGDEFSET_BKGCOLOUR);
+ prswdWindowData->hBkgBrush=CreateSolidBrush(colour);
+ }
+
+ if (Utils_RestoreWindowPosition(hWndDlg,(DB_SMS_GetByte(NULL,"SavePerContact",0)? prswdWindowData->hContact:NULL),PROTOCOL_NAMEA,"recv"))
+ {// def pos
+ SetWindowPos(hWndDlg,0,200,200,400,350,SWP_NOZORDER);
+ }
+ InvalidateRect(GetDlgItem(hWndDlg,IDC_MESSAGE),NULL,FALSE);
+ break;
+ case WM_CTLCOLORSTATIC:
+ if ((HWND)lParam==GetDlgItem(hWndDlg,IDC_MESSAGE))
+ {
+ COLORREF colour;
+
+ LoadMsgDlgFont(MSGFONTID_YOURMSG,NULL,&colour);
+ SetTextColor((HDC)wParam,colour);
+ SetBkColor((HDC)wParam,DBGetContactSettingDword(NULL,SRMMMOD,SRMSGSET_BKGCOLOUR,SRMSGDEFSET_BKGCOLOUR));
+ return((BOOL)prswdWindowData->hBkgBrush);
+ }
+ break;
+ case WM_GETMINMAXINFO:
+ ((LPMINMAXINFO)lParam)->ptMinTrackSize.x=300;
+ ((LPMINMAXINFO)lParam)->ptMinTrackSize.y=230;
+ break;
+ case WM_SIZE:
+ {
+ int cx,cy;
+ RECT rcWin;
+
+ GetWindowRect(hWndDlg,&rcWin);
+ cx = rcWin.right - rcWin.left;
+ cy = rcWin.bottom - rcWin.top;
+ SetWindowPos(GetDlgItem(hWndDlg,IDC_MESSAGE),0,0,0,cx - 14,cy - 112,SWP_NOZORDER|SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg,IDC_NAME),0,0,0,(cx*35)/100,20,SWP_NOZORDER|SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg,IDC_NUMBER),0,cx - (cx*35)/100 - 11,5,(cx*35)/100,20,SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg,IDC_ST_NUMBER),0,cx - (cx*35)/100 - 58,5,40,20,SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg,IDC_READNEXT),0,cx - 87, cy - 60,80,25,SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg,IDOK),0,cx/2 - 87,cy - 60,80,25,SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg,IDCANCEL),0,cx/2 + 7,cy - 60,80,25,SWP_NOZORDER);
+
+ RedrawWindow(hWndDlg,NULL,NULL,RDW_FRAME|RDW_INVALIDATE);
+ }
+ break;
+ case WM_COMMAND:
+ switch(LOWORD(wParam)){
+ case IDOK:
+ {
+ WCHAR wszPhone[MAX_PHONE_LEN];
+ HWND hwndSendSms;
+ HANDLE hContact;
+
+ hContact=HContactFromPhone(wszPhone,GET_DLG_ITEM_TEXTW(hWndDlg,IDC_NUMBER,wszPhone,SIZEOF(wszPhone)));
+ hwndSendSms=SendSMSWindowIsOtherInstanceHContact(hContact);
+ if (hwndSendSms)
+ {
+ SetFocus(hwndSendSms);
+ }else{
+ hwndSendSms=SendSMSWindowAdd(prswdWindowData->hContact);
+ SET_DLG_ITEM_TEXTW(hwndSendSms,IDC_ADDRESS,wszPhone);
+ }
+ }
+ 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(HANDLE hContact,DWORD dwEventType,LPWSTR lpwszPhone,SIZE_T dwPhoneSize,LPSTR lpszMessage,SIZE_T dwMessageSize)
+{
+ HWND hRet=NULL;
+
+ if ((dwPhoneSize+dwMessageSize)>MIN_SMS_DBEVENT_LEN)
+ {
+ LPWSTR lpwszMessage;
+
+ lpwszMessage=(LPWSTR)MEMALLOC(((dwMessageSize+MAX_PATH)*sizeof(WCHAR)));
+ if (lpwszMessage)
+ {
+ 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),NULL,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=TranslateW(L"Received SMS");
+ hIcon=LoadSkinnedIcon(SKINICON_OTHER_SMS);
+ break;
+ case ICQEVENTTYPE_SMSCONFIRMATION:
+ lpwszTitlepart=TranslateW(L"Received SMS Confirmation");
+ GetDataFromMessage(lpszMessage,dwMessageSize,NULL,NULL,0,NULL,&iIcon);
+ hIcon=(HICON)LoadImage(ssSMSSettings.hInstance,MAKEINTRESOURCE(iIcon),IMAGE_ICON,0,0,LR_SHARED);
+ break;
+ default:
+ lpwszTitlepart=L"Unknown event type";
+ }
+
+ wszPhoneLocal[0]='+';
+ if (dwPhoneSize)
+ {
+ dwPhoneSize=CopyNumberW((wszPhoneLocal+1),lpwszPhone,dwPhoneSize);
+ }else{
+ GetDataFromMessage(lpszMessage,dwMessageSize,NULL,(wszPhoneLocal+1),(SIZEOF(wszPhoneLocal)-1),&dwPhoneSize,NULL);
+ dwPhoneSize++;
+ }
+
+ lpwszContactDisplayName=GetContactNameW(hContact);
+ mir_sntprintf(wszTitle,SIZEOF(wszTitle),L"%s - %s",lpwszContactDisplayName,lpwszTitlepart);
+ MultiByteToWideChar(CP_UTF8,0,lpszMessage,dwMessageSize,lpwszMessage,(dwMessageSize+MAX_PATH));
+
+ SendMessageW(prswdWindowData->hWnd,WM_SETTEXT,NULL,(LPARAM)wszTitle);
+ SET_DLG_ITEM_TEXTW(prswdWindowData->hWnd,IDC_NAME,lpwszContactDisplayName);
+ SET_DLG_ITEM_TEXTW(prswdWindowData->hWnd,IDC_NUMBER,wszPhoneLocal);
+ SET_DLG_ITEM_TEXTW(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),PROTOCOL_NAMEA,"recv");
+
+ ListMTLock(&ssSMSSettings.lmtRecvSMSWindowsListMT);
+ ListMTItemDelete(&ssSMSSettings.lmtRecvSMSWindowsListMT,&prswdWindowData->lmtListMTItem);
+ ListMTUnLock(&ssSMSSettings.lmtRecvSMSWindowsListMT);
+ MEMFREE(prswdWindowData);
+ }
+ DestroyWindow(hWndDlg);
+}
+
diff --git a/plugins/SMS/recvdlg.h b/plugins/SMS/recvdlg.h new file mode 100644 index 0000000000..a34231b255 --- /dev/null +++ b/plugins/SMS/recvdlg.h @@ -0,0 +1,18 @@ +#if !defined(AFX_SMS_RECVDLG_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_)
+#define AFX_SMS_RECVDLG_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_
+
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+
+DWORD RecvSMSWindowInitialize ();
+void RecvSMSWindowDestroy ();
+HWND RecvSMSWindowAdd (HANDLE 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/res/SMSNOTSENT.ico b/plugins/SMS/res/SMSNOTSENT.ico Binary files differnew file mode 100644 index 0000000000..edc59a9d00 --- /dev/null +++ b/plugins/SMS/res/SMSNOTSENT.ico diff --git a/plugins/SMS/res/SMSSENT.ico b/plugins/SMS/res/SMSSENT.ico Binary files differnew file mode 100644 index 0000000000..da61e1c52c --- /dev/null +++ b/plugins/SMS/res/SMSSENT.ico diff --git a/plugins/SMS/res/halftick.ico b/plugins/SMS/res/halftick.ico Binary files differnew file mode 100644 index 0000000000..a7fcd94b7a --- /dev/null +++ b/plugins/SMS/res/halftick.ico diff --git a/plugins/SMS/resource.h b/plugins/SMS/resource.h new file mode 100644 index 0000000000..3a7e98455d --- /dev/null +++ b/plugins/SMS/resource.h @@ -0,0 +1,70 @@ +//{{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/resource.rc b/plugins/SMS/resource.rc new file mode 100644 index 0000000000..50c92a2c70 --- /dev/null +++ b/plugins/SMS/resource.rc @@ -0,0 +1,291 @@ +// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include <windows.h>
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Neutral resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
+#ifdef _WIN32
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+#pragma code_page(1251)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 0,2,5,3
+ PRODUCTVERSION 0,2,5,3
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "000004b0"
+ BEGIN
+ VALUE "Comments", "Send and receive SMS messages"
+ VALUE "CompanyName", " "
+ VALUE "FileDescription", "Miranda SMS plugin"
+ VALUE "FileVersion", "0.2.5.3"
+ VALUE "InternalName", "sms plugin"
+ VALUE "LegalCopyright", "Copyright © 2002-3 Ariel Shulman (Original by Richard Hughes), 2007-2009 Rozhuk Ivan (Ivan 83)"
+ VALUE "OriginalFilename", "sms.dll"
+ VALUE "ProductName", "Miranda IM"
+ VALUE "ProductVersion", "0.2.5.3"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0, 1200
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_SMSNOTSENT ICON "res\\SMSNOTSENT.ico"
+IDI_SMSSENT ICON "res\\SMSSENT.ico"
+IDI_HALFTICK ICON "res\\halftick.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_RECVSMS DIALOGEX 0, 0, 278, 126
+STYLE DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
+CAPTION "Received SMS"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ EDITTEXT IDC_MESSAGE,3,29,271,76,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL,WS_EX_CLIENTEDGE
+ DEFPUSHBUTTON "&Reply",IDOK,83,108,50,14
+ PUSHBUTTON "&Close",IDCANCEL,143,108,50,14
+ PUSHBUTTON "Read Next",IDC_READNEXT,217,105,57,17,NOT WS_VISIBLE
+ LTEXT "From:",IDC_STATIC,3,6,19,11
+ LTEXT "Message received:",IDC_STATIC,3,20,108,8
+ LTEXT "",IDC_NAME,24,5,105,11,SS_SUNKEN
+ LTEXT "Number:",IDC_ST_NUMBER,133,6,28,11
+ LTEXT "",IDC_NUMBER,164,5,110,11,SS_SUNKEN
+END
+
+IDD_SENDSMS DIALOGEX 0, 0, 394, 145
+STYLE DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
+CAPTION "Send SMS"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ LTEXT "To:",IDC_ST_TO,2,5,18,8
+ COMBOBOX IDC_NAME,20,3,111,12,CBS_DROPDOWNLIST | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
+ RTEXT "Number:",IDC_ST_ADDRESS,134,5,30,8
+ COMBOBOX IDC_ADDRESS,164,3,113,62,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "Add number to list",IDC_ADDNUMBER,284,3,108,14
+ CONTROL "Tree1",IDC_NUMBERSLIST,"SysTreeView32",TVS_HASBUTTONS | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | TVS_TRACKSELECT | TVS_FULLROWSELECT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,284,17,108,109
+ PUSHBUTTON "&H",IDC_HISTORY,2,17,15,11,BS_ICON
+ COMBOBOX IDC_ACCOUNTS,20,18,72,83,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "Save number",IDC_SAVENUMBER,133,17,46,11
+ PUSHBUTTON "Multiple >>",IDC_MULTIPLE,232,17,45,11
+ LTEXT "Enter message:",IDC_ST_ENTERMESSAGE,2,32,76,9
+ RTEXT "Chars:",IDC_ST_CHARS,207,32,34,8
+ RTEXT "%d/160",IDC_COUNT,242,32,35,8,SS_NOPREFIX | SS_SUNKEN
+ EDITTEXT IDC_MESSAGE,2,42,275,84,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL,WS_EX_CLIENTEDGE
+ DEFPUSHBUTTON "&Send",IDOK,73,130,50,14
+ PUSHBUTTON "&Close",IDCANCEL,143,130,50,14
+END
+
+IDD_SENDSMSTIMEDOUT DIALOG 0, 0, 211, 94
+STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "SMS Message Didn't Send"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ DEFPUSHBUTTON "&Try again",IDOK,39,73,62,16
+ PUSHBUTTON "&Cancel",IDCANCEL,106,73,62,16
+ LTEXT "The SMS message send timed out",IDC_STATUS,5,6,201,61
+END
+
+IDD_OPT_SMSPLUGIN DIALOGEX 0, 0, 255, 161
+STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ GROUPBOX "SMS Plugin",IDC_STATIC,6,4,244,150
+ GROUPBOX "",IDC_SIGNGROUP,12,28,231,74,WS_GROUP
+ EDITTEXT IDC_SIGNATURE,17,40,221,44,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN
+ CONTROL "Begining",IDC_BEGIN,"Button",BS_AUTORADIOBUTTON | WS_GROUP,115,90,65,8
+ CONTROL "End",IDC_END,"Button",BS_AUTORADIOBUTTON,180,90,58,8
+ LTEXT "Put signature at the:",IDC_STATIC,18,90,89,10
+ CONTROL "Use Signature",IDC_USESIGNATURE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,21,226,10
+ CONTROL "Show server notifications",IDC_SHOWACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,108,226,10
+ CONTROL "Auto popup on new message",IDC_AUTOPOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,120,226,10
+ CONTROL "Save window position per contact",IDC_SAVEWINPOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,132,226,10
+END
+
+IDD_SENDSMSACCEPT DIALOG 0, 0, 256, 90
+STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "SMS Message Sent"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ PUSHBUTTON "&OK",IDOK,91,69,62,16
+ LTEXT "",IDC_MESSAGEID,57,6,194,9
+ LTEXT "Message ID:",IDC_ST_MESSAGEID,5,6,52,8
+ LTEXT "Source:",IDC_ST_SOURCE,5,27,52,8
+ LTEXT "",IDC_SOURCE,57,27,194,39
+ LTEXT "Network:",IDC_ST_NETWORK,5,17,52,8
+ LTEXT "",IDC_NETWORK,57,17,194,10
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_RECVSMS, DIALOG
+ BEGIN
+ LEFTMARGIN, 3
+ RIGHTMARGIN, 274
+ TOPMARGIN, 5
+ BOTTOMMARGIN, 122
+ HORZGUIDE, 16
+ HORZGUIDE, 29
+ HORZGUIDE, 105
+ END
+
+ IDD_SENDSMS, DIALOG
+ BEGIN
+ LEFTMARGIN, 2
+ RIGHTMARGIN, 392
+ VERTGUIDE, 164
+ VERTGUIDE, 277
+ VERTGUIDE, 284
+ TOPMARGIN, 3
+ BOTTOMMARGIN, 144
+ HORZGUIDE, 17
+ HORZGUIDE, 28
+ HORZGUIDE, 32
+ HORZGUIDE, 51
+ HORZGUIDE, 111
+ HORZGUIDE, 126
+ HORZGUIDE, 130
+ END
+
+ IDD_SENDSMSTIMEDOUT, DIALOG
+ BEGIN
+ LEFTMARGIN, 5
+ RIGHTMARGIN, 206
+ TOPMARGIN, 6
+ BOTTOMMARGIN, 89
+ END
+
+ IDD_OPT_SMSPLUGIN, DIALOG
+ BEGIN
+ RIGHTMARGIN, 250
+ VERTGUIDE, 6
+ VERTGUIDE, 12
+ VERTGUIDE, 18
+ VERTGUIDE, 115
+ VERTGUIDE, 180
+ VERTGUIDE, 238
+ VERTGUIDE, 243
+ VERTGUIDE, 248
+ BOTTOMMARGIN, 150
+ HORZGUIDE, 84
+ HORZGUIDE, 90
+ HORZGUIDE, 95
+ HORZGUIDE, 107
+ HORZGUIDE, 116
+ END
+
+ IDD_SENDSMSACCEPT, DIALOG
+ BEGIN
+ LEFTMARGIN, 5
+ RIGHTMARGIN, 251
+ VERTGUIDE, 57
+ TOPMARGIN, 6
+ BOTTOMMARGIN, 85
+ HORZGUIDE, 14
+ HORZGUIDE, 17
+ HORZGUIDE, 27
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // Neutral resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.K.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include <windows.h>\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.K.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/plugins/SMS/send.cpp b/plugins/SMS/send.cpp new file mode 100644 index 0000000000..fdfc80ffd8 --- /dev/null +++ b/plugins/SMS/send.cpp @@ -0,0 +1,88 @@ +/*
+Miranda-IM SMS Plugin
+Copyright (C) 2001-2 Richard Hughes
+Copyright (C) 2007-2009 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 "main.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)
+ {
+ LPSTR lpszMessageUTF;
+ LPWSTR lpwszMessageXMLEncoded;
+ SIZE_T dwMessageUTFBuffSize,dwMessageXMLEncodedSize,dwBuffSize;
+ DBEVENTINFO *pdbei;
+
+ dwMessageXMLEncodedSize=((dwMessageSize+MAX_PATH)*sizeof(WCHAR)*6);
+ lpwszMessageXMLEncoded=(LPWSTR)MEMALLOC(dwMessageXMLEncodedSize);
+ if (lpwszMessageXMLEncoded)
+ {
+ 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,dwMessageSize,lpszMessageUTF,dwMessageUTFBuffSize,NULL,NULL));
+ pdbei=(DBEVENTINFO*)MEMALLOC((sizeof(DBEVENTINFO)+dwBuffSize));
+ if (pdbei)
+ {
+ char szServiceName[MAX_PATH],szPhone[MAX_PHONE_LEN];
+ LPSTR lpszBuff=(LPSTR)(pdbei+1);
+ HANDLE hProcess;
+
+ WideCharToMultiByte(CP_UTF8,0,lpwszPhone,dwPhoneSize,szPhone,MAX_PHONE_LEN,NULL,NULL);
+ dwPhoneSize=CopyNumberA(szPhone,szPhone,dwPhoneSize);
+
+ pdbei->timestamp=time(NULL);
+ 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);
+
+ mir_snprintf(szServiceName,sizeof(szServiceName),"%s%s",ssSMSSettings.ppaSMSAccounts[dwModuleIndex]->szModuleName,MS_ICQ_SENDSMS);
+ if (ServiceExists(szServiceName))
+ {
+ WideCharToMultiByte(CP_UTF8,0,lpwszMessageXMLEncoded,dwMessageXMLEncodedSize,lpszMessageUTF,dwMessageUTFBuffSize,NULL,NULL);
+ hProcess=(HANDLE)CallService(szServiceName,(WPARAM)szPhone,(LPARAM)lpszMessageUTF);
+ SendSMSWindowHProcessSet(hWndDlg,hProcess);
+ }else{
+ MEMFREE(pdbei);
+ }
+ }
+ MEMFREE(lpszMessageUTF);
+ }
+ MEMFREE(lpwszMessageXMLEncoded);
+ }
+ }
+}
+
+
+
diff --git a/plugins/SMS/senddlg.cpp b/plugins/SMS/senddlg.cpp new file mode 100644 index 0000000000..dbecd20ec6 --- /dev/null +++ b/plugins/SMS/senddlg.cpp @@ -0,0 +1,1177 @@ +/*
+Miranda-IM SMS Plugin
+Copyright (C) 2001-2 Richard Hughes
+Copyright (C) 2007-2009 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 "main.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;
+ HANDLE hContact;
+ HANDLE hMyContact;
+ HTREEITEM hItemSend;
+ BOOL bMultiple;
+ SIZE_T dwContactsListCount;
+ HANDLE *phContactsList;
+ DBEVENTINFO *pdbei;
+} SEND_SMS_WINDOW_DATA;
+
+
+
+void AddContactPhonesToCombo (HWND hWnd,HANDLE hContact);
+void SendSMSWindowFillTreeView (HWND hWnd);
+SIZE_T GetSMSMessageLenMax (HWND hWndDlg);
+
+#define GET_WINDOW_DATA(hWndDlg) ((SEND_SMS_WINDOW_DATA*)GetWindowLongPtr(hWndDlg,GWL_USERDATA))
+
+
+
+
+
+DWORD SendSMSWindowInitialize()
+{
+ DWORD dwRetErrorCode;
+
+ dwRetErrorCode=ListMTInitialize(&ssSMSSettings.lmtSendSMSWindowsListMT,0);
+return(dwRetErrorCode);
+}
+
+void SendSMSWindowDestroy()
+{
+ SEND_SMS_WINDOW_DATA *psswdWindowData;
+
+ ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
+ while(ListMTItemGetFirst(&ssSMSSettings.lmtSendSMSWindowsListMT,NULL,(LPVOID*)&psswdWindowData)==NO_ERROR)
+ {// цикл
+ SendSMSWindowRemove(psswdWindowData->hWnd);
+ }
+ ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
+ ListMTDestroy(&ssSMSSettings.lmtSendSMSWindowsListMT);
+}
+
+
+
+BOOL 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,GWL_USERDATA,(LONG_PTR)lParam);
+
+ {
+ WNDPROC OldEditWndProc;
+
+ OldEditWndProc=(WNDPROC)SetWindowLongPtr(GetDlgItem(hWndDlg,IDC_MESSAGE),GWL_WNDPROC,(LONG_PTR)MessageSubclassProc);
+ SetWindowLongPtr(GetDlgItem(hWndDlg,IDC_MESSAGE),GWL_USERDATA,(LONG_PTR)OldEditWndProc);
+ }
+
+ SendMessage(hWndDlg,WM_SETICON,ICON_BIG,(LPARAM)LoadSkinnedIcon(SKINICON_OTHER_SMS));
+ SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_HISTORY,BM_SETIMAGE,IMAGE_ICON,(LPARAM)LoadSkinnedIcon(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=LoadSkinnedIcon(SKINICON_OTHER_NOTICK); ImageList_AddIcon(hIml,hIcon);
+ hIcon=LoadSkinnedIcon(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);
+ }
+ {
+ HFONT hFont;
+ LOGFONT lf;
+ hFont=(HFONT)SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,WM_GETFONT,0,0);
+ if (hFont && hFont!=(HFONT)SEND_DLG_ITEM_MESSAGE(hWndDlg,IDOK,WM_GETFONT,0,0)) DeleteObject(hFont);
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA,&lf,NULL);
+ hFont=CreateFontIndirect(&lf);
+ SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(TRUE,0));
+
+ COLORREF colour=DBGetContactSettingDword(NULL,SRMMMOD,SRMSGSET_INPBKGCOLOUR,SRMSGDEFSET_BKGCOLOUR);
+ psswdWindowData->hBkgBrush=CreateSolidBrush(colour);
+ }
+ {
+ TOOLINFO ti;
+ HWND hwndToolTips;
+ hwndToolTips=CreateWindowEx(WS_EX_TOPMOST,TOOLTIPS_CLASS,TEXT(""),WS_POPUP,0,0,0,0,NULL,NULL,GetModuleHandle(NULL),NULL);
+ ZeroMemory(&ti,sizeof(ti));
+ ti.cbSize=sizeof(ti);
+ ti.uFlags=TTF_IDISHWND|TTF_SUBCLASS;
+ ti.uId=(UINT)GetDlgItem(hWndDlg,IDC_HISTORY);
+ ti.lpszText=TranslateW(L"View User's History");
+ SendMessage(hwndToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
+ ti.uId=(UINT)GetDlgItem(hWndDlg,IDC_ADDNUMBER);
+ ti.lpszText=TranslateW(L"Add Number To The Multiple List");
+ SendMessage(hwndToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
+ ti.uId=(UINT)GetDlgItem(hWndDlg,IDC_SAVENUMBER);
+ ti.lpszText=TranslateW(L"Save Number To The User's Details Phonebook");
+ SendMessage(hwndToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
+ ti.uId=(UINT)GetDlgItem(hWndDlg,IDC_MULTIPLE);
+ ti.lpszText=TranslateW(L"Show/Hide Multiple List");
+ SendMessage(hwndToolTips,TTM_ADDTOOL,0,(LPARAM)&ti);
+ ti.uId=(UINT)GetDlgItem(hWndDlg,IDC_COUNT);
+ ti.lpszText=TranslateW(L"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,0,rcWin.left,rcWin.top,rcWin.right-rcWin.left - (rcList.right-rcList.left) - 10,rcWin.bottom - rcWin.top,SWP_NOZORDER|SWP_NOMOVE);
+ }
+
+ SendSMSWindowUpdateAccountList(hWndDlg);
+
+ {
+ WCHAR wszSign[1024];
+ SIZE_T dwSignLen;
+
+ if (DB_SMS_GetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE))
+ if (DB_SMS_GetStaticStringW(NULL,"Signature",wszSign,SIZEOF(wszSign),&dwSignLen))
+ {
+ SET_DLG_ITEM_TEXTW(hWndDlg,IDC_MESSAGE,wszSign);
+
+ if (DB_SMS_GetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS)) SEND_DLG_ITEM_MESSAGEW(hWndDlg,IDC_MESSAGE,EM_SETSEL,dwSignLen,dwSignLen);
+ EnableWindow(GetDlgItem(hWndDlg,IDOK),dwSignLen);
+ }
+
+ mir_sntprintf(wszSign,SIZEOF(wszSign),L"%d/%d",dwSignLen,GetSMSMessageLenMax(hWndDlg));
+ SET_DLG_ITEM_TEXTW(hWndDlg,IDC_COUNT,wszSign);
+ }
+
+ if (Utils_RestoreWindowPosition(hWndDlg,(DB_SMS_GetByte(NULL,"SavePerContact",0)? psswdWindowData->hMyContact:NULL),PROTOCOL_NAMEA,"send"))
+ {// def pos
+ SetWindowPos(hWndDlg,0,200,200,400,350,SWP_NOZORDER);
+ }
+ InvalidateRect(GetDlgItem(hWndDlg,IDC_MESSAGE),NULL,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;
+ }
+ SetWindowPos(GetDlgItem(hWndDlg,IDC_MESSAGE),0,0,0,cx - 14,cy - 132,SWP_NOZORDER|SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg,IDC_NAME),0,0,0,(cx*35)/100,20,SWP_NOZORDER|SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg,IDC_ACCOUNTS),0,0,0,(cx*35)/100,20,SWP_NOZORDER|SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg,IDC_ADDRESS),0,cx - (cx*35)/100 - 11,5,(cx*35)/100,20,SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg,IDC_ST_ADDRESS),0,cx - (cx*35)/100 - 68,5,50,20,SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg,IDC_MULTIPLE),0,cx - ((cx*35)/100 + 35)/2 - 11,30,((cx*35)/100 + 35)/2,20,SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg,IDC_SAVENUMBER),0,cx - (cx*35)/100 - 58,30,((cx*35)/100 + 35)/2,20,SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg,IDC_HISTORY),0,0,0,20,20,SWP_NOZORDER|SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg,IDC_COUNT),0,cx - 61,52,50,15,SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg,IDC_ST_CHARS),0,cx - 106,52,40,15,SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg,IDC_ADDNUMBER),0,cx,5,170,20,SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),0,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),0,cx/2 - 87,cy - 60,80,25,SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg,IDCANCEL),0,cx/2 + 7,cy - 60,80,25,SWP_NOZORDER);
+ RedrawWindow(hWndDlg,NULL,NULL,RDW_FRAME|RDW_INVALIDATE);
+ }
+ break;
+ case WM_TIMER:
+ if (wParam==TIMERID_MSGSEND)
+ {
+ HWND hwndTimeOut;
+ WCHAR wszMessage[1028],wszPhone[MAX_PHONE_LEN];
+
+ if (psswdWindowData->bMultiple)
+ {
+ TVITEM tvi;
+ tvi.mask=TVIF_TEXT;
+ tvi.hItem=SendSMSWindowHItemSendGet(hWndDlg);
+ tvi.pszText=wszPhone;
+ tvi.cchTextMax=SIZEOF(wszPhone);
+ TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi);
+ }else{
+ GET_DLG_ITEM_TEXTW(hWndDlg,IDC_ADDRESS,wszPhone,SIZEOF(wszPhone));
+ }
+ mir_sntprintf(wszMessage,SIZEOF(wszMessage),TranslateW(L"The SMS message send to %s timed out."),wszPhone);
+ KillTimer(hWndDlg,wParam);
+ ShowWindow(hWndDlg,SW_SHOWNORMAL);
+ EnableWindow(hWndDlg,FALSE);
+ hwndTimeOut=CreateDialog(ssSMSSettings.hInstance,MAKEINTRESOURCE(IDD_SENDSMSTIMEDOUT),hWndDlg,SMSTimedOutDlgProc);
+ SET_DLG_ITEM_TEXTW(hwndTimeOut,IDC_STATUS,wszMessage);
+ }
+ break;
+ case WM_CTLCOLOREDIT:
+ if ((HWND)lParam==GetDlgItem(hWndDlg,IDC_MESSAGE))
+ {
+ COLORREF colour;
+
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA,NULL,&colour);
+ SetTextColor((HDC)wParam,colour);
+ SetBkColor((HDC)wParam,DBGetContactSettingDword(NULL,SRMMMOD,SRMSGSET_INPBKGCOLOUR,SRMSGDEFSET_BKGCOLOUR));
+ return((BOOL)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);
+ SEND_DLG_ITEM_MESSAGE(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=NULL;
+ }
+ break;
+ case TIMEDOUT_RETRY:
+ {
+ WCHAR wszPhone[MAX_PHONE_LEN];
+ LPWSTR lpwszMessage;
+ SIZE_T dwPhoneSize,dwMessageSize;
+
+ dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
+ lpwszMessage=(LPWSTR)MEMALLOC(((dwMessageSize+4)*sizeof(WCHAR)));
+ if (lpwszMessage)
+ {
+ if (psswdWindowData->bMultiple)
+ {
+ TVITEM tvi;
+ tvi.mask=TVIF_TEXT;
+ tvi.hItem=psswdWindowData->hItemSend;
+ tvi.pszText=wszPhone;
+ tvi.cchTextMax=SIZEOF(wszPhone);
+ TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi);
+ dwPhoneSize=lstrlenW(wszPhone);
+ }else{
+ dwPhoneSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_ADDRESS,wszPhone,SIZEOF(wszPhone));
+ }
+ dwMessageSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_MESSAGE,lpwszMessage,(dwMessageSize+2));
+ SendSMSWindowNumberSet(hWndDlg,wszPhone,dwPhoneSize);
+ StartSmsSend(hWndDlg,SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0),wszPhone,dwPhoneSize,lpwszMessage,dwMessageSize);
+ MEMFREE(lpwszMessage);
+ }
+ }
+ SetTimer(hWndDlg,TIMERID_MSGSEND,TIMEOUT_MSGSEND,NULL);
+ break;
+ }
+ break;
+ case WM_COMMAND:
+ switch(LOWORD(wParam)){
+ case IDC_MULTIPLE:
+ SendSMSWindowMultipleSet(hWndDlg,!psswdWindowData->bMultiple);
+ break;
+ case IDC_ADDNUMBER:
+ {
+ WCHAR wszPhone[MAX_PHONE_LEN];
+ if (IsPhoneW(wszPhone,GET_DLG_ITEM_TEXTW(hWndDlg,IDC_ADDRESS,wszPhone,SIZEOF(wszPhone))))
+ {
+ TVINSERTSTRUCT tvis={0};
+
+ tvis.item.mask=(TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE);
+ tvis.hInsertAfter=TVI_SORT;
+ tvis.item.pszText=wszPhone;
+ TreeView_InsertItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvis);
+ }else{
+ MessageBox(hWndDlg,TranslateW(L"The phone szPhone should start with a + and consist of numbers, spaces, brackets and hyphens only."),TranslateW(L"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,TranslateW(L"Message is too long, press OK to continue."),TranslateW(L"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);
+ SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,EM_SETREADONLY,TRUE,0);
+ EnableWindow(GetDlgItem(hWndDlg,IDC_ACCOUNTS),FALSE);
+ EnableWindow(GetDlgItem(hWndDlg,IDC_ADDRESS),FALSE);
+ SendSMSWindowNext(hWndDlg);
+ }else{
+ MessageBox(hWndDlg,TranslateW(L"There must be numbers in the list first."),TranslateW(L"No Numbers"),MB_OK);
+ }
+ }else{
+ WCHAR wszPhone[MAX_PHONE_LEN];
+ SIZE_T dwPhoneSize;
+
+ dwPhoneSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_ADDRESS,wszPhone,SIZEOF(wszPhone));
+ if (IsPhoneW(wszPhone,dwPhoneSize))
+ {
+ LPWSTR lpwszMessage;
+ SIZE_T dwMessageSize;
+
+ dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
+ lpwszMessage=(LPWSTR)MEMALLOC((dwMessageSize+4)*sizeof(WCHAR));
+ if (lpwszMessage)
+ {
+ dwMessageSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_MESSAGE,lpwszMessage,(dwMessageSize+2));
+ SendSMSWindowNumberSet(hWndDlg,wszPhone,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);
+ SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,EM_SETREADONLY,TRUE,0);
+ StartSmsSend(hWndDlg,SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0),wszPhone,dwPhoneSize,lpwszMessage,dwMessageSize);
+ SetTimer(hWndDlg,TIMERID_MSGSEND,TIMEOUT_MSGSEND,NULL);
+
+ MEMFREE(lpwszMessage);
+ }
+ }else{
+ MessageBox(hWndDlg,TranslateW(L"Valid phone numbers are of the form '+(country code)(phone szPhone)'. The contents of the phone szPhone portion is dependent on the national layout of phone numbers, but often omits the leading zero."),TranslateW(L"Invalid phone number"),MB_OK);
+ SetFocus(GetDlgItem(hWndDlg,IDC_ADDRESS));
+ SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ADDRESS,CB_SETEDITSEL,0,MAKELPARAM(0,-1));
+ }
+ }
+ }
+ break;
+ case IDCANCEL:
+ DeleteObject((HFONT)SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_MESSAGE,WM_GETFONT,0,0));
+ KillTimer(GetParent(hWndDlg),TIMERID_MSGSEND);
+ SendSMSWindowRemove(hWndDlg);
+ break;
+ case IDC_MESSAGE:
+ if (HIWORD(wParam)==EN_CHANGE)
+ {
+ WCHAR wszBuff[MAX_PATH];
+ SIZE_T dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
+
+ EnableWindow(GetDlgItem(hWndDlg,IDOK),dwMessageSize);
+ mir_sntprintf(wszBuff,SIZEOF(wszBuff),L"%d/%d",dwMessageSize,GetSMSMessageLenMax(hWndDlg));
+ SET_DLG_ITEM_TEXTW(hWndDlg,IDC_COUNT,wszBuff);
+ }
+ break;
+ case IDC_SAVENUMBER:
+ {
+ BOOL bCont=TRUE;
+ char szBuff[MAX_PATH];
+ WCHAR wszPhone[MAX_PHONE_LEN];
+ SIZE_T dwPhoneSize;
+ DBVARIANT dbv;
+
+ dwPhoneSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_ADDRESS,wszPhone,(SIZEOF(wszPhone)-4));
+ if (IsPhoneW(wszPhone,dwPhoneSize))
+ {
+ if (IsContactPhone(psswdWindowData->hMyContact,wszPhone,dwPhoneSize)==FALSE)
+ {
+ lstrcatW(wszPhone,L" SMS");
+ for(DWORD i=0;bCont;i++)
+ {
+ mir_snprintf(szBuff,SIZEOF(szBuff),"MyPhone%d",i);
+ if (DBGetContactSetting(psswdWindowData->hMyContact,"UserInfo",szBuff,&dbv)) bCont=FALSE;
+ DBFreeVariant(&dbv);
+ }
+ DB_SetStringW(psswdWindowData->hMyContact,"UserInfo",szBuff,wszPhone);
+ }
+ }else{
+ MessageBox(hWndDlg,TranslateW(L"The phone szPhone should start with a + and consist of numbers, spaces, brackets and hyphens only."),TranslateW(L"Invalid Phone Number"),MB_OK);
+ }
+ }
+ break;
+ case IDC_NAME:
+ if (HIWORD(wParam)==CBN_SELCHANGE)
+ {
+ SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ADDRESS,CB_RESETCONTENT,0,0);
+ if (SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_NAME,CB_GETCURSEL,0,0))
+ {
+ HANDLE hContact=SendSMSWindowSMSContactGet(hWndDlg,(SEND_DLG_ITEM_MESSAGE(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)SEND_DLG_ITEM_MESSAGE(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);
+}
+
+BOOL CALLBACK SMSTimedOutDlgProc(HWND hWndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
+{
+ switch(msg){
+ case WM_INITDIALOG:
+ {
+ RECT rc,rcParent;
+ TranslateDialogDefault(hWndDlg);
+ GetWindowRect(hWndDlg,&rc);
+ GetWindowRect(GetParent(hWndDlg),&rcParent);
+ SetWindowPos(hWndDlg,0,(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);
+}
+
+BOOL CALLBACK SMSAcceptedDlgProc(HWND hWndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
+{
+ switch(msg){
+ case WM_INITDIALOG:
+ {
+ RECT rc,rcParent;
+ TranslateDialogDefault(hWndDlg);
+ GetWindowRect(hWndDlg,&rc);
+ GetWindowRect(GetParent(hWndDlg),&rcParent);
+ SetWindowPos(hWndDlg,0,(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(HANDLE hContact)
+{
+ HWND hRet=NULL;
+ SEND_SMS_WINDOW_DATA *psswdWindowData;
+
+ psswdWindowData=(SEND_SMS_WINDOW_DATA*)MEMALLOC(sizeof(SEND_SMS_WINDOW_DATA));
+ if (psswdWindowData)
+ {
+ psswdWindowData->hMyContact=hContact;
+ psswdWindowData->hWnd=CreateDialogParam(ssSMSSettings.hInstance,MAKEINTRESOURCE(IDD_SENDSMS),NULL,SendSmsDlgProc,(LPARAM)psswdWindowData);
+ if (psswdWindowData->hWnd)
+ {
+ WCHAR wszTitle[MAX_PATH];
+ LPWSTR lpwszContactDisplayName;
+
+ ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
+ ListMTItemAdd(&ssSMSSettings.lmtSendSMSWindowsListMT,&psswdWindowData->lmtListMTItem,psswdWindowData);
+ ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
+
+ lpwszContactDisplayName=GetContactNameW(hContact);
+ mir_sntprintf(wszTitle,SIZEOF(wszTitle),L"%s - %s",lpwszContactDisplayName,TranslateW(L"Send SMS"));
+ SendMessageW(psswdWindowData->hWnd,WM_SETTEXT,NULL,(LPARAM)wszTitle);
+ SEND_DLG_ITEM_MESSAGEW(psswdWindowData->hWnd,IDC_NAME,CB_ADDSTRING,0,(LPARAM)lpwszContactDisplayName);
+ SEND_DLG_ITEM_MESSAGE(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",SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0));
+ SendSMSWindowMultipleSet(hWndDlg,FALSE);
+ Utils_SaveWindowPosition(hWndDlg,(DB_SMS_GetByte(NULL,"SavePerContact",0)? psswdWindowData->hMyContact:NULL),PROTOCOL_NAMEA,"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.
+HANDLE SendSMSWindowHContactGet(HWND hWndDlg)
+{
+ HANDLE 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,HANDLE 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=NULL;
+ SEND_SMS_WINDOW_DATA *psswdWindowData;
+ LIST_MT_ITERATOR lmtiIterator;
+
+ ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
+ ListMTIteratorMoveFirst(&ssSMSSettings.lmtSendSMSWindowsListMT,&lmtiIterator);
+ do
+ {// цикл
+ if (ListMTIteratorGet(&lmtiIterator,NULL,(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)
+ if (psswdWindowData->bMultiple!=bMultiple)
+ {
+ 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);
+ SET_DLG_ITEM_TEXTW(hWndDlg,IDC_MULTIPLE,TranslateW(L"<< Single"));
+ if (wp.showCmd==SW_MAXIMIZE) SetWindowPos(hWndDlg,0,0,0,rcWin.right - rcWin.left - (rcList.right - rcList.left + 11) ,rcWin.bottom - rcWin.top,SWP_NOZORDER|SWP_NOMOVE);
+ SetWindowPos(hWndDlg,0,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);
+ SET_DLG_ITEM_TEXTW(hWndDlg,IDC_MULTIPLE,TranslateW(L"Multiple >>"));
+ SetWindowPos(hWndDlg,0,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,0,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 hWndDlg)
+{
+// 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,sizeof(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->cbSize=sizeof(DBEVENTINFO);
+ psswdWindowData->pdbei->szModule=GetModuleName(psswdWindowData->hContact);
+
+ CallService(MS_DB_EVENT_ADD,(WPARAM)psswdWindowData->hContact,(LPARAM)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=NULL;
+ 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(NULL);
+}
+
+//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(HANDLE hContact)
+{
+ HWND hRet=NULL;
+ SEND_SMS_WINDOW_DATA *psswdWindowData;
+ LIST_MT_ITERATOR lmtiIterator;
+
+ ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
+ ListMTIteratorMoveFirst(&ssSMSSettings.lmtSendSMSWindowsListMT,&lmtiIterator);
+ do
+ {// цикл
+ if (ListMTIteratorGet(&lmtiIterator,NULL,(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 wszPhone[MAX_PHONE_LEN];
+ LPWSTR lpwszMessage;
+ SIZE_T dwPhoneSize,dwMessageSize;
+ TVITEM tvi={0};
+
+ dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
+ lpwszMessage=(LPWSTR)MEMALLOC(((dwMessageSize+4)*sizeof(WCHAR)));
+ if (lpwszMessage)
+ {
+ dwMessageSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_MESSAGE,lpwszMessage,(dwMessageSize+2));
+
+ // if (SendSMSWindowNextHItemGet(hWndDlg,SendSMSWindowHItemSendGet(hWndDlg))==NULL) SendSMSWindowMultipleSet(hWndDlg,FALSE);
+ tvi.mask=TVIF_TEXT;
+ tvi.hItem=SendSMSWindowHItemSendGet(hWndDlg);
+ tvi.pszText=wszPhone;
+ tvi.cchTextMax=SIZEOF(wszPhone);
+ TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi);
+ TreeView_SelectItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),tvi.hItem);
+ dwPhoneSize=lstrlenW(wszPhone);
+ SendSMSWindowNumberSet(hWndDlg,wszPhone,dwPhoneSize);
+ StartSmsSend(hWndDlg,SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0),wszPhone,dwPhoneSize,lpwszMessage,dwMessageSize);
+ SetTimer(hWndDlg,TIMERID_MSGSEND,TIMEOUT_MSGSEND,NULL);
+ MEMFREE(lpwszMessage);
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////
+//This function gets a HANDLE of a contact and add it to a list.
+void SendSMSWindowSMSContactAdd(HWND hWndDlg,HANDLE hContact)
+{
+ SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg);
+
+ if (psswdWindowData)
+ {
+ psswdWindowData->dwContactsListCount++;
+ if (psswdWindowData->phContactsList)
+ {
+ psswdWindowData->phContactsList=(HANDLE*)MEMREALLOC(psswdWindowData->phContactsList,(sizeof(HANDLE)*psswdWindowData->dwContactsListCount));
+ }else{
+ psswdWindowData->phContactsList=(HANDLE*)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.
+HANDLE 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=SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0);
+ if (dwCurSel==-1) dwCurSel=DB_SMS_GetDword(NULL,"LastProto",0);
+ if (dwCurSel==-1) dwCurSel=0;
+
+ SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ACCOUNTS,CB_RESETCONTENT,0,0);
+ for(i=0;i<ssSMSSettings.dwSMSAccountsCount;i++)
+ {
+ SEND_DLG_ITEM_MESSAGEA(hWndDlg,IDC_ACCOUNTS,CB_ADDSTRING,0,(LPARAM)ssSMSSettings.ppaSMSAccounts[i]->szModuleName);
+ }
+ SEND_DLG_ITEM_MESSAGE(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,NULL,(LPVOID*)&psswdWindowData)==NO_ERROR)
+ {
+ SendSMSWindowUpdateAccountList(psswdWindowData->hWnd);
+ }
+ }while(ListMTIteratorMoveNext(&lmtiIterator));
+ ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT);
+}
+//////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+
+void AddContactPhonesToComboToListParam(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,HWND hWndList)
+{
+ char szBuff[MAX_PATH];
+ WCHAR wszPhone[MAX_PHONE_LEN],wszPhoneRaw[MAX_PHONE_LEN];
+ SIZE_T i,dwPhoneSize;
+
+ if (DB_GetStaticStringW(hContact,lpszModule,lpszValueName,wszPhoneRaw,SIZEOF(wszPhoneRaw),&dwPhoneSize))
+ {
+ wszPhone[0]='+';
+ dwPhoneSize=CopyNumberW((wszPhone+1),wszPhoneRaw,dwPhoneSize);
+ if (IsPhoneW(wszPhone,dwPhoneSize))
+ {
+ if (SendMessage(hWndList,CB_FINDSTRING,-1,(LPARAM)wszPhone)==CB_ERR) SendMessage(hWndList,CB_ADDSTRING,0,(LPARAM)wszPhone);
+ }
+ }
+
+ for (i=0;TRUE;i++)
+ {
+ mir_snprintf(szBuff,sizeof(szBuff),"%s%ld",lpszValueName,i);
+ if (DB_GetStaticStringW(hContact,lpszModule,szBuff,wszPhoneRaw,SIZEOF(wszPhoneRaw),&dwPhoneSize))
+ {
+ wszPhone[0]='+';
+ dwPhoneSize=CopyNumberW((wszPhone+1),wszPhoneRaw,dwPhoneSize);
+ if (IsPhoneW(wszPhone,dwPhoneSize))
+ {
+ if (SendMessage(hWndList,CB_FINDSTRING,-1,(LPARAM)wszPhone)==CB_ERR) SendMessage(hWndList,CB_ADDSTRING,0,(LPARAM)wszPhone);
+ }
+ }else{
+ if (i>PHONES_MIN_COUNT) break;
+ }
+ }
+}
+
+
+void AddContactPhonesToCombo(HWND hWnd,HANDLE hContact)
+{
+ HWND hWndList;
+ LPSTR lpszProto;
+
+ hWndList=GetDlgItem(hWnd,IDC_ADDRESS);
+ SEND_DLG_ITEM_MESSAGE(hWnd,IDC_ADDRESS,CB_RESETCONTENT,0,0);
+
+ lpszProto=(LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
+ 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);
+
+ SEND_DLG_ITEM_MESSAGE(hWnd,IDC_ADDRESS,CB_SETCURSEL,0,0);
+}
+
+
+
+void AddContactPhonesToTreeViewParam(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,HWND hWndList,HTREEITEM *phParent)
+{
+ char szBuff[MAX_PATH];
+ WCHAR wszPhone[MAX_PHONE_LEN],wszPhoneRaw[MAX_PHONE_LEN];
+ SIZE_T i,dwPhoneSize;
+ TVINSERTSTRUCT tvis={0};
+
+ 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,wszPhoneRaw,SIZEOF(wszPhoneRaw),&dwPhoneSize))
+ {
+ wszPhone[0]='+';
+ dwPhoneSize=CopyNumberW((wszPhone+1),wszPhoneRaw,dwPhoneSize);
+ if (IsPhoneW(wszPhone,dwPhoneSize))
+ {
+ if (tvis.hParent==NULL)
+ {
+ tvis.item.pszText=GetContactNameW(hContact);
+ tvis.hParent=TreeView_InsertItem(hWndList,&tvis);
+ }
+ tvis.item.pszText=wszPhone;
+ TreeView_InsertItem(hWndList,&tvis);
+ }
+ }
+
+ for (i=0;TRUE;i++)
+ {
+ mir_snprintf(szBuff,sizeof(szBuff),"%s%ld",lpszValueName,i);
+ if (DB_GetStaticStringW(hContact,lpszModule,szBuff,wszPhoneRaw,SIZEOF(wszPhoneRaw),&dwPhoneSize))
+ {
+ wszPhone[0]='+';
+ dwPhoneSize=CopyNumberW((wszPhone+1),wszPhoneRaw,dwPhoneSize);
+ if (IsPhoneW(wszPhone,dwPhoneSize))
+ {
+ if (tvis.hParent==NULL)
+ {
+ tvis.item.pszText=GetContactNameW(hContact);
+ tvis.hParent=TreeView_InsertItem(hWndList,&tvis);
+ }
+ tvis.item.pszText=wszPhone;
+ TreeView_InsertItem(hWndList,&tvis);
+ }
+ }else{
+ if (i>PHONES_MIN_COUNT) break;
+ }
+ }
+ if (phParent) (*phParent)=tvis.hParent;
+}
+
+
+void SendSMSWindowFillTreeView(HWND hWnd)
+{
+ HWND hWndTreeView;
+ LPSTR lpszProto;
+ HTREEITEM hParent;
+
+ hWndTreeView=GetDlgItem(hWnd,IDC_NUMBERSLIST);
+ TreeView_DeleteAllItems(hWndTreeView);
+
+ for(HANDLE hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);hContact!=NULL;hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
+ {
+ hParent=NULL;
+ lpszProto=(LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
+ 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)
+{
+ LPWSTR lpwszMessage;
+ SIZE_T dwMessageSize,dwLenght=160;
+
+ dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
+ lpwszMessage=(LPWSTR)MEMALLOC(((dwMessageSize+4)*sizeof(WCHAR)));
+ if (lpwszMessage)
+ {
+ dwMessageSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_MESSAGE,lpwszMessage,(dwMessageSize+2));
+ if (dwMessageSize!=WideCharToMultiByte(CP_UTF8,0,lpwszMessage,dwMessageSize,NULL,0,NULL,NULL)) dwLenght=70;
+ MEMFREE(lpwszMessage);
+ }
+return(dwLenght);
+}
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/SMS/senddlg.h b/plugins/SMS/senddlg.h new file mode 100644 index 0000000000..225cf80f28 --- /dev/null +++ b/plugins/SMS/senddlg.h @@ -0,0 +1,40 @@ +#if !defined(AFX_SMS_SENDDLG_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_)
+#define AFX_SMS_SENDDLG_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_
+
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+DWORD SendSMSWindowInitialize ();
+void SendSMSWindowDestroy ();
+
+//Decleration of SMS send window list
+BOOL CALLBACK SMSAcceptedDlgProc (HWND hWndDlg,UINT msg,WPARAM wParam,LPARAM lParam);
+BOOL CALLBACK SMSTimedOutDlgProc (HWND hWndDlg,UINT msg,WPARAM wParam,LPARAM lParam);
+HWND SendSMSWindowAdd (HANDLE hContact);
+void SendSMSWindowRemove (HWND hWndDlg);
+HANDLE SendSMSWindowHContactGet (HWND hWndDlg);
+void SendSMSWindowHContactSet (HWND hWndDlg,HANDLE 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);
+HTREEITEM SendSMSWindowHItemSendGet (HWND hWndDlg);
+HTREEITEM SendSMSWindowNextHItemGet (HWND hWndDlg,HTREEITEM hItem);
+HWND SendSMSWindowIsOtherInstanceHContact(HANDLE hContact);
+void SendSMSWindowNext (HWND hWndDlg);
+
+void SendSMSWindowSMSContactAdd (HWND hWndDlg,HANDLE hContact);
+HANDLE 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/sms.dsp b/plugins/SMS/sms.dsp new file mode 100644 index 0000000000..75d75ee5d8 --- /dev/null +++ b/plugins/SMS/sms.dsp @@ -0,0 +1,231 @@ +# Microsoft Developer Studio Project File - Name="sms" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=sms - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "sms.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "sms.mak" CFG="sms - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "sms - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "sms - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "sms - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SMS_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SMS_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 LIBCTINY.LIB kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib /nologo /base:"0x25000000" /dll /map /machine:I386 /nodefaultlib
+
+!ELSEIF "$(CFG)" == "sms - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SMS_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SMS_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 LIBCTINY.LIB kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /nodefaultlib /out:"../../Debug/plugins/sms.dll" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "sms - Win32 Release"
+# Name "sms - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Group "minicrt"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\mincrt\MEMSET.C
+# End Source File
+# Begin Source File
+
+SOURCE=.\mincrt\STRCHR.C
+# End Source File
+# Begin Source File
+
+SOURCE=.\mincrt\STRDUP.C
+# End Source File
+# Begin Source File
+
+SOURCE=.\mincrt\strncmp.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mincrt\STRSPN.C
+# End Source File
+# Begin Source File
+
+SOURCE=.\mincrt\time.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mincrt\wsnprintf.c
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\main.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\options.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\receive.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\recvdlg.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\send.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\senddlg.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\utf8.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\AggressiveOptimize.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\m_autoreplacer.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\main.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\receive.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\send.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\utf8.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mincrt\wsnprintf.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\halftick.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\history.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\history.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\notick.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\SMSMSG.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\SMSNOTSENT.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\SMSSENT.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\tick.ico
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/plugins/SMS/sms.dsw b/plugins/SMS/sms.dsw new file mode 100644 index 0000000000..2bc1715ec7 --- /dev/null +++ b/plugins/SMS/sms.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "sms"=.\sms.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/plugins/SMS/sms.opt b/plugins/SMS/sms.opt Binary files differnew file mode 100644 index 0000000000..d32d04fb8b --- /dev/null +++ b/plugins/SMS/sms.opt diff --git a/plugins/SMS/sms.vcproj b/plugins/SMS/sms.vcproj new file mode 100644 index 0000000000..2b5e61d508 --- /dev/null +++ b/plugins/SMS/sms.vcproj @@ -0,0 +1,388 @@ +<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="sms"
+ ProjectGUID="{896C1557-3841-4D04-B3CA-3DED03AFED37}"
+ RootNamespace="sms"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/sms.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="1"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="2"
+ EnableFiberSafeOptimizations="true"
+ WholeProgramOptimization="false"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SMS_EXPORTS"
+ StringPooling="true"
+ MinimalRebuild="false"
+ ExceptionHandling="0"
+ RuntimeLibrary="0"
+ BufferSecurityCheck="false"
+ EnableFunctionLevelLinking="false"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=""
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="comctl32.lib"
+ OutputFile=".\Release/sms.dll"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ AdditionalManifestDependencies="type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'"
+ IgnoreAllDefaultLibraries="true"
+ IgnoreDefaultLibraryNames=""
+ ModuleDefinitionFile="sms.def"
+ ProgramDatabaseFile=".\Release/sms.pdb"
+ GenerateMapFile="true"
+ MapFileName=".\Release/sms.map"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ OptimizeForWindows98="0"
+ LinkTimeCodeGeneration="0"
+ ResourceOnlyDLL="true"
+ SetChecksum="true"
+ BaseAddress=""
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="2"
+ ImportLibrary=".\Release/sms.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="copy "C:\Documents and Settings\rozhuk_IM\Мои документы\Programmer\VC\smsvsrc-unicode\Debug\SMS.dll" "C:\Documents and Settings\rozhuk_IM\Мои документы\Programmer\VC\Mra\Miranda IM\Plugins\SMS.dll"
"
+ Outputs="w"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/sms.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SMS_EXPORTS"
+ StringPooling="true"
+ MinimalRebuild="true"
+ ExceptionHandling="0"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=""
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="comctl32.lib"
+ OutputFile="Debug/sms.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalManifestDependencies="type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'"
+ IgnoreAllDefaultLibraries="false"
+ IgnoreDefaultLibraryNames="msvcrtd.lib"
+ ModuleDefinitionFile="sms.def"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/sms.pdb"
+ OptimizeReferences="1"
+ EnableCOMDATFolding="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="2"
+ ImportLibrary=".\Debug/sms.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="functions.cpp"
+ >
+ </File>
+ <File
+ RelativePath="main.cpp"
+ >
+ </File>
+ <File
+ RelativePath="options.cpp"
+ >
+ </File>
+ <File
+ RelativePath="receive.cpp"
+ >
+ </File>
+ <File
+ RelativePath="recvdlg.cpp"
+ >
+ </File>
+ <File
+ RelativePath="send.cpp"
+ >
+ </File>
+ <File
+ RelativePath="senddlg.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\SMS_svc.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\!Clases\include\ListMT.h"
+ >
+ </File>
+ <File
+ RelativePath=".\m_autoreplacer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\!Clases\include\Miranda\m_fontservice.h"
+ >
+ </File>
+ <File
+ RelativePath=".\main.h"
+ >
+ </File>
+ <File
+ RelativePath="..\!Clases\include\MemoryCompare.h"
+ >
+ </File>
+ <File
+ RelativePath="..\!Clases\include\MemoryFind.h"
+ >
+ </File>
+ <File
+ RelativePath="..\!Clases\include\MemoryFindByte.h"
+ >
+ </File>
+ <File
+ RelativePath="recvdlg.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ </File>
+ <File
+ RelativePath="senddlg.h"
+ >
+ </File>
+ <File
+ RelativePath="SMS.def"
+ >
+ </File>
+ <File
+ RelativePath=".\SMSConstans.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\halftick.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\res\halftick.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\res\history.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\history.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\notick.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.rc"
+ >
+ </File>
+ <File
+ RelativePath=".\SMSMSG.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\SMSNOTSENT.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\res\SMSNOTSENT.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\res\SMSSENT.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\SMSSENT.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\tick.ico"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath="readme.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
|