mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-29 08:21:47 +00:00
dead code cleanup
This commit is contained in:
parent
4278f4d0ba
commit
b17f718f94
@ -101,7 +101,7 @@ impl DbEvent {
|
||||
output
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
/*
|
||||
pub async fn fetch_by_ids(ids: Vec<IdHex>) -> Result<Vec<DbEvent>, Error> {
|
||||
if ids.is_empty() {
|
||||
return Ok(vec![]);
|
||||
@ -141,6 +141,7 @@ impl DbEvent {
|
||||
|
||||
output
|
||||
}
|
||||
*/
|
||||
|
||||
pub async fn fetch_latest_metadata() -> Result<Vec<DbEvent>, Error> {
|
||||
// THIS SQL MIGHT WORK, NEEDS REVIEW
|
||||
@ -234,7 +235,7 @@ impl DbEvent {
|
||||
*/
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
/*
|
||||
fn repeat_vars(count: usize) -> String {
|
||||
assert_ne!(count, 0);
|
||||
let mut s = "?,".repeat(count);
|
||||
@ -242,3 +243,4 @@ fn repeat_vars(count: usize) -> String {
|
||||
s.pop();
|
||||
s
|
||||
}
|
||||
*/
|
||||
|
@ -45,7 +45,6 @@ impl DbEventSeen {
|
||||
}
|
||||
*/
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub async fn get_relays_for_event(id: Id) -> Result<Vec<Url>, Error> {
|
||||
let sql = "SELECT relay FROM event_seen WHERE event=?";
|
||||
|
||||
|
@ -192,7 +192,6 @@ impl DbPersonRelay {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub async fn upsert_last_suggested_kind3(
|
||||
person: String,
|
||||
relay: String,
|
||||
@ -273,7 +272,7 @@ impl DbPersonRelay {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
/*
|
||||
pub async fn fetch_matching(
|
||||
people: Vec<PublicKeyHex>,
|
||||
relays: Vec<String>,
|
||||
@ -331,8 +330,8 @@ impl DbPersonRelay {
|
||||
|
||||
output
|
||||
}
|
||||
*/
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub async fn get_best_relays(pubkey: PublicKeyHex) -> Result<Vec<Url>, Error> {
|
||||
// This is the ranking we are using. There might be reasons
|
||||
// for ranking differently:
|
||||
|
@ -23,17 +23,17 @@ impl Events {
|
||||
let _ = self.events.insert(event.id, event);
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
/*
|
||||
pub fn contains_key(&self, id: &Id) -> bool {
|
||||
self.events.contains_key(id)
|
||||
}
|
||||
*/
|
||||
|
||||
pub fn get(&self, id: &Id) -> Option<Event> {
|
||||
self.events.get(id).map(|e| e.value().to_owned())
|
||||
}
|
||||
|
||||
/// Get the event from memory, and also try the database
|
||||
#[allow(dead_code)]
|
||||
pub async fn get_local(&self, id: Id) -> Result<Option<Event>, Error> {
|
||||
if let Some(e) = self.get(&id) {
|
||||
return Ok(Some(e));
|
||||
@ -64,7 +64,6 @@ impl Events {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[async_recursion]
|
||||
pub async fn get_highest_local_parent(&self, id: &Id) -> Result<Option<Id>, Error> {
|
||||
if let Some(event) = self.get_local(*id).await? {
|
||||
|
12
src/feed.rs
12
src/feed.rs
@ -120,18 +120,6 @@ impl Feed {
|
||||
events.iter().map(|e| e.id).collect()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_my_event_ids(&self) -> Vec<Id> {
|
||||
// we assume the main get() happens fast enough to recompute for us.
|
||||
self.my_event_ids.read().clone()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_followed_event_ids(&self) -> Vec<Id> {
|
||||
// we assume the main get() happens fast enough to recompute for us.
|
||||
self.followed_event_ids.read().clone()
|
||||
}
|
||||
|
||||
pub fn get_thread_parent(&self) -> Option<Id> {
|
||||
self.maybe_recompute();
|
||||
*self.thread_parent.read()
|
||||
|
@ -72,7 +72,6 @@ impl Fetcher {
|
||||
cache_file
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn try_get(&self, url: Url) -> Result<Option<Vec<u8>>, Error> {
|
||||
// Error if we are dead
|
||||
if let Some(reason) = &self.dead {
|
||||
|
@ -6,7 +6,6 @@ use nostr_types::{Metadata, Nip05, PublicKeyHex, Unixtime, Url};
|
||||
use std::collections::hash_map::Entry;
|
||||
|
||||
// This updates the people map and the database with the result
|
||||
#[allow(dead_code)]
|
||||
pub async fn validate_nip05(person: DbPerson) -> Result<(), Error> {
|
||||
let now = Unixtime::now().unwrap();
|
||||
|
||||
|
@ -702,7 +702,6 @@ impl Minion {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
async fn subscribe(&mut self, filters: Vec<Filter>, handle: &str) -> Result<(), Error> {
|
||||
let req_message = if self.subscriptions.has(handle) {
|
||||
let sub = self.subscriptions.get_mut(handle).unwrap();
|
||||
@ -719,7 +718,6 @@ impl Minion {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
async fn unsubscribe(&mut self, handle: &str) -> Result<(), Error> {
|
||||
if !self.subscriptions.has(handle) {
|
||||
return Ok(());
|
||||
|
@ -501,7 +501,6 @@ impl People {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub async fn generate_contact_list_event(&self) -> Result<Event, Error> {
|
||||
let mut p_tags: Vec<Tag> = Vec::new();
|
||||
|
||||
@ -820,7 +819,7 @@ impl People {
|
||||
output
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
/*
|
||||
async fn insert(person: DbPerson) -> Result<(), Error> {
|
||||
let sql = "INSERT OR IGNORE INTO person (pubkey, metadata, metadata_at, \
|
||||
nip05_valid, nip05_last_checked, followed, followed_last_updated) \
|
||||
@ -852,6 +851,7 @@ impl People {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
pub async fn delete(criteria: &str) -> Result<(), Error> {
|
||||
|
@ -2,8 +2,7 @@
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum Relationship {
|
||||
Reply,
|
||||
#[allow(dead_code)]
|
||||
Quote,
|
||||
//Mention,
|
||||
Reaction(String),
|
||||
Deletion(String),
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ impl Signer {
|
||||
settings.save().await
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn set_public_key(&mut self, pk: PublicKey) {
|
||||
if self.private.is_some() {
|
||||
*GLOBALS.status_message.blocking_write() =
|
||||
@ -39,7 +38,6 @@ impl Signer {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn clear_public_key(&mut self) {
|
||||
if self.private.is_some() {
|
||||
*GLOBALS.status_message.blocking_write() =
|
||||
@ -49,7 +47,6 @@ impl Signer {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn set_encrypted_private_key(&mut self, epk: EncryptedPrivateKey) {
|
||||
if self.private.is_some() && self.encrypted.is_some() {
|
||||
// ignore, epk supercedes
|
||||
|
@ -19,7 +19,7 @@ use egui::{
|
||||
ColorImage, Context, ImageData, Label, RichText, SelectableLabel, Sense, TextStyle,
|
||||
TextureHandle, TextureOptions, Ui,
|
||||
};
|
||||
use nostr_types::{Id, IdHex, Metadata, PublicKey, PublicKeyHex};
|
||||
use nostr_types::{Id, IdHex, Metadata, PublicKeyHex};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::time::{Duration, Instant};
|
||||
@ -378,12 +378,6 @@ impl GossipUi {
|
||||
idhex.0[0..8].to_string()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn pubkey_long(pubkey: &PublicKey) -> String {
|
||||
let hex: PublicKeyHex = (*pubkey).into();
|
||||
hex.0
|
||||
}
|
||||
|
||||
pub fn render_person_name_line(ui: &mut Ui, maybe_person: Option<&DbPerson>) {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
if let Some(person) = maybe_person {
|
||||
|
Loading…
Reference in New Issue
Block a user