diff --git a/index.html b/index.html
new file mode 100644
index 0000000..8d00860
--- /dev/null
+++ b/index.html
@@ -0,0 +1,16499 @@
+
+
+
+
+ Main
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Internal/Api/LoginWithUsernameAndPassword/Api.elm b/src/Internal/Api/LoginWithUsernameAndPassword/Api.elm
index 5ae8f29..17d121d 100644
--- a/src/Internal/Api/LoginWithUsernameAndPassword/Api.elm
+++ b/src/Internal/Api/LoginWithUsernameAndPassword/Api.elm
@@ -232,6 +232,7 @@ loginWithUsernameAndPasswordV2 { deviceId, initialDeviceDisplayName, username, p
, refresh = Nothing
, value = out.accessToken
}
+ , E.RemovePasswordIfNecessary
, out.user
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|> E.Optional
@@ -283,6 +284,7 @@ loginWithUsernameAndPasswordV3 { deviceId, initialDeviceDisplayName, username, p
, refresh = Nothing
, value = out.accessToken
}
+ , E.RemovePasswordIfNecessary
, out.user
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|> E.Optional
@@ -334,6 +336,7 @@ loginWithUsernameAndPasswordV4 { deviceId, initialDeviceDisplayName, username, p
, refresh = Nothing
, value = out.accessToken
}
+ , E.RemovePasswordIfNecessary
, out.user
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|> E.Optional
@@ -389,6 +392,7 @@ loginWithUsernameAndPasswordV5 { deviceId, initialDeviceDisplayName, username, p
, refresh = Nothing
, value = out.accessToken
}
+ , E.RemovePasswordIfNecessary
, out.user
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|> E.Optional
@@ -445,6 +449,7 @@ loginWithUsernameAndPasswordV6 { deviceId, enableRefreshToken, initialDeviceDisp
, refresh = out.refreshToken
, value = out.accessToken
}
+ , E.RemovePasswordIfNecessary
, out.user
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|> E.Optional
@@ -501,6 +506,7 @@ loginWithUsernameAndPasswordV7 { deviceId, enableRefreshToken, initialDeviceDisp
, refresh = out.refreshToken
, value = out.accessToken
}
+ , E.RemovePasswordIfNecessary
, E.ContentUpdate (V.SetUser out.user)
, out.wellKnown
|> Maybe.map (.homeserver >> .baseUrl)
diff --git a/src/Matrix.elm b/src/Matrix.elm
index b9da8e7..0991107 100644
--- a/src/Matrix.elm
+++ b/src/Matrix.elm
@@ -57,6 +57,9 @@ type alias VaultUpdate =
Types.VaultUpdate
+{-| Adds a custom access token to the Vault. This can be done if no password is
+provided or known.
+-}
addAccessToken : String -> Vault -> Vault
addAccessToken token (Vault vault) =
Envelope.mapContext (\c -> { c | suggestedAccessToken = Just token }) vault
@@ -74,16 +77,18 @@ addAccessToken token (Vault vault) =
-}
fromUserId : String -> Maybe Vault
-fromUserId =
- User.fromString
- >> Maybe.map
+fromUserId uid =
+ uid
+ |> User.fromString
+ |> Maybe.map
(\u ->
Envelope.init
{ serverName = "https://" ++ User.domain u
- , content = Internal.init u
+ , content = Internal.init (Just u)
}
+ |> Envelope.mapContext (\c -> { c | username = Just uid })
)
- >> Maybe.map Vault
+ |> Maybe.map Vault
{-| Send a message event to a room.