summaryrefslogtreecommitdiff
path: root/plugins/SecureIM
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-17 15:06:11 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-17 15:06:11 +0000
commit82ae452fff08430d514f762f49e78fec90f88625 (patch)
tree184c31c029a364eec13b58d060d20ba85b2a20bc /plugins/SecureIM
parent15267ea2d489606fb4b99d011bc3ea7c2a644a9f (diff)
- rest of memory leaks
- code cleaning; git-svn-id: http://svn.miranda-ng.org/main/trunk@4078 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SecureIM')
-rw-r--r--plugins/SecureIM/src/commonheaders.cpp48
-rw-r--r--plugins/SecureIM/src/commonheaders.h7
-rw-r--r--plugins/SecureIM/src/crypt_check.cpp8
-rw-r--r--plugins/SecureIM/src/crypt_dll.cpp16
-rw-r--r--plugins/SecureIM/src/crypt_icons.cpp2
-rw-r--r--plugins/SecureIM/src/crypt_lists.cpp20
-rw-r--r--plugins/SecureIM/src/crypt_misc.cpp4
-rw-r--r--plugins/SecureIM/src/crypt_popups.cpp34
-rw-r--r--plugins/SecureIM/src/loadicons.cpp2
-rw-r--r--plugins/SecureIM/src/main.cpp294
-rw-r--r--plugins/SecureIM/src/options.cpp134
-rw-r--r--plugins/SecureIM/src/popupOptions.cpp62
-rw-r--r--plugins/SecureIM/src/splitmsg.cpp4
-rw-r--r--plugins/SecureIM/src/svcs_menu.cpp34
-rw-r--r--plugins/SecureIM/src/svcs_proto.cpp319
-rw-r--r--plugins/SecureIM/src/svcs_rsa.cpp12
-rw-r--r--plugins/SecureIM/src/svcs_srmm.cpp2
17 files changed, 452 insertions, 550 deletions
diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp
index f8de40fc35..5895a51b04 100644
--- a/plugins/SecureIM/src/commonheaders.cpp
+++ b/plugins/SecureIM/src/commonheaders.cpp
@@ -2,14 +2,12 @@
HINSTANCE g_hInst, g_hIconInst;
-LPCSTR szModuleName = MODULENAME;
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_hService=NULL;
-HANDLE *g_hHook=NULL;
+
int iService=0;
int iHook=0;
@@ -76,30 +74,30 @@ int myDBWriteStringEncode(HANDLE hContact,const char *szModule,const char *szSet
void GetFlags()
{
- bSFT = db_get_b(0, szModuleName, "sft", 0);
- bSOM = db_get_b(0, szModuleName, "som", 0);
- bASI = db_get_b(0, szModuleName, "asi", 0);
- bMCD = db_get_b(0, szModuleName, "mcd", 0);
- bSCM = db_get_b(0, szModuleName, "scm", 0);
- bDGP = db_get_b(0, szModuleName, "dgp", 0);
- bAIP = db_get_b(0, szModuleName, "aip", 0);
- bNOL = db_get_b(0, szModuleName, "nol", 0);
- bAAK = db_get_b(0, szModuleName, "aak", 0);
- bMCM = db_get_b(0, szModuleName, "mcm", 0);
+ bSFT = db_get_b(0, MODULENAME, "sft", 0);
+ bSOM = db_get_b(0, MODULENAME, "som", 0);
+ bASI = db_get_b(0, MODULENAME, "asi", 0);
+ bMCD = db_get_b(0, MODULENAME, "mcd", 0);
+ bSCM = db_get_b(0, MODULENAME, "scm", 0);
+ bDGP = db_get_b(0, MODULENAME, "dgp", 0);
+ bAIP = db_get_b(0, MODULENAME, "aip", 0);
+ bNOL = db_get_b(0, MODULENAME, "nol", 0);
+ bAAK = db_get_b(0, MODULENAME, "aak", 0);
+ bMCM = db_get_b(0, MODULENAME, "mcm", 0);
}
void SetFlags()
{
- db_set_b(0, szModuleName, "sft", bSFT);
- db_set_b(0, szModuleName, "som", bSOM);
- db_set_b(0, szModuleName, "asi", bASI);
- db_set_b(0, szModuleName, "mcd", bMCD);
- db_set_b(0, szModuleName, "scm", bSCM);
- db_set_b(0, szModuleName, "dgp", bDGP);
- db_set_b(0, szModuleName, "aip", bAIP);
- db_set_b(0, szModuleName, "nol", bNOL);
- db_set_b(0, szModuleName, "aak", bAAK);
- db_set_b(0, szModuleName, "mcm", bMCM);
+ db_set_b(0, MODULENAME, "sft", bSFT);
+ db_set_b(0, MODULENAME, "som", bSOM);
+ db_set_b(0, MODULENAME, "asi", bASI);
+ db_set_b(0, MODULENAME, "mcd", bMCD);
+ db_set_b(0, MODULENAME, "scm", bSCM);
+ db_set_b(0, MODULENAME, "dgp", bDGP);
+ db_set_b(0, MODULENAME, "aip", bAIP);
+ db_set_b(0, MODULENAME, "nol", bNOL);
+ db_set_b(0, MODULENAME, "aak", bAAK);
+ db_set_b(0, MODULENAME, "mcm", bMCM);
}
struct A2U {
@@ -161,8 +159,8 @@ HANDLE hNetlibUser;
void InitNetlib()
{
NETLIBUSER nl_user = { sizeof(nl_user) };
- nl_user.szSettingsModule = (LPSTR)szModuleName;
- nl_user.szDescriptiveName = (LPSTR)szModuleName;
+ nl_user.szSettingsModule = (LPSTR)MODULENAME;
+ nl_user.szDescriptiveName = (LPSTR)MODULENAME;
nl_user.flags = NUF_NOOPTIONS;
hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nl_user);
diff --git a/plugins/SecureIM/src/commonheaders.h b/plugins/SecureIM/src/commonheaders.h
index d803db21b2..3965536da0 100644
--- a/plugins/SecureIM/src/commonheaders.h
+++ b/plugins/SecureIM/src/commonheaders.h
@@ -72,7 +72,6 @@
#define MODULENAME "SecureIM"
-extern LPCSTR szModuleName;
extern LPCSTR szVersionStr;
extern char TEMP[MAX_PATH];
extern int TEMP_SIZE;
@@ -85,8 +84,6 @@ extern PLUGININFOEX pluginInfoEx;
#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_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 HANDLE g_IEC[1+IEC_CNT*MODE_CNT];
@@ -103,10 +100,6 @@ int onModulesLoaded(WPARAM, LPARAM);
int onSystemOKToExit(WPARAM, LPARAM);
int ModuleLoad(WPARAM wParam, LPARAM lParam);
-void AddServiceFunction(LPCSTR,MIRANDASERVICE);
-void AddProtoServiceFunction(LPCSTR,MIRANDASERVICE);
-void AddHookFunction(LPCSTR,MIRANDAHOOK);
-
LPSTR myDBGetString(HANDLE,const char *,const char *);
LPSTR myDBGetStringDecode(HANDLE,const char *,const char *);
int myDBWriteStringEncode(HANDLE,const char *,const char *,const char *);
diff --git a/plugins/SecureIM/src/crypt_check.cpp b/plugins/SecureIM/src/crypt_check.cpp
index b1bb9512ce..a8d3ebf2a5 100644
--- a/plugins/SecureIM/src/crypt_check.cpp
+++ b/plugins/SecureIM/src/crypt_check.cpp
@@ -38,12 +38,12 @@ BYTE isContactSecured(HANDLE hContact) {
if (cpp_keyx(clist[j].cntx)!=0) r|=SECURED;
break;
case MODE_PGP:
- DBGetContactSetting(hContact,szModuleName,"pgp",&dbv);
+ DBGetContactSetting(hContact,MODULENAME,"pgp",&dbv);
if ( dbv.type!=0 ) r|=SECURED;
DBFreeVariant(&dbv);
break;
case MODE_GPG:
- DBGetContactSetting(hContact,szModuleName,"gpg",&dbv);
+ DBGetContactSetting(hContact,MODULENAME,"gpg",&dbv);
if ( dbv.type!=0 ) r|=SECURED;
DBFreeVariant(&dbv);
break;
@@ -157,7 +157,7 @@ BOOL isContactPGP(HANDLE hContact) {
if ( !clist[j].proto->inspecting ) break;
if ( clist[j].mode!=MODE_PGP ) break;
DBVARIANT dbv;
- DBGetContactSetting(hContact,szModuleName,"pgp",&dbv);
+ DBGetContactSetting(hContact,MODULENAME,"pgp",&dbv);
BOOL r=(dbv.type!=0);
DBFreeVariant(&dbv);
return r;
@@ -176,7 +176,7 @@ BOOL isContactGPG(HANDLE hContact) {
if ( !clist[j].proto->inspecting ) break;
if ( clist[j].mode!=MODE_GPG ) break;
DBVARIANT dbv;
- DBGetContactSetting(hContact,szModuleName,"gpg",&dbv);
+ DBGetContactSetting(hContact,MODULENAME,"gpg",&dbv);
BOOL r=(dbv.type!=0);
DBFreeVariant(&dbv);
return r;
diff --git a/plugins/SecureIM/src/crypt_dll.cpp b/plugins/SecureIM/src/crypt_dll.cpp
index f81ea8ad3a..3a2e5ad6a3 100644
--- a/plugins/SecureIM/src/crypt_dll.cpp
+++ b/plugins/SecureIM/src/crypt_dll.cpp
@@ -9,7 +9,7 @@ LPSTR InitKeyA(pUinKey ptr,int features) {
if ( !ptr->cntx )
ptr->cntx = cpp_create_context(isProtoSmallPackets(ptr->hContact)?CPP_MODE_BASE64:0);
- char *tmp = myDBGetString(ptr->hContact,szModuleName,"PSK");
+ char *tmp = myDBGetString(ptr->hContact,MODULENAME,"PSK");
if (tmp) {
cpp_init_keyp(ptr->cntx,tmp); // make pre-shared key from password
mir_free(tmp);
@@ -50,7 +50,7 @@ int InitKeyB(pUinKey ptr,LPCSTR key) {
ptr->cntx = cpp_create_context(isProtoSmallPackets(ptr->hContact)?CPP_MODE_BASE64:0);
if (!cpp_keyp(ptr->cntx)) {
- char *tmp = myDBGetString(ptr->hContact,szModuleName,"PSK");
+ char *tmp = myDBGetString(ptr->hContact,MODULENAME,"PSK");
if (tmp) {
cpp_init_keyp(ptr->cntx,tmp); // make pre-shared key from password
mir_free(tmp);
@@ -88,7 +88,7 @@ BOOL CalculateKeyX(pUinKey ptr,HANDLE hContact) {
cpp_get_keyx(ptr->cntx,buffer);
DBCONTACTWRITESETTING cws;
- cws.szModule = szModuleName;
+ cws.szModule = MODULENAME;
// store key in database
cws.szSetting = "offlineKey";
@@ -100,7 +100,7 @@ BOOL CalculateKeyX(pUinKey ptr,HANDLE hContact) {
// store timeout of key in database (2 days)
cws.szSetting = "offlineKeyTimeout";
cws.value.type = DBVT_DWORD;
- cws.value.dVal = gettime()+(60*60*24*DBGetContactSettingWord(0,szModuleName,"okt",2));
+ cws.value.dVal = gettime()+(60*60*24*DBGetContactSettingWord(0,MODULENAME,"okt",2));
CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws);
// key exchange is finished
@@ -200,10 +200,10 @@ LPSTR decodeMsg(pUinKey ptr, LPARAM lParam, LPSTR szEncMsg) {
BOOL LoadKeyPGP(pUinKey ptr) {
- int mode = db_get_b(ptr->hContact,szModuleName,"pgp_mode",255);
+ int mode = db_get_b(ptr->hContact,MODULENAME,"pgp_mode",255);
if (mode==0) {
DBVARIANT dbv;
- DBGetContactSetting(ptr->hContact,szModuleName,"pgp",&dbv);
+ DBGetContactSetting(ptr->hContact,MODULENAME,"pgp",&dbv);
BOOL r=(dbv.type==DBVT_BLOB);
if (r) pgp_set_keyid(ptr->cntx,(PVOID)dbv.pbVal);
DBFreeVariant(&dbv);
@@ -211,7 +211,7 @@ BOOL LoadKeyPGP(pUinKey ptr) {
}
else
if (mode==1) {
- LPSTR key = myDBGetStringDecode(ptr->hContact,szModuleName,"pgp");
+ LPSTR key = myDBGetStringDecode(ptr->hContact,MODULENAME,"pgp");
if ( key ) {
pgp_set_key(ptr->cntx,key);
mir_free(key);
@@ -224,7 +224,7 @@ BOOL LoadKeyPGP(pUinKey ptr) {
BOOL LoadKeyGPG(pUinKey ptr) {
- LPSTR key = myDBGetString(ptr->hContact,szModuleName,"gpg");
+ LPSTR key = myDBGetString(ptr->hContact,MODULENAME,"gpg");
if ( key ) {
gpg_set_keyid(ptr->cntx,key);
mir_free(key);
diff --git a/plugins/SecureIM/src/crypt_icons.cpp b/plugins/SecureIM/src/crypt_icons.cpp
index c155c0525a..b22fc909cf 100644
--- a/plugins/SecureIM/src/crypt_icons.cpp
+++ b/plugins/SecureIM/src/crypt_icons.cpp
@@ -77,7 +77,7 @@ void ShowStatusIcon(HANDLE hContact, int mode)
if ( ServiceExists(MS_MSG_MODIFYICON)) { // обновить иконки в srmm
StatusIconData sid = {sizeof(sid) };
- sid.szModule = (char*)szModuleName;
+ sid.szModule = (char*)MODULENAME;
for(int i = MODE_NATIVE; i < MODE_CNT; i++) {
sid.dwId = i;
sid.flags = (mode & SECURED) ? 0 : MBF_DISABLED;
diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp
index fc77021775..964cb7b4ff 100644
--- a/plugins/SecureIM/src/crypt_lists.cpp
+++ b/plugins/SecureIM/src/crypt_lists.cpp
@@ -9,7 +9,7 @@ int clist_inc = 100;
void loadSupportedProtocols() {
int numberOfProtocols;
PROTOACCOUNT **protos;
- LPSTR szNames = myDBGetString(0,szModuleName,"protos");
+ LPSTR szNames = myDBGetString(0,MODULENAME,"protos");
if ( szNames && strchr(szNames,':') == NULL ) {
LPSTR tmp = (LPSTR) mir_alloc(2048); int j=0;
for(int i=0; szNames[i]; i++) {
@@ -20,13 +20,13 @@ void loadSupportedProtocols() {
}
tmp[j] = '\0';
SAFE_FREE(szNames); szNames = tmp;
- DBWriteContactSettingString(0,szModuleName,"protos",szNames);
+ DBWriteContactSettingString(0,MODULENAME,"protos",szNames);
}
ProtoEnumAccounts(&numberOfProtocols, &protos);
- for (int i=0;i<numberOfProtocols;i++) {
- if (protos[i]->szModuleName && CallProtoService(protos[i]->szModuleName,PS_GETCAPS,PFLAGNUM_2,0)) {
+ for (int i=0; i < numberOfProtocols; i++) {
+ if (protos[i]->szModuleName && CallProtoService(protos[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)) {
int j = proto_cnt; proto_cnt++;
proto = (pSupPro) mir_realloc(proto,sizeof(SupPro)*proto_cnt);
memset(&proto[j],0,sizeof(SupPro));
@@ -51,9 +51,7 @@ void loadSupportedProtocols() {
}
}
}
- else {
- proto[j].inspecting = true;
- }
+ else proto[j].inspecting = true;
}
}
SAFE_FREE(szNames);
@@ -95,17 +93,17 @@ pUinKey addContact(HANDLE hContact) {
clist[j].footer = FOOTER;
clist[j].hContact = hContact;
clist[j].proto = proto;
- clist[j].mode = db_get_b(hContact, szModuleName, "mode", 99);
+ clist[j].mode = db_get_b(hContact, MODULENAME, "mode", 99);
if ( clist[j].mode == 99 ) {
if ( isContactPGP(hContact)) clist[j].mode = MODE_PGP;
else
if ( isContactGPG(hContact)) clist[j].mode = MODE_GPG;
else
clist[j].mode = MODE_RSAAES;
- db_set_b(hContact, szModuleName, "mode", clist[j].mode);
+ db_set_b(hContact, MODULENAME, "mode", clist[j].mode);
}
- clist[j].status = db_get_b(hContact, szModuleName, "StatusID", STATUS_ENABLED);
- clist[j].gpgMode = db_get_b(hContact, szModuleName, "gpgANSI", 0);
+ clist[j].status = db_get_b(hContact, MODULENAME, "StatusID", STATUS_ENABLED);
+ clist[j].gpgMode = db_get_b(hContact, MODULENAME, "gpgANSI", 0);
return &clist[j];
}
}
diff --git a/plugins/SecureIM/src/crypt_misc.cpp b/plugins/SecureIM/src/crypt_misc.cpp
index fb65f29798..4b82746279 100644
--- a/plugins/SecureIM/src/crypt_misc.cpp
+++ b/plugins/SecureIM/src/crypt_misc.cpp
@@ -43,7 +43,7 @@ unsigned __stdcall sttWaitForExchange( LPVOID param ) {
if ( !ptr ) return 0;
- for(int i=0;i<DBGetContactSettingWord(0,szModuleName,"ket",10)*10; i++) {
+ for(int i=0;i<DBGetContactSettingWord(0,MODULENAME,"ket",10)*10; i++) {
Sleep( 100 );
if ( ptr->waitForExchange != 1 ) break;
} // for
@@ -53,7 +53,7 @@ unsigned __stdcall sttWaitForExchange( LPVOID param ) {
#endif
// if keyexchange failed or timeout
if ( ptr->waitForExchange==1 || ptr->waitForExchange==3 ) { // Їа®вге«® - ®вЇа ў«пҐ¬ ­Ґ§ иЁда®ў ­­®, Ґб«Ё ­ ¤®
- if ( ptr->msgQueue && msgbox1(0,sim104,szModuleName,MB_YESNO|MB_ICONQUESTION)==IDYES ) {
+ if ( ptr->msgQueue && msgbox1(0,sim104,MODULENAME,MB_YESNO|MB_ICONQUESTION)==IDYES ) {
EnterCriticalSection(&localQueueMutex);
ptr->sendQueue = true;
pWM ptrMessage = ptr->msgQueue;
diff --git a/plugins/SecureIM/src/crypt_popups.cpp b/plugins/SecureIM/src/crypt_popups.cpp
index 4d91ab8f8d..6f217273c1 100644
--- a/plugins/SecureIM/src/crypt_popups.cpp
+++ b/plugins/SecureIM/src/crypt_popups.cpp
@@ -41,32 +41,32 @@ void showPopUp(LPCSTR lpzText,HANDLE hContact,HICON hIcon, UINT type) {
DBVARIANT dbv_timeout;
if (type==0) {
- colorBack=DBGetContactSettingDword(0,szModuleName,"colorKeyb",(UINT)-1);
- colorText=DBGetContactSettingDword(0,szModuleName,"colorKeyt",(UINT)-1);
+ colorBack=DBGetContactSettingDword(0,MODULENAME,"colorKeyb",(UINT)-1);
+ colorText=DBGetContactSettingDword(0,MODULENAME,"colorKeyt",(UINT)-1);
if (colorBack==(UINT)-1) colorBack=colorBackKey;
if (colorText==(UINT)-1) colorText=colorTextKey;
- res=DBGetContactSetting(0,szModuleName,"timeoutKey",&dbv_timeout);
+ res=DBGetContactSetting(0,MODULENAME,"timeoutKey",&dbv_timeout);
if (res==0) timeout=atoi(dbv_timeout.pszVal);
DBFreeVariant(&dbv_timeout);
}
else if (type==1) {
- colorBack=DBGetContactSettingDword(0,szModuleName,"colorSecb",(UINT)-1);
- colorText=DBGetContactSettingDword(0,szModuleName,"colorSect",(UINT)-1);
+ colorBack=DBGetContactSettingDword(0,MODULENAME,"colorSecb",(UINT)-1);
+ colorText=DBGetContactSettingDword(0,MODULENAME,"colorSect",(UINT)-1);
if (colorBack==(UINT)-1) colorBack=colorBackSec;
if (colorText==(UINT)-1) colorText=colorTextSec;
- res=DBGetContactSetting(0,szModuleName,"timeoutSec",&dbv_timeout);
+ res=DBGetContactSetting(0,MODULENAME,"timeoutSec",&dbv_timeout);
if (res==0) timeout=atoi(dbv_timeout.pszVal);
DBFreeVariant(&dbv_timeout);
}
else if (type>=2) {
- colorBack=DBGetContactSettingDword(0, szModuleName, "colorSRb", (UINT)-1);
- colorText=DBGetContactSettingDword(0, szModuleName, "colorSRt", (UINT)-1);
+ colorBack=DBGetContactSettingDword(0, MODULENAME, "colorSRb", (UINT)-1);
+ colorText=DBGetContactSettingDword(0, MODULENAME, "colorSRt", (UINT)-1);
if (colorBack==(UINT)-1) colorBack=colorBackSR;
if (colorText==(UINT)-1) colorText=colorTextSR;
- res=DBGetContactSetting(0,szModuleName,"timeoutSR",&dbv_timeout);
+ res=DBGetContactSetting(0,MODULENAME,"timeoutSR",&dbv_timeout);
if (res==0) timeout=atoi(dbv_timeout.pszVal);
DBFreeVariant(&dbv_timeout);
}
@@ -90,36 +90,36 @@ void showPopUp(LPCSTR lpzText,HANDLE hContact,HICON hIcon, UINT type) {
void showPopUpDCmsg(HANDLE hContact,LPCSTR msg) {
- int indic=db_get_b(0, szModuleName, "dc",1);
+ int indic=db_get_b(0, MODULENAME, "dc",1);
if (indic==1) showPopUp(msg,hContact,g_hPOP[POP_PU_DIS],1);
}
void showPopUpDC(HANDLE hContact) {
- int indic=db_get_b(0, szModuleName, "dc",1);
+ int indic=db_get_b(0, MODULENAME, "dc",1);
if (indic==1) showPopUp(sim006,hContact,g_hPOP[POP_PU_DIS],1);
}
void showPopUpEC(HANDLE hContact) {
- int indic=db_get_b(0, szModuleName, "ec",1);
+ int indic=db_get_b(0, MODULENAME, "ec",1);
if (indic==1) showPopUp(sim001,hContact,g_hPOP[POP_PU_EST],1);
}
void showPopUpKS(HANDLE hContact) {
- int indic=db_get_b(0, szModuleName, "ks",1);
+ int indic=db_get_b(0, MODULENAME, "ks",1);
if (indic==1) showPopUp(sim007,hContact,g_hPOP[POP_PU_PRC],0);
}
void showPopUpKRmsg(HANDLE hContact,LPCSTR msg) {
- int indic=db_get_b(0, szModuleName, "kr",1);
+ int indic=db_get_b(0, MODULENAME, "kr",1);
if (indic==1) showPopUp(msg,hContact,g_hPOP[POP_PU_PRC],0);
}
void showPopUpKR(HANDLE hContact) {
- int indic=db_get_b(0, szModuleName, "kr",1);
+ int indic=db_get_b(0, MODULENAME, "kr",1);
if (indic==1) showPopUp(sim008,hContact,g_hPOP[POP_PU_PRC],0);
}
void showPopUpSM(HANDLE hContact) {
- int indic=db_get_b(0, szModuleName, "ss",0);
+ int indic=db_get_b(0, MODULENAME, "ss",0);
if (indic==1) showPopUp(sim009,hContact,g_hPOP[POP_PU_MSS],2);
SkinPlaySound("OutgoingSecureMessage");
}
void showPopUpRM(HANDLE hContact) {
- int indic=db_get_b(0, szModuleName, "sr",0);
+ int indic=db_get_b(0, MODULENAME, "sr",0);
if (indic==1) showPopUp(sim010,hContact,g_hPOP[POP_PU_MSR],2);
SkinPlaySound("IncomingSecureMessage");
}
diff --git a/plugins/SecureIM/src/loadicons.cpp b/plugins/SecureIM/src/loadicons.cpp
index ba6ca81727..cf86cb77dc 100644
--- a/plugins/SecureIM/src/loadicons.cpp
+++ b/plugins/SecureIM/src/loadicons.cpp
@@ -116,7 +116,7 @@ void InitIcons(void)
g_hPOP[icons[i].idx] = hIcon;
}
- AddHookFunction(ME_SKIN2_ICONSCHANGED, ReloadIcons);
+ HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
}
// EOF
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp
index 87370c7260..3c3d08aa64 100644
--- a/plugins/SecureIM/src/main.cpp
+++ b/plugins/SecureIM/src/main.cpp
@@ -16,27 +16,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
return &pluginInfoEx;
}
-void AddServiceFunction(LPCSTR serviceName, MIRANDASERVICE serviceFunction) {
-
- g_hService = (HANDLE*) mir_realloc(g_hService,sizeof(HANDLE)*(iService+1));
- g_hService[iService] = CreateServiceFunction(serviceName, serviceFunction);
- iService++;
-}
-
-void AddProtoServiceFunction(LPCSTR serviceName, MIRANDASERVICE serviceFunction)
-{
- g_hService = (HANDLE*) mir_realloc(g_hService,sizeof(HANDLE)*(iService+1));
- g_hService[iService] = CreateProtoServiceFunction(szModuleName, serviceName, serviceFunction);
- iService++;
-}
-
-void AddHookFunction(LPCSTR eventName, MIRANDAHOOK hookFunction)
-{
- g_hHook = (HANDLE*) mir_realloc(g_hHook,sizeof(HANDLE)*(iHook+1));
- g_hHook[iHook] = HookEvent(eventName, hookFunction);
- iHook++;
-}
-
HANDLE AddMenuItem(LPCSTR name,int pos,HICON hicon,LPCSTR service,int flags=0,WPARAM wParam=0)
{
CLISTMENUITEM mi = { sizeof(mi) };
@@ -102,7 +81,7 @@ extern "C" __declspec(dllexport) int __cdecl Load(void)
// load crypo++ dll
if ( !loadlib()) {
- msgbox1(0,sim107,szModuleName,MB_OK|MB_ICONSTOP);
+ msgbox1(0,sim107,MODULENAME,MB_OK|MB_ICONSTOP);
return 1;
}
@@ -110,33 +89,33 @@ extern "C" __declspec(dllexport) int __cdecl Load(void)
// register plugin module
PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
- pd.szName = (char*)szModuleName;
+ pd.szName = (char*)MODULENAME;
pd.type = PROTOTYPE_ENCRYPTION;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
// hook events
- AddHookFunction(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
- AddHookFunction(ME_SYSTEM_OKTOEXIT, onSystemOKToExit);
- AddHookFunction(ME_SYSTEM_MODULELOAD, ModuleLoad);
- AddHookFunction(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
+ HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
+ HookEvent(ME_SYSTEM_OKTOEXIT, onSystemOKToExit);
+ HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad);
+ HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
g_hEvent[0] = CreateHookableEvent(MODULENAME"/Disabled");
g_hEvent[1] = CreateHookableEvent(MODULENAME"/Established");
- AddServiceFunction(MODULENAME"/IsContactSecured",Service_IsContactSecured);
- AddServiceFunction(MODULENAME"/SIM_EST",Service_CreateIM);
- AddServiceFunction(MODULENAME"/SIM_DIS",Service_DisableIM);
- AddServiceFunction(MODULENAME"/SIM_ST_DIS",Service_StatusDis);
- AddServiceFunction(MODULENAME"/SIM_ST_ENA",Service_StatusEna);
- AddServiceFunction(MODULENAME"/SIM_ST_TRY",Service_StatusTry);
- AddServiceFunction(MODULENAME"/PGP_SET",Service_PGPsetKey);
- AddServiceFunction(MODULENAME"/PGP_DEL",Service_PGPdelKey);
- AddServiceFunction(MODULENAME"/GPG_SET",Service_GPGsetKey);
- AddServiceFunction(MODULENAME"/GPG_DEL",Service_GPGdelKey);
- AddServiceFunction(MODULENAME"/MODE_NAT",Service_ModeNative);
- AddServiceFunction(MODULENAME"/MODE_PGP",Service_ModePGP);
- AddServiceFunction(MODULENAME"/MODE_GPG",Service_ModeGPG);
- AddServiceFunction(MODULENAME"/MODE_RSA",Service_ModeRSAAES);
+ CreateServiceFunction(MODULENAME"/IsContactSecured",Service_IsContactSecured);
+ CreateServiceFunction(MODULENAME"/SIM_EST",Service_CreateIM);
+ CreateServiceFunction(MODULENAME"/SIM_DIS",Service_DisableIM);
+ CreateServiceFunction(MODULENAME"/SIM_ST_DIS",Service_StatusDis);
+ CreateServiceFunction(MODULENAME"/SIM_ST_ENA",Service_StatusEna);
+ CreateServiceFunction(MODULENAME"/SIM_ST_TRY",Service_StatusTry);
+ CreateServiceFunction(MODULENAME"/PGP_SET",Service_PGPsetKey);
+ CreateServiceFunction(MODULENAME"/PGP_DEL",Service_PGPdelKey);
+ CreateServiceFunction(MODULENAME"/GPG_SET",Service_GPGsetKey);
+ CreateServiceFunction(MODULENAME"/GPG_DEL",Service_GPGdelKey);
+ CreateServiceFunction(MODULENAME"/MODE_NAT",Service_ModeNative);
+ CreateServiceFunction(MODULENAME"/MODE_PGP",Service_ModePGP);
+ CreateServiceFunction(MODULENAME"/MODE_GPG",Service_ModeGPG);
+ CreateServiceFunction(MODULENAME"/MODE_RSA",Service_ModeRSAAES);
return 0;
}
@@ -156,75 +135,73 @@ int ModuleLoad(WPARAM wParam, LPARAM lParam)
int onModulesLoaded(WPARAM wParam, LPARAM lParam)
{
#if defined(_DEBUG) || defined(NETLIB_LOG)
- InitNetlib();
- Sent_NetLog("onModuleLoaded begin");
+ InitNetlib();
+ Sent_NetLog("onModuleLoaded begin");
#endif
- g_hFolders = FoldersRegisterCustomPathT(szModuleName, LPGEN("Icons"), _T(MIRANDA_PATH"\\icons"));
+ g_hFolders = FoldersRegisterCustomPathT(MODULENAME, LPGEN("Icons"), _T(MIRANDA_PATH"\\icons"));
- InitIcons();
- GetFlags();
- ModuleLoad(0, 0);
+ InitIcons();
+ GetFlags();
+ ModuleLoad(0, 0);
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_init");
#endif
- { // RSA/AES
- rsa_init(&exp,&imp);
-
- DBVARIANT dbv;
- dbv.type = DBVT_BLOB;
+ // RSA/AES
+ rsa_init(&exp, &imp);
- if ( DBGetContactSetting(0,szModuleName,"rsa_priv",&dbv) == 0 ) {
- exp->rsa_set_keypair(CPP_MODE_RSA_4096,dbv.pbVal,dbv.cpbVal);
- DBFreeVariant(&dbv);
- rsa_4096=1;
- }
- else
- if ( DBGetContactSetting(0,szModuleName,"rsa_priv_4096",&dbv) == 0 ) {
- exp->rsa_set_keypair(CPP_MODE_RSA_4096|CPP_MODE_RSA_BER,dbv.pbVal,dbv.cpbVal);
- DBFreeVariant(&dbv);
+ DBVARIANT dbv;
+ dbv.type = DBVT_BLOB;
- char priv_key[4096]; int priv_len;
- char pub_key[4096]; int pub_len;
+ if ( DBGetContactSetting(0,MODULENAME,"rsa_priv",&dbv) == 0 ) {
+ exp->rsa_set_keypair(CPP_MODE_RSA_4096,dbv.pbVal,dbv.cpbVal);
+ DBFreeVariant(&dbv);
+ rsa_4096=1;
+ }
+ else if ( DBGetContactSetting(0,MODULENAME,"rsa_priv_4096",&dbv) == 0 ) {
+ exp->rsa_set_keypair(CPP_MODE_RSA_4096|CPP_MODE_RSA_BER,dbv.pbVal,dbv.cpbVal);
+ DBFreeVariant(&dbv);
- DBCONTACTWRITESETTING cws;
- cws.szModule = szModuleName;
- cws.value.type = DBVT_BLOB;
+ char priv_key[4096]; int priv_len;
+ char pub_key[4096]; int pub_len;
- exp->rsa_get_keypair(CPP_MODE_RSA_4096,(PBYTE)&priv_key,&priv_len,(PBYTE)&pub_key,&pub_len);
+ DBCONTACTWRITESETTING cws;
+ cws.szModule = MODULENAME;
+ cws.value.type = DBVT_BLOB;
- cws.szSetting = "rsa_priv";
- cws.value.pbVal = (PBYTE)&priv_key;
- cws.value.cpbVal = priv_len;
- CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
+ exp->rsa_get_keypair(CPP_MODE_RSA_4096,(PBYTE)&priv_key,&priv_len,(PBYTE)&pub_key,&pub_len);
- cws.szSetting = "rsa_pub";
- cws.value.pbVal = (PBYTE)&pub_key;
- cws.value.cpbVal = pub_len;
- CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
+ cws.szSetting = "rsa_priv";
+ cws.value.pbVal = (PBYTE)&priv_key;
+ cws.value.cpbVal = priv_len;
+ CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
- DBDeleteContactSetting(0, szModuleName, "rsa_priv_2048");
- DBDeleteContactSetting(0, szModuleName, "rsa_pub_2048");
- rsa_4096 = 1;
- }
+ cws.szSetting = "rsa_pub";
+ cws.value.pbVal = (PBYTE)&pub_key;
+ cws.value.cpbVal = pub_len;
+ CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
- if ( !rsa_4096 ) {
- unsigned int tID;
- CloseHandle( (HANDLE) _beginthreadex(NULL, 0, sttGenerateRSA, NULL, 0, &tID));
- }
+ db_unset(0, MODULENAME, "rsa_priv_2048");
+ db_unset(0, MODULENAME, "rsa_pub_2048");
+ rsa_4096 = 1;
+ }
- exp->rsa_set_timeout( DBGetContactSettingWord(0,szModuleName,"ket",10));
+ if ( !rsa_4096 ) {
+ unsigned int tID;
+ CloseHandle( (HANDLE) _beginthreadex(NULL, 0, sttGenerateRSA, NULL, 0, &tID));
}
+ exp->rsa_set_timeout( DBGetContactSettingWord(0,MODULENAME,"ket",10));
+
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("pgp_init");
#endif
- bPGP = db_get_b(0, szModuleName, "pgp", 0);
+ bPGP = db_get_b(0, MODULENAME, "pgp", 0);
if (bPGP) { //PGP
bPGPloaded = pgp_init();
- bUseKeyrings = db_get_b(0,szModuleName,"ukr",1);
- LPSTR priv = myDBGetStringDecode(0,szModuleName,"pgpPrivKey");
+ bUseKeyrings = db_get_b(0,MODULENAME,"ukr",1);
+ LPSTR priv = myDBGetStringDecode(0,MODULENAME,"pgpPrivKey");
if (priv) {
bPGPprivkey = true;
if (bPGPloaded)
@@ -239,12 +216,12 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam)
}
else {
LPSTR tmp;
- tmp = myDBGetString(0,szModuleName,"pgpPubRing");
+ tmp = myDBGetString(0,MODULENAME,"pgpPubRing");
if (tmp) {
strncpy(PubRingPath,tmp,sizeof(PubRingPath));
mir_free(tmp);
}
- tmp = myDBGetString(0,szModuleName,"pgpSecRing");
+ tmp = myDBGetString(0,MODULENAME,"pgpSecRing");
if (tmp) {
strncpy(SecRingPath,tmp,sizeof(SecRingPath));
mir_free(tmp);
@@ -252,12 +229,12 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam)
if (PubRingPath[0] && SecRingPath[0]) {
bPGPkeyrings = pgp_open_keyrings(PubRingPath,SecRingPath);
if (bPGPkeyrings) {
- DBWriteContactSettingString(0,szModuleName,"pgpPubRing",PubRingPath);
- DBWriteContactSettingString(0,szModuleName,"pgpSecRing",SecRingPath);
+ DBWriteContactSettingString(0,MODULENAME,"pgpPubRing",PubRingPath);
+ DBWriteContactSettingString(0,MODULENAME,"pgpSecRing",SecRingPath);
}
else {
- DBDeleteContactSetting(0, szModuleName, "pgpPubRing");
- DBDeleteContactSetting(0, szModuleName, "pgpSecRing");
+ db_unset(0, MODULENAME, "pgpPubRing");
+ db_unset(0, MODULENAME, "pgpSecRing");
}
}
}
@@ -267,37 +244,34 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam)
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("gpg_init");
#endif
- bGPG = db_get_b(0, szModuleName, "gpg", 0);
+ bGPG = db_get_b(0, MODULENAME, "gpg", 0);
if (bGPG) { //GPG
-
- LPSTR tmp;
-
bGPGloaded = gpg_init();
- char gpgexec[MAX_PATH], gpghome[MAX_PATH];
- gpgexec[0]='\0'; gpghome[0]='\0';
+ char gpgexec[MAX_PATH], gpghome[MAX_PATH];
+ gpgexec[0]='\0'; gpghome[0]='\0';
- tmp = myDBGetString(0,szModuleName,"gpgExec");
+ LPSTR tmp = myDBGetString(0,MODULENAME,"gpgExec");
if (tmp) {
strncpy(gpgexec,tmp,sizeof(gpgexec));
mir_free(tmp);
}
- tmp = myDBGetString(0,szModuleName,"gpgHome");
+ tmp = myDBGetString(0,MODULENAME,"gpgHome");
if (tmp) {
strncpy(gpghome,tmp,sizeof(gpghome));
mir_free(tmp);
}
- if (db_get_b(0, szModuleName, "gpgLogFlag",0)) {
- tmp = myDBGetString(0,szModuleName,"gpgLog");
+ if (db_get_b(0, MODULENAME, "gpgLogFlag",0)) {
+ tmp = myDBGetString(0,MODULENAME,"gpgLog");
if (tmp) {
gpg_set_log(tmp);
mir_free(tmp);
}
}
- if (db_get_b(0, szModuleName, "gpgTmpFlag",0)) {
- tmp = myDBGetString(0,szModuleName,"gpgTmp");
+ if (db_get_b(0, MODULENAME, "gpgTmpFlag",0)) {
+ tmp = myDBGetString(0,MODULENAME,"gpgTmp");
if (tmp) {
gpg_set_tmp(tmp);
mir_free(tmp);
@@ -306,17 +280,17 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam)
bGPGkeyrings = gpg_open_keyrings(gpgexec,gpghome);
if (bGPGkeyrings) {
- DBWriteContactSettingString(0,szModuleName,"gpgExec",gpgexec);
- DBWriteContactSettingString(0,szModuleName,"gpgHome",gpghome);
+ DBWriteContactSettingString(0,MODULENAME,"gpgExec",gpgexec);
+ DBWriteContactSettingString(0,MODULENAME,"gpgHome",gpghome);
}
else {
- DBDeleteContactSetting(0, szModuleName, "gpgExec");
- DBDeleteContactSetting(0, szModuleName, "gpgHome");
+ db_unset(0, MODULENAME, "gpgExec");
+ db_unset(0, MODULENAME, "gpgHome");
}
- bSavePass = db_get_b(0,szModuleName,"gpgSaveFlag",0);
+ bSavePass = db_get_b(0,MODULENAME,"gpgSaveFlag",0);
if (bSavePass) {
- tmp = myDBGetString(0,szModuleName,"gpgSave");
+ tmp = myDBGetString(0,MODULENAME,"gpgSave");
if (tmp) {
gpg_set_passphrases(tmp);
mir_free(tmp);
@@ -343,24 +317,24 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam)
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("hook events");
#endif
- AddHookFunction(ME_CLIST_PREBUILDCONTACTMENU, onRebuildContactMenu);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onRebuildContactMenu);
- g_hCLIcon = ExtraIcon_Register(szModuleName, Translate("SecureIM status"), "sim_cm_est", onExtraImageListRebuilding, onExtraImageApplying);
+ g_hCLIcon = ExtraIcon_Register(MODULENAME, Translate("SecureIM status"), "sim_cm_est", onExtraImageListRebuilding, onExtraImageApplying);
// hook init options
- AddHookFunction(ME_OPT_INITIALISE, onRegisterOptions);
+ HookEvent(ME_OPT_INITIALISE, onRegisterOptions);
if (bPopupExists)
- AddHookFunction(ME_OPT_INITIALISE, onRegisterPopOptions);
- AddHookFunction(ME_PROTO_ACK, onProtoAck);
- AddHookFunction(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
- AddHookFunction(ME_DB_CONTACT_ADDED, onContactAdded);
- AddHookFunction(ME_DB_CONTACT_DELETED, onContactDeleted);
+ HookEvent(ME_OPT_INITIALISE, onRegisterPopOptions);
+ HookEvent(ME_PROTO_ACK, onProtoAck);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
+ HookEvent(ME_DB_CONTACT_ADDED, onContactAdded);
+ HookEvent(ME_DB_CONTACT_DELETED, onContactDeleted);
// hook message transport
- AddProtoServiceFunction(PSR_MESSAGE, onRecvMsg);
- AddProtoServiceFunction(PSS_MESSAGE, onSendMsg);
- AddProtoServiceFunction(PSS_MESSAGE"W", onSendMsgW);
- AddProtoServiceFunction(PSS_FILE, onSendFile);
+ CreateProtoServiceFunction(MODULENAME, PSR_MESSAGE, onRecvMsg);
+ CreateProtoServiceFunction(MODULENAME, PSS_MESSAGE, onSendMsg);
+ CreateProtoServiceFunction(MODULENAME, PSS_MESSAGE"W", onSendMsgW);
+ CreateProtoServiceFunction(MODULENAME, PSS_FILE, onSendFile);
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("create Native/RSA menu");
@@ -370,16 +344,16 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam)
g_hMenu[1] = AddMenuItem(sim302,110001,g_hICO[ICO_CM_DIS],MODULENAME"/SIM_DIS",CMIF_NOTOFFLINE);
if (ServiceExists(MS_CLIST_MENUBUILDSUBGROUP)) {
- g_hMenu[2] = AddMenuItem(sim312[0],110002,NULL,NULL,CMIF_ROOTPOPUP);
- g_hMenu[3] = AddSubItem(g_hMenu[2],sim232[0],110003,110002,MODULENAME"/SIM_ST_DIS");
- g_hMenu[4] = AddSubItem(g_hMenu[2],sim232[1],110004,110002,MODULENAME"/SIM_ST_ENA");
- g_hMenu[5] = AddSubItem(g_hMenu[2],sim232[2],110005,110002,MODULENAME"/SIM_ST_TRY");
+ g_hMenu[2] = AddMenuItem(sim312[0],110002,NULL,NULL,CMIF_ROOTPOPUP);
+ g_hMenu[3] = AddSubItem(g_hMenu[2],sim232[0],110003,110002,MODULENAME"/SIM_ST_DIS");
+ g_hMenu[4] = AddSubItem(g_hMenu[2],sim232[1],110004,110002,MODULENAME"/SIM_ST_ENA");
+ g_hMenu[5] = AddSubItem(g_hMenu[2],sim232[2],110005,110002,MODULENAME"/SIM_ST_TRY");
}
else {
- g_hMenu[2] = 0;
- g_hMenu[3] = AddMenuItem(sim232[0],110003,NULL,MODULENAME"/SIM_ST_DIS");
- g_hMenu[4] = AddMenuItem(sim232[1],110004,NULL,MODULENAME"/SIM_ST_ENA");
- g_hMenu[5] = AddMenuItem(sim232[2],110005,NULL,MODULENAME"/SIM_ST_TRY");
+ g_hMenu[2] = 0;
+ g_hMenu[3] = AddMenuItem(sim232[0],110003,NULL,MODULENAME"/SIM_ST_DIS");
+ g_hMenu[4] = AddMenuItem(sim232[1],110004,NULL,MODULENAME"/SIM_ST_ENA");
+ g_hMenu[5] = AddMenuItem(sim232[2],110005,NULL,MODULENAME"/SIM_ST_TRY");
}
#if defined(_DEBUG) || defined(NETLIB_LOG)
@@ -393,42 +367,38 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam)
g_hMenu[7] = AddMenuItem(sim307,110007,icon,MODULENAME"/PGP_DEL",0);
}
- if (bGPGloaded) {
+ if (bGPGloaded) {
icon=mode2icon(MODE_GPG|SECURED,2);
g_hMenu[8] = AddMenuItem(sim308,110008,icon,MODULENAME"/GPG_SET",0);
icon=mode2icon(MODE_GPG,2);
g_hMenu[9] = AddMenuItem(sim309,110009,icon,MODULENAME"/GPG_DEL",0);
- }
+ }
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("create Mode menu");
#endif
if (ServiceExists(MS_CLIST_MENUBUILDSUBGROUP)) {
- g_hMenu[10] = AddMenuItem(sim311[0],110010,NULL,NULL,CMIF_ROOTPOPUP);
- g_hMenu[11] = AddSubItem(g_hMenu[10],sim231[0],110011,110010,MODULENAME"/MODE_NAT");
- g_hMenu[12] = AddSubItem(g_hMenu[10],sim231[1],110012,110010,MODULENAME"/MODE_PGP");
- g_hMenu[13] = AddSubItem(g_hMenu[10],sim231[2],110013,110010,MODULENAME"/MODE_GPG");
- g_hMenu[14] = AddSubItem(g_hMenu[10],sim231[3],110014,110010,MODULENAME"/MODE_RSA");
+ g_hMenu[10] = AddMenuItem(sim311[0],110010,NULL,NULL,CMIF_ROOTPOPUP);
+ g_hMenu[11] = AddSubItem(g_hMenu[10],sim231[0],110011,110010,MODULENAME"/MODE_NAT");
+ g_hMenu[12] = AddSubItem(g_hMenu[10],sim231[1],110012,110010,MODULENAME"/MODE_PGP");
+ g_hMenu[13] = AddSubItem(g_hMenu[10],sim231[2],110013,110010,MODULENAME"/MODE_GPG");
+ g_hMenu[14] = AddSubItem(g_hMenu[10],sim231[3],110014,110010,MODULENAME"/MODE_RSA");
}
else {
- g_hMenu[10] = 0;
- g_hMenu[11] = AddMenuItem(sim231[0],110011,NULL,MODULENAME"/MODE_NAT");
- g_hMenu[12] = AddMenuItem(sim231[1],110012,NULL,MODULENAME"/MODE_PGP");
- g_hMenu[13] = AddMenuItem(sim231[2],110013,NULL,MODULENAME"/MODE_GPG");
- g_hMenu[14] = AddMenuItem(sim231[3],110014,NULL,MODULENAME"/MODE_RSA");
+ g_hMenu[10] = 0;
+ g_hMenu[11] = AddMenuItem(sim231[0],110011,NULL,MODULENAME"/MODE_NAT");
+ g_hMenu[12] = AddMenuItem(sim231[1],110012,NULL,MODULENAME"/MODE_PGP");
+ g_hMenu[13] = AddMenuItem(sim231[2],110013,NULL,MODULENAME"/MODE_GPG");
+ g_hMenu[14] = AddMenuItem(sim231[3],110014,NULL,MODULENAME"/MODE_RSA");
}
-
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("create srmm icons");
#endif
// add icon to srmm status icons
if (ServiceExists(MS_MSG_ADDICON)) {
-
- StatusIconData sid;
- memset(&sid,0,sizeof(sid));
- sid.cbSize = sizeof(sid);
- sid.szModule = (char*)szModuleName;
+ StatusIconData sid = { sizeof(sid) };
+ sid.szModule = (char*)MODULENAME;
sid.flags = MBF_DISABLED|MBF_HIDDEN;
// Native
sid.dwId = MODE_NATIVE;
@@ -456,8 +426,8 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam)
CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid);
// hook the window events so that we can can change the status of the icon
- AddHookFunction(ME_MSG_WINDOWEVENT, onWindowEvent);
- AddHookFunction(ME_MSG_ICONPRESSED, onIconPressed);
+ HookEvent(ME_MSG_WINDOWEVENT, onWindowEvent);
+ HookEvent(ME_MSG_ICONPRESSED, onIconPressed);
}
#if defined(_DEBUG) || defined(NETLIB_LOG)
@@ -466,26 +436,22 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam)
return 0;
}
-
int onSystemOKToExit(WPARAM wParam, LPARAM lParam)
{
- if (bSavePass) {
- LPSTR tmp = gpg_get_passphrases();
- DBWriteContactSettingString(0,szModuleName,"gpgSave",tmp);
- LocalFree(tmp);
- }
- else {
- DBDeleteContactSetting(0,szModuleName,"gpgSave");
- }
+ if (bSavePass) {
+ LPSTR tmp = gpg_get_passphrases();
+ DBWriteContactSettingString(0,MODULENAME,"gpgSave",tmp);
+ LocalFree(tmp);
+ }
+ else db_unset(0,MODULENAME,"gpgSave");
+
if (bPGPloaded) pgp_done();
if (bGPGloaded) gpg_done();
rsa_done();
- while(iHook--) UnhookEvent(g_hHook[iHook]);
- mir_free(g_hHook);
- while(iService--) DestroyServiceFunction(g_hService[iService]);
- mir_free(g_hService);
+
DestroyHookableEvent(g_hEvent[0]);
DestroyHookableEvent(g_hEvent[1]);
+
freeContactList();
free_rtfconv();
#if defined(_DEBUG) || defined(NETLIB_LOG)
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp
index f3ac91a328..719fb2fc87 100644
--- a/plugins/SecureIM/src/options.cpp
+++ b/plugins/SecureIM/src/options.cpp
@@ -9,14 +9,14 @@ BOOL hasKey(pUinKey ptr)
{
BOOL ret = 0;
if ( ptr->mode==MODE_NATIVE ) {
- LPSTR str = myDBGetString(ptr->hContact,szModuleName,"PSK");
+ LPSTR str = myDBGetString(ptr->hContact,MODULENAME,"PSK");
ret = (str!=NULL); SAFE_FREE(str);
}
else
if ( ptr->mode==MODE_RSAAES ) {
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if ( DBGetContactSetting(ptr->hContact,szModuleName,"rsa_pub",&dbv) == 0 ) {
+ if ( DBGetContactSetting(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0 ) {
ret = 1;
DBFreeVariant(&dbv);
}
@@ -304,7 +304,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR
int res = DialogBoxParam(g_hInst,MAKEINTRESOURCE(IDD_PSK),NULL,DlgProcSetPSK,(LPARAM)buffer);
if (res == IDOK) {
setListViewPSK(hLV,idx,1);
- DBWriteContactSettingString(ptr->hContact,szModuleName,"tPSK",buffer);
+ DBWriteContactSettingString(ptr->hContact,MODULENAME,"tPSK",buffer);
}
}
}
@@ -315,7 +315,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR
ptr = (pUinKey) getListViewParam(hLV,idx);
if (ptr) {
setListViewPSK(hLV,idx,0);
- DBDeleteContactSetting(ptr->hContact, szModuleName, "tPSK");
+ db_unset(ptr->hContact, MODULENAME, "tPSK");
}
}
break;
@@ -341,7 +341,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR
LPSTR buffer = (LPSTR) alloca(RSASIZE);
exp->rsa_export_pubkey(ptr->cntx,buffer);
if ( !SaveExportRSAKeyDlg(hDlg,buffer,0))
- msgbox(hDlg,sim114,szModuleName,MB_OK|MB_ICONEXCLAMATION);
+ msgbox(hDlg,sim114,MODULENAME,MB_OK|MB_ICONEXCLAMATION);
}
}
return TRUE;
@@ -360,7 +360,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR
exp->rsa_get_pubkey(ptr->cntx,(PBYTE)pub,&len);
DBCONTACTWRITESETTING cws;
- cws.szModule = szModuleName;
+ cws.szModule = MODULENAME;
cws.szSetting = "rsa_pub";
cws.value.type = DBVT_BLOB;
cws.value.pbVal = (PBYTE)pub;
@@ -370,7 +370,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR
setListViewPUB(hLV,idx,1);
}
else
- msgbox(hDlg,sim115,szModuleName,MB_OK|MB_ICONEXCLAMATION);
+ msgbox(hDlg,sim115,MODULENAME,MB_OK|MB_ICONEXCLAMATION);
}
return TRUE;
}
@@ -577,7 +577,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM
LPSTR pub = (LPSTR) alloca(RSASIZE);
exp->rsa_export_keypair(CPP_MODE_RSA,NULL,pub,NULL);
if ( !SaveExportRSAKeyDlg(hDlg,pub,0))
- msgbox(hDlg,sim114,szModuleName,MB_OK|MB_ICONEXCLAMATION);
+ msgbox(hDlg,sim114,MODULENAME,MB_OK|MB_ICONEXCLAMATION);
return TRUE;
} break;
case IDC_RSA_EXPPRIV: {
@@ -587,7 +587,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM
LPSTR priv = (LPSTR) alloca(RSASIZE);
exp->rsa_export_keypair(CPP_MODE_RSA,priv,NULL,passphrase);
if ( !SaveExportRSAKeyDlg(hDlg,priv,1))
- msgbox(hDlg,sim112,szModuleName,MB_OK|MB_ICONEXCLAMATION);
+ msgbox(hDlg,sim112,MODULENAME,MB_OK|MB_ICONEXCLAMATION);
}
return TRUE;
} break;
@@ -599,7 +599,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM
int res = DialogBoxParam(g_hInst,MAKEINTRESOURCE(IDD_PASSPHRASE),NULL,DlgProcSetPassphrase,(LPARAM)passphrase);
if ( res==IDOK ) {
if ( !exp->rsa_import_keypair(CPP_MODE_RSA,priv,passphrase)) {
- msgbox(hDlg,sim113,szModuleName,MB_OK|MB_ICONEXCLAMATION);
+ msgbox(hDlg,sim113,MODULENAME,MB_OK|MB_ICONEXCLAMATION);
}
else {
// обновить SHA1 значение
@@ -738,8 +738,8 @@ INT_PTR CALLBACK DlgProcOptionsPGP(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l
PubRingPath[0]='\0'; SecRingPath[0]='\0';
bPGPkeyrings = pgp_open_keyrings(PubRingPath,SecRingPath);
if (bPGPkeyrings && PubRingPath[0] && SecRingPath[0]) {
- DBWriteContactSettingString(0,szModuleName,"pgpPubRing",PubRingPath);
- DBWriteContactSettingString(0,szModuleName,"pgpSecRing",SecRingPath);
+ DBWriteContactSettingString(0,MODULENAME,"pgpPubRing",PubRingPath);
+ DBWriteContactSettingString(0,MODULENAME,"pgpSecRing",SecRingPath);
}
SetDlgItemText(hDlg, IDC_KEYRING_STATUS, bPGPkeyrings?Translate(sim216):Translate(sim217));
// EnableWindow(hLV, bPGPkeyrings);
@@ -759,11 +759,11 @@ INT_PTR CALLBACK DlgProcOptionsPGP(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l
if (ShowSelectKeyDlg(hDlg,KeyPath)) {
char *priv = LoadKeys(KeyPath,true);
if (priv) {
- DBWriteContactSettingString(0,szModuleName,"tpgpPrivKey",priv);
+ DBWriteContactSettingString(0,MODULENAME,"tpgpPrivKey",priv);
mir_free(priv);
}
else {
- DBDeleteContactSetting(0,szModuleName,"tpgpPrivKey");
+ db_unset(0,MODULENAME,"tpgpPrivKey");
}
}
}
@@ -890,11 +890,11 @@ INT_PTR CALLBACK DlgProcOptionsGPG(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l
if (ShowSelectKeyDlg(hDlg,KeyPath)) {
char *priv = LoadKeys(KeyPath,true);
if (priv) {
- DBWriteContactSettingString(0,szModuleName,"tpgpPrivKey",priv);
+ DBWriteContactSettingString(0,MODULENAME,"tpgpPrivKey",priv);
mir_free(priv);
}
else {
- DBDeleteContactSetting(0,szModuleName,"tpgpPrivKey");
+ db_unset(0,MODULENAME,"tpgpPrivKey");
}
}
}
@@ -1003,7 +1003,7 @@ INT_PTR CALLBACK DlgProcSetPSK(HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
case IDOK: {
int len = GetDlgItemTextA(hDlg,IDC_EDIT1,buffer,PSKSIZE);
if (len<8) {
- msgbox1(hDlg,sim211,szModuleName,MB_OK|MB_ICONEXCLAMATION);
+ msgbox1(hDlg,sim211,MODULENAME,MB_OK|MB_ICONEXCLAMATION);
return TRUE;
}
else {
@@ -1070,12 +1070,12 @@ void RefreshGeneralDlg(HWND hDlg, BOOL iInit) {
Sent_NetLog("RefreshGeneralDlg");
#endif
// Key Exchange Timeout
- data = DBGetContactSettingWord(0, szModuleName, "ket", 10);
+ data = DBGetContactSettingWord(0, MODULENAME, "ket", 10);
mir_itoa(data,timeout,10);
SetDlgItemText(hDlg,IDC_KET,timeout);
// Offline Key Timeout
- data = DBGetContactSettingWord(0, szModuleName, "okt", 2);
+ data = DBGetContactSettingWord(0, MODULENAME, "okt", 2);
mir_itoa(data,timeout,10);
SetDlgItemText(hDlg,IDC_OKT,timeout);
@@ -1214,7 +1214,7 @@ void RefreshPGPDlg(HWND hDlg, BOOL iInit) {
pUinKey ptr = getUinKey(hContact);
if (ptr && ptr->mode==MODE_PGP && isSecureProtocol(hContact) /*&& !getMetaContact(hContact)*/ && !isChatRoom(hContact)) {
- LPSTR szKeyID = myDBGetString(hContact,szModuleName,"pgp_abbr");
+ LPSTR szKeyID = myDBGetString(hContact,MODULENAME,"pgp_abbr");
lvi.iItem++;
lvi.iImage = (szKeyID!=0);
@@ -1243,27 +1243,27 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("RefreshGPGDlg");
#endif
- path = myDBGetString(0,szModuleName,"gpgExec");
+ path = myDBGetString(0,MODULENAME,"gpgExec");
if (path) {
SetDlgItemText(hDlg, IDC_GPGEXECUTABLE_EDIT, path);
mir_free(path);
}
- path = myDBGetString(0,szModuleName,"gpgHome");
+ path = myDBGetString(0,MODULENAME,"gpgHome");
if (path) {
SetDlgItemText(hDlg, IDC_GPGHOME_EDIT, path);
mir_free(path);
}
- BOOL bGPGLogFlag = db_get_b(0, szModuleName, "gpgLogFlag",0);
+ BOOL bGPGLogFlag = db_get_b(0, MODULENAME, "gpgLogFlag",0);
SendMessage(GetDlgItem(hDlg,IDC_LOGGINGON_CBOX),BM_SETCHECK,(bGPGLogFlag)?BST_CHECKED:BST_UNCHECKED,0L);
- path = myDBGetString(0,szModuleName,"gpgLog");
+ path = myDBGetString(0,MODULENAME,"gpgLog");
if (path) {
SetDlgItemText(hDlg, IDC_GPGLOGFILE_EDIT, path);
mir_free(path);
}
SendMessage(GetDlgItem(hDlg,IDC_SAVEPASS_CBOX),BM_SETCHECK,(bSavePass)?BST_CHECKED:BST_UNCHECKED,0L);
- BOOL bGPGTmpFlag = db_get_b(0, szModuleName, "gpgTmpFlag",0);
+ BOOL bGPGTmpFlag = db_get_b(0, MODULENAME, "gpgTmpFlag",0);
SendMessage(GetDlgItem(hDlg,IDC_TMPPATHON_CBOX),BM_SETCHECK,(bGPGTmpFlag)?BST_CHECKED:BST_UNCHECKED,0L);
- path = myDBGetString(0,szModuleName,"gpgTmp");
+ path = myDBGetString(0,MODULENAME,"gpgTmp");
if (path) {
SetDlgItemText(hDlg, IDC_GPGTMPPATH_EDIT, path);
mir_free(path);
@@ -1288,7 +1288,7 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit) {
ptr->tgpgMode = ptr->gpgMode;
}
- LPSTR szKeyID = myDBGetString(hContact,szModuleName,"gpg");
+ LPSTR szKeyID = myDBGetString(hContact,MODULENAME,"gpg");
lvi.iItem++;
lvi.iImage = (szKeyID!=0);
@@ -1389,15 +1389,15 @@ void ApplyGeneralSettings(HWND hDlg) {
// Key Exchange Timeout
GetDlgItemText(hDlg,IDC_KET,timeout,5);
tmp = atoi(timeout); if (tmp > 65535) tmp = 65535;
- DBWriteContactSettingWord(0,szModuleName,"ket",tmp);
- exp->rsa_set_timeout( DBGetContactSettingWord(0,szModuleName,"ket",10));
+ DBWriteContactSettingWord(0,MODULENAME,"ket",tmp);
+ exp->rsa_set_timeout( DBGetContactSettingWord(0,MODULENAME,"ket",10));
mir_itoa(tmp,timeout,10);
SetDlgItemText(hDlg,IDC_KET,timeout);
// Offline Key Timeout
GetDlgItemText(hDlg,IDC_OKT,timeout,5);
tmp = atoi(timeout); if (tmp > 65535) tmp = 65535;
- DBWriteContactSettingWord(0,szModuleName,"okt",tmp);
+ DBWriteContactSettingWord(0,MODULENAME,"okt",tmp);
mir_itoa(tmp,timeout,10);
SetDlgItemText(hDlg,IDC_OKT,timeout);
@@ -1420,14 +1420,14 @@ void ApplyGeneralSettings(HWND hDlg) {
i = SendMessage(GetDlgItem(hDlg, IDC_PGP),BM_GETCHECK,0L,0L)==BST_CHECKED;
if (i!=bPGP) {
bPGP = i; tmp++;
- db_set_b(0, szModuleName, "pgp", bPGP);
+ db_set_b(0, MODULENAME, "pgp", bPGP);
}
i = SendMessage(GetDlgItem(hDlg, IDC_GPG),BM_GETCHECK,0L,0L)==BST_CHECKED;
if (i!=bGPG) {
bGPG = i; tmp++;
- db_set_b(0, szModuleName, "gpg", bGPG);
+ db_set_b(0, MODULENAME, "gpg", bGPG);
}
- if (tmp) msgbox1(hDlg, sim224, szModuleName, MB_OK|MB_ICONINFORMATION);
+ if (tmp) msgbox1(hDlg, sim224, MODULENAME, MB_OK|MB_ICONINFORMATION);
}
HWND hLV = GetDlgItem(hDlg,IDC_STD_USERLIST);
@@ -1437,28 +1437,28 @@ void ApplyGeneralSettings(HWND hDlg) {
if ( !ptr ) continue;
if ( ptr->mode!=ptr->tmode ) {
ptr->mode = ptr->tmode;
- db_set_b(ptr->hContact, szModuleName, "mode", ptr->mode);
+ db_set_b(ptr->hContact, MODULENAME, "mode", ptr->mode);
}
if ( ptr->status!=ptr->tstatus ) {
ptr->status = ptr->tstatus;
- if (ptr->status==STATUS_ENABLED) DBDeleteContactSetting(ptr->hContact, szModuleName, "StatusID");
- else db_set_b(ptr->hContact, szModuleName, "StatusID", ptr->status);
+ if (ptr->status==STATUS_ENABLED) db_unset(ptr->hContact, MODULENAME, "StatusID");
+ else db_set_b(ptr->hContact, MODULENAME, "StatusID", ptr->status);
}
if ( ptr->mode==MODE_NATIVE ) {
if ( getListViewPSK(hLV,i)) {
- LPSTR tmp = myDBGetString(ptr->hContact,szModuleName,"tPSK");
- DBWriteContactSettingString(ptr->hContact, szModuleName, "PSK", tmp);
+ LPSTR tmp = myDBGetString(ptr->hContact,MODULENAME,"tPSK");
+ DBWriteContactSettingString(ptr->hContact, MODULENAME, "PSK", tmp);
mir_free(tmp);
}
else {
- DBDeleteContactSetting(ptr->hContact, szModuleName, "PSK");
+ db_unset(ptr->hContact, MODULENAME, "PSK");
}
- DBDeleteContactSetting(ptr->hContact, szModuleName, "tPSK");
+ db_unset(ptr->hContact, MODULENAME, "tPSK");
}
else
if ( ptr->mode==MODE_RSAAES ) {
if ( !getListViewPUB(hLV,i)) {
- DBDeleteContactSetting(ptr->hContact, szModuleName, "rsa_pub");
+ db_unset(ptr->hContact, MODULENAME, "rsa_pub");
}
}
i = ListView_GetNextItem(hLV,i,LVNI_ALL);
@@ -1483,22 +1483,22 @@ void ApplyProtoSettings(HWND hDlg) {
i = ListView_GetNextItem(hLV,i,LVNI_ALL);
}
- DBWriteContactSettingString(0,szModuleName,"protos",szNames);
+ DBWriteContactSettingString(0,MODULENAME,"protos",szNames);
}
void ApplyPGPSettings(HWND hDlg) {
bUseKeyrings = !(SendMessage(GetDlgItem(hDlg, IDC_NO_KEYRINGS),BM_GETCHECK,0L,0L)==BST_CHECKED);
- db_set_b(0,szModuleName,"ukr",bUseKeyrings);
+ db_set_b(0,MODULENAME,"ukr",bUseKeyrings);
- char *priv = myDBGetString(0,szModuleName,"tpgpPrivKey");
+ char *priv = myDBGetString(0,MODULENAME,"tpgpPrivKey");
if (priv) {
bPGPprivkey = true;
pgp_set_priv_key(priv);
- myDBWriteStringEncode(0,szModuleName,"pgpPrivKey",priv);
+ myDBWriteStringEncode(0,MODULENAME,"pgpPrivKey",priv);
mir_free(priv);
- DBDeleteContactSetting(0,szModuleName,"tpgpPrivKey");
+ db_unset(0,MODULENAME,"tpgpPrivKey");
}
}
@@ -1508,24 +1508,24 @@ void ApplyGPGSettings(HWND hDlg) {
char tmp[256];
GetDlgItemText(hDlg, IDC_GPGEXECUTABLE_EDIT, tmp, sizeof(tmp));
- DBWriteContactSettingString(0,szModuleName,"gpgExec",tmp);
+ DBWriteContactSettingString(0,MODULENAME,"gpgExec",tmp);
GetDlgItemText(hDlg, IDC_GPGHOME_EDIT, tmp, sizeof(tmp));
- DBWriteContactSettingString(0,szModuleName,"gpgHome",tmp);
+ DBWriteContactSettingString(0,MODULENAME,"gpgHome",tmp);
bSavePass = (SendMessage(GetDlgItem(hDlg, IDC_SAVEPASS_CBOX),BM_GETCHECK,0L,0L)==BST_CHECKED);
- db_set_b(0,szModuleName,"gpgSaveFlag",bSavePass);
+ db_set_b(0,MODULENAME,"gpgSaveFlag",bSavePass);
BOOL bgpgLogFlag = (SendMessage(GetDlgItem(hDlg, IDC_LOGGINGON_CBOX),BM_GETCHECK,0L,0L)==BST_CHECKED);
- db_set_b(0,szModuleName,"gpgLogFlag",bgpgLogFlag);
+ db_set_b(0,MODULENAME,"gpgLogFlag",bgpgLogFlag);
GetDlgItemText(hDlg, IDC_GPGLOGFILE_EDIT, tmp, sizeof(tmp));
- DBWriteContactSettingString(0,szModuleName,"gpgLog",tmp);
+ DBWriteContactSettingString(0,MODULENAME,"gpgLog",tmp);
if (bgpgLogFlag) gpg_set_log(tmp);
else gpg_set_log(0);
BOOL bgpgTmpFlag = (SendMessage(GetDlgItem(hDlg, IDC_TMPPATHON_CBOX),BM_GETCHECK,0L,0L)==BST_CHECKED);
- db_set_b(0,szModuleName,"gpgTmpFlag",bgpgTmpFlag);
+ db_set_b(0,MODULENAME,"gpgTmpFlag",bgpgTmpFlag);
GetDlgItemText(hDlg, IDC_GPGTMPPATH_EDIT, tmp, sizeof(tmp));
- DBWriteContactSettingString(0,szModuleName,"gpgTmp",tmp);
+ DBWriteContactSettingString(0,MODULENAME,"gpgTmp",tmp);
if (bgpgTmpFlag) gpg_set_tmp(tmp);
else gpg_set_tmp(0);
@@ -1536,8 +1536,8 @@ void ApplyGPGSettings(HWND hDlg) {
if ( !ptr ) continue;
if ( ptr->gpgMode != ptr->tgpgMode ) {
ptr->gpgMode = ptr->tgpgMode;
- if ( ptr->gpgMode ) db_set_b(ptr->hContact,szModuleName,"gpgANSI",1);
- else DBDeleteContactSetting(ptr->hContact,szModuleName,"gpgANSI");
+ if ( ptr->gpgMode ) db_set_b(ptr->hContact,MODULENAME,"gpgANSI",1);
+ else db_unset(ptr->hContact,MODULENAME,"gpgANSI");
}
i = ListView_GetNextItem(hLV,i,LVNI_ALL);
@@ -1632,7 +1632,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,szModuleName,"rsa_pub",&dbv) == 0 ) {
+ if ( DBGetContactSetting(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));
@@ -1678,8 +1678,8 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) {
return (s-d)*m;
} break;
case 0x13: {
- DBGetContactSetting(pUinKey(lParam1)->hContact,szModuleName,"pgp_abbr",&dbv1);
- DBGetContactSetting(pUinKey(lParam2)->hContact,szModuleName,"pgp_abbr",&dbv2);
+ DBGetContactSetting(pUinKey(lParam1)->hContact,MODULENAME,"pgp_abbr",&dbv1);
+ DBGetContactSetting(pUinKey(lParam2)->hContact,MODULENAME,"pgp_abbr",&dbv2);
s=(dbv1.type==DBVT_ASCIIZ);
d=(dbv2.type==DBVT_ASCIIZ);
if (s && d) {
@@ -1691,8 +1691,8 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) {
return (s-d)*m;
} break;
case 0x23: {
- DBGetContactSetting(pUinKey(lParam1)->hContact,szModuleName,"gpg",&dbv1);
- DBGetContactSetting(pUinKey(lParam2)->hContact,szModuleName,"gpg",&dbv2);
+ DBGetContactSetting(pUinKey(lParam1)->hContact,MODULENAME,"gpg",&dbv1);
+ DBGetContactSetting(pUinKey(lParam2)->hContact,MODULENAME,"gpg",&dbv2);
s=(dbv1.type==DBVT_ASCIIZ);
d=(dbv2.type==DBVT_ASCIIZ);
if (s && d) {
@@ -1709,10 +1709,10 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) {
return (s-d)*m;
} break;
case 0x05: {
- DBGetContactSetting(pUinKey(lParam1)->hContact,szModuleName,"PSK",&dbv1);
+ DBGetContactSetting(pUinKey(lParam1)->hContact,MODULENAME,"PSK",&dbv1);
s=(dbv1.type==DBVT_ASCIIZ);
DBFreeVariant(&dbv1);
- DBGetContactSetting(pUinKey(lParam2)->hContact,szModuleName,"PSK",&dbv2);
+ DBGetContactSetting(pUinKey(lParam2)->hContact,MODULENAME,"PSK",&dbv2);
d=(dbv2.type==DBVT_ASCIIZ);
DBFreeVariant(&dbv2);
return (s-d)*m;
@@ -1728,14 +1728,14 @@ void ListView_Sort(HWND hLV, LPARAM lParamSort) {
// restore sort column
sprintf(t,"os%02x",(UINT)lParamSort&0xF0);
if ((lParamSort&0x0F)==0) {
- lParamSort=(int)db_get_b(0, szModuleName, t, lParamSort+1);
+ lParamSort=(int)db_get_b(0, MODULENAME, t, lParamSort+1);
}
- db_set_b(0, szModuleName, t, (BYTE)lParamSort);
+ db_set_b(0, MODULENAME, t, (BYTE)lParamSort);
// restore sort order
sprintf(t,"os%02x",(UINT)lParamSort);
- int m=db_get_b(0, szModuleName, t, 0);
- if (bChangeSortOrder){ m=!m; db_set_b(0, szModuleName, t, m); }
+ int m=db_get_b(0, MODULENAME, t, 0);
+ if (bChangeSortOrder){ m=!m; db_set_b(0, MODULENAME, t, m); }
ListView_SortItems(hLV,&CompareFunc,lParamSort|(m<<8));
}
@@ -1882,7 +1882,7 @@ int onRegisterOptions(WPARAM wParam, LPARAM)
odp.cbSize = sizeof(odp);
odp.hInstance = g_hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSTAB);
- odp.pszTitle = (char*)szModuleName;
+ odp.pszTitle = (char*)MODULENAME;
odp.pszGroup = LPGEN("Services");
odp.pfnDlgProc = OptionsDlgProc;
Options_AddPage(wParam, &odp);
diff --git a/plugins/SecureIM/src/popupOptions.cpp b/plugins/SecureIM/src/popupOptions.cpp
index 572ed34b99..9095c3c482 100644
--- a/plugins/SecureIM/src/popupOptions.cpp
+++ b/plugins/SecureIM/src/popupOptions.cpp
@@ -21,22 +21,22 @@ INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l
switch(LOWORD(wParam)) {
case IDC_BACKKEY:
- DBWriteContactSettingDword(0, szModuleName, "colorKeyb", color);
+ DBWriteContactSettingDword(0, MODULENAME, "colorKeyb", color);
break;
case IDC_TEXTKEY:
- DBWriteContactSettingDword(0, szModuleName, "colorKeyt", color);
+ DBWriteContactSettingDword(0, MODULENAME, "colorKeyt", color);
break;
case IDC_BACKSEC:
- DBWriteContactSettingDword(0, szModuleName, "colorSecb", color);
+ DBWriteContactSettingDword(0, MODULENAME, "colorSecb", color);
break;
case IDC_TEXTSEC:
- DBWriteContactSettingDword(0, szModuleName, "colorSect", color);
+ DBWriteContactSettingDword(0, MODULENAME, "colorSect", color);
break;
case IDC_BACKSR:
- DBWriteContactSettingDword(0, szModuleName, "colorSRb", color);
+ DBWriteContactSettingDword(0, MODULENAME, "colorSRb", color);
break;
case IDC_TEXTSR:
- DBWriteContactSettingDword(0, szModuleName, "colorSRt", color);
+ DBWriteContactSettingDword(0, MODULENAME, "colorSRt", color);
break;
}
return TRUE;
@@ -52,53 +52,53 @@ INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l
break;
case IDC_EC: {
//set ec checkbox value
- db_set_b(0, szModuleName, "ec", (BYTE)(SendMessage(hec,BM_GETCHECK,0L,0L)==BST_CHECKED));
+ db_set_b(0, MODULENAME, "ec", (BYTE)(SendMessage(hec,BM_GETCHECK,0L,0L)==BST_CHECKED));
}
break;
case IDC_DC: {
//set dc checkbox value
- db_set_b(0, szModuleName, "dc", (BYTE)(SendMessage(hdc,BM_GETCHECK,0L,0L)==BST_CHECKED));
+ db_set_b(0, MODULENAME, "dc", (BYTE)(SendMessage(hdc,BM_GETCHECK,0L,0L)==BST_CHECKED));
}
break;
case IDC_SS: {
//set ss checkbox value
- db_set_b(0, szModuleName, "ss", (BYTE)(SendMessage(hss,BM_GETCHECK,0L,0L)==BST_CHECKED));
+ db_set_b(0, MODULENAME, "ss", (BYTE)(SendMessage(hss,BM_GETCHECK,0L,0L)==BST_CHECKED));
}
break;
case IDC_SR: {
//set sr checkbox value
- db_set_b(0, szModuleName, "sr", (BYTE)(SendMessage(hsr,BM_GETCHECK,0L,0L)==BST_CHECKED));
+ db_set_b(0, MODULENAME, "sr", (BYTE)(SendMessage(hsr,BM_GETCHECK,0L,0L)==BST_CHECKED));
}
break;
case IDC_KS: {
//set indicator checkbox value
- db_set_b(0, szModuleName, "ks", (BYTE)(SendMessage(hks,BM_GETCHECK,0L,0L)==BST_CHECKED));
+ db_set_b(0, MODULENAME, "ks", (BYTE)(SendMessage(hks,BM_GETCHECK,0L,0L)==BST_CHECKED));
}
break;
case IDC_KR: {
//set indicator checkbox value
- db_set_b(0, szModuleName, "kr", (BYTE)(SendMessage(hkr,BM_GETCHECK,0L,0L)==BST_CHECKED));
+ db_set_b(0, MODULENAME, "kr", (BYTE)(SendMessage(hkr,BM_GETCHECK,0L,0L)==BST_CHECKED));
}
break;
case IDC_TIMEKEY: {
//set timeout value
GetDlgItemText(hDlg,IDC_TIMEKEY,getTimeout,sizeof(getTimeout));
mir_itoa(atoi(getTimeout),getTimeout,10);
- DBWriteContactSettingString(0, szModuleName, "timeoutKey", getTimeout);
+ DBWriteContactSettingString(0, MODULENAME, "timeoutKey", getTimeout);
}
break;
case IDC_TIMESEC: {
//set timeout value
GetDlgItemText(hDlg,IDC_TIMESEC,getTimeout,sizeof(getTimeout));
mir_itoa(atoi(getTimeout),getTimeout,10);
- DBWriteContactSettingString(0, szModuleName, "timeoutSec", getTimeout);
+ DBWriteContactSettingString(0, MODULENAME, "timeoutSec", getTimeout);
}
break;
case IDC_TIMESR: {
//set timeout value
GetDlgItemText(hDlg,IDC_TIMESR,getTimeout,sizeof(getTimeout));
mir_itoa(atoi(getTimeout),getTimeout,10);
- DBWriteContactSettingString(0, szModuleName, "timeoutSR", getTimeout);
+ DBWriteContactSettingString(0, MODULENAME, "timeoutSR", getTimeout);
}
break;
} //switch
@@ -118,34 +118,34 @@ INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l
char *timeout;
//set timeout value for Key
- if (DBGetContactSetting(0, szModuleName, "timeoutKey", &dbv) == 0) timeout=dbv.pszVal;
+ if (DBGetContactSetting(0, MODULENAME, "timeoutKey", &dbv) == 0) timeout=dbv.pszVal;
else timeout="0";
SetDlgItemText(hDlg, IDC_TIMEKEY, timeout);
DBFreeVariant(&dbv);
//set timeout value for SEC
- if (DBGetContactSetting(0, szModuleName, "timeoutSec", &dbv) == 0) timeout=dbv.pszVal;
+ if (DBGetContactSetting(0, MODULENAME, "timeoutSec", &dbv) == 0) timeout=dbv.pszVal;
else timeout="0";
SetDlgItemText(hDlg, IDC_TIMESEC, timeout);
DBFreeVariant(&dbv);
//set timeout value for SR
- if (DBGetContactSetting(0, szModuleName, "timeoutSR", &dbv) == 0) timeout=dbv.pszVal;
+ if (DBGetContactSetting(0, MODULENAME, "timeoutSR", &dbv) == 0) timeout=dbv.pszVal;
else timeout="0";
SetDlgItemText(hDlg, IDC_TIMESR, timeout);
DBFreeVariant(&dbv);
//key color
- SendDlgItemMessage(hDlg,IDC_BACKKEY,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, szModuleName, "colorKeyb", RGB(230,230,255)));
- SendDlgItemMessage(hDlg,IDC_TEXTKEY,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, szModuleName, "colorKeyt", RGB(0,0,0)));
+ SendDlgItemMessage(hDlg,IDC_BACKKEY,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, MODULENAME, "colorKeyb", RGB(230,230,255)));
+ SendDlgItemMessage(hDlg,IDC_TEXTKEY,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, MODULENAME, "colorKeyt", RGB(0,0,0)));
//Session color
- SendDlgItemMessage(hDlg,IDC_BACKSEC,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, szModuleName, "colorSecb", RGB(255,255,200)));
- SendDlgItemMessage(hDlg,IDC_TEXTSEC,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, szModuleName, "colorSect", RGB(0,0,0)));
+ SendDlgItemMessage(hDlg,IDC_BACKSEC,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, MODULENAME, "colorSecb", RGB(255,255,200)));
+ SendDlgItemMessage(hDlg,IDC_TEXTSEC,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, MODULENAME, "colorSect", RGB(0,0,0)));
//SR color
- SendDlgItemMessage(hDlg,IDC_BACKSR,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, szModuleName, "colorSRb", RGB(200,255,200)));
- SendDlgItemMessage(hDlg,IDC_TEXTSR,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, szModuleName, "colorSRt", RGB(0,0,0)));
+ SendDlgItemMessage(hDlg,IDC_BACKSR,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, MODULENAME, "colorSRb", RGB(200,255,200)));
+ SendDlgItemMessage(hDlg,IDC_TEXTSR,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, MODULENAME, "colorSRt", RGB(0,0,0)));
break;
}
@@ -166,7 +166,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk
int indic;
// ec checkbox
- if (DBGetContactSetting(0, szModuleName, "ec", &dbv) == 0)
+ if (DBGetContactSetting(0, MODULENAME, "ec", &dbv) == 0)
{indic=dbv.bVal;
}
else indic=1;
@@ -175,7 +175,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk
else SendMessage(hec,BM_SETCHECK,BST_UNCHECKED,0L);
// dc checkbox
- if (DBGetContactSetting(0, szModuleName, "dc", &dbv) == 0)
+ if (DBGetContactSetting(0, MODULENAME, "dc", &dbv) == 0)
{indic=dbv.bVal;
}
else indic=1;
@@ -184,7 +184,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk
else SendMessage(hdc,BM_SETCHECK,BST_UNCHECKED,0L);
// ks checkbox
- if (DBGetContactSetting(0, szModuleName, "ks", &dbv) == 0)
+ if (DBGetContactSetting(0, MODULENAME, "ks", &dbv) == 0)
{indic=dbv.bVal;
}
else indic=1;
@@ -193,7 +193,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk
else SendMessage(hks,BM_SETCHECK,BST_UNCHECKED,0L);
// kr checkbox
- if (DBGetContactSetting(0, szModuleName, "kr", &dbv) == 0)
+ if (DBGetContactSetting(0, MODULENAME, "kr", &dbv) == 0)
{indic=dbv.bVal;
}
else indic=1;
@@ -202,7 +202,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk
else SendMessage(hkr,BM_SETCHECK,BST_UNCHECKED,0L);
//ss checkbox
- if (DBGetContactSetting(0, szModuleName, "ss", &dbv) == 0)
+ if (DBGetContactSetting(0, MODULENAME, "ss", &dbv) == 0)
{indic=dbv.bVal;
}
else indic=0;
@@ -211,7 +211,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk
else SendMessage(hss,BM_SETCHECK,BST_UNCHECKED,0L);
//sr checkbox
- if (DBGetContactSetting(0, szModuleName, "sr", &dbv) == 0)
+ if (DBGetContactSetting(0, MODULENAME, "sr", &dbv) == 0)
{indic=dbv.bVal;
}
else indic=0;
@@ -230,7 +230,7 @@ int onRegisterPopOptions(WPARAM wParam, LPARAM)
odp.cbSize = sizeof(odp);
odp.hInstance = g_hInst;
odp.pszTemplate = MAKEINTRESOURCE(IDD_POPUP);
- odp.pszTitle = (char*)szModuleName;
+ odp.pszTitle = (char*)MODULENAME;
odp.pszGroup = LPGEN("PopUps");
odp.pfnDlgProc = PopOptionsDlgProc;
Options_AddPage(wParam, &odp);
diff --git a/plugins/SecureIM/src/splitmsg.cpp b/plugins/SecureIM/src/splitmsg.cpp
index 944393025b..4cf6e5f91d 100644
--- a/plugins/SecureIM/src/splitmsg.cpp
+++ b/plugins/SecureIM/src/splitmsg.cpp
@@ -11,8 +11,8 @@ LPSTR splitMsg(LPSTR szMsg, int iLen) {
LPSTR out = (LPSTR) mir_alloc(len*2);
LPSTR buf = out;
- WORD msg_id = DBGetContactSettingWord(0, szModuleName, "msgid", 0) + 1;
- DBWriteContactSettingWord(0, szModuleName, "msgid", msg_id);
+ WORD msg_id = DBGetContactSettingWord(0, MODULENAME, "msgid", 0) + 1;
+ DBWriteContactSettingWord(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_menu.cpp b/plugins/SecureIM/src/svcs_menu.cpp
index d2b37b8155..45cd9a9eea 100644
--- a/plugins/SecureIM/src/svcs_menu.cpp
+++ b/plugins/SecureIM/src/svcs_menu.cpp
@@ -28,8 +28,8 @@ INT_PTR __cdecl Service_Status(WPARAM wParam, LPARAM lParam) {
pUinKey ptr = getUinKey((HANDLE)wParam);
if (ptr) {
ptr->status=ptr->tstatus=(BYTE)lParam;
- if (ptr->status==STATUS_ENABLED) DBDeleteContactSetting(ptr->hContact, szModuleName, "StatusID");
- else db_set_b(ptr->hContact, szModuleName, "StatusID", ptr->status);
+ if (ptr->status==STATUS_ENABLED) db_unset(ptr->hContact, MODULENAME, "StatusID");
+ else db_set_b(ptr->hContact, MODULENAME, "StatusID", ptr->status);
}
break;
}
@@ -59,9 +59,9 @@ INT_PTR __cdecl Service_StatusTry(WPARAM wParam, LPARAM lParam) {
INT_PTR __cdecl Service_PGPdelKey(WPARAM wParam, LPARAM lParam) {
if (bPGPloaded) {
- DBDeleteContactSetting((HANDLE)wParam, szModuleName, "pgp");
- DBDeleteContactSetting((HANDLE)wParam, szModuleName, "pgp_mode");
- DBDeleteContactSetting((HANDLE)wParam, szModuleName, "pgp_abbr");
+ db_unset((HANDLE)wParam, MODULENAME, "pgp");
+ db_unset((HANDLE)wParam, MODULENAME, "pgp_mode");
+ db_unset((HANDLE)wParam, MODULENAME, "pgp_abbr");
}
{
pUinKey ptr = getUinKey((HANDLE)wParam);
@@ -80,17 +80,17 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) {
char szKeyID[128]; szKeyID[0]='\0';
PVOID KeyID = pgp_select_keyid(GetForegroundWindow(),szKeyID);
if (szKeyID[0]) {
- DBDeleteContactSetting((HANDLE)wParam,szModuleName,"pgp");
+ db_unset((HANDLE)wParam,MODULENAME,"pgp");
DBCONTACTWRITESETTING cws;
memset(&cws,0,sizeof(cws));
- cws.szModule = szModuleName;
+ cws.szModule = MODULENAME;
cws.szSetting = "pgp";
cws.value.type = DBVT_BLOB;
cws.value.pbVal = (LPBYTE)KeyID;
cws.value.cpbVal = pgp_size_keyid();
CallService(MS_DB_CONTACT_WRITESETTING,wParam,(LPARAM)&cws);
- db_set_b((HANDLE)wParam,szModuleName,"pgp_mode",0);
- DBWriteContactSettingString((HANDLE)wParam,szModuleName,"pgp_abbr",szKeyID);
+ db_set_b((HANDLE)wParam,MODULENAME,"pgp_mode",0);
+ DBWriteContactSettingString((HANDLE)wParam,MODULENAME,"pgp_abbr",szKeyID);
del = false;
}
}
@@ -100,10 +100,10 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) {
if (ShowSelectKeyDlg(0,KeyPath)) {
char *publ = LoadKeys(KeyPath,false);
if (publ) {
- DBDeleteContactSetting((HANDLE)wParam,szModuleName,"pgp");
- myDBWriteStringEncode((HANDLE)wParam,szModuleName,"pgp",publ);
- db_set_b((HANDLE)wParam,szModuleName,"pgp_mode",1);
- DBWriteContactSettingString((HANDLE)wParam,szModuleName,"pgp_abbr","(binary)");
+ db_unset((HANDLE)wParam,MODULENAME,"pgp");
+ myDBWriteStringEncode((HANDLE)wParam,MODULENAME,"pgp",publ);
+ db_set_b((HANDLE)wParam,MODULENAME,"pgp_mode",1);
+ DBWriteContactSettingString((HANDLE)wParam,MODULENAME,"pgp_abbr","(binary)");
mir_free(publ);
del = false;
}
@@ -124,7 +124,7 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) {
INT_PTR __cdecl Service_GPGdelKey(WPARAM wParam, LPARAM lParam) {
if (bGPGloaded) {
- DBDeleteContactSetting((HANDLE)wParam, szModuleName, "gpg");
+ db_unset((HANDLE)wParam, MODULENAME, "gpg");
}
{
pUinKey ptr = getUinKey((HANDLE)wParam);
@@ -142,7 +142,7 @@ INT_PTR __cdecl Service_GPGsetKey(WPARAM wParam, LPARAM lParam) {
char szKeyID[128]; szKeyID[0]='\0';
gpg_select_keyid(GetForegroundWindow(),szKeyID);
if (szKeyID[0]) {
- DBWriteContactSettingString((HANDLE)wParam,szModuleName,"gpg",szKeyID);
+ DBWriteContactSettingString((HANDLE)wParam,MODULENAME,"gpg",szKeyID);
del = false;
}
}
@@ -165,7 +165,7 @@ INT_PTR __cdecl Service_Mode(WPARAM wParam, LPARAM lParam) {
case MODE_NATIVE:
case MODE_RSAAES:
if ( isContactSecured((HANDLE)wParam)&SECURED ) {
- msgbox(NULL, sim111, szModuleName, MB_OK);
+ msgbox(NULL, sim111, MODULENAME, MB_OK);
return 0;
}
if ( lParam!=MODE_NATIVE && ptr->status>STATUS_ENABLED ) {
@@ -181,7 +181,7 @@ INT_PTR __cdecl Service_Mode(WPARAM wParam, LPARAM lParam) {
ptr->keyLoaded = 0;
}
ptr->mode=(BYTE)lParam;
- db_set_b((HANDLE)wParam, szModuleName, "mode", (BYTE)lParam);
+ db_set_b((HANDLE)wParam, MODULENAME, "mode", (BYTE)lParam);
}
ShowStatusIcon((HANDLE)wParam);
break;
diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp
index 803ba30c8a..509cb9ecf6 100644
--- a/plugins/SecureIM/src/svcs_proto.cpp
+++ b/plugins/SecureIM/src/svcs_proto.cpp
@@ -188,7 +188,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) {
#endif
szEncMsg = ppre->szMessage;
if ( !ptr->cntx ) {
- ptr->cntx = cpp_create_context(((bGPGloaded && bGPGkeyrings)?CPP_MODE_GPG:CPP_MODE_PGP) | ((db_get_b(pccsd->hContact,szModuleName,"gpgANSI",0))?CPP_MODE_GPG_ANSI:0));
+ ptr->cntx = cpp_create_context(((bGPGloaded && bGPGkeyrings)?CPP_MODE_GPG:CPP_MODE_PGP) | ((db_get_b(pccsd->hContact,MODULENAME,"gpgANSI",0))?CPP_MODE_GPG_ANSI:0));
ptr->keyLoaded = 0;
}
@@ -245,7 +245,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) {
if ( ptr->mode==MODE_NATIVE ) {
ptr->mode = MODE_RSAAES;
deleteRSAcntx(ptr);
- db_set_b(ptr->hContact, szModuleName, "mode", ptr->mode);
+ db_set_b(ptr->hContact, MODULENAME, "mode", ptr->mode);
}
createRSAcntx(ptr);
loadRSAkey(ptr);
@@ -322,7 +322,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) {
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if ( DBGetContactSetting(ptr->hContact,szModuleName,"offlineKey",&dbv) == 0 ) {
+ if ( DBGetContactSetting(ptr->hContact,MODULENAME,"offlineKey",&dbv) == 0 ) {
// if valid key is succefully retrieved
ptr->offlineKey = true;
InitKeyX(ptr,dbv.pbVal);
@@ -361,7 +361,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) {
Sent_NetLog("onRecvMsg: Native SiG_DISA message");
#endif
// ptr->status=ptr->tstatus=STATUS_DISABLED;
-// db_set_b(ptr->hContact, szModuleName, "StatusID", ptr->status);
+// db_set_b(ptr->hContact, MODULENAME, "StatusID", ptr->status);
}
case SiG_DEIN: { // deinit message
// other user has disabled SecureIM with you
@@ -382,7 +382,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) {
cpp_delete_context(ptr->cntx);
ptr->cntx = 0;
ptr->keyLoaded = 0;
- db_set_b(ptr->hContact, szModuleName, "mode", ptr->mode);
+ db_set_b(ptr->hContact, MODULENAME, "mode", ptr->mode);
}
switch(ssig) {
case SiG_KEYR: { // key3 message
@@ -419,7 +419,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) {
if ( ptr->features & CPP_FEATURES_RSA ) {
// switch to RSAAES mode
ptr->mode = MODE_RSAAES;
- db_set_b(ptr->hContact, szModuleName, "mode", ptr->mode);
+ db_set_b(ptr->hContact, MODULENAME, "mode", ptr->mode);
resetRSAcntx(ptr);
loadRSAkey(ptr);
@@ -586,10 +586,10 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) {
int ssig = getSecureSig((LPCSTR)pccsd->lParam);
int stat = getContactStatus(pccsd->hContact);
-// HANDLE hMetaContact = getMetaContact(pccsd->hContact);
-// if ( hMetaContact ) {
-// ptr = getUinKey(hMetaContact);
-// }
+ // HANDLE hMetaContact = getMetaContact(pccsd->hContact);
+ // if ( hMetaContact ) {
+ // ptr = getUinKey(hMetaContact);
+ // }
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onSend: %s",(LPSTR)pccsd->lParam);
#endif
@@ -597,14 +597,14 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) {
if ( !ptr ||
ssig==SiG_GAME || ssig==SiG_PGPM || ssig==SiG_SECU || ssig==SiG_SECP ||
isChatRoom(pccsd->hContact) ||
-/* (ssig!=SiG_NONE && hMetaContact && (pccsd->wParam & PREF_METANODB)) || */
+ /* (ssig!=SiG_NONE && hMetaContact && (pccsd->wParam & PREF_METANODB)) || */
stat==-1 ||
(ssig==SiG_NONE && ptr->sendQueue) ||
(ssig==SiG_NONE && ptr->status==STATUS_DISABLED) // Disabled - pass unhandled
- ) {
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ ) {
+ return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
#if defined(_DEBUG) || defined(NETLIB_LOG)
- Sent_NetLog("onSendMsg: pass unhandled");
+ Sent_NetLog("onSendMsg: pass unhandled");
#endif
}
@@ -613,52 +613,43 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) {
//
if ( ptr->mode==MODE_PGP || ptr->mode==MODE_GPG ) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
- Sent_NetLog("onSendMsg: PGP|GPG mode");
+ Sent_NetLog("onSendMsg: PGP|GPG mode");
#endif
- // если можно зашифровать - шифруем
- if ( isContactPGP(ptr->hContact) || isContactGPG(ptr->hContact)) {
-/*
- if (stat==ID_STATUS_OFFLINE) {
- if (msgbox1(0,sim110,szModuleName,MB_YESNO|MB_ICONQUESTION)==IDNO) {
- return returnNoError(pccsd->hContact);
+ // если можно зашифровать - шифруем
+ if ( isContactPGP(ptr->hContact) || isContactGPG(ptr->hContact)) {
+ if ( !ptr->cntx ) {
+ ptr->cntx = cpp_create_context((isContactGPG(ptr->hContact)?CPP_MODE_GPG:CPP_MODE_PGP) | ((db_get_b(ptr->hContact,MODULENAME,"gpgANSI",0))?CPP_MODE_GPG_ANSI:0));
+ ptr->keyLoaded = 0;
}
- // exit and send unencrypted message
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
- }
-*/
- if ( !ptr->cntx ) {
- ptr->cntx = cpp_create_context((isContactGPG(ptr->hContact)?CPP_MODE_GPG:CPP_MODE_PGP) | ((db_get_b(ptr->hContact,szModuleName,"gpgANSI",0))?CPP_MODE_GPG_ANSI:0));
- ptr->keyLoaded = 0;
- }
- if ( !ptr->keyLoaded && bPGPloaded ) ptr->keyLoaded = LoadKeyPGP(ptr);
- if ( !ptr->keyLoaded && bGPGloaded ) ptr->keyLoaded = LoadKeyGPG(ptr);
- if ( !ptr->keyLoaded ) return returnError(pccsd->hContact,Translate(sim108));
+ if ( !ptr->keyLoaded && bPGPloaded ) ptr->keyLoaded = LoadKeyPGP(ptr);
+ if ( !ptr->keyLoaded && bGPGloaded ) ptr->keyLoaded = LoadKeyGPG(ptr);
+ if ( !ptr->keyLoaded ) return returnError(pccsd->hContact,Translate(sim108));
- LPSTR szNewMsg = NULL;
- LPSTR szUtfMsg = miranda_to_utf8((LPCSTR)pccsd->lParam,pccsd->wParam);
- if ( ptr->keyLoaded == 1 ) { // PGP
- szNewMsg = pgp_encode(ptr->cntx,szUtfMsg);
- }
- else
- if ( ptr->keyLoaded == 2 ) { // GPG
- szNewMsg = gpg_encode(ptr->cntx,szUtfMsg);
- }
- mir_free(szUtfMsg);
- if ( !szNewMsg ) {
- return returnError(pccsd->hContact,Translate(sim109));
- }
+ LPSTR szNewMsg = NULL;
+ LPSTR szUtfMsg = miranda_to_utf8((LPCSTR)pccsd->lParam,pccsd->wParam);
+ if ( ptr->keyLoaded == 1 ) { // PGP
+ szNewMsg = pgp_encode(ptr->cntx,szUtfMsg);
+ }
+ else
+ if ( ptr->keyLoaded == 2 ) { // GPG
+ szNewMsg = gpg_encode(ptr->cntx,szUtfMsg);
+ }
+ mir_free(szUtfMsg);
+ if ( !szNewMsg ) {
+ return returnError(pccsd->hContact,Translate(sim109));
+ }
- // отправляем зашифрованное сообщение
- splitMessageSend(ptr,szNewMsg);
+ // отправляем зашифрованное сообщение
+ splitMessageSend(ptr,szNewMsg);
- showPopUpSM(ptr->hContact);
+ showPopUpSM(ptr->hContact);
- return returnNoError(pccsd->hContact);
- }
- else {
- // отправляем незашифрованное
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
- }
+ return returnNoError(pccsd->hContact);
+ }
+ else {
+ // отправляем незашифрованное
+ return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ }
}
// get contact SecureIM status
@@ -673,17 +664,17 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) {
#endif
// contact is offline
if ( stat==ID_STATUS_OFFLINE ) {
- if ( ptr->cntx ) {
- if ( exp->rsa_get_state(ptr->cntx)!=0 ) {
- resetRSAcntx(ptr);
+ if ( ptr->cntx ) {
+ if ( exp->rsa_get_state(ptr->cntx)!=0 ) {
+ resetRSAcntx(ptr);
}
- }
- else {
- createRSAcntx(ptr);
- }
+ }
+ else {
+ createRSAcntx(ptr);
+ }
if ( !bSOM || (!isClientMiranda(ptr,1) && !isSecureIM(ptr,1)) || !loadRSAkey(ptr)) {
if ( ssig==SiG_NONE ) {
- // просто шлем незашифрованное в оффлайн
+ // просто шлем незашифрованное в оффлайн
return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
}
else {
@@ -705,8 +696,8 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) {
deleteRSAcntx(ptr);
}
if ( ssig==SiG_NONE ) {
- // просто шлем незашифрованное
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ // просто шлем незашифрованное
+ return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
}
// ничего не шлем дальше - это служебное сообщение
return returnNoError(pccsd->hContact);
@@ -773,7 +764,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) {
CCSDATA ccsd;
memcpy(&ccsd, (HLOCAL)lParam, sizeof(CCSDATA));
- pccsd->wParam |= PREF_METANODB;
+ pccsd->wParam |= PREF_METANODB;
ccsd.lParam = (LPARAM) SIG_DEIN;
ccsd.szProtoService = PSS_MESSAGE;
CallService(MS_PROTO_CHAINSEND, wParam, (LPARAM)&ccsd);
@@ -795,29 +786,29 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) {
}
if ( !bSOM ) {
- if ( ssig!=SiG_NONE ) {
+ if ( ssig!=SiG_NONE ) {
return returnNoError(pccsd->hContact);
- }
- // exit and send unencrypted message
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ }
+ // exit and send unencrypted message
+ return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
}
BOOL isMiranda = isClientMiranda(ptr->hContact);
if ( stid==STATUS_ALWAYSTRY && isMiranda ) { // always try && Miranda
// set key for offline user
DBVARIANT dbv; dbv.type = DBVT_BLOB;
- if ( DBGetContactSettingDword(ptr->hContact, szModuleName, "offlineKeyTimeout", 0) > gettime() &&
- DBGetContactSetting(ptr->hContact, szModuleName, "offlineKey", &dbv) == 0
- ) {
- // if valid key is succefully retrieved
- ptr->offlineKey = true;
- InitKeyX(ptr,dbv.pbVal);
- DBFreeVariant(&dbv);
+ if ( DBGetContactSettingDword(ptr->hContact, MODULENAME, "offlineKeyTimeout", 0) > gettime() &&
+ DBGetContactSetting(ptr->hContact, MODULENAME, "offlineKey", &dbv) == 0
+ ) {
+ // if valid key is succefully retrieved
+ ptr->offlineKey = true;
+ InitKeyX(ptr,dbv.pbVal);
+ DBFreeVariant(&dbv);
}
else {
- DBDeleteContactSetting(ptr->hContact,szModuleName,"offlineKey");
- DBDeleteContactSetting(ptr->hContact,szModuleName,"offlineKeyTimeout");
- if (msgbox1(0,sim106,szModuleName,MB_YESNO|MB_ICONQUESTION)==IDNO) {
+ db_unset(ptr->hContact,MODULENAME,"offlineKey");
+ db_unset(ptr->hContact,MODULENAME,"offlineKeyTimeout");
+ if (msgbox1(0,sim106,MODULENAME,MB_YESNO|MB_ICONQUESTION)==IDNO) {
return returnNoError(pccsd->hContact);
}
// exit and send unencrypted message
@@ -825,13 +816,13 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) {
}
}
else {
-/* if (stid==STATUS_ALWAYSTRY && !isMiranda || stid!=STATUS_ALWAYSTRY && isMiranda) {
- int res=msgbox1(0,"User is offline now, Do you want to send your message ?\nIt will be unencrypted !","Can't Send Encrypted Message !",MB_YESNO);
- if (res==IDNO) return 1;
+ /* if (stid==STATUS_ALWAYSTRY && !isMiranda || stid!=STATUS_ALWAYSTRY && isMiranda) {
+ int res=msgbox1(0,"User is offline now, Do you want to send your message ?\nIt will be unencrypted !","Can't Send Encrypted Message !",MB_YESNO);
+ if (res==IDNO) return 1;
}*/
- if ( ssig!=SiG_NONE ) {
- return returnNoError(pccsd->hContact);
- }
+ if ( ssig!=SiG_NONE ) {
+ return returnNoError(pccsd->hContact);
+ }
// exit and send unencrypted message
return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
}
@@ -885,83 +876,62 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onSendMsg: cryptokey exist");
#endif
-/* if ( !hMetaContact && isProtoMetaContacts(pccsd->hContact) && (db_get_b(NULL, "MetaContacts", "SubcontactHistory", 1) == 1)) {
- // add sent event to subcontact
- DBEVENTINFO dbei; HANDLE hC = getMostOnline(pccsd->hContact);
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
- dbei.szModule = GetContactProto(hC, 0);
- dbei.flags = DBEF_SENT;
- dbei.timestamp = time(NULL);
- dbei.eventType = EVENTTYPE_MESSAGE;
- if (pccsd->wParam & PREF_RTL) dbei.flags |= DBEF_RTL;
- if (pccsd->wParam & PREF_UTF) dbei.flags |= DBEF_UTF;
- dbei.cbBlob = strlen((char *)pccsd->lParam) + 1;
- if ( pccsd->wParam & PREF_UNICODE )
- dbei.cbBlob *= ( sizeof( wchar_t )+1 );
- dbei.pBlob = (PBYTE)pccsd->lParam;
-
- CallService(MS_DB_EVENT_ADD, (WPARAM)hC, (LPARAM)&dbei);
- } */
-
- LPSTR szNewMsg = encodeMsg(ptr,(LPARAM)pccsd);
+ LPSTR szNewMsg = encodeMsg(ptr,(LPARAM)pccsd);
#if defined(_DEBUG) || defined(NETLIB_LOG)
- Sent_NetLog("onSend: encrypted msg '%s'",szNewMsg);
+ Sent_NetLog("onSend: encrypted msg '%s'",szNewMsg);
#endif
- pccsd->wParam |= PREF_METANODB;
- pccsd->lParam = (LPARAM) szNewMsg;
- pccsd->szProtoService = PSS_MESSAGE;
- int ret = CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ pccsd->wParam |= PREF_METANODB;
+ pccsd->lParam = (LPARAM) szNewMsg;
+ pccsd->szProtoService = PSS_MESSAGE;
+ int ret = CallService(MS_PROTO_CHAINSEND, wParam, lParam);
- mir_free(szNewMsg);
+ mir_free(szNewMsg);
- showPopUpSM(ptr->hContact);
+ showPopUpSM(ptr->hContact);
- return ret;
+ return ret;
}
- else {
+
#if defined(_DEBUG) || defined(NETLIB_LOG)
- Sent_NetLog("onSendMsg: cryptokey not exist, try establishe connection");
+ Sent_NetLog("onSendMsg: cryptokey not exist, try establishe connection");
#endif
- // send KeyA if init || always_try || waitkey || always_if_possible
- if ( ssig==SiG_INIT || (stid==STATUS_ALWAYSTRY && isClientMiranda(ptr->hContact)) || isSecureIM(ptr->hContact) || ptr->waitForExchange ) {
- if (ssig==SiG_NONE) {
- addMsg2Queue(ptr, pccsd->wParam, (LPSTR)pccsd->lParam);
- }
- if ( !ptr->waitForExchange ) {
- // init || always_try || always_if_possible
- LPSTR keyToSend = InitKeyA(ptr,0); // calculate public and private key & fill KeyA
+ // send KeyA if init || always_try || waitkey || always_if_possible
+ if ( ssig==SiG_INIT || (stid==STATUS_ALWAYSTRY && isClientMiranda(ptr->hContact)) || isSecureIM(ptr->hContact) || ptr->waitForExchange ) {
+ if (ssig==SiG_NONE) {
+ addMsg2Queue(ptr, pccsd->wParam, (LPSTR)pccsd->lParam);
+ }
+ if ( !ptr->waitForExchange ) {
+ // init || always_try || always_if_possible
+ LPSTR keyToSend = InitKeyA(ptr,0); // calculate public and private key & fill KeyA
#if defined(_DEBUG) || defined(NETLIB_LOG)
- Sent_NetLog("Sending KEY3: %s", keyToSend);
+ Sent_NetLog("Sending KEY3: %s", keyToSend);
#endif
- pccsd->wParam &= ~PREF_UNICODE;
- pccsd->wParam |= PREF_METANODB;
- pccsd->lParam = (LPARAM) keyToSend;
- pccsd->szProtoService = PSS_MESSAGE;
- CallService(MS_PROTO_CHAINSEND, wParam, lParam);
- mir_free(keyToSend);
-
- showPopUpKS(pccsd->hContact);
- ShowStatusIconNotify(pccsd->hContact);
-
- waitForExchange(ptr); // запускаем ожидание
- }
- return returnNoError(pccsd->hContact);
- }
+ pccsd->wParam &= ~PREF_UNICODE;
+ pccsd->wParam |= PREF_METANODB;
+ pccsd->lParam = (LPARAM) keyToSend;
+ pccsd->szProtoService = PSS_MESSAGE;
+ CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ mir_free(keyToSend);
+
+ showPopUpKS(pccsd->hContact);
+ ShowStatusIconNotify(pccsd->hContact);
+
+ waitForExchange(ptr); // запускаем ожидание
+ }
+ return returnNoError(pccsd->hContact);
+ }
#if defined(_DEBUG) || defined(NETLIB_LOG)
- Sent_NetLog("onSendMsg: pass unchanged to chain");
+ Sent_NetLog("onSendMsg: pass unchanged to chain");
#endif
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
- }
+ return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
}
-
int file_idx = 0;
-INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam) {
-
+INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam)
+{
CCSDATA *pccsd=(CCSDATA*)lParam;
pUinKey ptr = getUinKey(pccsd->hContact);
@@ -976,9 +946,9 @@ INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam) {
if (strstr(file[i],".AESHELL")) continue;
- char *name = strrchr(file[i],'\\');
- if ( !name ) name = file[i];
- else name++;
+ char *name = strrchr(file[i],'\\');
+ if ( !name ) name = file[i];
+ else name++;
char *file_out = (char*) mir_alloc(TEMP_SIZE+strlen(name)+20);
sprintf(file_out,"%s\\%s.AESHELL(%d)",TEMP,name,file_idx++);
@@ -987,12 +957,10 @@ INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam) {
sprintf(buf,"%s\n%s",Translate(sim011),file[i]);
showPopUp(buf,NULL,g_hPOP[POP_PU_MSS],2);
- if ( ptr->mode==MODE_RSAAES ) {
+ if (ptr->mode == MODE_RSAAES)
exp->rsa_encrypt_file(ptr->cntx,file[i],file_out);
- }
- else {
+ else
cpp_encrypt_file(ptr->cntx,file[i],file_out);
- }
mir_free(file[i]);
file[i]=file_out;
@@ -1014,27 +982,8 @@ INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam) {
return CallService(PSS_FILE, wParam, lParam);
}
-
-/*
-typedef struct {
- size_t cbSize;
- HANDLE hContact;
- int sending; //true if sending, false if receiving
- char **files;
- int totalFiles;
- int currentFileNumber;
- unsigned long totalBytes;
- unsigned long totalProgress;
- char *workingDir;
- char *currentFile;
- unsigned long currentFileSize;
- unsigned long currentFileProgress;
- unsigned long currentFileTime; //as seconds since 1970
-} PROTOFILETRANSFERSTATUS;
-*/
-
-int __cdecl onProtoAck(WPARAM wParam,LPARAM lParam) {
-
+int __cdecl onProtoAck(WPARAM wParam,LPARAM lParam)
+{
ACKDATA *ack=(ACKDATA*)lParam;
if (ack->type!=ACKTYPE_FILE) return 0; //quit if not file transfer event
PROTOFILETRANSFERSTATUS *f = (PROTOFILETRANSFERSTATUS*) ack->lParam;
@@ -1044,21 +993,20 @@ int __cdecl onProtoAck(WPARAM wParam,LPARAM lParam) {
if ( isContactSecured(ack->hContact)&SECURED ) {
switch(ack->result) {
-// case ACKRESULT_FILERESUME:
- case ACKRESULT_DATA: {
+ case ACKRESULT_DATA:
if ( !( f->flags & PFTS_SENDING )) {
ptr->finFileRecv = (f->currentFileSize == f->currentFileProgress);
if ( !ptr->lastFileRecv ) ptr->lastFileRecv = mir_strdup(f->szCurrentFile);
}
else
- if ( f->flags & PFTS_SENDING ) {
- ptr->finFileSend = (f->currentFileSize == f->currentFileProgress);
- if ( !ptr->lastFileSend ) ptr->lastFileSend = mir_strdup(f->szCurrentFile);
- }
- } break;
-// case ACKRESULT_INITIALISING:
+ if ( f->flags & PFTS_SENDING ) {
+ ptr->finFileSend = (f->currentFileSize == f->currentFileProgress);
+ if ( !ptr->lastFileSend ) ptr->lastFileSend = mir_strdup(f->szCurrentFile);
+ }
+ break;
+
case ACKRESULT_DENIED:
- case ACKRESULT_FAILED: {
+ case ACKRESULT_FAILED:
if ( ptr->lastFileRecv ) {
if (strstr(ptr->lastFileRecv,".AESHELL")) mir_unlink(ptr->lastFileRecv);
SAFE_FREE(ptr->lastFileRecv);
@@ -1069,16 +1017,16 @@ int __cdecl onProtoAck(WPARAM wParam,LPARAM lParam) {
}
if ( ptr->fileSend ) {
char **file=ptr->fileSend;
- for(int j=0;file[j];j++) {
+ for(int j=0;file[j];j++) {
if ( strstr(file[j],".AESHELL")) mir_unlink(file[j]);
mir_free(file[j]);
}
SAFE_FREE(ptr->fileSend);
}
return 0;
- } break;
+
case ACKRESULT_NEXTFILE:
- case ACKRESULT_SUCCESS: {
+ case ACKRESULT_SUCCESS:
if ( ptr->finFileRecv && ptr->lastFileRecv ) {
if ( strstr(ptr->lastFileRecv,".AESHELL")) {
char buf[MAX_PATH];
@@ -1120,11 +1068,10 @@ int __cdecl onProtoAck(WPARAM wParam,LPARAM lParam) {
SAFE_FREE(ptr->lastFileSend);
ptr->finFileSend = false;
}
- } break;
+ break;
} // switch
}
return 0;
}
-
// EOF
diff --git a/plugins/SecureIM/src/svcs_rsa.cpp b/plugins/SecureIM/src/svcs_rsa.cpp
index 18daf53c62..ed7430b16d 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
#endif
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if ( DBGetContactSetting(ptr->hContact,szModuleName,"rsa_pub",&dbv) == 0 ) {
+ if ( DBGetContactSetting(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);
@@ -62,14 +62,14 @@ int __cdecl rsa_check_pub(HANDLE context, PBYTE pub, int pubLen, PBYTE sig, int
else {
if ( k ) mir_snprintf(msg,MSGSIZE,Translate(sim522),cnm,sha,sha_old);
else mir_snprintf(msg,MSGSIZE,Translate(sim520),cnm,sha);
- v = (msgbox(0,msg,szModuleName,MB_YESNO|MB_ICONQUESTION)==IDYES);
+ v = (msgbox(0,msg,MODULENAME,MB_YESNO|MB_ICONQUESTION)==IDYES);
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_check_pub: manual accepted %d",v);
#endif
}
if (v) {
DBCONTACTWRITESETTING cws;
- cws.szModule = szModuleName;
+ cws.szModule = MODULENAME;
cws.szSetting = "rsa_pub";
cws.value.type = DBVT_BLOB;
cws.value.pbVal = pub;
@@ -112,7 +112,7 @@ void __cdecl rsa_notify(HANDLE context, int state) {
case -8: { // сессия разорвана по причине "disabled"
msg=sim508;
// ptr->status=ptr->tstatus=STATUS_DISABLED;
-// db_set_b(ptr->hContact, szModuleName, "StatusID", ptr->status);
+// db_set_b(ptr->hContact, MODULENAME, "StatusID", ptr->status);
} break;
case -0x10: // сессия разорвана по ошибке
case -0x21:
@@ -159,7 +159,7 @@ unsigned __stdcall sttGenerateRSA( LPVOID param ) {
exp->rsa_gen_keypair(CPP_MODE_RSA_4096);
DBCONTACTWRITESETTING cws;
- cws.szModule = szModuleName;
+ cws.szModule = MODULENAME;
cws.value.type = DBVT_BLOB;
exp->rsa_get_keypair(CPP_MODE_RSA_4096,(PBYTE)&priv_key,&priv_len,(PBYTE)&pub_key,&pub_len);
@@ -185,7 +185,7 @@ BYTE loadRSAkey(pUinKey ptr) {
if ( !ptr->keyLoaded ) {
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if ( DBGetContactSetting(ptr->hContact,szModuleName,"rsa_pub",&dbv) == 0 ) {
+ if ( DBGetContactSetting(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0 ) {
ptr->keyLoaded = exp->rsa_set_pubkey(ptr->cntx,dbv.pbVal,dbv.cpbVal);
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("loadRSAkey %d", ptr->keyLoaded);
diff --git a/plugins/SecureIM/src/svcs_srmm.cpp b/plugins/SecureIM/src/svcs_srmm.cpp
index 6504a209ac..005f93f76e 100644
--- a/plugins/SecureIM/src/svcs_srmm.cpp
+++ b/plugins/SecureIM/src/svcs_srmm.cpp
@@ -17,7 +17,7 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) {
hContact = getMostOnline(hContact); // возьмем тот, через который пойдет сообщение
StatusIconClickData *sicd = (StatusIconClickData *)lParam;
- if ( strcmp(sicd->szModule, szModuleName) != 0 ||
+ if ( strcmp(sicd->szModule, MODULENAME) != 0 ||
!isSecureProtocol(hContact)) return 0; // not our event
BOOL isPGP = isContactPGP(hContact);