Update change log and spec for wrt-plugins-tizen_0.4.25-1
[platform/framework/web/wrt-plugins-tizen.git] / src / Callhistory / CallHistory.cpp
old mode 100644 (file)
new mode 100755 (executable)
index bf0dc72..daf42b8
@@ -74,16 +74,14 @@ CallHistory::~CallHistory()
 
        if (m_watchers.size() > 0) {
                for (;it < CallHistory::m_watchers.end();) {
-                       //ret = contacts_db_remove_changed_cb(_contacts_phone_log._uri, callhistoryListenerCB, it->Get());
                        ret = contacts_db_remove_changed_cb_with_info(_contacts_phone_log._uri, callhistoryListenerCB, it->Get());
 
                        if (ret != CONTACTS_ERROR_NONE) {
-                               LoggerD("callhistory remove listener error [" << ret << "]");
+                               LoggerD("Failed removing listener");
                        }
 
                        it = CallHistory::m_watchers.erase(it);
                }
-               LoggerD("CallHistory Watcher is removed. (" << CallHistory::m_watchers.size() << ")");
        }
 
        EventCallHistoryPtr event(new EventCallHistory());
@@ -288,15 +286,12 @@ void CallHistory::removeListener(const long id)
 
        for (;it < CallHistory::m_watchers.end();) {
 
-               LoggerD("removeListener : id ["<<id<<"]");
-               LoggerD("removeListener : handle() ["<<(*it)->getHandle()<<"]");
-
                if (id == (*it)->getHandle()) {
                        flag = true;
                        ret = contacts_db_remove_changed_cb_with_info(_contacts_phone_log._uri, callhistoryListenerCB, it->Get());
 
                        if (ret != CONTACTS_ERROR_NONE) {
-                               LoggerD("callhistory remove listener error [" << ret << "]");
+                               LoggerD("Failed removing listener");
                        }
 
                        it = CallHistory::m_watchers.erase(it);
@@ -306,7 +301,7 @@ void CallHistory::removeListener(const long id)
        }
 
        if (!flag) {
-               ThrowMsg(Commons::InvalidArgumentException, "Invalid values error : handle");
+               ThrowMsg(Commons::InvalidArgumentException, "Invalid values");
        }
 }
 
@@ -327,7 +322,7 @@ bool CallHistory::parseRecord(contacts_list_h *recordList, CallHistoryEntryListP
                if (record == NULL) {
                        ret = contacts_list_next(*recordList);
                        if (ret != CONTACTS_ERROR_NONE && ret != CONTACTS_ERROR_NO_DATA) {
-                               LoggerD("callhistory parse error [" << ret << "]");
+                               LoggerD("Failed callhistory parser");
                                return false;
                        } else {
                                continue;
@@ -350,7 +345,7 @@ bool CallHistory::parseRecord(contacts_list_h *recordList, CallHistoryEntryListP
 
                ret = contacts_list_next(*recordList);
                if (ret != CONTACTS_ERROR_NONE && ret != CONTACTS_ERROR_NO_DATA) {
-                       LoggerD("callhistory parse error [" << ret << "]");
+                       LoggerD("Failed callhistory parser");
                        return false;
                }
        }
@@ -444,7 +439,7 @@ void CallHistory::OnRequestReceived(const EventFindCallHistoryPtr& event)
                }
 
                if (ret != CONTACTS_ERROR_NONE) {
-                       LoggerD("callhistory query error [" << ret << "]");
+                       LoggerD("callhistory invalid query statement");
                }
 
 
@@ -459,7 +454,7 @@ void CallHistory::OnRequestReceived(const EventFindCallHistoryPtr& event)
                ret = contacts_db_get_records_with_query(query, offset, limit, &recordList);
 
                if (ret != CONTACTS_ERROR_NONE) {
-                       LoggerD("callhistory query error [" << ret << "]");
+                       LoggerD("Invalid query statement");
                }
 
                if (parseRecord(&recordList, callHistoryListPtr)) {
@@ -500,13 +495,13 @@ void CallHistory::OnRequestReceived(const EventRemoveBatchPtr& event)
                                                m_removeBatchEvent.push_back(eventData);
                                                event->switchToManualAnswer();
                                        } else {
-                                               LoggerD("callhistory remove Batch error [" << ret << "]");
+                                               LoggerD("Failed callhistory remove Batch [" << ret << "]");
                                                event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
                                        }
                                } else {
                                        ret = contacts_db_delete_records(_contacts_phone_log._uri, list, entryIds.size());
                                        if (ret != CONTACTS_ERROR_NONE) {
-                                               LoggerD("callhistory remove Batch error [" << ret << "]");
+                                               LoggerD("Failed callhistory remove Batch [" << ret << "]");
                                                event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
                                        }
                                }
@@ -548,14 +543,13 @@ void CallHistory::OnRequestReceived(const EventRemoveAllPtr& event)
                contacts_list_get_count(record_list, &total);
 
                list = new int[total];
-               LoggerD("total [" << total << "]");
                for (unsigned int i = 0; i < total; i++) {
                        ret = contacts_list_get_current_record_p(record_list, &record);
 
                        if (record == NULL) {
                                ret = contacts_list_next(record_list);
                                if ( !(ret==CONTACTS_ERROR_NONE || ret==CONTACTS_ERROR_NO_DATA) ){
-                                       LoggerD("callhistory remove All error [" << ret << "]");
+                                       LoggerD("Failed callhistory remove all [" << ret << "]");
                                        event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
                                }
                                continue;
@@ -571,13 +565,11 @@ void CallHistory::OnRequestReceived(const EventRemoveAllPtr& event)
                        value = 0;
                        ret = contacts_list_next(record_list);
                        if ( !(ret==CONTACTS_ERROR_NONE || ret==CONTACTS_ERROR_NO_DATA) ){
-                               LoggerD("callhistory remove All error [" << ret << "]");
+                               LoggerD("Failed callhistory remove all [" << ret << "]");
                                event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
                        }
                }
 
-               LoggerD("cnt [" << cnt << "]");
-
                if (cnt > 0) {
                        EventRemoveAllDataPtr eventData( new EventCallHistoryPtrs<EventRemoveAll>(event, this));
 
@@ -589,13 +581,13 @@ void CallHistory::OnRequestReceived(const EventRemoveAllPtr& event)
                                                m_removeAllEvent.push_back(eventData);
                                                event->switchToManualAnswer();
                                        } else {
-                                               LoggerD("callhistory remove All error [" << ret << "]");
+                                               LoggerD("Failed callhistory remove all [" << ret << "]");
                                                event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
                                        }
                                } else {
                                        ret = contacts_db_delete_records(_contacts_phone_log._uri, list, cnt);
                                        if (ret != CONTACTS_ERROR_NONE) {
-                                               LoggerD("callhistory remove All error [" << ret << "]");
+                                               LoggerD("Failed callhistory remove all [" << ret << "]");
                                                event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
                                        }
                                }
@@ -626,7 +618,6 @@ void CallHistory::callRemoveBatchEvent(int error, const EventRemoveBatchPtr &eve
        for (it = m_removeBatchEvent.begin(); it != m_removeBatchEvent.end(); ++it) {
                if ((*it)->getEventPtrs() == event) {
                        m_removeBatchEvent.erase(it);
-                       LoggerD("event is removed. (" << m_removeBatchEvent.size() << ")");
                        break;
                }
        }
@@ -644,7 +635,6 @@ void CallHistory::callRemoveAllEvent(int error, const EventRemoveAllPtr &event)
        for (it = m_removeAllEvent.begin(); it != m_removeAllEvent.end(); ++it) {
                if ((*it)->getEventPtrs() == event) {
                        m_removeAllEvent.erase(it);
-                       LoggerD("event is removed. (" << m_removeAllEvent.size() << ")");
                        break;
                }
        }
@@ -733,7 +723,6 @@ void CallHistory::Watcher::ListenerCB(char* changes)
        while( tokenType != NULL )
        {
                tokenId = strtok( NULL, seps );
-               LoggerD("[ %s / %s ]", tokenType , tokenId );
                changeType = atoi((const char*)tokenType);
                changeId = atoi((const char*)tokenId);
 
@@ -751,7 +740,7 @@ void CallHistory::Watcher::ListenerCB(char* changes)
 
                ret = contacts_query_set_sort(query, _contacts_phone_log.id, false);
                if (ret != CONTACTS_ERROR_NONE) {
-                       LoggerD("callhistory query error [" << ret << "]");
+                       LoggerD("Invalid callhistory query [" << ret << "]");
                }
 
                ret = contacts_db_get_records_with_query(query, 0, 1, &recordList);
@@ -759,7 +748,7 @@ void CallHistory::Watcher::ListenerCB(char* changes)
                        contacts_list_destroy(recordList, true);
                        contacts_query_destroy(query);
                        contacts_filter_destroy(filter);
-                       LoggerD("callhistory query error [" << ret << "]");
+                       LoggerD("Invalid callhistory query [" << ret << "]");
                        return;
                }