allsms.py

来自「python s60 1.4.5版本的源代码」· Python 代码 · 共 52 行

PY
52
字号
#
# allsms.py
#
# Copyright (c) 2006 - 2007 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.
#

import logs
import contacts
#
print "getting SMS logs. be patient..."
evlist = logs.sms(mode='in')
evlist.extend(logs.sms(mode='out'))

#print evlist

#
db = contacts.open()
#
for d in evlist:
    if len(d) > 0:
        print '%s %s' %(d['description'], d['direction'])
        
        if len(d['name']) < 1:
            persons=db.find(d['number'])
            if len(persons) > 0:
                fnames = persons[0].find('first_name')
                lname  = persons[0].find('last_name')
                if len(fnames)>0 and len(lname)>0:
                    full_name = lname[0].value +' '+fnames[0].value
                    print '%s %s'%(d['number'],full_name)
                else:
                    print '%s N/A'%d['number']
            else:
                print '%s N/A'%d['number']
        else:
            print '%s %s'%(d['number'],d['name'])
#

print "done ..."

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?