Add api key to user, add status update support, add other things i dont remember at 2am...

This commit is contained in:
osaajani 2020-01-08 02:14:38 +01:00
parent 193dd00c1e
commit fb6abb4d91
14 changed files with 323 additions and 8 deletions

View file

@ -36,6 +36,11 @@
* Does the implemented service support flash smss
*/
public static function meta_support_flash() : bool;
/**
* Does the implemented service support status change
*/
public static function meta_support_status_change() : bool;
/**
@ -61,4 +66,11 @@
* @return array : Array of the sms reads
*/
public function read () : array;
/**
* Method called on reception of a status update notification for a SMS
* @return mixed : False on error, else array ['uid' => uid of the sms, 'status' => New status of the sms ('unknown', 'delivered', 'failed')]
*/
public static function status_change_callback ();
}

View file

@ -36,6 +36,11 @@
* Does the implemented service support flash smss
*/
public static function meta_support_flash() : bool { return false ; }
/**
* Does the implemented service support status change
*/
public static function meta_support_status_change() : bool { return true; }
/**
@ -82,4 +87,14 @@
{
return [];
}
/**
* Method called on reception of a status update notification for a SMS
* @return mixed : False on error, else array ['uid' => uid of the sms, 'status' => New status of the sms ('unknown', 'delivered', 'failed')]
*/
public static function status_change_callback ()
{
return false;
}
}

View file

@ -36,6 +36,11 @@
* Does the implemented service support flash smss
*/
public static function meta_support_flash() : bool { return true ; }
/**
* Does the implemented service support status change
*/
public static function meta_support_status_change() : bool { return true; }
/**
@ -118,4 +123,42 @@
return $return;
}
/**
* Method called on reception of a status update notification for a SMS
* @return mixed : False on error, else array ['uid' => uid of the sms, 'status' => New status of the sms ('unknown', 'delivered', 'failed')]
*/
public static function status_change_callback ()
{
$uid = $_GET['uid'] ?? false;
$status = $_GET['status'] ?? false;
if (!$uid || !$status)
{
return false;
}
$return = [
'uid' => $uid,
'status' => 'unknown',
];
switch ($status)
{
case 'delivered' :
$return['status'] = 'delivered';
break;
case 'failed' :
$return['status'] = 'failed';
break;
default :
$return['status'] = 'unknown';
break;
}
return $return;
}
}