mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Some small idea changes
This commit is contained in:
parent
3576c22401
commit
04f3133f27
2 changed files with 31 additions and 1 deletions
|
|
@ -300,6 +300,30 @@ class Manager
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
private static function getCallableName(callable $callable) {
|
||||||
|
if (\is_string($callable)) {
|
||||||
|
if (\str_contains($callable, '::')) {
|
||||||
|
return '[static] ' . $callable;
|
||||||
|
}
|
||||||
|
return '[function] ' . $callable;
|
||||||
|
}
|
||||||
|
if (\is_array($callable)) {
|
||||||
|
if (\is_object($callable[0])) {
|
||||||
|
return '[method] ' . \get_class($callable[0]) . '->' . $callable[1];
|
||||||
|
}
|
||||||
|
return '[static] ' . $callable[0] . '::' . $callable[1];
|
||||||
|
}
|
||||||
|
if ($callable instanceof \Closure) {
|
||||||
|
return '[closure]';
|
||||||
|
}
|
||||||
|
if (\is_object($callable)) {
|
||||||
|
return '[invokable] ' . \get_class($callable);
|
||||||
|
}
|
||||||
|
return '[unknown]';
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public function RunHook(string $sHookName, array $aArg = array(), bool $bLogHook = true) : self
|
public function RunHook(string $sHookName, array $aArg = array(), bool $bLogHook = true) : self
|
||||||
{
|
{
|
||||||
if ($this->bIsEnabled) {
|
if ($this->bIsEnabled) {
|
||||||
|
|
@ -307,9 +331,13 @@ class Manager
|
||||||
if (isset($this->aHooks[$sHookName])) {
|
if (isset($this->aHooks[$sHookName])) {
|
||||||
if ($bLogHook) {
|
if ($bLogHook) {
|
||||||
$this->WriteLog('Hook: '.$sHookName, \LOG_INFO);
|
$this->WriteLog('Hook: '.$sHookName, \LOG_INFO);
|
||||||
|
// $this->WriteLog('Hooks: '.\implode(',', \array_map('self::getCallableName', $this->aHooks[$sHookName])), \LOG_DEBUG);
|
||||||
}
|
}
|
||||||
foreach ($this->aHooks[$sHookName] as $mCallback) {
|
foreach ($this->aHooks[$sHookName] as $mCallback) try {
|
||||||
$mCallback(...$aArg);
|
$mCallback(...$aArg);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
// $this->WriteLog("Hook {$sHookName} {$e->getMessage()}\n".static::getCallableName($mCallback), \LOG_ERR);
|
||||||
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ class OAuthBearer extends \SnappyMail\SASL
|
||||||
?string $authzid = null
|
?string $authzid = null
|
||||||
) : string
|
) : string
|
||||||
{
|
{
|
||||||
|
// add host and port?
|
||||||
|
//return $this->encode("n,a={$username},\x01host={$host}\x01port={$port}\x01auth=Bearer {$accessToken}\x01\x01");
|
||||||
return $this->encode("n,a={$username},\x01auth=Bearer {$accessToken}\x01\x01");
|
return $this->encode("n,a={$username},\x01auth=Bearer {$accessToken}\x01\x01");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue