mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-29 08:21:47 +00:00
Fix: command delete_spam_by_content to work better for DM spam (kind=14 works now)
This commit is contained in:
parent
79ab68aa4a
commit
26c63396a1
@ -430,7 +430,7 @@ pub fn delete_spam_by_content(
|
||||
mut args: env::Args,
|
||||
runtime: &Runtime,
|
||||
) -> Result<(), Error> {
|
||||
let kind: EventKind = match args.next() {
|
||||
let mut kind: EventKind = match args.next() {
|
||||
Some(integer) => integer.parse::<u32>()?.into(),
|
||||
None => return cmd.usage("Missing kind parameter".to_string()),
|
||||
};
|
||||
@ -445,6 +445,11 @@ pub fn delete_spam_by_content(
|
||||
None => return cmd.usage("Missing <substring> paramter".to_string()),
|
||||
};
|
||||
|
||||
// If DM Chat, use GiftWrap
|
||||
if kind == EventKind::DmChat {
|
||||
kind = EventKind::GiftWrap;
|
||||
}
|
||||
|
||||
// Login if we need to look into GiftWraps
|
||||
if kind == EventKind::GiftWrap {
|
||||
login()?;
|
||||
@ -475,6 +480,14 @@ pub fn delete_spam_by_content(
|
||||
}
|
||||
}
|
||||
|
||||
// If no events we are done
|
||||
if target_ids.is_empty() {
|
||||
println!("No matches found");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
println!("Deleting {} events...", target_ids.len());
|
||||
|
||||
// Delete locally
|
||||
let mut txn = GLOBALS.storage.get_write_txn()?;
|
||||
for id in &target_ids {
|
||||
|
Loading…
Reference in New Issue
Block a user