2

I am trying to write a couple of modules / filter for ejabberd. After successfully implemented external auth in php I was having high hopes, that I will be able to do everything in PHP.

What I am trying to accomplish is the following:

Ejabberd hooks -> Send data to PHP

PHP accessing Ejabberd via shell_exec() / exec() using ejabberdctl

PHP responding to "Hooks".

I found this SO question (How to filter messages in Ejabberd) which almost answered my question, but it misses the part where the data gets passed to PHP.

So my question are:

  1. How I can send the data to php from erlang (ie. the " %% should return modified Packet or atom drop to drop the packet" part from the linked question)

  2. Where I can find some specification / documentation about ejabberd binary protocol?

Community
  • 1
  • 1
DuppyWeb
  • 43
  • 1
  • 4

1 Answers1

0

Filtering messages in the xmpp internal domain with ejabberd is only possible making an erlang module.

You could try a component approach. The component will be in a subdomain and be able to filter messages passing through it. You should use it like a proxy domain where all parties in the chat should talk to. Remember that your component should be a daemon like process listening on the component interface for stanzas. This is not easy in php. I've used an intermediate python script for this.

Depending on your needs you could also use mod_logxml to dump all stanzas in an xml file and read that file with a daemon.

Actually, I ended up rewriting the whole thing in node.

E_lexy
  • 141
  • 6