summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2007-04-25 16:59:34 +0000
committersje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2007-04-25 16:59:34 +0000
commit55a944b86166c4b863cd1a17c39b160e03e1a3f5 (patch)
tree09af3d2b142d15577c0215af605770937a8ff818
parent71540bc23a4ea911424372ce3bd721a0380da0b4 (diff)
fix options
apply html conversion on outgoing messages even if bbcode conversion not applied git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@151 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r--nohtml/filter.cpp39
-rw-r--r--nohtml/options.cpp13
-rw-r--r--nohtml/version.h2
3 files changed, 33 insertions, 21 deletions
diff --git a/nohtml/filter.cpp b/nohtml/filter.cpp
index 11229cd..5d60445 100644
--- a/nohtml/filter.cpp
+++ b/nohtml/filter.cpp
@@ -8,26 +8,33 @@ int FilterSendMessage(WPARAM wParam, LPARAM lParam) {
char *old_message = (char *)ccs->lParam;
char *buf = 0;
- if(options.html) {
- if(ccs->wParam & PREF_UNICODE) {
- wchar_t *messagew = (wchar_t *)&old_message[strlen(old_message)+1];
- wchar_t* smsg=strip_carrots(messagew);
- wchar_t* html_msg=bbcodes_to_html(smsg);
+ if(ccs->wParam & PREF_UNICODE) {
+ wchar_t *messagew = (wchar_t *)&old_message[strlen(old_message)+1];
+ wchar_t* smsg=strip_carrots(messagew);
+ wchar_t* html_msg;
+ if(options.html) {
+ html_msg=bbcodes_to_html(smsg);
delete[] smsg;
+ } else
+ html_msg = smsg;
- buf=(char *)malloc(wcslen(html_msg)*3+3);
- WideCharToMultiByte( CP_ACP, 0,html_msg, -1,buf,wcslen(html_msg)+1, NULL, NULL);
- memcpy(&buf[strlen(buf)+1],html_msg,lstrlen(buf)*2+2);
- delete[] html_msg;
- } else {
- char* smsg=strip_carrots(old_message);
- char* html_msg=bbcodes_to_html(smsg);
+ buf=(char *)malloc(wcslen(html_msg)*3+3);
+ WideCharToMultiByte( CP_ACP, 0,html_msg, -1,buf,wcslen(html_msg)+1, NULL, NULL);
+ memcpy(&buf[strlen(buf)+1],html_msg,lstrlen(buf)*2+2);
+ delete[] html_msg;
+ } else {
+ char* smsg=strip_carrots(old_message);
+ char* html_msg;
+ if(options.html) {
+ html_msg=bbcodes_to_html(smsg);
delete[] smsg;
- buf = strdup(html_msg);
- delete[] html_msg;
- }
- ccs->lParam = (LPARAM)buf;
+ } else
+ html_msg = smsg;
+
+ buf = strdup(html_msg);
+ delete[] html_msg;
}
+ ccs->lParam = (LPARAM)buf;
int ret = CallService(MS_PROTO_CHAINSEND, wParam, lParam);
ccs->lParam = (LPARAM)old_message;
diff --git a/nohtml/options.cpp b/nohtml/options.cpp
index 927260b..c27afb3 100644
--- a/nohtml/options.cpp
+++ b/nohtml/options.cpp
@@ -5,13 +5,13 @@
Options options;
void LoadOptions() {
- DBWriteContactSettingDword(0, MODULE, "BBCodes", options.bbcodes ? 1 : 0);
- DBWriteContactSettingDword(0, MODULE, "HTML", options.html ? 1 : 0);
+ options.bbcodes = (DBGetContactSettingDword(0, MODULE, "BBCodes", 0) != 0);
+ options.html = (DBGetContactSettingDword(0, MODULE, "HTML", 0) != 0);
}
void SaveOptions() {
- options.bbcodes = (DBGetContactSettingDword(0, MODULE, "BBCodes", 0) != 0);
- options.html = (DBGetContactSettingDword(0, MODULE, "HTML", 0) != 0);
+ DBWriteContactSettingDword(0, MODULE, "BBCodes", options.bbcodes ? 1 : 0);
+ DBWriteContactSettingDword(0, MODULE, "HTML", options.html ? 1 : 0);
}
BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
@@ -20,8 +20,13 @@ BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
switch ( msg ) {
case WM_INITDIALOG:
TranslateDialogDefault( hwndDlg );
+ CheckDlgButton(hwndDlg, IDC_CHK_BBCODES, options.bbcodes);
+ CheckDlgButton(hwndDlg, IDC_CHK_HTML, options.html);
return FALSE;
case WM_COMMAND:
+ if(HIWORD(wParam) == BN_CLICKED) {
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
break;
case WM_NOTIFY:
switch(((LPNMHDR)lParam)->idFrom) {
diff --git a/nohtml/version.h b/nohtml/version.h
index 494e474..b8bc27c 100644
--- a/nohtml/version.h
+++ b/nohtml/version.h
@@ -5,7 +5,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 0
#define __RELEASE_NUM 0
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM