The following is one of the packet logged in the function which is called by filter_packet hook.
I(<0.10945.0>:my_module:46) : in_filter_packet: {xmlelement,"message",
[{"type","headline"}],
[{xmlelement,"event",
[{"xmlns",
"http://jabber.org/protocol/pubsub#event"}],
[{xmlelement,"items",
[{"node",
"http://jabber.org/protocol/tune"}],
[{xmlelement,"item",
[{"id",
"5A487A38503FE"}],
[{xmlelement,"tune",
[{"xmlns",
"http://jabber.org/protocol/tune"}],
[]}]}]}]},
{xmlelement,"addresses",
[{"xmlns",
"http://jabber.org/protocol/address"}],
[{xmlelement,"address",
[{"type","replyto"},
{"jid",
"test1@ubuntu/10042049171444555575238273"}],
[]}]}]}
How to filter out only the "message" , "type" packets ? i.e currently the hooked function looks like
on_filter_packet({From, To, Packet} = Input) ->
?INFO_MSG("in_filter_packet: ~p ", [Packet]), %[gen_mod:get_module_opt(global, ?MODULE, debug, false)]),
Input.
How to write the code ** if (packet.type == message) only then print ** ?