maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   General (https://talk.maemo.org/forumdisplay.php?f=7)
-   -   Help me. about use python delete sms. (https://talk.maemo.org/showthread.php?t=80559)

binkcn 2011-12-02 07:26

Help me. about use python delete sms.
 
First, Sorry, I'm not good at English.

I want devel a application, it's can auto delete AD SMS,code use python.

this is code:

Code:


    conn = sqlite3.connect("/home/user/.rtcom-eventlogger/el-v1.db")
    cur = conn.cursor()
    cur.execute('delete from Events where service_id=3 and event_type_id=11 and remote_uid=\''+sendernumber+'\'')
    conn.commit()
    cur.close()
    conn.close()

it's not work. delete data from database,but this item also show in SMS UI. I think the are not synchronous?

I search some code form google.com.

like this:
Code:


def del_sms(id):
    OSSO_CTX      =  osso.Context("some_context_here", "0.1")
    OSSO_EL      =  ctypes.CDLL('librtcom-eventlogger.so.1')
    OSSO_OBJ      =  OSSO_EL.rtcom_el_new()
    OSSO_EL.rtcom_el_delete_event(OSSO_OBJ,int(id),None)

it's not work too.

I don't why? every body can help me?

binkcn 2011-12-02 07:30

Re: Help me. about use python delete sms.
 
I don't why?
Change:
I don't know why?


this forum can't edit thread?

binkcn 2011-12-02 09:55

Re: Help me. about use python delete sms.
 
oh. ****. no reply.....

nicolai 2011-12-02 11:00

Re: Help me. about use python delete sms.
 
Both ways should work, but
the direct sqlite3 commands only changes the database and
the conversation app (appname rtcom-messaging-ui) didn't
get notified about the database change.

A cleaner way is to use the conversation backend rtcom-eventlogger.
Every change through this interface notifies any listeners (like
the rtcom-messaging-ui).

The below code deletes an event with event_id 3332. As it
uses rtcom-eventlogger api, the conversation
app should be notified and don't list the message with this
id anymore.

Code:

import glib
import gobject
import ctypes
import osso
osso_context = osso.Context("test_rtcom", "0.1")
rtcom_el_lib = ctypes.CDLL("librtcom-eventlogger.so.1")
rtcom_el_obj = rtcom_el_lib.rtcom_el_new()
rtcom_el_lib.rtcom_el_delete_event(rtcom_el_obj, int(3332), None)



All times are GMT. The time now is 10:02.

vBulletin® Version 3.8.8