diff options
author | George Hazan <ghazan@miranda.im> | 2018-02-09 16:13:50 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-02-09 16:13:50 +0300 |
commit | d15bd517fb0eb4bbdb1b118b44398b00bc8f6d6a (patch) | |
tree | ead9ec16a070ed6237975fe00a368fec2491e1ad /protocols/IcqOscarJ/src | |
parent | b407cbb7ad5cf00f0420fd91b82969ffcbaba5b5 (diff) |
all duplicate "Request auth", "Grant auth" & "Revoke auth" menu items eliminated
Diffstat (limited to 'protocols/IcqOscarJ/src')
-rw-r--r-- | protocols/IcqOscarJ/src/changeinfo.h | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/db.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/dlgproc.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_constants.h | 9 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_menu.cpp | 61 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_proto.cpp | 6 |
6 files changed, 15 insertions, 67 deletions
diff --git a/protocols/IcqOscarJ/src/changeinfo.h b/protocols/IcqOscarJ/src/changeinfo.h index d3b25626c5..4c90b617f4 100644 --- a/protocols/IcqOscarJ/src/changeinfo.h +++ b/protocols/IcqOscarJ/src/changeinfo.h @@ -96,7 +96,7 @@ struct ChangeInfoData : public MZeroedObject void FreeStoredDbSettings(void);
int ChangesMade(void);
void ClearChangeFlags(void);
- int SaveSettingsToDb(HWND hwndDlg);
+ int SaveSettingsToDb(void);
//upload.cpp
int UploadSettings(void);
diff --git a/protocols/IcqOscarJ/src/db.cpp b/protocols/IcqOscarJ/src/db.cpp index 06063b0302..5daf759ed6 100644 --- a/protocols/IcqOscarJ/src/db.cpp +++ b/protocols/IcqOscarJ/src/db.cpp @@ -162,7 +162,7 @@ static INT_PTR CALLBACK PwConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, return FALSE;
}
-int ChangeInfoData::SaveSettingsToDb(HWND hwnd)
+int ChangeInfoData::SaveSettingsToDb()
{
int ret = 1;
diff --git a/protocols/IcqOscarJ/src/dlgproc.cpp b/protocols/IcqOscarJ/src/dlgproc.cpp index b754a2e5ab..992cbe8ad7 100644 --- a/protocols/IcqOscarJ/src/dlgproc.cpp +++ b/protocols/IcqOscarJ/src/dlgproc.cpp @@ -416,7 +416,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break;
case IDC_SAVE:
- if (!dat->SaveSettingsToDb(hwndDlg))
+ if (!dat->SaveSettingsToDb())
break;
EnableDlgItem(hwndDlg, IDC_SAVE, FALSE);
diff --git a/protocols/IcqOscarJ/src/icq_constants.h b/protocols/IcqOscarJ/src/icq_constants.h index 4b806fa6af..c03a6ec2cd 100644 --- a/protocols/IcqOscarJ/src/icq_constants.h +++ b/protocols/IcqOscarJ/src/icq_constants.h @@ -41,12 +41,9 @@ #define ISI_ADD_TO_SERVLIST 3
/* Contact menu item indexes */
-#define ICMI_AUTH_REQUEST 0
-#define ICMI_AUTH_GRANT 1
-#define ICMI_AUTH_REVOKE 2
-#define ICMI_ADD_TO_SERVLIST 3
-#define ICMI_XSTATUS_DETAILS 4
-#define ICMI_OPEN_PROFILE 5
+#define ICMI_ADD_TO_SERVLIST 0
+#define ICMI_XSTATUS_DETAILS 1
+#define ICMI_OPEN_PROFILE 2
/* Some default settings */
#define DEFAULT_SERVER_PORT 5190
diff --git a/protocols/IcqOscarJ/src/icq_menu.cpp b/protocols/IcqOscarJ/src/icq_menu.cpp index 65c0ea5bb9..f4450d0095 100644 --- a/protocols/IcqOscarJ/src/icq_menu.cpp +++ b/protocols/IcqOscarJ/src/icq_menu.cpp @@ -27,8 +27,8 @@ #include <m_skin.h>
-HGENMENU g_hContactMenuItems[6];
-HANDLE g_hContactMenuSvc[6];
+HGENMENU g_hContactMenuItems[3];
+HANDLE g_hContactMenuSvc[3];
static int sttCompareProtocols(const CIcqProto *p1, const CIcqProto *p2)
{
@@ -50,24 +50,6 @@ static CIcqProto* IcqGetInstanceByHContact(MCONTACT hContact) return nullptr;
}
-static INT_PTR IcqMenuHandleRequestAuth(WPARAM wParam, LPARAM lParam)
-{
- CIcqProto* ppro = IcqGetInstanceByHContact(wParam);
- return (ppro) ? ppro->RequestAuthorization(wParam, lParam) : 0;
-}
-
-static INT_PTR IcqMenuHandleGrantAuth(WPARAM wParam, LPARAM lParam)
-{
- CIcqProto* ppro = IcqGetInstanceByHContact(wParam);
- return (ppro) ? ppro->GrantAuthorization(wParam, lParam) : 0;
-}
-
-static INT_PTR IcqMenuHandleRevokeAuth(WPARAM wParam, LPARAM lParam)
-{
- CIcqProto* ppro = IcqGetInstanceByHContact(wParam);
- return (ppro) ? ppro->RevokeAuthorization(wParam, lParam) : 0;
-}
-
static INT_PTR IcqMenuHandleAddServContact(WPARAM wParam, LPARAM lParam)
{
CIcqProto* ppro = IcqGetInstanceByHContact(wParam);
@@ -88,9 +70,6 @@ static INT_PTR IcqMenuHandleOpenProfile(WPARAM wParam, LPARAM lParam) static int IcqPrebuildContactMenu( WPARAM wParam, LPARAM lParam )
{
- Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_REQUEST], FALSE);
- Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_GRANT], FALSE);
- Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_REVOKE], FALSE);
Menu_ShowItem(g_hContactMenuItems[ICMI_ADD_TO_SERVLIST], FALSE);
Menu_ShowItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], FALSE);
Menu_ShowItem(g_hContactMenuItems[ICMI_OPEN_PROFILE], FALSE);
@@ -113,30 +92,6 @@ void g_MenuInit(void) CMenuItem mi;
mi.pszService = str;
-
- // "Request authorization"
- mir_strcpy(pszDest, MS_REQ_AUTH); CreateServiceFunction(str, IcqMenuHandleRequestAuth );
- SET_UID(mi, 0x36375a1f, 0xc142, 0x4d6e, 0xa6, 0x57, 0xe4, 0x76, 0x5d, 0xbc, 0x59, 0x8e);
- mi.name.a = LPGEN("Request authorization");
- mi.position = 1000030000;
- mi.hIcolibItem = Skin_GetIconHandle(SKINICON_AUTH_REQUEST);
- g_hContactMenuItems[ICMI_AUTH_REQUEST] = Menu_AddContactMenuItem(&mi);
-
- // "Grant authorization"
- mir_strcpy(pszDest, MS_GRANT_AUTH); CreateServiceFunction(str, IcqMenuHandleGrantAuth);
- SET_UID(mi, 0x4c90452a, 0x869a, 0x4a81, 0xaf, 0xa8, 0x28, 0x34, 0xaf, 0x2b, 0x6b, 0x30);
- mi.name.a = LPGEN("Grant authorization");
- mi.position = 1000029999;
- mi.hIcolibItem = Skin_GetIconHandle(SKINICON_AUTH_GRANT);
- g_hContactMenuItems[ICMI_AUTH_GRANT] = Menu_AddContactMenuItem(&mi);
-
- // "Revoke authorization"
- mir_strcpy(pszDest, MS_REVOKE_AUTH); CreateServiceFunction(str, IcqMenuHandleRevokeAuth);
- SET_UID(mi, 0x619efdcb, 0x99c0, 0x44a8, 0xbf, 0x28, 0xc3, 0xe0, 0x2f, 0xb3, 0x7e, 0x77);
- mi.name.a = LPGEN("Revoke authorization");
- mi.position = 1000029998;
- mi.hIcolibItem = Skin_GetIconHandle(SKINICON_AUTH_REVOKE);
- g_hContactMenuItems[ICMI_AUTH_REVOKE] = Menu_AddContactMenuItem(&mi);
// "Add to server list"
mir_strcpy(pszDest, MS_ICQ_ADDSERVCONTACT); CreateServiceFunction(str, IcqMenuHandleAddServContact);
@@ -164,9 +119,6 @@ void g_MenuInit(void) void g_MenuUninit(void)
{
- Menu_RemoveItem(g_hContactMenuItems[ICMI_AUTH_REQUEST]);
- Menu_RemoveItem(g_hContactMenuItems[ICMI_AUTH_GRANT]);
- Menu_RemoveItem(g_hContactMenuItems[ICMI_AUTH_REVOKE]);
Menu_RemoveItem(g_hContactMenuItems[ICMI_ADD_TO_SERVLIST]);
Menu_RemoveItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS]);
Menu_RemoveItem(g_hContactMenuItems[ICMI_OPEN_PROFILE]);
@@ -188,11 +140,10 @@ int CIcqProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM) DWORD dwUin = getContactUin(hContact);
- Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_REQUEST],
- dwUin && (bCtrlPressed || (getByte(hContact, "Auth", 0) && getWord(hContact, DBSETTING_SERVLIST_ID, 0))));
- Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_GRANT], dwUin && (bCtrlPressed || getByte(hContact, "Grant", 0)));
- Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_REVOKE],
- dwUin && (bCtrlPressed || (getByte("PrivacyItems", 0) && !getByte(hContact, "Grant", 0))));
+ Menu_ShowItem(m_hmiReqAuth, dwUin && (bCtrlPressed || (getByte(hContact, "Auth", 0) && getWord(hContact, DBSETTING_SERVLIST_ID, 0))));
+ Menu_ShowItem(m_hmiGrantAuth, dwUin && (bCtrlPressed || getByte(hContact, "Grant", 0)));
+ Menu_ShowItem(m_hmiRevokeAuth, dwUin && (bCtrlPressed || (getByte("PrivacyItems", 0) && !getByte(hContact, "Grant", 0))));
+
Menu_ShowItem(g_hContactMenuItems[ICMI_ADD_TO_SERVLIST],
m_bSsiEnabled && !getWord(hContact, DBSETTING_SERVLIST_ID, 0) &&
!getWord(hContact, DBSETTING_SERVLIST_IGNORE, 0) &&
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index fb9a2928d6..8cc92b3f96 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -134,9 +134,9 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) : CreateProtoService(MS_ICQ_ADDSERVCONTACT, &CIcqProto::AddServerContact);
- CreateProtoService(MS_REQ_AUTH, &CIcqProto::RequestAuthorization);
- CreateProtoService(MS_GRANT_AUTH, &CIcqProto::GrantAuthorization);
- CreateProtoService(MS_REVOKE_AUTH, &CIcqProto::RevokeAuthorization);
+ CreateProtoService(PS_MENU_REQAUTH, &CIcqProto::RequestAuthorization);
+ CreateProtoService(PS_MENU_GRANTAUTH, &CIcqProto::GrantAuthorization);
+ CreateProtoService(PS_MENU_REVOKEAUTH, &CIcqProto::RevokeAuthorization);
CreateProtoService(MS_XSTATUS_SHOWDETAILS, &CIcqProto::ShowXStatusDetails);
|