/**
  * @param \OC\Hooks\Emitter $emitter
  */
 protected function forward($emitter)
 {
     $this->forwardEmitters[] = $emitter;
     //forward all previously connected hooks
     foreach ($this->listeners as $key => $listeners) {
         list($scope, $method) = explode('::', $key, 2);
         foreach ($listeners as $listener) {
             $emitter->listen($scope, $method, $listener);
         }
     }
 }
 /**
  * @expectedException \Test\Hooks\EmittedException
  */
 public function testRemoveNonExistingName()
 {
     $listener = function () {
         throw new EmittedException();
     };
     $this->emitter->listen('Test', 'test', $listener);
     $this->emitter->removeListener('Bar', 'test', $listener);
     $this->emitter->emitEvent('Test', 'test');
     $this->assertTrue(true);
 }
Example #3
0
 /**
  * Set the password of the user
  *
  * @param string $password
  * @param string $recoveryPassword for the encryption app to reset encryption keys
  * @return bool
  */
 public function setPassword($password, $recoveryPassword = null)
 {
     if ($this->emitter) {
         $this->emitter->emit('\\OC\\User', 'preSetPassword', array($this, $password, $recoveryPassword));
     }
     if ($this->backend->implementsActions(\OC_USER_BACKEND_SET_PASSWORD)) {
         $result = $this->backend->setPassword($this->uid, $password);
         if ($this->emitter) {
             $this->emitter->emit('\\OC\\User', 'postSetPassword', array($this, $password, $recoveryPassword));
         }
         return !($result === false);
     } else {
         return false;
     }
 }
Example #4
0
 public function triggerChange($feature, $value = null)
 {
     if ($this->emitter) {
         $this->emitter->emit('\\OC\\User', 'changeUser', array($this, $feature, $value));
     }
 }
Example #5
0
 public function triggerChange()
 {
     if ($this->emitter) {
         $this->emitter->emit('\\OC\\User', 'changeUser', array($this));
     }
 }