Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # s60_block_caller_ultra.py
- # To very much block blacklisted callers from also leaving a voice
- # message, this app will instantly hang up upon answering therefore
- # prevent occupying the limited allotment.
- import appuifw,e32,telephone,time,messaging,contacts,re
- regex = r'''\+?[0-9]{7,10}'''
- def quit(): app_lock.signal()
- appuifw.app.exit_key_handler = quit
- app_lock=e32.Ao_lock()
- cDB = contacts.open()
- entry = cDB.find('ZZZZZZ block') ###
- blacklist = entry[0].find()
- blacklist = str(blacklist)
- blacklist = re.findall(regex, blacklist)
- blacklist = list(set(blacklist))
- def stateChange((callState, number)):
- print "%d:%02d" % time.localtime()[3:5],"callState",callState
- if callState == telephone.EStatusRinging:
- if number == "":
- print "Unknown Number"
- return
- else:
- print "Call From "+number
- if number in blacklist:
- telephone.incoming_call()
- while 1:
- try:
- telephone.answer()
- break
- except:
- pass
- while 1:
- try:
- telephone.hangup()
- break
- except:
- pass
- telephone.call_state(stateChange)
- print 's60 Block Caller Ultra *** Commenced...'
- app_lock.wait()
- print "*** Exited."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement