Parse QR codes without using Param

Param should only be used to parse dictionaries stored in SQL database, not external data.

Since Param parser has been extended to escape newlines with newlines, QR-codes parser started to treat && as escaped &, which is wrong.

This change also uses String keys like "n" for "name" instead of completely unrelated constants like Param::SetLongitude.
This commit is contained in:
link2xt
2021-02-03 04:58:51 +03:00
committed by link2xt
parent 5ee4bb58cd
commit 6bb0c164f9
2 changed files with 33 additions and 32 deletions

View File

@@ -127,15 +127,6 @@ pub enum Param {
/// For Chats
Devicetalk = b'D',
/// For QR
Auth = b's',
/// For QR
GroupId = b'x',
/// For QR
GroupName = b'g',
/// For MDN-sending job
MsgId = b'I',
}
@@ -431,14 +422,6 @@ mod tests {
assert_eq!(params.to_string().parse::<Params>().unwrap(), params);
}
#[test]
fn test_regression() {
let p1: Params = "a=cli%40deltachat.de\nn=\ni=TbnwJ6lSvD5\ns=0ejvbdFSQxB"
.parse()
.unwrap();
assert_eq!(p1.get(Param::Forwarded).unwrap(), "cli%40deltachat.de");
}
#[async_std::test]
async fn test_params_file_fs_path() {
let t = TestContext::new().await;