Login to muc room with exmpp
How can i login with exmpp bot to multi user chat room?
try to use:
create_move_room (Room, Username) ->
#xmlel {name=presence, attrs=[#xmlattr{name = to,
value = list_to_binary(Room ++ "@" ++ ? JABBER_MUC_HOST ++ "/" ++ Username)}],
开发者_开发问答 children=[#xmlel{name=x,attrs=[#xmlattr{name=xmlns, value="?MUC"}]}]}.
But get error:
** Reason for termination =
** {badarg,[{erlang,binary_to_list,[to]},
{exmpp_xml,xmlnsattributes_to_xmlattributes2,3},
{exmpp_xml,unresolve_xmlel_nss,3},
{exmpp_xml,node_to_iolist2,4},
{exmpp_xml,node_to_binary,3},
{exmpp_socket,send,2},
{exmpp_session,send_packet,3},
{exmpp_session,logged_in,3}]}
Thank you.
The error is because someone is calling binary_to_list/1 on an atom ('to').
most likely the problem is the "name = to". perhaps it should be the binary <<"to">>, list "to", or maybe even the variable To (if that exists).
加载中,请稍侯......
精彩评论