Open GoogleCodeExporter opened 9 years ago
The server I'm trying to connect to doesn't pay any attention to the whitespace
ping, so I had to do a (half-assed) implementation of XMPP-Ping. This is not a
full implementation, only enough to send a pong back to an incoming ping.
First I implemented swa...@gmail.com's xpath_parse.patch from
https://code.google.com/p/xmpphp/issues/detail?id=44
Then in XMPP.php, around line 136, I added:
$this->addXPathHandler('iq/{urn:xmpp:ping}ping', 'ping_handler');
Then, same file, among the handler functions (say line 375):
/**
* Ping handler
* Gets all packets matching XPath "iq/{urn:xmpp:ping}ping'
*
* @param string $xml
*/
protected function ping_handler($xml) {
$payload['from'] = $xml->attrs['from']; //lh3
$payload['to'] = $xml->attrs['to']; //ltlbot
$payload['id'] = $xml->attrs['id']; //ltlbot
$payload['type'] = $xml->attrs['type']; //get
if ($xml->attrs['type'] == 'get') {
$this->send("<iq from=\"{$xml->attrs['to']}\" to=\"{$xml->attrs['from']}\" id=\"{$xml->attrs['id']}\" type=\"result\" />");
}
}
Deborah
Original comment by deborah....@gmail.com
on 17 Jun 2014 at 8:05
Original issue reported on code.google.com by
stro...@stronk7.com
on 24 Apr 2009 at 5:36Attachments: