Commit 43b159a006

43b159a00645803ee1306d04556760eda0f5944a

parent: 341ba19fcc

Unregistered key

Valentin Brandl <vbrandl@riseup.net> · 2020-05-08 15:59 UTC

Fix changes in upstream APIs

Layout: unified · split

src/room_buffer.rs +2 −2
@@ -111,7 +111,7 @@ impl RoomBuffer {
111 111
112 let buffer_settings = BufferSettingsAsync::new(&room_id.to_string()) 112 let buffer_settings = BufferSettingsAsync::new(&room_id.to_string())
113 .input_callback(room.clone()) 113 .input_callback(room.clone())
114 .close_callback(|weechat, buffer| { 114 .close_callback(|weechat: &Weechat, buffer: &Buffer| {
115 // TODO remove the roombuffer from the server here. 115 // TODO remove the roombuffer from the server here.
116 // TODO leave the room if the plugin isn't unloading. 116 // TODO leave the room if the plugin isn't unloading.
117 Ok(()) 117 Ok(())
@@ -148,7 +148,7 @@ impl RoomBuffer {
148 148
149 pub fn calculate_buffer_name(&self) -> String { 149 pub fn calculate_buffer_name(&self) -> String {
150 let room = self.room(); 150 let room = self.room();
151 let room_name = room.calculate_name(); 151 let room_name = room.display_name();
152 152
153 if room_name == "#" { 153 if room_name == "#" {
154 "##".to_owned() 154 "##".to_owned()
src/server.rs +7 −7
@@ -69,7 +69,7 @@ use matrix_sdk::{
69 room::message::{MessageEventContent, TextMessageEventContent}, 69 room::message::{MessageEventContent, TextMessageEventContent},
70 }, 70 },
71 identifiers::{RoomId, UserId}, 71 identifiers::{RoomId, UserId},
72 AsyncClient, AsyncClientConfig, SyncSettings, 72 Client, ClientConfig, SyncSettings,
73}; 73};
74 74
75use weechat::config::{ 75use weechat::config::{
@@ -149,7 +149,7 @@ pub(crate) struct InnerServer {
149 room_buffers: HashMap<RoomId, RoomBuffer>, 149 room_buffers: HashMap<RoomId, RoomBuffer>,
150 settings: ServerSettings, 150 settings: ServerSettings,
151 config: Config, 151 config: Config,
152 client: Option<AsyncClient>, 152 client: Option<Client>,
153 login_state: Option<LoginState>, 153 login_state: Option<LoginState>,
154 connected_state: Rc<RefCell<Option<Connection>>>, 154 connected_state: Rc<RefCell<Option<Connection>>>,
155} 155}
@@ -414,13 +414,13 @@ impl InnerServer {
414 self.login_state = Some(login_state); 414 self.login_state = Some(login_state);
415 } 415 }
416 416
417 pub fn create_client(&mut self) -> Result<AsyncClient, ServerError> { 417 pub fn create_client(&mut self) -> Result<Client, ServerError> {
418 let homeserver = 418 let homeserver =
419 self.settings.homeserver.as_ref().ok_or_else(|| { 419 self.settings.homeserver.as_ref().ok_or_else(|| {
420 ServerError::StartError("Homeserver not configured".to_owned()) 420 ServerError::StartError("Homeserver not configured".to_owned())
421 })?; 421 })?;
422 422
423 let mut client_config = AsyncClientConfig::new(); 423 let mut client_config = ClientConfig::new();
424 424
425 if let Some(proxy) = &self.settings.proxy { 425 if let Some(proxy) = &self.settings.proxy {
426 client_config = client_config 426 client_config = client_config
@@ -429,7 +429,7 @@ impl InnerServer {
429 .disable_ssl_verification(); 429 .disable_ssl_verification();
430 } 430 }
431 431
432 let client = AsyncClient::new_with_config( 432 let client = Client::new_with_config(
433 homeserver.clone(), 433 homeserver.clone(),
434 None, 434 None,
435 client_config, 435 client_config,
@@ -522,7 +522,7 @@ impl MatrixServer {
522 /// This runs on the per server tokio executor. 522 /// This runs on the per server tokio executor.
523 /// It communicates with the main Weechat thread using a async channel. 523 /// It communicates with the main Weechat thread using a async channel.
524 pub async fn sync_loop( 524 pub async fn sync_loop(
525 client: AsyncClient, 525 client: Client,
526 channel: Sender<Result<ThreadMessage, String>>, 526 channel: Sender<Result<ThreadMessage, String>>,
527 username: String, 527 username: String,
528 password: String, 528 password: String,
@@ -629,7 +629,7 @@ impl MatrixServer {
629 /// Send loop that waits for requests that need to be sent out using our 629 /// Send loop that waits for requests that need to be sent out using our
630 /// Matrix client. 630 /// Matrix client.
631 pub async fn send_loop( 631 pub async fn send_loop(
632 client: AsyncClient, 632 client: Client,
633 channel: Receiver<ServerMessage>, 633 channel: Receiver<ServerMessage>,
634 ) { 634 ) {
635 while let Some(message) = channel.recv().await { 635 while let Some(message) = channel.recv().await {