Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions src/callinput.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
#include "time_update.h"
#include "trx_memory.h"
#include "ui_utils.h"
#include "utils.h"
#include "showzones.h"
#include "bands.h"
#include "fldigixmlrpc.h"
Expand All @@ -85,7 +86,6 @@ typedef enum { STORE_OR_POP, POP, SWAP } memory_op_t;

void send_bandswitch(freq_t freq);
int autosend(void);
bool plain_number(char *str);
void handle_bandswitch(int direction);
void handle_memory_operation(memory_op_t op);

Expand Down Expand Up @@ -877,30 +877,6 @@ bool valid_call_char(int ch) {
|| ch == '/';
}

/** check if string is plain number
*
* Check if string contains only digits
* \param str the string to check
* \return true if only digits inside
* false contains at least one non-digit or it's an empty string
*/
bool plain_number(char *str) {
int i;

if (strlen(str) == 0) {
return false;
}

for (i = 0; i < strlen(str); i++) {
if (!isdigit(str[i])) {
return false;
}
}

return true;
}


/** autosend function
*
* autosend allow an operator in RUN mode to just enter the call of the
Expand Down
1 change: 0 additions & 1 deletion src/callinput.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@
int callinput(void);
void send_bandswitch(freq_t freq);
bool valid_call_char(int ch);
bool plain_number(char *str);

#endif /* CALLINPUT_H */
2 changes: 2 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,8 @@ static void init_variables() {
#ifdef HAVE_PYTHON
FREE_DYNAMIC_STRING(plugin_config);
#endif

init_contests();
}

/** load all databases
Expand Down
1 change: 1 addition & 0 deletions src/parse_logcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,7 @@ static config_t logcfg_configs[] = {
{"USEPARTIALS", CFG_BOOL(use_part)},
{"PARTIALS", CFG_BOOL(partials)},
{"RECALL_MULTS", CFG_CONTEST_BOOL(recall_mult)},
{"RECALL_NUMERIC_EXCHANGES", CFG_CONTEST_BOOL(recall_numeric_exchanges)},
{"WYSIWYG_MULTIBAND", CFG_BOOL(wysiwyg_multi)},
{"WYSIWYG_ONCE", CFG_BOOL(wysiwyg_once)},
{"RIT_CLEAR", CFG_BOOL(rit)},
Expand Down
8 changes: 8 additions & 0 deletions src/recall_exchange.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "tlf.h"
#include "tlf_curses.h"
#include "setcontest.h"
#include "utils.h"


/** \brief Recall former exchange or lookup initial exchange file
Expand Down Expand Up @@ -63,6 +64,13 @@ int get_proposed_exchange(void) {
}
}

if (found == 1 &&
!contest->recall_numeric_exchanges && plain_number(proposed_exchange)) {
// do not recall numeric exchanges
proposed_exchange[0] = 0;
found = -1;
}

if (found == -1) {

/* if no exchange could be recycled and no comment available
Expand Down
2 changes: 1 addition & 1 deletion src/sendqrg.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <assert.h>

#include "bands.h"
#include "callinput.h"
#include "utils.h"
#include "cw_utils.h"
#include "err_utils.h"
#include "hamlib_keyer.h"
Expand Down
12 changes: 11 additions & 1 deletion src/setcontest.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,19 @@ contest_config_t *lookup_contest(char *name) {
}


/** initalize contests
*
*/
void init_contests() {
for (int i = 0; i < NR_CONTESTS; i++) {
contest_configs[i]->recall_numeric_exchanges = true;
}
}


/** show a list of supported/hard-coded contests
*
* works out of ncurses context for 'tlf -l' i
* works out of ncurses context for 'tlf -l'
*/
void list_contests() {
puts(
Expand Down
1 change: 1 addition & 0 deletions src/setcontest.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

extern contest_config_t config_qso;

void init_contests();
bool general_ismulti(spot *data);
contest_config_t *lookup_contest(char *name);
void list_contests();
Expand Down
1 change: 1 addition & 0 deletions src/tlf.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ typedef struct {
contest_type_t id;
char *name;
bool recall_mult;
bool recall_numeric_exchanges;
bool exchange_serial;
int exchange_width;
struct {
Expand Down
25 changes: 25 additions & 0 deletions src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include <ctype.h>
#include <unistd.h>
#include <string.h>
#include <stdbool.h>
Expand Down Expand Up @@ -233,3 +234,27 @@ void get_partial_callsign(char *call1, char *call2, char *partial) {
free_call_parts(cp1);
free_call_parts(cp2);
}

/** check if string is plain number
*
* Check if string contains only digits
* \param str the string to check
* \return true if only digits inside
* false contains at least one non-digit or it's an empty string
*/
bool plain_number(char *str) {
int i;

if (strlen(str) == 0) {
return false;
}

for (i = 0; i < strlen(str); i++) {
if (!isdigit(str[i])) {
return false;
}
}

return true;
}

1 change: 1 addition & 0 deletions src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
bool check_qra(char *qra);
char *find_available(char *filename);
void get_partial_callsign(char *call1, char *call2, char *partial);
bool plain_number(char *str);

#endif /* UTILS_H */
1 change: 1 addition & 0 deletions test/test_recallexchange.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

// OBJECT ../src/recall_exchange.o
// OBJECT ../src/initial_exchange.o
// OBJECT ../src/utils.o

contest_config_t config_any = {
.id = 123,
Expand Down
15 changes: 14 additions & 1 deletion tlf.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -3075,7 +3075,20 @@ Multiplier is DXCC country or section from multiplier file.
.B RECALL_MULTS
Exchange can be recycled, will be filled into exchange field when it is known
(see also
.BR INITIAL_EXCHANGE ).
.BR INITIAL_EXCHANGE
and
.BR RECALL_NUMERIC_EXCHANGES ).
.
.TP
\fBRECALL_NUMERIC_EXCHANGES\fR[=<\fION\fR|\fIOFF\fR>]
Controls whether all-numeric exchanges (like serial or zone number) shall be
recalled when using
.BR RECALL_MULTS .
Default is \fION\fR, meaning that numeric exchanges are also recalled.
If set to \fIOFF\fR then numeric exchanges are not recalled.
This setting can be useful in contests where
a group of stations send fixed non-numeric exchanges
(county or DOK, for example) and the rest sent serial number.
.
.TP
\fBINITIAL_EXCHANGE\fR=\fIexchanges.txt\fR
Expand Down