Commit f0b5c30eb1
Unsigned
Layout: unified · split
src/server.rs +24 −9
| @@ -904,6 +904,7 @@ impl InnerServer { | ||
| 904 | 904 | &self, |
| 905 | 905 | connection: Connection, |
| 906 | 906 | ) -> Result<(), Error> { |
| 907 | let client = connection.client(); | |
| 907 | 908 | let mut response = connection.devices().await?; |
| 908 | 909 | |
| 909 | 910 | if response.devices.is_empty() { |
| @@ -919,20 +920,34 @@ impl InnerServer { | ||
| 919 | 920 | )); |
| 920 | 921 | |
| 921 | 922 | response.devices.sort_by_key(|d| Reverse(d.last_seen_ts)); |
| 922 | let own_device_id = connection.client().device_id(); | |
| 923 | let own_user_id = connection | |
| 924 | .client() | |
| 925 | .user_id() | |
| 923 | let own_device_id = client.device_id(); | |
| 924 | let own_user_id = client | |
| 925 | .session_meta() | |
| 926 | .map(|s| s.user_id.to_owned()) | |
| 926 | 927 | .expect("Getting our own devices while not being logged in"); |
| 927 | 928 | |
| 928 | 929 | let mut lines: Vec<String> = Vec::new(); |
| 929 | 930 | |
| 930 | 931 | for device_info in response.devices { |
| 931 | let device = connection | |
| 932 | .client() | |
| 933 | .encryption() | |
| 934 | .get_device(&own_user_id, &device_info.device_id) | |
| 935 | .await?; | |
| 932 | let client = client.clone(); | |
| 933 | let own_user_id = own_user_id.clone(); | |
| 934 | let device_info_move = device_info.clone(); | |
| 935 | let device = match connection | |
| 936 | .spawn(async move { | |
| 937 | client | |
| 938 | .clone() | |
| 939 | .encryption() | |
| 940 | .get_device(&own_user_id, &device_info_move.device_id) | |
| 941 | .await | |
| 942 | }) | |
| 943 | .await | |
| 944 | { | |
| 945 | Ok(d) => d, | |
| 946 | Err(e) => { | |
| 947 | self.print_error(&format!("Failed to obtain device: {e}")); | |
| 948 | continue; | |
| 949 | } | |
| 950 | }; | |
| 936 | 951 | |
| 937 | 952 | let own_device = own_device_id == Some(&device_info.device_id); |
| 938 | 953 | |