diff --git a/conversations/src/context.rs b/conversations/src/context.rs index 3e16386..4ca0bc0 100644 --- a/conversations/src/context.rs +++ b/conversations/src/context.rs @@ -22,7 +22,7 @@ pub struct Context { impl Context { pub fn new() -> Self { - let identity = Rc::new(Identity::new()); + let identity = Rc::new(Identity::default()); let inbox = Inbox::new(Rc::clone(&identity)); // Self { _identity: identity, @@ -31,6 +31,20 @@ impl Context { } } + pub fn new_with_name(name: impl Into) -> Self { + let identity = Rc::new(Identity::new(name)); + let inbox = Inbox::new(Rc::clone(&identity)); // + Self { + _identity: identity, + store: ConversationStore::new(), + inbox, + } + } + + pub fn get_friendly_name(&self) -> &str { + self._identity.get_name() + } + pub fn create_private_convo( &mut self, remote_bundle: &Introduction,