diff options
Diffstat (limited to 'src/client.rs')
| -rw-r--r-- | src/client.rs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/client.rs b/src/client.rs index 4202a8e..4f002fb 100644 --- a/src/client.rs +++ b/src/client.rs | |||
| @@ -1023,6 +1023,7 @@ async fn create_relays_request( | |||
| 1023 | }) | 1023 | }) |
| 1024 | } | 1024 | } |
| 1025 | 1025 | ||
| 1026 | #[allow(clippy::too_many_lines)] | ||
| 1026 | async fn process_fetched_events( | 1027 | async fn process_fetched_events( |
| 1027 | events: Vec<nostr::Event>, | 1028 | events: Vec<nostr::Event>, |
| 1028 | request: &FetchRequest, | 1029 | request: &FetchRequest, |
| @@ -1102,14 +1103,20 @@ async fn process_fetched_events( | |||
| 1102 | fresh_profiles.insert(event.author()); | 1103 | fresh_profiles.insert(event.author()); |
| 1103 | } | 1104 | } |
| 1104 | } else if [Kind::RelayList, Kind::Metadata].contains(&event.kind()) { | 1105 | } else if [Kind::RelayList, Kind::Metadata].contains(&event.kind()) { |
| 1105 | if Kind::Metadata.eq(&event.kind()) { | 1106 | if request |
| 1106 | if request | 1107 | .missing_contributor_profiles |
| 1107 | .missing_contributor_profiles | 1108 | .contains(event.author_ref()) |
| 1108 | .contains(event.author_ref()) | 1109 | { |
| 1110 | report.contributor_profiles.insert(event.author()); | ||
| 1111 | } else if let Some((_, (metadata_timestamp, relay_list_timestamp))) = request | ||
| 1112 | .profiles_to_fetch_from_user_relays | ||
| 1113 | .get_key_value(event.author_ref()) | ||
| 1114 | { | ||
| 1115 | if (Kind::Metadata.eq(&event.kind()) | ||
| 1116 | && event.created_at().gt(metadata_timestamp)) | ||
| 1117 | || (Kind::RelayList.eq(&event.kind()) | ||
| 1118 | && event.created_at().gt(relay_list_timestamp)) | ||
| 1109 | { | 1119 | { |
| 1110 | report.contributor_profiles.insert(event.author()); | ||
| 1111 | } else { | ||
| 1112 | // TODO: how do we know if the recieved profile is new? | ||
| 1113 | report.profile_updates.insert(event.author()); | 1120 | report.profile_updates.insert(event.author()); |
| 1114 | } | 1121 | } |
| 1115 | } | 1122 | } |