* further splitting onionrutils into a module
This commit is contained in:
parent
0d258e1a16
commit
d378340099
31 changed files with 234 additions and 199 deletions
|
@ -1,5 +1,7 @@
|
|||
import sqlite3, os
|
||||
import onionrevents as events
|
||||
from onionrutils import localcommand
|
||||
|
||||
def daemon_queue(core_inst):
|
||||
'''
|
||||
Gives commands to the communication proccess/daemon by reading an sqlite3 database
|
||||
|
@ -55,7 +57,7 @@ def daemon_queue_get_response(core_inst, responseID=''):
|
|||
Get a response sent by communicator to the API, by requesting to the API
|
||||
'''
|
||||
assert len(responseID) > 0
|
||||
resp = core_inst._utils.localCommand('queueResponse/' + responseID)
|
||||
resp = localcommand.local_command(core_inst, 'queueResponse/' + responseID)
|
||||
return resp
|
||||
|
||||
def clear_daemon_queue(core_inst):
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import sqlite3
|
||||
import onionrevents as events, config
|
||||
import onionrevents as events
|
||||
from onionrutils import stringvalidators
|
||||
|
||||
def add_peer(core_inst, peerID, name=''):
|
||||
'''
|
||||
Adds a public key to the key database (misleading function name)
|
||||
|
@ -40,8 +42,8 @@ def add_address(core_inst, address):
|
|||
|
||||
if type(address) is None or len(address) == 0:
|
||||
return False
|
||||
if core_inst._utils.validateID(address):
|
||||
if address == config.get('i2p.ownAddr', None) or address == core_inst.hsAddress:
|
||||
if stringvalidators.validate_transport(address):
|
||||
if address == core_inst.config.get('i2p.ownAddr', None) or address == core_inst.hsAddress:
|
||||
return False
|
||||
conn = sqlite3.connect(core_inst.addressDB, timeout=30)
|
||||
c = conn.cursor()
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
import sqlite3
|
||||
import onionrevents as events
|
||||
from onionrutils import stringvalidators
|
||||
|
||||
def remove_address(core_inst, address):
|
||||
'''
|
||||
Remove an address from the address database
|
||||
'''
|
||||
|
||||
if core_inst._utils.validateID(address):
|
||||
if stringvalidators.validate_transport(address):
|
||||
conn = sqlite3.connect(core_inst.addressDB, timeout=30)
|
||||
c = conn.cursor()
|
||||
t = (address,)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue