Skip to content

Commit

Permalink
fix NOTIFY syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
jkaessens committed Feb 6, 2018
1 parent 3fec0de commit 757ac51
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl<'a, T: Read + Write + 'a> NotifyHandle<'a, T> {
})
}

fn set(&mut self, cmd: NotifyOp<'a>) -> Result<()> {
pub fn set(&mut self, cmd: NotifyOp<'a>) -> Result<()> {
// This command will end in a tagged OK but if the NOTIFY args contains
// a `STATUS` identifier, one status line for each specified mailbox
// will be emitted before the final OK.
Expand All @@ -127,7 +127,7 @@ impl<'a, T: Read + Write + 'a> NotifyHandle<'a, T> {
} else {
s += "SET ";
for i in cmd.items.iter() {
s += &format!("({} ({}))",
s += &format!("(mailboxes {} ({}))",
i.mailbox,
i.events.iter().fold(String::new(), |sofar, cur| format!("{} {}", sofar, cur)));
}
Expand All @@ -136,7 +136,7 @@ impl<'a, T: Read + Write + 'a> NotifyHandle<'a, T> {
self.client.run_command_and_check_ok(&s)
}

fn set_status(&mut self, cmd: NotifyOp<'a>) -> Result<HashMap<String, Mailbox>> {
pub fn set_status(&mut self, cmd: NotifyOp<'a>) -> Result<HashMap<String, Mailbox>> {
if cmd.items.len() == 0 {
panic!("Cannot request a STATUS response without a mailbox specification!");
}
Expand All @@ -146,9 +146,9 @@ impl<'a, T: Read + Write + 'a> NotifyHandle<'a, T> {
if cmd.items.len() == 0 {
s += "NONE";
} else {
s += "STATUS SET ";
s += "SET STATUS ";
for i in cmd.items.iter() {
s += &format!("({} ({}))",
s += &format!("(mailboxes {} ({}))",
i.mailbox,
i.events.iter().fold(String::new(), |sofar, cur| format!("{} {}", sofar, cur)));
}
Expand Down

0 comments on commit 757ac51

Please sign in to comment.