diff options
author | Till Hoeppner | 2015-04-03 00:18:35 +0200 |
---|---|---|
committer | Till Hoeppner | 2015-04-03 00:18:35 +0200 |
commit | 9826d256eec94144469e27c159e0ec4642b2fda6 (patch) | |
tree | 16d751b4dfea1c336747a3a2a63936e8881f0b3e /src/format | |
parent | 522ba8bdc2d63c6503324baf3eacdaa0630f4673 (diff) | |
download | ilc-9826d256eec94144469e27c159e0ec4642b2fda6.tar.gz ilc-9826d256eec94144469e27c159e0ec4642b2fda6.tar.xz ilc-9826d256eec94144469e27c159e0ec4642b2fda6.zip |
More event types
Diffstat (limited to 'src/format')
-rw-r--r-- | src/format/weechat3.rs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/format/weechat3.rs b/src/format/weechat3.rs index 40445a1..dfe2868 100644 --- a/src/format/weechat3.rs +++ b/src/format/weechat3.rs @@ -58,14 +58,23 @@ impl<R> Iterator for Iter<R> where R: BufRead { nick: nick.to_owned(), channel: channel.to_owned(), mask: mask(host), time: timestamp(date, time) })), - [date, time, "<--", nick, host, "has", "left", channel, reason, _..] => return Some(Ok(Event::Part { + [date, time, "<--", nick, host, "has", "left", channel, reason..] => return Some(Ok(Event::Part { nick: nick.to_owned(), channel: channel.to_owned(), mask: mask(host), - reason: reason.to_owned(), time: timestamp(date, time) + reason: mask(&join(reason)), time: timestamp(date, time) + })), + [date, time, "--", notice, content..] + if notice.starts_with("Notice(") + => return Some(Ok(Event::Notice { + nick: notice["Notice(".len()..notice.len() - 2].to_owned(), + content: join(content), + time: timestamp(date, time) })), [date, time, "--", "irc:", "disconnected", "from", "server", _..] => return Some(Ok(Event::Disconnect { time: timestamp(date, time) })), - [date, time, "*", nick, msg..] => return Some(Ok(Event::Action { + [date, time, sp, "*", nick, msg..] + if sp.is_empty() + => return Some(Ok(Event::Action { from: nick.to_owned(), content: join(msg), time: timestamp(date, time) })), @@ -159,7 +168,7 @@ impl<W> Encode<W> for Weechat3 where W: Write { try!(writeln!(&mut output, "{}\t{}\t{}", date(*time), from, content)) }, &Event::Action { ref from, ref content, ref time } => { - try!(writeln!(&mut output, "{}\t*\t{} {}", date(*time), from, content)) + try!(writeln!(&mut output, "{}\t *\t{} {}", date(*time), from, content)) }, &Event::Join { ref nick, ref mask, ref channel, ref time } => { try!(writeln!(&mut output, "{}\t-->\t{} ({}) has joined {}", @@ -183,6 +192,9 @@ impl<W> Encode<W> for Weechat3 where W: Write { &Event::Disconnect { ref time } => { try!(writeln!(&mut output, "{}\t--\tirc: disconnected from server", date(*time))) }, + &Event::Notice { ref nick, ref content, ref time } => { + try!(writeln!(&mut output, "{}\t--\tNotice({}): {}", date(*time), nick, content)) + }, _ => () } Ok(()) |