niftycode / imessage_reader

Fetch imessages from chat.db
MIT License
90 stars 22 forks source link

how to remove messages? #13

Closed Jarrodsz closed 2 years ago

Jarrodsz commented 3 years ago

Not able to figure out how I could remove messages after reading them?


from imessage_reader import fetch_data

# Create a FetchData instance
fd = fetch_data.FetchData()

# Store messages in my_data
# This is a list of tuples containing user id, message and service.
# service -> iMessage or SMS
my_data = fd.get_messages()

# get last index
sender = my_data[-1]
if "student" in sender:
    user = my_data[-1][1]
    print user
    # deletet this  message how??

Would it be possible to somehow delete the message or any suggestions on how to get this functionality? kind regards

Jarrodsz commented 3 years ago

Any updates on this?

thecircleisround commented 3 years ago

Any updates on this?

This tool only pulls data from the chat.do file. It does not perform any write actions on chat.db itself. If you need to delete messages you would need to write code that implements the sql needed to delete from chat.db

Jarrodsz commented 3 years ago

Ok thank you

Woudent this be a nice addition to the library? Any suggestions where to start implementing this?

If we have the message id we would need to write a delete sql statement and make it available true a function call.

thecircleisround commented 3 years ago

I'm not sure it fits the nature of what this project is supposed to be. Maybe @niftycode could provide input. To implement should be easy enough so long as there aren't any issues with permission on the chat.db file. I think having FetchData.get_messages() return a class object rather than a tuple would make managing methods easier. From there you can have a delete method that does what you describe.