From 1925d3521846f4e6683d3d537cc41de9c9bd7250 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 11 Feb 2014 19:01:03 +0000 Subject: "we don't need these variables" (c) Pink Floyd git-svn-id: http://svn.miranda-ng.org/main/trunk@8101 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirOTR/MirOTR/src/dbfilter.cpp | 20 ++++++++------ plugins/MirOTR/MirOTR/src/mirotrmenu.cpp | 6 ++-- plugins/MirOTR/MirOTR/src/svcs_menu.cpp | 47 ++++++++++++++------------------ plugins/MirOTR/MirOTR/src/svcs_srmm.cpp | 3 +- 4 files changed, 36 insertions(+), 40 deletions(-) (limited to 'plugins/MirOTR') diff --git a/plugins/MirOTR/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/MirOTR/src/dbfilter.cpp index 333a49be06..674a4965de 100644 --- a/plugins/MirOTR/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/MirOTR/src/dbfilter.cpp @@ -43,17 +43,21 @@ VOID CALLBACK DeleteTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTi // add prefix to sent messages -int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { - if (!options.prefix_messages || !lParam) return 0; - MCONTACT hContact = wParam; +int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) +{ + if (!options.prefix_messages || !lParam) + return 0; + DBEVENTINFO *dbei = (DBEVENTINFO *)lParam; if ((dbei->eventType != EVENTTYPE_MESSAGE) || !(dbei->flags & DBEF_SENT) || (dbei->flags & DBEF_OTR_PREFIXED)) return 0; + if(dbei->cbBlob == 0 || dbei->pBlob == 0) return 0; // just to be safe const char *proto = contact_get_proto(hContact); - if (!proto ) return 0; + if (!proto) + return 0; if (db_get_b(hContact, proto, "ChatRoom", 0) == 1) return 0; @@ -177,7 +181,7 @@ int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { return 1; } - int OnDatabaseEventAdded(WPARAM wParam, LPARAM lParam) + int OnDatabaseEventAdded(WPARAM hContact, LPARAM lParam) { if (!options.delete_history) return 0; @@ -191,7 +195,7 @@ int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { info.pBlob = (PBYTE)mir_alloc(info.cbBlob); if (!db_event_get((HANDLE)lParam, &info)) { if(info.eventType == EVENTTYPE_MESSAGE) { - MCONTACT hContact = wParam, hSub; + MCONTACT hSub; if(options.bHaveMetaContacts && (hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) hContact = hSub; @@ -293,10 +297,10 @@ int StatusModeChange(WPARAM wParam, LPARAM lParam) { return 0; } -int OnContactSettingChanged(WPARAM wParam, LPARAM lParam) { +int OnContactSettingChanged(WPARAM hContact, LPARAM lParam) +{ DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam; if (!lParam || strcmp(cws->szSetting, "Status") != 0) return 0; - MCONTACT hContact = wParam; int status=0; switch (cws->value.type){ case DBVT_WORD: diff --git a/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp index 9a8bb85475..2714a21e4f 100644 --- a/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp +++ b/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp @@ -47,13 +47,11 @@ static INT_PTR AddMirOTRMenuItem(WPARAM, LPARAM lParam) return menuHandle; } -static INT_PTR BuildMirOTRMenu(WPARAM wParam, LPARAM) +static INT_PTR BuildMirOTRMenu(WPARAM hContact, LPARAM) { - MCONTACT hContact = wParam; - ListParam param = { 0 }; param.MenuObjectHandle = hMirOTRMenuObject; - param.wParam = (WPARAM)hContact; + param.wParam = hContact; HMENU hMenu = CreatePopupMenu(); CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); diff --git a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp index 2874d5f81a..5240337872 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp @@ -23,11 +23,11 @@ int StartOTR(MCONTACT hContact) { return 0; } -INT_PTR SVC_StartOTR(WPARAM wParam, LPARAM lParam) { - MCONTACT hContact = wParam, hSub; - if(options.bHaveMetaContacts && (hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) { +INT_PTR SVC_StartOTR(WPARAM hContact, LPARAM lParam) +{ + MCONTACT hSub; + if(options.bHaveMetaContacts && (hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) hContact = hSub; - } if ( options.bHaveSecureIM && CallService("SecureIM/IsContactSecured", (WPARAM)hContact, 0) != 0 ) { TCHAR msg[512]; @@ -35,22 +35,19 @@ INT_PTR SVC_StartOTR(WPARAM wParam, LPARAM lParam) { ShowError(msg); return 0; } - + TCHAR buff[512]; mir_sntprintf(buff, 512, TranslateT(LANG_SESSION_REQUEST_OTR), contact_get_nameT(hContact)); ShowMessage(hContact, buff); - int res = StartOTR(hContact); - if (res) return res; - - return 0; + return StartOTR(hContact); } -INT_PTR SVC_RefreshOTR(WPARAM wParam, LPARAM lParam) { - MCONTACT hContact = wParam, hSub; - if(options.bHaveMetaContacts && (hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) { +INT_PTR SVC_RefreshOTR(WPARAM hContact, LPARAM lParam) +{ + MCONTACT hSub; + if(options.bHaveMetaContacts && (hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) hContact = hSub; - } if ( options.bHaveSecureIM && CallService("SecureIM/IsContactSecured", (WPARAM)hContact, 0) != 0 ) { TCHAR msg[512]; @@ -87,10 +84,8 @@ int otr_disconnect_contact(MCONTACT hContact) return 0; } -INT_PTR SVC_StopOTR(WPARAM wParam, LPARAM lParam) +INT_PTR SVC_StopOTR(WPARAM hContact, LPARAM lParam) { - MCONTACT hContact = wParam; - // prevent this filter from acting on injeceted messages for metas, when they are passed though the subcontact's proto send chain if (otr_disconnect_contact(hContact)) return 0; @@ -99,24 +94,26 @@ INT_PTR SVC_StopOTR(WPARAM wParam, LPARAM lParam) TCHAR buff[512]; mir_sntprintf(buff, 512, TranslateT(LANG_SESSION_TERMINATED_OTR), contact_get_nameT(hContact)); ShowMessage(hContact, buff); - return 0; } -INT_PTR SVC_VerifyOTR(WPARAM wParam, LPARAM lParam) { - MCONTACT hContact = wParam, hSub; +INT_PTR SVC_VerifyOTR(WPARAM hContact, LPARAM lParam) +{ + MCONTACT hSub; if(options.bHaveMetaContacts && (hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) hContact = hSub; - ConnContext *context = otrl_context_find_miranda(otr_user_state, wParam); - if (!context) return 1; + ConnContext *context = otrl_context_find_miranda(otr_user_state, hContact); + if (!context) + return 1; + //VerifyContextDialog(context); SMPInitDialog(context); return 0; } -INT_PTR SVC_ToggleHTMLOTR(WPARAM wParam, LPARAM lParam) { - MCONTACT hContact = wParam; +INT_PTR SVC_ToggleHTMLOTR(WPARAM hContact, LPARAM lParam) +{ if (db_get_b(hContact, MODULENAME, "HTMLConv", 0)) db_set_b(hContact, MODULENAME, "HTMLConv", 0); else @@ -152,10 +149,8 @@ void InitMenu() HookEvent(ME_CLIST_PREBUILDCONTACTMENU, SVC_PrebuildContactMenu); } -int SVC_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) +int SVC_PrebuildContactMenu(WPARAM hContact, LPARAM lParam) { - MCONTACT hContact = wParam; - CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_TCHAR; diff --git a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp index a24bc5dec5..e07473eb15 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp @@ -3,9 +3,8 @@ HICON hIconNotSecure, hIconFinished, hIconPrivate, hIconUnverified; BBButton OTRButton; -int SVC_IconPressed(WPARAM wParam, LPARAM lParam) +int SVC_IconPressed(WPARAM hContact, LPARAM lParam) { - MCONTACT hContact = wParam; StatusIconClickData *sicd = (StatusIconClickData *)lParam; if(sicd->cbSize < (int)sizeof(StatusIconClickData)) return 0; -- cgit v1.2.3