SHARE
TWEET

user_receive_packet hook

krot Jun 4th, 2020 (edited) 1,150 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. отправляемые пользователю recv исх
  2. user_receive_packet(Acc, #jid{lserver = LServer}, From, _To,Packet = #xmlel{name = <<"iq">>}) ->
  3. Query=exml_query:path(Packet, [{element_with_ns, <<"query">>,<<"urn:xmpp:muclight:0#affiliations">>}]),
  4. case Query of
  5. undefined-> Acc;
  6. _->
  7. %io:format("user_receive_packet ~p  ~p~n",[Packet,Query]),
  8.  
  9. Acc
  10. end
  11. ;
  12. user_receive_packet(Acc, _Jid, _From, _To,_Packet) ->
  13. Acc.   
  14. отправляет пользователь send вход
  15. -spec user_send_packet(mongoose_acc:t(), From :: jid:jid(), To :: jid:jid(),
  16.                        Packet :: exml:element()) -> mongoose_acc:t().
  17. user_send_packet(Acc, From, To, Packet = #xmlel{name = <<"iq">>}) ->
  18.      io:format("user_send_packet ~p  ~n",[Packet]),
  19.   Acc;
  20. user_send_packet(Acc, _From, _To, _Packet) ->
  21.     Acc.
  22.  
  23.  
  24.  
  25.     ejabberd_hooks:add(user_receive_packet, Host, ?MODULE, user_receive_packet, 500),
  26.        ejabberd_hooks:add(user_send_packet, Host, ?MODULE, user_send_packet, 500),
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top