summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradmin@progandy.co.cc <admin@progandy.co.cc@eced67a3-f377-a0ae-92ae-d6de1850b05a>2010-09-12 15:31:41 +0000
committeradmin@progandy.co.cc <admin@progandy.co.cc@eced67a3-f377-a0ae-92ae-d6de1850b05a>2010-09-12 15:31:41 +0000
commit9832446d4b9476acfb3b5fc63d3b8f3d54f398b8 (patch)
tree8fee3226060337fbb216e6bafccb34f03129bbc4
parentbed8c75c86c6002eec23af0332912224f452558c (diff)
- moved options from Plugins to Services
- [ issue 8 ] added some code for compatibility with SecureIM git-svn-id: http://mirotr.googlecode.com/svn/trunk@10 eced67a3-f377-a0ae-92ae-d6de1850b05a
-rw-r--r--MirOTR/dllmain.cpp7
-rw-r--r--MirOTR/language.h6
-rw-r--r--MirOTR/options.cpp3
-rw-r--r--MirOTR/options.h4
-rw-r--r--MirOTR/otr.cpp4
-rw-r--r--MirOTR/svcs_menu.cpp14
6 files changed, 34 insertions, 4 deletions
diff --git a/MirOTR/dllmain.cpp b/MirOTR/dllmain.cpp
index 2982789..0db4cb7 100644
--- a/MirOTR/dllmain.cpp
+++ b/MirOTR/dllmain.cpp
@@ -105,6 +105,13 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
InitSRMM();
hEventWindow = HookEvent(ME_MSG_WINDOWEVENT, WindowEvent);
+
+ if (options.bHaveSecureIM && !db_byte_get(0, MODULENAME, "sim_warned", 0)) {
+ db_byte_set(0, MODULENAME, "sim_warned", 1);
+ options.default_policy = OTRL_POLICY_MANUAL_MOD;
+ SaveOptions();
+ MessageBox(0, TranslateT(LANG_OTR_SECUREIM_TITLE), TranslateT(LANG_OTR_SECUREIM_TEXT), 0x30);
+ }
// HookEvent(ME_OPT_INITIALISE, OptInit);
diff --git a/MirOTR/language.h b/MirOTR/language.h
index 952a41f..23eb811 100644
--- a/MirOTR/language.h
+++ b/MirOTR/language.h
@@ -113,4 +113,8 @@
#define LANG_OTR_SMPPASSWORD_RESPOND_DESC LPGEN("Your contact '%s' wants to verify your identity with a secret password you should know.")
#define LANG_FINGERPRINT_STILL_IN_USE LPGEN("Fingerprint '%s' still in use in conversation with '%s' (%s). You cannot delete it!")
-#define LANG_FINGERPRINT_NOT_DELETED LPGEN("Fingerprint '%s' in use in conversation with '%s' (%s). It could not be deleted!") \ No newline at end of file
+#define LANG_FINGERPRINT_NOT_DELETED LPGEN("Fingerprint '%s' in use in conversation with '%s' (%s). It could not be deleted!")
+
+#define LANG_OTR_SECUREIM_STARTED LPGEN("Cannot start OTR for '%s'. SecureIM is already running")
+#define LANG_OTR_SECUREIM_TITLE LPGEN("OTR: SecureIM installed")
+#define LANG_OTR_SECUREIM_TEXT LPGEN("You are using SecureIM. MirOTR will only work for contacts with SecureIM disabled") \ No newline at end of file
diff --git a/MirOTR/options.cpp b/MirOTR/options.cpp
index 8672071..175edb5 100644
--- a/MirOTR/options.cpp
+++ b/MirOTR/options.cpp
@@ -99,6 +99,7 @@ void LoadOptions() {
options.bHaveMetaContacts = 0!=ServiceExists(MS_MC_GETMETACONTACT);
options.bHavePopups = 0!=ServiceExists(MS_POPUP_ADDPOPUPT) && ServiceExists(MS_POPUP_SHOWMESSAGE);
options.bHaveSRMMIcons = 0!=ServiceExists(MS_MSG_MODIFYICON);
+ options.bHaveSecureIM = 0!=ServiceExists("SecureIM/IsContactSecured");
LoadFilenames();
}
@@ -110,7 +111,7 @@ extern "C" INT_PTR OpenOptions(WPARAM wParam, LPARAM lParam)
odp.cbSize = sizeof(odp);
odp.position = 100;
odp.hInstance = hInst;
- odp.ptszGroup = LPGENT("Plugins");
+ odp.ptszGroup = LPGENT("Services"); //"Plugins"
odp.ptszTitle = _T(MODULENAME);
odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
diff --git a/MirOTR/options.h b/MirOTR/options.h
index 94149d1..2fdbd49 100644
--- a/MirOTR/options.h
+++ b/MirOTR/options.h
@@ -33,7 +33,7 @@ typedef struct {
bool end_offline, end_window_close;
// temporary options
- bool bHaveMetaContacts, bHavePopups, bHaveSRMMIcons;
+ bool bHaveMetaContacts, bHavePopups, bHaveSRMMIcons, bHaveSecureIM;
} Options;
@@ -51,7 +51,7 @@ typedef std::map<Fingerprint*, FPModify> FPModifyMap;
int OptInit(WPARAM wParam, LPARAM lParam);
void LoadOptions();
-void SaveOptions(ContactPolicyMap *contact_policies);
+void SaveOptions();
extern "C" INT_PTR OpenOptions(WPARAM wParam, LPARAM lParam);
void InitOptions();
void DeinitOptions();
diff --git a/MirOTR/otr.cpp b/MirOTR/otr.cpp
index eb6728c..485e0f7 100644
--- a/MirOTR/otr.cpp
+++ b/MirOTR/otr.cpp
@@ -81,6 +81,10 @@ extern "C" {
DWORD pol;
if(hContact) {
pol = DBGetContactSettingDword(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY);
+ if (options.bHaveSecureIM && pol != OTRL_POLICY_MANUAL_MOD && pol != OTRL_POLICY_NEVER && db_byte_get(hContact, "SecureIM" , "StatusID", 0)) {
+ db_dword_set(hContact, MODULENAME, "Policy", OTRL_POLICY_MANUAL_MOD);
+ return OTRL_POLICY_MANUAL_MOD;
+ }
if(pol != CONTACT_DEFAULT_POLICY) return pol ;
}
if(context->protocol) {
diff --git a/MirOTR/svcs_menu.cpp b/MirOTR/svcs_menu.cpp
index 3f99834..47900f2 100644
--- a/MirOTR/svcs_menu.cpp
+++ b/MirOTR/svcs_menu.cpp
@@ -28,6 +28,13 @@ int SVC_StartOTR(WPARAM wParam, LPARAM lParam) {
if(options.bHaveMetaContacts && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) {
hContact = hSub;
}
+
+ if ( options.bHaveSecureIM && CallService("SecureIM/IsContactSecured", (WPARAM)hContact, 0) != 0 ) {
+ TCHAR msg[512];
+ mir_sntprintf(msg, 512, TranslateT(LANG_OTR_SECUREIM_STARTED), contact_get_nameT(hContact));
+ ShowError(msg);
+ return 0;
+ }
TCHAR buff[512];
mir_sntprintf(buff, 512, TranslateT(LANG_SESSION_REQUEST_OTR), contact_get_nameT(hContact));
@@ -43,6 +50,13 @@ int SVC_RefreshOTR(WPARAM wParam, LPARAM lParam) {
if(options.bHaveMetaContacts && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) {
hContact = hSub;
}
+
+ if ( options.bHaveSecureIM && CallService("SecureIM/IsContactSecured", (WPARAM)hContact, 0) != 0 ) {
+ TCHAR msg[512];
+ mir_sntprintf(msg, 512, TranslateT(LANG_OTR_SECUREIM_STARTED), contact_get_nameT(hContact));
+ ShowError(msg);
+ return 0;
+ }
TCHAR buff[512];
mir_sntprintf(buff, 512, TranslateT(LANG_SESSION_TRY_CONTINUE_OTR), contact_get_nameT(hContact));