summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-04-01 10:16:13 +0100
committerErik Johnston <erik@matrix.org>2019-04-01 15:23:01 +0100
commit1666c0696a8891d39fd308e38e1b9b0042cabe34 (patch)
tree8e31b63f8fc789e27610e561ed1b1522cf45f497 /synapse/handlers
parentMerge pull request #4968 from Jurrie/feature/fix_small_stuff_in_Docker_README.md (diff)
downloadsynapse-1666c0696a8891d39fd308e38e1b9b0042cabe34.tar.xz
Track IS used to bind 3PIDs
This will then be used to know which IS to default to when unbinding the
threepid.
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/identity.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/synapse/handlers/identity.py b/synapse/handlers/identity.py
index 39184f0e22..cc480301ac 100644
--- a/synapse/handlers/identity.py
+++ b/synapse/handlers/identity.py
@@ -132,6 +132,14 @@ class IdentityHandler(BaseHandler):
                 }
             )
             logger.debug("bound threepid %r to %s", creds, mxid)
+
+            # Remember where we bound the threepid
+            yield self.store.add_user_bound_threepid(
+                user_id=mxid,
+                medium=data["medium"],
+                address=data["address"],
+                id_server=id_server,
+            )
         except CodeMessageException as e:
             data = json.loads(e.msg)  # XXX WAT?
         defer.returnValue(data)
@@ -188,6 +196,13 @@ class IdentityHandler(BaseHandler):
                 content,
                 headers,
             )
+
+            yield self.store.remove_user_bound_threepid(
+                user_id=mxid,
+                medium=threepid["medium"],
+                address=threepid["address"],
+                id_server=id_server,
+            )
         except HttpResponseException as e:
             if e.code in (400, 404, 501,):
                 # The remote server probably doesn't support unbinding (yet)