diff options
Diffstat (limited to 'src/archive_parser.cpp')
-rw-r--r-- | src/archive_parser.cpp | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/archive_parser.cpp b/src/archive_parser.cpp index 0ace163..d677f84 100644 --- a/src/archive_parser.cpp +++ b/src/archive_parser.cpp @@ -54,6 +54,7 @@ bool is_status_type_allowed(StatusType status_type, ViewStatusTypes allowed_type case UNLISTED: return allowed_types.includeUnlisted; case PRIVATE: return allowed_types.includePrivate; case DIRECT: return allowed_types.includeDirect; + case REBLOG: return allowed_types.includeReblogs; default: return true; } } @@ -119,15 +120,20 @@ void Archive::update_status_list(ViewStatusTypes allowed_types, QListWidget *par if (not obj.value("type").isString()) // this shouldn't happen, but you never know goto next_item; - if (obj.value("type").toString() != "Create") // ignoring everything that isn't a Create activity for now + + QString activity_type = obj.value("type").toString(); + if (not (activity_type == "Create" or activity_type == "Announce")) // ignoring everything that isn't a Create or Announce activity for now goto next_item; // Determine the status' type - StatusType status_type = get_status_type(obj); + StatusType status_type; + if (activity_type == "Announce") status_type = REBLOG; + else status_type = get_status_type(obj); + if (not is_status_type_allowed(status_type, allowed_types)) goto next_item; - if (obj.value("object").isObject()) { + if (activity_type == "Create" and obj.value("object").isObject()) { QJsonObject activity = obj.value("object").toObject(); bool has_attachment = false; @@ -144,6 +150,8 @@ void Archive::update_status_list(ViewStatusTypes allowed_types, QListWidget *par ListItem *item = new ListItem(strip_html.toPlainText(), status_type, has_attachment, parent, i); } + } else if (activity_type == "Announce" and obj["object"].isString()) { + ListItem *item = new ListItem(activity_type, REBLOG, false, parent, i); } } next_item: @@ -237,7 +245,7 @@ QString Archive::get_html_status_attachments(QJsonValueRef attachments_ref, int } // status_index is assumed to be a valid index -QString Archive::get_html_status_info(int status_index, int text_zone_width) { +QString Archive::get_html_status_info(int status_index, int text_zone_width, StatusType status_type) { QString info_text(*get_html_status_info_template()); QJsonObject obj = outbox_items->at(status_index).toObject(); @@ -271,6 +279,20 @@ QString Archive::get_html_status_info(int status_index, int text_zone_width) { if (activity["content"].isString()) { info_text.replace("{{content}}", activity["content"].toString()); } + } else if (obj["object"].isString()) { + QString text = obj["object"].toString(); + QString content_text; + + if (status_type == REBLOG) { + content_text = "Reblog of this object: <a href=\"{{url}}\">{{url}}</a>"; + content_text.replace("{{url}}", text); + info_text.replace("{{url-status}}", text); + } else + content_text = text; + + info_text.replace("{{content}}", content_text); + info_text.replace("{{summary}}", "<em>(empty)</em>"); + info_text.replace("{{attachment-div}}", ""); } return info_text; |