Statusnet Research SeriesStatusnet Research (1): Introduction of statusnet research (2): Basic installation of statusnet Research (3): friendly URL and openid support of statusnet Research (4): quick installation of statusnet Research (5 ): support for Jabber/Gtalk
As a microblog platform, it is one of the basic functions to support publishing and receiving information through IM. Today we are talking about how to enable statusnet to support Jabber/Gtalk. The Jabber server can be built or used by open-source projects such as openfire (for example, Gtalk ). The Jabber Client is implemented using the PHP open-source project xmpphp. The configuration of Jabber/Gtalk in statusnet is described in Gtalk and xmpphp.
1. Register a Gtalk accountThe account, as a jabber bot, is used to receive and send messages. I registered the user as a canbeing.com@gmail.com, assuming the password is test.
2. Download xmpphpIf you have configured "series (2) Basic installation" or "series (4): quick installation", this step has been completed, see settings.
3. modify the configuration fileMake the following settings in config. php (take my Gtalk as an example ): # XMPP using Gtalk example
$ Config ['xmpp '] ['enabled'] = true;
$ Config ['xmpp '] ['server'] = 'gmail. com ';
$ Config ['xmpp '] ['host'] = 'talk .google.com ';
$ Config ['xmpp '] ['Port'] = 5222;
$ Config ['xmpp '] ['user'] = 'canbeing. com ';
$ Config ['xmpp '] ['encryption'] = false;
$ Config ['xmpp '] ['resource'] = 'canbeingxmpphp ';
$ Config ['xmpp '] ['Password'] = 'test ';
$ Config ['xmpp '] ['public'] [] = 'canbeing. com@gmail.com ';
$ Config ['xmpp '] ['debug'] = true;
4. install PHP ExtensionInstall OpenSSL and mbstring extensions for enabling PHP, because TLS and SASL are used for jabber communication.
5. modify some codeSome code of statusnet 0.8.2 jabber has some problems. You need to make some modifications: Find the function jabber_connect in lib/Jabber. php and change the original If (! $ Conn ){
Return false;
}
$ Conn-> autosubscribe ();
$ Conn-> useencryption (common_config ('xmpp ', 'encryption '));
Try {
$ Conn-> connect (true); // true = persistent connection
} Catch (xmpphp_exception $ e ){
Common_log (log_err, $ e-> getmessage ());
Return false;
}
$ Conn-> processuntil ('session _ start ');
Change If (! $ Conn ){
Return false;
}
Try {
$ Conn-> connect (true); // true = persistent connection
} Catch (xmpphp_exception $ e ){
Common_log (log_err, $ e-> getmessage ());
Return false;
}
$ Conn-> processuntil ('session _ start ');
$ Conn-> autosubscribe ();
$ Conn-> useencryption (common_config ('xmpp ', 'encryption '));
6. Supports receiving messagesAfter completing the preceding five steps, you can bind the jabber account. However, because the B/S program cannot keep the jabber account online, messages cannot be received. Statusnet provides a daemon-running PHP script in scripts/xmppdaemon. php. Run the following full eclipse command prompt to open a window and keep running the corresponding script. C: \ Inetpub \ php-5.2.12-nts \ PHP-c: \ Inetpub \ php-5.2.12-nts \ PHP. ini h: \ 13. PHP \ 04. work spaces \ statusnet \ statusnet-0.8.2 \ scripts \ xmppdaemon. PHP (the specific path must be set based on the actual PHP Directory and statusnet)
Possible problems
1. An error is prompted during verification.: Warning: stream_socket_enable_crypto () [streams. crypto]: This stream does not support SSL/crypto in H: \ 13. PHP \ 04. workspaces \ xmpphp \ XMPP. PHP problem cause: OpenSSL extension solution not installed: Install OpenSSL Extension
2. Prompt for jabber verification: AUTH failCause: the Jabber server, user name, and password are incorrectly set, or the program's own bug solution: follow Step 3 to configure jabber or modify some code
3. When the script is run in step 6, the following message is displayed: Call to undefined function pcntl_fork ()Cause: php does not run in FastCGI mode, and the function solution cannot be found: configure a PHP running in FastCGI mode to run the daemon independently. Author: canbeing Source: Login.