English 中文(简体)
Ejabberd 寄出的口号
原标题:Ejabberd send message from hooks

I have hook handler in my code:

ejabberd_hooks:add(sm_register_connection_hook, "localhost", ?MODULE, on_register, 80),

on_register(SID, JID, INFO) ->
    {_, _, _, _, Name, _, _} = JID,
    ok.

例如,如果想将这一名称寄给基因服务器,那么如何向基因-服务器发出信息,例如从这个名称的 h中传递信息? • 如何知道基因-服务器在注册处内的粉??

谢谢。

问题回答

The on_register is a basic module function of ?MODULE. If the gen_server is a singleton server, you can send the name to it using gen_server:call(?MODULE, {name, Name}) or gen_server:cast(?MODULE, {name, Name}).

因此,结果如下:

on_register(SID, JID, INFO) ->
    {_, _, _, _, Name, _, _} = JID,
    gen_server:call(?MODULE, {name, Name}),
    ok.




相关问题
Setting application hooks - C#/ASP.NET

Many popular applications such as Wordpress, WHMCS and the majority of PHP forums allow plugins to hook into core application events (such as registration, logging in, create post etc.) by simply ...

Global Shell Hook only registering local events

I am trying to use a global shell hook to listen for windows created and destroyed events, but it seems as though my program is only registering the destroyed event for the local thread. No creation ...

C# - Determine if user is moving a window

I am going to be checking if the user is moving any window around (my application does not have an interface) and respond accordingly. What do you think is the best way to do this? Can I determine if ...

keyboard hook in windows C++ or what?

I wish to build my own application which can send keyboard commands(messages) to the Windows OS. For example when I press the combination ctrl+shift+n, I wish to launch the notepad.exe . How can I ...

Can a script be automated after a commit on Perforce?

We use Perforce at work, and routinely keep software projects in the repository. In general creators follow the normal Perforce flow, BUT we also have a class of users, who doesn t have any need to ...

git hooks and how they work

So I m trying to get hudson to build with a post-receive hook. In my local git repo I set post-receive.sample to just post-receive, chmod 755 and added in the line: /usr/bin/curl -u user:secret http:...

Useful Mercurial Hooks [closed]

What are some useful Mercurial hooks that you have come across? A few example hooks are located in the Mercurial book: acl bugzilla notify check for whitespace I personally don t find these very ...

热门标签