summaryrefslogtreecommitdiff
path: root/MirOTR
diff options
context:
space:
mode:
authoradmin@progandy.co.cc <admin@progandy.co.cc@eced67a3-f377-a0ae-92ae-d6de1850b05a>2010-09-14 12:48:48 +0000
committeradmin@progandy.co.cc <admin@progandy.co.cc@eced67a3-f377-a0ae-92ae-d6de1850b05a>2010-09-14 12:48:48 +0000
commitfa7c6913dd96ba0282af7b5be85213bb1ce32efa (patch)
treeb5939b0541292ac6e62a0004fe38f71fffd16ddd /MirOTR
parent376594ac1d65cbb31165f5a74775d624c3fd2981 (diff)
- Added HTMLConv-setting to options ans SRMM-Menu
- modified buildpaths git-svn-id: http://mirotr.googlecode.com/svn/trunk@13 eced67a3-f377-a0ae-92ae-d6de1850b05a
Diffstat (limited to 'MirOTR')
-rw-r--r--MirOTR/MirOTR.vcproj6
-rw-r--r--MirOTR/dllmain.cpp9
-rw-r--r--MirOTR/language.h2
-rw-r--r--MirOTR/mirotrmenu.cpp19
-rw-r--r--MirOTR/options.cpp72
-rw-r--r--MirOTR/options.h10
-rw-r--r--MirOTR/stdafx.h5
-rw-r--r--MirOTR/svcs_menu.cpp16
-rw-r--r--MirOTR/svcs_menu.h8
-rw-r--r--MirOTR/version.h6
10 files changed, 113 insertions, 40 deletions
diff --git a/MirOTR/MirOTR.vcproj b/MirOTR/MirOTR.vcproj
index a03fe12..686ec3e 100644
--- a/MirOTR/MirOTR.vcproj
+++ b/MirOTR/MirOTR.vcproj
@@ -65,7 +65,7 @@
Name="VCLinkerTool"
AdditionalDependencies="libgcrypt.lib libotr.lib Comctl32.lib"
LinkIncremental="2"
- AdditionalLibraryDirectories="..\gpg.vs\bin.vs\libgcrypt\debug\static;..\otr.vs\bin.vs\libotr\debug\static;&quot;..\ekhtml\vc9\$(PlatformName)\debug&quot;"
+ AdditionalLibraryDirectories="&quot;$(SolutionDir)\gpg.vs\bin.vs\libgcrypt\$(PlatformName)\debug\static&quot;;&quot;$(SolutionDir)\otr.vs\bin.vs\libotr\$(PlatformName)\debug\static&quot;;&quot;$(SolutionDir)\ekhtml\vc9\$(PlatformName)\debug&quot;"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
@@ -144,7 +144,7 @@
Name="VCLinkerTool"
AdditionalDependencies="libgcrypt.lib libotr.lib Comctl32.lib EkHtml.lib"
LinkIncremental="1"
- AdditionalLibraryDirectories="..\gpg.vs\bin.vs\libgcrypt\release\static;..\otr.vs\bin.vs\libotr\release\static;&quot;..\ekhtml\vc9\$(PlatformName)\release&quot;"
+ AdditionalLibraryDirectories="&quot;$(SolutionDir)\gpg.vs\bin.vs\libgcrypt\$(PlatformName)\release\static&quot;;&quot;$(SolutionDir)\otr.vs\bin.vs\libotr\$(PlatformName)\release\static&quot;;&quot;$(SolutionDir)\ekhtml\vc9\$(PlatformName)\release&quot;"
GenerateDebugInformation="false"
SubSystem="2"
OptimizeReferences="2"
@@ -226,7 +226,7 @@
AdditionalDependencies="libgcrypt.lib libotr.lib Comctl32.lib"
OutputFile="$(OutDir)\$(ProjectName)A.dll"
LinkIncremental="1"
- AdditionalLibraryDirectories="..\gpg.vs\bin.vs\libgcrypt\release\static;..\otr.vs\bin.vs\libotr\release\static;&quot;..\ekhtml\vc9\$(PlatformName)\release&quot;"
+ AdditionalLibraryDirectories="&quot;$(SolutionDir)\gpg.vs\bin.vs\libgcrypt\$(PlatformName)\release\static&quot;;&quot;$(SolutionDir)\otr.vs\bin.vs\libotr\$(PlatformName)\release\static&quot;;&quot;$(SolutionDir)\ekhtml\vc9\$(PlatformName)\release&quot;"
GenerateDebugInformation="false"
SubSystem="2"
OptimizeReferences="2"
diff --git a/MirOTR/dllmain.cpp b/MirOTR/dllmain.cpp
index aa02340..c237d73 100644
--- a/MirOTR/dllmain.cpp
+++ b/MirOTR/dllmain.cpp
@@ -112,6 +112,9 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
SaveOptions();
MessageBox(0, TranslateT(LANG_OTR_SECUREIM_TEXT), TranslateT(LANG_OTR_SECUREIM_TITLE), 0x30);
}
+ if (!options.bHaveSRMMIcons) {
+ MessageBox(0, _T("OTR Info"), _T("Your SRMM plugin does not support status icons. Not all OTR-functions are available!"), 0x30);
+ }
// HookEvent(ME_OPT_INITIALISE, OptInit);
@@ -179,11 +182,7 @@ DLLFUNC int Load(PLUGINLINK *link)
CreateProtoServiceFunction(MODULENAME, PSS_MESSAGE, SVC_OTRSendMessage);
CreateProtoServiceFunction(MODULENAME, PSS_MESSAGE"W", SVC_OTRSendMessageW);
CreateProtoServiceFunction(MODULENAME, PSR_MESSAGE, SVC_OTRRecvMessage);
-
- 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/language.h b/MirOTR/language.h
index 23eb811..499661b 100644
--- a/MirOTR/language.h
+++ b/MirOTR/language.h
@@ -18,6 +18,7 @@
#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_MENU_TOGGLEHTML LPGEN("&Convert HTML (for Pidgin)")
#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'")
@@ -69,6 +70,7 @@
#define LANG_VERIFIED LPGEN("Verified")
#define LANG_ACTIVE LPGEN("Active")
#define LANG_FINGERPRINT LPGEN("Fingerprint")
+#define LANG_HTMLCONV LPGEN("Conv. HTML")
#define LANG_POLICY_DEFAULT LPGEN("Default")
#define LANG_POLICY_ALWAYS LPGEN("Always")
diff --git a/MirOTR/mirotrmenu.cpp b/MirOTR/mirotrmenu.cpp
index 65d512d..61425fc 100644
--- a/MirOTR/mirotrmenu.cpp
+++ b/MirOTR/mirotrmenu.cpp
@@ -2,7 +2,7 @@
#include "m_genmenu.h"
#include "mirotrmenu.h"
static HANDLE hMirOTRMenuObject;
-static HGENMENU hStatusInfoItem;
+static HGENMENU hStatusInfoItem, hHTMLConvMenuItem;
HWND hDummyPaintWin;
//contactmenu exec param(ownerdata)
@@ -56,7 +56,7 @@ static INT_PTR BuildMirOTRMenu(WPARAM wParam, LPARAM)
ListParam param = { 0 };
param.MenuObjectHandle = hMirOTRMenuObject;
- param.wParam = (WPARAM)otr_context_get_trust(otrl_context_find_miranda(otr_user_state, hContact));
+ param.wParam = (WPARAM)hContact;
HMENU hMenu = CreatePopupMenu();
CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)&param);
@@ -90,7 +90,8 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam,LPARAM)
if ( cmep == NULL ) //this is root...build it
return TRUE;
- TrustLevel level = ( TrustLevel )pcpp->wParam;
+ HANDLE hContact = (HANDLE)pcpp->wParam;
+ TrustLevel level = ( TrustLevel )otr_context_get_trust(otrl_context_find_miranda(otr_user_state, hContact));
mi.cbSize = sizeof(mi);
if ( CallService(MO_GETMENUITEM, ( WPARAM )pcpp->MenuItemHandle, ( LPARAM )&mi ) == 0 ) {
@@ -121,6 +122,12 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam,LPARAM)
mi.ptszName = TranslateT(LANG_STATUS_DISABLED);
}
CallService(MO_MODIFYMENUITEM, (WPARAM)hStatusInfoItem, (LPARAM)&mi);
+ } else if (pcpp->MenuItemHandle == hHTMLConvMenuItem) {
+ if (db_byte_get(hContact, MODULENAME, "HTMLConv", 0) )
+ mi.flags |= CMIM_FLAGS|CMIF_CHECKED;
+ else
+ mi.flags = CMIM_FLAGS|(mi.flags &~CMIF_CHECKED);
+ CallService(MO_MODIFYMENUITEM, (WPARAM)hHTMLConvMenuItem, (LPARAM)&mi);
}
}
return TRUE;
@@ -263,6 +270,12 @@ void InitMirOTRMenu(void)
mi.icolibItem = GetIconHandle(ICON_PRIVATE);
AddMirOTRMenuItem(0, (LPARAM) &mi);
+ mi.flags = CMIF_TCHAR|CMIF_CHECKED;
+ mi.ptszName = _T(LANG_MENU_TOGGLEHTML);
+ mi.position = 300001;
+ mi.pszService = MS_OTR_MENUTOGGLEHTML;
+ hHTMLConvMenuItem = (HGENMENU) AddMirOTRMenuItem(0, (LPARAM) &mi);
+
}
diff --git a/MirOTR/options.cpp b/MirOTR/options.cpp
index af0875d..3cc2d07 100644
--- a/MirOTR/options.cpp
+++ b/MirOTR/options.cpp
@@ -551,13 +551,18 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
lvc.iSubItem = 1;
lvc.pszText = TranslateT(LANG_PROTO);
- lvc.cx = 150; // width of column in pixels
+ lvc.cx = 100; // width of column in pixels
ListView_InsertColumn(lv, 1, &lvc);
lvc.iSubItem = 2;
lvc.pszText = TranslateT(LANG_POLICY);
- lvc.cx = 100; // width of column in pixels
+ lvc.cx = 90; // width of column in pixels
ListView_InsertColumn(lv, 2, &lvc);
+
+ lvc.iSubItem = 3;
+ lvc.pszText = TranslateT(LANG_HTMLCONV);
+ lvc.cx = 80; // width of column in pixels
+ ListView_InsertColumn(lv, 3, &lvc);
}
SendMessage(hwndDlg, WMU_REFRESHLIST, 0, 0);
@@ -595,6 +600,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
mir_free(proto_t);
ListView_SetItemText(lv, lvI.iItem, 2, (TCHAR*)policy_to_string((OtrlPolicy)db_dword_get(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY)) );
+ ListView_SetItemText(lv, lvI.iItem, 3, (db_byte_get(hContact, MODULENAME, "HTMLConv", 0))?TranslateT(LANG_YES):TranslateT(LANG_NO) );
}
@@ -628,7 +634,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS), &lvi);
ContactPolicyMap* cpm = (ContactPolicyMap*) GetWindowLongPtr(hwndDlg, GWL_USERDATA);
hContact = (HANDLE)lvi.lParam;
- (*cpm)[hContact] = policy;
+ (*cpm)[hContact].policy = policy;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}break;
}
@@ -637,20 +643,9 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
break;
case WM_NOTIFY:
- if (((LPNMHDR) lParam)->code == (UINT) LVN_ITEMCHANGED && ((LPNMHDR) lParam)->hwndFrom == GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS)
- && (((LPNMLISTVIEW)lParam)->uNewState & LVIS_SELECTED )) {
- int sel = ListView_GetSelectionMark(((LPNMHDR) lParam)->hwndFrom);
- if (sel == -1) {
- SendMessage(GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY), CB_SETCURSEL, (LPARAM)-1, 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY), FALSE);
- } else {
- EnableWindow(GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY), TRUE);
- TCHAR buff[50];
- ListView_GetItemText(((LPNMHDR)lParam)->hwndFrom, sel, 2, buff, 50);
- SendMessage(GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY), CB_SELECTSTRING, (LPARAM)-1, (WPARAM)buff);
- }
-
- } else if (((LPNMHDR)lParam)->code == (UINT) PSN_APPLY ) {
+ {
+ UINT code = ((LPNMHDR) lParam)->code;
+ if (code == (UINT) PSN_APPLY ) {
// handle apply
ContactPolicyMap *cpm = (ContactPolicyMap*) GetWindowLongPtr(hwndDlg, GWL_USERDATA);
@@ -659,11 +654,50 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
for(ContactPolicyMap::const_iterator it = cpm->begin(); it != cpm->end(); ++it)
{
if (!it->first) continue;
- DBWriteContactSettingDword(it->first, MODULENAME, "Policy", (DWORD)it->second);
+ if (it->second.policy) DBWriteContactSettingDword(it->first, MODULENAME, "Policy", (DWORD)it->second.policy);
+ if (it->second.htmlconv) db_byte_set(it->first, MODULENAME, "HTMLConv", it->second.htmlconv-1);
}
return TRUE;
+ } else if (((LPNMHDR) lParam)->hwndFrom == GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS)) {
+ if (code == (UINT) LVN_ITEMCHANGED && (((LPNMLISTVIEW)lParam)->uNewState & LVIS_SELECTED )) {
+ int sel = ListView_GetSelectionMark(((LPNMHDR) lParam)->hwndFrom);
+ if (sel == -1) {
+ SendMessage(GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY), CB_SETCURSEL, (LPARAM)-1, 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY), FALSE);
+ } else {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY), TRUE);
+ TCHAR buff[50];
+ ListView_GetItemText(((LPNMHDR)lParam)->hwndFrom, sel, 2, buff, 50);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY), CB_SELECTSTRING, (LPARAM)-1, (WPARAM)buff);
+ }
+ } else if (code == (UINT) NM_CLICK) {
+ if (((LPNMLISTVIEW)lParam)->iSubItem == 3) {
+ LVITEM lvi;
+ lvi.mask = LVIF_PARAM;
+ lvi.iItem = ((LPNMLISTVIEW)lParam)->iItem;
+ if (lvi.iItem < 0) return FALSE;
+ lvi.iSubItem = 0;
+ SendDlgItemMessage(hwndDlg, IDC_LV_CONT_CONTACTS, LVM_GETITEM, 0, (LPARAM)&lvi);
+
+ HANDLE hContact = (HANDLE)lvi.lParam;
+ ContactPolicyMap *cp = (ContactPolicyMap *)GetWindowLong(hwndDlg, GWL_USERDATA);
+ TCHAR buff[50];
+ ListView_GetItemText(((LPNMHDR)lParam)->hwndFrom, lvi.iItem, 3, buff, 50);
+ if (_tcsncmp(buff, TranslateT(LANG_YES), 50)==0){
+ (*cp)[hContact].htmlconv = HTMLCONV_DISABLE;
+ ListView_SetItemText(((LPNMHDR)lParam)->hwndFrom, lvi.iItem, 3, TranslateT(LANG_NO));
+ }else {
+ (*cp)[hContact].htmlconv = HTMLCONV_ENABLE;
+ ListView_SetItemText(((LPNMHDR)lParam)->hwndFrom, lvi.iItem, 3, TranslateT(LANG_YES));
+ }
+ (*cp)[hContact].htmlconv += 1;
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+
+
+ }
}
- break;
+ }break;
case WM_DESTROY:
ContactPolicyMap *cpm = (ContactPolicyMap*) GetWindowLongPtr(hwndDlg, GWL_USERDATA);
cpm->clear();
diff --git a/MirOTR/options.h b/MirOTR/options.h
index 2fdbd49..7a2ecec 100644
--- a/MirOTR/options.h
+++ b/MirOTR/options.h
@@ -44,7 +44,15 @@ extern Options options;
#define CONTACT_DEFAULT_POLICY 0xFFFF
#include <map>
-typedef std::map<HANDLE, OtrlPolicy> ContactPolicyMap;
+enum HTMLConvSetting {
+ HTMLCONV_DISABLE,
+ HTMLCONV_ENABLE
+};
+struct CONTACT_DATA {
+ OtrlPolicy policy;
+ int htmlconv;
+};
+typedef std::map<HANDLE, CONTACT_DATA> ContactPolicyMap;
typedef enum {FPM_VERIFY, FPM_NOTRUST, FPM_DELETE } FPModify;
typedef std::map<Fingerprint*, FPModify> FPModifyMap;
diff --git a/MirOTR/stdafx.h b/MirOTR/stdafx.h
index 4768108..dbf05ce 100644
--- a/MirOTR/stdafx.h
+++ b/MirOTR/stdafx.h
@@ -78,11 +78,6 @@ static const MUUID MIID_OTR = { 0x30f37d6, 0xdd32, 0x434d, { 0xbc, 0x64, 0x5b, 0
#define MODULENAME "MirOTR"
-#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 47900f2..6eaa3d6 100644
--- a/MirOTR/svcs_menu.cpp
+++ b/MirOTR/svcs_menu.cpp
@@ -109,7 +109,23 @@ int SVC_VerifyOTR(WPARAM wParam, LPARAM lParam) {
return 0;
}
+int SVC_ToggleHTMLOTR(WPARAM wParam, LPARAM lParam) {
+ HANDLE hContact = (HANDLE)wParam;
+ if (db_byte_get(hContact, MODULENAME, "HTMLConv", 0))
+ db_byte_set(hContact, MODULENAME, "HTMLConv", 0);
+ else
+ db_byte_set(hContact, MODULENAME, "HTMLConv", 1);
+
+ return 0;
+}
+
void InitMenu() {
+ CreateServiceFunction(MS_OTR_MENUSTART, SVC_StartOTR);
+ CreateServiceFunction(MS_OTR_MENUSTOP, SVC_StopOTR);
+ CreateServiceFunction(MS_OTR_MENUREFRESH, SVC_RefreshOTR);
+ CreateServiceFunction(MS_OTR_MENUVERIFY, SVC_VerifyOTR);
+ CreateServiceFunction(MS_OTR_MENUTOGGLEHTML, SVC_ToggleHTMLOTR);
+
CLISTMENUITEM mi = {0};
mi.cbSize = sizeof(mi);
mi.flags = CMIF_NOTOFFLINE | CMIF_TCHAR | CMIF_ICONFROMICOLIB;
diff --git a/MirOTR/svcs_menu.h b/MirOTR/svcs_menu.h
index ceb2af5..c6f3223 100644
--- a/MirOTR/svcs_menu.h
+++ b/MirOTR/svcs_menu.h
@@ -5,4 +5,10 @@ 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
+void DeinitMenu();
+
+#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 MS_OTR_MENUTOGGLEHTML MODULENAME"/ToggleHTML" \ No newline at end of file
diff --git a/MirOTR/version.h b/MirOTR/version.h
index 936cae7..7a8b1ec 100644
--- a/MirOTR/version.h
+++ b/MirOTR/version.h
@@ -4,11 +4,11 @@
/* VERSION DEFINITIONS */
#define VER_MAJOR 0
#define VER_MINOR 10
-#define VER_RELEASE 0
-#define VER_BUILD 5
+#define VER_RELEASE 1
+#define VER_BUILD 2
#define __STRINGIZE(x) #x
-#define VER_STRING "0.10.0.5"
+#define VER_STRING "0.10.1.2"
#ifdef _UNICODE
#define SHORT_NAME_STRING "Miranda OTR"