diff --git a/appinfo/database.xml b/appinfo/database.xml
index fc9cdd7..5085676 100644
--- a/appinfo/database.xml
+++ b/appinfo/database.xml
@@ -72,6 +72,12 @@
true
1
+
+ sms_type
+ integer
+ true
+ 1
+
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 0016559..1944459 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -5,6 +5,6 @@
Owncloud SMS app
AGPL
Loic Blot
- 0.1.5
+ 0.1.7
7
diff --git a/controller/smscontroller.php b/controller/smscontroller.php
index 81b1a99..b0cc557 100644
--- a/controller/smscontroller.php
+++ b/controller/smscontroller.php
@@ -60,7 +60,7 @@ class SmsController extends Controller {
foreach ($smsDatas as &$sms) {
if (!array_key_exists("_id", $sms) || !array_key_exists("read", $sms) ||
!array_key_exists("date", $sms) || !array_key_exists("seen", $sms) ||
- !array_key_exists("mbox", $sms) ||
+ !array_key_exists("mbox", $sms) || !array_key_exists("type", $sms)
!array_key_exists("body", $sms) || !array_key_exists("address", $sms)) {
$this->errorMsg = "Error: bad SMS entry";
return false;
@@ -71,6 +71,11 @@ class SmsController extends Controller {
return false;
}
+ if (!is_numeric($sms["type"])) {
+ $this->errorMsg = sprintf("Error: Invalid SMS type '%s'", $sms["type"]);
+ return false;
+ }
+
if (!is_numeric($sms["mbox"]) && $sms["mbox"] != 0 && $sms["mbox"] != 1 &&
$sms["mbox"] != 2) {
$this->errorMsg = sprintf("Error: Invalid Mailbox ID '%s'", $sms["mbox"]);
diff --git a/db/smsmapper.php b/db/smsmapper.php
index 76586c0..0ad681c 100644
--- a/db/smsmapper.php
+++ b/db/smsmapper.php
@@ -30,12 +30,13 @@ class SmsMapper extends Mapper {
$query = \OC_DB::prepare('INSERT INTO *PREFIX*ocsms_smsdatas ' .
'(user_id, added, lastmodified, sms_flags, sms_date, sms_id,' .
- 'sms_address, sms_msg, sms_mailbox) VALUES ' .
- '(?,?,?,?,?,?,?,?,?)');
+ 'sms_address, sms_msg, sms_mailbox, sms_type) VALUES ' .
+ '(?,?,?,?,?,?,?,?,?,?)');
$result = $query->execute(array(
$userId, "NOW()", "NOW()", $smsFlags,
(int) $sms["date"], (int) $sms["_id"],
- $sms["address"], $sms["body"], (int) $sms["mbox"]
+ $sms["address"], $sms["body"], (int) $sms["mbox"],
+ (int) $sms["type"]
));
}
}