diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/message.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/message.rs b/src/message.rs index 9bd6b6f..b90cafb 100644 --- a/src/message.rs +++ b/src/message.rs @@ -1,5 +1,7 @@ use constants::MessageType; +use std::io; + #[deriving(PartialEq, Eq, Show)] pub struct Message { from: Option<String>, @@ -64,6 +66,13 @@ impl Message { w.flush(); } + pub fn to_protocol_string (&self) -> String { + let mut w = io::MemWriter::new(); + self.write_protocol_string(&mut w); + // XXX error handling, encoding + String::from_utf8(w.unwrap()).unwrap() + } + fn parse_params(params: &str) -> Vec<String> { let mut offset = 0; let len = params.len(); |