Skip to content

Commit 49c0be1

Browse files
committed
Version jPskmail-3.3.0.2
- Added option to have time based passwords (when prefixed by _), renewed every 10 seconds to prevent unwanted server access. May require the use of the Time Sync command, or a GPS receiver, to ensure clocks are synchronized within 10 seconds. - Added option to monitor the RadioMsgSending sub-folder to automatically send .txt files as a Radio Message.
1 parent 7ebd77a commit 49c0be1

14 files changed

Lines changed: 414 additions & 175 deletions

commons-codec-1.7.jar

254 KB
Binary file not shown.

nbproject/project.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
application.splash=src/Images/logo.gif
22
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
3+
file.reference.commons-codec-1.7.jar=commons-codec-1.7.jar
34
file.reference.javax.activation-1.2.0.jar=javax.activation-1.2.0.jar
45
file.reference.javax.mail-1.6.2.jar=javax.mail-1.6.2.jar
56
file.reference.json-simple-4.0.2.jar=json-simple-4.0.2.jar
@@ -84,7 +85,8 @@ javac.classpath=\
8485
${file.reference.javax.mail-1.6.2.jar}:\
8586
${file.reference.libphonenumber-8.10.22.jar}:\
8687
${libs.absolutelayout.classpath}:\
87-
${file.reference.json-simple-4.0.2.jar}
88+
${file.reference.json-simple-4.0.2.jar}:\
89+
${file.reference.commons-codec-1.7.jar}
8890
mkdist.disabled=false
8991
run.test.modulepath=\
9092
${javac.test.modulepath}

src/javapskmail/Main.java

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Main.java
33
*
44
* Copyright (C) 2008 Pär Crusefalk and Rein Couperus
5-
* Copyright (C) 2018-2024 Pskmail Server and RadioMsg sections by John Douyere (VK2ETA)
5+
* Copyright (C) 2018-2025 Pskmail Server and RadioMsg sections by John Douyere (VK2ETA)
66
*
77
* This program is distributed in the hope that it will be useful,
88
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -34,9 +34,9 @@
3434
public class Main {
3535

3636
//VK2ETA: Based on "jpskmail 1.7.b";
37-
static String version = "3.3.0.1";
37+
static String version = "3.3.0.2";
3838
static String application = "jPskmail " + version;// Used to preset an empty status
39-
static String versionDate = "20250320";
39+
static String versionDate = "20250407";
4040
static String host = "localhost";
4141
static int port = 7322; //ARQ IP port
4242
static String xmlPort = "7362"; //XML IP port
@@ -66,6 +66,7 @@ public class Main {
6666
//static final String DirTemp = "Temp";
6767
//static final String DirLogs = "Logs";
6868
static final String dirImages = "RadioMsg-Images";
69+
static final String dirSendingAPI = "RadioMsgSending";
6970
static final String messageLogFile = "RadioMsg.log";
7071
//
7172
static String mailOutFile = "";
@@ -255,7 +256,7 @@ public class Main {
255256
static long restartScanAtEpoch = 0L;
256257

257258
static String callsignAsServer = "";
258-
static String accessPassword = "";
259+
static String relayingPassword = "";
259260
static String IotAccessPassword = "";
260261

261262
//crypto
@@ -358,9 +359,6 @@ public static void main(String[] args) throws InterruptedException {
358359

359360
q.Message(version, 10);
360361

361-
// Make calendar object
362-
// Calendar cal = Calendar.getInstance();
363-
// Make amp2 object
364362
Bul = new Amp2();
365363
Bul.init();
366364
Thread.sleep(1000);
@@ -441,7 +439,12 @@ public static void main(String[] args) throws InterruptedException {
441439
//System.out.println("About to call startemail");
442440
RMsgProcessor.startEmailsAndSMSsMonitor();
443441
//System.out.println("Returned from startemail");
444-
442+
443+
//File Sending API
444+
if (configuration.getPreference("MONITORFILESFOLDER", "no").equals("yes")) {
445+
RMsgProcessor.startFilesMonitor();
446+
}
447+
445448
//vk2eta debug
446449
//System.out.println("entering receive loop");
447450
while (true) {
@@ -1067,7 +1070,7 @@ public static void main(String[] args) throws InterruptedException {
10671070
String pCheck = bmsc.group(6);
10681071
String checkstring = "00u" + scall + ":25" + spaces1 + email + spaces2 + body + "\n";
10691072
String check = q.checksum(checkstring);
1070-
String checkWithPass = q.checksum(checkstring + accessPassword);
1073+
String checkWithPass = q.checksum(checkstring + relayingPassword);
10711074
//Only authorized if the server is left open (without a password)
10721075
// Otherwise use the RadioMsg app to send short messages
10731076
//if (Main.WantServer && (Main.accessPassword.length() == 0 && check.equals(pCheck)
@@ -1474,8 +1477,8 @@ public static void main(String[] args) throws InterruptedException {
14741477
//I am not in a session, or the current client is connecting again, try to accept connection connect
14751478
ttyCaller = newCaller;
14761479
//Password supplied matches or None required?
1477-
if ((rxb.valid && Main.accessPassword.length() == 0)
1478-
|| (rxb.validWithPW && Main.accessPassword.length() > 0)) {
1480+
if ((rxb.valid && Main.relayingPassword.length() == 0)
1481+
|| (rxb.validWithPW && Main.relayingPassword.length() > 0)) {
14791482
//Clean any previous session data
14801483
disconnect = false;
14811484
status = "Listening";
@@ -1533,7 +1536,7 @@ public static void main(String[] args) throws InterruptedException {
15331536
//blocktime = (charval * 64 / 1000) + 4;
15341537
}
15351538
log("Connect request from " + ttyCaller);
1536-
} else if (rxb.valid && Main.accessPassword.length() > 0) {
1539+
} else if (rxb.valid && Main.relayingPassword.length() > 0) {
15371540
//Need password but none provided. Send a reject block with a reason
15381541
m.requestTxRsid("ON");
15391542
m.setRxRsid("ON");
@@ -1902,6 +1905,11 @@ private static void handlefolderstructure() {
19021905
if (!RadioMsgSentbox.isDirectory()) {
19031906
RadioMsgSentbox.mkdir();
19041907
}
1908+
//Create RadioMsgSendingAPI
1909+
File RadioMsgSendingAPI = new File(homePath + dirPrefix + dirSendingAPI + separator);
1910+
if (!RadioMsgSendingAPI.isDirectory()) {
1911+
RadioMsgSendingAPI.mkdir();
1912+
}
19051913
//Create RadioMsgImages
19061914
File RadioMsgImages = new File(homePath + dirPrefix + dirImages + separator);
19071915
if (!RadioMsgImages.isDirectory()) {
@@ -2039,7 +2047,7 @@ private static void handleinitialization() {
20392047
wantRelaySMSsImmediat = false;
20402048
}
20412049
callsignAsServer = configuration.getPreference("CALLSIGNASSERVER", "N0CAL");
2042-
accessPassword = Main.configuration.getPreference("ACCESSPASSWORD").trim();
2050+
relayingPassword = Main.configuration.getPreference("ACCESSPASSWORD").trim();
20432051
IotAccessPassword = Main.configuration.getPreference("IOTACCESSPASSWORD").trim();
20442052
} catch (Exception e) {
20452053
MAXDCD = 3;

src/javapskmail/MainPskmailUi.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ public void actionPerformed(ActionEvent e) {
472472
Main.mainmutex = false;
473473
}
474474

475-
// 5 x 200 = 1000 msec timer
475+
// 5 x 200 = 1 second timer
476476
if (timercnt < 5) {
477477
timercnt++;
478478
} else { //Loop run every SECOND
@@ -511,6 +511,8 @@ public void actionPerformed(ActionEvent e) {
511511
}
512512
timercnt = 0;
513513
Calendar cal = Calendar.getInstance();
514+
//Adjust for a received time reference (e.g. from this remote station)
515+
cal.add(Calendar.SECOND, Main.deviceToRefTimeCorrection.intValue());
514516
int Hour = cal.get(Calendar.HOUR_OF_DAY);
515517
int Minute = cal.get(Calendar.MINUTE);
516518
int Second = cal.get(Calendar.SECOND);
@@ -722,6 +724,12 @@ public void actionPerformed(ActionEvent e) {
722724
formatsecond = formatsecond.substring(formatsecond.length() - 2);
723725

724726
clock = formathour + ":" + formatminute + ":" + formatsecond;
727+
//Adjust the text colour
728+
if (Main.deviceToRefTimeCorrection.intValue() == 0) {
729+
jTextField1.setForeground(Color.BLACK);
730+
} else {
731+
jTextField1.setForeground(Color.RED);
732+
}
725733
setClock(clock);
726734

727735
// display status field
@@ -7727,13 +7735,12 @@ private void timeSyncMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//
77277735
}//GEN-LAST:event_timeSyncMenuItemActionPerformed
77287736

77297737
private void serverControlActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_serverControlActionPerformed
7730-
if (selectedTo.equals("*")) {
7731-
//middleToastText("CAN'T send commands to all servers. Select a single TO destination above"
7732-
Main.q.Message(mainpskmailui.getString("you_must_select_to"), 5);
7733-
} else {
7738+
if ((selectedTo.equals("*") && !selectedVia.equals("")) || (!selectedTo.equals("*") && selectedVia.equals(""))) {
77347739
ServerControlWindow scw = new ServerControlWindow(this, true);
77357740
scw.setLocationRelativeTo(this);
77367741
scw.setVisible(true);
7742+
} else {
7743+
Main.q.Message(mainpskmailui.getString("you_must_select_to_or_via"), 5);
77377744
}
77387745
}//GEN-LAST:event_serverControlActionPerformed
77397746

src/javapskmail/OptionsDialog.form

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,9 @@
461461
</SubComponents>
462462
</Container>
463463
<Container class="javax.swing.JPanel" name="pnlEmail">
464+
<Properties>
465+
<Property name="enabled" type="boolean" value="false"/>
466+
</Properties>
464467
<Constraints>
465468
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
466469
<JTabbedPaneConstraints tabName="Email settings">
@@ -1143,12 +1146,25 @@
11431146
<Layout>
11441147
<DimensionLayout dim="0">
11451148
<Group type="103" groupAlignment="0" attributes="0">
1146-
<Component id="jPanel9" alignment="0" max="32767" attributes="0"/>
11471149
<Group type="102" attributes="0">
1148-
<Component id="test1" min="-2" max="-2" attributes="0"/>
1150+
<Group type="103" groupAlignment="0" attributes="0">
1151+
<Component id="test1" min="-2" max="-2" attributes="0"/>
1152+
<Group type="102" alignment="0" attributes="0">
1153+
<EmptySpace max="-2" attributes="0"/>
1154+
<Component id="jLabel38" min="-2" max="-2" attributes="0"/>
1155+
<EmptySpace min="-2" pref="78" max="-2" attributes="0"/>
1156+
<Component id="checkboxMonitorFilesFolder" min="-2" max="-2" attributes="0"/>
1157+
</Group>
1158+
</Group>
11491159
<EmptySpace pref="215" max="32767" attributes="0"/>
11501160
</Group>
1151-
<Component id="jPanel10" alignment="0" max="32767" attributes="0"/>
1161+
<Group type="102" alignment="0" attributes="0">
1162+
<Group type="103" groupAlignment="1" max="-2" attributes="0">
1163+
<Component id="jPanel9" alignment="0" max="32767" attributes="0"/>
1164+
<Component id="jPanel10" alignment="0" max="32767" attributes="0"/>
1165+
</Group>
1166+
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
1167+
</Group>
11521168
<Component id="jPanel13" alignment="1" max="32767" attributes="0"/>
11531169
</Group>
11541170
</DimensionLayout>
@@ -1160,8 +1176,13 @@
11601176
<EmptySpace max="32767" attributes="0"/>
11611177
<Component id="jPanel9" min="-2" max="-2" attributes="0"/>
11621178
<EmptySpace max="-2" attributes="0"/>
1163-
<Component id="jPanel10" min="-2" max="-2" attributes="0"/>
1164-
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
1179+
<Component id="jPanel10" min="-2" pref="66" max="-2" attributes="0"/>
1180+
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
1181+
<Group type="103" groupAlignment="3" attributes="0">
1182+
<Component id="jLabel38" alignment="3" min="-2" max="-2" attributes="0"/>
1183+
<Component id="checkboxMonitorFilesFolder" alignment="0" min="-2" max="-2" attributes="0"/>
1184+
</Group>
1185+
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
11651186
<Component id="jPanel13" min="-2" max="-2" attributes="0"/>
11661187
<EmptySpace max="-2" attributes="0"/>
11671188
</Group>
@@ -1318,7 +1339,7 @@
13181339
</Group>
13191340
<Component id="jButtonConfigSmsGateway" alignment="0" min="-2" max="-2" attributes="0"/>
13201341
</Group>
1321-
<EmptySpace pref="19" max="32767" attributes="0"/>
1342+
<EmptySpace max="32767" attributes="0"/>
13221343
</Group>
13231344
</Group>
13241345
</DimensionLayout>
@@ -1329,7 +1350,7 @@
13291350
<Component id="checkboxRelaySMSs" alignment="3" min="-2" max="-2" attributes="0"/>
13301351
<Component id="checkboxRelaySMSsImmediately" alignment="3" min="-2" max="-2" attributes="0"/>
13311352
</Group>
1332-
<EmptySpace type="separate" max="-2" attributes="0"/>
1353+
<EmptySpace type="unrelated" max="-2" attributes="0"/>
13331354
<Component id="jButtonConfigSmsGateway" min="-2" max="-2" attributes="0"/>
13341355
<EmptySpace max="32767" attributes="0"/>
13351356
</Group>
@@ -1382,14 +1403,15 @@
13821403
<Layout>
13831404
<DimensionLayout dim="0">
13841405
<Group type="103" groupAlignment="0" attributes="0">
1385-
<Group type="102" attributes="0">
1406+
<Group type="102" alignment="0" attributes="0">
1407+
<EmptySpace max="-2" attributes="0"/>
13861408
<Group type="103" groupAlignment="0" attributes="0">
1387-
<Group type="102" attributes="0">
1409+
<Group type="102" alignment="0" attributes="0">
13881410
<Component id="jLabel24" min="-2" pref="201" max="-2" attributes="0"/>
13891411
<EmptySpace type="unrelated" max="-2" attributes="0"/>
13901412
<Component id="spinnerAckPosition" min="-2" pref="59" max="-2" attributes="0"/>
13911413
</Group>
1392-
<Group type="102" attributes="0">
1414+
<Group type="102" alignment="0" attributes="0">
13931415
<Component id="jLabel26" min="-2" pref="201" max="-2" attributes="0"/>
13941416
<EmptySpace type="unrelated" max="-2" attributes="0"/>
13951417
<Component id="checkboxAckWithRSID" min="-2" max="-2" attributes="0"/>
@@ -1400,7 +1422,7 @@
14001422
<Component id="spinnerMaxAckPosition" min="-2" pref="59" max="-2" attributes="0"/>
14011423
</Group>
14021424
</Group>
1403-
<EmptySpace min="0" pref="173" max="32767" attributes="0"/>
1425+
<EmptySpace max="32767" attributes="0"/>
14041426
</Group>
14051427
</Group>
14061428
</DimensionLayout>
@@ -1487,6 +1509,23 @@
14871509
</Component>
14881510
</SubComponents>
14891511
</Container>
1512+
<Component class="javax.swing.JLabel" name="jLabel38">
1513+
<Properties>
1514+
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
1515+
<ResourceString bundle="javapskmail/optionsdialog.properties" key="lblMonitorFolder" replaceFormat="optionsdialog.getString(&quot;{key}&quot;)"/>
1516+
</Property>
1517+
</Properties>
1518+
</Component>
1519+
<Component class="javax.swing.JCheckBox" name="checkboxMonitorFilesFolder">
1520+
<Properties>
1521+
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
1522+
<ResourceString bundle="javapskmail/optionsdialog.properties" key="TOOLTIPMONITORFILESFOLDER" replaceFormat="optionsdialog.getString(&quot;{key}&quot;)"/>
1523+
</Property>
1524+
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
1525+
<Insets value="[0, 2, 2, 2]"/>
1526+
</Property>
1527+
</Properties>
1528+
</Component>
14901529
</SubComponents>
14911530
</Container>
14921531
<Container class="javax.swing.JPanel" name="pnlConfiguration">

0 commit comments

Comments
 (0)