#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); } } }