usage: msg($peer, $text)

This commit is contained in:
Denny Dai
2015-06-26 13:59:37 +08:00
parent fce895bb21
commit c3ada33e3b
6 changed files with 20 additions and 5 deletions
+16
View File
@@ -32,4 +32,20 @@ class Base
}
return false;
}
public function escapeStringArgument($argument)
{
return '"' . addslashes($argument) . '"';
}
public function escapePeer($peer)
{
return str_replace(' ', '_', $peer);
}
public function msg($peer, $msg)
{
$peer = $this->escapePeer($peer);
$msg = $this->escapeStringArgument($msg);
return $this->exec('msg ' . $peer . ' ' . $msg);
}
}