Browse Source

Handle differently Items in Roster and their related events

pull/676/head
Timothée Jaussoin 7 years ago
parent
commit
ece0c76a6b
  1. 4
      app/widgets/Roster/Roster.php
  2. 2
      lib/moxl/src/Moxl/Xec/Action/Roster/RemoveItem.php
  3. 7
      lib/moxl/src/Moxl/Xec/Action/Roster/UpdateItem.php

4
app/widgets/Roster/Roster.php

@ -15,8 +15,8 @@ class Roster extends \Movim\Widget\Base
$this->addjs('roster.js');
$this->registerEvent('roster_getlist_handle', 'onRoster', 'contact');
$this->registerEvent('roster_additem_handle', 'onAdd', 'contact');
$this->registerEvent('roster_removeitem_handle', 'onDelete', 'contact');
$this->registerEvent('roster_updateitem_handle', 'onUpdate', 'contact');
$this->registerEvent('roster_removeitem_handle', 'onDelete');
$this->registerEvent('roster_updateitem_handle', 'onUpdate');
$this->registerEvent('roster', 'onChange', 'contact');
$this->registerEvent('presence', 'onPresence', 'contact');
}

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

@ -25,7 +25,7 @@ class RemoveItem extends Action
{
$contact = \App\User::me()
->session
->contacts
->contacts()
->where('jid', $this->_to)
->first();
if ($contact) $contact->delete();

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

@ -38,12 +38,7 @@ class UpdateItem extends Action
public function handle($stanza, $parent = false)
{
$roster = \App\User::me()
->session
->contacts
->where('jid', $this->_to)
->first();
$roster = \App\Roster::firstOrNew(['jid' => $this->_to]);
$roster->name = $this->_name;
$roster->group = $this->_group;
$roster->save();

Loading…
Cancel
Save