Support addemoji links.
This commit is contained in:
parent
99b39069a4
commit
e3ae8957bb
@ -1116,8 +1116,9 @@ unique_ptr<LinkManager::InternalLink> LinkManager::parse_tg_link_query(Slice que
|
||||
return td::make_unique<InternalLinkDialogInvite>(PSTRING() << "tg:join?invite="
|
||||
<< url_encode(get_url_query_hash(true, url_query)));
|
||||
}
|
||||
} else if (path.size() == 1 && path[0] == "addstickers") {
|
||||
} else if (path.size() == 1 && (path[0] == "addstickers" || path[0] == "addemoji")) {
|
||||
// addstickers?set=<name>
|
||||
// addemoji?set=<name>
|
||||
if (has_arg("set")) {
|
||||
return td::make_unique<InternalLinkStickerSet>(get_arg("set"));
|
||||
}
|
||||
@ -1255,9 +1256,10 @@ unique_ptr<LinkManager::InternalLink> LinkManager::parse_t_me_link_query(Slice q
|
||||
<< url_encode(get_url_query_hash(false, url_query)));
|
||||
}
|
||||
}
|
||||
} else if (path[0] == "addstickers") {
|
||||
} else if (path[0] == "addstickers" || path[0] == "addemoji") {
|
||||
if (path.size() >= 2 && !path[1].empty()) {
|
||||
// /addstickers/<name>
|
||||
// /addemoji/<name>
|
||||
return td::make_unique<InternalLinkStickerSet>(path[1]);
|
||||
}
|
||||
} else if (path[0] == "setlanguage") {
|
||||
|
@ -585,6 +585,24 @@ TEST(Link, parse_internal_link) {
|
||||
parse_internal_link("tg:addstickers?set=abc%30ef", sticker_set("abc0ef"));
|
||||
parse_internal_link("tg://addstickers?set=", unknown_deep_link("tg://addstickers?set="));
|
||||
|
||||
parse_internal_link("t.me/addemoji?set=abcdef", nullptr);
|
||||
parse_internal_link("t.me/addemoji", nullptr);
|
||||
parse_internal_link("t.me/addemoji/", nullptr);
|
||||
parse_internal_link("t.me/addemoji//abcdef", nullptr);
|
||||
parse_internal_link("t.me/addemoji?/abcdef", nullptr);
|
||||
parse_internal_link("t.me/addemoji/?abcdef", nullptr);
|
||||
parse_internal_link("t.me/addemoji/#abcdef", nullptr);
|
||||
parse_internal_link("t.me/addemoji/abacaba", sticker_set("abacaba"));
|
||||
parse_internal_link("t.me/addemoji/aba%20aba", sticker_set("aba aba"));
|
||||
parse_internal_link("t.me/addemoji/123456a", sticker_set("123456a"));
|
||||
parse_internal_link("t.me/addemoji/12345678901", sticker_set("12345678901"));
|
||||
parse_internal_link("t.me/addemoji/123456", sticker_set("123456"));
|
||||
parse_internal_link("t.me/addemoji/123456/123123/12/31/a/s//21w/?asdas#test", sticker_set("123456"));
|
||||
|
||||
parse_internal_link("tg:addemoji?set=abcdef", sticker_set("abcdef"));
|
||||
parse_internal_link("tg:addemoji?set=abc%30ef", sticker_set("abc0ef"));
|
||||
parse_internal_link("tg://addemoji?set=", unknown_deep_link("tg://addemoji?set="));
|
||||
|
||||
parse_internal_link("t.me/confirmphone?hash=abc%30ef&phone=", nullptr);
|
||||
parse_internal_link("t.me/confirmphone/123456/123123/12/31/a/s//21w/?hash=abc%30ef&phone=123456789",
|
||||
phone_number_confirmation("abc0ef", "123456789"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user