Skip to content

Commit

Permalink
When handling incoming messages and setting channelvariables and vari…
Browse files Browse the repository at this point in the history
…ables, we should update the

'variable' in the set of available keys

fixes: #13

Signed-off-by: Diederik de Groot <[email protected]>
  • Loading branch information
dkgroot committed May 9, 2020
1 parent 50979a6 commit afe87ca
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/PAMI/Message/IncomingMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,11 @@ public function __construct($rawContent)
$chanName = $captures[1];
}
$content = explode('=', $value);
$name = strtolower(trim($content[0]));
$name = trim($content[0]);
unset($content[0]);
$value = isset($content[1]) ? trim(implode(':', $content)) : '';
$this->channelVariables[$chanName][$name] = $value;
$this->channelVariables[$chanName][strtolower($name)] = $value;
$this->setSanitizedKey('chanvariable', $name);
} elseif (!strncmp($name, 'variable', 8)) {
// https://github.com/marcelog/PAMI/issues/85
$matches = preg_match("/\(([^\)]*)\)/", $name, $captures);
Expand All @@ -209,18 +210,17 @@ public function __construct($rawContent)
$chanName = $captures[1];
}
$content = explode('=', $value);
$name = strtolower(trim($content[0]));
$name = trim($content[0]);
unset($content[0]);
$value = isset($content[1]) ? trim(implode(':', $content)) : '';
$this->statusVariables[$chanName][$name] = $value;
} else {
// Added ResponseFactory #d3b0ce8
try {
$this->setSanitizedKey($name, $value);
} catch (PAMIException $e) {
throw new PAMIException("Error: '" . $e . "'\n Dump RawContent:\n" . $this->rawContent ."\n");
}
//$this->setKey($name, $value);
$this->statusVariables[$chanName][strtolower($name)] = $value;
$this->setSanitizedKey('variable', $name);
}
// Added ResponseFactory #d3b0ce8
try {
$this->setSanitizedKey($name, $value);
} catch (PAMIException $e) {
throw new PAMIException("Error: '" . $e . "'\n Dump RawContent:\n" . $this->rawContent ."\n");
}
}
// https://github.com/marcelog/PAMI/issues/85
Expand Down

0 comments on commit afe87ca

Please sign in to comment.