fix_privacy_mod_on_login: set some options after login
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
		
							parent
							
								
									2762f541e2
								
							
						
					
					
						commit
						a9f40df2bc
					
				| @ -946,10 +946,6 @@ impl LoginConfigHandler { | ||||
|             msg.lock_after_session_end = BoolOption::Yes.into(); | ||||
|             n += 1; | ||||
|         } | ||||
|         if self.get_toggle_option("privacy-mode") { | ||||
|             msg.privacy_mode = BoolOption::Yes.into(); | ||||
|             n += 1; | ||||
|         } | ||||
|         if self.get_toggle_option("disable-audio") { | ||||
|             msg.disable_audio = BoolOption::Yes.into(); | ||||
|             n += 1; | ||||
| @ -973,6 +969,23 @@ impl LoginConfigHandler { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     pub fn get_option_message_after_login(&self) -> Option<OptionMessage> { | ||||
|         if self.is_port_forward || self.is_file_transfer { | ||||
|             return None; | ||||
|         } | ||||
|         let mut n = 0; | ||||
|         let mut msg = OptionMessage::new(); | ||||
|         if self.get_toggle_option("privacy-mode") { | ||||
|             msg.privacy_mode = BoolOption::Yes.into(); | ||||
|             n += 1; | ||||
|         } | ||||
|         if n > 0 { | ||||
|             Some(msg) | ||||
|         } else { | ||||
|             None | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     fn get_image_quality_enum(&self, q: &str, ignore_default: bool) -> Option<ImageQuality> { | ||||
|         if q == "low" { | ||||
|             Some(ImageQuality::Low) | ||||
|  | ||||
| @ -2076,6 +2076,22 @@ impl Remote { | ||||
|         true | ||||
|     } | ||||
| 
 | ||||
|     async fn send_opts_after_login(&self, peer: &mut Stream) { | ||||
|         if let Some(opts) = self | ||||
|         .handler | ||||
|         .lc | ||||
|         .read() | ||||
|         .unwrap() | ||||
|         .get_option_message_after_login() | ||||
|     { | ||||
|         let mut misc = Misc::new(); | ||||
|         misc.set_option(opts); | ||||
|         let mut msg_out = Message::new(); | ||||
|         msg_out.set_misc(misc); | ||||
|         allow_err!(peer.send(&msg_out).await); | ||||
|     } | ||||
|     } | ||||
| 
 | ||||
|     async fn handle_msg_from_peer(&mut self, data: &[u8], peer: &mut Stream) -> bool { | ||||
|         if let Ok(msg_in) = Message::parse_from_bytes(&data) { | ||||
|             match msg_in.union { | ||||
| @ -2084,6 +2100,7 @@ impl Remote { | ||||
|                         self.first_frame = true; | ||||
|                         self.handler.call2("closeSuccess", &make_args!()); | ||||
|                         self.handler.call("adaptSize", &make_args!()); | ||||
|                         self.send_opts_after_login(peer).await; | ||||
|                     } | ||||
|                     let incomming_format = CodecFormat::from(&vf); | ||||
|                     if self.video_format != incomming_format { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user