summaryrefslogtreecommitdiff
path: root/MirOTR
diff options
context:
space:
mode:
authoradmin@progandy.co.cc <admin@progandy.co.cc@eced67a3-f377-a0ae-92ae-d6de1850b05a>2010-09-06 13:57:42 +0000
committeradmin@progandy.co.cc <admin@progandy.co.cc@eced67a3-f377-a0ae-92ae-d6de1850b05a>2010-09-06 13:57:42 +0000
commit3ab5329069479c9951ee1bf8ac26af73df500045 (patch)
treea6627c54f2997050b87eb8aa5d18148976b42220 /MirOTR
parent11e5e8749eb7d4d3cfebfa49bbb7ea4624608647 (diff)
- new OTR-menu in messagewindow
git-svn-id: http://mirotr.googlecode.com/svn/trunk@3 eced67a3-f377-a0ae-92ae-d6de1850b05a
Diffstat (limited to 'MirOTR')
-rw-r--r--MirOTR/MirOTR.vcproj16
-rw-r--r--MirOTR/dialogs.h1
-rw-r--r--MirOTR/dllmain.cpp2
-rw-r--r--MirOTR/icons.cpp3
-rw-r--r--MirOTR/icons.h3
-rw-r--r--MirOTR/language.h5
-rw-r--r--MirOTR/stdafx.h2
-rw-r--r--MirOTR/svcs_menu.cpp8
-rw-r--r--MirOTR/svcs_menu.h1
-rw-r--r--MirOTR/svcs_srmm.cpp20
10 files changed, 54 insertions, 7 deletions
diff --git a/MirOTR/MirOTR.vcproj b/MirOTR/MirOTR.vcproj
index 4b46162..905d4b3 100644
--- a/MirOTR/MirOTR.vcproj
+++ b/MirOTR/MirOTR.vcproj
@@ -344,6 +344,18 @@
>
</File>
<File
+ RelativePath=".\mirotrmenu.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath=".\options.cpp"
>
</File>
@@ -422,6 +434,10 @@
>
</File>
<File
+ RelativePath=".\mirotrmenu.h"
+ >
+ </File>
+ <File
RelativePath=".\options.h"
>
</File>
diff --git a/MirOTR/dialogs.h b/MirOTR/dialogs.h
index 528622f..0dfd955 100644
--- a/MirOTR/dialogs.h
+++ b/MirOTR/dialogs.h
@@ -1,2 +1,3 @@
+#pragma once
void VerifyContextDialog(ConnContext* context);
INT_PTR CALLBACK DlgProcVerifyContext(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); \ No newline at end of file
diff --git a/MirOTR/dllmain.cpp b/MirOTR/dllmain.cpp
index 38f6bac..1f3c131 100644
--- a/MirOTR/dllmain.cpp
+++ b/MirOTR/dllmain.cpp
@@ -172,6 +172,8 @@ DLLFUNC int Load(PLUGINLINK *link)
CreateServiceFunction(MS_OTR_MENUSTART, SVC_StartOTR);
CreateServiceFunction(MS_OTR_MENUSTOP, SVC_StopOTR);
+ CreateServiceFunction(MS_OTR_MENUREFRESH, SVC_RefreshOTR);
+ CreateServiceFunction(MS_OTR_MENUVERIFY, SVC_VerifyOTR);
// hook modules loaded for updater support
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
diff --git a/MirOTR/icons.cpp b/MirOTR/icons.cpp
index 7b26df9..363705b 100644
--- a/MirOTR/icons.cpp
+++ b/MirOTR/icons.cpp
@@ -57,3 +57,6 @@ HANDLE GetIconHandle(const char* name) {
void ReleaseIcon(const char* name, int big) {
CallService( big ? MS_SKIN2_RELEASEICONBIG : MS_SKIN2_RELEASEICON, 0, (LPARAM)name );
}
+void ReleaseIcon(HICON handle, int big) {
+ CallService( big ? MS_SKIN2_RELEASEICONBIG : MS_SKIN2_RELEASEICON, (WPARAM)handle, 0 );
+}
diff --git a/MirOTR/icons.h b/MirOTR/icons.h
index 86605d4..0983cc1 100644
--- a/MirOTR/icons.h
+++ b/MirOTR/icons.h
@@ -9,4 +9,5 @@ void InitIcons();
void DeinitIcons();
HICON LoadIcon(const char* name, int big);
HANDLE GetIconHandle(const char* name);
-void ReleaseIcon(const char* name, int big); \ No newline at end of file
+void ReleaseIcon(const char* name, int big);
+void ReleaseIcon(HICON handle, int big); \ No newline at end of file
diff --git a/MirOTR/language.h b/MirOTR/language.h
index 41f4525..941f1fc 100644
--- a/MirOTR/language.h
+++ b/MirOTR/language.h
@@ -14,6 +14,11 @@
#define LANG_STATUS_PRIVATE LPGEN("OTR Encryption: Private")
#define LANG_STATUS_FINISHED LPGEN("OTR Encryption: Finished")
+#define LANG_MENU_START LPGEN("&Start OTR session")
+#define LANG_MENU_REFRESH LPGEN("&Refresh OTR session")
+#define LANG_MENU_STOP LPGEN("Sto&p OTR session")
+#define LANG_MENU_VERIFY LPGEN("&Verify Fingerprint")
+
#define LANG_SESSION_TERMINATED_OTR LPGEN("OTR encrypted session with '%s' has been terminated")
#define LANG_SESSION_REQUEST_OTR LPGEN("Requesting OTR encrypted session with '%s'")
#define LANG_SESSION_START_OTR LPGEN("Beginning OTR encrypted session with '%s'")
diff --git a/MirOTR/stdafx.h b/MirOTR/stdafx.h
index ebb3f07..4768108 100644
--- a/MirOTR/stdafx.h
+++ b/MirOTR/stdafx.h
@@ -80,6 +80,8 @@ static const MUUID MIID_OTR = { 0x30f37d6, 0xdd32, 0x434d, { 0xbc, 0x64, 0x5b, 0
#define MS_OTR_MENUSTART MODULENAME"/Start"
#define MS_OTR_MENUSTOP MODULENAME"/Stop"
+#define MS_OTR_MENUREFRESH MODULENAME"/Refresh"
+#define MS_OTR_MENUVERIFY MODULENAME"/Verify"
#define PREF_BYPASS_OTR 0x8000
#define PREF_NO_HISTORY 0x10000
diff --git a/MirOTR/svcs_menu.cpp b/MirOTR/svcs_menu.cpp
index 5a2944c..da1104a 100644
--- a/MirOTR/svcs_menu.cpp
+++ b/MirOTR/svcs_menu.cpp
@@ -86,6 +86,14 @@ int SVC_StopOTR(WPARAM wParam, LPARAM lParam) {
return 0;
}
+int SVC_VerifyOTR(WPARAM wParam, LPARAM lParam) {
+ HANDLE hContact = (HANDLE)wParam;
+ ConnContext *context = otrl_context_find_miranda(otr_user_state, (HANDLE)wParam);
+ if (!context) return 1;
+ VerifyContextDialog(context);
+ return 0;
+}
+
void InitMenu() {
CLISTMENUITEM mi = {0};
mi.cbSize = sizeof(mi);
diff --git a/MirOTR/svcs_menu.h b/MirOTR/svcs_menu.h
index 43e6d03..ceb2af5 100644
--- a/MirOTR/svcs_menu.h
+++ b/MirOTR/svcs_menu.h
@@ -2,6 +2,7 @@
int SVC_StartOTR(WPARAM wParam, LPARAM lParam);
int SVC_RefreshOTR(WPARAM wParam, LPARAM lParam);
int SVC_StopOTR(WPARAM wParam, LPARAM lParam);
+int SVC_VerifyOTR(WPARAM wParam, LPARAM lParam);
int SVC_PrebuildContactMenu(WPARAM wParam, LPARAM lParam);
void InitMenu();
void DeinitMenu(); \ No newline at end of file
diff --git a/MirOTR/svcs_srmm.cpp b/MirOTR/svcs_srmm.cpp
index e562725..98bc770 100644
--- a/MirOTR/svcs_srmm.cpp
+++ b/MirOTR/svcs_srmm.cpp
@@ -1,4 +1,5 @@
#include "stdafx.h"
+#include "mirotrmenu.h"
HANDLE hEventIconPressed;
HICON hIconNotSecure, hIconFinished, hIconPrivate, hIconUnverified;
@@ -38,6 +39,8 @@ int SVC_IconPressed(WPARAM wParam, LPARAM lParam) {
char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if(proto && DBGetContactSettingByte(hContact, proto, "ChatRoom", 0))
return 0;
+ ShowOTRMenu(hContact, sicd->clickLocation);
+ /*
HMENU hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT));
CallService(MS_LANGPACK_TRANSLATEMENU, (WPARAM)hMenu, 0);
TrustLevel level = (TrustLevel) db_dword_get(hContact, MODULENAME, "TrustLevel", TRUST_NOT_PRIVATE);
@@ -125,6 +128,7 @@ int SVC_IconPressed(WPARAM wParam, LPARAM lParam) {
DeleteObject(bmpIconFinished);
DeleteObject(bmpIconNotSecure);
DeleteObject(bmpIconUnverified);
+ */
}
return 0;
@@ -212,13 +216,17 @@ void InitSRMM() {
// hook the window events so that we can can change the status of the icon
hEventIconPressed = HookEvent(ME_MSG_ICONPRESSED, SVC_IconPressed);
+ InitMirOTRMenu();
}
}
void DeinitSRMM() {
- UnhookEvent(hEventIconPressed);
- ReleaseIcon(ICON_NOT_PRIVATE, 0);
- ReleaseIcon(ICON_FINISHED, 0);
- ReleaseIcon(ICON_PRIVATE, 0);
- ReleaseIcon(ICON_UNVERIFIED, 0);
- hIconNotSecure = hIconFinished = hIconPrivate = hIconUnverified =0;
+ if(options.bHaveSRMMIcons) {
+ UnhookEvent(hEventIconPressed);
+ ReleaseIcon(ICON_NOT_PRIVATE, 0);
+ ReleaseIcon(ICON_FINISHED, 0);
+ ReleaseIcon(ICON_PRIVATE, 0);
+ ReleaseIcon(ICON_UNVERIFIED, 0);
+ hIconNotSecure = hIconFinished = hIconPrivate = hIconUnverified =0;
+ UninitMirOTRMenu();
+ }
} \ No newline at end of file