diff options
Diffstat (limited to 'plugins/SecureIM')
-rw-r--r-- | plugins/SecureIM/res/resource.rc | 2 | ||||
-rw-r--r-- | plugins/SecureIM/src/commonheaders.cpp | 6 | ||||
-rw-r--r-- | plugins/SecureIM/src/commonheaders.h | 4 | ||||
-rw-r--r-- | plugins/SecureIM/src/crypt.h | 2 | ||||
-rw-r--r-- | plugins/SecureIM/src/crypt_icons.cpp | 90 | ||||
-rw-r--r-- | plugins/SecureIM/src/main.cpp | 23 | ||||
-rw-r--r-- | plugins/SecureIM/src/options.cpp | 18 | ||||
-rw-r--r-- | plugins/SecureIM/src/resource.h | 1 | ||||
-rw-r--r-- | plugins/SecureIM/src/svcs_clist.cpp | 30 |
9 files changed, 37 insertions, 139 deletions
diff --git a/plugins/SecureIM/res/resource.rc b/plugins/SecureIM/res/resource.rc index 9ff15ed681..45ea911955 100644 --- a/plugins/SecureIM/res/resource.rc +++ b/plugins/SecureIM/res/resource.rc @@ -52,8 +52,6 @@ BEGIN CONTROL "Not secured for NotOnList",IDC_NOL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,212,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,158,144,19
- COMBOBOX IDC_ADVICON,160,163,135,81,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP,WS_EX_CLIENTEDGE
GROUPBOX "",IDC_STATIC,156,175,144,32
RTEXT "Key Exchange Timeout :",IDC_STATIC,160,182,80,8
EDITTEXT IDC_KET,241,180,30,12,ES_AUTOHSCROLL | ES_NUMBER
diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index 2c18f51e5d..881e69c38d 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -14,14 +14,14 @@ int iService=0; int iHook=0;
HICON g_hICO[ICO_CNT], g_hPOP[POP_CNT], g_hIEC[1+IEC_CNT*MODE_CNT] = {0};
-IconExtraColumn g_IEC[1+IEC_CNT*MODE_CNT];
+HANDLE g_IEC[1+IEC_CNT*MODE_CNT];
int iBmpDepth;
BOOL bCoreUnicode = false, bMetaContacts = false, bPopupExists = false, bPopupUnicode = false;
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;
-BYTE bADV, bPGP, bGPG;
+BYTE bPGP, bGPG;
DWORD iCoreVersion = 0;
CRITICAL_SECTION localQueueMutex;
@@ -78,7 +78,6 @@ void GetFlags() { bSCM = DBGetContactSettingByte(0,szModuleName,"scm",0);
bDGP = DBGetContactSettingByte(0,szModuleName,"dgp",0);
bAIP = DBGetContactSettingByte(0,szModuleName,"aip",0);
- bADV = DBGetContactSettingByte(0,szModuleName,"adv",0);
bNOL = DBGetContactSettingByte(0,szModuleName,"nol",0);
bAAK = DBGetContactSettingByte(0,szModuleName,"aak",0);
bMCM = DBGetContactSettingByte(0,szModuleName,"mcm",0);
@@ -93,7 +92,6 @@ void SetFlags() { DBWriteContactSettingByte(0,szModuleName,"scm",bSCM);
DBWriteContactSettingByte(0,szModuleName,"dgp",bDGP);
DBWriteContactSettingByte(0,szModuleName,"aip",bAIP);
- DBWriteContactSettingByte(0,szModuleName,"adv",bADV);
DBWriteContactSettingByte(0,szModuleName,"nol",bNOL);
DBWriteContactSettingByte(0,szModuleName,"aak",bAAK);
DBWriteContactSettingByte(0,szModuleName,"mcm",bMCM);
diff --git a/plugins/SecureIM/src/commonheaders.h b/plugins/SecureIM/src/commonheaders.h index c848d43484..1f4e94b8e8 100644 --- a/plugins/SecureIM/src/commonheaders.h +++ b/plugins/SecureIM/src/commonheaders.h @@ -141,13 +141,13 @@ extern HANDLE *g_hService; extern HANDLE *g_hHook;
extern int iService, iHook;
extern HICON g_hICO[ICO_CNT], g_hIEC[1+IEC_CNT*MODE_CNT], g_hPOP[POP_CNT];
-extern IconExtraColumn g_IEC[1+IEC_CNT*MODE_CNT];
+extern HANDLE g_IEC[1+IEC_CNT*MODE_CNT];
extern int iBmpDepth;
extern BOOL bCoreUnicode, bMetaContacts, bPopupExists, bPopupUnicode;
extern BOOL bPGPloaded, bPGPkeyrings, bUseKeyrings, bPGPprivkey;
extern BOOL bGPGloaded, bGPGkeyrings, bSavePass;
extern BOOL bSFT, bSOM, bASI, bMCD, bSCM, bDGP, bAIP, bNOL, bAAK, bMCM;
-extern BYTE bADV, bPGP, bGPG;
+extern BYTE bPGP, bGPG;
extern DWORD iCoreVersion;
extern CRITICAL_SECTION localQueueMutex;
diff --git a/plugins/SecureIM/src/crypt.h b/plugins/SecureIM/src/crypt.h index e626570f9e..be936d420f 100644 --- a/plugins/SecureIM/src/crypt.h +++ b/plugins/SecureIM/src/crypt.h @@ -139,8 +139,6 @@ BOOL isSecureIM(HANDLE hContact, BOOL emptyMirverAsSecureIM=FALSE); // crypt_icons.cpp
HICON mode2icon(int,int);
-HICON mode2icon2(int,int); // создает КОПИЮ иконки, которую надо разрушить
-IconExtraColumn mode2iec(int);
void RefreshContactListIcons(void);
void ShowStatusIcon(HANDLE,UINT);
void ShowStatusIcon(HANDLE);
diff --git a/plugins/SecureIM/src/crypt_icons.cpp b/plugins/SecureIM/src/crypt_icons.cpp index f48e94278e..ed0b68d15a 100644 --- a/plugins/SecureIM/src/crypt_icons.cpp +++ b/plugins/SecureIM/src/crypt_icons.cpp @@ -1,6 +1,5 @@ #include "commonheaders.h"
-
typedef struct {
HICON icon;
SHORT mode;
@@ -47,52 +46,19 @@ HICON mode2icon(int mode,int type) { return icon;
}
-
-// преобразует mode в HICON который НУЖНО разрушить в конце
-HICON mode2icon2(int mode,int type) {
- return CopyIcon(mode2icon(mode,type));
-}
-
-
-// преобразует mode в IconExtraColumn который НЕ нужно разрушать в конце
-IconExtraColumn mode2iec(int mode) {
-
- int m=mode&0x0f,s=(mode&SECURED)>>4; // разобрали на части - режим и состояние
-
- if ( mode==-1 || (!s && !bASI && m!=MODE_PGP && m!=MODE_GPG)) {
- return g_IEC[0]; // вернем пустое место
- }
-
- int i=1+m*IEC_CNT+IEC_CL_DIS+s;
- if ( g_IEC[i].hImage==(HANDLE)-1 ) {
-/* g_hIEC[i] = mode2icon(mode,1);
- g_IEC[i].hImage = (HANDLE) CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)g_hIEC[i], 0);*/
- HICON icon = mode2icon(mode,1);
- g_IEC[i].hImage = (HANDLE) CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)icon, 0);
- }
- return g_IEC[i];
-}
-
-
// обновляет иконки в clist и в messagew
-void ShowStatusIcon(HANDLE hContact,int mode) {
-
+void ShowStatusIcon(HANDLE hContact,int mode)
+{
HANDLE hMC = getMetaContact(hContact);
- if ( bADV || g_hCLIcon ) { // обновить иконки в clist
- if ( mode!= -1 ) {
- IconExtraColumn iec=mode2iec(mode);
- if ( g_hCLIcon ) {
- ExtraIcon_SetIcon(g_hCLIcon, hContact, iec.hImage);
- if ( hMC )
- ExtraIcon_SetIcon(g_hCLIcon, hMC, iec.hImage);
- }
- else {
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
- if ( hMC )
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hMC, (LPARAM)&iec);
- }
- }
+
+ // обновить иконки в clist
+ if (mode != -1) {
+ HICON hIcon = mode2icon(mode, 1);
+ ExtraIcon_SetIcon(g_hCLIcon, hContact, hIcon);
+ if ( hMC )
+ ExtraIcon_SetIcon(g_hCLIcon, hMC, hIcon);
}
+
if ( ServiceExists(MS_MSG_MODIFYICON)) { // обновить иконки в srmm
StatusIconData sid;
memset(&sid,0,sizeof(sid));
@@ -100,52 +66,36 @@ void ShowStatusIcon(HANDLE hContact,int mode) { sid.szModule = (char*)szModuleName;
for(int i=MODE_NATIVE; i<MODE_CNT;i++) {
sid.dwId = i;
- sid.flags = (mode&SECURED)?0:MBF_DISABLED;
- if ( mode==-1 || (mode&0x0f)!=i || isChatRoom(hContact))
+ sid.flags = (mode & SECURED) ? 0 : MBF_DISABLED;
+ if (mode == -1 || (mode & 0x0f) != i || isChatRoom(hContact))
sid.flags |= MBF_HIDDEN; // отключаем все ненужные иконки
CallService(MS_MSG_MODIFYICON, (WPARAM)hContact, (LPARAM)&sid);
if ( hMC )
- CallService(MS_MSG_MODIFYICON, (WPARAM)hMC, (LPARAM)&sid);
+ CallService(MS_MSG_MODIFYICON, (WPARAM)hMC, (LPARAM)&sid);
}
}
}
-
-void ShowStatusIcon(HANDLE hContact) {
+void ShowStatusIcon(HANDLE hContact)
+{
ShowStatusIcon(hContact,isContactSecured(hContact));
}
-
-void ShowStatusIconNotify(HANDLE hContact) {
+void ShowStatusIconNotify(HANDLE hContact)
+{
int mode = isContactSecured(hContact);
NotifyEventHooks(g_hEvent[(mode&SECURED)!=0], (WPARAM)hContact, 0);
ShowStatusIcon(hContact,mode);
}
-
-void RefreshContactListIcons(void) {
-
- HANDLE hContact;
-// CallService(MS_CLUI_LISTBEGINREBUILD,0,0);
- if ( !g_hCLIcon ) {
- hContact = db_find_first();
- while (hContact) { // сначала все выключаем
- ShowStatusIcon(hContact,-1);
- hContact = db_find_next(hContact);
- }
- // менем местоположение иконки
- for(int i=0;i<1+MODE_CNT*IEC_CNT;i++) {
- g_IEC[i].ColumnType = bADV;
- }
- }
- hContact = db_find_first();
+void RefreshContactListIcons(void)
+{
+ HANDLE hContact = db_find_first();
while (hContact) { // и снова зажигаем иконку
if ( isSecureProtocol(hContact))
ShowStatusIcon(hContact);
hContact = db_find_next(hContact);
}
-// CallService(MS_CLUI_LISTENDREBUILD,0,0);
}
-
// EOF
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 5d2a27215d..23ee788a76 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -355,35 +355,20 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { Sent_NetLog("init extra icons");
#endif
// init extra icons
- for(int i=0;i<1+MODE_CNT*IEC_CNT;i++) {
- g_IEC[i].cbSize = sizeof(g_IEC[i]);
- g_IEC[i].ColumnType = bADV;
- g_IEC[i].hImage = (HANDLE)-1;
- }
-
- // build extra imagelist
- //onExtraImageListRebuilding(0,0);
+ for(int i=0;i<1+MODE_CNT*IEC_CNT;i++)
+ g_IEC[i] = (HANDLE)-1;
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("hook events");
#endif
AddHookFunction(ME_CLIST_PREBUILDCONTACTMENU, onRebuildContactMenu);
-// g_hMC = HookEvent(ME_MC_SUBCONTACTSCHANGED, onMC);
- if ( ServiceExists(MS_EXTRAICON_REGISTER)) {
- g_hCLIcon = ExtraIcon_Register(szModuleName, Translate("SecureIM status"), "sim_cm_est",
- onExtraImageListRebuilding,
- onExtraImageApplying);
- }
- else {
- AddHookFunction(ME_CLIST_EXTRA_LIST_REBUILD, onExtraImageListRebuilding);
- AddHookFunction(ME_CLIST_EXTRA_IMAGE_APPLY, onExtraImageApplying);
- }
+ g_hCLIcon = ExtraIcon_Register(szModuleName, Translate("SecureIM status"), "sim_cm_est", onExtraImageListRebuilding, onExtraImageApplying);
// hook init options
AddHookFunction(ME_OPT_INITIALISE, onRegisterOptions);
if(bPopupExists)
- AddHookFunction(ME_OPT_INITIALISE, onRegisterPopOptions);
+ AddHookFunction(ME_OPT_INITIALISE, onRegisterPopOptions);
AddHookFunction(ME_PROTO_ACK, onProtoAck);
AddHookFunction(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
AddHookFunction(ME_DB_CONTACT_ADDED, onContactAdded);
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index eba769f9ca..a8ac1c72bf 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -4,8 +4,6 @@ #define RSASIZE (4096+1)
BOOL bChangeSortOrder = false;
-const char *szAdvancedIcons[] = {"None", "Email", "Protocol", "SMS", "Advanced 1", "Advanced 2", "Web", "Client", "VisMode", "Advanced 6", "Advanced 7", 0};
-
BOOL hasKey(pUinKey ptr) {
BOOL ret = 0;
@@ -25,7 +23,6 @@ BOOL hasKey(pUinKey ptr) { return ret;
}
-
void TC_InsertItem(HWND hwnd, WPARAM wparam, TCITEM *tci) {
if ( bCoreUnicode ) {
LPWSTR tmp = mir_a2u(tci->pszText);
@@ -268,9 +265,6 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR lvc.cx = iColWidth[i];
LV_InsertColumn(hLV, i, &lvc);
}
- for (i = 0; szAdvancedIcons[i]; i++) {
- SendMessage(GetDlgItem(hDlg, IDC_ADVICON), CB_ADDSTRING, 0, (LPARAM) Translate(szAdvancedIcons[i]));
- }
RefreshGeneralDlg(hDlg,TRUE);
EnableWindow(hLV, true);
@@ -442,7 +436,6 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR case IDC_SCM:
case IDC_DGP:
case IDC_OKT:
- case IDC_ADVICON:
break;
default:
@@ -1131,12 +1124,6 @@ void RefreshGeneralDlg(HWND hDlg, BOOL iInit) { SendMessage(GetDlgItem(hDlg,IDC_AAK),BM_SETCHECK,(bAAK)?BST_CHECKED:BST_UNCHECKED,0L);
SendMessage(GetDlgItem(hDlg,IDC_MCM),BM_SETCHECK,(bMCM)?BST_CHECKED:BST_UNCHECKED,0L);
- // Advanced
- SendMessage(GetDlgItem(hDlg, IDC_ADVICON), CB_SETCURSEL, bADV, 0);
- if ( g_hCLIcon ) {
- EnableWindow(GetDlgItem(hDlg, IDC_ADVICON), false);
- }
-
// Select {OFF,PGP,GPG}
SendMessage(GetDlgItem(hDlg,IDC_PGP),BM_SETCHECK,bPGP?BST_CHECKED:BST_UNCHECKED,0L);
SendMessage(GetDlgItem(hDlg,IDC_GPG),BM_SETCHECK,bGPG?BST_CHECKED:BST_UNCHECKED,0L);
@@ -1376,10 +1363,6 @@ void ResetGeneralDlg(HWND hDlg) { SendMessage(GetDlgItem(hDlg,IDC_AIP),BM_SETCHECK,BST_UNCHECKED,0L);
SendMessage(GetDlgItem(hDlg,IDC_MCM),BM_SETCHECK,BST_UNCHECKED,0L);
-// for(int i=0;i<ADV_CNT;i++)
-// SendMessage(GetDlgItem(hDlg,IDC_ADV1+i),BM_SETCHECK,(i==0)?BST_CHECKED:BST_UNCHECKED,0L);
- SendMessage(GetDlgItem(hDlg, IDC_ADVICON), CB_SETCURSEL, 0, 0);
-
// rebuild list of contacts
HWND hLV = GetDlgItem(hDlg,IDC_STD_USERLIST);
ListView_DeleteAllItems(hLV);
@@ -1461,7 +1444,6 @@ void ApplyGeneralSettings(HWND hDlg) { bNOL = (SendMessage(GetDlgItem(hDlg, IDC_NOL),BM_GETCHECK,0L,0L)==BST_CHECKED);
bAAK = (SendMessage(GetDlgItem(hDlg, IDC_AAK),BM_GETCHECK,0L,0L)==BST_CHECKED);
bMCM = (SendMessage(GetDlgItem(hDlg, IDC_MCM),BM_GETCHECK,0L,0L)==BST_CHECKED);
- bADV = (BYTE)SendMessage(GetDlgItem(hDlg, IDC_ADVICON), CB_GETCURSEL, 0, 0);
SetFlags();
diff --git a/plugins/SecureIM/src/resource.h b/plugins/SecureIM/src/resource.h index f8a753773d..fc800bdd56 100644 --- a/plugins/SecureIM/src/resource.h +++ b/plugins/SecureIM/src/resource.h @@ -106,7 +106,6 @@ #define IDC_DGP 1044
#define IDC_OKT 1045
#define IDC_AIP 1046
-#define IDC_ADVICON 1047
#define IDC_SPLITON 1048
#define IDC_SPLITOFF 1049
#define IDC_RSA_SHA 1050
diff --git a/plugins/SecureIM/src/svcs_clist.cpp b/plugins/SecureIM/src/svcs_clist.cpp index 12402a58be..4a3d657097 100644 --- a/plugins/SecureIM/src/svcs_clist.cpp +++ b/plugins/SecureIM/src/svcs_clist.cpp @@ -71,39 +71,27 @@ int __cdecl onContactAdded(WPARAM wParam,LPARAM lParam) { // wParam=(WPARAM)(HANDLE)hContact
// lParam=0
-int __cdecl onContactDeleted(WPARAM wParam,LPARAM lParam) {
+int __cdecl onContactDeleted(WPARAM wParam,LPARAM lParam)
+{
delContact((HANDLE)wParam);
return 0;
}
-int __cdecl onExtraImageListRebuilding(WPARAM, LPARAM) {
-
-#if defined(_DEBUG) || defined(NETLIB_LOG)
- Sent_NetLog("onExtraImageListRebuilding");
-#endif
- if ( (bADV || g_hCLIcon) && ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) {
- RefreshContactListIcons();
- }
+int __cdecl onExtraImageListRebuilding(WPARAM, LPARAM)
+{
+ RefreshContactListIcons();
return 0;
}
+int __cdecl onExtraImageApplying(WPARAM wParam, LPARAM)
+{
+ if ( isSecureProtocol((HANDLE)wParam))
+ ExtraIcon_SetIcon(g_hCLIcon, (HANDLE)wParam, mode2icon( isContactSecured((HANDLE)wParam), 1));
-int __cdecl onExtraImageApplying(WPARAM wParam, LPARAM) {
-
- if ( (bADV || g_hCLIcon) && ServiceExists(MS_CLIST_EXTRA_SET_ICON) && isSecureProtocol((HANDLE)wParam)) {
- IconExtraColumn iec = mode2iec(isContactSecured((HANDLE)wParam));
- if ( g_hCLIcon ) {
- ExtraIcon_SetIcon(g_hCLIcon, (HANDLE)wParam, iec.hImage);
- }
- else {
- CallService(MS_CLIST_EXTRA_SET_ICON, wParam, (LPARAM)&iec);
- }
- }
return 0;
}
-
int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
|