From a98a6af7362812dd55adafb4e0119514c309a6f0 Mon Sep 17 00:00:00 2001 From: Maurice ONeal Date: Wed, 1 Apr 2020 11:45:55 -0400 Subject: [PATCH] Minor update this client will no longer display TEXT messages from just any async commands. instead it will now display TEXT from ASYNC_RDY and ASYNC_CAST only. --- docs/README.md | 2 +- src/cmd_objs/exec.cpp | 2 +- src/common.cpp | 15 ++++++++------- src/common.h | 2 +- src/session.cpp | 23 ++++++++++++++++++----- 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/docs/README.md b/docs/README.md index b203c38..d4d114e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -82,7 +82,7 @@ notes: * reply = 2, means the client is acceptable but the host will now send it's Pem formatted SSL cert data in a ```HOST_CERT``` mrci frame just after sending it's header. After receiving the cert, the client will then need to send a STARTTLS signal using this cert. * reply = 4, means the host was unable to find the SSL cert associated with the common name sent by the client. The session will auto close at this point. -* **major**, **minor**, **tcp_rev**, **mod_rev** these 4 numeric values are the host version number that uses a 4 number versioning system. This can be used by the client to setup backwards compatibility or determine of if supports the host at all. If not supported, the client can simply disconnect form the host and display an error to the user. +* **major**, **minor**, **tcp_rev**, **mod_rev** these 4 numeric values are the host version number that uses a 4 number versioning system. This can be used by the client to setup backwards compatibility or determine if it supports the host at all. If not supported, the client can simply disconnect from the host and display an error to the user. * **sesId** is the session id. It is a unique 224bit sha3 hash that can be used by the host and client to uniquely identify the current session or past sessions. diff --git a/src/cmd_objs/exec.cpp b/src/cmd_objs/exec.cpp index e6cffec..dda9105 100644 --- a/src/cmd_objs/exec.cpp +++ b/src/cmd_objs/exec.cpp @@ -23,7 +23,7 @@ Connect::Connect(QObject *parent) : Command(parent) Shared::clientCmds->insert(objectName(), this); } -QString Connect::shortText() {return tr("connect a MRCI host.");} +QString Connect::shortText() {return tr("connect to a MRCI host.");} QString Connect::ioText() {return tr("[-addr (text) -port (text) {-save (bookmark)}] or [-load (bookmark)]/[text]");} QString Connect::longText() {return TXT_Connect;} diff --git a/src/common.cpp b/src/common.cpp index 4165a13..7c268ad 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -290,16 +290,17 @@ void wordWrap(const QString &label, QTextStream &txtOut, const QString &txtIn, Q // breaking mid-word and also honors line breaks by treating // lines with line breaks as complete text bodies. - int width = measureWid->width() / 8; - bool labelWr = true; - QString indent = QString(label.size(), ' '); - QStringList textBodies = txtIn.split('\n'); + auto width = measureWid->width() / 8; + auto labelWr = true; + auto indent = QString(label.size(), ' '); + auto textBodies = txtIn.split('\n'); for (int i = 0; i < textBodies.size(); ++i) { - int index = 0; - QStringList words = textBodies[i].split(' '); - QString line; + auto index = 0; + auto words = textBodies[i].split(' '); + + QString line; while(index < words.size()) { diff --git a/src/common.h b/src/common.h index b63dff0..cb6e33a 100644 --- a/src/common.h +++ b/src/common.h @@ -76,7 +76,7 @@ #define CONFIG_FILENAME "config_v3.json" #define APP_NAME "Cmdr" #define APP_TARGET "cmdr" -#define APP_VERSION "3.1" +#define APP_VERSION "3.2" enum TypeID : quint8 { diff --git a/src/session.cpp b/src/session.cpp index c9bc9fa..4de2d2b 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -242,14 +242,27 @@ bool Session::isAsync(quint16 id) void Session::procAsync(const QByteArray &data) { - if ((dType == TEXT) || (dType == BIG_TEXT) || (dType == ERR)) + if (cmdId == ASYNC_CAST) + { + if (dType == TEXT) + { + cacheTxt(dType, "\ncast_text: " + fromTEXT(data) + "\n"); + } + else if (dType == BIG_TEXT) + { + QString txt; + QTextStream stream(&txt); + + wordWrap("cast_text: ", stream, fromTEXT(data), Shared::mainWidget); + cacheTxt(TEXT, "\n"); + cacheTxt(TEXT, txt); + } + } + else if (cmdId == ASYNC_RDY) { cacheTxt(dType, fromTEXT(data)); - if (cmdId == ASYNC_RDY) - { - hook = 0; - } + hook = 0; } else if (cmdId == ASYNC_SYS_MSG) {