From 78c0815c4118fe24ab78cce2dc48a6232dcd824a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 2 Jun 2012 20:55:18 +0000 Subject: - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MetaContacts/addto.c | 6 +- plugins/MetaContacts/edit.c | 6 +- plugins/MetaContacts/meta_api.c | 10 ++-- plugins/MetaContacts/meta_main.c | 4 +- plugins/MetaContacts/meta_menu.c | 20 +++---- plugins/MetaContacts/meta_options.c | 12 ++-- plugins/MetaContacts/meta_services.c | 112 +++++++++++++++++------------------ plugins/MetaContacts/meta_utils.c | 112 +++++++++++++++++------------------ 8 files changed, 141 insertions(+), 141 deletions(-) (limited to 'plugins/MetaContacts') diff --git a/plugins/MetaContacts/addto.c b/plugins/MetaContacts/addto.c index 3fcfcd2a62..f6ef14529b 100644 --- a/plugins/MetaContacts/addto.c +++ b/plugins/MetaContacts/addto.c @@ -61,7 +61,7 @@ int FillList(HWND list, BOOL sort) while(hMetaUser) // The DB is searched through, to get all the metacontacts { - if((metaID=DBGetContactSettingDword(hMetaUser,META_PROTO,META_ID,(DWORD)-1))==(DWORD)-1) + if ((metaID=DBGetContactSettingDword(hMetaUser,META_PROTO,META_ID,(DWORD)-1))==(DWORD)-1) { // This isn't a MetaContact, go to the next hMetaUser = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hMetaUser,0); @@ -257,13 +257,13 @@ INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP { HANDLE hMeta, hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); int item; // Get the index of the selected metacontact - if((item = SendMessage(GetDlgItem(hwndDlg, IDC_METALIST),LB_GETCURSEL, 0, 0))==-1) + if ((item = SendMessage(GetDlgItem(hwndDlg, IDC_METALIST),LB_GETCURSEL, 0, 0))==-1) return IDOK == MessageBox(hwndDlg,Translate("Please select a MetaContact"),Translate("No MetaContact selected"),MB_ICONHAND); hMeta = (HANDLE)SendMessage(GetDlgItem(hwndDlg, IDC_METALIST), LB_GETITEMDATA, (WPARAM)item, 0); { - if(!Meta_Assign(hContact,hMeta, FALSE)) + if (!Meta_Assign(hContact,hMeta, FALSE)) { MessageBox(hwndDlg, Translate("Assignment to the MetaContact failed."), Translate("Assignment failure"),MB_ICONERROR); } diff --git a/plugins/MetaContacts/edit.c b/plugins/MetaContacts/edit.c index 9a5f55d920..f477d825dc 100644 --- a/plugins/MetaContacts/edit.c +++ b/plugins/MetaContacts/edit.c @@ -222,7 +222,7 @@ void ApplyChanges(CHANGES *chg) AI.format = PA_FORMAT_UNKNOWN; strcpy(AI.filename, "X"); - if((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) + if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) DBWriteContactSettingString(chg->hMeta, "ContactPhoto", "File",AI.filename); } @@ -388,7 +388,7 @@ INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR switch(LOWORD(wParam)) // hit control { case IDC_LST_CONTACTS: // did we hit our ListView contorl? - if(((LPNMHDR)lParam)->code == NM_CLICK) { + if (((LPNMHDR)lParam)->code == NM_CLICK) { hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS); sel=SendMessage(hwnd,LVM_GETNEXTITEM,-1,LVNI_FOCUSED|LVNI_SELECTED); // return item selected // enable buttons @@ -404,7 +404,7 @@ INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow(hwnd, (sel != -1) && (sel < changes.num_contacts - 1)); /* // custom draw stuff - change colour of listview things - doesn't affect selection :( - } else if(((LPNMHDR)lParam)->code == NM_CUSTOMDRAW) { + } else if (((LPNMHDR)lParam)->code == NM_CUSTOMDRAW) { SetWindowLong(hwndDlg, DWL_MSGRESULT, (LONG)ProcessCustomDraw(lParam)); return TRUE; */ diff --git a/plugins/MetaContacts/meta_api.c b/plugins/MetaContacts/meta_api.c index bf3aed5d2f..6a8781f6e1 100644 --- a/plugins/MetaContacts/meta_api.c +++ b/plugins/MetaContacts/meta_api.c @@ -88,7 +88,7 @@ INT_PTR MetaAPI_SetDefaultContactNum(WPARAM wParam, LPARAM lParam) { DWORD num_contacts = DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "NumContacts", -1); if(num_contacts == -1) return 1; - if((DWORD)lParam >= num_contacts || (DWORD)lParam < 0) + if ((DWORD)lParam >= num_contacts || (DWORD)lParam < 0) return 1; if(DBWriteContactSettingDword((HANDLE)wParam, META_PROTO, "Default", (DWORD)lParam)) return 1; @@ -120,7 +120,7 @@ INT_PTR MetaAPI_SetDefaultContact(WPARAM wParam, LPARAM lParam) { INT_PTR MetaAPI_ForceSendContactNum(WPARAM wParam, LPARAM lParam) { HANDLE hContact = Meta_GetContactHandle((HANDLE)wParam, (int)lParam); HANDLE hMeta = (HANDLE)DBGetContactSettingDword(hContact, META_PROTO, "Handle", 0); - if(!hContact || !hMeta || hMeta != (HANDLE)wParam || DBGetContactSettingByte(hMeta, META_PROTO, "ForceDefault", 0)) + if (!hContact || !hMeta || hMeta != (HANDLE)wParam || DBGetContactSettingByte(hMeta, META_PROTO, "ForceDefault", 0)) return 1; DBWriteContactSettingDword(hMeta, META_PROTO, "ForceSend", (DWORD)hContact); @@ -136,7 +136,7 @@ INT_PTR MetaAPI_ForceSendContactNum(WPARAM wParam, LPARAM lParam) { INT_PTR MetaAPI_ForceSendContact(WPARAM wParam, LPARAM lParam) { HANDLE hContact = (HANDLE)lParam; HANDLE hMeta = (HANDLE)DBGetContactSettingDword(hContact, META_PROTO, "Handle", 0); - if(!hContact || !hMeta || hMeta != (HANDLE)wParam || DBGetContactSettingByte(hMeta, META_PROTO, "ForceDefault", 0)) + if (!hContact || !hMeta || hMeta != (HANDLE)wParam || DBGetContactSettingByte(hMeta, META_PROTO, "ForceDefault", 0)) return 1; DBWriteContactSettingDword(hMeta, META_PROTO, "ForceSend", (DWORD)hContact); @@ -182,7 +182,7 @@ INT_PTR MetaAPI_GetForceState(WPARAM wParam, LPARAM lParam) { HANDLE hMeta = (HANDLE)wParam; HANDLE hContact; - if(!hMeta) return 0; + if (!hMeta) return 0; if(DBGetContactSettingByte(hMeta, META_PROTO, "ForceDefault", 0)) { if(lParam) *(DWORD *)lParam = DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "Default", -1); @@ -191,7 +191,7 @@ INT_PTR MetaAPI_GetForceState(WPARAM wParam, LPARAM lParam) { hContact = (HANDLE)DBGetContactSettingDword(hMeta, META_PROTO, "ForceSend", 0); - if(!hContact) { + if (!hContact) { if(lParam) *(DWORD *)lParam = -1; } else { if(lParam) *(DWORD *)lParam = (DWORD)Meta_GetContactNumber(hContact); diff --git a/plugins/MetaContacts/meta_main.c b/plugins/MetaContacts/meta_main.c index eea5e0666e..2de31f978a 100644 --- a/plugins/MetaContacts/meta_main.c +++ b/plugins/MetaContacts/meta_main.c @@ -187,7 +187,7 @@ int __declspec(dllexport)Load(PLUGINLINK *link) char *proto; while(hContact != NULL) { //proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - if(!DBGetContactSetting(hContact, "Protocol", "p", &dbv)) { + if (!DBGetContactSetting(hContact, "Protocol", "p", &dbv)) { proto = dbv.pszVal; if (proto && !lstrcmp( META_PROTO, proto)) { DBWriteContactSettingWord(hContact, META_PROTO, "Status", ID_STATUS_OFFLINE); @@ -218,7 +218,7 @@ int __declspec(dllexport)Load(PLUGINLINK *link) // that metacontacts: have the correct number of subcontacts, and have reasonable defaults if(Meta_SetHandles()) { // error - db corruption - if(!DBGetContactSettingByte(0, META_PROTO, "DisabledMessageShown", 0)) { + if (!DBGetContactSettingByte(0, META_PROTO, "DisabledMessageShown", 0)) { MessageBox(0, Translate("Error - Database corruption.\nPlugin disabled."), Translate("MetaContacts"), MB_OK | MB_ICONERROR); DBWriteContactSettingByte(0, META_PROTO, "DisabledMessageShown", 1); } diff --git a/plugins/MetaContacts/meta_menu.c b/plugins/MetaContacts/meta_menu.c index 36caabffa7..37ceb1116a 100644 --- a/plugins/MetaContacts/meta_menu.c +++ b/plugins/MetaContacts/meta_menu.c @@ -43,7 +43,7 @@ INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam) // Get some information about the selected contact. // proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0); - if(!DBGetContactSettingStringUtf((HANDLE)wParam,"CList","Group",&dbv)) { + if (!DBGetContactSettingStringUtf((HANDLE)wParam,"CList","Group",&dbv)) { group = _strdup(dbv.pszVal); DBFreeVariant(&dbv); } @@ -70,14 +70,14 @@ INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam) } // Assign the contact to the MetaContact just created (and make default). - if(!Meta_Assign((HANDLE)wParam,hMetaContact,TRUE)) { + if (!Meta_Assign((HANDLE)wParam,hMetaContact,TRUE)) { MessageBox(0,Translate("There was a problem in assigning the contact to the MetaContact"),Translate("Error"),MB_ICONEXCLAMATION); CallService(MS_DB_CONTACT_DELETE, (WPARAM)hMetaContact, 0); return 0; } // hide the contact if clist groups disabled (shouldn't create one anyway since menus disabled) - if(!Meta_IsEnabled()) + if (!Meta_IsEnabled()) DBWriteContactSettingByte(hMetaContact, "CList", "Hidden", 1); } @@ -153,7 +153,7 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) { hContact = Meta_GetContactHandle(hMeta, number); // make sure this contact thinks it's part of this metacontact - if((HANDLE)DBGetContactSettingDword(hContact,META_PROTO,"Handle", 0) == hMeta) { + if ((HANDLE)DBGetContactSettingDword(hContact,META_PROTO,"Handle", 0) == hMeta) { // remove link to meta contact DBDeleteContactSetting(hContact,META_PROTO,"IsSubcontact"); @@ -231,7 +231,7 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) { AI.format = PA_FORMAT_UNKNOWN; strcpy(AI.filename, "X"); - if((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) + if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) DBWriteContactSettingString(hMeta, "ContactPhoto", "File",AI.filename); } } @@ -250,9 +250,9 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) DWORD metaID; HANDLE hContact; - if((metaID=DBGetContactSettingDword((HANDLE)wParam,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) + if ((metaID=DBGetContactSettingDword((HANDLE)wParam,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) {// The wParam is a metacontact - if(!lParam) { // check from recursion - see second half of this function + if (!lParam) { // check from recursion - see second half of this function if(MessageBox((HWND)CallService(MS_CLUI_GETHWND,0,0),Translate("This will remove the MetaContact permanently.\n\nProceed Anyway?"), Translate("Are you sure?"),MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2)!=IDYES) { @@ -327,7 +327,7 @@ INT_PTR Meta_Default(WPARAM wParam,LPARAM lParam) { HANDLE hMeta; - if((hMeta = (HANDLE)DBGetContactSettingDword((HANDLE)wParam,META_PROTO,"Handle",0)) != 0) + if ((hMeta = (HANDLE)DBGetContactSettingDword((HANDLE)wParam,META_PROTO,"Handle",0)) != 0) { // the wParam is a subcontact DBWriteContactSettingDword(hMeta, META_PROTO, "Default", (DWORD)Meta_GetContactNumber((HANDLE)wParam)); NotifyEventHooks(hEventDefaultChanged, (WPARAM)hMeta, (LPARAM)(HANDLE)wParam); @@ -439,7 +439,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) hContact = Meta_GetContactHandle((HANDLE)wParam, i); proto = _strdup((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)); - if(!proto) + if (!proto) status = ID_STATUS_OFFLINE; else status = DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE); @@ -513,7 +513,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) } else {// This is a simple contact - if(!Meta_IsEnabled()) + if (!Meta_IsEnabled()) { // groups disabled - all meta menu options hidden mi.flags = CMIM_FLAGS | CMIF_HIDDEN; diff --git a/plugins/MetaContacts/meta_options.c b/plugins/MetaContacts/meta_options.c index 6fd6aa47e5..af23243c5e 100644 --- a/plugins/MetaContacts/meta_options.c +++ b/plugins/MetaContacts/meta_options.c @@ -65,7 +65,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara CheckDlgButton(hwndDlg, IDC_CHK_SUBHISTORY, options_changes.subhistory ? TRUE : FALSE); CheckDlgButton(hwndDlg, IDC_CHK_COPYDATA, options_changes.copydata ? TRUE : FALSE); - if(!options_changes.subcontact_windows) { + if (!options_changes.subcontact_windows) { hw = GetDlgItem(hwndDlg, IDC_CHK_METAHISTORY); EnableWindow(hw, FALSE); } else { @@ -257,7 +257,7 @@ int Meta_WriteOptions(MetaOptions *opt) { DBWriteContactSettingByte(NULL, META_PROTO, "MetaMessageIcon", (BYTE)(opt->flash_meta_message_icon ? 1 : 0)); DBWriteContactSettingByte(NULL, META_PROTO, "CopyUserInfo", (BYTE)(opt->copy_userinfo ? 1 : 0)); - if(!opt->subcontact_windows) + if (!opt->subcontact_windows) DBWriteContactSettingByte(NULL, META_PROTO, "MetaHistory", 1); else DBWriteContactSettingByte(NULL, META_PROTO, "MetaHistory", (BYTE)(opt->metahistory ? 1 : 0)); @@ -289,7 +289,7 @@ int Meta_ReadOptions(MetaOptions *opt) { opt->flash_meta_message_icon = (DBGetContactSettingByte(NULL, META_PROTO, "MetaMessageIcon", 1) == 1 ? TRUE : FALSE); opt->copy_userinfo = (DBGetContactSettingByte(NULL, META_PROTO, "CopyUserInfo", 1) == 1 ? TRUE : FALSE); - if(!opt->subcontact_windows) + if (!opt->subcontact_windows) opt->metahistory = TRUE; else opt->metahistory = (DBGetContactSettingByte(NULL, META_PROTO, "MetaHistory", 1) == 1 ? TRUE : FALSE); @@ -340,7 +340,7 @@ ProtoStatusPrio *priorities = 0; int GetRealPriority(char *proto, int status) { char szSetting[256]; - if(!proto) { + if (!proto) { mir_snprintf(szSetting, 256, "DefaultPrio_%d", status); return DBGetContactSettingWord(0, META_PROTO, szSetting, GetDefaultPrio(status)); } else { @@ -401,7 +401,7 @@ void WritePriorities() { current = priorities + (i + 1); for(j = ID_STATUS_OFFLINE; j <= ID_STATUS_OUTTOLUNCH; j++) { mir_snprintf(szSetting, 256, "ProtoPrio_%s%d", pppDesc[i]->szName, j); - if(!current->def[j - ID_STATUS_OFFLINE]) + if (!current->def[j - ID_STATUS_OFFLINE]) DBWriteContactSettingWord(0, META_PROTO, szSetting, (WORD)current->prio[j - ID_STATUS_OFFLINE]); else DBDeleteContactSetting(0, META_PROTO, szSetting); @@ -438,7 +438,7 @@ void SetPriority(int proto_index, int status, BOOL def, int prio) { } else { current = priorities + (proto_index + 1); current->def[status - ID_STATUS_OFFLINE] = def; - if(!def) { + if (!def) { current->prio[status - ID_STATUS_OFFLINE] = prio; } } diff --git a/plugins/MetaContacts/meta_services.c b/plugins/MetaContacts/meta_services.c index bbf9177132..67644af23c 100644 --- a/plugins/MetaContacts/meta_services.c +++ b/plugins/MetaContacts/meta_services.c @@ -90,7 +90,7 @@ INT_PTR Meta_GetCaps(WPARAM wParam,LPARAM lParam) ret = PF1_IM | PF1_CHAT | PF1_FILESEND | PF1_MODEMSGRECV | PF1_NUMERICUSERID; break; case PFLAGNUM_2: - if(!options.suppress_proto) { + if (!options.suppress_proto) { ret = PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE; } @@ -264,7 +264,7 @@ INT_PTR MetaFilter_SendMessage(WPARAM wParam,LPARAM lParam) CCSDATA *ccs = (CCSDATA *) lParam; HANDLE hMeta; - if((hMeta = (HANDLE)DBGetContactSettingDword(ccs->hContact,META_PROTO, "Handle", (DWORD)0)) == (DWORD)0) { + if ((hMeta = (HANDLE)DBGetContactSettingDword(ccs->hContact,META_PROTO, "Handle", (DWORD)0)) == (DWORD)0) { return CallService(MS_PROTO_CHAINSEND, wParam, lParam); // Can't find the MetaID of the metacontact linked to } @@ -336,7 +336,7 @@ INT_PTR Meta_SendMessage(WPARAM wParam,LPARAM lParam) DWORD default_contact_number; - if((default_contact_number = DBGetContactSettingDword(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1) + if ((default_contact_number = DBGetContactSettingDword(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1) { // This is a simple contact, let through the stack of protocols // (this should normally not happen, since linked contacts do not appear on the list.) @@ -350,7 +350,7 @@ INT_PTR Meta_SendMessage(WPARAM wParam,LPARAM lParam) most_online = Meta_GetMostOnline(ccs->hContact); //DBEVENTINFO dbei; - if(!most_online) { + if (!most_online) { DWORD dwThreadId; HANDLE hEvent; TFakeAckParams *tfap; @@ -429,7 +429,7 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) PROTORECVEVENT *pre = (PROTORECVEVENT *) ccs->lParam; HANDLE hMeta; - if((hMeta = (HANDLE)DBGetContactSettingDword(ccs->hContact,META_PROTO, "Handle", (DWORD)0)) == (DWORD)0) { + if ((hMeta = (HANDLE)DBGetContactSettingDword(ccs->hContact,META_PROTO, "Handle", (DWORD)0)) == (DWORD)0) { CallService(MS_PROTO_CHAINRECV, wParam, (LPARAM)ccs); // Can't find the MetaID of the metacontact linked to // this contact, let through the protocol chain return 0; @@ -444,7 +444,7 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) // if meta disabled (now message api) or window open (message api), or using subcontact windows, // let through but add db event for metacontact history - if(!Meta_IsEnabled() + if (!Meta_IsEnabled() || DBGetContactSettingByte(ccs->hContact, META_PROTO, "WindowOpen", 0) == 1 || options.subcontact_windows) { @@ -494,7 +494,7 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) } } - if(!added) { + if (!added) { // otherwise add raw db event ZeroMemory(&dbei, sizeof(dbei)); dbei.cbSize = sizeof(dbei); @@ -571,7 +571,7 @@ INT_PTR Meta_RecvMessage(WPARAM wParam, LPARAM lParam) proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); // contact is not a meta proto contact - just leave it - if(!proto || strcmp(proto, META_PROTO)) { + if (!proto || strcmp(proto, META_PROTO)) { return 0; } @@ -629,7 +629,7 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam) return 0; // Can't find the MetaID, let through the protocol chain - if(!strcmp(ack->szModule, META_PROTO)) { + if (!strcmp(ack->szModule, META_PROTO)) { return 0; // don't rebroadcast our own acks } @@ -654,8 +654,8 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam) return 0; } - //if(!DBGetContactSetting(AI.hContact, "ContactPhoto", "File", &dbv)) { - if(!DBGetContactSetting(ack->hContact, "ContactPhoto", "File", &dbv)) { + //if (!DBGetContactSetting(AI.hContact, "ContactPhoto", "File", &dbv)) { + if (!DBGetContactSetting(ack->hContact, "ContactPhoto", "File", &dbv)) { DBWriteContactSettingString(hUser, "ContactPhoto", "File", dbv.pszVal); DBFreeVariant(&dbv); } @@ -713,7 +713,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); int meta_id; while ( hContact != NULL ) { - if((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) { + if ((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) { Meta_CopyData(hContact); } hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 ); @@ -734,7 +734,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) // from here on, we're just interested in contact settings if(wParam == 0) return 0; - if((hMeta=(HANDLE)DBGetContactSettingDword((HANDLE)wParam,META_PROTO,"Handle",0))!=0 + if ((hMeta=(HANDLE)DBGetContactSettingDword((HANDLE)wParam,META_PROTO,"Handle",0))!=0 && CallService(MS_DB_CONTACT_IS, (WPARAM)hMeta, 0)) // just to be safe { // This contact is attached to a MetaContact. @@ -742,9 +742,9 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) contact_number = Meta_GetContactNumber((HANDLE)wParam); if(contact_number == -1) return 0; // exit - db corruption - if(!meta_group_hack_disabled && !strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "Group") && + if (!meta_group_hack_disabled && !strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "Group") && Meta_IsEnabled() && DBGetContactSettingByte((HANDLE)wParam, META_PROTO, "Hidden", 0) == 0 && !Miranda_Terminated()) { - if((dcws->value.type == DBVT_ASCIIZ || dcws->value.type == DBVT_UTF8) && !Meta_IsHiddenGroup(dcws->value.pszVal)) { + if ((dcws->value.type == DBVT_ASCIIZ || dcws->value.type == DBVT_UTF8) && !Meta_IsHiddenGroup(dcws->value.pszVal)) { // subcontact group reassigned - copy to saved group MyDBWriteContactSetting((HANDLE)wParam, META_PROTO, "OldCListGroup", &dcws->value); DBWriteContactSettingString((HANDLE)wParam, "CList", "Group", META_HIDDEN_GROUP); @@ -755,7 +755,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) } else // copy IP - if(!strcmp(dcws->szSetting, "IP")) { + if (!strcmp(dcws->szSetting, "IP")) { if(dcws->value.type == DBVT_DWORD) DBWriteContactSettingDword(hMeta, META_PROTO, "IP", dcws->value.dVal); else @@ -763,7 +763,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) } else // copy RealIP - if(!strcmp(dcws->szSetting, "RealIP")) { + if (!strcmp(dcws->szSetting, "RealIP")) { if(dcws->value.type == DBVT_DWORD) DBWriteContactSettingDword(hMeta, META_PROTO, "RealIP", dcws->value.dVal); else @@ -771,7 +771,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) } else // copy ListeningTo - if(!strcmp(dcws->szSetting, "ListeningTo")) { + if (!strcmp(dcws->szSetting, "ListeningTo")) { switch(dcws->value.type) { case DBVT_ASCIIZ: DBWriteContactSettingString(hMeta, META_PROTO, "ListeningTo", dcws->value.pszVal); @@ -788,7 +788,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) } } else - if(!strcmp(dcws->szSetting, "Nick") && !dcws->value.type == DBVT_DELETED) { + if (!strcmp(dcws->szSetting, "Nick") && !dcws->value.type == DBVT_DELETED) { DBVARIANT dbv; HANDLE most_online; @@ -812,21 +812,21 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) return 0; } else - if(!strcmp(dcws->szSetting, "IdleTS")) { + if (!strcmp(dcws->szSetting, "IdleTS")) { if(dcws->value.type == DBVT_DWORD) DBWriteContactSettingDword(hMeta, META_PROTO, "IdleTS", dcws->value.dVal); else if(dcws->value.type == DBVT_DELETED) DBWriteContactSettingDword(hMeta, META_PROTO, "IdleTS", 0); } else - if(!strcmp(dcws->szSetting, "LogonTS")) { + if (!strcmp(dcws->szSetting, "LogonTS")) { if(dcws->value.type == DBVT_DWORD) DBWriteContactSettingDword(hMeta, META_PROTO, "LogonTS", dcws->value.dVal); else if(dcws->value.type == DBVT_DELETED) DBWriteContactSettingDword(hMeta, META_PROTO, "LogonTS", 0); } else - if(!strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "MyHandle")) { + if (!strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "MyHandle")) { HANDLE most_online; if(dcws->value.type == DBVT_DELETED) { @@ -856,7 +856,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) return 0; } else - if(!strcmp(dcws->szSetting, "Status") && !dcws->value.type == DBVT_DELETED) { + if (!strcmp(dcws->szSetting, "Status") && !dcws->value.type == DBVT_DELETED) { // subcontact changing status // update subcontact status setting @@ -869,7 +869,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) DBWriteContactSettingString(hMeta, META_PROTO, buffer, buffer2); // if the contact was forced, unforce it (which updates status) - if((HANDLE)DBGetContactSettingDword(hMeta, META_PROTO, "ForceSend", 0) == (HANDLE)wParam) { + if ((HANDLE)DBGetContactSettingDword(hMeta, META_PROTO, "ForceSend", 0) == (HANDLE)wParam) { MetaAPI_UnforceSendContact((WPARAM)hMeta, 0); } else { // set status to that of most online contact @@ -891,7 +891,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) AI.format = PA_FORMAT_UNKNOWN; strcpy(AI.filename, "X"); - if((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) + if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) DBWriteContactSettingString(hMeta, "ContactPhoto", "File",AI.filename); } } else @@ -904,8 +904,8 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) Meta_CopyData(hMeta); } else - if(!meta_group_hack_disabled && !strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "Hidden")) { - if((dcws->value.type == DBVT_DELETED || DBGetContactSettingByte((HANDLE)wParam, "CList", "Hidden", 0) == 0) + if (!meta_group_hack_disabled && !strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "Hidden")) { + if ((dcws->value.type == DBVT_DELETED || DBGetContactSettingByte((HANDLE)wParam, "CList", "Hidden", 0) == 0) && DBGetContactSettingByte((HANDLE)wParam, META_PROTO, "Hidden", 0) == 1) { // a subcontact we hid (e.g. jabber) has been unhidden - hide it again :( @@ -982,7 +982,7 @@ INT_PTR Meta_UserIsTyping(WPARAM wParam, LPARAM lParam) HANDLE most_online = Meta_GetMostOnline((HANDLE)wParam); Meta_CopyContactNick((HANDLE)wParam, most_online); - if(!most_online) return 0; + if (!most_online) return 0; proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); if(proto) { @@ -1007,12 +1007,12 @@ int Meta_ContactIsTyping(WPARAM wParam, LPARAM lParam) { HANDLE hMeta; - if((hMeta = (HANDLE)DBGetContactSettingDword((HANDLE)wParam,META_PROTO,"Handle",(DWORD)0)) != 0 + if ((hMeta = (HANDLE)DBGetContactSettingDword((HANDLE)wParam,META_PROTO,"Handle",(DWORD)0)) != 0 // check metacontacts enabled && Meta_IsEnabled() ) { // This contact is attached to a MetaContact. - if(!options.subcontact_windows) { // we don't want clicking on the clist notification icon to open the metacontact message window + if (!options.subcontact_windows) { // we don't want clicking on the clist notification icon to open the metacontact message window // try to remove any clist events we added for subcontact CallServiceSync(MS_CLIST_REMOVEEVENT, wParam, (LPARAM) 1); @@ -1052,7 +1052,7 @@ int Meta_MessageWindowEvent(WPARAM wParam, LPARAM lParam) { message_window_api_enabled = TRUE; - if((hMeta = (HANDLE)DBGetContactSettingDword(mwed->hContact, META_PROTO, "Handle", 0)) != 0 + if ((hMeta = (HANDLE)DBGetContactSettingDword(mwed->hContact, META_PROTO, "Handle", 0)) != 0 || DBGetContactSettingDword(mwed->hContact, META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1) { // contact is subcontact of metacontact, or an actual metacontact - record whether window is open or closed @@ -1064,7 +1064,7 @@ int Meta_MessageWindowEvent(WPARAM wParam, LPARAM lParam) { } } else if(mwed->uType == MSG_WINDOW_EVT_CLOSE || mwed->uType == MSG_WINDOW_EVT_CLOSING) { DBWriteContactSettingByte(mwed->hContact, META_PROTO, "WindowOpen", 0); - if(!hMeta) { // hMeta is 0 for metacontact (sorry) + if (!hMeta) { // hMeta is 0 for metacontact (sorry) DWORD saved_def; MetaAPI_UnforceSendContact((WPARAM)mwed->hContact, 0); @@ -1152,7 +1152,7 @@ int Meta_CListMW_ExtraIconsApply(WPARAM wParam, LPARAM lParam) { WORD status = DBGetContactSettingWord(most_online_im, proto, "Status", ID_STATUS_OFFLINE); iec.cbSize = sizeof(iec); for(i = 0; i < proto_count; i++) { - if(!strcmp((proto_names + i * 128), proto)) { + if (!strcmp((proto_names + i * 128), proto)) { if(hExtraImage[i * 2 + (status == ID_STATUS_OFFLINE ? 1 : 0)]) { iec.hImage = hExtraImage[i * 2 + (status == ID_STATUS_OFFLINE ? 1 : 0)]; iec.ColumnType = EXTRA_ICON_ADV2; @@ -1186,7 +1186,7 @@ int Meta_ClistDoubleClicked(WPARAM wParam, LPARAM lParam) { char buffer[512]; int caps; - if(!most_online) + if (!most_online) return 0; if(options.subcontact_windows) { @@ -1208,7 +1208,7 @@ int Meta_ClistDoubleClicked(WPARAM wParam, LPARAM lParam) { // get the contacts messaging capabilities caps = CallService(buffer, (WPARAM)PFLAGNUM_1, 0); - if((caps & PF1_IMSEND) || (caps & PF1_CHAT) || (proto && strcmp(proto, "IRC") == 0)) + if ((caps & PF1_IMSEND) || (caps & PF1_CHAT) || (proto && strcmp(proto, "IRC") == 0)) // let event process normally return 0; else { @@ -1369,7 +1369,7 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); int meta_id; while ( hContact != NULL ) { - if((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) { + if ((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) { Meta_CopyData(hContact); } hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 ); @@ -1380,7 +1380,7 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) InitIcons(); - if(!Meta_IsEnabled()) + if (!Meta_IsEnabled()) { // modify main menu item menu.flags = CMIM_NAME; @@ -1464,7 +1464,7 @@ INT_PTR Meta_ContactMenuFunc(WPARAM wParam, LPARAM lParam) { caps = CallService(buffer, (WPARAM)PFLAGNUM_1, 0); - if((caps & PF1_IMSEND) || (caps & PF1_CHAT) || (proto && strcmp(proto, "IRC") == 0)) { + if ((caps & PF1_IMSEND) || (caps & PF1_CHAT) || (proto && strcmp(proto, "IRC") == 0)) { // set default contact for sending/status and open message window DBWriteContactSettingDword((HANDLE)wParam, META_PROTO, "Default", (DWORD)(int)lParam); NotifyEventHooks(hEventDefaultChanged, wParam, (LPARAM)hContact); @@ -1511,7 +1511,7 @@ INT_PTR Meta_FileResume(WPARAM wParam, LPARAM lParam) DBFreeVariant(&dbv); - if(!most_online) + if (!most_online) return 0; proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); @@ -1547,7 +1547,7 @@ INT_PTR Meta_FileAllow(WPARAM wParam, LPARAM lParam) DBFreeVariant(&dbv); - if(!most_online) + if (!most_online) return 0; proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); @@ -1584,7 +1584,7 @@ INT_PTR Meta_FileDeny(WPARAM wParam, LPARAM lParam) DBFreeVariant(&dbv); - if(!most_online) + if (!most_online) return 1; proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); @@ -1621,7 +1621,7 @@ INT_PTR Meta_FileRecv(WPARAM wParam, LPARAM lParam) DBFreeVariant(&dbv); - if(!most_online) + if (!most_online) return 0; proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); @@ -1659,7 +1659,7 @@ int Meta_FileCancel(WPARAM wParam, LPARAM lParam) DBFreeVariant(&dbv); - if(!most_online) + if (!most_online) return 0; proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); @@ -1683,7 +1683,7 @@ INT_PTR Meta_FileSend(WPARAM wParam, LPARAM lParam) char *proto = 0; DWORD default_contact_number; - if((default_contact_number = DBGetContactSettingDword(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1) + if ((default_contact_number = DBGetContactSettingDword(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1) { // This is a simple contact // (this should normally not happen, since linked contacts do not appear on the list.) @@ -1698,7 +1698,7 @@ INT_PTR Meta_FileSend(WPARAM wParam, LPARAM lParam) most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_FILESEND); - if(!most_online) { + if (!most_online) { //PUShowMessage("no most online for ft", SM_NOTIFY); return 0; } @@ -1728,7 +1728,7 @@ INT_PTR Meta_GetAwayMsg(WPARAM wParam, LPARAM lParam) { char *proto = 0; DWORD default_contact_number; - if((default_contact_number = DBGetContactSettingDword(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1) + if ((default_contact_number = DBGetContactSettingDword(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1) { // This is a simple contact // (this should normally not happen, since linked contacts do not appear on the list.) @@ -1740,11 +1740,11 @@ INT_PTR Meta_GetAwayMsg(WPARAM wParam, LPARAM lParam) { most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_MODEMSGRECV); - if(!most_online) + if (!most_online) return 0; proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); - if(!proto) return 0; + if (!proto) return 0; //Meta_CopyContactNick(ccs->hContact, most_online, proto); @@ -1761,7 +1761,7 @@ INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) { char *proto = 0; DWORD default_contact_number; - if((default_contact_number = DBGetContactSettingDword(AI->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1) + if ((default_contact_number = DBGetContactSettingDword(AI->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1) { // This is a simple contact // (this should normally not happen, since linked contacts do not appear on the list.) @@ -1776,11 +1776,11 @@ INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) { hMeta = AI->hContact; hSub = Meta_GetMostOnlineSupporting(AI->hContact, PFLAGNUM_4, PF4_AVATARS); - if(!hSub) + if (!hSub) return GAIR_NOAVATAR; proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hSub, 0); - if(!proto) return GAIR_NOAVATAR; + if (!proto) return GAIR_NOAVATAR; AI->hContact = hSub; @@ -1797,7 +1797,7 @@ INT_PTR Meta_GetInfo(WPARAM wParam, LPARAM lParam) { char *proto = 0; DWORD default_contact_number; - if((default_contact_number = DBGetContactSettingDword(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1) + if ((default_contact_number = DBGetContactSettingDword(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1) { // This is a simple contact // (this should normally not happen, since linked contacts do not appear on the list.) @@ -1811,23 +1811,23 @@ INT_PTR Meta_GetInfo(WPARAM wParam, LPARAM lParam) { most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_4, PF4_AVATARS); - if(!most_online) + if (!most_online) return 0; proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); - if(!proto) return 0; + if (!proto) return 0; AI.cbSize = sizeof(AI); AI.hContact = ccs->hContact; AI.format = PA_FORMAT_UNKNOWN; strcpy(AI.filename, "X"); - if((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) + if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) DBWriteContactSettingString(ccs->hContact, "ContactPhoto", "File",AI.filename); most_online = Meta_GetMostOnline(ccs->hContact); Meta_CopyContactNick(ccs->hContact, most_online); - if(!most_online) + if (!most_online) return 0; //Meta_CopyContactNick(ccs->hContact, most_online, proto); diff --git a/plugins/MetaContacts/meta_utils.c b/plugins/MetaContacts/meta_utils.c index 38a9e69f6c..ccee31e2a5 100644 --- a/plugins/MetaContacts/meta_utils.c +++ b/plugins/MetaContacts/meta_utils.c @@ -40,7 +40,7 @@ INT_PTR MyDBGetContactSetting(HANDLE hContact, const char *szModule, const char static BOOL strsvc, strsvcset = FALSE; memset(dbv, 0, sizeof(DBVARIANT)); - if(!strsvcset) {strsvc = ServiceExists(MS_DB_CONTACT_GETSETTING_STR); strsvcset = TRUE;} + if (!strsvcset) {strsvc = ServiceExists(MS_DB_CONTACT_GETSETTING_STR); strsvcset = TRUE;} // preserve unicode strings - this service should return other data types unchanged if(strsvc) return DBGetContactSettingW(hContact, szModule, szSetting, dbv); @@ -70,10 +70,10 @@ int Meta_EqualDBV(DBVARIANT *dbv, DBVARIANT *id) { break; case DBVT_ASCIIZ: case DBVT_UTF8: - if(!strcmp(dbv->pszVal,id->pszVal)) + if (!strcmp(dbv->pszVal,id->pszVal)) return 1; case DBVT_WCHAR: - if(!wcscmp(dbv->pwszVal,id->pwszVal)) + if (!wcscmp(dbv->pwszVal,id->pwszVal)) return 1; case DBVT_BLOB: if(dbv->cpbVal == id->cpbVal) @@ -110,14 +110,14 @@ HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id) char str[MAXMODULELABELLENGTH]; strcpy(str,protocol); strcat(str,PS_GETCAPS); - if(!ServiceExists(str)) + if (!ServiceExists(str)) return NULL; field = (char *)CallProtoService(protocol,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0); hUser = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); while(hUser) { // Scan the database and retrieve the field for each contact - if(!DBGetContactSetting(hUser,protocol,field,&dbv)) + if (!DBGetContactSetting(hUser,protocol,field,&dbv)) { if(dbv.type == id->type) { // If the id parameter and the value returned by the DBGetContactSetting @@ -140,7 +140,7 @@ HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id) break; case DBVT_ASCIIZ: case DBVT_UTF8: - if(!strcmp(dbv.pszVal,id->pszVal)) + if (!strcmp(dbv.pszVal,id->pszVal)) { DBFreeVariant(&dbv); return hUser; @@ -151,7 +151,7 @@ HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id) break; } case DBVT_WCHAR: - if(!wcscmp(dbv.pwszVal,id->pwszVal)) + if (!wcscmp(dbv.pwszVal,id->pwszVal)) { DBFreeVariant(&dbv); return hUser; @@ -177,7 +177,7 @@ HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id) } // end switch } else DBFreeVariant(&dbv); - } // end if(!DBGetContactSetting(hUser,protocol,field,&dbv)) + } // end if (!DBGetContactSetting(hUser,protocol,field,&dbv)) // This contact wasn't the good one, go to the next. hUser = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hUser,0); } // end while @@ -249,15 +249,15 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) WORD status; HANDLE most_online; - if((metaID=DBGetContactSettingDword(dest,META_PROTO,META_ID,(DWORD)-1))==-1) { + if ((metaID=DBGetContactSettingDword(dest,META_PROTO,META_ID,(DWORD)-1))==-1) { MessageBox(0, Translate("Could not get MetaContact id"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING); return FALSE; } - if((num_contacts=DBGetContactSettingDword(dest,META_PROTO,"NumContacts",(DWORD)-1))==-1) { + if ((num_contacts=DBGetContactSettingDword(dest,META_PROTO,"NumContacts",(DWORD)-1))==-1) { MessageBox(0, Translate("Could not retreive MetaContact contact count"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING); return FALSE; } - if(!(proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)src,0))) { + if (!(proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)src,0))) { MessageBox(0, Translate("Could not retreive contact protocol"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING); return FALSE; } @@ -309,7 +309,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) DBFreeVariant(&cws.value); // If we can get the nickname of the subcontact... - if(!DBGetContactSetting(src,proto,"Nick",&cws.value)) { + if (!DBGetContactSetting(src,proto,"Nick",&cws.value)) { // write the nickname strcpy(buffer, "Nick"); strcat(buffer, _itoa((int)(num_contacts - 1), buffer2, 10)); @@ -340,7 +340,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) DBWriteContactSettingString(dest, META_PROTO, buffer, name); // Get the status - if(!proto) + if (!proto) status = ID_STATUS_OFFLINE; else status = DBGetContactSettingWord(src, proto, "Status", ID_STATUS_OFFLINE); @@ -373,7 +373,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) // Add the MetaContactFilter module to the old contact to intercept messages and forward to the new // metacontact - if( !CallService( MS_PROTO_ISPROTOONCONTACT, (WPARAM)src, ( LPARAM )META_FILTER )) + if ( !CallService( MS_PROTO_ISPROTOONCONTACT, (WPARAM)src, ( LPARAM )META_FILTER )) CallService( MS_PROTO_ADDTOCONTACT, (WPARAM)src, ( LPARAM )META_FILTER ); // Write the link in the contact @@ -423,7 +423,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) AI.format = PA_FORMAT_UNKNOWN; strcpy(AI.filename, "X"); - if((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) + if ((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS) DBWriteContactSettingString(dest, "ContactPhoto", "File",AI.filename); } @@ -469,7 +469,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca char *proto, *most_online_proto; // you can't get more online than having the default contact ONLINE - so check that first - if((default_contact_number = DBGetContactSettingDword(hMeta,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1) + if ((default_contact_number = DBGetContactSettingDword(hMeta,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1) { // This is a simple contact - return NULL to signify error. // (this should normally not happen, since all meta contacts have a default contact) @@ -489,7 +489,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca return most_online_contact; // a subcontact is being temporarily 'forced' to do sending - if((most_online_contact = (HANDLE)DBGetContactSettingDword(hMeta, META_PROTO, "ForceSend", 0))) { + if ((most_online_contact = (HANDLE)DBGetContactSettingDword(hMeta, META_PROTO, "ForceSend", 0))) { caps = proto ? CallProtoService(proto, PS_GETCAPS, (WPARAM)pflagnum, 0) : 0; if(proto && strcmp(proto, "IRC") == 0) caps |= PF1_IM; if(proto && (caps & capability) == capability && capability != 0) // capability is 0 when we're working out status @@ -523,7 +523,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca hContact = Meta_GetContactHandle(hMeta, i); proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - if(!proto || CallProtoService(proto, PS_GETSTATUS, 0, 0) < ID_STATUS_ONLINE) // proto offline or connecting + if (!proto || CallProtoService(proto, PS_GETSTATUS, 0, 0) < ID_STATUS_ONLINE) // proto offline or connecting continue; caps = proto ? CallProtoService(proto, PS_GETCAPS, (WPARAM)pflagnum, 0) : 0; @@ -611,9 +611,9 @@ BOOL dbv_same(DBVARIANT *dbv1, DBVARIANT *dbv2) { hContact = Meta_GetContactHandle(hMeta, j); if(hContact) { - if(!module) { + if (!module) { used_mod = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - if(!used_mod) continue; // next contact + if (!used_mod) continue; // next contact } else used_mod = module; @@ -627,14 +627,14 @@ BOOL dbv_same(DBVARIANT *dbv1, DBVARIANT *dbv2) { if(strcmp(settings[i], "MirVer") == 0) { if(DBGetContactSettingWord(hContact, used_mod, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) { - if(!free || (dbv1.pszVal == NULL || strcmp(dbv1.pszVal, "") == 0 || strlen(dbv1.pszVal) < 2)) { + if (!free || (dbv1.pszVal == NULL || strcmp(dbv1.pszVal, "") == 0 || strlen(dbv1.pszVal) < 2)) { MyDBWriteContactSetting(hMeta, (module ? used_mod : META_PROTO), settings[i], &dbv2); bDataWritten = TRUE; //only break if found something to copy } } } else { - if(!free || !dbv_same(&dbv1, &dbv2)) { + if (!free || !dbv_same(&dbv1, &dbv2)) { MyDBWriteContactSetting(hMeta, (module ? used_mod : META_PROTO), settings[i], &dbv2); if(dbv2.type == DBVT_ASCIIZ || dbv2.type == DBVT_UTF8) { if(dbv2.pszVal != NULL && strcmp(dbv2.pszVal, "") != 0) @@ -706,21 +706,21 @@ void CopyStatusData(HANDLE hMeta) { proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); if(proto && DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE) == status) { - if(!bDoneStatus && !MyDBGetContactSetting(hContact, "CList", "StatusMsg", &dbv)) { + if (!bDoneStatus && !MyDBGetContactSetting(hContact, "CList", "StatusMsg", &dbv)) { MyDBWriteContactSetting(hMeta, "CList", "StatusMsg", &dbv); DBFreeVariant(&dbv); bDoneStatus = TRUE; } - if((!bDoneXStatus) && (!MyDBGetContactSetting(hContact, proto, "XStatusId", &dbv)) && dbv.type != DBVT_DELETED) { + if ((!bDoneXStatus) && (!MyDBGetContactSetting(hContact, proto, "XStatusId", &dbv)) && dbv.type != DBVT_DELETED) { DBWriteContactSettingString(hMeta, META_PROTO, "XStatusProto", proto); MyDBWriteContactSetting(hMeta, META_PROTO, "XStatusId", &dbv); DBFreeVariant(&dbv); - if(!MyDBGetContactSetting(hContact, proto, "XStatusMsg", &dbv)) { + if (!MyDBGetContactSetting(hContact, proto, "XStatusMsg", &dbv)) { MyDBWriteContactSetting(hMeta, META_PROTO, "XStatusMsg", &dbv); DBFreeVariant(&dbv); } - if(!MyDBGetContactSetting(hContact, proto, "XStatusName", &dbv)) { + if (!MyDBGetContactSetting(hContact, proto, "XStatusName", &dbv)) { MyDBWriteContactSetting(hMeta, META_PROTO, "XStatusName", &dbv); DBFreeVariant(&dbv); } @@ -731,8 +731,8 @@ void CopyStatusData(HANDLE hMeta) { if(bDoneStatus && bDoneXStatus) break; } - if(!bDoneStatus) DBDeleteContactSetting(hMeta, "CList", "StatusMsg"); - if(!bDoneXStatus) { + if (!bDoneStatus) DBDeleteContactSetting(hMeta, "CList", "StatusMsg"); + if (!bDoneXStatus) { DBDeleteContactSetting(hMeta, META_PROTO, "XStatusId"); DBDeleteContactSetting(hMeta, META_PROTO, "XStatusMsg"); DBDeleteContactSetting(hMeta, META_PROTO, "XStatusName"); @@ -773,7 +773,7 @@ int Meta_SetHandles(void) { BOOL found; while ( hContact != NULL ) { - if((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1))!=(DWORD)-1) { + if ((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1))!=(DWORD)-1) { // is a subcontact // get nick for debug messages @@ -837,7 +837,7 @@ int Meta_SetHandles(void) { hContact2 = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact2, 0 ); } - if(!found) { + if (!found) { // problem - subcontact's meta not found MessageBox(0, "Subcontact's MetaContact not found - deleting MetaContact data", nick_buffer, MB_OK | MB_ICONERROR); @@ -855,14 +855,14 @@ int Meta_SetHandles(void) { CallService(MS_IGNORE_UNIGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE); } else { - if(!DBGetContactSettingByte(hContact, META_PROTO, "IsSubcontact", 0)) + if (!DBGetContactSettingByte(hContact, META_PROTO, "IsSubcontact", 0)) DBWriteContactSettingByte(hContact, META_PROTO, "IsSubcontact", 1); } } else DBDeleteContactSetting(hContact, META_PROTO, "Handle"); - if((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) { + if ((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) { // is a metacontact // get nick for debug messages @@ -905,7 +905,7 @@ int Meta_SetHandles(void) { // loop through one more time - check contact counts match hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); while ( hContact != NULL ) { - if((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) { + if ((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) { // get nick for debug messages strcpy(nick_buffer, Translate("MetaId: ")); strcat(nick_buffer, _itoa(meta_id, buffer2, 10)); @@ -948,7 +948,7 @@ int Meta_HideLinkedContacts(void) { // ensure the hidden group does not exist (how this occurs i wonder but there have been reports!) // (sometimes protocol server side groups are to blame - msn and icq) - if(!meta_group_hack_disabled) do { + if (!meta_group_hack_disabled) do { group_name = (char *)CallService(MS_CLIST_GROUPGETNAME, (WPARAM)hGroup, 0); if(group_name && !strcmp(group_name, META_HIDDEN_GROUP)) { // disabled because it shows a message box @@ -967,11 +967,11 @@ int Meta_HideLinkedContacts(void) { while ( hContact != NULL ) { - if((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1))!=(DWORD)-1) { + if ((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1))!=(DWORD)-1) { // is a subcontact // * ensure filter present - if( !CallService( MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, ( LPARAM )META_FILTER )) + if ( !CallService( MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, ( LPARAM )META_FILTER )) CallService( MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, ( LPARAM )META_FILTER ); @@ -992,7 +992,7 @@ int Meta_HideLinkedContacts(void) { num_contacts = DBGetContactSettingDword(hContact2, META_PROTO, "NumContacts", (DWORD)-1); if(contact_number >= 0 && contact_number < num_contacts) { - if(!proto) + if (!proto) status = ID_STATUS_OFFLINE; else status = DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE); @@ -1019,7 +1019,7 @@ int Meta_HideLinkedContacts(void) { DBFreeVariant(&dbv); } else { - if(!DBGetContactSetting(hContact, "CList", "MyHandle", &dbv)) { + if (!DBGetContactSetting(hContact, "CList", "MyHandle", &dbv)) { strcpy(buffer, "CListName"); strcat(buffer, _itoa(contact_number, buffer2, 10)); MyDBWriteContactSetting(hContact2, META_PROTO, buffer, &dbv); @@ -1074,7 +1074,7 @@ int Meta_UnhideLinkedContacts(void) { hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 ); } - if(!CallService(MS_SYSTEM_TERMINATED, 0, 0)) + if (!CallService(MS_SYSTEM_TERMINATED, 0, 0)) CallService(MS_CLUI_SORTLIST, 0, 0); return 0; } @@ -1107,7 +1107,7 @@ int Meta_HideMetaContacts(int hide) { hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 ); } - if(!CallService(MS_SYSTEM_TERMINATED, 0, 0)) + if (!CallService(MS_SYSTEM_TERMINATED, 0, 0)) CallService(MS_CLUI_SORTLIST, 0, 0); return 0; } @@ -1131,9 +1131,9 @@ void Meta_RestoreGroup(HANDLE hContact) { } else { DBCONTACTWRITESETTING cws; - if(!DBGetContactSetting(hContact, META_PROTO, "OldCListGroup", &cws.value)) { + if (!DBGetContactSetting(hContact, META_PROTO, "OldCListGroup", &cws.value)) { - if((cws.value.type == DBVT_ASCIIZ || cws.value.type == DBVT_UTF8) && !strcmp(cws.value.pszVal, META_HIDDEN_GROUP)) { + if ((cws.value.type == DBVT_ASCIIZ || cws.value.type == DBVT_UTF8) && !strcmp(cws.value.pszVal, META_HIDDEN_GROUP)) { DBDeleteContactSetting(hContact, "CList", "Group"); } else { int hGroup = 1; @@ -1168,8 +1168,8 @@ void Meta_RestoreGroup(HANDLE hContact) { } DBDeleteContactSetting(hContact, META_PROTO, "OldCListGroup"); - if(!DBGetContactSetting(hContact, "CList", "Group", &cws.value)) { - if((cws.value.type == DBVT_ASCIIZ || cws.value.type == DBVT_UTF8) && !strcmp(cws.value.pszVal, META_HIDDEN_GROUP)) { + if (!DBGetContactSetting(hContact, "CList", "Group", &cws.value)) { + if ((cws.value.type == DBVT_ASCIIZ || cws.value.type == DBVT_UTF8) && !strcmp(cws.value.pszVal, META_HIDDEN_GROUP)) { DBDeleteContactSetting(hContact, "CList", "Group"); } DBFreeVariant(&cws.value); @@ -1200,8 +1200,8 @@ void Meta_SetGroup(HANDLE hContact) { } else { DBCONTACTWRITESETTING cws; // save old group and move to invisible group (i.e. non-existent group) - if(!MyDBGetContactSetting(hContact, "CList", "Group", &cws.value)) { - if((cws.value.type == DBVT_ASCIIZ || cws.value.type == DBVT_UTF8) && !strcmp(cws.value.pszVal, META_HIDDEN_GROUP)) { + if (!MyDBGetContactSetting(hContact, "CList", "Group", &cws.value)) { + if ((cws.value.type == DBVT_ASCIIZ || cws.value.type == DBVT_UTF8) && !strcmp(cws.value.pszVal, META_HIDDEN_GROUP)) { // it's already in the group (shouldn't be - but maybe a crash) } else { cws.szModule = META_PROTO; @@ -1283,15 +1283,15 @@ int Meta_CopyContactNick(HANDLE hMeta, HANDLE hContact) { hContact = Meta_GetContactHandle(hMeta, 0); } - if(!hContact) return 1; + if (!hContact) return 1; //proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); // read proto direct from db, since we do this on load and other proto plugins may not be loaded yet - if(!DBGetContactSetting(hContact, "Protocol", "p", &dbv_proto)) { + if (!DBGetContactSetting(hContact, "Protocol", "p", &dbv_proto)) { proto = dbv_proto.pszVal; if(options.clist_contact_name == CNNT_NICK && proto) { - if(!MyDBGetContactSetting(hContact, proto, "Nick", &dbv)) { + if (!MyDBGetContactSetting(hContact, proto, "Nick", &dbv)) { MyDBWriteContactSetting(hMeta, META_PROTO, "Nick", &dbv); DBFreeVariant(&dbv); //CallService(MS_CLIST_INVALIDATEDISPLAYNAME, (WPARAM)hMeta, 0); @@ -1518,7 +1518,7 @@ void copyHistory(HANDLE hContactFrom,HANDLE hContactTo) if (!hContactFrom || !hContactTo) return; //id = Meta_GetUniqueIdentifier(hContactFrom, &id_length); - //if(!id) return; + //if (!id) return; progress_dialog = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_COPYPROGRESS), 0, DlgProcNull); ShowWindow(progress_dialog, SW_SHOW); @@ -1534,7 +1534,7 @@ void copyHistory(HANDLE hContactFrom,HANDLE hContactTo) ZeroMemory(&dbei, sizeof(dbei)); dbei.cbSize = sizeof(dbei); - if((dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == -1) + if ((dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == -1) break; buffer = mir_realloc(buffer, dbei.cbBlob);// + id_length); @@ -1584,7 +1584,7 @@ void Meta_RemoveHistory(HANDLE hContactRemoveFrom, HANDLE hContactSource) { if (!hContactRemoveFrom || !hContactSource) return; id = Meta_GetUniqueIdentifier(hContactSource, &id_length); - if(!id) return; + if (!id) return; progress_dialog = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DELPROGRESS), 0, DlgProcNull); ShowWindow(progress_dialog, SW_SHOW); @@ -1599,7 +1599,7 @@ void Meta_RemoveHistory(HANDLE hContactRemoveFrom, HANDLE hContactSource) { ZeroMemory(&dbei, sizeof(dbei)); dbei.cbSize = sizeof(dbei); - if((dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == -1) { + if ((dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == -1) { break; } @@ -1650,7 +1650,7 @@ char *Meta_GetUniqueIdentifier(HANDLE hContact, DWORD *pused) { id = (char *)mir_alloc(256); - if(!proto) return 0; + if (!proto) return 0; strncpy(id, proto, 127); strcat(id, "*"); // seperate proto & proto id with asterisk to make one long comparable string @@ -1658,7 +1658,7 @@ char *Meta_GetUniqueIdentifier(HANDLE hContact, DWORD *pused) { used = strlen(id); field = (char *)CallProtoService(proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0); - if(!field) return 0; + if (!field) return 0; DBGetContactSetting(hContact,proto,field,&dbv); switch(dbv.type) @@ -1683,7 +1683,7 @@ char *Meta_GetUniqueIdentifier(HANDLE hContact, DWORD *pused) { strncpy(id + used, buff, 256 - used); if(used) { *pused = (DWORD)(used + strlen(buff) + 1); - if(*pused > 256) *pused = 256; + if (*pused > 256) *pused = 256; } return id; -- cgit v1.2.3