From 29b4b5ae3058bb7fb44b329fa8d51c15c2eba096 Mon Sep 17 00:00:00 2001 From: Tom Quackenbush Date: Tue, 9 Aug 2016 16:49:14 -0400 Subject: [PATCH] pull message body attibs to look for lang --- mod_pottymouth/src/mod_pottymouth.erl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mod_pottymouth/src/mod_pottymouth.erl b/mod_pottymouth/src/mod_pottymouth.erl index 0260344..6d6ddae 100644 --- a/mod_pottymouth/src/mod_pottymouth.erl +++ b/mod_pottymouth/src/mod_pottymouth.erl @@ -62,13 +62,13 @@ stop(_Host) -> on_filter_packet(drop) -> drop; -on_filter_packet({_From, _To, {xmlel, <<"message">>, Attrs, [_chatState, {xmlel, <<"body">>, _BodyAttr, [{xmlcdata, MessageText}] = _BodyCData} = _MessageBody] = _Els} = _Packet} = _Msg) -> - FilteredMessageWords = filterMessageText(Attrs, MessageText), - {_From, _To, {xmlel, <<"message">>, Attrs, [_chatState, {xmlel, <<"body">>, _BodyAttr, [{xmlcdata, FilteredMessageWords}]}]}}; +on_filter_packet({_From, _To, {xmlel, <<"message">>, _Attrs, [_chatState, {xmlel, <<"body">>, BodyAttr, [{xmlcdata, MessageText}] = _BodyCData} = _MessageBody] = _Els} = _Packet} = _Msg) -> + FilteredMessageWords = filterMessageText(BodyAttr, MessageText), + {_From, _To, {xmlel, <<"message">>, _Attrs, [_chatState, {xmlel, <<"body">>, BodyAttr, [{xmlcdata, FilteredMessageWords}]}]}}; -on_filter_packet({_From, _To, {xmlel, <<"message">>, Attrs, [{xmlel, <<"body">>, _BodyAttr, [{xmlcdata, MessageText}] = _BodyCData} = _MessageBody] = _Els} = _Packet} = _Msg) -> - FilteredMessageWords = filterMessageText(Attrs, MessageText), - {_From, _To, {xmlel, <<"message">>, Attrs, [{xmlel, <<"body">>, _BodyAttr, [{xmlcdata, FilteredMessageWords}]}]}}; +on_filter_packet({_From, _To, {xmlel, <<"message">>, _Attrs, [{xmlel, <<"body">>, BodyAttr, [{xmlcdata, MessageText}] = _BodyCData} = _MessageBody] = _Els} = _Packet} = _Msg) -> + FilteredMessageWords = filterMessageText(BodyAttr, MessageText), + {_From, _To, {xmlel, <<"message">>, _Attrs, [{xmlel, <<"body">>, BodyAttr, [{xmlcdata, FilteredMessageWords}]}]}}; on_filter_packet(Msg) -> % Handle the generic case (any packet that isn't a message with a body).