From c370af60855db957c5b200914bf0bde743845528 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 28 Aug 2015 16:22:41 +0000 Subject: mir_sntprintf / mir_snprintf: obsoleted second parameter removed wherever possible git-svn-id: http://svn.miranda-ng.org/main/trunk@15064 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SMS/src/SMS_svc.cpp | 72 ++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 37 deletions(-) (limited to 'plugins/SMS/src/SMS_svc.cpp') diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp index 474a9194d4..2e19ef232f 100644 --- a/plugins/SMS/src/SMS_svc.cpp +++ b/plugins/SMS/src/SMS_svc.cpp @@ -2,16 +2,15 @@ int LoadServices(void) { - char szServiceFunction[MAX_PATH],*pszServiceFunctionName; + char szServiceFunction[MAX_PATH], *pszServiceFunctionName; - memcpy(szServiceFunction,PROTOCOL_NAMEA,PROTOCOL_NAME_SIZE); - pszServiceFunctionName=szServiceFunction+PROTOCOL_NAME_LEN; + memcpy(szServiceFunction, PROTOCOL_NAMEA, PROTOCOL_NAME_SIZE); + pszServiceFunctionName = szServiceFunction + PROTOCOL_NAME_LEN; // Service creation - for (size_t i=0;i<_countof(siPluginServices);i++) - { - memcpy(pszServiceFunctionName,siPluginServices[i].lpszName,(mir_strlen(siPluginServices[i].lpszName)+1)); - CreateServiceFunction(szServiceFunction,(MIRANDASERVICE)siPluginServices[i].lpFunc); + for (size_t i = 0; i < _countof(siPluginServices); i++) { + memcpy(pszServiceFunctionName, siPluginServices[i].lpszName, (mir_strlen(siPluginServices[i].lpszName) + 1)); + CreateServiceFunction(szServiceFunction, (MIRANDASERVICE)siPluginServices[i].lpFunc); } return 0; } @@ -19,14 +18,14 @@ int LoadServices(void) int LoadModules(void) { - HookEvent(ME_OPT_INITIALISE,OptInitialise); - HookEvent(ME_CLIST_PREBUILDCONTACTMENU,SmsRebuildContactMenu); - HookEvent(ME_PROTO_ACK,handleAckSMS); - HookEvent(ME_DB_EVENT_ADDED,handleNewMessage); - HookEvent(ME_PROTO_ACCLISTCHANGED,RefreshAccountList); + HookEvent(ME_OPT_INITIALISE, OptInitialise); + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, SmsRebuildContactMenu); + HookEvent(ME_PROTO_ACK, handleAckSMS); + HookEvent(ME_DB_EVENT_ADDED, handleNewMessage); + HookEvent(ME_PROTO_ACCLISTCHANGED, RefreshAccountList); char szServiceFunction[MAX_PATH]; - mir_snprintf(szServiceFunction,_countof(szServiceFunction),"%s%s",PROTOCOL_NAMEA,SMS_SEND); + mir_snprintf(szServiceFunction, "%s%s", PROTOCOL_NAMEA, SMS_SEND); CMenuItem mi; mi.position = 300050000; @@ -40,13 +39,13 @@ int LoadModules(void) mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_SMS); mi.name.t = SMS_SEND_CM_STR; mi.pszService = szServiceFunction; - mi.flags = CMIF_TCHAR; + mi.flags = CMIF_TCHAR; ssSMSSettings.hContactMenuItems[0] = Menu_AddContactMenuItem(&mi); - SkinAddNewSoundEx("RecvSMSMsg",PROTOCOL_NAMEA,LPGEN("Incoming SMS Message")); - SkinAddNewSoundEx("RecvSMSConfirmation",PROTOCOL_NAMEA,LPGEN("Incoming SMS Confirmation")); + SkinAddNewSoundEx("RecvSMSMsg", PROTOCOL_NAMEA, LPGEN("Incoming SMS Message")); + SkinAddNewSoundEx("RecvSMSConfirmation", PROTOCOL_NAMEA, LPGEN("Incoming SMS Confirmation")); - RefreshAccountList(NULL,NULL); + RefreshAccountList(NULL, NULL); RestoreUnreadMessageAlerts(); return 0; @@ -72,23 +71,22 @@ int SendSMSMenuCommand(WPARAM wParam, LPARAM) hwndSendSms = SendSMSWindowAdd(wParam); } // user clicked on the "SMS Send" in the Main Menu - else{ + else { hwndSendSms = SendSMSWindowAdd(NULL); - EnableWindow(GetDlgItem(hwndSendSms,IDC_NAME),TRUE); - EnableWindow(GetDlgItem(hwndSendSms,IDC_SAVENUMBER),FALSE); + EnableWindow(GetDlgItem(hwndSendSms, IDC_NAME), TRUE); + EnableWindow(GetDlgItem(hwndSendSms, IDC_SAVENUMBER), FALSE); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (GetContactPhonesCount(hContact)) { SendDlgItemMessage(hwndSendSms, IDC_NAME, CB_ADDSTRING, 0, (LPARAM)pcli->pfnGetContactDisplayName(hContact, 0)); - SendSMSWindowSMSContactAdd(hwndSendSms,hContact); + SendSMSWindowSMSContactAdd(hwndSendSms, hContact); } } } return 0; } - -//This function used to popup a read SMS window after the user clicked on the received SMS message. +// This function used to popup a read SMS window after the user clicked on the received SMS message. int ReadMsgSMS(WPARAM, LPARAM lParam) { CLISTEVENT *cle = (CLISTEVENT*)lParam; @@ -99,17 +97,17 @@ int ReadMsgSMS(WPARAM, LPARAM lParam) dbei.pBlob = (PBYTE)_alloca(dbei.cbBlob); if (db_event_get(cle->hDbEvent, &dbei) == 0) - if (dbei.eventType == ICQEVENTTYPE_SMS || dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION) - if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN) { - if (RecvSMSWindowAdd(cle->hContact,ICQEVENTTYPE_SMS,NULL,0,(LPSTR)dbei.pBlob,dbei.cbBlob)) { - db_event_markRead(cle->hContact, cle->hDbEvent); - return 0; - } - } + if (dbei.eventType == ICQEVENTTYPE_SMS || dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION) + if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN) { + if (RecvSMSWindowAdd(cle->hContact, ICQEVENTTYPE_SMS, NULL, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) { + db_event_markRead(cle->hContact, cle->hDbEvent); + return 0; + } + } return 1; } -//This function used to popup a read SMS window after the user clicked on the received SMS confirmation. +// This function used to popup a read SMS window after the user clicked on the received SMS confirmation. int ReadAckSMS(WPARAM, LPARAM lParam) { CLISTEVENT *cle = (CLISTEVENT*)lParam; @@ -138,16 +136,16 @@ void RestoreUnreadMessageAlerts(void) for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) { dbei.cbBlob = 0; if (db_event_get(hDbEvent, &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(hContact,(LPARAM)hDbEvent); + if ((dbei.flags & (DBEF_SENT | DBEF_READ)) == 0 && ((dbei.eventType == ICQEVENTTYPE_SMS) || (dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION))) + if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN) + handleNewMessage(hContact, (LPARAM)hDbEvent); } for (MEVENT hDbEvent = db_event_firstUnread(NULL); hDbEvent; hDbEvent = db_event_next(NULL, hDbEvent)) { dbei.cbBlob = 0; if (db_event_get(hDbEvent, &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(NULL, (LPARAM)hDbEvent); + if ((dbei.flags & (DBEF_SENT | DBEF_READ)) == 0 && ((dbei.eventType == ICQEVENTTYPE_SMS) || (dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION))) + if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN) + handleNewMessage(NULL, (LPARAM)hDbEvent); } } -- cgit v1.2.3