2019-06-22 21:16:12 +00:00
|
|
|
import sqlite3
|
|
|
|
import onionrevents as events
|
2019-06-23 17:41:07 +00:00
|
|
|
from onionrutils import stringvalidators
|
|
|
|
|
2019-06-22 21:16:12 +00:00
|
|
|
def remove_address(core_inst, address):
|
|
|
|
'''
|
|
|
|
Remove an address from the address database
|
|
|
|
'''
|
|
|
|
|
2019-06-23 17:41:07 +00:00
|
|
|
if stringvalidators.validate_transport(address):
|
2019-06-22 21:16:12 +00:00
|
|
|
conn = sqlite3.connect(core_inst.addressDB, timeout=30)
|
|
|
|
c = conn.cursor()
|
|
|
|
t = (address,)
|
|
|
|
c.execute('Delete from adders where address=?;', t)
|
|
|
|
conn.commit()
|
|
|
|
conn.close()
|
|
|
|
|
|
|
|
events.event('address_remove', data = {'address': address}, onionr = core_inst.onionrInst)
|
|
|
|
return True
|
|
|
|
else:
|
|
|
|
return False
|