how to use MongoDB for storing ejabberd messages?

本秂侑毒 提交于 2019-12-06 04:03:25

问题


I am using ejabberd as an XMPP server. But i wish to store the messages that go through the server and also when was the message sent and to whom and by who. I googled it but could not find how to do it. Help?


回答1:


You probably need to write a hook in Erlang. See the ejabberd documentation for events and hooks Specifically this one :

user_send_packet(From, To, Packet) -> ok

Use the erlang driver for mongodb . If that's "not possible"/"too difficult", i suggest you call a PHP/Python/Ruby script that just stores the message into mongodb. Its easy to do, but won't scale too well.

Hope this helps.

Some links : mongodb-erlang Erlang driver examples

PS : It's been sometime since i used eJabberd. Any corrections are welcome.



来源:https://stackoverflow.com/questions/14694654/how-to-use-mongodb-for-storing-ejabberd-messages

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!