M hlog/contest/contest.h +2 -1
@@ 70,7 70,8 @@ extern void ui_current_dispatch(struct x
*/
extern int init_contact(struct xlua_state *lua, struct qso **qso, char *error,
size_t errlen);
-extern int save_qso_and_update_index(struct qso *qso, const char *source);
+extern int save_qso_and_update_index(struct qso *qso,
+ enum announce_qso_msg_src src);
/*
* callout box
M hlog/contest/save.c +24 -9
@@ 28,10 28,27 @@
#include "contest.h"
static void print_notification(enum announce_qso_msg_type type,
- const char *source, const char *uuid,
- struct str *call, struct str *mode,
- struct str *grid)
+ enum announce_qso_msg_src src,
+ const char *uuid, struct str *call,
+ struct str *mode, struct str *grid)
{
+ const char *source;
+
+ switch (src) {
+ case ANNOUNCE_QSO_SRC_ANNOUNCE:
+ source = "announcement";
+ break;
+ case ANNOUNCE_QSO_SRC_UI:
+ source = "ui";
+ break;
+ case ANNOUNCE_QSO_SRC_WSJTX:
+ source = "wsjtx";
+ break;
+ default:
+ source = "unknown";
+ break;
+ }
+
switch (type) {
case ANNOUNCE_QSO_NEW:
case ANNOUNCE_QSO_UPDATED: {
@@ 51,7 68,7 @@ static void print_notification(enum anno
str_putref(grid);
}
-int save_qso_and_update_index(struct qso *qso, const char *source)
+int save_qso_and_update_index(struct qso *qso, enum announce_qso_msg_src src)
{
struct qso_side *rx;
int ret;
@@ 69,16 86,14 @@ int save_qso_and_update_index(struct qso
}
/*
- * Let everyone know about the update
+ * Notify the local operator about the new contact
*/
- print_notification(ANNOUNCE_QSO_NEW, source, qso->uuid_str,
+ print_notification(ANNOUNCE_QSO_NEW, src, qso->uuid_str,
qso_get_station_call(rx),
qso_get_mode(rx),
qso_get_grid(rx));
- /* for now, fake the source */
- announce_publish_qso(ANNOUNCE_QSO_NEW, ANNOUNCE_QSO_SRC_ANNOUNCE,
- &qso->uuid);
+ announce_publish_qso(ANNOUNCE_QSO_NEW, src, &qso->uuid);
/*
* Now, update the index
M hlog/contest/ui-work.c +1 -1
@@ 136,7 136,7 @@ static void end_qso(struct xlua_state *l
/* TODO: check that we have a frequency */
- ret = save_qso_and_update_index(qso, "ui");
+ ret = save_qso_and_update_index(qso, ANNOUNCE_QSO_SRC_UI);
if (ret) {
snprintf(error, sizeof(error), "Failed to save QSO: %s",
xstrerror(ret));
M hlog/contest/wsjtx.c +1 -1
@@ 356,7 356,7 @@ static int log_qso(struct xlua_state *lu
/*
* Now, save the QSO.
*/
- ret = save_qso_and_update_index(qso, "wsjtx");
+ ret = save_qso_and_update_index(qso, ANNOUNCE_QSO_SRC_WSJTX);
err:
qso_putref(qso);