diff options
author | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2012-05-19 01:43:48 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2012-05-19 01:43:48 +0300 |
commit | 9026615fea720ca69d3a3480a69e32e5432db69b (patch) | |
tree | 10e18a6b7bce1427cb04dafd4a5772123c974050 | |
parent | ec0c325b00df0576ecf6f159e6ea4b6f72a13e49 (diff) |
fixed one more metacontacts problem
added option to remove own tags in outgoing messages (useful to quote)
-rwxr-xr-x | globals.h | 2 | ||||
-rwxr-xr-x | init.cpp | 3 | ||||
-rwxr-xr-x | messages.cpp | 12 | ||||
-rwxr-xr-x | metacontacts.cpp | 6 | ||||
-rwxr-xr-x | new_gpg.rc | 2 | ||||
-rwxr-xr-x | options.cpp | 2 | ||||
-rwxr-xr-x | resource.h | 4 |
7 files changed, 25 insertions, 6 deletions
@@ -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
@@ -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;
}
@@ -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);
@@ -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
|