diff options
author | Till Höppner | 2016-03-16 15:18:20 +0100 |
---|---|---|
committer | Till Höppner | 2016-03-16 15:18:20 +0100 |
commit | 5cbe7a0042600793f65b86cc821bdd159de91071 (patch) | |
tree | 19573791bbb984424c63f8f3a9bebaba7a54d014 /ops/src/lib.rs | |
parent | 586461676df9abd2e011fbcb1bb7c784cdb2844c (diff) | |
download | ilc-5cbe7a0042600793f65b86cc821bdd159de91071.tar.gz ilc-5cbe7a0042600793f65b86cc821bdd159de91071.tar.xz ilc-5cbe7a0042600793f65b86cc821bdd159de91071.zip |
Remove "seen" command
Its functionality can be imitated via a combination of
--if nick --exactly ... and tail, with more flexibility,
though a little less performant.
Diffstat (limited to 'ops/src/lib.rs')
-rw-r--r-- | ops/src/lib.rs | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/ops/src/lib.rs b/ops/src/lib.rs index 6fd4cab..a929816 100644 --- a/ops/src/lib.rs +++ b/ops/src/lib.rs @@ -29,37 +29,6 @@ pub mod parse { } } -/// Last-seen of nicks -pub mod seen { - use ilc_base::{self, Context, Decode, Encode, Event}; - use std::io::{BufRead, Write}; - - /// Return the last message of a given nickname, searching from the beginning of the logs. - /// Will return `Err` if the decoder yields `Err`. This relies on absolute timestamps, and - /// behaviour without full dates is undefined. - pub fn seen(nick: &str, - ctx: &Context, - input: &mut BufRead, - decoder: &mut Decode, - output: &mut Write, - encoder: &Encode) - -> ilc_base::Result<()> { - let mut last: Option<Event> = None; - for e in decoder.decode(&ctx, input) { - let m: Event = try!(e); - if m.ty.involves(nick) && - last.as_ref().map_or(true, - |last| m.time.as_timestamp() > last.time.as_timestamp()) { - last = Some(m) - } - } - if let Some(ref m) = last { - try!(encoder.encode(&ctx, output, m)); - } - Ok(()) - } -} - /// Internal (as opposed to external, not to be confused with private) log sorting pub mod sort { use ilc_base::{self, Context, Decode, Encode, Event}; |