diff options
author | Robert Pösel <robyer@seznam.cz> | 2012-12-24 21:30:41 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2012-12-24 21:30:41 +0000 |
commit | 367d9f6f71420e4c7ed5f273e04d280655bb3d7a (patch) | |
tree | d4bb82414145d3be020ab2b579bcd1947d8b6fa2 /plugins/SMS/src/send.cpp | |
parent | 0851c3965879663c41cfe435d1b320ba68cf873a (diff) |
SMS plugin adopted (32bit version only)
git-svn-id: http://svn.miranda-ng.org/main/trunk@2831 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SMS/src/send.cpp')
-rw-r--r-- | plugins/SMS/src/send.cpp | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/plugins/SMS/src/send.cpp b/plugins/SMS/src/send.cpp new file mode 100644 index 0000000000..fda9c490db --- /dev/null +++ b/plugins/SMS/src/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 "common.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);
+ }
+ }
+}
+
+
+
|