summaryrefslogtreecommitdiff
path: root/plugins/MirOTR
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-04-27 07:36:58 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-04-27 07:36:58 +0000
commit1319f3775c793bdfb8299f5757e7c198d7a61339 (patch)
treee132a96411aedeb5b86cdea901b15ff8028f00f5 /plugins/MirOTR
parentfd511dcd6739e2994445833ac8f03f01a2c5df95 (diff)
ConnectionNotify common project
git-svn-id: http://svn.miranda-ng.org/main/trunk@13191 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR')
-rw-r--r--plugins/MirOTR/src/dialogs.cpp4
-rw-r--r--plugins/MirOTR/src/options.cpp48
-rw-r--r--plugins/MirOTR/src/options.h6
-rw-r--r--plugins/MirOTR/src/otr.cpp8
-rw-r--r--plugins/MirOTR/src/utils.cpp2
5 files changed, 34 insertions, 34 deletions
diff --git a/plugins/MirOTR/src/dialogs.cpp b/plugins/MirOTR/src/dialogs.cpp
index 6dd74a5390..c43a2b1d55 100644
--- a/plugins/MirOTR/src/dialogs.cpp
+++ b/plugins/MirOTR/src/dialogs.cpp
@@ -745,7 +745,7 @@ unsigned int CALLBACK verify_context_thread(void *param)
case IDYES:
lib_cs_lock();
otrl_context_set_trust(context->active_fingerprint, "verified");
- otrl_privkey_write_fingerprints(otr_user_state, g_fingerprint_store_filename);
+ otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename));
lib_cs_unlock();
mir_sntprintf(msg, SIZEOF(msg), TranslateT(LANG_FINGERPRINT_VERIFIED), contact_get_nameT(hContact));
ShowMessage(hContact, msg);
@@ -754,7 +754,7 @@ unsigned int CALLBACK verify_context_thread(void *param)
case IDNO:
lib_cs_lock();
otrl_context_set_trust(context->active_fingerprint, NULL);
- otrl_privkey_write_fingerprints(otr_user_state, g_fingerprint_store_filename);
+ otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename));
lib_cs_unlock();
mir_sntprintf(msg, SIZEOF(msg), TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact));
ShowMessage(hContact, msg);
diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp
index ca7e95b44c..07dadafd6b 100644
--- a/plugins/MirOTR/src/options.cpp
+++ b/plugins/MirOTR/src/options.cpp
@@ -3,42 +3,42 @@ extern "C"{
#include "otrlextensions.h"
}
-char g_private_key_filename[MAX_PATH];
-char g_fingerprint_store_filename[MAX_PATH];
-char g_instag_filename[MAX_PATH];
+TCHAR g_private_key_filename[MAX_PATH];
+TCHAR g_fingerprint_store_filename[MAX_PATH];
+TCHAR g_instag_filename[MAX_PATH];
HANDLE hPATH_MIROTR;
Options options;
-#define DATA_DIRECTORY MIRANDA_USERDATA "\\" MODULENAME
+#define DATA_DIRECTORY MIRANDA_USERDATAT _T("\\") _T(MODULENAME)
struct PROTOREGENKEYOPTIONS {
HWND refresh;
TCHAR proto[129];
};
-void SetFilenames(const char *path)
+void SetFilenames(const TCHAR *path)
{
if (!path || !path[0])
return;
- CreateDirectoryTree(path);
+ CreateDirectoryTreeT(path);
- strcpy(g_private_key_filename, path);
- strcat(g_private_key_filename, ("\\"));
- strcat(g_private_key_filename, PRIVATE_KEY_FILENAME);
+ mir_tstrcpy(g_private_key_filename, path);
+ mir_tstrcat(g_private_key_filename, _T("\\"));
+ mir_tstrcat(g_private_key_filename, _T(PRIVATE_KEY_FILENAME));
- strcpy(g_fingerprint_store_filename, path);
- strcat(g_fingerprint_store_filename, ("\\"));
- strcat(g_fingerprint_store_filename, FINGERPRINT_STORE_FILENAME);
+ mir_tstrcpy(g_fingerprint_store_filename, path);
+ mir_tstrcat(g_fingerprint_store_filename, _T("\\"));
+ mir_tstrcat(g_fingerprint_store_filename, _T(FINGERPRINT_STORE_FILENAME));
- strcpy(g_instag_filename, path);
- strcat(g_instag_filename, ("\\"));
- strcat(g_instag_filename, INSTAG_FILENAME);
+ mir_tstrcpy(g_instag_filename, path);
+ mir_tstrcat(g_instag_filename, _T("\\"));
+ mir_tstrcat(g_instag_filename, _T(INSTAG_FILENAME));
}
int FoldersChanged(WPARAM wParam, LPARAM lParam)
{
- char path[MAX_PATH];
- if ( FoldersGetCustomPath(hPATH_MIROTR, path, SIZEOF(path), ""))
- SetFilenames( VARS(DATA_DIRECTORY));
+ TCHAR path[MAX_PATH];
+ if ( FoldersGetCustomPathT(hPATH_MIROTR, path, SIZEOF(path), _T("")))
+ SetFilenames( VARST(DATA_DIRECTORY));
else
SetFilenames(path);
@@ -48,14 +48,14 @@ int FoldersChanged(WPARAM wParam, LPARAM lParam)
void LoadFilenames()
{
- if (hPATH_MIROTR = FoldersRegisterCustomPath("OTR", LPGEN("Private Data"), DATA_DIRECTORY)) {
+ if (hPATH_MIROTR = FoldersRegisterCustomPathT("OTR", LPGEN("Private Data"), DATA_DIRECTORY)) {
HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersChanged);
// get the path - above are only defaults - there may be a different value in the db
FoldersChanged(0, 0);
}
else {
- SetFilenames( VARS(DATA_DIRECTORY));
+ SetFilenames( VARST(DATA_DIRECTORY));
ReadPrivkeyFiles();
}
}
@@ -130,9 +130,9 @@ void ReadPrivkeyFiles()
{
DEBUGOUT_T("READ privkey");
lib_cs_lock();
- otrl_privkey_read(otr_user_state, g_private_key_filename);
- otrl_privkey_read_fingerprints(otr_user_state, g_fingerprint_store_filename, set_context_contact, 0);
- otrl_instag_read(otr_user_state, g_instag_filename);
+ otrl_privkey_read(otr_user_state, _T2A(g_private_key_filename));
+ otrl_privkey_read_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename), set_context_contact, 0);
+ otrl_instag_read(otr_user_state, _T2A(g_instag_filename));
lib_cs_unlock();
}
@@ -374,7 +374,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP
OtrlPrivKey *key = otrl_privkey_find(otr_user_state, proto, proto);
if (key) {
otrl_privkey_forget(key);
- otrl_privkey_write(otr_user_state, g_private_key_filename);
+ otrl_privkey_write(otr_user_state, _T2A(g_private_key_filename));
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 2, _T(""));
}
}
diff --git a/plugins/MirOTR/src/options.h b/plugins/MirOTR/src/options.h
index b291297596..d7f46344ea 100644
--- a/plugins/MirOTR/src/options.h
+++ b/plugins/MirOTR/src/options.h
@@ -5,9 +5,9 @@
#define FINGERPRINT_STORE_FILENAME "otr.fingerprints"
#define INSTAG_FILENAME "otr.instag"
-extern char g_fingerprint_store_filename[MAX_PATH];
-extern char g_private_key_filename[MAX_PATH];
-extern char g_instag_filename[MAX_PATH];
+extern TCHAR g_fingerprint_store_filename[MAX_PATH];
+extern TCHAR g_private_key_filename[MAX_PATH];
+extern TCHAR g_instag_filename[MAX_PATH];
#define CONTACT_DEFAULT_POLICY 0xFFFF
diff --git a/plugins/MirOTR/src/otr.cpp b/plugins/MirOTR/src/otr.cpp
index 0c988da819..d4f560573a 100644
--- a/plugins/MirOTR/src/otr.cpp
+++ b/plugins/MirOTR/src/otr.cpp
@@ -40,7 +40,7 @@ static unsigned int CALLBACK generate_key_thread(void* param)
Thread_Push(0);
GenKeyData *data = (GenKeyData *)param;
//lib_cs_lock();
- otrl_privkey_generate(otr_user_state, g_private_key_filename, data->proto, data->proto);
+ otrl_privkey_generate(otr_user_state, _T2A(g_private_key_filename), data->proto, data->proto);
//lib_cs_unlock();
PostMessage(data->dialog, WMU_ENDDIALOG, 0, 0);
mir_free(data);
@@ -165,14 +165,14 @@ extern "C" {
//CloseHandle((HANDLE)_beginthreadex(0, 0, trust_fp_thread, (void *)fp, 0, 0));
otrl_context_set_trust(fp, NULL);
- otrl_privkey_write_fingerprints(otr_user_state, g_fingerprint_store_filename);
+ otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename));
}
/* The list of known fingerprints has changed. Write them to disk. */
void otr_gui_write_fingerprints(void *opdata) {
DEBUGOUT_T("OTR_GUI_WRITE_FINGERPRINTS\n");
//if(MessageBox(0, Translate("Would you like to save the current fingerprint list?"), Translate(MODULE), MB_YESNO) == IDYES)
- otrl_privkey_write_fingerprints(otr_user_state, g_fingerprint_store_filename);
+ otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename));
}
/* A ConnContext has entered a secure state. */
@@ -389,7 +389,7 @@ extern "C" {
void otr_create_instag(void *opdata, const char *accountname, const char *protocol){
DEBUGOUT_T("OTR_CREATE_INSTAG\n");
- FILE* instagf = fopen(g_instag_filename, "w+b");
+ FILE* instagf = _tfopen(g_instag_filename, _T("w+b"));
if(!instagf)
return;
otrl_instag_generate_FILEp(otr_user_state, instagf, accountname, protocol);
diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp
index 2261b089a8..2b84202d52 100644
--- a/plugins/MirOTR/src/utils.cpp
+++ b/plugins/MirOTR/src/utils.cpp
@@ -75,7 +75,7 @@ TrustLevel otr_context_get_trust(ConnContext *context)
void VerifyFingerprint(ConnContext *context, bool verify) {
lib_cs_lock();
otrl_context_set_trust(context->active_fingerprint, (verify)?"verified":NULL);
- otrl_privkey_write_fingerprints(otr_user_state, g_fingerprint_store_filename);
+ otrl_privkey_write_fingerprints(otr_user_state, _T2A(g_fingerprint_store_filename));
lib_cs_unlock();
VerifyFingerprintMessage(context, verify);
}