summary refs log tree commit diff
path: root/synapse/storage/directory.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-10-17 21:02:16 +0100
committerErik Johnston <erik@matrix.org>2014-10-17 21:02:16 +0100
commit449739e6a364759a86f73417626af49d6a794e3d (patch)
tree04b2f39c91ec6098ffe3b380442787ac3ce2908f /synapse/storage/directory.py
parentMerge branch 'release-v0.3.4' of github.com:matrix-org/synapse (diff)
parentCheck that we have auth headers and fail nicely (diff)
downloadsynapse-449739e6a364759a86f73417626af49d6a794e3d.tar.xz
Merge branch 'release-v0.4.0' of github.com:matrix-org/synapse
Diffstat (limited to 'synapse/storage/directory.py')
-rw-r--r--synapse/storage/directory.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/synapse/storage/directory.py b/synapse/storage/directory.py
index 540eb4c2c4..52373a28a6 100644
--- a/synapse/storage/directory.py
+++ b/synapse/storage/directory.py
@@ -93,6 +93,36 @@ class DirectoryStore(SQLBaseStore):
                 }
             )
 
+    def delete_room_alias(self, room_alias):
+        return self.runInteraction(
+            self._delete_room_alias_txn,
+            room_alias,
+        )
+
+    def _delete_room_alias_txn(self, txn, room_alias):
+        cursor = txn.execute(
+            "SELECT room_id FROM room_aliases WHERE room_alias = ?",
+            (room_alias.to_string(),)
+        )
+
+        res = cursor.fetchone()
+        if res:
+            room_id = res[0]
+        else:
+            return None
+
+        txn.execute(
+            "DELETE FROM room_aliases WHERE room_alias = ?",
+            (room_alias.to_string(),)
+        )
+
+        txn.execute(
+            "DELETE FROM room_alias_servers WHERE room_alias = ?",
+            (room_alias.to_string(),)
+        )
+
+        return room_id
+
     def get_aliases_for_room(self, room_id):
         return self._simple_select_onecol(
             "room_aliases",