summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2012-05-19 01:43:48 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2012-05-19 01:43:48 +0300
commit9026615fea720ca69d3a3480a69e32e5432db69b (patch)
tree10e18a6b7bce1427cb04dafd4a5772123c974050
parentec0c325b00df0576ecf6f159e6ea4b6f72a13e49 (diff)
fixed one more metacontacts problem
added option to remove own tags in outgoing messages (useful to quote)
-rwxr-xr-xglobals.h2
-rwxr-xr-xinit.cpp3
-rwxr-xr-xmessages.cpp12
-rwxr-xr-xmetacontacts.cpp6
-rwxr-xr-xnew_gpg.rc2
-rwxr-xr-xoptions.cpp2
-rwxr-xr-xresource.h4
7 files changed, 25 insertions, 6 deletions
diff --git a/globals.h b/globals.h
index e62ab24..1d7c9e4 100755
--- a/globals.h
+++ b/globals.h
@@ -16,7 +16,7 @@
#ifndef GLOBALS_H
#define GLOBALS_H
-extern bool bAppendTags, gpg_valid, gpg_keyexist;
+extern bool bAppendTags, bStripTags, gpg_valid, gpg_keyexist;
extern TCHAR *inopentag, *inclosetag, *outopentag, *outclosetag;
extern logtofile debuglog;
#endif
diff --git a/init.cpp b/init.cpp
index 0d2fb4b..5c1f11d 100755
--- a/init.cpp
+++ b/init.cpp
@@ -17,7 +17,7 @@
#include "commonheaders.h"
//global variables
-bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bIsMiranda09 = false, bMetaContacts = false, bFileTransfers = false, bAutoExchange = false;
+bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bIsMiranda09 = false, bMetaContacts = false, bFileTransfers = false, bAutoExchange = false, bStripTags = false;
TCHAR *inopentag = NULL, *inclosetag = NULL, *outopentag = NULL, *outclosetag = NULL, *password = NULL;
list <JabberAccount*> Accounts;
@@ -85,6 +85,7 @@ int SendKey(WPARAM w, LPARAM l);
void init_vars()
{
bAppendTags = DBGetContactSettingByte(NULL, szGPGModuleName, "bAppendTags", 0);
+ bStripTags = DBGetContactSettingByte(NULL, szGPGModuleName, "bStripTags", 0);
inopentag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInOpenTag", _T("<GPGdec>"));
inclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInCloseTag", _T("</GPGdec>"));
outopentag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutOpenTag", _T("<GPGenc>"));
diff --git a/messages.cpp b/messages.cpp
index 74d0c44..6e69a2a 100755
--- a/messages.cpp
+++ b/messages.cpp
@@ -627,6 +627,18 @@ int SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags)
str.append(tmp);
mir_free(tmp);
}
+ if(bStripTags && bAppendTags)
+ {
+ std::wstring::size_type p;
+ for(p = str.find(inopentag); p != std::wstring::npos; p = str.find(inopentag))
+ str.erase(p, _tcslen(inopentag));
+ for(p = str.find(inclosetag); p != std::wstring::npos; p = str.find(inclosetag))
+ str.erase(p, _tcslen(inclosetag));
+ for(p = str.find(outopentag); p != std::wstring::npos; p = str.find(outopentag))
+ str.erase(p, _tcslen(outopentag));
+ for(p = str.find(outclosetag); p != std::wstring::npos; p = str.find(outclosetag))
+ str.erase(p, _tcslen(outclosetag));
+ }
/* for(std::wstring::size_type i = str.find(_T("\r\n")); i != std::wstring::npos; i = str.find(_T("\r\n"), i+1))
str.replace(i, 2, _T("\n")); */
string out;
diff --git a/metacontacts.cpp b/metacontacts.cpp
index 6e96ebe..1abc2aa 100755
--- a/metacontacts.cpp
+++ b/metacontacts.cpp
@@ -44,7 +44,7 @@ HANDLE metaGetContact(HANDLE hContact)
if(bMetaContacts)
if(metaIsSubcontact(hContact))
return (HANDLE)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0);
- return hContact;
+ return NULL;
}
bool metaIsSubcontact(HANDLE hContact)
{
@@ -60,7 +60,7 @@ HANDLE metaGetMostOnline(HANDLE hContact)
if(bMetaContacts)
if(metaIsProtoMetaContacts(hContact))
return (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hContact,0);
- return hContact;
+ return NULL;
}
HANDLE metaGetDefault(HANDLE hContact)
{
@@ -68,7 +68,7 @@ HANDLE metaGetDefault(HANDLE hContact)
if(bMetaContacts)
if(metaIsProtoMetaContacts(hContact))
return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)hContact,0);
- return hContact;
+ return NULL;
}
diff --git a/new_gpg.rc b/new_gpg.rc
index e2705d7..6ebf7ad 100755
--- a/new_gpg.rc
+++ b/new_gpg.rc
@@ -356,6 +356,8 @@ BEGIN
EDITTEXT IDC_OUT_CLOSE_TAG,151,46,90,14,ES_AUTOHSCROLL
RTEXT "Open:",IDC_STATIC,13,49,26,8
RTEXT "Close:",IDC_STATIC,127,49,23,8
+ CONTROL "Strip all tags in outgoing messages",IDC_STRIP_TAGS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,3,76,233,10
END
diff --git a/options.cpp b/options.cpp
index 45f56d5..8efc0c2 100755
--- a/options.cpp
+++ b/options.cpp
@@ -599,6 +599,7 @@ static BOOL CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
TranslateDialogDefault(hwndDlg);
CheckStateLoadDB(hwndDlg, IDC_APPEND_TAGS, "bAppendTags", 0);
+ CheckStateLoadDB(hwndDlg, IDC_STRIP_TAGS, "bStripTags", 0);
{
TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInOpenTag", _T("<GPGdec>"));
SetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp);
@@ -639,6 +640,7 @@ static BOOL CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case PSN_APPLY:
{
bAppendTags = CheckStateStoreDB(hwndDlg, IDC_APPEND_TAGS, "bAppendTags");
+ bStripTags = CheckStateStoreDB(hwndDlg, IDC_STRIP_TAGS, "bStripTags");
{
TCHAR tmp[128];
GetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp, 128);
diff --git a/resource.h b/resource.h
index b7900a0..332e2d3 100755
--- a/resource.h
+++ b/resource.h
@@ -74,6 +74,8 @@
#define IDC_AUT_EXCHANGE 1065
#define IDC_BUTTON3 1066
#define IDC_COPY_KEY 1066
+#define IDC_CHECK1 1067
+#define IDC_STRIP_TAGS 1067
// Next default values for new objects
//
@@ -81,7 +83,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 114
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1067
+#define _APS_NEXT_CONTROL_VALUE 1068
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif