[Ttssh2-commit] [6666] OSC 52 でのクリップボードアクセス時に通知を出せるようにした

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2017年 4月 3日 (月) 21:51:49 JST


Revision: 6666
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6666
Author:   doda
Date:     2017-04-03 21:51:49 +0900 (Mon, 03 Apr 2017)
Log Message:
-----------
OSC 52 でのクリップボードアクセス時に通知を出せるようにした

Modified Paths:
--------------
    trunk/doc/en/html/about/history.html
    trunk/doc/ja/html/about/history.html
    trunk/installer/release/TERATERM.INI
    trunk/teraterm/common/tttypes.h
    trunk/teraterm/teraterm/vtterm.c
    trunk/teraterm/ttpset/ttset.c

-------------- next part --------------
Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2017-04-03 12:51:46 UTC (rev 6665)
+++ trunk/doc/en/html/about/history.html	2017-04-03 12:51:49 UTC (rev 6666)
@@ -35,7 +35,7 @@
 <ul class="history">
   <!-- li>Changes
     <ul>
-      <li></li>
+      <li>\x83\x8A\x83\x82\x81[\x83g\x82\xA9\x82\xE7\x82̃N\x83\x8A\x83b\x83v\x83{\x81[\x83h\x82ւ̃A\x83N\x83Z\x83X\x82\xF0\x92ʒm\x82\xB7\x82\xE9\x8B@\x94\\x82\xF0\x92lj\xC1\x82\xB5\x82\xBD\x81B</li>
     </ul>
   </li -->
 

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2017-04-03 12:51:46 UTC (rev 6665)
+++ trunk/doc/ja/html/about/history.html	2017-04-03 12:51:49 UTC (rev 6666)
@@ -33,9 +33,9 @@
 
 <h3><a name="teraterm_4.95">2017.05.xx (Ver 4.95)</a></h3>
 <ul class="history">
-  <!-- li>\x95ύX
+  <li>\x95ύX
     <ul>
-      <li>li>
+      <li>\x83\x8A\x83\x82\x81[\x83g\x82\xA9\x82\xE7\x82̃N\x83\x8A\x83b\x83v\x83{\x81[\x83h\x82ւ̃A\x83N\x83Z\x83X\x82\xF0\x92ʒm\x82\xB7\x82\xE9\x8B@\x94\\x82\xF0\x92lj\xC1\x82\xB5\x82\xBD\x81B</li>
     </ul>
   </li -->
 

Modified: trunk/installer/release/TERATERM.INI
===================================================================
--- trunk/installer/release/TERATERM.INI	2017-04-03 12:51:46 UTC (rev 6665)
+++ trunk/installer/release/TERATERM.INI	2017-04-03 12:51:49 UTC (rev 6666)
@@ -562,6 +562,9 @@
 ; Normalize line break when pasting
 NormalizeLineBreakOnPaste=off
 
+; Notify Clipboard access from remote
+NotifyClipboardAccess=on
+
 ; Polygon cursor for KILLFOCUS
 KillFocusCursor=on
 

Modified: trunk/teraterm/common/tttypes.h
===================================================================
--- trunk/teraterm/common/tttypes.h	2017-04-03 12:51:46 UTC (rev 6665)
+++ trunk/teraterm/common/tttypes.h	2017-04-03 12:51:49 UTC (rev 6666)
@@ -542,7 +542,7 @@
 	int TerminalOldWidth;
 	int TerminalOldHeight;
 	WORD MaximizedBugTweak;
-	WORD Dummy2;		// \x8B\x8CConfirmChangePaste. PasteFlag\x82ɓ\x9D\x8D\x87\x82\xB5\x82\xBD\x82\xBD\x82ߔp\x8E~\x81B\x91\xBC\x82֓]\x97p
+	WORD NotifyClipboardAccess;
 	WORD SaveVTWinPos;
 	WORD Dummy3;		// \x8B\x8CDisablePasteMouseMButton. PasteFlag\x82ɓ\x9D\x8D\x87\x82\xB5\x82\xBD\x82\xBD\x82ߔp\x8E~\x81B\x91\xBC\x82֓]\x97p
 	int MouseWheelScrollLine;
@@ -1089,6 +1089,9 @@
  * Increment the number of this macro value
  * when you change TMap or member of TMap.
  *
+ * - At version 4.95, ttset_memfilemap was replaced with ttset_memfilemap_31.
+ *   added tttset.NotifyClipboardAccess
+ *
  * - At version 4.94, ttset_memfilemap was replaced with ttset_memfilemap_30.
  *   paste related settings are integrated into tttset.PasteFlag
  *
@@ -1267,4 +1270,4 @@
  *   added tttset.VTCompatTab.
  */
 
-#define TT_FILEMAPNAME "ttset_memfilemap_30"
+#define TT_FILEMAPNAME "ttset_memfilemap_31"

Modified: trunk/teraterm/teraterm/vtterm.c
===================================================================
--- trunk/teraterm/teraterm/vtterm.c	2017-04-03 12:51:46 UTC (rev 6665)
+++ trunk/teraterm/teraterm/vtterm.c	2017-04-03 12:51:49 UTC (rev 6666)
@@ -4579,7 +4579,7 @@
 void XsProcClipboard(PCHAR buff)
 {
 	int len, blen;
-	char *p, *cbbuff, hdr[20];
+	char *p, *cbbuff, hdr[20], notify_buff[130];
 	HGLOBAL cbmem;
 	int wide_len;
 	HGLOBAL wide_cbmem;
@@ -4593,11 +4593,17 @@
 	if (*p++ == ';') {
 		if (*p == '?' && *(p+1) == 0) { // Read access
 			if (ts.CtrlFlag & CSF_CBREAD) {
+				if (ts.NotifyClipboardAccess) {
+					NotifyInfoMessage(&cv, "remote host reads clipboard contents", "Clipboard Access");
+				}
 				strncpy_s(hdr, sizeof(hdr), "\033]52;", _TRUNCATE);
 				if (strncat_s(hdr, sizeof(hdr), buff, p - buff) == 0) {
 					CBStartPasteB64(HVTWin, hdr, "\033\\");
 				}
 			}
+			else if (ts.NotifyClipboardAccess) {
+				NotifyWarnMessage(&cv, "Reject clipboard read access from remote", "Rejected Clipboard Access");
+			}
 		}
 		else if (ts.CtrlFlag & CSF_CBWRITE) { // Write access
 			len = strlen(buff);
@@ -4622,6 +4628,11 @@
 			cbbuff[len] = 0;
 			GlobalUnlock(cbmem);
 
+			if (ts.NotifyClipboardAccess) {
+				_snprintf_s(notify_buff, sizeof(notify_buff), _TRUNCATE, "remote host writes clipboard.\n--\n%s", cbbuff);
+				NotifyInfoMessage(&cv, notify_buff, "Clipboard Access");
+			}
+
 			wide_len = MultiByteToWideChar(CP_ACP, 0, cbbuff, -1, NULL, 0);
 			wide_cbmem = GlobalAlloc(GMEM_MOVEABLE, sizeof(WCHAR) * wide_len);
 			if (wide_cbmem) {
@@ -4639,6 +4650,9 @@
 				CloseClipboard();
 			}
 		}
+		else if (ts.NotifyClipboardAccess) {
+			NotifyWarnMessage(&cv, "Reject clipboard write access from remote", "Rejected Clipboard Access");
+		}
 	}
 }
 

Modified: trunk/teraterm/ttpset/ttset.c
===================================================================
--- trunk/teraterm/ttpset/ttset.c	2017-04-03 12:51:46 UTC (rev 6665)
+++ trunk/teraterm/ttpset/ttset.c	2017-04-03 12:51:49 UTC (rev 6666)
@@ -1804,6 +1804,9 @@
 	else if (_stricmp(Temp, "write") == 0)
 		ts->CtrlFlag |= CSF_CBWRITE;
 
+	// Notify Clipboard Access from Remote
+	ts->NotifyClipboardAccess = GetOnOff(Section, "NotifyClipboardAccess", FName, TRUE);
+
 	// Use invalid DECRPSS (for testing)
 	if (GetOnOff(Section, "UseInvalidDECRQSSResponse", FName, FALSE))
 		ts->TermFlag |= TF_INVALIDDECRPSS;
@@ -3096,6 +3099,9 @@
 		break;
 	}
 
+	// Notify Clipboard Access from Remote
+	WriteOnOff(Section, "NotifyClipboardAccess", FName, ts->NotifyClipboardAccess);
+
 	// ClickableUrlBrowser
 	WritePrivateProfileString(Section, "ClickableUrlBrowser", ts->ClickableUrlBrowser, FName);
 	WritePrivateProfileString(Section, "ClickableUrlBrowserArg", ts->ClickableUrlBrowserArg, FName);



Ttssh2-commit メーリングリストの案内
Back to archive index