Provided access to internal connections where needed, and added multi-line support to send_privmsg(...).
This commit is contained in:
parent
25532d145e
commit
6db71ded01
4 changed files with 17 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
//! Thread-safe connections on any IrcWriters and IrcReaders
|
||||
#![experimental]
|
||||
use std::sync::Mutex;
|
||||
use std::sync::{Mutex, MutexGuard};
|
||||
use std::io::{BufferedReader, BufferedWriter, IoResult, TcpStream};
|
||||
use data::kinds::{IrcWriter, IrcReader};
|
||||
use data::message::Message;
|
||||
|
@ -44,4 +44,10 @@ impl<T, U> Connection<T, U> where T: IrcWriter, U: IrcReader {
|
|||
pub fn recv(&self) -> IoResult<String> {
|
||||
self.reader.lock().read_line()
|
||||
}
|
||||
|
||||
/// Acquires the Writer lock
|
||||
#[experimental]
|
||||
pub fn writer<'a>(&'a self) -> MutexGuard<'a, T> {
|
||||
self.writer.lock()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue