Categories: Python | S60 | Code Examples | How To | Messaging | SMS
This page was last modified 22:59, 7 July 2008.
How to set/unset read sms status
From Forum Nokia Wiki
We can set or unset the status of message in the new PyS60 1.4.4. Below code shows how to do that.
# Copyright (c) 2008 Nokia Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: Sets/Get the status(1=unread, 0=read) of SMS. import inbox, appuifw, e32 inb = inbox.Inbox() sms_ids = inb.sms_messages() msgs = [] msg_unread = [] msg_read = [] for id in sms_ids: msgs.append(inb.content(id)) def setreadunread(message, status): global msgs i = 0 for msg in msgs: if message == msg: if status == 1: inb.set_unread(sms_ids[i],1) else: inb.set_unread(sms_ids[i],0) i = i+1 def get_readandunreadmessages_inlist(): global msg_unread global msg_read msg_unread = [] msg_read = [] for id in sms_ids: if inb.unread(id): msg_unread.append(inb.content(id)) else: msg_read.append(inb.content(id)) def setmessageunread(): global msg_read get_readandunreadmessages_inlist() index = appuifw.selection_list(msg_read, 1) if index != None and index >= 0: print index setreadunread(msg_read[index], 1) print "Done" def setmessageread(): global msg_unread get_readandunreadmessages_inlist() index = appuifw.selection_list(msg_unread, 1) if index != None and index >= 0: print index setreadunread(msg_unread[index], 0) print "Done" def showmessagestatus(): global sms_ids for id in sms_ids: print inb.content(id)[:20] print inb.unread(id) def quit(): app_lock.signal() appuifw.app.exit_key_handler = quit appuifw.app.menu = [(u"Mark_read", setmessageread), (u"Mark_unread", setmessageunread), (u"Show_read/unread_status", showmessagestatus)] app_lock = e32.Ao_lock() app_lock.wait()
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to read incoming sms, its going by default in handset inbox, how do i get sms.... | patil_mayur | Mobile Java General | 4 | 2008-04-09 08:33 |
| USSD alphabet error | Cyrilou | General Symbian C++ | 2 | 2004-02-28 21:39 |
| Cookies (OTA) and MIDlets in S60 emulator | Sinonim | Browsing and Mark-ups | 1 | 2007-11-26 23:35 |
| Setting flag "Read Only" distort the SMS | igl | General Symbian C++ | 0 | 2004-08-15 23:31 |
| How to get successfule status of the sent message? | anand_zain76 | Symbian Networking & Messaging | 1 | 2008-03-27 15:28 |
