From 3eb7e7688dea39fa83f41c1f9aba79a962ef1a15 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 25 Jun 2010 04:36:06 +0200 Subject: Create conversation tabs for new conversations --- src/core/ephraim.erl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/core/ephraim.erl') diff --git a/src/core/ephraim.erl b/src/core/ephraim.erl index bd36118..61c3c68 100644 --- a/src/core/ephraim.erl +++ b/src/core/ephraim.erl @@ -32,17 +32,21 @@ init() -> -spec get_conv(#state{},exmpp_jid:jid()) -> {#state{},pid()|undefined}. get_conv(State, JID) -> - Key = exmpp_jid:to_lower(JID), - case Key of - {_,_,undefined} -> + {Node, Domain, Resource} = exmpp_jid:to_lower(exmpp_jid:parse(JID)), + + case Resource of + undefined -> {State, undefined}; _ -> + Key = list_to_binary([Node, <<"@">>, Domain, <<"/">>, Resource]), + case dict:find(Key, State#state.convs) of {ok, Conv} -> {State, Conv}; error -> Conv = spawn(ephraim_conv, init, [Key]), Dict = dict:store(Key, Conv, State#state.convs), + self() ! {ui_update, {new_conversation, Key}}, {State#state{convs=Dict}, Conv} end end. -- cgit v1.2.3