add client_connected/3

This commit is contained in:
Feng 2016-01-21 15:37:25 +08:00
parent 7193bf4f20
commit 166e085fff
1 changed files with 3 additions and 1 deletions

View File

@ -52,7 +52,9 @@ client_connected(?CONNACK_ACCEPT, #mqtt_client{client_id = ClientId,
#state{topics = Topics, stored = Stored}) -> #state{topics = Topics, stored = Stored}) ->
Replace = fun(Topic) -> rep(<<"$u">>, Username, rep(<<"$c">>, ClientId, Topic)) end, Replace = fun(Topic) -> rep(<<"$u">>, Username, rep(<<"$c">>, ClientId, Topic)) end,
TopicTable = with_stored(Stored, ClientId, [{Replace(Topic), Qos} || {Topic, Qos} <- Topics]), TopicTable = with_stored(Stored, ClientId, [{Replace(Topic), Qos} || {Topic, Qos} <- Topics]),
emqttd_client:subscribe(ClientPid, TopicTable). emqttd_client:subscribe(ClientPid, TopicTable);
client_connected(_ConnAck, _Client, _State) -> ok.
with_stored(false, _ClientId, TopicTable) -> with_stored(false, _ClientId, TopicTable) ->
TopicTable; TopicTable;