diff options
Diffstat (limited to 'plugins/SecureIM')
-rw-r--r-- | plugins/SecureIM/src/commonheaders.cpp | 3 | ||||
-rw-r--r-- | plugins/SecureIM/src/commonheaders.h | 3 | ||||
-rw-r--r-- | plugins/SecureIM/src/crypt_dll.cpp | 2 | ||||
-rw-r--r-- | plugins/SecureIM/src/crypt_lists.cpp | 2 | ||||
-rw-r--r-- | plugins/SecureIM/src/main.cpp | 9 | ||||
-rw-r--r-- | plugins/SecureIM/src/options.cpp | 8 | ||||
-rw-r--r-- | plugins/SecureIM/src/popupOptions.cpp | 18 | ||||
-rw-r--r-- | plugins/SecureIM/src/splitmsg.cpp | 2 | ||||
-rw-r--r-- | plugins/SecureIM/src/svcs_clist.cpp | 61 | ||||
-rw-r--r-- | plugins/SecureIM/src/svcs_proto.cpp | 4 | ||||
-rw-r--r-- | plugins/SecureIM/src/svcs_rsa.cpp | 4 |
11 files changed, 49 insertions, 67 deletions
diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index f23ef86633..4f92e5a34c 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -6,7 +6,8 @@ LPCSTR szVersionStr = MODULENAME" DLL ("__VERSION_STRING")"; char TEMP[MAX_PATH];
int TEMP_SIZE = 0;
-HANDLE g_hEvent[2], g_hMenu[15], g_hCLIcon=0, g_hFolders=0;
+HANDLE g_hEvent[2], g_hCLIcon=0, g_hFolders=0;
+HGENMENU g_hMenu[15];
int iService=0;
int iHook=0;
diff --git a/plugins/SecureIM/src/commonheaders.h b/plugins/SecureIM/src/commonheaders.h index 9a5091183b..5b0b0173d7 100644 --- a/plugins/SecureIM/src/commonheaders.h +++ b/plugins/SecureIM/src/commonheaders.h @@ -83,7 +83,8 @@ extern PLUGININFOEX pluginInfoEx; #define PREF_METANODB 0x2000 //!< Flag to indicate message should not be added to db by filter when sending
#define PREF_SIMNOMETA 0x4000 //!< Flag to indicate message should not be inspected by filter on metacontact
-extern HANDLE g_hEvent[2], g_hMenu[15], g_hCLIcon, g_hFolders;
+extern HANDLE g_hEvent[2], g_hCLIcon, g_hFolders;
+extern HGENMENU g_hMenu[15];
extern int iService, iHook;
extern HICON g_hICO[ICO_CNT], g_hIEC[1+IEC_CNT*MODE_CNT], g_hPOP[POP_CNT];
extern HANDLE g_IEC[1+IEC_CNT*MODE_CNT];
diff --git a/plugins/SecureIM/src/crypt_dll.cpp b/plugins/SecureIM/src/crypt_dll.cpp index 023de0ba68..c98d6e8489 100644 --- a/plugins/SecureIM/src/crypt_dll.cpp +++ b/plugins/SecureIM/src/crypt_dll.cpp @@ -204,7 +204,7 @@ BOOL LoadKeyPGP(pUinKey ptr) int mode = db_get_b(ptr->hContact,MODULENAME,"pgp_mode",255);
if (mode == 0) {
DBVARIANT dbv;
- DBGetContactSetting(ptr->hContact,MODULENAME,"pgp",&dbv);
+ db_get(ptr->hContact,MODULENAME,"pgp",&dbv);
BOOL r=(dbv.type == DBVT_BLOB);
if (r) pgp_set_keyid(ptr->cntx,(PVOID)dbv.pbVal);
db_free(&dbv);
diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp index 5c89f4d2e9..784cb2378d 100644 --- a/plugins/SecureIM/src/crypt_lists.cpp +++ b/plugins/SecureIM/src/crypt_lists.cpp @@ -221,7 +221,7 @@ void getContactUinA(HANDLE hContact, LPSTR szUIN) DBVARIANT dbv_uniqueid;
LPSTR uID = (LPSTR) CallProtoService(ptr->name, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if (uID == (LPSTR)CALLSERVICE_NOTFOUND ) uID = 0; // Billy_Bons
- if (uID && DBGetContactSetting(hContact, ptr->name, uID, &dbv_uniqueid) == 0) {
+ if (uID && db_get(hContact, ptr->name, uID, &dbv_uniqueid) == 0) {
if (dbv_uniqueid.type == DBVT_WORD)
sprintf(szUIN, "%u [%s]", dbv_uniqueid.wVal, ptr->name);
else if (dbv_uniqueid.type == DBVT_DWORD)
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 504e2e1e5e..531ea39a96 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -17,7 +17,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda return &pluginInfoEx;
}
-HANDLE AddMenuItem(LPCSTR name,int pos,HICON hicon,LPCSTR service,int flags=0,WPARAM wParam=0)
+HGENMENU AddMenuItem(LPCSTR name,int pos,HICON hicon,LPCSTR service,int flags=0,WPARAM wParam=0)
{
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = flags | CMIF_HIDDEN;
@@ -29,13 +29,12 @@ HANDLE AddMenuItem(LPCSTR name,int pos,HICON hicon,LPCSTR service,int flags=0,WP return Menu_AddContactMenuItem(&mi);
}
-HANDLE AddSubItem(HANDLE rootid,LPCSTR name,int pos,int poppos,LPCSTR service,WPARAM wParam=0)
+HGENMENU AddSubItem(HANDLE rootid,LPCSTR name,int pos,int poppos,LPCSTR service,WPARAM wParam=0)
{
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_CHILDPOPUP | CMIF_HIDDEN;
mi.position = pos;
mi.popupPosition = poppos;
- mi.hIcon = NULL;
mi.pszName = (char*)name;
mi.pszPopupName = (char*)rootid;
mi.pszService = (char*)service;
@@ -150,12 +149,12 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if (DBGetContactSetting(0,MODULENAME,"rsa_priv",&dbv) == 0) {
+ if (db_get(0,MODULENAME,"rsa_priv",&dbv) == 0) {
exp->rsa_set_keypair(CPP_MODE_RSA_4096,dbv.pbVal,dbv.cpbVal);
db_free(&dbv);
rsa_4096=1;
}
- else if (DBGetContactSetting(0,MODULENAME,"rsa_priv_4096",&dbv) == 0) {
+ else if (db_get(0,MODULENAME,"rsa_priv_4096",&dbv) == 0) {
exp->rsa_set_keypair(CPP_MODE_RSA_4096|CPP_MODE_RSA_BER,dbv.pbVal,dbv.cpbVal);
db_free(&dbv);
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 3cbbe13449..386fc023bf 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -15,7 +15,7 @@ BOOL hasKey(pUinKey ptr) else if (ptr->mode == MODE_RSAAES) {
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if (DBGetContactSetting(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0) {
+ if (db_get(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0) {
ret = 1;
db_free(&dbv);
}
@@ -1233,7 +1233,7 @@ void ApplyGeneralSettings(HWND hDlg) // Key Exchange Timeout
GetDlgItemText(hDlg,IDC_KET,timeout,5);
tmp = atoi(timeout); if (tmp > 65535) tmp = 65535;
- DBWriteContactSettingWord(0,MODULENAME,"ket",tmp);
+ db_set_w(0,MODULENAME,"ket",tmp);
exp->rsa_set_timeout( db_get_w(0,MODULENAME,"ket",10));
mir_itoa(tmp,timeout,10);
SetDlgItemText(hDlg,IDC_KET,timeout);
@@ -1241,7 +1241,7 @@ void ApplyGeneralSettings(HWND hDlg) // Offline Key Timeout
GetDlgItemText(hDlg,IDC_OKT,timeout,5);
tmp = atoi(timeout); if (tmp > 65535) tmp = 65535;
- DBWriteContactSettingWord(0,MODULENAME,"okt",tmp);
+ db_set_w(0,MODULENAME,"okt",tmp);
mir_itoa(tmp,timeout,10);
SetDlgItemText(hDlg,IDC_OKT,timeout);
@@ -1461,7 +1461,7 @@ void setListViewPUB(HWND hLV, UINT iItem, UINT iStatus) DBVARIANT dbv;
dbv.type = DBVT_BLOB;
pUinKey ptr = (pUinKey) getListViewParam(hLV, iItem);
- if (DBGetContactSetting(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0) {
+ if (db_get(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0) {
int len;
exp->rsa_get_hash((PBYTE)dbv.pbVal,dbv.cpbVal,(PBYTE)str,&len);
sha = mir_strdup(to_hex((PBYTE)str,len));
diff --git a/plugins/SecureIM/src/popupOptions.cpp b/plugins/SecureIM/src/popupOptions.cpp index 7098db2b0e..e25403582c 100644 --- a/plugins/SecureIM/src/popupOptions.cpp +++ b/plugins/SecureIM/src/popupOptions.cpp @@ -20,19 +20,19 @@ INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l char *timeout;
//set timeout value for Key
- if (DBGetContactSetting(0, MODULENAME, "timeoutKey", &dbv) == 0) timeout=dbv.pszVal;
+ if (db_get(0, MODULENAME, "timeoutKey", &dbv) == 0) timeout=dbv.pszVal;
else timeout="0";
SetDlgItemText(hDlg, IDC_TIMEKEY, timeout);
db_free(&dbv);
//set timeout value for SEC
- if (DBGetContactSetting(0, MODULENAME, "timeoutSec", &dbv) == 0) timeout=dbv.pszVal;
+ if (db_get(0, MODULENAME, "timeoutSec", &dbv) == 0) timeout=dbv.pszVal;
else timeout="0";
SetDlgItemText(hDlg, IDC_TIMESEC, timeout);
db_free(&dbv);
//set timeout value for SR
- if (DBGetContactSetting(0, MODULENAME, "timeoutSR", &dbv) == 0) timeout=dbv.pszVal;
+ if (db_get(0, MODULENAME, "timeoutSR", &dbv) == 0) timeout=dbv.pszVal;
else timeout="0";
SetDlgItemText(hDlg, IDC_TIMESR, timeout);
db_free(&dbv);
@@ -57,22 +57,22 @@ INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l switch(LOWORD(wParam)) {
case IDC_BACKKEY:
- DBWriteContactSettingDword(0, MODULENAME, "colorKeyb", color);
+ db_set_dw(0, MODULENAME, "colorKeyb", color);
break;
case IDC_TEXTKEY:
- DBWriteContactSettingDword(0, MODULENAME, "colorKeyt", color);
+ db_set_dw(0, MODULENAME, "colorKeyt", color);
break;
case IDC_BACKSEC:
- DBWriteContactSettingDword(0, MODULENAME, "colorSecb", color);
+ db_set_dw(0, MODULENAME, "colorSecb", color);
break;
case IDC_TEXTSEC:
- DBWriteContactSettingDword(0, MODULENAME, "colorSect", color);
+ db_set_dw(0, MODULENAME, "colorSect", color);
break;
case IDC_BACKSR:
- DBWriteContactSettingDword(0, MODULENAME, "colorSRb", color);
+ db_set_dw(0, MODULENAME, "colorSRb", color);
break;
case IDC_TEXTSR:
- DBWriteContactSettingDword(0, MODULENAME, "colorSRt", color);
+ db_set_dw(0, MODULENAME, "colorSRt", color);
break;
}
return TRUE;
diff --git a/plugins/SecureIM/src/splitmsg.cpp b/plugins/SecureIM/src/splitmsg.cpp index a21cb8ef44..c9098e1999 100644 --- a/plugins/SecureIM/src/splitmsg.cpp +++ b/plugins/SecureIM/src/splitmsg.cpp @@ -11,7 +11,7 @@ LPSTR splitMsg(LPSTR szMsg, int iLen) LPSTR buf = out;
WORD msg_id = db_get_w(0, MODULENAME, "msgid", 0) + 1;
- DBWriteContactSettingWord(0, MODULENAME, "msgid", msg_id);
+ db_set_w(0, MODULENAME, "msgid", msg_id);
int part_all = (len+iLen-1)/iLen;
for (int part_num=0; part_num<part_all; part_num++) {
diff --git a/plugins/SecureIM/src/svcs_clist.cpp b/plugins/SecureIM/src/svcs_clist.cpp index 2b02df1092..3524f78775 100644 --- a/plugins/SecureIM/src/svcs_clist.cpp +++ b/plugins/SecureIM/src/svcs_clist.cpp @@ -71,25 +71,18 @@ int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) if (bMC ) hContact = getMostOnline(hContact); // возьмем тот, через который пойдет сообщение
pUinKey ptr = getUinKey(hContact);
int i;
+ CLISTMENUITEM mi = { sizeof(mi) };
ShowStatusIconNotify(hContact);
// check offline/online
- CLISTMENUITEM mi = { sizeof(mi) };
if (!ptr) {
// hide menu bars
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_HIDDEN;
- for (i=0;i<SIZEOF(g_hMenu);i++) {
- if (g_hMenu[i] )
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[i],(LPARAM)&mi);
- }
+ for (i=0; i < SIZEOF(g_hMenu); i++)
+ Menu_ShowItem(g_hMenu[i], false);
return 0;
}
-// char *szProto = GetContactProto(hContact,0);
-// if (szProto == NULL) // || db_get_dw(hContact, szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
-// return 0;
-
bool isSecureProto = isSecureProtocol(hContact);
bool isPGP = isContactPGP(hContact);
bool isGPG = isContactGPG(hContact);
@@ -98,11 +91,8 @@ int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) bool isMiranda = isClientMiranda(hContact);
// hide all menu bars
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_HIDDEN;
- for (i=0;i<SIZEOF(g_hMenu);i++) {
- if (g_hMenu[i] )
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[i],(LPARAM)&mi);
- }
+ for (i=0; i < SIZEOF(g_hMenu); i++)
+ Menu_ShowItem(g_hMenu[i], false);
if (isSecureProto && !isChat && isMiranda &&
(ptr->mode == MODE_NATIVE || ptr->mode == MODE_RSAAES)) {
@@ -111,61 +101,52 @@ int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) if (!isSecured) {
// create secureim connection
mi.hIcon = mode2icon(ptr->mode|SECURED,2);
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[0],(LPARAM)&mi);
+ Menu_ModifyItem(g_hMenu[0], &mi);
}
else {
// disable secureim connection
mi.hIcon = mode2icon(ptr->mode,2);
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[1],(LPARAM)&mi);
+ Menu_ModifyItem(g_hMenu[1], &mi);
}
// set status menu
- if (bSCM && !bMC &&
- ( !isSecured || ptr->mode == MODE_PGP || ptr->mode == MODE_GPG )) {
+ if (bSCM && !bMC && (!isSecured || ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) {
mi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON;
mi.hIcon = g_hICO[ICO_ST_DIS+ptr->status];
mi.pszName = (LPSTR)sim312[ptr->status];
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[2],(LPARAM)&mi);
+ Menu_ModifyItem(g_hMenu[2], &mi);
mi.flags = CMIM_FLAGS | CMIM_ICON;
for (i=0;i<=(ptr->mode == MODE_RSAAES?1:2);i++) {
mi.hIcon = (i == ptr->status) ? g_hICO[ICO_ST_DIS+ptr->status] : NULL;
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[3+i],(LPARAM)&mi);
+ Menu_ModifyItem(g_hMenu[3+i], &mi);
}
}
}
- else
- if (isSecureProto && !isChat && (ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) {
+ else if (isSecureProto && !isChat && (ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) {
// PGP, GPG
- if (ptr->mode == MODE_PGP && bPGPloaded) {
- if ((bPGPkeyrings || bPGPprivkey) && !isGPG) {
- mi.flags = CMIM_FLAGS;
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[isPGP+6],(LPARAM)&mi);
- }
- }
- if (ptr->mode == MODE_GPG && bGPGloaded) {
- if (bGPGkeyrings && !isPGP) {
- mi.flags = CMIM_FLAGS;
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[isGPG+8],(LPARAM)&mi);
- }
- }
+ if (ptr->mode == MODE_PGP && bPGPloaded)
+ if ((bPGPkeyrings || bPGPprivkey) && !isGPG)
+ Menu_ShowItem(g_hMenu[isPGP+6], true);
+
+ if (ptr->mode == MODE_GPG && bGPGloaded)
+ if (bGPGkeyrings && !isPGP)
+ Menu_ShowItem(g_hMenu[isGPG+8], true);
}
if (isSecureProto && !isChat && isMiranda) {
// set mode menu
- if (bMCM && !bMC &&
- ( !isSecured || ptr->mode == MODE_PGP || ptr->mode == MODE_GPG )) {
-
+ if (bMCM && !bMC && (!isSecured || ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) {
mi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON;
mi.hIcon = g_hICO[ICO_OV_NAT+ptr->mode];
mi.pszName = (LPSTR)sim311[ptr->mode];
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[10],(LPARAM)&mi);
+ Menu_ModifyItem(g_hMenu[10], &mi);
mi.flags = CMIM_FLAGS | CMIM_ICON;
for (i=0;i<MODE_CNT;i++) {
if (i == MODE_PGP && ptr->mode != MODE_PGP && !bPGP ) continue;
if (i == MODE_GPG && ptr->mode != MODE_GPG && !bGPG ) continue;
mi.hIcon = (i == ptr->mode) ? g_hICO[ICO_ST_ENA] : NULL;
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[11+i],(LPARAM)&mi);
+ Menu_ModifyItem(g_hMenu[11+i], &mi);
}
}
}
diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp index 3e4f708792..9031b88231 100644 --- a/plugins/SecureIM/src/svcs_proto.cpp +++ b/plugins/SecureIM/src/svcs_proto.cpp @@ -283,7 +283,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) // decrypting message with last offline key
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if (DBGetContactSetting(ptr->hContact, MODULENAME, "offlineKey", &dbv))
+ if (db_get(ptr->hContact, MODULENAME, "offlineKey", &dbv))
return CallService(MS_PROTO_CHAINRECV, wParam, lParam); // exit and show messsage
// if valid key is succefully retrieved
@@ -683,7 +683,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) // set key for offline user
DBVARIANT dbv; dbv.type = DBVT_BLOB;
if (db_get_dw(ptr->hContact, MODULENAME, "offlineKeyTimeout", 0) > gettime() &&
- DBGetContactSetting(ptr->hContact, MODULENAME, "offlineKey", &dbv) == 0) {
+ db_get(ptr->hContact, MODULENAME, "offlineKey", &dbv) == 0) {
// if valid key is succefully retrieved
ptr->offlineKey = true;
InitKeyX(ptr,dbv.pbVal);
diff --git a/plugins/SecureIM/src/svcs_rsa.cpp b/plugins/SecureIM/src/svcs_rsa.cpp index 38adfa7cd8..d065d0b397 100644 --- a/plugins/SecureIM/src/svcs_rsa.cpp +++ b/plugins/SecureIM/src/svcs_rsa.cpp @@ -42,7 +42,7 @@ int __cdecl rsa_check_pub(HANDLE context, PBYTE pub, int pubLen, PBYTE sig, int DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if (DBGetContactSetting(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0) {
+ if (db_get(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0) {
k = 1;
PBYTE buf = (PBYTE) alloca(sigLen); int len;
exp->rsa_get_hash((PBYTE)dbv.pbVal,dbv.cpbVal,(PBYTE)buf,&len);
@@ -181,7 +181,7 @@ BYTE loadRSAkey(pUinKey ptr) if (!ptr->keyLoaded) {
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if ( DBGetContactSetting(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0) {
+ if ( db_get(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0) {
ptr->keyLoaded = exp->rsa_set_pubkey(ptr->cntx,dbv.pbVal,dbv.cpbVal);
Sent_NetLog("loadRSAkey %d", ptr->keyLoaded);
db_free(&dbv);
|