aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 9460ec6..709dfea 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3673,19 +3673,28 @@ namespace QuickMedia {
if(tabs[selected_tab].type == ChatTabType::MESSAGES && event.key.code == sf::Keyboard::Enter) {
BodyItem *selected = tabs[selected_tab].body->get_selected();
if(selected) {
- // TODO: Change this when messages are not stored in the description
- const std::string &message_str = selected->get_description();
- auto urls_begin = std::sregex_iterator(message_str.begin(), message_str.end(), url_extract_regex);
- auto urls_end = std::sregex_iterator();
- size_t num_urls = std::distance(urls_begin, urls_end);
- if(num_urls == 1) {
- launch_url(urls_begin->str());
- } else if(num_urls > 1) {
- chat_state = ChatState::URL_SELECTION;
- url_selection_body.clear_items();
- for(auto it = urls_begin; it != urls_end; ++it) {
- auto body_item = BodyItem::create(it->str());
- url_selection_body.items.push_back(std::move(body_item));
+ if(!selected->url.empty()) {
+ page_stack.push(Page::CHAT);
+ watched_videos.clear();
+ content_url = selected->url;
+ current_page = Page::VIDEO_CONTENT;
+ video_content_page();
+ redraw = true;
+ } else {
+ // TODO: Change this when messages are not stored in the description
+ const std::string &message_str = selected->get_description();
+ auto urls_begin = std::sregex_iterator(message_str.begin(), message_str.end(), url_extract_regex);
+ auto urls_end = std::sregex_iterator();
+ size_t num_urls = std::distance(urls_begin, urls_end);
+ if(num_urls == 1) {
+ launch_url(urls_begin->str());
+ } else if(num_urls > 1) {
+ chat_state = ChatState::URL_SELECTION;
+ url_selection_body.clear_items();
+ for(auto it = urls_begin; it != urls_end; ++it) {
+ auto body_item = BodyItem::create(it->str());
+ url_selection_body.items.push_back(std::move(body_item));
+ }
}
}
}