[X2Go-Commits] [x2goclient] 15/15: src/sshmasterconnection.cpp: use QString::arg () to insert function name and thus deduplicate error translation messages.

git-admin at x2go.org git-admin at x2go.org
Sat Jan 28 18:43:11 CET 2017


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch feature/libssh-api-upgrade
in repository x2goclient.

commit 2b7f60874ef6b1e87f072ef03328e93268154075
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat Jan 28 18:34:46 2017 +0100

    src/sshmasterconnection.cpp: use QString::arg () to insert function name and thus deduplicate error translation messages.
    
    Also re-add the full stop sign and remove it when needed for x2goDebug.
---
 debian/changelog            |    3 +++
 src/sshmasterconnection.cpp |   31 ++++++++++++++++---------------
 2 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index f641d09..4af7611 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -602,6 +602,9 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium
     - src/sshmasterconnection.cpp: replace deprecated channel_free () function
       with ssh_channel_free (). Might break on ancient systems, but we don't
       care.
+    - src/sshmasterconnection.cpp: use QString::arg () to insert function name
+      and thus deduplicate error translation messages. Also re-add the full
+      stop sign and remove it when needed for x2goDebug.
 
   [ Bernard Cafarelli ]
   * New upstream version (4.1.0.0):
diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp
index 84d8e53..13432a6 100644
--- a/src/sshmasterconnection.cpp
+++ b/src/sshmasterconnection.cpp
@@ -1553,11 +1553,12 @@ void SshMasterConnection::channelLoop()
 
                 if (!channel) {
                     QString err = ssh_get_error (my_ssh_session);
-                    QString error_msg = tr ("ssh_channel_new failed");
-                    emit ioErr (channelConnections[i].creator, error_msg + ".", err);
+                    /*: Argument in this context will be a function name. */
+                    QString error_msg = tr ("%1 failed.").arg ("ssh_channel_new");
+                    emit ioErr (channelConnections[i].creator, error_msg, err);
 
 #ifdef DEBUG
-                    x2goDebug << errorMsg << ": " << err << endl;
+                    x2goDebug << errorMsg.left (errorMsg.size () - 1) << ": " << err << endl;
 #endif
 
                     continue;
@@ -1578,10 +1579,10 @@ void SshMasterConnection::channelLoop()
                                                     channelConnections.at ( i ).localPort ) != SSH_OK )
                     {
                         QString err=ssh_get_error ( my_ssh_session );
-                        QString errorMsg=tr ( "ssh_channel_open_forward failed" );
-                        emit ioErr ( channelConnections[i].creator, errorMsg + ".", err );
+                        QString errorMsg=tr ( "%1 failed." ).arg ("ssh_channel_open_forward");
+                        emit ioErr ( channelConnections[i].creator, errorMsg, err );
 #ifdef DEBUG
-                        x2goDebug<<errorMsg<<": "<<err<<endl;
+                        x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl;
 #endif
                     }
 #ifdef DEBUG
@@ -1599,19 +1600,19 @@ void SshMasterConnection::channelLoop()
                     if ( ssh_channel_open_session ( channel ) !=SSH_OK )
                     {
                         QString err=ssh_get_error ( my_ssh_session );
-                        QString errorMsg=tr ( "ssh_channel_open_session failed" );
-                        emit ioErr ( channelConnections[i].creator, errorMsg + ".", err );
+                        QString errorMsg=tr ( "%1 failed." ).arg ("ssh_channel_open_session");
+                        emit ioErr ( channelConnections[i].creator, errorMsg, err );
 #ifdef DEBUG
-                        x2goDebug<<errorMsg<<": "<<err<<endl;
+                        x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl;
 #endif
                     }
                     else if ( ssh_channel_request_exec ( channel, channelConnections[i].command.toLatin1() ) != SSH_OK )
                     {
                         QString err=ssh_get_error ( my_ssh_session );
-                        QString errorMsg=tr ( "ssh_channel_request_exec failed" );
-                        emit ioErr ( channelConnections[i].creator, errorMsg + ".", err );
+                        QString errorMsg=tr ( "%1 failed." ).args ("ssh_channel_request_exec");
+                        emit ioErr ( channelConnections[i].creator, errorMsg, err );
 #ifdef DEBUG
-                        x2goDebug<<errorMsg<<": "<<err<<endl;
+                        x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl;
 #endif
                     }
 #ifdef DEBUG
@@ -1743,10 +1744,10 @@ void SshMasterConnection::channelLoop()
                     if ( ssh_channel_write ( channel, buffer, nbytes ) !=nbytes )
                     {
                         QString err=ssh_get_error ( my_ssh_session );
-                        QString errorMsg=tr ( "ssh_channel_write failed" );
-                        emit ioErr ( channelConnections[i].creator, errorMsg + ".", err );
+                        QString errorMsg=tr ( "%1 failed." ).arg ("ssh_channel_write");
+                        emit ioErr ( channelConnections[i].creator, errorMsg, err );
 #ifdef DEBUG
-                        x2goDebug<<errorMsg<<": "<<err<<endl;
+                        x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl;
 #endif
                         finalize ( i );
                         continue;

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list