cargo fmt
This commit is contained in:
parent
ec3a327c3e
commit
ac901ccf4a
|
@ -471,7 +471,8 @@ fn do_protocol(
|
||||||
wiki: &Mediawiki,
|
wiki: &Mediawiki,
|
||||||
) -> Result<(), Box<dyn Error>> {
|
) -> Result<(), Box<dyn Error>> {
|
||||||
NYI!("trace/verbose annotations");
|
NYI!("trace/verbose annotations");
|
||||||
let (current_pad_id, pad_content_without_cleanup, toc, n_topics) = get_pad_info(config, hedgedoc);
|
let (current_pad_id, pad_content_without_cleanup, toc, n_topics) =
|
||||||
|
get_pad_info(config, hedgedoc);
|
||||||
if !toc.is_empty() {
|
if !toc.is_empty() {
|
||||||
let human_date = plenum_day.format("%d.%m.%Y");
|
let human_date = plenum_day.format("%d.%m.%Y");
|
||||||
let pad_content = hedgedoc::strip_metadata(pad_content_without_cleanup.clone());
|
let pad_content = hedgedoc::strip_metadata(pad_content_without_cleanup.clone());
|
||||||
|
|
|
@ -84,7 +84,8 @@ impl std::fmt::Debug for MatrixClient {
|
||||||
|
|
||||||
impl MatrixClient {
|
impl MatrixClient {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
homeserver_url: &str, user_id: &str, access_token: &str, room_id_for_short_messages: &str, room_id_for_long_messages: &str, is_dry_run: bool,
|
homeserver_url: &str, user_id: &str, access_token: &str, room_id_for_short_messages: &str,
|
||||||
|
room_id_for_long_messages: &str, is_dry_run: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
homeserver_url: homeserver_url.to_string(),
|
homeserver_url: homeserver_url.to_string(),
|
||||||
|
@ -175,7 +176,9 @@ impl MatrixClient {
|
||||||
current
|
current
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_room_message(&mut self, room_id: &str, text: &str) -> Result<Value, Box<dyn Error>> {
|
pub fn send_room_message(
|
||||||
|
&mut self, room_id: &str, text: &str,
|
||||||
|
) -> Result<Value, Box<dyn Error>> {
|
||||||
let content = HashMap::from([("msgtype", "m.text"), ("body", text)]);
|
let content = HashMap::from([("msgtype", "m.text"), ("body", text)]);
|
||||||
self.send_room_event(&room_id, "m.room.message", &content)
|
self.send_room_event(&room_id, "m.room.message", &content)
|
||||||
}
|
}
|
||||||
|
@ -186,7 +189,9 @@ impl MatrixClient {
|
||||||
let endpoint = format!("/r0/rooms/{}/send/{}/{}", room, event_type, self.txn_id());
|
let endpoint = format!("/r0/rooms/{}/send/{}/{}", room, event_type, self.txn_id());
|
||||||
self.put(&endpoint, None, Some(content), false)
|
self.put(&endpoint, None, Some(content), false)
|
||||||
}
|
}
|
||||||
pub fn send_short_and_long_messages_to_two_rooms(&mut self, short_message: &str, long_message: &str) -> Result<(), Box<dyn Error>> {
|
pub fn send_short_and_long_messages_to_two_rooms(
|
||||||
|
&mut self, short_message: &str, long_message: &str,
|
||||||
|
) -> Result<(), Box<dyn Error>> {
|
||||||
self.send_room_message(&long_message, &self.room_id_for_long_messages.clone())?;
|
self.send_room_message(&long_message, &self.room_id_for_long_messages.clone())?;
|
||||||
self.send_room_message(&short_message, &self.room_id_for_short_messages.clone())?;
|
self.send_room_message(&short_message, &self.room_id_for_short_messages.clone())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -301,9 +301,14 @@ impl Mediawiki {
|
||||||
if let Some(error) = response.get("error") {
|
if let Some(error) = response.get("error") {
|
||||||
if let Some(info) = error.get("info") {
|
if let Some(info) = error.get("info") {
|
||||||
if info == "The page you tried to create has been created already." {
|
if info == "The page you tried to create has been created already." {
|
||||||
verboseln!("The page you tried to create has been created already. Continuing...")
|
verboseln!(
|
||||||
|
"The page you tried to create has been created already. Continuing..."
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
println!("There was an error while editing the wiki: {}", info.to_string().yellow())
|
println!(
|
||||||
|
"There was an error while editing the wiki: {}",
|
||||||
|
info.to_string().yellow()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if let Some(edit) = response.get("edit") {
|
} else if let Some(edit) = response.get("edit") {
|
||||||
|
|
Loading…
Reference in a new issue