diff --git a/maps.py b/maps.py
index 75c93ee5a..8cd846c69 100644
--- a/maps.py
+++ b/maps.py
@@ -97,6 +97,26 @@ def _get_location_from_tags(tags: []) -> str:
return None
+def update_address_book(base_dir: str, nickname: str, domain: str,
+ location: str, address: str) -> None:
+ """Adds an address to the address book for the given account
+ """
+ address_book_filename = \
+ acct_dir(base_dir, nickname, domain) + '/addresses.json'
+ address_book_dict = {}
+ if os.path.isfile(address_book_filename):
+ address_book_dict2 = load_json(address_book_filename)
+ if address_book_dict2:
+ address_book_dict = address_book_dict2
+ address = remove_html(address)
+ if address_book_dict.get(location):
+ if address_book_dict[location] == address:
+ # already exists so we don't need to update
+ return
+ address_book_dict[location] = address
+ save_json(address_book_dict, address_book_filename)
+
+
def get_location_from_post(post_json_object: {}) -> str:
"""Returns the location for the given post
"""
diff --git a/webapp_post.py b/webapp_post.py
index fda9c62d2..7a9944cf7 100644
--- a/webapp_post.py
+++ b/webapp_post.py
@@ -125,6 +125,7 @@ from cwlists import add_cw_from_lists
from blocking import is_blocked
from blocking import sending_is_blocked2
from reaction import html_emoji_reactions
+from maps import update_address_book
from maps import html_open_street_map
from maps import set_map_preferences_coords
from maps import set_map_preferences_url
@@ -3188,6 +3189,11 @@ def individual_post_as_html(signing_priv_key_pem: str,
# if this is a location with an address then remove the address
if '