mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Accept more types of ejabberdctl commands arguments as JSON-encoded
This commit is contained in:
parent
42bdb501ca
commit
536beedeb6
@ -378,7 +378,11 @@ format_arg("", string) ->
|
|||||||
format_arg(Arg, string) ->
|
format_arg(Arg, string) ->
|
||||||
NumChars = integer_to_list(length(Arg)),
|
NumChars = integer_to_list(length(Arg)),
|
||||||
Parse = "~" ++ NumChars ++ "c",
|
Parse = "~" ++ NumChars ++ "c",
|
||||||
format_arg2(Arg, Parse).
|
format_arg2(Arg, Parse);
|
||||||
|
format_arg(Arg, Format) ->
|
||||||
|
S = unicode:characters_to_binary(Arg, utf8),
|
||||||
|
JSON = jiffy:decode(S),
|
||||||
|
mod_http_api:format_arg(JSON, Format).
|
||||||
|
|
||||||
format_arg2(Arg, Parse)->
|
format_arg2(Arg, Parse)->
|
||||||
{ok, [Arg2], _RemainingArguments} = io_lib:fread(Parse, Arg),
|
{ok, [Arg2], _RemainingArguments} = io_lib:fread(Parse, Arg),
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
-behaviour(gen_mod).
|
-behaviour(gen_mod).
|
||||||
|
|
||||||
-export([start/2, stop/1, reload/3, process/2, depends/2,
|
-export([start/2, stop/1, reload/3, process/2, depends/2,
|
||||||
|
format_arg/2,
|
||||||
mod_options/1, mod_doc/0]).
|
mod_options/1, mod_doc/0]).
|
||||||
|
|
||||||
-include_lib("xmpp/include/xmpp.hrl").
|
-include_lib("xmpp/include/xmpp.hrl").
|
||||||
|
Loading…
Reference in New Issue
Block a user