Commit 1d27f59d36

1d27f59d36a70c4db95c702e17d46b851fa7cfde

parent: 69203b09bc

Unsigned

Damir Jelić <poljar@termina.org.uk> · 2021-01-03 15:44 UTC

weechat-matrix: Formatting fixes.

Layout: unified · split

src/bar_items/status.rs +1 −3
@@ -31,9 +31,7 @@ impl BarItemCallback for Status {
31 } 31 }
32 32
33 if room.is_busy() { 33 if room.is_busy() {
34 signs.push( 34 signs.push(server.config().borrow().look().busy_sign());
35 server.config().borrow().look().busy_sign(),
36 );
37 } 35 }
38 } 36 }
39 37
src/connection.rs +7 −2
@@ -43,7 +43,10 @@ use matrix_sdk::{
43 43
44use weechat::{Task, Weechat}; 44use weechat::{Task, Weechat};
45 45
46use crate::{room::PrevBatch, server::{InnerServer, MatrixServer}}; 46use crate::{
47 room::PrevBatch,
48 server::{InnerServer, MatrixServer},
49};
47 50
48const DEFAULT_SYNC_TIMEOUT: Duration = Duration::from_secs(30); 51const DEFAULT_SYNC_TIMEOUT: Duration = Duration::from_secs(30);
49pub const TYPING_NOTICE_TIMEOUT: Duration = Duration::from_secs(4); 52pub const TYPING_NOTICE_TIMEOUT: Duration = Duration::from_secs(4);
@@ -209,7 +212,9 @@ impl Connection {
209 212
210 self.spawn(async move { 213 self.spawn(async move {
211 let request = match &prev_batch { 214 let request = match &prev_batch {
212 PrevBatch::Backwards(t) => MessagesRequest::backward(&room_id, &t), 215 PrevBatch::Backwards(t) => {
216 MessagesRequest::backward(&room_id, &t)
217 }
213 PrevBatch::Forward(t) => MessagesRequest::forward(&room_id, &t), 218 PrevBatch::Forward(t) => MessagesRequest::forward(&room_id, &t),
214 }; 219 };
215 220
src/lib.rs +10 −6
@@ -75,7 +75,9 @@ impl Servers {
75 } 75 }
76 76
77 pub fn insert(&self, server: MatrixServer) { 77 pub fn insert(&self, server: MatrixServer) {
78 self.0.borrow_mut().insert(server.name().to_string(), server); 78 self.0
79 .borrow_mut()
80 .insert(server.name().to_string(), server);
79 } 81 }
80 82
81 pub fn get(&self, server_name: &str) -> Option<MatrixServer> { 83 pub fn get(&self, server_name: &str) -> Option<MatrixServer> {
@@ -177,10 +179,7 @@ impl Matrix {
177 } 179 }
178 } 180 }
179 181
180 fn create_default_server( 182 fn create_default_server(servers: Servers, config: &ConfigHandle) {
181 servers: Servers,
182 config: &ConfigHandle,
183 ) {
184 // TODO change this to matrix.org. 183 // TODO change this to matrix.org.
185 let server_name = "localhost"; 184 let server_name = "localhost";
186 185
@@ -189,7 +188,12 @@ impl Matrix {
189 .search_section_mut("server") 188 .search_section_mut("server")
190 .expect("Can't get server section"); 189 .expect("Can't get server section");
191 190
192 let server = MatrixServer::new(server_name, config, &mut section, servers.clone()); 191 let server = MatrixServer::new(
192 server_name,
193 config,
194 &mut section,
195 servers.clone(),
196 );
193 servers.insert(server); 197 servers.insert(server);
194 } 198 }
195} 199}