diff --git a/Configuration.cpp b/Configuration.cpp index c7f623c..4788a61 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -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); diff --git a/mainwindow.cpp b/mainwindow.cpp index 22a8557..dbcc414 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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