]> granicus.if.org Git - ejabberd/commitdiff
Fix (un)setting of priority
authorEvgeny Khramtsov <ekhramtsov@process-one.net>
Mon, 10 Dec 2018 14:06:21 +0000 (17:06 +0300)
committerEvgeny Khramtsov <ekhramtsov@process-one.net>
Mon, 10 Dec 2018 14:06:21 +0000 (17:06 +0300)
src/ejabberd_sm.erl

index 821a7883ebb0946e04084b80b512ead1a7cd5ca0..6c00815d54986c012c6112ea3f33296c74ae2ab2 100644 (file)
@@ -317,7 +317,7 @@ set_presence(SID, User, Server, Resource, Priority, Presence) ->
     case get_sessions(Mod, LUser, LServer, LResource) of
        [] -> {error, notfound};
        Ss ->
-           case lists:keyfind(SID, 1, Ss) of
+           case lists:keyfind(SID, #session.sid, Ss) of
                #session{info = Info} ->
                    set_session(SID, User, Server, Resource, Priority, Info),
                    ejabberd_hooks:run(set_presence_hook,
@@ -339,7 +339,7 @@ unset_presence(SID, User, Server, Resource, Status) ->
     case get_sessions(Mod, LUser, LServer, LResource) of
        [] -> {error, notfound};
        Ss ->
-           case lists:keyfind(SID, 1, Ss) of
+           case lists:keyfind(SID, #session.sid, Ss) of
                #session{info = Info} ->
                    set_session(SID, User, Server, Resource, undefined, Info),
                    ejabberd_hooks:run(unset_presence_hook,