diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2010-06-25 04:36:06 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2010-06-25 04:36:06 +0200 |
commit | 3eb7e7688dea39fa83f41c1f9aba79a962ef1a15 (patch) | |
tree | 91d91bfb779f2d502d88af1e5dec53f5fab23905 /src/core/ephraim.erl | |
parent | d5adf274c137bef22d5695d4a280e10068edcb0e (diff) | |
download | ephraim-3eb7e7688dea39fa83f41c1f9aba79a962ef1a15.tar ephraim-3eb7e7688dea39fa83f41c1f9aba79a962ef1a15.zip |
Create conversation tabs for new conversations
Diffstat (limited to 'src/core/ephraim.erl')
-rw-r--r-- | src/core/ephraim.erl | 10 |
1 files changed, 7 insertions, 3 deletions
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. |