dup-check

* Add 'possible dup' to logic and apply corresponding
      - possible dup color
      - dup color
    to CALL controls
  * Separate N3FJP duplicate query from response
    - response time was a part of keyboard input processing
This commit is contained in:
David Freese 2019-02-14 08:47:27 -06:00
parent 57cc6eaf2c
commit ce586b89e9
14 changed files with 182 additions and 103 deletions

View file

@ -1044,6 +1044,22 @@ o->redraw();
progdefaults.changed = true;
}
Fl_Button *btnPossibleDupColor=(Fl_Button *)0;
static void cb_btnPossibleDupColor(Fl_Button* o, void*) {
fl_color_chooser("Possible_Dup Check",
progdefaults.possible_dup_color.R,
progdefaults.possible_dup_color.G,
progdefaults.possible_dup_color.B);
o->color(
fl_rgb_color(
progdefaults.possible_dup_color.R,
progdefaults.possible_dup_color.G,
progdefaults.possible_dup_color.B));
o->redraw();
progdefaults.changed = true;
}
Fl_Check_Button *btnDupXchg1=(Fl_Check_Button *)0;
static void cb_btnDupXchg1(Fl_Check_Button* o, void*) {
@ -8178,7 +8194,6 @@ Fl_Double_Window* ConfigureDialog() {
{ tabOperator = new Fl_Group(0, 25, 600, 365, _("Operator"));
tabOperator->callback((Fl_Callback*)cb_tabOperator);
tabOperator->when(FL_WHEN_CHANGED);
tabOperator->hide();
{ Fl_Group* o = new Fl_Group(5, 35, 590, 285, _("Station / Operator"));
o->box(FL_ENGRAVED_FRAME);
o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
@ -8330,10 +8345,10 @@ Fl_Double_Window* ConfigureDialog() {
tabOperator->end();
} // Fl_Group* tabOperator
{ tabUI = new Fl_Group(0, 25, 604, 365, _("UI"));
tabUI->hide();
{ tabsUI = new Fl_Tabs(0, 25, 604, 365);
tabsUI->selection_color(FL_LIGHT1);
{ tabBrowser = new Fl_Group(0, 50, 600, 340, _("Browser"));
tabBrowser->hide();
{ Fl_Group* o = new Fl_Group(30, 65, 540, 300);
o->box(FL_ENGRAVED_FRAME);
{ Fl_Spinner2* o = cntChannels = new Fl_Spinner2(46, 75, 50, 24, _("Channels, first channel starts at waterfall lower limit"));
@ -8897,6 +8912,7 @@ ab and newline are automatically included."));
tabLogServer->end();
} // Fl_Group* tabLogServer
{ tabLogContests = new Fl_Group(0, 50, 604, 340, _("Contests"));
tabLogContests->hide();
{ tabs_contests = new Fl_Tabs(0, 50, 604, 340);
{ grpGeneral_contest = new Fl_Group(0, 75, 600, 315, _("General"));
{ Fl_ListBox* o = listbox_contest = new Fl_ListBox(86, 84, 500, 24, _("Contest"));
@ -8944,34 +8960,34 @@ ab and newline are automatically included."));
inp_contest_notes->when(FL_WHEN_RELEASE);
o->value(progdefaults.CONTESTnotes.c_str());
} // Fl_Input2* inp_contest_notes
{ Fl_Group* o = new Fl_Group(3, 192, 590, 83, _("Duplicate check, CALL plus"));
{ Fl_Group* o = new Fl_Group(3, 192, 590, 86, _("Duplicate check, CALL plus"));
o->box(FL_ENGRAVED_FRAME);
o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
{ Fl_Light_Button* o = btnDupCheckOn = new Fl_Light_Button(68, 217, 74, 20, _("On/Off"));
{ Fl_Light_Button* o = btnDupCheckOn = new Fl_Light_Button(20, 217, 74, 20, _("On/Off"));
btnDupCheckOn->tooltip(_("Check for duplicates"));
btnDupCheckOn->selection_color((Fl_Color)2);
btnDupCheckOn->callback((Fl_Callback*)cb_btnDupCheckOn);
o->value(progdefaults.EnableDupCheck);
} // Fl_Light_Button* btnDupCheckOn
{ Fl_Check_Button* o = btnDupBand = new Fl_Check_Button(173, 217, 70, 20, _("Band"));
{ Fl_Check_Button* o = btnDupBand = new Fl_Check_Button(132, 217, 70, 20, _("Band"));
btnDupBand->tooltip(_("Bands must match"));
btnDupBand->down_box(FL_DOWN_BOX);
btnDupBand->callback((Fl_Callback*)cb_btnDupBand);
o->value(progdefaults.dupband);
} // Fl_Check_Button* btnDupBand
{ Fl_Check_Button* o = btnDupMode = new Fl_Check_Button(293, 217, 70, 20, _("Mode"));
{ Fl_Check_Button* o = btnDupMode = new Fl_Check_Button(245, 217, 70, 20, _("Mode"));
btnDupMode->tooltip(_("Mode must match"));
btnDupMode->down_box(FL_DOWN_BOX);
btnDupMode->callback((Fl_Callback*)cb_btnDupMode);
o->value(progdefaults.dupmode);
} // Fl_Check_Button* btnDupMode
{ Fl_Check_Button* o = btnDupTimeSpan = new Fl_Check_Button(408, 217, 129, 20, _("Time span over"));
{ Fl_Check_Button* o = btnDupTimeSpan = new Fl_Check_Button(370, 217, 129, 20, _("Time span over"));
btnDupTimeSpan->tooltip(_("QSO must not occur within a time period of"));
btnDupTimeSpan->down_box(FL_DOWN_BOX);
btnDupTimeSpan->callback((Fl_Callback*)cb_btnDupTimeSpan);
o->value(progdefaults.duptimespan);
} // Fl_Check_Button* btnDupTimeSpan
{ Fl_Button* o = btnDupColor = new Fl_Button(68, 244, 90, 24, _("Dup Color"));
{ Fl_Button* o = btnDupColor = new Fl_Button(20, 244, 90, 24, _("Dup Color"));
btnDupColor->tooltip(_("Left click to select dup color"));
btnDupColor->box(FL_DOWN_BOX);
btnDupColor->down_box(FL_DOWN_BOX);
@ -8980,19 +8996,28 @@ ab and newline are automatically included."));
btnDupColor->callback((Fl_Callback*)cb_btnDupColor);
o->color(fl_rgb_color(progdefaults.dup_color.R, progdefaults.dup_color.G, progdefaults.dup_color.B));
} // Fl_Button* btnDupColor
{ Fl_Check_Button* o = btnDupXchg1 = new Fl_Check_Button(173, 246, 105, 20, _("Exchange In"));
{ Fl_Button* o = btnPossibleDupColor = new Fl_Button(132, 244, 90, 24, _("? Dup Color"));
btnPossibleDupColor->tooltip(_("Left click to select possible dup color"));
btnPossibleDupColor->box(FL_DOWN_BOX);
btnPossibleDupColor->down_box(FL_DOWN_BOX);
btnPossibleDupColor->color(FL_BACKGROUND2_COLOR);
btnPossibleDupColor->selection_color(FL_BACKGROUND2_COLOR);
btnPossibleDupColor->callback((Fl_Callback*)cb_btnPossibleDupColor);
o->color(fl_rgb_color(progdefaults.possible_dup_color.R, progdefaults.possible_dup_color.G, progdefaults.possible_dup_color.B));
} // Fl_Button* btnPossibleDupColor
{ Fl_Check_Button* o = btnDupXchg1 = new Fl_Check_Button(245, 246, 105, 20, _("Exchange In"));
btnDupXchg1->tooltip(_("free form 1 must match"));
btnDupXchg1->down_box(FL_DOWN_BOX);
btnDupXchg1->callback((Fl_Callback*)cb_btnDupXchg1);
o->value(progdefaults.dupxchg1);
} // Fl_Check_Button* btnDupXchg1
{ Fl_Check_Button* o = btnDupState = new Fl_Check_Button(293, 246, 70, 20, _("State"));
{ Fl_Check_Button* o = btnDupState = new Fl_Check_Button(370, 246, 70, 20, _("State"));
btnDupState->tooltip(_("State must match"));
btnDupState->down_box(FL_DOWN_BOX);
btnDupState->callback((Fl_Callback*)cb_btnDupState);
o->value(progdefaults.dupstate);
} // Fl_Check_Button* btnDupState
{ Fl_Value_Input2* o = nbrTimeSpan = new Fl_Value_Input2(408, 244, 53, 24, _("minutes"));
{ Fl_Value_Input2* o = nbrTimeSpan = new Fl_Value_Input2(463, 244, 53, 24, _("minutes"));
nbrTimeSpan->tooltip(_("Enter time span in minutes"));
nbrTimeSpan->box(FL_DOWN_BOX);
nbrTimeSpan->color(FL_BACKGROUND2_COLOR);
@ -10346,6 +10371,7 @@ i on a\ntouch screen device such as a tablet."));
tabWaterfall->end();
} // Fl_Group* tabWaterfall
{ tabModems = new Fl_Group(0, 25, 609, 365, _("Modems"));
tabModems->hide();
{ tabsModems = new Fl_Tabs(0, 25, 609, 365);
tabsModems->selection_color(FL_LIGHT1);
tabsModems->align(Fl_Align(FL_ALIGN_TOP_RIGHT));

View file

@ -432,15 +432,15 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
static const char szProsigns[] = "~|%|&|+|=|{|}|<|>|[|]| ";} {}
Fl_Window {} {
label {Fldigi configuration} open
xywh {84 40 600 425} type Double color 45 selection_color 51 labelsize 18 align 80 non_modal visible
xywh {507 54 600 425} type Double color 45 selection_color 51 labelsize 18 align 80 non_modal visible
} {
Fl_Tabs tabsConfigure {open
xywh {0 0 609 390} color 50 selection_color 50
} {
Fl_Group tabOperator {
label Operator
callback {progdefaults.changed = true;} open
xywh {0 25 600 365} when 1 hide
callback {progdefaults.changed = true;} open selected
xywh {0 25 600 365} when 1
} {
Fl_Group {} {
label {Station / Operator} open
@ -566,14 +566,14 @@ progdefaults.changed = true;} open
}
Fl_Group tabUI {
label UI open
xywh {0 25 604 365}
xywh {0 25 604 365} hide
} {
Fl_Tabs tabsUI {open
xywh {0 25 604 365} selection_color 50
} {
Fl_Group tabBrowser {
label Browser open
xywh {0 50 600 340} hide
xywh {0 50 600 340}
} {
Fl_Group {} {open
xywh {30 65 540 300} box ENGRAVED_FRAME
@ -1224,7 +1224,7 @@ progdefaults.changed = true;}
}
Fl_Group tabLogContests {
label Contests open
xywh {0 50 604 340}
xywh {0 50 604 340} hide
} {
Fl_Tabs tabs_contests {open
xywh {0 50 604 340}
@ -1247,7 +1247,7 @@ inp_contest_notes->value(progdefaults.CONTESTnotes.c_str());
UI_select();
clear_log_fields();
clearQSO();
progdefaults.changed = true;} open selected
progdefaults.changed = true;} open
tooltip {Select Logging as QSO or Contest} xywh {86 84 500 24} box DOWN_BOX color 7 align 4
code0 {\#include "contest.h"}
code1 {o->add(contest_names().c_str());}
@ -1284,34 +1284,34 @@ progdefaults.changed = true;} open
}
Fl_Group {} {
label {Duplicate check, CALL plus} open
xywh {3 192 590 83} box ENGRAVED_FRAME align 21
xywh {3 192 590 86} box ENGRAVED_FRAME align 21
} {
Fl_Light_Button btnDupCheckOn {
label {On/Off}
callback {progdefaults.EnableDupCheck = o->value();
progdefaults.changed = true;}
tooltip {Check for duplicates} xywh {68 217 74 20} selection_color 2
tooltip {Check for duplicates} xywh {20 217 74 20} selection_color 2
code0 {o->value(progdefaults.EnableDupCheck);}
}
Fl_Check_Button btnDupBand {
label Band
callback {progdefaults.dupband = o->value();
progdefaults.changed = true;}
tooltip {Bands must match} xywh {173 217 70 20} down_box DOWN_BOX
tooltip {Bands must match} xywh {132 217 70 20} down_box DOWN_BOX
code0 {o->value(progdefaults.dupband);}
}
Fl_Check_Button btnDupMode {
label Mode
callback {progdefaults.dupmode = o->value();
progdefaults.changed = true;}
tooltip {Mode must match} xywh {293 217 70 20} down_box DOWN_BOX
tooltip {Mode must match} xywh {245 217 70 20} down_box DOWN_BOX
code0 {o->value(progdefaults.dupmode);}
}
Fl_Check_Button btnDupTimeSpan {
label {Time span over}
callback {progdefaults.duptimespan=(int)o->value();
progdefaults.changed = true;}
tooltip {QSO must not occur within a time period of} xywh {408 217 129 20} down_box DOWN_BOX
tooltip {QSO must not occur within a time period of} xywh {370 217 129 20} down_box DOWN_BOX
code0 {o->value(progdefaults.duptimespan);}
}
Fl_Button btnDupColor {
@ -1327,29 +1327,46 @@ o->color(
progdefaults.dup_color.B));
o->redraw();
progdefaults.changed = true;}
tooltip {Left click to select dup color} xywh {68 244 90 24} box DOWN_BOX down_box DOWN_BOX color 7 selection_color 7
tooltip {Left click to select dup color} xywh {20 244 90 24} box DOWN_BOX down_box DOWN_BOX color 7 selection_color 7
code0 {o->color(fl_rgb_color(progdefaults.dup_color.R, progdefaults.dup_color.G, progdefaults.dup_color.B));}
code1 {\#include <FL/Fl_Color_Chooser.H>}
}
Fl_Button btnPossibleDupColor {
label {? Dup Color}
callback {fl_color_chooser("Possible_Dup Check",
progdefaults.possible_dup_color.R,
progdefaults.possible_dup_color.G,
progdefaults.possible_dup_color.B);
o->color(
fl_rgb_color(
progdefaults.possible_dup_color.R,
progdefaults.possible_dup_color.G,
progdefaults.possible_dup_color.B));
o->redraw();
progdefaults.changed = true;}
tooltip {Left click to select possible dup color} xywh {132 244 90 24} box DOWN_BOX down_box DOWN_BOX color 7 selection_color 7
code0 {o->color(fl_rgb_color(progdefaults.possible_dup_color.R, progdefaults.possible_dup_color.G, progdefaults.possible_dup_color.B));}
code1 {\#include <FL/Fl_Color_Chooser.H>}
}
Fl_Check_Button btnDupXchg1 {
label {Exchange In}
callback {progdefaults.dupxchg1 = o->value();
progdefaults.changed = true;}
tooltip {free form 1 must match} xywh {173 246 105 20} down_box DOWN_BOX
tooltip {free form 1 must match} xywh {245 246 105 20} down_box DOWN_BOX
code0 {o->value(progdefaults.dupxchg1);}
}
Fl_Check_Button btnDupState {
label State
callback {progdefaults.dupstate = o->value();
progdefaults.changed = true;}
tooltip {State must match} xywh {293 246 70 20} down_box DOWN_BOX
tooltip {State must match} xywh {370 246 70 20} down_box DOWN_BOX
code0 {o->value(progdefaults.dupstate);}
}
Fl_Value_Input nbrTimeSpan {
label minutes
callback {progdefaults.timespan = (int)o->value();
progdefaults.changed = true;}
tooltip {Enter time span in minutes} xywh {408 244 53 24} align 8 maximum 1440 step 1 value 120
tooltip {Enter time span in minutes} xywh {463 244 53 24} align 8 maximum 1440 step 1 value 120
code0 {o->value(progdefaults.timespan);}
class Fl_Value_Input2
}
@ -3560,7 +3577,7 @@ progdefaults.changed = true;}
}
Fl_Group tabModems {
label Modems open
xywh {0 25 609 365}
xywh {0 25 609 365} hide
} {
Fl_Tabs tabsModems {open
xywh {0 25 609 365} selection_color 50 align 9
@ -6135,7 +6152,7 @@ WKFSK_init();} open
Fl_Group sel_WKFSK_monitor {
label Echo
callback {progStatus.WKFSK_monitor = o->index();
WKFSK_init();} open selected
WKFSK_init();} open
tooltip {Unshift on space} xywh {380 266 78 23} box DOWN_BOX color 7 align 4 when 1
code0 {o->add("Off|On");}
code1 {o->index(progStatus.WKFSK_monitor);}

View file

@ -134,6 +134,7 @@ extern Fl_Check_Button *btnDupMode;
extern Fl_Check_Button *btnDupTimeSpan;
#include <FL/Fl_Color_Chooser.H>
extern Fl_Button *btnDupColor;
extern Fl_Button *btnPossibleDupColor;
extern Fl_Check_Button *btnDupXchg1;
extern Fl_Check_Button *btnDupState;
extern Fl_Value_Input2 *nbrTimeSpan;

View file

@ -1531,6 +1531,9 @@
ELEM_(RGB, dup_color, "dupcolor", \
"Callsign background color when duplicate detected", \
{255, 110, 180}) \
ELEM_(RGB, possible_dup_color, "duppossiblecolor", \
"Callsign background color when possible duplicate detected", \
{255, 255, 150}) \
ELEM_(bool, EnableDupCheck, "ENABLEDUPCHECK", \
"Check for duplicates (contest)", \
true) \

View file

@ -35,7 +35,7 @@ extern void FD_add_record();
extern void FD_mode_check();
extern void FD_band_check();
extern bool FD_dupcheck();
extern int FD_dupcheck();
extern bool FD_connected;
extern bool FD_logged_on;

View file

@ -526,7 +526,7 @@ extern void updateOutSerNo();
extern void connect_to_log_server(void *p = NULL);
extern void set_server_label(bool);
extern void activate_menu_item(const char *caption, bool val);
extern bool xml_check_dup();
extern int xml_check_dup();
extern bool xml_get_record(const char *);
extern const char* zdate(void);

View file

@ -117,6 +117,7 @@ extern void DisplayRecord (int idxRec);
extern void SearchLastQSO (const char *);
extern cQsoRec* SearchLog(const char *callsign);
extern void DupCheck();
extern void show_dup(void *);
extern void cb_search(Fl_Widget* w, void*);
extern int log_search_handler(int);
extern void reload_browser();

View file

@ -14,7 +14,7 @@ extern void n3fjp_start();
extern void n3fjp_restart();
extern void n3fjp_close(void);
extern bool n3fjp_dupcheck();
extern int n3fjp_dupcheck();
extern void n3fjp_add_record(cQsoRec &rec);
extern void n3fjp_get_record(string rec);
extern void n3fjp_set_freq(long f);

View file

@ -115,13 +115,20 @@ public:
void sort_reverse(bool rev) { reverse = rev;}
const cQsoRec *recarray() { return qsorec; }
bool duplicate(
int duplicate(
const char *callsign,
const char *date, const char *time, unsigned int interval, bool chkdatetime,
const char *freq, bool chkfreq,
const char *state, bool chkstate,
const char *mode, bool chkmode,
const char *xchg1, bool chkxchg1 );
const char *date = NULL,
const char *time = NULL,
unsigned int interval = 0,
bool chkdatetime = false,
const char *freq = NULL,
bool chkfreq = false,
const char *state = NULL,
bool chkstate = false,
const char *mode = NULL,
bool chkmode = false,
const char *xchg1 = NULL,
bool chkxchg1 = false);
int matched( cQsoRec *rec );
};

View file

@ -403,10 +403,10 @@ static string FD_opband()
//======================================================================
//
//======================================================================
bool FD_dupcheck()
int FD_dupcheck()
{
if(!FD_socket) return false;
if (!FD_connected) return false;
if(!FD_socket) return 0;
if (!FD_connected) return 0;
string response;
string cmd = "DUPCHECK ";
@ -417,17 +417,17 @@ bool FD_dupcheck()
MilliSleep(50);
FD_socket->recv(response);
if (response.empty())
return false;
return 0;
if (response.find("NODUP") != string::npos)
return false;
return 0;
if (response.find("DUP") != string::npos)
return true;
return false;
return 1;
return 0;
} catch (const SocketException& e) {
LOG_ERROR("Error %d, %s", e.error(), e.what());
FD_exit = true;
}
return false;
return 0;
}
//======================================================================

View file

@ -1317,35 +1317,25 @@ void cb_SortByFreq (void) {
loadBrowser();
}
void DupCheck()
void show_dup(void *dup)
{
int cdup = 0;
if (dup == (void *)1) cdup = 1;
if (dup == (void *)2) cdup = 2;
Fl_Color call_clr = progdefaults.LOGGINGcolor;
Fl_Color dup_clr = fl_rgb_color(
progdefaults.dup_color.R,
progdefaults.dup_color.G,
progdefaults.dup_color.B);
bool dup = false;
if (n3fjp_connected)
dup = n3fjp_dupcheck();
else if ( FD_logged_on && strlen(inpCall->value()) > 2)
dup = FD_dupcheck();
else if ( progdefaults.xml_logbook)
dup = xml_check_dup();
else if ( !progdefaults.xml_logbook && qsodb.duplicate(
inpCall->value(),
zdate(), ztime(), progdefaults.timespan, progdefaults.duptimespan,
inpFreq->value(), progdefaults.dupband,
inpState->value(), progdefaults.dupstate,
mode_info[active_modem->get_mode()].adif_name, progdefaults.dupmode,
inpXchgIn->value(), progdefaults.dupxchg1 ) )
dup = true;
inpCall1->color(dup ? dup_clr : call_clr);
inpCall2->color(dup ? dup_clr : call_clr);
inpCall3->color(dup ? dup_clr : call_clr);
inpCall4->color(dup ? dup_clr : call_clr);
Fl_Color pdup_clr = fl_rgb_color(
progdefaults.possible_dup_color.R,
progdefaults.possible_dup_color.G,
progdefaults.possible_dup_color.B);
inpCall1->color(cdup == 1 ? dup_clr : cdup == 2 ? pdup_clr : call_clr);
inpCall2->color(cdup == 1 ? dup_clr : cdup == 2 ? pdup_clr : call_clr);
inpCall3->color(cdup == 1 ? dup_clr : cdup == 2 ? pdup_clr : call_clr);
inpCall4->color(cdup == 1 ? dup_clr : cdup == 2 ? pdup_clr : call_clr);
inpCall1->redraw();
inpCall2->redraw();
@ -1353,6 +1343,35 @@ void DupCheck()
inpCall4->redraw();
}
void DupCheck()
{
size_t dup = 0;
if (n3fjp_connected) {
show_dup(0);
n3fjp_dupcheck();
return;
}
if ( FD_logged_on && strlen(inpCall->value()) > 2)
dup = FD_dupcheck();
else if ( progdefaults.xml_logbook)
dup = xml_check_dup();
else {
// check for call only for possible dup returns 2 if possible
dup = qsodb.duplicate(inpCall->value());
if (dup && qsodb.duplicate(
inpCall->value(),
zdate(), ztime(), progdefaults.timespan, progdefaults.duptimespan,
inpFreq->value(), progdefaults.dupband,
inpState->value(), progdefaults.dupstate,
mode_info[active_modem->get_mode()].adif_name, progdefaults.dupmode,
inpXchgIn->value(), progdefaults.dupxchg1 ) )
dup = 1;
}
show_dup((void*)dup);
}
cQsoRec* SearchLog(const char *callsign)
{
size_t len = strlen(callsign);

View file

@ -301,7 +301,6 @@ static string n3fjp_freq();
static void send_control(const string ctl, string val);
static void send_action(const string action);
static void send_command(const string command, string val="");
bool n3fjp_dupcheck();
static void send_data();
static void send_data_norig();
void get_n3fjp_frequency();
@ -2022,7 +2021,7 @@ static void check_log_data()
} catch (...) { throw; }
}
bool n3fjp_dupcheck()
int n3fjp_dupcheck()
{
guard_lock rx_lock(&n3fjp_mutex);
@ -2032,7 +2031,6 @@ bool n3fjp_dupcheck()
if ((chkcall.length() == 3) && isdigit(chkcall[2])) return false;
string cmd;
bool isdup = false;
try {
send_call(chkcall);
@ -2043,24 +2041,8 @@ bool n3fjp_dupcheck()
check_log_data();
send_action("CALLTAB");
string resp;
int count = 200;
while (count && resp.empty()) {
n3fjp_rcv(resp, progdefaults.enable_N3FJP_log);
count -= 10;
MilliSleep(10);
Fl::awake();
}
if (resp.find("CALLTABDUPEEVENT") != string::npos &&
resp.find("Duplicate") != string::npos &&
resp.find("Possible") == string::npos)
isdup = true;
} catch (...) { throw; }
return isdup;
return 0;
}
static void send_log_data()
@ -2362,6 +2344,14 @@ void n3fjp_parse_response(string tempbuff)
if (tempbuff.find("<NEXTSERIALNUMBERRESPONSE>") != string::npos) {
REQ(n3fjp_parse_next_serial, tempbuff);
}
if (tempbuff.find("CALLTABDUPEEVENT") != string::npos &&
tempbuff.find("Duplicate") != string::npos) {
if (tempbuff.find("Possible") != string::npos)
REQ(show_dup, (void*)2);
else
REQ(show_dup, (void*)1);
}
}
//======================================================================
@ -2691,7 +2681,7 @@ void *n3fjp_loop(void *args)
if (loopcount == 0)
if (!connect_to_n3fjp_server())
n3fjp_disconnect(false);
} else try {
} else try { // insure connection still up (2.5 second interval)
if (loopcount == 0) {
guard_lock send_lock(&send_this_mutex);
std::string buffer;

View file

@ -568,7 +568,7 @@ unsigned long cQsoDb::epoch_dt (const char *szdate, const char *sztime)
return doe*60*60*24 + secs;
}
bool cQsoDb::duplicate(
int cQsoDb::duplicate(
const char *callsign,
const char *szdate, const char *sztime, unsigned int interval, bool chkdatetime,
const char *freq, bool chkfreq,
@ -576,19 +576,33 @@ bool cQsoDb::duplicate(
const char *mode, bool chkmode,
const char *xchg1, bool chkxchg1 )
{
int f1, f2 = 0;
f1 = (int)(atof(freq)/1000.0);
bool b_freqDUP = true, b_stateDUP = true, b_modeDUP = true,
b_xchg1DUP = true,
b_dtimeDUP = true;
unsigned long datetime = epoch_dt(szdate, sztime);
unsigned long qsodatetime;
unsigned long datetime = 0L;
unsigned long qsodatetime = 0L;
int f1 = 0;
int f2 = 0;
int isdup = 0;
if (freq) f1 = (int)(atof(freq)/1000.0);
if (chkdatetime) datetime = epoch_dt(szdate, sztime);
for (int i = 0; i < nbrrecs; i++) {
if (strcasecmp(qsorec[i].getField(CALL), callsign) == 0) {
// found callsign duplicate
b_freqDUP = b_stateDUP = b_modeDUP =
b_xchg1DUP = b_dtimeDUP = false;
if (!chkdatetime && !chkfreq && !chkstate &&
!chkmode && !chkxchg1)
isdup = 2;
if (szdate == NULL)
return isdup;
b_freqDUP =
b_stateDUP =
b_modeDUP =
b_xchg1DUP =
b_dtimeDUP = false;
if (chkfreq) {
f2 = (int)atof(qsorec[i].getField(FREQ));
b_freqDUP = (f1 == f2);
@ -614,11 +628,11 @@ bool cQsoDb::duplicate(
(!chkmode || (chkmode && b_modeDUP)) &&
(!chkxchg1 || (chkxchg1 && b_xchg1DUP)) &&
(!chkdatetime || (chkdatetime && b_dtimeDUP))) {
return true;
isdup = 1;
}
}
}
return false;
return isdup;
}
// set epoch interval test to 15 * 60

View file

@ -323,8 +323,9 @@ std::cout << adif << std::endl;
}
bool xml_check_dup()
int xml_check_dup()
{
int dup_test = 0;
if (!test_connection()) {
LOG_INFO("%s","Logbook server down!");
progdefaults.xml_logbook = false;
@ -332,7 +333,7 @@ bool xml_check_dup()
activate_log_menus(true);
if (!dlgLogbook) create_logbook_dialogs();
start_logbook();
return false;
return dup_test;
}
XmlRpcValue six_args, result;
six_args[0] = inpCall->value();
@ -346,9 +347,9 @@ bool xml_check_dup()
if (log_client->execute("log.check_dup", six_args, result)) {
string res = std::string(result);
if (res == "true")
return true;
dup_test = 1;
}
return false;
return dup_test;
}