Made function to allow different ways of holding the voicemail files
git-svn-id: http://voip.null.ro/svn/yate@1752 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
5eec57a32c
commit
6f9b570cfc
|
@ -26,13 +26,13 @@
|
||||||
require_once("libyate.php");
|
require_once("libyate.php");
|
||||||
|
|
||||||
$vm_base = "/var/spool/voicemail";
|
$vm_base = "/var/spool/voicemail";
|
||||||
|
$vm_func_for_dir = "vmDefaultGetDir";
|
||||||
|
|
||||||
function vmGetMessageStats($mailbox,&$total,&$unread,$type = "voicemail")
|
function vmGetMessageStats($mailbox,&$total,&$unread,$type = "voicemail")
|
||||||
{
|
{
|
||||||
global $vm_base;
|
|
||||||
$o = 0;
|
$o = 0;
|
||||||
$n = 0;
|
$n = 0;
|
||||||
$dir = "$vm_base/$mailbox";
|
$dir = vmGetVoicemailDir($mailbox);
|
||||||
if (is_dir($dir) && ($d = @opendir($dir))) {
|
if (is_dir($dir) && ($d = @opendir($dir))) {
|
||||||
while (($f = readdir($d)) !== false) {
|
while (($f = readdir($d)) !== false) {
|
||||||
if (substr($f,0,4) == "nvm-") {
|
if (substr($f,0,4) == "nvm-") {
|
||||||
|
@ -52,8 +52,7 @@ function vmGetMessageStats($mailbox,&$total,&$unread,$type = "voicemail")
|
||||||
|
|
||||||
function vmGetMessageFiles($mailbox,&$files)
|
function vmGetMessageFiles($mailbox,&$files)
|
||||||
{
|
{
|
||||||
global $vm_base;
|
$dir = vmGetVoicemailDir($mailbox);
|
||||||
$dir = "$vm_base/$mailbox";
|
|
||||||
if (is_dir($dir) && ($d = @opendir($dir))) {
|
if (is_dir($dir) && ($d = @opendir($dir))) {
|
||||||
$nf = array();
|
$nf = array();
|
||||||
$of = array();
|
$of = array();
|
||||||
|
@ -76,8 +75,7 @@ function vmGetMessageFiles($mailbox,&$files)
|
||||||
|
|
||||||
function vmSetMessageRead($mailbox,&$file)
|
function vmSetMessageRead($mailbox,&$file)
|
||||||
{
|
{
|
||||||
global $vm_base;
|
$dir = vmGetVoicemailDir($mailbox);
|
||||||
$dir = "$vm_base/$mailbox";
|
|
||||||
if (is_dir($dir) && is_file("$dir/$file")) {
|
if (is_dir($dir) && is_file("$dir/$file")) {
|
||||||
if (substr($file,0,4) != "nvm-")
|
if (substr($file,0,4) != "nvm-")
|
||||||
return false;
|
return false;
|
||||||
|
@ -92,17 +90,14 @@ function vmSetMessageRead($mailbox,&$file)
|
||||||
|
|
||||||
function vmInitMessageDir($mailbox)
|
function vmInitMessageDir($mailbox)
|
||||||
{
|
{
|
||||||
global $vm_base;
|
$dir = vmGetVoicemailDir($mailbox);
|
||||||
$dir = "$vm_base/$mailbox";
|
|
||||||
if (!is_dir($dir))
|
if (!is_dir($dir))
|
||||||
mkdir($dir,0750);
|
mkdir($dir,0750);
|
||||||
}
|
}
|
||||||
|
|
||||||
function vmHasMessageDir($mailbox)
|
function vmHasMessageDir($mailbox)
|
||||||
{
|
{
|
||||||
global $vm_base;
|
return is_dir(vmGetVoicemailDir($mailbox));
|
||||||
$dir = "$vm_base/$mailbox";
|
|
||||||
return is_dir($dir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function vmBuildNewFilename($caller)
|
function vmBuildNewFilename($caller)
|
||||||
|
@ -112,4 +107,18 @@ function vmBuildNewFilename($caller)
|
||||||
return $tmp;
|
return $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function vmGetVoicemailDir($called)
|
||||||
|
{
|
||||||
|
global $vm_func_for_dir;
|
||||||
|
|
||||||
|
return call_user_func($vm_func_for_dir,$called);
|
||||||
|
}
|
||||||
|
|
||||||
|
function vmDefaultGetDir($called)
|
||||||
|
{
|
||||||
|
global $vm_base;
|
||||||
|
|
||||||
|
return "$vm_base/$called";
|
||||||
|
}
|
||||||
|
|
||||||
/* vi: set ts=8 sw=4 sts=4 noet: */
|
/* vi: set ts=8 sw=4 sts=4 noet: */
|
||||||
|
|
Loading…
Reference in New Issue