aboutsummaryrefslogtreecommitdiff
path: root/formats/weechat/src
diff options
context:
space:
mode:
authorTill Höppner2016-03-16 17:17:25 +0100
committerTill Höppner2016-03-16 17:17:25 +0100
commit155971b36c100c0c146492375d5580ef0c5ac572 (patch)
treea7420ae7fbd123d3db4985621d9da5568da138e6 /formats/weechat/src
parent51c7e0c58d8aeaf342cb416c4376b69bd144c818 (diff)
downloadilc-155971b36c100c0c146492375d5580ef0c5ac572.tar.gz
ilc-155971b36c100c0c146492375d5580ef0c5ac572.tar.xz
ilc-155971b36c100c0c146492375d5580ef0c5ac572.zip
Add time_out param, change timezone handling
Diffstat (limited to 'formats/weechat/src')
-rw-r--r--formats/weechat/src/lib.rs25
1 files changed, 17 insertions, 8 deletions
diff --git a/formats/weechat/src/lib.rs b/formats/weechat/src/lib.rs
index 7d9eb3d..d347d5d 100644
--- a/formats/weechat/src/lib.rs
+++ b/formats/weechat/src/lib.rs
@@ -27,7 +27,9 @@ impl<'a> Iterator for Iter<'a> {
type Item = ilc_base::Result<Event<'a>>;
fn next(&mut self) -> Option<ilc_base::Result<Event<'a>>> {
fn parse_time(c: &Context, date: &str, time: &str) -> Time {
- Time::from_format(&c.timezone, &format!("{} {}", date, time), TIME_DATE_FORMAT)
+ Time::from_format(&c.timezone_in,
+ &format!("{} {}", date, time),
+ TIME_DATE_FORMAT)
}
loop {
@@ -181,29 +183,36 @@ impl Encode for Weechat {
&Event { ty: Type::Msg { ref from, ref content, .. }, ref time, .. } => {
try!(writeln!(&mut output,
"{}\t{}\t{}",
- time.with_format(&context.timezone, TIME_DATE_FORMAT),
+ time.with_format(&context.timezone_out, TIME_DATE_FORMAT),
from,
content))
}
&Event { ty: Type::Action { ref from, ref content, .. }, ref time, .. } => {
try!(writeln!(&mut output,
"{}\t *\t{} {}",
- time.with_format(&context.timezone, TIME_DATE_FORMAT),
+ time.with_format(&context.timezone_out, TIME_DATE_FORMAT),
from,
content))
}
&Event { ty: Type::Join { ref nick, ref mask, .. }, ref channel, ref time } => {
try!(writeln!(&mut output,
"{}\t-->\t{} ({}) has joined {}",
- time.with_format(&context.timezone, TIME_DATE_FORMAT),
+ time.with_format(&context.timezone_out, TIME_DATE_FORMAT),
nick,
mask.as_ref().expect("Hostmask not present, but required."),
channel.as_ref().expect("Channel not present, but required.")))
}
+ &Event { ty: Type::Nick { ref old_nick, ref new_nick, .. }, ref time, .. } => {
+ try!(writeln!(&mut output,
+ "{}\t--\t{} is now known as {}",
+ time.with_format(&context.timezone_out, TIME_DATE_FORMAT),
+ old_nick,
+ new_nick))
+ }
&Event { ty: Type::Part { ref nick, ref mask, ref reason }, ref channel, ref time } => {
try!(write!(&mut output,
"{}\t<--\t{} ({}) has left {}",
- time.with_format(&context.timezone, TIME_DATE_FORMAT),
+ time.with_format(&context.timezone_out, TIME_DATE_FORMAT),
nick,
mask.as_ref().expect("Hostmask not present, but required."),
channel.as_ref().expect("Channel not present, but required.")));
@@ -215,7 +224,7 @@ impl Encode for Weechat {
&Event { ty: Type::Quit { ref nick, ref mask, ref reason }, ref time, .. } => {
try!(write!(&mut output,
"{}\t<--\t{} ({}) has quit",
- time.with_format(&context.timezone, TIME_DATE_FORMAT),
+ time.with_format(&context.timezone_out, TIME_DATE_FORMAT),
nick,
mask.as_ref().expect("Hostmask not present, but required.")));
if reason.is_some() && reason.as_ref().unwrap().len() > 0 {
@@ -226,12 +235,12 @@ impl Encode for Weechat {
&Event { ty: Type::Disconnect, ref time, .. } => {
try!(writeln!(&mut output,
"{}\t--\tirc: disconnected from server",
- time.with_format(&context.timezone, TIME_DATE_FORMAT)))
+ time.with_format(&context.timezone_out, TIME_DATE_FORMAT)))
}
&Event { ty: Type::Notice { ref from, ref content }, ref time, .. } => {
try!(writeln!(&mut output,
"{}\t--\tNotice({}): {}",
- time.with_format(&context.timezone, TIME_DATE_FORMAT),
+ time.with_format(&context.timezone_out, TIME_DATE_FORMAT),
from,
content))
}