我想从其中一个ejabberd挂钩获取房间的名称或主题。 我有一个像下面的代码中的方法,我想在该方法中得到房间的名称或主题。 有可能吗?
muc_filter_message(Stanza, MUCState, RoomJID, FromJID, FromNick) ->
PostUrl = gen_mod:get_module_opt(FromJID#jid.lserver, ?MODULE, post_url, fun(S) -> iolist_to_binary(S) end, list_to_binary("")),
Token = gen_mod:get_module_opt(FromJID#jid.lserver, ?MODULE, auth_token, fun(S) -> iolist_to_binary(S) end, list_to_binary("")),
Body = fxml:get_path_s(Stanza, [{elem, list_to_binary("body")}, cdata]),
_LISTUSERS = lists:map(
fun({_LJID, Info}) ->
binary_to_list(Info#user.jid#jid.luser) ++ ".."
end,
dict:to_list(MUCState#state.users)
),
?DEBUG(" ######### GROUPCHAT _LISTUSERS = ~p~n ####### ", [_LISTUSERS]),
_AFILLIATIONS = lists:map(
fun({{Uname, _Domain, _Res}, _Stuff}) ->
binary_to_list(Uname) ++ ".."
end,
dict:to_list(MUCState#state.affiliations)
),
?DEBUG(" ######### GROUPCHAT _AFILLIATIONS = ~p~n ####### ", [_AFILLIATIONS]),
_OFFLINE = lists:subtract(_AFILLIATIONS, _LISTUSERS),
?DEBUG(" ######### GROUPCHAT _OFFLINE = ~p~n ####### ", [_OFFLINE]),
if
Stanza /= "", length(_OFFLINE) > 0 ->
Sep = "&",
Post = [
"type=groupchat", Sep,
"to=", RoomJID#jid.luser, Sep,
"from=", FromJID#jid.luser, Sep,
"offline=", _OFFLINE, Sep,
"nick=", FromNick, Sep,
"body=", url_encode(binary_to_list(Body)), Sep,
"access_token=", Token
],
?INFO_MSG("Sending post request to ~s with body \"~s\"", [PostUrl, Post]),
httpc:request(post, {binary_to_list(PostUrl), [], "application/x-www-form-urlencoded", list_to_binary(Post)},[],[]),
Stanza;
true ->
Stanza
end.
由于