diff --git a/js/script.js b/js/script.js index 83c6f03..51df8ec 100644 --- a/js/script.js +++ b/js/script.js @@ -14,7 +14,8 @@ var selectedConversation = null; var curPhoneNumber = null; var curContactName = ''; var lastMsgDate = 0; -var unreadCount = 0; +var unreadCountCurrentConv = 0; +var unreadCountAllConv = 0; var originalTitle = document.title; $.urlParam = function(name){ @@ -48,9 +49,9 @@ var refreshConversation = function() { $('#app-content').scrollTop(1E10); // This will blink the tab because there is new messages if (document.hasFocus() == false) { - unreadCount += fmt[0]; - document.title = originalTitle + " (" + unreadCount + ")"; - desktopNotify(unreadCount + " unread message(s) in conversation with " + curContactName); + unreadCountCurrentConv += fmt[0]; + document.title = originalTitle + " (" + unreadCountCurrentConv + ")"; + desktopNotify(unreadCountCurrentConv + " unread message(s) in conversation with " + curContactName); } } @@ -64,6 +65,7 @@ var refreshConversation = function() { }; var checkNewMessages = function() { + unreadCountAllConv = 0; $.getJSON(OC.generateUrl('/apps/ocsms/get/new_messages'), { 'lastDate': lastMsgDate }, function(jsondata, status) { @@ -82,16 +84,20 @@ var checkNewMessages = function() { fn = jsondata['contacts'][id]; peerLabel = fn; } + if ($.inArray(peerLabel, bufferedContacts) == -1) { $("a[mailbox-label='" + peerLabel + "']").remove(); peerListBuf = '