Nimrodda / mod_offline_http_post

Ejabberd 16.08 module to send offline user's message via POST request to target URL
Other
4 stars 7 forks source link

Syntax error at line 43 #2

Closed thang2410199 closed 7 years ago

thang2410199 commented 7 years ago

https://github.com/Nimrodda/mod_offline_http_post/blob/master/src/mod_offline_http_post.erl#L43

after I change the line to

Data = string:join([binary_to_list(AuthTokenKey), binary_to_list(Token), "&to=", binary_to_list(ToUser), "&from=", binary_to_list(FromUser), "&vhost=", binary_to_list(Vhost), "&body=", binary_to_list(Body), "&messageId=", binary_to_list(MessageId)]),

The mod crash with this log:

23:20:29.787 [error] Hook offline_message_hook crashed when running mod_offline_http_post:create_message/1: Reason = {error,function_clause,[{mod_offline_http_post,create_message,[{file,"/Users/thang2410199/.ejabberd-modules/sources/mod_offline_http_post/src/mod_offline_http_post.erl"},{line,24}],[{bounce,{message,<<"purplec5bd947f">>,chat,<<"en">>,{jid,<<"nhat">>,<<"localhost">>,<<"Thangs-MacBook-Pro">>,<<"nhat">>,<<"localhost">>,<<"Thangs-MacBook-Pro">>},{jid,<<"tung">>,<<"localhost">>,<<>>,<<"tung">>,<<"localhost">>,<<>>},[],[],undefined,[{xmlel,<<"composing">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/chatstates">>}],[]}],#{ip => {0,0,0,0,0,0,0,1}}}}]},{ejabberd_hooks,safe_apply,[{file,"src/ejabberd_hooks.erl"},{line,380}],4},{ejabberd_hooks,run_fold1,[{file,"src/ejabberd_hooks.erl"},{line,364}],4},{ejabberd_sm,route,[{file,"src/ejabberd_sm.erl"},{line,138}],1},{ejabberd_local,route,[{file,"src/ejabberd_local.erl"},{line,116}],1},{ejabberd_router,do_route,[{file,"src/ejabberd_router.erl"},{line,348}],1},{ejabberd_router,route,[{file,"src/ejabberd_router.erl"},{line,87}],1},{ejabberd_c2s,check_privacy_then_route,[{file,"src/ejabberd_c2s.erl"},{line,797}],2}]} Arguments = [{bounce,{message,<<"purplec5bd947f">>,chat,<<"en">>,{jid,<<"nhat">>,<<"localhost">>,<<"Thangs-MacBook-Pro">>,<<"nhat">>,<<"localhost">>,<<"Thangs-MacBook-Pro">>},{jid,<<"tung">>,<<"localhost">>,<<>>,<<"tung">>,<<"localhost">>,<<>>},[],[],undefined,[{xmlel,<<"composing">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/chatstates">>}],[]}],#{ip => {0,0,0,0,0,0,0,1}}}}]

budhead commented 7 years ago

Seems like the line is truncated. I'll push a new variant with reformatted line. Really Sorry for the inconvenience.

budhead commented 7 years ago

I just submitted a pull request and soon I hope it will be accepted. During this here is the whole line 43: Data = string:join([binary_to_list(AuthTokenKey), binary_to_list(Token), "&to=", binary_to_list(ToUser), "&from=", binary_to_list(FromUser), "&vhost=", binary_to_list(Vhost), "&body=", binary_to_list(Body), "&messageId=", binary_to_list(MessageId)], ""),