-# Copyright 2005 James Bunton <james@delx.cjb.net>
+# Copyright 2005-2006 James Bunton <james@delx.cjb.net>
# Licensed for distribution under the GPL version 2, check COPYING for details
from debug import LogEvent, INFO, WARN, ERROR
from twisted.internet import reactor
-from tlib.xmlw import Element
+from twisted.words.xish.domish import Element
import sha, base64, os, os.path
cType = photo.addElement("TYPE")
cType.addContent("image/png")
binval = photo.addElement("BINVAL")
- binval.addContent(base64.encodestring(self.getImageData()))
+ binval.addContent(base64.encodestring(self.getImageData()).replace("\n", ""))
return photo
def makeDataElement(self):
""" Returns an XML Element that can be put into a jabber:x:avatar IQ stanza. """
data = Element((None, "data"))
data["mimetype"] = "image/png"
- data.addContent(base64.encodestring(self.getImageData()))
+ data.addContent(base64.encodestring(self.getImageData()).replace("\n", ""))
return data
def __eq__(self, other):
""" Returns the full path to the directory that a
particular key is in. Creates that directory if it doesn't already exist. """
X = os.path.sep
- d = os.path.os.path.abspath(config.spooldir) + X + config.jid + X + "avatars" + X + key[0:3] + X
+ d = os.path.os.path.abspath(config.spooldir) + X + "avatars" + X + key[0:3] + X
if not os.path.exists(d):
os.makedirs(d)
return d