summaryrefslogtreecommitdiffstats
path: root/py-bin
diff options
context:
space:
mode:
authoralice <alice@immerda.ch>2012-08-31 14:17:31 +0200
committeralice <alice@immerda.ch>2012-10-19 15:20:06 +0200
commitc03748ed544d6229f8d903642c926ac23fe33b8f (patch)
treed5f4ffb8f0fa807a0df15acf9625fd7cc24ae349 /py-bin
parentb1be46acc3219a3f613de9c21b89ce90e64b7867 (diff)
add/remove of jids working
Diffstat (limited to 'py-bin')
-rw-r--r--py-bin/jabberman.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/py-bin/jabberman.py b/py-bin/jabberman.py
index d199ca3..c187db4 100644
--- a/py-bin/jabberman.py
+++ b/py-bin/jabberman.py
@@ -1,6 +1,6 @@
#jabber manager
-import sqlite3, atexit, bcrypt, sha, hmac, random, os, time, re, datetime, string
+import sqlite3, atexit, bcrypt, sha, hmac, random, os, time, re, logging, datetime, string
import config
# FIXME: error handling (especially sqlite)
@@ -39,7 +39,12 @@ class WebUser:
class JabberDB:
def __init__(self):
self.__connection = sqlite3.connect(config.sqlite_path)
- atexit.register(self.__connection.close) # FIXME: test that!
+ logging.info("JabberDB init")
+ atexit.register(self.__close_db) # FIXME: test that!
+
+ def __close_db(self):
+ logging.info("closing connection")
+ self.__connection.cursor().close()
def login_user(self, user_id, password):
user = self.get_web_user(user_id)
@@ -101,7 +106,7 @@ class JabberDB:
def remove_account(self, user_id, jabber_id, check_only = False):
user = self.get_web_user(user_id)
- if (not user) or (not user.has_account(jabber_id)):
+ if (not user) or (not self.is_jid(jabber_id)):
return (False, "Zugriff verweigert.")
if check_only:
@@ -351,7 +356,6 @@ class JabberManager:
if not ok:
return (False, status)
- acc = JabberAccount(jabber_id)
try:
password = self.session["pass"]
except Exception: