diff --git a/appinfo/database.xml b/appinfo/database.xml index f92a6fb..eec1edc 100644 --- a/appinfo/database.xml +++ b/appinfo/database.xml @@ -26,8 +26,16 @@ 64 true + + user_datas_user_datakey + + user_id + + + datakey + + - *dbprefix*ocsms_smsdatas @@ -102,6 +110,54 @@ true1 + + smsdata_user_mailbox + + user_id + + + sms_mailbox + + + + smsdata_user_mailbox_date + + user_id + + + sms_mailbox + + + sms_date + + + + smsdata_user_mailbox_address + + user_id + + + sms_mailbox + + + sms_address + + + + smsdata_user_mailbox_address_date + + user_id + + + sms_mailbox + + + sms_address + + + sms_date + +
@@ -157,6 +213,15 @@ false10240 + + config_user_key + + user + + + key + +
diff --git a/appinfo/info.xml b/appinfo/info.xml index fd8eaa0..0ee5930 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -6,7 +6,7 @@ A app to sync SMS with your ownCloud agpl Loic Blot - 1.8.3 + 1.8.5 diff --git a/db/smsmapper.php b/db/smsmapper.php index da02e75..657f617 100644 --- a/db/smsmapper.php +++ b/db/smsmapper.php @@ -197,7 +197,7 @@ class SmsMapper extends Mapper { } public function getLastMessageTimestampForAllPhonesNumbers ($userId, $order = true) { - $sql = 'SELECT sms_address,MAX(sms_date) as mx FROM ' . + $sql = 'SELECT sms_address, MAX(sms_date) AS mx FROM ' . '*PREFIX*ocsms_smsdatas WHERE user_id = ? AND sms_mailbox IN (?,?) ' . 'GROUP BY sms_address'; @@ -210,7 +210,7 @@ class SmsMapper extends Mapper { $phoneList = array(); while ($row = $result->fetchRow()) { - $phoneNumber = $row["sms_address"]; + $phoneNumber = preg_replace("#[ ]#", "", $row["sms_address"]); if (!in_array($phoneNumber, $phoneList)) { $phoneList[$phoneNumber] = $row["mx"]; } @@ -221,7 +221,7 @@ class SmsMapper extends Mapper { public function getNewMessagesCountForAllPhonesNumbers($userId, $lastDate) { $ld = ($lastDate == '') ? 0 : $lastDate; - $sql = 'SELECT sms_address,count(sms_date) as ct FROM ' . + $sql = 'SELECT sms_address, COUNT(sms_date) AS ct FROM ' . '*PREFIX*ocsms_smsdatas WHERE user_id = ? AND sms_mailbox IN (?,?) ' . 'AND sms_date > ? GROUP BY sms_address'; diff --git a/js/public/app.js b/js/public/app.js index 4b7f287..b5c6661 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -204,10 +204,9 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' var bufferedContacts = []; $.each(jsondata['phonelist'], function(id, val) { - var fn, peerLabel, idxVal; - idxVal = id.replace(/\//g,''); + var fn, peerLabel; if (typeof jsondata['contacts'][id] == 'undefined') { - peerLabel = idxVal; + peerLabel = id; } else { fn = jsondata['contacts'][id]; @@ -217,7 +216,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' if (!inArray(peerLabel, bufferedContacts)) { var contactObj = { 'label': peerLabel, - 'nav': idxVal, + 'nav': id, 'unread': val }; @@ -229,8 +228,8 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' bufferedContacts.push(peerLabel); // Re-set conversation because we reload the element - if (idxVal == $scope.selectedContact.nav) { - changeSelectedConversation($("a[mailbox-navigation='" + idxVal + "']")); + if (id == $scope.selectedContact.nav) { + changeSelectedConversation($("a[mailbox-navigation='" + id + "']")); } g_unreadCountAllConv += parseInt(val); @@ -363,11 +362,9 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' $scope.photoVersion = jsondata["photo_version"]; $.each(jsondata['phonelist'], function(id, val) { - var peerLabel, idxVal, idxVal2; - idxVal = id.replace(/\//g,' '); - idxVal2 = idxVal.replace('/ /g',''); + var peerLabel; if (typeof jsondata['contacts'][id] == 'undefined') { - peerLabel = idxVal; + peerLabel = id; } else { peerLabel = jsondata['contacts'][id]; @@ -375,7 +372,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' if (!inArray(peerLabel, bufferedContacts)) { var contactObj = { 'label': peerLabel, - 'nav': idxVal2, + 'nav': id, 'unread' : 0, 'lastmsg': val };