Support videochat/livestream internal links.
This commit is contained in:
parent
5bb10b4bb3
commit
015d6cd92d
@ -768,9 +768,9 @@ unique_ptr<LinkManager::InternalLink> LinkManager::parse_tg_link_query(Slice que
|
|||||||
}
|
}
|
||||||
auto username = get_arg("domain");
|
auto username = get_arg("domain");
|
||||||
for (auto &arg : url_query.args_) {
|
for (auto &arg : url_query.args_) {
|
||||||
if (arg.first == "voicechat") {
|
if (arg.first == "voicechat" || arg.first == "videochat" || arg.first == "livestream") {
|
||||||
// resolve?domain=<username>&voicechat
|
// resolve?domain=<username>&videochat
|
||||||
// resolve?domain=<username>&voicechat=<invite_hash>
|
// resolve?domain=<username>&videochat=<invite_hash>
|
||||||
if (Scheduler::context() != nullptr) {
|
if (Scheduler::context() != nullptr) {
|
||||||
send_closure(G()->messages_manager(), &MessagesManager::reload_voice_chat_on_search, username);
|
send_closure(G()->messages_manager(), &MessagesManager::reload_voice_chat_on_search, username);
|
||||||
}
|
}
|
||||||
@ -1017,9 +1017,9 @@ unique_ptr<LinkManager::InternalLink> LinkManager::parse_t_me_link_query(Slice q
|
|||||||
}
|
}
|
||||||
auto username = path[0];
|
auto username = path[0];
|
||||||
for (auto &arg : url_query.args_) {
|
for (auto &arg : url_query.args_) {
|
||||||
if (arg.first == "voicechat") {
|
if (arg.first == "voicechat" || arg.first == "videochat" || arg.first == "livestream") {
|
||||||
// /<username>?voicechat
|
// /<username>?videochat
|
||||||
// /<username>?voicechat=<invite_hash>
|
// /<username>?videochat=<invite_hash>
|
||||||
if (Scheduler::context() != nullptr) {
|
if (Scheduler::context() != nullptr) {
|
||||||
send_closure(G()->messages_manager(), &MessagesManager::reload_voice_chat_on_search, username);
|
send_closure(G()->messages_manager(), &MessagesManager::reload_voice_chat_on_search, username);
|
||||||
}
|
}
|
||||||
|
@ -524,6 +524,8 @@ TEST(Link, parse_internal_link) {
|
|||||||
parse_internal_link("tg:socks?server=google.com&port=80&user=1&pass=2", proxy_socks("google.com", 80, "1", "2"));
|
parse_internal_link("tg:socks?server=google.com&port=80&user=1&pass=2", proxy_socks("google.com", 80, "1", "2"));
|
||||||
|
|
||||||
parse_internal_link("tg:resolve?domain=username&voice%63hat=aasdasd", voice_chat("username", "aasdasd"));
|
parse_internal_link("tg:resolve?domain=username&voice%63hat=aasdasd", voice_chat("username", "aasdasd"));
|
||||||
|
parse_internal_link("tg:resolve?domain=username&video%63hat=aasdasd", voice_chat("username", "aasdasd"));
|
||||||
|
parse_internal_link("tg:resolve?domain=username&livestream=aasdasd", voice_chat("username", "aasdasd"));
|
||||||
parse_internal_link("TG://resolve?domain=username&voicechat=", voice_chat("username", ""));
|
parse_internal_link("TG://resolve?domain=username&voicechat=", voice_chat("username", ""));
|
||||||
parse_internal_link("TG://test@resolve?domain=username&voicechat=", nullptr);
|
parse_internal_link("TG://test@resolve?domain=username&voicechat=", nullptr);
|
||||||
parse_internal_link("tg:resolve:80?domain=username&voicechat=", nullptr);
|
parse_internal_link("tg:resolve:80?domain=username&voicechat=", nullptr);
|
||||||
@ -533,6 +535,8 @@ TEST(Link, parse_internal_link) {
|
|||||||
parse_internal_link("tg:resolve?domain=telegram&&&&&&&voicechat=%30", voice_chat("telegram", "0"));
|
parse_internal_link("tg:resolve?domain=telegram&&&&&&&voicechat=%30", voice_chat("telegram", "0"));
|
||||||
|
|
||||||
parse_internal_link("t.me/username/0/a//s/as?voicechat=", voice_chat("username", ""));
|
parse_internal_link("t.me/username/0/a//s/as?voicechat=", voice_chat("username", ""));
|
||||||
|
parse_internal_link("t.me/username/0/a//s/as?videochat=2", voice_chat("username", "2"));
|
||||||
|
parse_internal_link("t.me/username/0/a//s/as?livestream=3", voice_chat("username", "3"));
|
||||||
parse_internal_link("t.me/username/aasdas?test=1&voicechat=#12312", voice_chat("username", ""));
|
parse_internal_link("t.me/username/aasdas?test=1&voicechat=#12312", voice_chat("username", ""));
|
||||||
parse_internal_link("t.me/username/0?voicechat=", voice_chat("username", ""));
|
parse_internal_link("t.me/username/0?voicechat=", voice_chat("username", ""));
|
||||||
parse_internal_link("t.me/username/-1?voicechat=asdasd", voice_chat("username", "asdasd"));
|
parse_internal_link("t.me/username/-1?voicechat=asdasd", voice_chat("username", "asdasd"));
|
||||||
|
Loading…
Reference in New Issue
Block a user