]> code.delx.au - pymsnt/blobdiff - src/housekeep.py
Fixed groupchatTimeout
[pymsnt] / src / housekeep.py
index d6399aba777ee514c51e8f1a8365353701482470..00f83bd7b057d7b197f3060521a3edf8a23aab72 100644 (file)
@@ -1,7 +1,7 @@
 # Copyright 2005 James Bunton <james@delx.cjb.net>
 # Licensed for distribution under the GPL version 2, check COPYING for details
 
-import tlib.xmlw
+from tlib import xmlw
 
 import utils
 import config
@@ -12,6 +12,8 @@ import os
 import os.path
 
 
+X = os.path.sep
+
 def init():
        global noteList
        global noteListF
@@ -30,8 +32,8 @@ def init():
 
 class NotesToMyself:
        def __init__(self):
-               pre = os.path.abspath(config.spooldir) + "/" + config.jid + "/"
-               self.filename = pre + "/notes_to_myself"
+               pre = os.path.abspath(config.spooldir) + X + config.jid + X
+               self.filename = pre + X + "notes_to_myself"
                self.notes = []
                
                if os.path.exists(self.filename):
@@ -60,7 +62,7 @@ class NotesToMyself:
 
 
 def doSpoolPrepCheck():
-       pre = os.path.abspath(config.spooldir) + "/" + config.jid + "/"
+       pre = os.path.abspath(config.spooldir) + X + config.jid + X
 
        print "Checking spool files and stringprepping any if necessary...",
 
@@ -86,12 +88,12 @@ def doHashDirUpgrade():
        print "Upgrading your XDB structure to use hashed directories for speed...",
 
        # Do avatars...
-       pre = os.path.abspath(config.spooldir) + "/" + config.jid + "/avatars/"
+       pre = os.path.join(os.path.abspath(config.spooldir), config.jid) + X + "avatars" + X
        if os.path.exists(pre):
                for file in os.listdir(pre):
                        try:
                                if os.path.isfile(pre + file):
-                                       pre2 = pre + file[0:3] + "/"
+                                       pre2 = pre + file[0:3] + X
                                        if not os.path.exists(pre2):
                                                os.makedirs(pre2)
                                        shutil.move(pre + file, pre2 + file)
@@ -100,13 +102,13 @@ def doHashDirUpgrade():
                                raise
        
        # Do spool files...
-       pre = os.path.abspath(config.spooldir) + "/" + config.jid + "/"
+       pre = os.path.join(os.path.abspath(config.spooldir), config.jid) + X
        if os.path.exists(pre):
                for file in os.listdir(pre):
                        try:
                                if os.path.isfile(pre + file) and file != "notes_to_myself":
                                        hash = file[0:2]
-                                       pre2 = pre + hash + "/"
+                                       pre2 = pre + hash + X
                                        if not os.path.exists(pre2):
                                                os.makedirs(pre2)