From 5fdac1cc6da07a800f944fa04d37f698bf296b8a Mon Sep 17 00:00:00 2001 From: Till Hoeppner Date: Sat, 4 Apr 2015 21:18:14 +0200 Subject: Remove remains of regex parsing --- src/format/weechat3.rs | 67 -------------------------------------------------- 1 file changed, 67 deletions(-) diff --git a/src/format/weechat3.rs b/src/format/weechat3.rs index dfe2868..f33847e 100644 --- a/src/format/weechat3.rs +++ b/src/format/weechat3.rs @@ -7,17 +7,10 @@ use format::{ Encode, Decode }; use l::LogLevel::Info; -//use regex::Regex; - use chrono::*; pub struct Weechat3; -//static NORMAL_LINE: Regex = regex!(r"^(\d+-\d+-\d+ \d+:\d+:\d+)\t[@%+~&]?([^ <-]\S+)\t(.*)"); -//static ACTION_LINE: Regex = regex!(r"^(\d+-\d+-\d+ \d+:\d+:\d+)\t \*\t(\S+) (.*)"); -//static OTHER_LINES: Regex = regex!(r"^(\d+-\d+-\d+ \d+:\d+:\d+)\s(?:--|<--|-->)\s(\S+)\s(\S+)\s(\S+)\s(\S+)\s(\S+)(.*)\n$"); -//static OTHER_LINES: Regex = regex!(r"(.+)"); - static TIME_DATE_FORMAT: &'static str = "%Y-%m-%d %H:%M:%S"; pub struct Iter where R: BufRead { @@ -85,66 +78,6 @@ impl Iterator for Iter where R: BufRead { })), _ => () } - /* - if let Some(cap) = NORMAL_LINE.captures(line) { - return Some(Ok(Event::Msg { - from: cap.at(2).unwrap().to_owned(), - content: cap.at(3).unwrap().to_owned(), - time: time(cap.at(1).unwrap()) - })) - } else if let Some(cap) = ACTION_LINE.captures(line) { - return Some(Ok(Event::Action { - from: cap.at(1).unwrap().to_owned(), - content: cap.at(2).unwrap().to_owned(), - time: time(cap.at(1).unwrap()) - })) - } else if let Some(cap) = OTHER_LINES.captures(line) { - println!("{:?}", cap.iter().collect::>()); - if cap.at(4) == Some("has") && cap.at(5) == Some("kicked") { - println!(" Matched Event::Kick"); - return Some(Ok(Event::Kick { - kicked_nick: cap.at(6).unwrap().to_owned(), - kicking_nick: cap.at(3).unwrap().to_owned(), - kick_message: cap.at(4).unwrap().to_owned(), - time: time(cap.at(1).unwrap()) - })) - } else if cap.at(2) == Some("Topic") && cap.at(3) == Some("for") { - return Some(Ok(Event::Topic { - topic: { let mut s = cap.at(6).unwrap().to_string(); s.push_str(cap.at(7).unwrap()); s }, - time: time(cap.at(1).unwrap()) - })) - } else if cap.at(3) == Some("has") && cap.at(5) == Some("changed") && cap.at(6) == Some("topic") { - return Some(Ok(Event::TopicChange { - new_topic: cap.at(5).unwrap().to_owned(), - time: time(cap.at(1).unwrap()) - })) - } else if cap.at(3) == Some("Mode") { - return Some(Ok(Event::Mode { - time: time(cap.at(1).unwrap()) - })) - } else if cap.at(4) == Some("has") && cap.at(5) == Some("joined") { - return Some(Ok(Event::Join { - nick: cap.at(2).unwrap().to_owned(), - channel: cap.at(6).unwrap().to_owned(), - mask: mask(cap.at(3).unwrap()), - time: time(cap.at(1).unwrap()) - })) - } else if cap.at(4) == Some("has") && cap.at(5) == Some("left") { - return Some(Ok(Event::Part { - nick: cap.at(2).unwrap().to_owned(), - channel: cap.at(6).unwrap().to_owned(), - reason: cap.at(7).unwrap().to_owned(), - mask: mask(cap.at(3).unwrap()), - time: time(cap.at(1).unwrap()) - })) - } else if cap.at(5) == Some("now") && cap.at(6) == Some("known") { - return Some(Ok(Event::Nick { - old: String::new(), - new: String::new(), - time: time(cap.at(1).unwrap()) - })) - } - }*/ } } } -- cgit v1.2.3