[X2Go-Commits] [x2goclient] 15/18: 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
Fri Feb 10 05:35:28 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 6990f5008222e30fd5d411860ae7a3fe74ef41e0
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 b847c80..a47fabf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -610,6 +610,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 93ec02d..4178730 100644
--- a/src/sshmasterconnection.cpp
+++ b/src/sshmasterconnection.cpp
@@ -1559,11 +1559,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 << error_msg.left (error_msg.size () - 1) << ": " << err << endl;
 #endif
 
                     continue;
@@ -1584,10 +1585,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
@@ -1605,19 +1606,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." ).arg ("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
@@ -1749,10 +1750,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