unmk2 / jaxl

Automatically exported from code.google.com/p/jaxl
GNU General Public License v3.0
0 stars 0 forks source link

no offline presence event #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
if a user goes offline, eventPresence is not called.

Original issue reported on code.google.com by marc.ur...@gmail.com on 5 Jun 2010 at 8:57

GoogleCodeExporter commented 9 years ago
i wrote a fix for this:

/*
 * parsePresence() method handles any incoming presence
*/
function parsePresence($arr) {
  if(isset($arr["presence"]["@"]["type"])) {
    switch($arr["presence"]["@"]["type"]) {
      case "subscribe":
        $this->subscribe($arr["presence"]["@"]["from"]);
        break;

      case "unavailable":
        $this->eventPresence($arr["presence"]["@"]["from"],"unavailable", NULL);
        break;
    }   
  } 
  else if(isset($arr["presence"]["#"]["status"])) {
    $fromJid = $arr["presence"]["@"]["from"];
    $status = $arr["presence"]["#"]["status"][0]["#"];

    if(isset($arr["presence"]["#"]["x"][0]["#"]["photo"])) {
      $photo = $arr["presence"]["#"]["x"][0]["#"]["photo"][0]["#"];
    } 
    else if(isset($arr["presence"]["#"]["x"][1]["#"]["photo"])) {
      $photo = $arr["presence"]["#"]["x"][1]["#"]["photo"][0]["#"];
    } 
    else {
      $photo = "";
    } 

    $this->eventPresence($fromJid,$status,$photo);
  } else if(isset($arr["presence"]["@"]["from"])) {
    $this->eventPresence($arr["presence"]["@"]["from"],"online", NULL);
  } 

}

Original comment by marc.ur...@gmail.com on 5 Jun 2010 at 10:22

GoogleCodeExporter commented 9 years ago
(also handles if a user comes online)

Original comment by marc.ur...@gmail.com on 5 Jun 2010 at 10:27

GoogleCodeExporter commented 9 years ago
Hi, Kindly upgrade to Jaxl 2.0 for better experience. Reopen this bug if 
required.

Original comment by mailsfor...@gmail.com on 4 Aug 2010 at 8:11