XMPP Module - Week 6

Events happening in the community are now at Drupal community events on www.drupal.org.
mxk's picture

This week I'm making the first release of the XMPP Drupal module. It basically wraps the functionality of the latest library version, giving you an interface to configure the client and send test messages. I would love to get some feedback both on the user interface and the actual functionality, since so far I've heard very little regarding the two library releases. You can grab the module archive from my site, be sure to read what I posted regarding the configuration steps.

-Max

Comments

Parse error.

jax's picture

I've downloaded the .tgz from your site and after activating it I'm getting the following error:

Parse error: syntax error, unexpected '{' in /home/olivier/public_html/drupal-5.1/sites/all/modules/xmpp/xmpp.module on line 311,

I'm using PHP4 on Apache2.
Update: It seems to work fine with PHP5.

PHP5

mxk's picture

Sorry, in order to use this module you'll need at least PHP 5.2.0.

User JID Field

jax's picture

On your site you say: "You should create a new profile field that will be used to store user JIDs.". Could you please elaborate on that since I don't understand how I should achieve that.

Profile JIDs

mxk's picture

The point of the module is to allow your site to send IMs. For that, users needs to have a JID associated with their profile in the same way that they currently have an e-mail address. To add a new field, go to Administer -> By module -> Profiles. There create a new single-line textfield, call it something like "Jabber ID". Then when you go to configure the XMPP module, select that field in the drop-down menu. Once you do this, the xmpp_get_jid function will be able to map user ids to their corresponding jid values, allowing functions like xmpp_message to actually send IMs to those users.

Error

jax's picture

It seems that your module requires the mbstring extension. It would be nice if that is mentioned while activating the module. Also on the "XMPP Settings" screen the Host field is required yet there is no * and it is not visible by default which makes it less useable.

Now, I followed the steps on your site and am now getting the error: "Error sending message: Server requires data encryption.". I'm also currently setting up a jabberd2 (http://jabberd2.xiaoka.com/) server so if I get it to work (the server) I'll try your module with that as well.

Re: Error

mxk's picture

All the required modules are listed in the library readme. Are you suggesting I add them to the module description as well, or is there another way Drupal deals with this? Good point about the Host field, I'll fix it in the next release. The server requires data encryption error means that TLS is required, but you do not have OpenSSL PHP extension. If you aren't able to install it, then be sure to configure jabberd2 to allow unencrypted sessions.

-Max

Success

jax's picture

After activating the php-openssl mojo I can confirm that I receive the test message on my @gmail.com account.

webchick's picture

According to the rules of Summer of Code, all source code must be in a publicly accessible repository. Please commit what you have to http://cvs.drupal.org/viewcvs/drupal/contributions/modules/xmpp/ and continue making changes there, rather on your personal site (mirroring on your personal site is fine).

It doesn't matter if you feel the code is not ready or not... in fact, the sooner you start putting stuff in the community, the sooner we can give you effective feedback to help you make it better. :)

Done.

mxk's picture

Done.

Thank you! :)

webchick's picture

Thank you! :)

jabberd 1.14

jax's picture

Alright, I've got my jabberd 1.14 server up and running and in use between our companies. I've tried your configuration screen again and am now getting the error:

Error sending message: Local stream-level error (unsupported-encoding)

Also, now that I know a bit more about XMPP I find the configuration screen confusing. You have a checkbox "Use DNS" and a Host and Port field. But when "Use DNS" is enabled the Host/Port fields are unnecessary. So, if by default use DNS is enabled the Host/Port field shouldn't be mandatory and my remark above isn't valid. Just something to think about.

Re: jabberd 1.14

mxk's picture

That error message indicates that the server sent <?xml encoding="..." ?> value other than UTF-8 (or didn't send one at all). XMPP Core specifications state that UTF-8 must be used, but I wasn't certain of what to do when the server did not send an encoding, which I think is your case. In the next version I'll check for no encoding. Until then you can fix this problem yourself... Open lib/common/Stream.inc, locate checkRecvStream function and delete the first if statement there (lines 424 and 425).

About the DNS, host and port fields are always required. They are used as fallback when DNS queries fail, and the host field is what the DNS query is performed on. “Use DNS" option is there so you can disable it when you only have one XMPP server, or when you specify one of many to use manually. For example, google has 5 XMPP servers (talk.l.google.com and talk[1-4].l.google.com). When Use DNS is enabled, the client performs SRV lookup and then selects the server with highest priority. When connection to that server fails, it goes down the list of all other servers attempting to connect to each one. When all the servers fail, it goes back to the original host/port combo and attempts a direct connection by resolving the host's A record. Turning DNS off simply causes the client to skip to that last step.

SoC 2007

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: