You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.6 KiB

  1. <?php
  2. namespace modl;
  3. class RosterLink extends Model {
  4. public $session;
  5. public $jid;
  6. public $rostername;
  7. public $rosterask;
  8. public $rostersubscription;
  9. public $realname;
  10. public $groupname;
  11. public $chaton;
  12. public $publickey;
  13. public function __construct() {
  14. $this->_struct = '
  15. {
  16. "session" :
  17. {"type":"string", "size":128, "mandatory":true, "key":true },
  18. "jid" :
  19. {"type":"string", "size":128, "mandatory":true, "key":true },
  20. "rostername" :
  21. {"type":"string", "size":128 },
  22. "rosterask" :
  23. {"type":"string", "size":128 },
  24. "rostersubscription" :
  25. {"type":"string", "size":128 },
  26. "realname" :
  27. {"type":"string", "size":128 },
  28. "groupname" :
  29. {"type":"string", "size":128 },
  30. "chaton" :
  31. {"type":"int", "size":11 }
  32. }';
  33. parent::__construct();
  34. }
  35. function set($stanza) {
  36. $this->jid = (string)$stanza->attributes()->jid;
  37. if(isset($stanza->attributes()->name) && (string)$stanza->attributes()->name != '')
  38. $this->rostername = (string)$stanza->attributes()->name;
  39. else
  40. $this->rostername = (string)$stanza->attributes()->jid;
  41. $this->rosterask = (string)$stanza->attributes()->ask;
  42. $this->rostersubscription = (string)$stanza->attributes()->subscription;
  43. $this->groupname = (string)$stanza->group;
  44. }
  45. }