Friday, 28 October 2016

xmpp MUC file sharing, how enable my xmpp to share attachements, file, photos in multi user chatting/ group chatting?

First if you find you cannot do this, usually it is not your client issue. it is your server issue. it doesn't support it.

I have tried prosody and ejabberd, none of them naturally support this by default.

You need plugins.


And today i found this: https://xmpp.org/extensions/xep-0363.html

for openfire:
https://community.igniterealtime.org/thread/58280
https://github.com/siacs/HttpUploadComponent

for prosody:
https://modules.prosody.im/mod_http_upload.html I will try them



for Openfire:


  1. Checkout(download) code from https://github.com/siacs/HttpUploadComponent
  2. Go to the subfolder: /HttpUploadComponent/httpupload
  3. Make sure you have python3 by run: python3 -V
  4. sudo apt-get install python3-pip
  5. pip3 install pyyaml
  6. pip3 install sleekxmpp
  7. Copy HttpUploadComponent/config.example.yml to /httpupload and change it to config.yml
  8. run python3 server.py


You will see the output like this. which means something is wrong , we need to change the settings.


But actually you can get lot clue from this log, the python program try to connect to your xmpp server, it get response but looks like the server is refused the connect.

Let's do some settings change to enable the connect:



On above image, you can see I am on the openfire admin settings page, and go to "server settings" - > external components. the default port is 5275. this is the port open for other components to connect to, so we should change our python program to use this port.

Second, we should enable a subdomain, which is will decided your component jid. what i created was "upload". So my component jid is upload.ebt. because my domain is "ebt" which is set in my openfire. I also created a secret with it, which is "aaa".



Above file is the config.yaml file of the python program. as we described for the previous picture. I did changes accordingly.

One thing i didn't mention before is the http_address, this is your server's ip address. If your server have a c name or DNS name, then use it instead of the ip address.  (the ip address in whitelist is not useful, you can delete it.)

Note, you can always run your xmpp and this python program in different computers. Then you need to change the server.py file line 115, change "localhost" to your xmpp server's ip address.



Above picture just put settings together to show which maps/links to which.


Finally you should be able to get above log after you restart you python program.

Try you xmpp client, then you should be able to share files in a group (MUC). Remember to logout and relogin again to re-request the server to update it's capability.


No comments:

Post a comment