aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTill Höppner2016-02-04 15:05:12 +0100
committerTill Höppner2016-02-04 15:05:12 +0100
commit815f31f5cef61709c50087c9f7601ea330929bb7 (patch)
tree07516a4d0528819b1de80958f55862bac4f24964
parent75b6c893acf9df6c3cecc8528f3c17e110378336 (diff)
downloadilc-815f31f5cef61709c50087c9f7601ea330929bb7.tar.gz
ilc-815f31f5cef61709c50087c9f7601ea330929bb7.tar.xz
ilc-815f31f5cef61709c50087c9f7601ea330929bb7.zip
Rename weechat3 -> weechat
-rw-r--r--README.md2
-rw-r--r--src/app/mod.rs3
-rw-r--r--src/format/mod.rs29
-rw-r--r--src/format/weechat.rs (renamed from src/format/weechat3.rs)6
4 files changed, 22 insertions, 18 deletions
diff --git a/README.md b/README.md
index a95ddb7..ec22187 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ ilc
ilc is a library to work with common IRC log formats, as well as a collection
of commonly needed utilities for IRC logs.
-The library can convert between most of the EnergyMech (ZNC) and Weechat3 log formats, as well as binary and msgpack representations of them.
+The library can convert between most of the EnergyMech (ZNC) and Weechat log formats, as well as binary and msgpack representations of them.
The tools can merge, convert, and pretty-print them, or count the lines/words that people said in them.
#### Fine, I'll try it. Do I really have to compile it myself?
diff --git a/src/app/mod.rs b/src/app/mod.rs
index b8006b7..3221ec9 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -173,7 +173,7 @@ pub mod seen {
if m.ty.involves(nick)
&& last.as_ref().map_or(true, |last| m.time.as_timestamp() > last.time.as_timestamp()) { last = Some(m) }
}
- let encoder = format::weechat3::Weechat3;
+ let encoder = format::Weechat;
if let Some(ref m) = last {
let _ = encoder.encode(&context, &mut output, m);
}
@@ -227,6 +227,5 @@ pub mod dedup {
}
}
}
-
}
}
diff --git a/src/format/mod.rs b/src/format/mod.rs
index f7de677..cea6855 100644
--- a/src/format/mod.rs
+++ b/src/format/mod.rs
@@ -23,11 +23,16 @@ use std::borrow::Cow;
use event::Event;
use context::Context;
-pub mod energymech;
-pub mod weechat3;
+pub use self::energymech::Energymech;
+pub use self::weechat::Weechat;
+pub use self::binary::Binary;
+pub use self::msgpack::Msgpack;
+
+mod energymech;
+mod weechat;
// pub mod irssi;
-pub mod binary;
-pub mod msgpack;
+mod binary;
+mod msgpack;
pub trait Encode {
fn encode<'a>(&'a self, context: &'a Context, output: &'a mut Write, event: &'a Event) -> ::Result<()>;
@@ -47,22 +52,22 @@ impl Decode for Dummy {
pub fn decoder(format: &str) -> Option<Box<Decode>> {
match format {
- "energymech" | "em" => Some(Box::new(energymech::Energymech)),
- "weechat3" | "weechat" | "w3" => Some(Box::new(weechat3::Weechat3)),
+ "energymech" | "em" => Some(Box::new(Energymech)),
+ "weechat" | "w" => Some(Box::new(Weechat)),
// "irssi" => Some(Box::new(irssi::Irssi)),
- "binary" => Some(Box::new(binary::Binary)),
- "msgpack" => Some(Box::new(msgpack::Msgpack)),
+ "binary" => Some(Box::new(Binary)),
+ "msgpack" => Some(Box::new(Msgpack)),
_ => None
}
}
pub fn encoder(format: &str) -> Option<Box<Encode>> {
match format {
- "energymech" | "em" => Some(Box::new(energymech::Energymech)),
- "weechat3" | "weechat" | "w3" => Some(Box::new(weechat3::Weechat3)),
+ "energymech" | "em" => Some(Box::new(Energymech)),
+ "weechat" | "w" => Some(Box::new(Weechat)),
// "irssi" => Some(Box::new(irssi::Irssi)),
- "binary" => Some(Box::new(binary::Binary)),
- "msgpack" => Some(Box::new(msgpack::Msgpack)),
+ "binary" => Some(Box::new(Binary)),
+ "msgpack" => Some(Box::new(Msgpack)),
_ => None
}
}
diff --git a/src/format/weechat3.rs b/src/format/weechat.rs
index 92da0e0..30fdc24 100644
--- a/src/format/weechat3.rs
+++ b/src/format/weechat.rs
@@ -22,7 +22,7 @@ use format::{ Encode, Decode, rejoin, strip_one };
use l::LogLevel::Info;
-pub struct Weechat3;
+pub struct Weechat;
static TIME_DATE_FORMAT: &'static str = "%Y-%m-%d %H:%M:%S";
@@ -139,7 +139,7 @@ impl<'a> Iterator for Iter<'a> {
}
}
-impl Decode for Weechat3 {
+impl Decode for Weechat {
fn decode<'a>(&'a mut self, context: &'a Context, input: &'a mut BufRead) -> Box<Iterator<Item = ::Result<Event<'a>>> + 'a> {
Box::new(Iter {
context: context,
@@ -149,7 +149,7 @@ impl Decode for Weechat3 {
}
}
-impl Encode for Weechat3 {
+impl Encode for Weechat {
fn encode<'a>(&'a self, context: &'a Context, mut output: &'a mut Write, event: &'a Event) -> ::Result<()> {
match event {
&Event { ty: Type::Msg { ref from, ref content, .. }, ref time, .. } => {