From 89c5b2369413025e1fe7dfe5c5d0bf3bedd8558d Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Mon, 23 Jul 2012 13:52:57 +0000 Subject: git-svn-id: http://svn.miranda-ng.org/main/trunk@1123 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- !NotAdopted/SMS/SMS_svc.cpp | 243 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 243 insertions(+) create mode 100644 !NotAdopted/SMS/SMS_svc.cpp (limited to '!NotAdopted/SMS/SMS_svc.cpp') diff --git a/!NotAdopted/SMS/SMS_svc.cpp b/!NotAdopted/SMS/SMS_svc.cpp new file mode 100644 index 0000000000..24e6d1ad2f --- /dev/null +++ b/!NotAdopted/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;ihDbEvent,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); + } + } +} + + + + + + + + + + + + + + + + -- cgit v1.2.3