Browse Source

Continue to cleanup old code in Moxl

pull/676/head
Timothée Jaussoin 7 years ago
parent
commit
7cd4cd2cab
  1. 1
      app/widgets/Vcard4/Vcard4.php
  2. 36
      lib/moxl/src/Moxl/Stanza/Notification.php
  3. 39
      lib/moxl/src/Moxl/Xec/Action/Message/Composing.php
  4. 32
      lib/moxl/src/Moxl/Xec/Action/Message/Invite.php
  5. 39
      lib/moxl/src/Moxl/Xec/Action/Message/Paused.php
  6. 80
      lib/moxl/src/Moxl/Xec/Action/Message/Publish.php
  7. 38
      lib/moxl/src/Moxl/Xec/Action/Microblog/CommentCreateNode.php
  8. 17
      lib/moxl/src/Moxl/Xec/Action/Microblog/CommentPublish.php
  9. 21
      lib/moxl/src/Moxl/Xec/Action/Microblog/CommentsGet.php
  10. 8
      lib/moxl/src/Moxl/Xec/Action/Muc/GetConfig.php
  11. 16
      lib/moxl/src/Moxl/Xec/Action/Muc/SetConfig.php
  12. 16
      lib/moxl/src/Moxl/Xec/Action/Muc/SetSubject.php
  13. 9
      lib/moxl/src/Moxl/Xec/Action/Nickname/Set.php
  14. 61
      lib/moxl/src/Moxl/Xec/Action/Notification/Get.php
  15. 57
      lib/moxl/src/Moxl/Xec/Action/Notification/ItemDelete.php
  16. 52
      lib/moxl/src/Moxl/Xec/Action/Pubsub/ConfigurePersistentStorage.php
  17. 24
      lib/moxl/src/Moxl/Xec/Action/Pubsub/Create.php
  18. 44
      lib/moxl/src/Moxl/Xec/Action/Pubsub/CreatePersistentStorage.php
  19. 16
      lib/moxl/src/Moxl/Xec/Action/Pubsub/Delete.php
  20. 22
      lib/moxl/src/Moxl/Xec/Action/Pubsub/Errors.php
  21. 38
      lib/moxl/src/Moxl/Xec/Action/Pubsub/GetAffiliations.php
  22. 40
      lib/moxl/src/Moxl/Xec/Action/Pubsub/GetConfig.php
  23. 62
      lib/moxl/src/Moxl/Xec/Action/Pubsub/GetItem.php
  24. 61
      lib/moxl/src/Moxl/Xec/Action/Pubsub/GetItems.php
  25. 16
      lib/moxl/src/Moxl/Xec/Action/Pubsub/GetItemsId.php
  26. 40
      lib/moxl/src/Moxl/Xec/Action/Pubsub/GetSubscriptions.php
  27. 24
      lib/moxl/src/Moxl/Xec/Action/Pubsub/PostDelete.php
  28. 46
      lib/moxl/src/Moxl/Xec/Action/Pubsub/SetAffiliations.php
  29. 53
      lib/moxl/src/Moxl/Xec/Action/Pubsub/SetConfig.php
  30. 46
      lib/moxl/src/Moxl/Xec/Action/Pubsub/SetSubscriptions.php
  31. 32
      lib/moxl/src/Moxl/Xec/Action/Pubsub/Subscribe.php
  32. 14
      lib/moxl/src/Moxl/Xec/Action/Pubsub/TestCreate.php
  33. 24
      lib/moxl/src/Moxl/Xec/Action/Pubsub/TestPostPublish.php
  34. 32
      lib/moxl/src/Moxl/Xec/Action/Pubsub/Unsubscribe.php
  35. 40
      lib/moxl/src/Moxl/Xec/Action/PubsubSubscription/Add.php
  36. 16
      lib/moxl/src/Moxl/Xec/Action/PubsubSubscription/Get.php
  37. 32
      lib/moxl/src/Moxl/Xec/Action/PubsubSubscription/Remove.php
  38. 24
      lib/moxl/src/Moxl/Xec/Action/Roster/AddItem.php
  39. 5
      lib/moxl/src/Moxl/Xec/Action/Roster/GetList.php
  40. 8
      lib/moxl/src/Moxl/Xec/Action/Roster/RemoveItem.php
  41. 26
      lib/moxl/src/Moxl/Xec/Action/Roster/UpdateItem.php
  42. 8
      lib/moxl/src/Moxl/Xec/Action/Session/Bind.php
  43. 8
      lib/moxl/src/Moxl/Xec/Action/Session/Start.php
  44. 22
      lib/moxl/src/Moxl/Xec/Action/Storage/Get.php
  45. 22
      lib/moxl/src/Moxl/Xec/Action/Storage/Set.php
  46. 52
      lib/moxl/src/Moxl/Xec/Action/Upload/Request.php
  47. 22
      lib/moxl/src/Moxl/Xec/Action/Vcard/Get.php
  48. 39
      lib/moxl/src/Moxl/Xec/Action/Vcard/Set.php
  49. 40
      lib/moxl/src/Moxl/Xec/Action/Vcard4/Get.php
  50. 8
      lib/moxl/src/Moxl/Xec/Action/Vcard4/Set.php
  51. 62
      lib/moxl/src/Moxl/Xec/Action/Version/Send.php

1
app/widgets/Vcard4/Vcard4.php

@ -56,7 +56,6 @@ class Vcard4 extends \Movim\Widget\Base
{
$r = new Get;
$r->setTo($this->user->id)
->setMe()
->request();
}

36
lib/moxl/src/Moxl/Stanza/Notification.php

@ -1,36 +0,0 @@
<?php
namespace Moxl\Stanza;
class Notification {
static function get($to)
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$pubsub = $dom->createElementNS('http://jabber.org/protocol/pubsub', 'pubsub');
$items = $dom->createElementNS('items');
$items->setAttribute('node', 'urn:xmpp:inbox');
$pubsub->appendChild($items);
$xml = \Moxl\API::iqWrapper($pubsub, $to, 'get');
\Moxl\API::request($xml);
}
static function itemDelete($to, $id)
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$pubsub = $dom->createElementNS('http://jabber.org/protocol/pubsub', 'pubsub');
$retract = $dom->createElement('retract');
$retract->setAttribute('node', 'urn:xmpp:inbox');
$retract->setAttribute('notify', 'true');
$item = $dom->createElement('item');
$item->setAttribute('id', $id);
$retract->appendChild($item);
$pubsub->appendChild($retract);
$xml = \Moxl\API::iqWrapper($pubsub, $to, 'set');
\Moxl\API::request($xml);
}
}

39
lib/moxl/src/Moxl/Xec/Action/Message/Composing.php

@ -1,26 +1,4 @@
<?php
/*
* Composing.php
*
* Copyright 2012 edhelas <edhelas@edhelas-laptop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Message;
@ -29,21 +7,14 @@ use Moxl\Stanza\Message;
class Composing extends Action
{
private $_to;
private $_content;
public function request()
protected $_to;
public function request()
{
Message::composing($this->_to);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function handle($stanza, $parent = false) {
public function handle($stanza, $parent = false)
{
}
}

32
lib/moxl/src/Moxl/Xec/Action/Message/Invite.php

@ -7,40 +7,16 @@ use Moxl\Stanza\Message;
class Invite extends Action
{
private $_to;
private $_content;
private $_id;
private $_invite;
protected $_to;
protected $_content;
protected $_id;
protected $_invite;
public function request()
{
Message::invite($this->_to, $this->_id, $this->_invite);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setContent($content)
{
$this->_content = $content;
return $this;
}
public function setId($id)
{
$this->_id = $id;
return $this;
}
public function setInvite($invite)
{
$this->_invite = $invite;
return $this;
}
public function handle($stanza, $parent = false)
{
}

39
lib/moxl/src/Moxl/Xec/Action/Message/Paused.php

@ -1,26 +1,4 @@
<?php
/*
* Paused.php
*
* Copyright 2012 edhelas <edhelas@edhelas-laptop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Message;
@ -29,21 +7,14 @@ use Moxl\Stanza\Message;
class Paused extends Action
{
private $_to;
private $_content;
public function request()
protected $_to;
public function request()
{
Message::paused($this->_to);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function handle($stanza, $parent = false) {
public function handle($stanza, $parent = false)
{
}
}

80
lib/moxl/src/Moxl/Xec/Action/Message/Publish.php

@ -1,26 +1,4 @@
<?php
/*
* Publish.php
*
* Copyright 2012 edhelas <edhelas@edhelas-laptop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Message;
@ -30,14 +8,14 @@ use Moxl\Stanza\Muc;
class Publish extends Action
{
private $_to;
private $_content;
private $_html;
private $_muc = false;
private $_encrypted = false;
private $_id = false;
private $_replace = false;
private $_file = false;
protected $_to;
protected $_content;
protected $_html;
protected $_muc = false;
protected $_encrypted = false;
protected $_id = false;
protected $_replace = false;
protected $_file = false;
public function request()
{
@ -51,12 +29,6 @@ class Publish extends Action
}
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setMuc()
{
$this->_muc = true;
@ -68,42 +40,6 @@ class Publish extends Action
return $this->_muc;
}
public function setEncrypted($bool)
{
$this->_encrypted = $bool;
return $this;
}
public function setContent($content)
{
$this->_content = $content;
return $this;
}
public function setHTML($html)
{
$this->_html = $html;
return $this;
}
public function setId($id)
{
$this->_id = $id;
return $this;
}
public function setReplace($replace)
{
$this->_replace = $replace;
return $this;
}
public function setFile($file)
{
$this->_file = $file;
return $this;
}
public function handle($stanza, $parent = false)
{
if($this->_muc) {

38
lib/moxl/src/Moxl/Xec/Action/Microblog/CommentCreateNode.php

@ -1,26 +1,4 @@
<?php
/*
* CommentCreateNode.php
*
* Copyright 2012 edhelas <edhelas@edhelas-laptop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Microblog;
@ -29,8 +7,8 @@ use Moxl\Stanza\Pubsub;
class CommentCreateNode extends Action
{
private $_to;
private $_parentid;
protected $_to;
protected $_parentid;
public function request()
{
@ -38,18 +16,6 @@ class CommentCreateNode extends Action
Pubsub::createCommentNode($this->_to, $this->_parentid);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setParentId($parentid)
{
$this->_parentid = $parentid;
return $this;
}
public function handle($stanza, $parent = false)
{
$this->pack(['server' => $this->_to, 'parentid' => $this->_parentid]);

17
lib/moxl/src/Moxl/Xec/Action/Microblog/CommentPublish.php

@ -10,12 +10,12 @@ use Moxl\Xec\Action\Pubsub\GetItem;
class CommentPublish extends Errors
{
private $_to;
private $_node;
private $_parentid;
private $_commentnodeid;
protected $_to;
protected $_node;
protected $_parentid;
protected $_commentnodeid;
private $_atom;
protected $_atom;
public function __construct()
{
@ -36,12 +36,6 @@ class CommentPublish extends Errors
return $this;
}
public function setParentId($parentid)
{
$this->_parentid = $parentid;
return $this;
}
public function setCommentNodeId($commentnodeid)
{
$this->_commentnodeid = $commentnodeid;
@ -105,5 +99,4 @@ class CommentPublish extends Errors
{
$this->event('commentpublisherror');
}
}

21
lib/moxl/src/Moxl/Xec/Action/Microblog/CommentsGet.php

@ -7,10 +7,10 @@ use Moxl\Stanza\Pubsub;
class CommentsGet extends Action
{
private $_to;
private $_id;
private $_node;
private $_parentid;
protected $_to;
protected $_id;
protected $_node;
protected $_parentid;
public function request()
{
@ -18,12 +18,6 @@ class CommentsGet extends Action
Pubsub::getItems($this->_to, $this->_node);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setId($id)
{
$this->_id = $id;
@ -31,12 +25,6 @@ class CommentsGet extends Action
return $this;
}
public function setParentId($parentid)
{
$this->_parentid = $parentid;
return $this;
}
public function handle($stanza, $parent = false)
{
$node = (string)$stanza->pubsub->items->attributes()->node;
@ -63,5 +51,4 @@ class CommentsGet extends Action
$this->pack($this->_id);
$this->deliver();
}
}

8
lib/moxl/src/Moxl/Xec/Action/Muc/GetConfig.php

@ -7,7 +7,7 @@ use Moxl\Stanza\Muc;
class GetConfig extends Action
{
private $_to;
protected $_to;
public function request()
{
@ -15,12 +15,6 @@ class GetConfig extends Action
Muc::getConfig($this->_to);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function handle($stanza, $parent = false)
{
$this->pack(['config' => $stanza->query, 'room' => $this->_to]);

16
lib/moxl/src/Moxl/Xec/Action/Muc/SetConfig.php

@ -7,8 +7,8 @@ use Moxl\Stanza\Muc;
class SetConfig extends Action
{
private $_to;
private $_data;
protected $_to;
protected $_data;
public function request()
{
@ -16,18 +16,6 @@ class SetConfig extends Action
Muc::setConfig($this->_to, $this->_data);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setData($data)
{
$this->_data = $data;
return $this;
}
public function handle($stanza, $parent = false)
{
$this->deliver();

16
lib/moxl/src/Moxl/Xec/Action/Muc/SetSubject.php

@ -7,8 +7,8 @@ use Moxl\Stanza\Muc;
class SetSubject extends Action
{
private $_to;
private $_subject;
protected $_to;
protected $_subject;
public function request()
{
@ -16,18 +16,6 @@ class SetSubject extends Action
Muc::setSubject($this->_to, $this->_subject);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setSubject($subject)
{
$this->_subject = $subject;
return $this;
}
public function handle($stanza, $parent = false)
{
$message = \App\Message::findByStanza($stanza);

9
lib/moxl/src/Moxl/Xec/Action/Nickname/Set.php

@ -7,7 +7,7 @@ use Moxl\Stanza\Nickname;
class Set extends Action
{
private $_nickname;
protected $_nickname;
public function request()
{
@ -15,12 +15,7 @@ class Set extends Action
Nickname::set($this->_nickname);
}
public function setNickname($nickname)
public function handle($stanza, $parent = false)
{
$this->_nickname = $nickname;
return $this;
}
public function handle($stanza, $parent = false) {
}
}

61
lib/moxl/src/Moxl/Xec/Action/Notification/Get.php

@ -1,61 +0,0 @@
<?php
namespace Moxl\Xec\Action\Notification;
use Moxl\Xec\Action;
use Moxl\Stanza\Notification;
use Movim\Session;
class Get extends Action
{
private $_to;
public function request()
{
$this->store();
Notification::get($this->_to);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function handle($stanza, $parent = false)
{
$session = Session::start();
$session->set('activenotifs', []);
if($stanza->pubsub->items->item) {
foreach($stanza->pubsub->items->item as $item) {
$this->event('notification', $item);
}
$this->event('notifications');
} else {
$this->event('nonotification');
}
}
public function errorFeatureNotImplemented($stanza)
{
$this->event('nonotification');
}
public function errorItemNotFound($stanza)
{
$this->event('nonotification');
}
public function errorNotAuthorized($stanza)
{
$this->event('nonotificationautorized');
}
public function errorNotAllowed($stanza)
{
$this->errorItemNotFound($stanza);
}
}

57
lib/moxl/src/Moxl/Xec/Action/Notification/ItemDelete.php

@ -1,57 +0,0 @@
<?php
/*
* ItemDelete.php
*
* Copyright 2012 edhelas <edhelas@edhelas-laptop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Notification;
use Moxl\Xec\Action;
use Moxl\Stanza\Notification;
class ItemDelete extends Action
{
private $_to;
private $_id;
public function request()
{
$this->store();
Notification::itemDelete($this->_to, $this->_id);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setId($id)
{
$this->_id = $id;
return $this;
}
public function handle($stanza, $parent = false)
{
$this->event('notificationdelete', $this->_id);
}
}

52
lib/moxl/src/Moxl/Xec/Action/Pubsub/ConfigurePersistentStorage.php

@ -1,26 +1,4 @@
<?php
/*
* ConfigurePersistentStorage.php - http://xmpp.org/extensions/xep-0223.html
*
* Copyright 2012 edhelas <edhelas@edhelas-laptop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Pubsub;
@ -29,10 +7,10 @@ use Moxl\Stanza\Pubsub;
class ConfigurePersistentStorage extends Action
{
private $_to;
private $_node;
private $_access_model;
private $_max_items;
protected $_to;
protected $_node;
protected $_access_model;
protected $_max_items;
public function request()
{
@ -40,18 +18,6 @@ class ConfigurePersistentStorage extends Action
Pubsub::configurePersistentStorage($this->_to, $this->_node, $this->_access_model, $this->_max_items);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function setAccessPresence()
{
$this->_access_model = 'presence';
@ -64,19 +30,21 @@ class ConfigurePersistentStorage extends Action
return $this;
}
public function handle($stanza, $parent = false) {
public function handle($stanza, $parent = false)
{
$this->pack($this->_node);
$this->deliver();
}
public function errorFeatureNotImplemented($error) {
public function errorFeatureNotImplemented($error)
{
$this->pack($this->_node);
$this->deliver();
}
public function errorItemNotFound($error) {
public function errorItemNotFound($error)
{
$this->pack($this->_node);
$this->deliver();
}
}

24
lib/moxl/src/Moxl/Xec/Action/Pubsub/Create.php

@ -8,9 +8,9 @@ use Moxl\Stanza\Pubsub;
class Create extends Errors
{
private $_to;
private $_node;
private $_name;
protected $_to;
protected $_node;
protected $_name;
public function request()
{
@ -18,24 +18,6 @@ class Create extends Errors
Pubsub::create($this->_to, $this->_node, $this->_name);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function setName($name)
{
$this->_name = $name;
return $this;
}
public function handle($stanza, $parent = false)
{
if($stanza["type"] == "result"){

44
lib/moxl/src/Moxl/Xec/Action/Pubsub/CreatePersistentStorage.php

@ -1,26 +1,4 @@
<?php
/*
* CreatePersistentStorage.php - http://xmpp.org/extensions/xep-0223.html
*
* Copyright 2012 edhelas <edhelas@edhelas-laptop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Pubsub;
@ -29,27 +7,15 @@ use Moxl\Stanza\Pubsub;
class CreatePersistentStorage extends Action
{
private $_to;
private $_node;
public function request()
protected $_to;
protected $_node;
public function request()
{
$this->store();
Pubsub::createPersistentStorage($this->_to, $this->_node);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function handle($stanza, $parent = false)
{
$this->pack($this->_node);

16
lib/moxl/src/Moxl/Xec/Action/Pubsub/Delete.php

@ -8,8 +8,8 @@ use Moxl\Stanza\Pubsub;
class Delete extends Errors
{
private $_to;
private $_node;
protected $_to;
protected $_node;
public function request()
{
@ -17,18 +17,6 @@ class Delete extends Errors
Pubsub::delete($this->_to, $this->_node);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function handle($stanza, $parent = false)
{
if($stanza["type"] == "result"){

22
lib/moxl/src/Moxl/Xec/Action/Pubsub/Errors.php

@ -1,26 +1,4 @@
<?php
/*
* Errors.php
*
* Copyright 2012 edhelas <edhelas@edhelas-laptop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Pubsub;

38
lib/moxl/src/Moxl/Xec/Action/Pubsub/GetAffiliations.php

@ -1,26 +1,4 @@
<?php
/*
* GetAffiliations.php
*
* Copyright 2012 nodpounod
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Pubsub;
@ -30,8 +8,8 @@ use Moxl\Xec\Action\Pubsub\Errors;
class GetAffiliations extends Errors
{
private $_to;
private $_node;
protected $_to;
protected $_node;
public function request()
{
@ -39,18 +17,6 @@ class GetAffiliations extends Errors
Pubsub::getAffiliations($this->_to, $this->_node);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function handle($stanza, $parent = false)
{
$tab = [];

40
lib/moxl/src/Moxl/Xec/Action/Pubsub/GetConfig.php

@ -1,26 +1,4 @@
<?php
/*
* GetConfig.php
*
* Copyright 2013 nodpounod
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Pubsub;
@ -30,9 +8,9 @@ use Moxl\Xec\Action\Pubsub\Errors;
class GetConfig extends Errors
{
private $_to;
private $_node;
private $_advanced = false;
protected $_to;
protected $_node;
protected $_advanced = false;
public function request()
{
@ -40,18 +18,6 @@ class GetConfig extends Errors
Pubsub::getConfig($this->_to, $this->_node);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function enableAdvanced()
{
$this->_advanced = true;

62
lib/moxl/src/Moxl/Xec/Action/Pubsub/GetItem.php

@ -1,26 +1,4 @@
<?php
/*
* GetItem.php
*
* Copyright 2014 edhelas <edhelas@edhelas-laptop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Pubsub;
@ -30,12 +8,12 @@ use Moxl\Xec\Action\Pubsub\Errors;
class GetItem extends Errors
{
private $_to;
private $_node;
private $_id;
private $_askreply;
protected $_to;
protected $_node;
protected $_id;
protected $_askreply;
private $_parentid;
protected $_parentid;
public function request()
{
@ -43,36 +21,6 @@ class GetItem extends Errors
Pubsub::getItem($this->_to, $this->_node, $this->_id);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function setId($id)
{
$this->_id = $id;
return $this;
}
public function setAskReply($reply)
{
$this->_askreply = $reply;
return $this;
}
public function setParentId($parentid)
{
$this->_parentid = $parentid;
return $this;
}
public function handle($stanza, $parent = false)
{
if ($stanza->pubsub->items->item) {

61
lib/moxl/src/Moxl/Xec/Action/Pubsub/GetItems.php

@ -1,26 +1,4 @@
<?php
/*
* GetItems.php
*
* Copyright 2012 edhelas <edhelas@edhelas-laptop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Pubsub;
@ -30,14 +8,14 @@ use Moxl\Xec\Action\Pubsub\Errors;
class GetItems extends Errors
{
private $_to;
private $_node;
private $_since;
private $_paging;
private $_after;
private $_before;
protected $_to;
protected $_node;
protected $_since;
protected $_paging;
protected $_after;
protected $_before;
private $_paginated = false;
protected $_paginated = false;
public function request()
{
@ -45,24 +23,6 @@ class GetItems extends Errors
Pubsub::getItems($this->_to, $this->_node, $this->_paging, $this->_after, $this->_before);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function setPaging($paging)
{
$this->_paging = $paging;
return $this;
}
public function setAfter($after)
{
$this->_after = $after;
@ -77,12 +37,6 @@ class GetItems extends Errors
return $this;
}
public function setSince($since)
{
$this->_since = $since;
return $this;
}
public function handle($stanza, $parent = false)
{
$ids = [];
@ -132,5 +86,4 @@ class GetItems extends Errors
$this->pack(['server' => $this->_to, 'node' => $this->_node]);
$this->deliver();
}
}

16
lib/moxl/src/Moxl/Xec/Action/Pubsub/GetItemsId.php

@ -9,8 +9,8 @@ use Moxl\Xec\Action\Pubsub\GetItem;
class GetItemsId extends Errors
{
private $_to;
private $_node;
protected $_to;
protected $_node;
public function request()
{
@ -18,18 +18,6 @@ class GetItemsId extends Errors
Disco::items($this->_to, $this->_node);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function handle($stanza, $parent = false)
{
$ids = [];

40
lib/moxl/src/Moxl/Xec/Action/Pubsub/GetSubscriptions.php

@ -1,26 +1,4 @@
<?php
/*
* GetSubscriptions.php
*
* Copyright 2013 edhelas <edhelas@edhelas-laptop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Pubsub;
@ -30,9 +8,9 @@ use Moxl\Xec\Action\Pubsub\Errors;
class GetSubscriptions extends Errors
{
private $_to;
private $_node;
private $_notify = true;
protected $_to;
protected $_node;
protected $_notify = true;
public function request()
{
@ -40,18 +18,6 @@ class GetSubscriptions extends Errors
Pubsub::getSubscriptions($this->_to, $this->_node);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function setNotify($notify)
{
$this->_notify = (bool)$notify;

24
lib/moxl/src/Moxl/Xec/Action/Pubsub/PostDelete.php

@ -8,9 +8,9 @@ use Moxl\Xec\Action\Pubsub\Errors;
class PostDelete extends Errors
{
private $_to;
private $_id;
private $_node;
protected $_to;
protected $_id;
protected $_node;
public function request()
{
@ -18,24 +18,6 @@ class PostDelete extends Errors
Pubsub::postDelete($this->_to, $this->_node, $this->_id);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setId($id)
{
$this->_id = $id;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function handle($stanza, $parent = false)
{
\App\Post::where('server', $this->_to)->where('node', $this->_node)

46
lib/moxl/src/Moxl/Xec/Action/Pubsub/SetAffiliations.php

@ -1,26 +1,4 @@
<?php
/*
* SetAffiliations.php
*
* Copyright 2012 nodpounod
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Pubsub;
@ -30,9 +8,9 @@ use Moxl\Xec\Action\Pubsub\Errors;
class SetAffiliations extends Errors
{
private $_to;
private $_node;
private $_data;
protected $_to;
protected $_node;
protected $_data;
public function request()
{
@ -40,24 +18,6 @@ class SetAffiliations extends Errors
Pubsub::setAffiliations($this->_to, $this->_node, $this->_data);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function setData($data)
{
$this->_data = $data;
return $this;
}
public function handle($stanza, $parent = false)
{
$ga = new GetAffiliations;

53
lib/moxl/src/Moxl/Xec/Action/Pubsub/SetConfig.php

@ -1,26 +1,4 @@
<?php
/*
* SetConfig.php
*
* Copyright 2012 edhelas <edhelas@edhelas-laptop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Pubsub;
@ -30,35 +8,18 @@ use Moxl\Xec\Action\Pubsub\Errors;
class SetConfig extends Errors
{
private $_to;
private $_node;
private $_data;
public function request()
protected $_to;
protected $_node;
protected $_data;
public function request()
{
$this->store();
Pubsub::setConfig($this->_to, $this->_node, $this->_data);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function setData($data)
public function handle($stanza, $parent = false)
{
$this->_data = $data;
return $this;
}
public function handle($stanza, $parent = false) {
$this->deliver();
}
}

46
lib/moxl/src/Moxl/Xec/Action/Pubsub/SetSubscriptions.php

@ -1,26 +1,4 @@
<?php
/*
* SetAffiliations.php
*
* Copyright 2012 nodpounod
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Pubsub;
@ -30,9 +8,9 @@ use Moxl\Xec\Action\Pubsub\Errors;
class SetSubscriptions extends Errors
{
private $_to;
private $_node;
private $_data;
protected $_to;
protected $_node;
protected $_data;
public function request()
{
@ -40,24 +18,6 @@ class SetSubscriptions extends Errors
Pubsub::setSubscriptions($this->_to, $this->_node, $this->_data);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function setData($data)
{
$this->_data = $data;
return $this;
}
public function handle($stanza, $parent = false)
{
$this->event('pubsubsubscriptionssubmited', $stanza);

32
lib/moxl/src/Moxl/Xec/Action/Pubsub/Subscribe.php

@ -9,10 +9,10 @@ use Moxl\Xec\Action\PubsubSubscription\Add as SubscriptionAdd;
class Subscribe extends Errors
{
private $_to;
private $_from;
private $_node;
private $_data;
protected $_to;
protected $_from;
protected $_node;
protected $_data;
public function request()
{
@ -20,30 +20,6 @@ class Subscribe extends Errors
Pubsub::subscribe($this->_to, $this->_from, $this->_node);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setFrom($from)
{
$this->_from = $from;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function setData($data)
{
$this->_data = $data;
return $this;
}
public function handle($stanza, $parent = false)
{
$sa = new SubscriptionAdd;

14
lib/moxl/src/Moxl/Xec/Action/Pubsub/TestCreate.php

@ -8,8 +8,8 @@ use Moxl\Stanza\Pubsub;
class TestCreate extends Errors
{
private $_to;
private $_node = 'test_node';
protected $_to;
protected $_node = 'test_node';
public function request()
{
@ -17,13 +17,8 @@ class TestCreate extends Errors
Pubsub::create($this->_to, $this->_node, 'Test');
}
public function setTo($to)
public function handle($stanza, $parent = false)
{
$this->_to = $to;
return $this;
}
public function handle($stanza, $parent = false) {
if($stanza["type"] == "result"){
// We delete the test node we just created
Pubsub::delete($this->_to, $this->_node);
@ -34,7 +29,8 @@ class TestCreate extends Errors
}
}
public function error($error) {
public function error($error)
{
$this->pack($this->_to);
$this->deliver();
}

24
lib/moxl/src/Moxl/Xec/Action/Pubsub/TestPostPublish.php

@ -10,37 +10,25 @@ use Moxl\Xec\Action\Pubsub\Errors;
class TestPostPublish extends Errors
{
private $_node;
private $_to;
private $_id = 'test_post';
protected $_node;
protected $_to;
protected $_id = 'test_post';
public function request()
public function request()
{
$this->store();
Pubsub::testPostPublish($this->_to, $this->_node, $this->_id);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function handle($stanza, $parent = false) {
Pubsub::postDelete($this->_to, $this->_node, $this->_id);
$this->pack(array('to' => $this->_to, 'node' => $this->_node));
$this->pack(['to' => $this->_to, 'node' => $this->_node]);
$this->deliver();
}
public function error($stanza, $parent = false) {
$this->pack(array('to' => $this->_to, 'node' => $this->_node));
$this->pack(['to' => $this->_to, 'node' => $this->_node]);
$this->deliver();
}
}

32
lib/moxl/src/Moxl/Xec/Action/Pubsub/Unsubscribe.php

@ -9,10 +9,10 @@ use Moxl\Xec\Action\PubsubSubscription\Remove as SubscriptionRemove;
class Unsubscribe extends Errors
{
private $_to;
private $_from;
private $_node;
private $_subid;
protected $_to;
protected $_from;
protected $_node;
protected $_subid;
public function request()
{
@ -20,30 +20,6 @@ class Unsubscribe extends Errors
Pubsub::unsubscribe($this->_to, $this->_from, $this->_node, $this->_subid);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setFrom($from)
{
$this->_from = $from;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function setSubid($subid)
{
$this->_subid = $subid;
return $this;
}
public function handle($stanza, $parent = false)
{
$sa = new SubscriptionRemove;

40
lib/moxl/src/Moxl/Xec/Action/PubsubSubscription/Add.php

@ -8,11 +8,11 @@ use Moxl\Stanza\PubsubSubscription;
class Add extends Errors
{
private $_server;
private $_from;
private $_node;
private $_data;
private $_pepnode = 'urn:xmpp:pubsub:subscription';
protected $_server;
protected $_from;
protected $_node;
protected $_data;
protected $_pepnode = 'urn:xmpp:pubsub:subscription';
public function request()
{
@ -23,36 +23,6 @@ class Add extends Errors
);
}
public function setServer($server)
{
$this->_server = $server;
return $this;
}
public function setFrom($from)
{
$this->_from = $from;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function setPEPNode($pepnode)
{
$this->_pepnode = $pepnode;
return $this;
}
public function setData($data)
{
$this->_data = $data;
return $this;
}
public function handle($stanza, $parent = false)
{
$subscription = \App\Subscription::firstOrNew([

16
lib/moxl/src/Moxl/Xec/Action/PubsubSubscription/Get.php

@ -8,8 +8,8 @@ use Moxl\Stanza\Pubsub;
class Get extends Errors
{
private $_to;
private $_pepnode = 'urn:xmpp:pubsub:subscription';
protected $_to;
protected $_pepnode = 'urn:xmpp:pubsub:subscription';
public function request()
{
@ -17,18 +17,6 @@ class Get extends Errors
Pubsub::getItems($this->_to, $this->_pepnode, 1000);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setPEPNode($pepnode)
{
$this->_pepnode = $pepnode;
return $this;
}
public function handle($stanza, $parent = false)
{
\App\User::me()->subscriptions()

32
lib/moxl/src/Moxl/Xec/Action/PubsubSubscription/Remove.php

@ -8,10 +8,10 @@ use Moxl\Stanza\PubsubSubscription;
class Remove extends Errors
{
private $_server;
private $_from;
private $_node;
private $_pepnode = 'urn:xmpp:pubsub:subscription';
protected $_server;
protected $_from;
protected $_node;
protected $_pepnode = 'urn:xmpp:pubsub:subscription';
public function request()
{
@ -21,30 +21,6 @@ class Remove extends Errors
);
}
public function setServer($server)
{
$this->_server = $server;
return $this;
}
public function setFrom($from)
{
$this->_from = $from;
return $this;
}
public function setNode($node)
{
$this->_node = $node;
return $this;
}
public function setPEPNode($pepnode)
{
$this->_pepnode = $pepnode;
return $this;
}
public function handle($stanza, $parent = false)
{
if ($this->_pepnode == 'urn:xmpp:pubsub:movim-public-subscription') {

24
lib/moxl/src/Moxl/Xec/Action/Roster/AddItem.php

@ -9,9 +9,9 @@ use App\User as DBUser;
class AddItem extends Action
{
private $_to;
private $_name;
private $_group;
protected $_to;
protected $_name;
protected $_group;
public function request()
{
@ -19,24 +19,6 @@ class AddItem extends Action
Roster::add($this->_to, $this->_name, $this->_group);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setName($name)
{
$this->_name = $name;
return $this;
}
public function setGroup($group)
{
$this->_group = $group;
return $this;
}
public function handle($stanza, $parent = false)
{
$roster = DBRoster::firstOrNew(['jid' => $this->_to]);

5
lib/moxl/src/Moxl/Xec/Action/Roster/GetList.php

@ -9,8 +9,6 @@ use App\User as DBUser;
class GetList extends Action
{
private $_from;
public function request()
{
$this->store();
@ -32,7 +30,4 @@ class GetList extends Action
$this->deliver();
}
public function load($key) {}
public function save() {}
}

8
lib/moxl/src/Moxl/Xec/Action/Roster/RemoveItem.php

@ -7,7 +7,7 @@ use Moxl\Stanza\Roster;
class RemoveItem extends Action
{
private $_to;
protected $_to;
public function request()
{
@ -15,12 +15,6 @@ class RemoveItem extends Action
Roster::remove($this->_to);
}
public function setTo($to)
{
$this->_to = \echapJid($to);
return $this;
}
public function handle($stanza, $parent = false)
{
$contact = \App\User::me()

26
lib/moxl/src/Moxl/Xec/Action/Roster/UpdateItem.php

@ -7,10 +7,10 @@ use Moxl\Stanza\Roster;
class UpdateItem extends Action
{
private $_to;
private $_from;
private $_name;
private $_group;
protected $_to;
protected $_from;
protected $_name;
protected $_group;
public function request()
{
@ -18,24 +18,6 @@ class UpdateItem extends Action
Roster::update($this->_to, $this->_name, $this->_group);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setName($name)
{
$this->_name = $name;
return $this;
}
public function setGroup($group)
{
$this->_group = $group;
return $this;
}
public function handle($stanza, $parent = false)
{
$roster = \App\Roster::firstOrNew(['jid' => $this->_to]);

8
lib/moxl/src/Moxl/Xec/Action/Session/Bind.php

@ -11,7 +11,7 @@ use App\Session as DBSession;
class Bind extends Action
{
private $_to;
protected $_resource;
public function request()
{
@ -19,12 +19,6 @@ class Bind extends Action
Stream::bindSet($this->_resource);
}
public function setResource($resource)
{
$this->_resource = $resource;
return $this;
}
public function handle($stanza, $parent = false)
{
$session = Session::start();

8
lib/moxl/src/Moxl/Xec/Action/Session/Start.php

@ -11,7 +11,7 @@ use App\Session as DBSession;
class Start extends Action
{
private $_to;
protected $_to;
public function request()
{
@ -19,12 +19,6 @@ class Start extends Action
Stream::sessionStart($this->_to);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function handle($stanza, $parent = false)
{
$session = Session::start();

22
lib/moxl/src/Moxl/Xec/Action/Storage/Get.php

@ -1,26 +1,4 @@
<?php
/*
* Get.php
*
* Copyright 2012 edhelas <edhelas@edhelas-laptop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Storage;

22
lib/moxl/src/Moxl/Xec/Action/Storage/Set.php

@ -1,26 +1,4 @@
<?php
/*
* Set.php
*
* Copyright 2012 edhelas <edhelas@edhelas-laptop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Storage;

52
lib/moxl/src/Moxl/Xec/Action/Upload/Request.php

@ -7,10 +7,10 @@ use Moxl\Stanza\Upload;
class Request extends Action
{
private $_to;
private $_name;
private $_size;
private $_type;
protected $_to;
protected $_name;
protected $_size;
protected $_type;
public function request()
{
@ -18,38 +18,13 @@ class Request extends Action
Upload::request($this->_to, $this->_name, $this->_size, $this->_type);
}
public function setTo($to)
public function handle($stanza, $parent = false)
{
$this->_to = echapJid($to);
return $this;
}
public function setName($name)
{
$this->_name = $name;
return $this;
}
public function setSize($size)
{
$this->_size = $size;
return $this;
}
public function setType($type)
{
$this->_type = $type;
return $this;
}
public function handle($stanza, $parent = false) {
if($stanza->slot) {
$this->pack(
array(
'get' => (string)$stanza->slot->get,
'put' => (string)$stanza->slot->put
)
);
$this->pack([
'get' => (string)$stanza->slot->get,
'put' => (string)$stanza->slot->put
]);
$this->deliver();
}
}
@ -60,19 +35,22 @@ class Request extends Action
}
// the file size was too large
public function errorNotAcceptable($error) {
public function errorNotAcceptable($error)
{
$this->pack($this->_to);
$this->deliver();
}
// the client exceeded a quota
public function errorResourceConstraint($error) {
public function errorResourceConstraint($error)
{
$this->pack($this->_to);
$this->deliver();
}
// the client is not allowed to upload files
public function errorNotAllowed($error) {
public function errorNotAllowed($error)
{
$this->pack($this->_to);
$this->deliver();
}

22
lib/moxl/src/Moxl/Xec/Action/Vcard/Get.php

@ -7,9 +7,7 @@ use Moxl\Stanza\Vcard;
class Get extends Action
{
private $_to;
private $_me = false;
private $_muc = false;
protected $_to;
public function request()
{
@ -17,24 +15,6 @@ class Get extends Action
Vcard::get($this->_to);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setMe()
{
$this->_me = true;
return $this;
}
public function isMuc()
{
$this->_muc = true;
return $this;
}
public function handle($stanza, $parent = false)
{
$contact = \App\Contact::firstOrNew(['id' => $this->_to]);

39
lib/moxl/src/Moxl/Xec/Action/Vcard/Set.php

@ -1,26 +1,5 @@
<?php
/*
* Set.php
*
* Copyright 2012 edhelas <edhelas@edhelas-laptop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Vcard;
use Moxl\Xec\Action;
@ -28,8 +7,8 @@ use Moxl\Stanza\Vcard;
class Set extends Action
{
private $_to;
private $_data;
protected $_to;
protected $_data;
public function request()
{
@ -37,18 +16,6 @@ class Set extends Action
Vcard::set($this->_to, $this->_data);
}
public function setData($data)
{
$this->_data = $data;
return $this;
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function handle($stanza, $parent = false)
{
$this->pack($this->_to);

40
lib/moxl/src/Moxl/Xec/Action/Vcard4/Get.php

@ -1,26 +1,5 @@
<?php
/*
* Get.php
*
* Copyright 2013 edhelas <edhelas@edhelas-laptop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Vcard4;
use Moxl\Xec\Action;
@ -29,8 +8,7 @@ use App\Contact;
class Get extends Action
{
private $_to;
private $_me = false;
protected $_to;
public function request()
{
@ -38,21 +16,9 @@ class Get extends Action
Vcard4::get($this->_to);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setMe()
{
$this->_me = true;
return $this;
}
public function handle($stanza, $parent = false)
{
if($vcard = $stanza->pubsub->items->item) {
if ($vcard = $stanza->pubsub->items->item) {
$contact = \App\Contact::firstOrNew(['id' => $this->_to]);
$contact->setVcard4($stanza->pubsub->items->item->vcard);
$contact->save();

8
lib/moxl/src/Moxl/Xec/Action/Vcard4/Set.php

@ -7,7 +7,7 @@ use Moxl\Stanza\Vcard4;
class Set extends Action
{
private $_data;
protected $_data;
public function request()
{
@ -15,12 +15,6 @@ class Set extends Action
Vcard4::set($this->_data);
}
public function setData($data)
{
$this->_data = $data;
return $this;
}
public function handle($stanza, $parent = false)
{
$this->pack(\App\User::me()->contact);

62
lib/moxl/src/Moxl/Xec/Action/Version/Send.php

@ -1,26 +1,4 @@
<?php
/*
* Send.php
*
* Copyright 2012 edhelas <edhelas@edhelas-laptop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
namespace Moxl\Xec\Action\Version;
@ -29,47 +7,17 @@ use Moxl\Stanza\Version;
class Send extends Action
{
private $_to;
private $_id;
private $_name;
private $_version;
private $_os;
protected $_to;
protected $_id;
protected $_name;
protected $_version;
protected $_os;
public function request()
{
Version::send($this->_to, $this->_id, $this->_name, $this->_version, $this->_os);
}
public function setTo($to)
{
$this->_to = $to;
return $this;
}
public function setId($id)
{
$this->_id = $id;
return $this;
}
public function setName($name)
{
$this->_name = $name;
return $this;
}
public function setVersion($version)
{
$this->_version = $version;
return $this;
}
public function setOs($os)
{
$this->_os = $os;
return $this;
}
public function handle($stanza, $parent = false)
{
}

Loading…
Cancel
Save