diff options
author | George Hazan <george.hazan@gmail.com> | 2023-11-08 19:15:04 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-11-08 19:15:04 +0300 |
commit | 39a227d88a3bfaab32b18e4bb961948864085f11 (patch) | |
tree | 5a52ed2b69767eaaba1c6c03513a8de52010139d | |
parent | eebfe35f7b33e1d2d307369ce440e8c3239a79ac (diff) |
fixes #3859 (SecureIM: перевод не помещается)
-rw-r--r-- | plugins/SecureIM/res/resource.rc | 5 | ||||
-rw-r--r-- | plugins/SecureIM/src/commonheaders.cpp | 4 | ||||
-rw-r--r-- | plugins/SecureIM/src/commonheaders.h | 2 | ||||
-rw-r--r-- | plugins/SecureIM/src/options.cpp | 4 | ||||
-rw-r--r-- | plugins/SecureIM/src/resource.h | 1 | ||||
-rw-r--r-- | plugins/SecureIM/src/secureim.h | 29 | ||||
-rw-r--r-- | plugins/SecureIM/src/svcs_proto.cpp | 39 |
7 files changed, 34 insertions, 50 deletions
diff --git a/plugins/SecureIM/res/resource.rc b/plugins/SecureIM/res/resource.rc index f4173017ad..c2fd0d952b 100644 --- a/plugins/SecureIM/res/resource.rc +++ b/plugins/SecureIM/res/resource.rc @@ -45,9 +45,8 @@ BEGIN CONTROL "Context Menu only for ""Miranda"" clients",IDC_MCD,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,172,145,10
CONTROL "Status in Context Menu",IDC_SCM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,182,145,10
- CONTROL "Disable encryption for game plugins",IDC_DGP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,192,145,10
- CONTROL "Always secured if possible",IDC_AIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,202,145,10
- CONTROL "Not secured for NotOnList",IDC_NOL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,212,145,10
+ CONTROL "Always secured if possible",IDC_AIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,192,145,10
+ CONTROL "Not secured for NotOnList",IDC_NOL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,202,145,10
CONTROL "Auto accept RSA key (NOT SECURED)",IDC_AAK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,156,142,145,10
CONTROL "Mode in Context Menu",IDC_MCM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,156,152,145,10
GROUPBOX "",IDC_STATIC,156,175,144,32
diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index db6b01fe01..f94021d506 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -17,7 +17,7 @@ HANDLE g_IEC[1 + IEC_CNT*MODE_CNT]; int iBmpDepth;
BOOL bPGPloaded = false, bPGPkeyrings = false, bUseKeyrings = false, bPGPprivkey = false;
BOOL bGPGloaded = false, bGPGkeyrings = false, bSavePass = false;
-BOOL bSFT, bSOM, bASI, bMCD, bSCM, bDGP, bAIP, bNOL, bAAK, bMCM;
+BOOL bSFT, bSOM, bASI, bMCD, bSCM, bAIP, bNOL, bAAK, bMCM;
uint8_t bPGP, bGPG;
mir_cs localQueueMutex;
@@ -49,7 +49,6 @@ void GetFlags() bASI = g_plugin.getByte("asi", 0);
bMCD = g_plugin.getByte("mcd", 0);
bSCM = g_plugin.getByte("scm", 0);
- bDGP = g_plugin.getByte("dgp", 0);
bAIP = g_plugin.getByte("aip", 0);
bNOL = g_plugin.getByte("nol", 0);
bAAK = g_plugin.getByte("aak", 0);
@@ -63,7 +62,6 @@ void SetFlags() g_plugin.setByte("asi", bASI);
g_plugin.setByte("mcd", bMCD);
g_plugin.setByte("scm", bSCM);
- g_plugin.setByte("dgp", bDGP);
g_plugin.setByte("aip", bAIP);
g_plugin.setByte("nol", bNOL);
g_plugin.setByte("aak", bAAK);
diff --git a/plugins/SecureIM/src/commonheaders.h b/plugins/SecureIM/src/commonheaders.h index 60839f80b7..32a5d602a4 100644 --- a/plugins/SecureIM/src/commonheaders.h +++ b/plugins/SecureIM/src/commonheaders.h @@ -85,7 +85,7 @@ extern HANDLE g_IEC[1+IEC_CNT*MODE_CNT]; extern int iBmpDepth;
extern BOOL bPGPloaded, bPGPkeyrings, bUseKeyrings, bPGPprivkey;
extern BOOL bGPGloaded, bGPGkeyrings, bSavePass;
-extern BOOL bSFT, bSOM, bASI, bMCD, bSCM, bDGP, bAIP, bNOL, bAAK, bMCM;
+extern BOOL bSFT, bSOM, bASI, bMCD, bSCM, bAIP, bNOL, bAAK, bMCM;
extern uint8_t bPGP, bGPG;
extern mir_cs localQueueMutex;
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index a04e991ea7..9fe86edcda 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -400,7 +400,6 @@ static void ResetGeneralDlg(HWND hDlg) CheckDlgButton(hDlg, IDC_ASI, BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_MCD, BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_SCM, BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_DGP, BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_AIP, BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_MCM, BST_UNCHECKED);
@@ -468,7 +467,6 @@ static void RefreshGeneralDlg(HWND hDlg, BOOL iInit) CheckDlgButton(hDlg, IDC_ASI, (bASI) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_MCD, (bMCD) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_SCM, (bSCM) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_DGP, (bDGP) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_AIP, (bAIP) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_NOL, (bNOL) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_AAK, (bAAK) ? BST_CHECKED : BST_UNCHECKED);
@@ -578,7 +576,6 @@ static void ApplyGeneralSettings(HWND hDlg) bASI = (IsDlgButtonChecked(hDlg, IDC_ASI) == BST_CHECKED);
bMCD = (IsDlgButtonChecked(hDlg, IDC_MCD) == BST_CHECKED);
bSCM = (IsDlgButtonChecked(hDlg, IDC_SCM) == BST_CHECKED);
- bDGP = (IsDlgButtonChecked(hDlg, IDC_DGP) == BST_CHECKED);
bAIP = (IsDlgButtonChecked(hDlg, IDC_AIP) == BST_CHECKED);
bNOL = (IsDlgButtonChecked(hDlg, IDC_NOL) == BST_CHECKED);
bAAK = (IsDlgButtonChecked(hDlg, IDC_AAK) == BST_CHECKED);
@@ -815,7 +812,6 @@ static INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wPara case IDC_MCD:
case IDC_KET:
case IDC_SCM:
- case IDC_DGP:
case IDC_OKT:
break;
diff --git a/plugins/SecureIM/src/resource.h b/plugins/SecureIM/src/resource.h index 79f9a8ed5b..0464a7ac0f 100644 --- a/plugins/SecureIM/src/resource.h +++ b/plugins/SecureIM/src/resource.h @@ -81,7 +81,6 @@ #define IDC_EDIT1 1041
#define IDC_EDIT2 1042
#define IDC_SCM 1043
-#define IDC_DGP 1044
#define IDC_OKT 1045
#define IDC_AIP 1046
#define IDC_SPLITON 1048
diff --git a/plugins/SecureIM/src/secureim.h b/plugins/SecureIM/src/secureim.h index 41f9f40cad..ddbf44feec 100644 --- a/plugins/SecureIM/src/secureim.h +++ b/plugins/SecureIM/src/secureim.h @@ -33,7 +33,6 @@ #define SiG_SECP 12
#define SiG_PGPM 13
#define SiG_NONE -1
-#define SiG_GAME -2
struct SIG {
char *sig;
@@ -41,33 +40,7 @@ struct SIG { char key;
};
-const SIG signs[] = {
- {"----Key3@hell----", 17, SiG_KEYR},
- {"----Key4@hell----", 17, SiG_KEYR},
- {"----Secured@hell----", 20, SiG_ENON},
- {"----Offline@hell----", 20, SiG_ENOF},
- {"----Resend@hell----", 19, SiG_RSND},
- {"----INIT@HELL----", 17, SiG_INIT},
- {"----DEINIT@HELL----", 19, SiG_DEIN},
- {"----DISABLED@HELL----", 21, SiG_DISA},
- {"----FAKE@HELL----", 17, SiG_FAKE},
- {"----KeyA@hell----", 17, SiG_KEYA},
- {"----KeyB@hell----", 17, SiG_KEYB},
- {"----Part@hell----", 17, SiG_PART},
- {"[SECURE]", 8, SiG_SECU},
- {"[$ECURE]", 8, SiG_SECP},
- {"-----BEGIN PGP MESSAGE-----", 27, SiG_PGPM},
- {"@@BattleShip", 12, SiG_GAME},
- {"GoMoku 0.0.2.2:", 15, SiG_GAME},
- {"@@GoMoku", 8, SiG_GAME},
- {"pbiChess:", 9, SiG_GAME},
- {"pbiReverse:", 11, SiG_GAME},
- {"pbiCorners:", 11, SiG_GAME},
- {"pbiCheckersInt:", 15, SiG_GAME},
- {"pbiCheckersRus:", 15, SiG_GAME},
- {"pbiCheckersPool:", 16, SiG_GAME},
- {0}
-};
+extern const SIG signs[];
#define SIG_KEY3 signs[ 0].sig
#define SIG_KEY4 signs[ 1].sig
diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp index f1819c0b29..d1079c8276 100644 --- a/plugins/SecureIM/src/svcs_proto.cpp +++ b/plugins/SecureIM/src/svcs_proto.cpp @@ -1,16 +1,35 @@ #include "commonheaders.h"
+const SIG signs[] = {
+ {"----Key3@hell----", 17, SiG_KEYR},
+ {"----Key4@hell----", 17, SiG_KEYR},
+ {"----Secured@hell----", 20, SiG_ENON},
+ {"----Offline@hell----", 20, SiG_ENOF},
+ {"----Resend@hell----", 19, SiG_RSND},
+ {"----INIT@HELL----", 17, SiG_INIT},
+ {"----DEINIT@HELL----", 19, SiG_DEIN},
+ {"----DISABLED@HELL----", 21, SiG_DISA},
+ {"----FAKE@HELL----", 17, SiG_FAKE},
+ {"----KeyA@hell----", 17, SiG_KEYA},
+ {"----KeyB@hell----", 17, SiG_KEYB},
+ {"----Part@hell----", 17, SiG_PART},
+ {"[SECURE]", 8, SiG_SECU},
+ {"[$ECURE]", 8, SiG_SECP},
+ {"-----BEGIN PGP MESSAGE-----", 27, SiG_PGPM},
+};
+
// return SignID
int getSecureSig(LPCSTR szMsg, LPSTR *szPlainMsg = nullptr)
{
- if (szPlainMsg) *szPlainMsg = (LPSTR)szMsg;
- for (int i = 0; signs[i].len; i++) {
- if (memcmp(szMsg, signs[i].sig, signs[i].len) == 0) {
- if (szPlainMsg) *szPlainMsg = (LPSTR)(szMsg + signs[i].len);
- if (signs[i].key == SiG_GAME && !bDGP)
- return SiG_NONE;
-
- return signs[i].key;
+ if (szPlainMsg)
+ *szPlainMsg = (LPSTR)szMsg;
+
+ for (auto &it: signs) {
+ if (memcmp(szMsg, it.sig, it.len) == 0) {
+ if (szPlainMsg)
+ *szPlainMsg = (LPSTR)(szMsg + it.len);
+
+ return it.key;
}
}
return SiG_NONE;
@@ -59,7 +78,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) bool bGPG = isContactGPG(ccs->hContact);
// pass any unchanged message
- if (!ptr || ssig == SiG_GAME || !isSecureProtocol(ccs->hContact) ||
+ if (!ptr || !isSecureProtocol(ccs->hContact) ||
(db_mc_isMeta(ccs->hContact) && (ccs->wParam & PREF_SIMNOMETA)) || isChatRoom(ccs->hContact) ||
(ssig == SiG_NONE && !ptr->msgSplitted && !bSecured && !bPGP && !bGPG)) {
Sent_NetLog("onRecvMsg: pass unhandled");
@@ -456,7 +475,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) Sent_NetLog("onSend: %s", (LPSTR)ccs->lParam);
// pass unhandled messages
- if (!ptr || ssig == SiG_GAME || ssig == SiG_PGPM || ssig == SiG_SECU || ssig == SiG_SECP ||
+ if (!ptr || ssig == SiG_PGPM || ssig == SiG_SECU || ssig == SiG_SECP ||
isChatRoom(ccs->hContact) || stat == -1 ||
(ssig == SiG_NONE && ptr->sendQueue) || (ssig == SiG_NONE && ptr->status == STATUS_DISABLED)) {
Sent_NetLog("onSendMsg: pass unhandled");
|