2019-06-26 06:34:34 +00:00
|
|
|
'''
|
|
|
|
Onionr - Private P2P Communication
|
|
|
|
|
|
|
|
Remove a transport address but don't ban them
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
'''
|
2019-06-22 21:16:12 +00:00
|
|
|
import sqlite3
|
2019-09-21 22:45:46 +00:00
|
|
|
from onionrplugins import onionrevents as events
|
2019-06-23 17:41:07 +00:00
|
|
|
from onionrutils import stringvalidators
|
2019-10-14 00:56:14 +00:00
|
|
|
from onionrutils import mnemonickeys
|
2019-07-18 23:07:18 +00:00
|
|
|
from .. import dbfiles
|
2019-10-29 05:36:56 +00:00
|
|
|
from etc import onionrvalues
|
2019-10-14 00:56:14 +00:00
|
|
|
|
2019-06-22 21:16:12 +00:00
|
|
|
|
2019-10-14 00:56:14 +00:00
|
|
|
|
|
|
|
def remove_user(pubkey: str)->bool:
|
|
|
|
'''
|
|
|
|
Remove a user from the user database
|
|
|
|
'''
|
|
|
|
pubkey = mnemonickeys.get_base32(pubkey)
|
|
|
|
if stringvalidators.validate_pub_key(pubkey):
|
2019-10-29 05:36:56 +00:00
|
|
|
conn = sqlite3.connect(dbfiles.user_id_info_db, timeout=onionrvalues.DATABASE_LOCK_TIMEOUT)
|
2019-10-14 00:56:14 +00:00
|
|
|
c = conn.cursor()
|
|
|
|
t = (pubkey,)
|
|
|
|
c.execute('Delete from peers where id=?;', t)
|
|
|
|
conn.commit()
|
|
|
|
conn.close()
|
|
|
|
|
|
|
|
return True
|
|
|
|
else:
|
|
|
|
return False
|