Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/model/Owner.py
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-03-09 15:18:23 (GMT)
committer Dan Williams <dcbw@redhat.com>2007-03-09 15:18:23 (GMT)
commit723bd21e776bc19e136aaca0ffdbbdb8c1d2ca3f (patch)
tree835bcba550c09c36ffb372608fe7d9e95cdf9e0a /shell/model/Owner.py
parent8dc201bc5f166a84a50535252d35e8f9586813e4 (diff)
Require jpeg format buddy icon
Since the intro screen ensures that a buddy icon exists and is in jpg format, we can simplify the buddy icon code in the ShellOwner object.
Diffstat (limited to 'shell/model/Owner.py')
-rw-r--r--shell/model/Owner.py29
1 files changed, 14 insertions, 15 deletions
diff --git a/shell/model/Owner.py b/shell/model/Owner.py
index 760697a..3d5b333 100644
--- a/shell/model/Owner.py
+++ b/shell/model/Owner.py
@@ -50,24 +50,23 @@ class ShellOwner(gobject.GObject):
gobject.GObject.__init__(self)
self._nick = profile.get_nick_name()
- user_dir = env.get_profile_path()
self._icon = None
self._icon_hash = ""
- for fname in os.listdir(user_dir):
- if not fname.startswith("buddy-icon."):
- continue
- fd = open(os.path.join(user_dir, fname), "r")
- self._icon = fd.read()
- fd.close()
- if not self._icon:
- raise RuntimeError("No buddy icon exists")
-
- # Get the icon's hash
- import md5, binascii
- digest = md5.new(self._icon).digest()
- self._icon_hash = util.printable_hash(digest)
- break
+ icon = os.path.join(env.get_profile_path(), "buddy-icon.jpg")
+ if not os.path.exists(icon):
+ raise RuntimeError("missing buddy icon")
+
+ fd = open(icon, "r")
+ self._icon = fd.read()
+ fd.close()
+ if not self._icon:
+ raise RuntimeError("invalid buddy icon")
+
+ # Get the icon's hash
+ import md5
+ digest = md5.new(self._icon).digest()
+ self._icon_hash = util.printable_hash(digest)
self._pservice = PresenceService.get_instance()