]> code.delx.au - pymsnt/blobdiff - src/housekeep.py
Major changes. Moved everything away from twistd and .tac files. Its nicer this way...
[pymsnt] / src / housekeep.py
index c3ed1defd6420bbc95543f8901e159b68fc2f3de..d6399aba777ee514c51e8f1a8365353701482470 100644 (file)
@@ -1,13 +1,11 @@
 # Copyright 2005 James Bunton <james@delx.cjb.net>
 # Licensed for distribution under the GPL version 2, check COPYING for details
 
+import tlib.xmlw
+
 import utils
 import config
 import xdb
-if(utils.checkTwisted()):
-       from twisted.words.protocols.jabber import jid
-else:
-       from tlib.jabber import jid
 
 import shutil
 import os
@@ -40,10 +38,11 @@ class NotesToMyself:
                        f = open(self.filename, "r")
                        self.notes = [x.strip() for x in f.readlines()]
                        f.close()
-               elif not os.path.exists(pre):
+               else:
+                       if not os.path.exists(pre):
+                               os.makedirs(pre)
                        global noteList
                        self.notes = noteList
-                       os.makedirs(pre)
        
        def check(self, note):
                return self.notes.count(note) == 0
@@ -68,7 +67,7 @@ def doSpoolPrepCheck():
        for file in os.listdir(pre):
                try:
                        file = xdb.unmangle(file).decode("utf-8")
-                       filej = jid.JID(file).full()
+                       filej = xmlw.jid.intern(file).full()
                        if(file != filej):
                                file = xdb.mangle(file)
                                filej = xdb.mangle(filej)