General Ejabberd Debug Shell Question

I am trying to test a function in a module ive been making, it works fine when ejabberd is running, but id like to test it directly:

-spec get_acct(#jid{}) -> string() | {error, atom()}.
get_acct(JID) ->
  #jid{luser = User, lserver = Server} = JID,
  ?INFO_MSG("trying to test: ~n user:~p~n server: ~p~n",[User, Server]),
  ok.        

Then when im in connected to 'ejabberdctl debug', in the shell, I can't seem to form the message accurately

(ejabberd@localhost)11> mod_test:get_acct({"user","localhost.com"}).
** exception error: no match of right hand side value {"user","localhost.com"}

Anyone have any ideas on how to pass the message correctly from the shell?

See Erlang Reference Manual /

See Erlang Reference Manual / records, section 9.8 "Internal Representation of Records".
You try to pass another tuple to the function.

ok I got it, for some reason

ok I got it, for some reason in the ejabberdctl debug shell, it doesn't load the jid record

tried to run:

rr('path/to/jlib.hrl').

but for some reason the shell kept saying the path was invalid, so in the end I had to run

rd(jid, {user, server, resource,luser, lserver, lresource}).

then run

TestJid = #jid{luser="user",lserver="localhost"}.

then finally pass 'TestJid' to the function

You could simply

You could simply run

mod_test:get_acct({jid,0,0,0,"user","localhost.com",0}).

as well without anything else.

nice, worked as well, thanks

nice, worked as well, thanks

Syndicate content