@@ -33,7 +33,7 @@ use tracing::info;
3333/// * `dialogs` uses RwLock for concurrent read access with exclusive writes
3434pub struct DialogLayerInner {
3535 pub ( super ) last_seq : AtomicU32 ,
36- pub ( super ) dialogs : RwLock < HashMap < DialogId , Dialog > > ,
36+ pub ( super ) dialogs : RwLock < HashMap < String , Dialog > > ,
3737}
3838pub type DialogLayerInnerRef = Arc < DialogLayerInner > ;
3939
@@ -154,7 +154,13 @@ impl DialogLayer {
154154 ) -> Result < ServerInviteDialog > {
155155 let mut id = DialogId :: try_from ( & tx. original ) ?;
156156 if !id. to_tag . is_empty ( ) {
157- let dlg = self . inner . dialogs . read ( ) . unwrap ( ) . get ( & id) . cloned ( ) ;
157+ let dlg = self
158+ . inner
159+ . dialogs
160+ . read ( )
161+ . unwrap ( )
162+ . get ( & id. to_string ( ) )
163+ . cloned ( ) ;
158164 match dlg {
159165 Some ( Dialog :: ServerInvite ( dlg) ) => return Ok ( dlg) ,
160166 _ => {
@@ -195,7 +201,7 @@ impl DialogLayer {
195201 . dialogs
196202 . write ( )
197203 . unwrap ( )
198- . insert ( id. clone ( ) , Dialog :: ServerInvite ( dialog. clone ( ) ) ) ;
204+ . insert ( id. to_string ( ) , Dialog :: ServerInvite ( dialog. clone ( ) ) ) ;
199205 info ! ( %id, "server invite dialog created" ) ;
200206 Ok ( dialog)
201207 }
@@ -209,7 +215,7 @@ impl DialogLayer {
209215 self . inner . dialogs . read ( ) . unwrap ( ) . len ( )
210216 }
211217
212- pub fn all_dialog_ids ( & self ) -> Vec < DialogId > {
218+ pub fn all_dialog_ids ( & self ) -> Vec < String > {
213219 self . inner
214220 . dialogs
215221 . read ( )
@@ -220,6 +226,10 @@ impl DialogLayer {
220226 }
221227
222228 pub fn get_dialog ( & self , id : & DialogId ) -> Option < Dialog > {
229+ self . get_dialog_with ( & id. to_string ( ) )
230+ }
231+
232+ pub fn get_dialog_with ( & self , id : & String ) -> Option < Dialog > {
223233 match self . inner . dialogs . read ( ) {
224234 Ok ( dialogs) => match dialogs. get ( id) {
225235 Some ( dialog) => Some ( dialog. clone ( ) ) ,
@@ -235,7 +245,7 @@ impl DialogLayer {
235245 . dialogs
236246 . write ( )
237247 . unwrap ( )
238- . remove ( id )
248+ . remove ( & id . to_string ( ) )
239249 . map ( |d| d. on_remove ( ) ) ;
240250 }
241251
0 commit comments