johanvorster / ejabberd_add_timestamp

Adding a timestamp to a message. Or just a general example of how to add extra tags and data to an ejabberd stanza.
11 stars 4 forks source link

error on starting ejabberd #1

Open navjeetc opened 8 years ago

navjeetc commented 8 years ago

I was compile a beam file after modifying line 14 from -include("ejabberd.hrl"). to -include("logger.hrl").

but now when start ejabberd I get the error

options: [] error: undef [{p1_logger,info_msg, [mod_add_timestamp,18,"starting mod_add_timestamp",[]], []}, {mod_add_timestamp,start,2, [{file,"/home/ec2-user/ejabberd_add_timestamp/mod_add_timestamp.erl"}, {line,18}]}, {gen_mod,start_module,3,[{file,"src/gen_mod.erl"},{line,99}]}, {lists,foreach,2,[{file,"lists.erl"},{line,1336}]}, {ejabberd_app,start,2,[{file,"src/ejabberd_app.erl"},{line,72}]}, {application_master,start_it_old,4, [{file,"application_master.erl"},{line,272}]}] 2016-01-08 04:34:32.895 [critical] <0.38.0>@gen_mod:start_module:112 ejabberd initialization was aborted because a module start failed. I am Erlang newbie so any suggestions to fix this will be helpful

johanvorster commented 8 years ago

Have you tried deleting all the logging code?

This code was created quite a few versions ago.

Sent from my iPhone

On 8 Jan 2016, at 04:37, Navjeet notifications@github.com wrote:

I was compile a beam file after modifying line 14 from -include("ejabberd.hrl"). to -include("logger.hrl").

but now when start ejabberd I get the error

options: [] error: undef [{p1_logger,info_msg, [mod_add_timestamp,18,"starting mod_add_timestamp",[]], []}, {mod_add_timestamp,start,2, [{file,"/home/ec2-user/ejabberd_add_timestamp/mod_add_timestamp.erl"}, {line,18}]}, {gen_mod,start_module,3,[{file,"src/gen_mod.erl"},{line,99}]}, {lists,foreach,2,[{file,"lists.erl"},{line,1336}]}, {ejabberd_app,start,2,[{file,"src/ejabberd_app.erl"},{line,72}]}, {application_master,start_it_old,4, [{file,"application_master.erl"},{line,272}]}] 2016-01-08 04:34:32.895 [critical] <0.38.0>@gen_mod:start_module:112 ejabberd initialization was aborted because a module start failed. I am Erlang newbie so any suggestions to fix this will be helpful

— Reply to this email directly or view it on GitHub.

navjeetc commented 8 years ago

Actually I got the logging code working but now the code to pattern match the packet is not extracting message type, I will provide more info tonight

navjeetc commented 8 years ago

Ok the whole packet being printed by debug statement is

2016-01-09 06:15:53.749 [debug] <0.589.0>@mod_add_timestamp:on_filter_packet:33 on_filter_packet {{jid,<"lobby-ae588d0b-5264-4fb5-8d00-3ad390bd7c0b">>,<<"conference.chat.myserver.io">>,<<"uberchopper">>,<<"lobby-ae588d0b-5264-4fb5-8d00-3ad390bd7c0b">>,<<"conference.chat.myserver.io">>,<<"uberchopper">>},{jid,<<"17033143955uberchopper">>,<<"chat.myserver.io">>,<<"uberchopper">>,<<"17033143955uberchopper">>,<<"chat.myserver.io">>,<<"uberchopper">>},{xmlel,<<"message">>,[{<<"to">>,<<"lobby-ae588d0b-5264-4fb5-8d00-3ad390bd7c0b@conference.chat.myserver.io">},{<<"type">>,<<"groupchat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"Test">>}]},{xmlel,<<"profile">>,[{<<"xmlns">>,<<"selfie:data">>}],[{xmlel,<<"profileImageURL">>,[],[]},{xmlel,<<"age">>,[],[{xmlcdata,<<"0">>}]},{xmlel,<<"gender">>,[],[]},{xmlel,<<"message">>,[],[]}]}]}}

And XML part of the packet is:

2016-01-09 06:15:53.750 [debug] <0.589.0>@mod_add_timestamp:on_filter_packet:34 on_filter_packet {xmlel,<"message">>,[{<<"to">>,<<"lobby-ae588d0b-5264-4fb5-8d00-3ad390bd7c0b@conference.chat.myserver.io">},{<<"type">>,<<"groupchat">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"Test">>}]},{xmlel,<<"profile">>,[{<<"xmlns">>,<<"selfie:data">>}],[{xmlel,<<"profileImageURL">>,[],[]},{xmlel,<<"age">>,[],[{xmlcdata,<<"0">>}]},{xmlel,<<"gender">>,[],[]},{xmlel,<<"message">>,[],[]}]}]}

BTW I only need this for group chat for now, so I will modify the code to look for type = groupchat, after XML is being extracted properly

lowolf commented 8 years ago

Hi all

Navjeetc did you fix trouble and add supporting groupchat? I use ejabberd 16.0

navjeetc commented 8 years ago

No, I did not

lowolf commented 8 years ago

But for single chat work correct? Because I do not have correct work, timestamp didn't add

johanvorster commented 8 years ago

http://justcreative.com/2016/03/17/html5-vs-native-apps-whats-best-for-2016/

Sent from my iPhone