From 0d35f8874a3b7b746a2f1e502b2834981e7ef0ee Mon Sep 17 00:00:00 2001
From: Athanasius <github@miggy.org>
Date: Wed, 5 Oct 2022 15:29:11 +0100
Subject: [PATCH] config/EDDN: Rename OUT_MKT_EDDN to
 OUT_EDDN_SEND_STATION_DATA

This flag controls whether commodity, outfitting or shipyard schema messages
are sent.  Thus 'MKT' ('market') is misleading.  Rename it so the intent when
used is clear.
---
 EDMarketConnector.py |  2 +-
 config/__init__.py   |  4 ++--
 plugins/eddn.py      | 13 +++++++------
 prefs.py             |  2 +-
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/EDMarketConnector.py b/EDMarketConnector.py
index 283c3bf5..041f7331 100755
--- a/EDMarketConnector.py
+++ b/EDMarketConnector.py
@@ -922,7 +922,7 @@ class AppWindow(object):
                     return False
 
             # Ignore possibly missing shipyard info
-            elif (config.get_int('output') & config.OUT_MKT_EDDN) \
+            elif (config.get_int('output') & config.OUT_EDDN_SEND_STATION_DATA) \
                     and not (data['lastStarport'].get('commodities') or data['lastStarport'].get('modules')):
                 if not self.status['text']:
                     # LANG: Status - Either no market or no modules data for station from Frontier CAPI
diff --git a/config/__init__.py b/config/__init__.py
index d57412c4..98056504 100644
--- a/config/__init__.py
+++ b/config/__init__.py
@@ -162,7 +162,7 @@ def appversion_nobuild() -> semantic_version.Version:
 class AbstractConfig(abc.ABC):
     """Abstract root class of all platform specific Config implementations."""
 
-    OUT_MKT_EDDN = 1
+    OUT_EDDN_SEND_STATION_DATA = 1
     # OUT_MKT_BPC = 2	# No longer supported
     OUT_MKT_TD = 4
     OUT_MKT_CSV = 8
@@ -171,7 +171,7 @@ class AbstractConfig(abc.ABC):
     # OUT_SYS_FILE = 32	# No longer supported
     # OUT_STAT = 64	# No longer available
     # OUT_SHIP_CORIOLIS = 128	# Replaced by OUT_SHIP
-    OUT_STATION_ANY = OUT_MKT_EDDN | OUT_MKT_TD | OUT_MKT_CSV
+    OUT_STATION_ANY = OUT_EDDN_SEND_STATION_DATA | OUT_MKT_TD | OUT_MKT_CSV
     # OUT_SYS_EDSM = 256  # Now a plugin
     # OUT_SYS_AUTO = 512  # Now always automatic
     OUT_MKT_MANUAL = 1024
diff --git a/plugins/eddn.py b/plugins/eddn.py
index ab7e7ef9..b0f28a27 100644
--- a/plugins/eddn.py
+++ b/plugins/eddn.py
@@ -1824,7 +1824,7 @@ def plugin_prefs(parent, cmdr: str, is_beta: bool) -> Frame:
     BUTTONX = 12  # noqa: N806 # indent Checkbuttons and Radiobuttons
 
     if prefsVersion.shouldSetDefaults('0.0.0.0', not bool(config.get_int('output'))):
-        output: int = (config.OUT_MKT_EDDN | config.OUT_EDDN_SEND_NON_STATION)  # default settings
+        output: int = (config.OUT_EDDN_SEND_STATION_DATA | config.OUT_EDDN_SEND_NON_STATION)  # default settings
 
     else:
         output = config.get_int('output')
@@ -1839,7 +1839,7 @@ def plugin_prefs(parent, cmdr: str, is_beta: bool) -> Frame:
         underline=True
     ).grid(padx=PADX, sticky=tk.W)  # Don't translate
 
-    this.eddn_station = tk.IntVar(value=(output & config.OUT_MKT_EDDN) and 1)
+    this.eddn_station = tk.IntVar(value=(output & config.OUT_EDDN_SEND_STATION_DATA) and 1)
     this.eddn_station_button = nb.Checkbutton(
         eddnframe,
         # LANG: Enable EDDN support for station data checkbox label
@@ -1895,7 +1895,7 @@ def prefs_changed(cmdr: str, is_beta: bool) -> None:
         'output',
         (config.get_int('output')
          & (config.OUT_MKT_TD | config.OUT_MKT_CSV | config.OUT_SHIP | config.OUT_MKT_MANUAL)) +
-        (this.eddn_station.get() and config.OUT_MKT_EDDN) +
+        (this.eddn_station.get() and config.OUT_EDDN_SEND_STATION_DATA) +
         (this.eddn_system.get() and config.OUT_EDDN_SEND_NON_STATION) +
         (this.eddn_delay.get() and config.OUT_EDDN_DO_NOT_DELAY)
     )
@@ -2208,11 +2208,12 @@ def journal_entry(  # noqa: C901, CCR001
             return _("Error: Can't connect to EDDN")  # LANG: Error while trying to send data to EDDN
 
         except Exception as e:
+            return
             logger.debug('Failed in export_journal_entry', exc_info=e)
             return str(e)
 
-    elif (config.get_int('output') & config.OUT_MKT_EDDN and not state['Captain'] and
-            event_name in ('market', 'outfitting', 'shipyard')):
+    elif (config.get_int('output') & config.OUT_EDDN_SEND_STATION_DATA and not state['Captain'] and
+          event_name in ('market', 'outfitting', 'shipyard')):
         # Market.json, Outfitting.json or Shipyard.json to process
 
         try:
@@ -2263,7 +2264,7 @@ def cmdr_data(data: CAPIData, is_beta: bool) -> Optional[str]:  # noqa: CCR001
     :return: str - Error message, or `None` if no errors.
     """
     if (data['commander'].get('docked') or (this.on_foot and monitor.station)
-            and config.get_int('output') & config.OUT_MKT_EDDN):
+            and config.get_int('output') & config.OUT_EDDN_SEND_STATION_DATA):
         try:
             if this.marketId != data['lastStarport']['id']:
                 this.commodities = this.outfitting = this.shipyard = None
diff --git a/prefs.py b/prefs.py
index d2fb69b0..dd52c78b 100644
--- a/prefs.py
+++ b/prefs.py
@@ -1221,7 +1221,7 @@ class PreferencesDialog(tk.Toplevel):
             (self.out_csv.get() and config.OUT_MKT_CSV) +
             (config.OUT_MKT_MANUAL if not self.out_auto.get() else 0) +
             (self.out_ship.get() and config.OUT_SHIP) +
-            (config.get_int('output') & (config.OUT_MKT_EDDN | config.OUT_EDDN_SEND_NON_STATION | config.OUT_EDDN_DO_NOT_DELAY))
+            (config.get_int('output') & (config.OUT_EDDN_SEND_STATION_DATA | config.OUT_EDDN_SEND_NON_STATION | config.OUT_EDDN_DO_NOT_DELAY))
         )
 
         config.set(