Added writing hashed messages to a file on disk

This commit is contained in:
Jordan Sherer 2018-08-28 20:58:39 -04:00
parent 2250589f83
commit f06df77db2
2 changed files with 26 additions and 0 deletions

View File

@ -994,6 +994,15 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
throw std::runtime_error {"Failed to create samples directory"};
}
QString messages_dir {"messages"};
if (!default_save_directory_.mkpath (messages_dir))
{
MessageBox::critical_message (this, tr ("Failed to create messages directory"),
tr ("path: \"%1\"")
.arg (default_save_directory_.absoluteFilePath (messages_dir)));
throw std::runtime_error {"Failed to create messages directory"};
}
// copy in any new sample files to the sample directory
QDir dest_dir {default_save_directory_};
dest_dir.cd (samples_dir);

View File

@ -9188,6 +9188,23 @@ void MainWindow::processCommandActivity() {
}
// PROCESS BUFFERED MESSAGE
else if (d.cmd == "#" && !isAllCall) {
// open file /save/messages/[callsign].txt and append a message log entry...
QFile f(QDir::toNativeSeparators(m_config.writeable_data_dir ().absolutePath()) + QString("/save/messages/%1.txt").arg(Radio::base_callsign(d.from)));
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
QTextStream out(&f);
auto df = dialFrequency();
auto text = QString("%1\t%2MHz\t%3Hz\t%4dB\t%5: %6");
text = text.arg(d.utcTimestamp.toString());
text = text.arg(Radio::frequency_MHz_string(df));
text = text.arg(d.freq);
text = text.arg(Varicode::formatSNR(d.snr));
text = text.arg(d.from);
text = text.arg(d.text);
out << text << endl;
f.close();
}
reply = QString("%1 ACK").arg(d.from);
}
// PROCESS AGN