- apply two patches from upstream svn:

* added --autoresume switch
* fix resuming a suspended session

ok ajacoutot@
This commit is contained in:
jasper 2011-03-02 10:23:36 +00:00
parent 30aa021611
commit 232901cd84
4 changed files with 123 additions and 2 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.13 2011/03/02 06:57:08 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.14 2011/03/02 10:23:36 jasper Exp $
COMMENT= OSS replacement for Nomachine's nxclient
DISTNAME= opennx-0.16
REVISION= 4
REVISION= 5
CATEGORIES= sysutils

View File

@ -0,0 +1,63 @@
$OpenBSD: patch-MySession_cpp,v 1.1 2011/03/02 10:23:36 jasper Exp $
- Fix resuming a suspended session.
From upstream svn -r610.
- Added --autoresume switch.
From upstream svn -r609.
--- MySession.cpp.orig Fri Jul 10 11:02:04 2009
+++ MySession.cpp Fri Feb 25 14:07:09 2011
@@ -846,7 +846,7 @@ MySession::OnSshEvent(wxCommandEvent &event)
break;
case STATE_RESUME_SESSION:
scmd = wxT("restoresession");
- scmd << m_pCfg->sGetSessionParams(intver(NX_PROTO), false, m_sClearPassword)
+ scmd << m_pCfg->sGetSessionParams(intver(NX_PROTO), true, m_sClearPassword)
<< wxT(" --session=\"") << m_sResumeName
<< wxT("\" --type=\"") << m_sResumeType
<< wxT("\" --id=\"") << m_sResumeId << wxT("\"");
@@ -922,9 +922,9 @@ MySession::OnSshEvent(wxCommandEvent &event)
m_sSmbPort = msg;
break;
case MyIPC::ActionExit:
- if (m_eConnectState == STATE_ABORT)
+ if (m_eConnectState == STATE_ABORT) {
m_bAbort = true;
- else {
+ } else {
if (m_eConnectState == STATE_FINISH) {
m_pDlg->SetStatusText(_("Starting session"));
msg = wxT("NX> 299 Switch connection to: ");
@@ -1062,7 +1062,13 @@ MySession::parseSessions(bool moreAllowed)
}
if (bFound) {
d.EnableNew(moreAllowed);
- if (m_bIsShadow || (iSessionCount > 1) || (!sName.IsSameAs(m_pCfg->sGetName()))) {
+ if ((!m_bIsShadow) && wxGetApp().AutoResume() && (iSessionCount == 1) && (sName.IsSameAs(m_pCfg->sGetName()))) {
+ ::wxLogInfo(wxT("RESUME"));
+ m_sResumeName = sName;
+ m_sResumeType = d.GetSelectedType();
+ m_sResumeId = d.GetSelectedId();
+ m_eConnectState = STATE_RESUME_SESSION;
+ } else {
switch (d.ShowModal()) {
case wxID_OK:
switch (d.GetMode()) {
@@ -1095,16 +1101,9 @@ MySession::parseSessions(bool moreAllowed)
break;
case wxID_CANCEL:
printSsh(wxT("bye"));
- if (m_bIsShadow)
- m_eConnectState = STATE_ABORT;
+ m_eConnectState = STATE_ABORT;
break;
}
- } else {
- wxLogInfo(wxT("RESUME"));
- m_sResumeName = d.GetSelectedName();
- m_sResumeType = d.GetSelectedType();
- m_sResumeId = d.GetSelectedId();
- m_eConnectState = STATE_RESUME_SESSION;
}
} else {
if (m_bIsShadow) {

View File

@ -0,0 +1,35 @@
$OpenBSD: patch-opennxApp_cpp,v 1.1 2011/03/02 10:23:36 jasper Exp $
- Added --autoresume switch.
From upstream svn -r609.
--- opennxApp.cpp.orig Wed Jul 8 13:50:50 2009
+++ opennxApp.cpp Fri Feb 25 14:04:44 2011
@@ -96,7 +96,8 @@ IMPLEMENT_APP(opennxApp);
,m_bRunproc(false)
,m_bLibUSBAvailable(false)
,m_bRequireWatchReader(false)
- ,m_bRequireStartUsbIp(false)
+ ,m_bRequireStartUsbIp(false)
+ ,m_bAutoResume(false)
{
SetAppName(wxT("OpenNX"));
#ifdef __WXMSW__
@@ -707,6 +708,8 @@ void opennxApp::OnInitCmdLine(wxCmdLineParser& parser)
}
tags.Prepend(_("\n\nSupported trace tags: "));
+ parser.AddSwitch(wxEmptyString, wxT("autoresume"),
+ _("Automatically resume/takeover a session with the same name."));
parser.AddSwitch(wxEmptyString, wxT("admin"),
_("Start the session administration tool."));
parser.AddOption(wxEmptyString, wxT("caption"),
@@ -844,6 +847,8 @@ bool opennxApp::OnCmdLineParsed(wxCmdLineParser& parse
m_eMode = MODE_ADMIN;
if (parser.Found(wxT("wizard")))
m_eMode = MODE_WIZARD;
+ if (parser.Found(wxT("autoresume")))
+ m_bAutoResume = true;
(void)parser.Found(wxT("session"), &m_sSessionName);
wxString traceTags;
if (parser.Found(wxT("trace"), &traceTags)) {

View File

@ -0,0 +1,23 @@
$OpenBSD: patch-opennxApp_h,v 1.1 2011/03/02 10:23:36 jasper Exp $
- Added --autoresume switch.
From upstream svn -r609.
--- opennxApp.h.orig Fri Feb 25 14:02:24 2011
+++ opennxApp.h Fri Feb 25 14:03:24 2011
@@ -49,6 +49,7 @@ class opennxApp : public wxApp
*/
bool NxSmartCardSupport() { return m_bNxSmartCardSupport; }
bool LibUSBAvailable() { return m_bLibUSBAvailable; }
+ bool AutoResume() { return m_bAutoResume; }
void SetRequireWatchReader(bool b) { m_bRequireWatchReader = b; }
void SetRequireStartUsbIp(bool b) { m_bRequireStartUsbIp = b; }
@@ -97,6 +98,7 @@ class opennxApp : public wxApp
bool m_bLibUSBAvailable;
bool m_bRequireWatchReader;
bool m_bRequireStartUsbIp;
+ bool m_bAutoResume;
bool preInit();
bool realInit();