Example #1
0
def getChatSessions(c1, address_book_list=None):
    # gets all the chat sessions
    count_chats = 0
    chat_session_list = []
    try:
        c1.execute(
            "SELECT m.rowid as ROWID, m.chat_identifier as CHATID, m.service_name as SERVICENAME, m.state as STATE, h.rowid as HNDLROWID, h.id as HNDLID, h.country as HNDLCOUNTRY, h.service as HNDLSERVICE FROM chat m, handle h Where m.chat_identifier = h.id and m.service_name = h.service"
        )
        for chats in c1:
            count_chats = count_chats + 1
            abcontact = ""
            if address_book_list is not None:
                abcontact = search_number_in_ab(address_book_list,
                                                chats["HNDLID"])
            #print chats
            curr_chat = MSGChat(chats["ROWID"], chats["CHATID"],
                                chats["HNDLROWID"], chats["SERVICENAME"],
                                chats["STATE"], chats["HNDLID"],
                                chats["HNDLCOUNTRY"], chats["HNDLSERVICE"],
                                abcontact)
            chat_session_list.append(curr_chat)
        chat_session_list = sorted(chat_session_list,
                                   key=lambda Chatsession: Chatsession.chat_id,
                                   reverse=True)
        return chat_session_list
    except sqlite3.Error as msg:
        print('Error: {}'.format(msg))
        return None
def getCall_list8(c1, address_book_list=None):
    call_list = []
    count_calls = 0
    try:
        c1.execute(
            "SELECT Z_PK, Z_ENT, Z_OPT, ZANSWERED, ZCALLTYPE, ZDISCONNECTED_CAUSE, ZFACE_TIME_DATA, ZNUMBER_AVAILABILITY, ZORIGINATED, ZREAD, ZDATE, ZDURATION, ZADDRESS, ZDEVICE_ID, ZISO_COUNTRY_CODE, ZNAME, ZUNIQUE_ID FROM ZCALLRECORD")
        for calls in c1:
            count_calls += 1
            curr_call = iOS8_CallHistory(calls["Z_PK"], calls["Z_ENT"], calls["Z_OPT"], calls["ZANSWERED"], calls["ZCALLTYPE"],
                                    calls["ZDISCONNECTED_CAUSE"], calls["ZFACE_TIME_DATA"], calls["ZNUMBER_AVAILABILITY"], calls["ZORIGINATED"],
                                    calls["ZREAD"], calls["ZDATE"], calls["ZDURATION"], calls["ZADDRESS"], calls["ZDEVICE_ID"], calls["ZISO_COUNTRY_CODE"], calls["ZNAME"], calls["ZUNIQUE_ID"])
            if address_book_list is not None:
                curr_call.contact = search_number_in_ab(address_book_list, calls["ZADDRESS"])
            call_list.append(curr_call)
        call_list = sorted(call_list, key=lambda Calls: Calls.zpk, reverse=True)
        return call_list
    except sqlite3.Error as msg:
        print('Error: {}'.format(msg))
        return None
Example #3
0
def getChatSessions(c1, address_book_list=None):
    # gets all the chat sessions
    count_chats = 0
    chat_session_list = []
    try:
        c1.execute("SELECT m.rowid as ROWID, m.chat_identifier as CHATID, m.service_name as SERVICENAME, m.state as STATE, h.rowid as HNDLROWID, h.id as HNDLID, h.country as HNDLCOUNTRY, h.service as HNDLSERVICE FROM chat m, handle h Where m.chat_identifier = h.id and m.service_name = h.service")
        for chats in c1:
            count_chats = count_chats + 1
            abcontact = ""
            if address_book_list is not None:
                abcontact = search_number_in_ab(address_book_list, chats["HNDLID"])
            #print chats
            curr_chat =  MSGChat(chats["ROWID"],chats["CHATID"],chats["HNDLROWID"],chats["SERVICENAME"],chats["STATE"],chats["HNDLID"],chats["HNDLCOUNTRY"],chats["HNDLSERVICE"], abcontact)
            chat_session_list.append(curr_chat)
        chat_session_list = sorted(chat_session_list, key=lambda Chatsession: Chatsession.chat_id, reverse=True)
        return chat_session_list
    except sqlite3.Error as msg:
        print('Error: {}'.format(msg))
        return None
def getCall_list(c1, address_book_list=None):

    # gets all the chat sessions
    call_list = []
    count_calls = 0
    try:
        c1.execute(
            "SELECT ROWID, ADDRESS, DATE, DURATION, FLAGS, ID, NAME, COUNTRY_CODE, NETWORK_CODE, READ, ASSISTED, FACE_TIME_DATA, ORIGINALADDRESS FROM call")
        for calls in c1:
            count_calls += 1
            curr_call = CallHistory(calls["ROWID"], calls["ADDRESS"], calls["DATE"], calls["DURATION"], calls["FLAGS"],
                                    calls["ID"], calls["NAME"], calls["COUNTRY_CODE"], calls["NETWORK_CODE"],
                                    calls["READ"], calls["ASSISTED"], calls["FACE_TIME_DATA"], calls["ORIGINALADDRESS"])
            cid = str(calls["ID"])
            if (cid != '-1') and (address_book_list is not None):
                curr_call.contact = search_id_in_ab(address_book_list, cid)
            elif address_book_list is not None:
                curr_call.contact = search_number_in_ab(address_book_list, calls["ADDRESS"])
            call_list.append(curr_call)
        call_list = sorted(call_list, key=lambda Calls: Calls.rowid, reverse=True)
        return call_list
    except sqlite3.Error as msg:
        print('Error: {}'.format(msg))
        return None