Commit d6c7becfde
Unsigned
Layout: unified · split
src/config.rs +11
| @@ -84,6 +84,7 @@ impl From<i32> for ServerBuffer { | ||
| 84 | 84 | |
| 85 | 85 | config!( |
| 86 | 86 | "matrix-rust", |
| 87 | ||
| 87 | 88 | Section look { |
| 88 | 89 | encrypted_room_sign: String { |
| 89 | 90 | // Description. |
| @@ -121,6 +122,7 @@ config!( | ||
| 121 | 122 | RedactionStyle, |
| 122 | 123 | }, |
| 123 | 124 | }, |
| 125 | ||
| 124 | 126 | Section network { |
| 125 | 127 | debug_buffer: bool { |
| 126 | 128 | // Description |
| @@ -128,6 +130,15 @@ config!( | ||
| 128 | 130 | // Default value. |
| 129 | 131 | false, |
| 130 | 132 | }, |
| 133 | }, | |
| 134 | ||
| 135 | Section input { | |
| 136 | markdown_input: bool { | |
| 137 | // Description | |
| 138 | "Should the input be parsed as markdown", | |
| 139 | // Default value. | |
| 140 | true, | |
| 141 | }, | |
| 131 | 142 | } |
| 132 | 143 | ); |
| 133 | 144 | |
src/room/mod.rs +6 −3
| @@ -337,9 +337,12 @@ impl RoomHandle { | ||
| 337 | 337 | #[async_trait(?Send)] |
| 338 | 338 | impl BufferInputCallbackAsync for MatrixRoom { |
| 339 | 339 | async fn callback(&mut self, _: BufferHandle, input: String) { |
| 340 | // TODO parse the input here and produce a formatted body. | |
| 341 | let content = | |
| 342 | MessageEventContent::Text(TextMessageEventContent::markdown(input)); | |
| 340 | let content = if self.config.borrow().input().markdown_input() { | |
| 341 | MessageEventContent::Text(TextMessageEventContent::markdown(input)) | |
| 342 | } else { | |
| 343 | MessageEventContent::Text(TextMessageEventContent::plain(input)) | |
| 344 | }; | |
| 345 | ||
| 343 | 346 | self.send_message(content).await; |
| 344 | 347 | } |
| 345 | 348 | } |