From 28161dc33c2d0f0da693d37baea6980013d6ee2e Mon Sep 17 00:00:00 2001 From: Stephan Erb Date: Sun, 15 Nov 2009 22:59:43 +0100 Subject: [PATCH] Apply coding standards. --- src/common/pep.py | 33 ++++++++++++++------------------- src/roster_window.py | 3 +-- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/common/pep.py b/src/common/pep.py index 18a27364a..e0394ce61 100644 --- a/src/common/pep.py +++ b/src/common/pep.py @@ -475,11 +475,12 @@ class ConnectionPEP: self.dispatch('PEP_RECEIVED', (jid, pep.type)) items = event_tag.getTag('items') - if items is None: return + if items is None: + return for item in items.getTags('item'): entry = item.getTag('entry') - if entry is not None: + if entry: # for each entry in feed (there shouldn't be more than one, # but to be sure... self.dispatch('ATOM_ENTRY', (atom.OldEntry(node=entry),)) @@ -493,9 +494,9 @@ def user_send_mood(account, mood, message=''): if not common.gajim.connections[account].pep_supported: return item = xmpp.Node('mood', {'xmlns': xmpp.NS_MOOD}) - if mood != '': + if mood: item.addChild(mood) - if message != '': + if message: i = item.addChild('text') i.addData(message) @@ -506,11 +507,11 @@ def user_send_activity(account, activity, subactivity='', message=''): if not common.gajim.connections[account].pep_supported: return item = xmpp.Node('activity', {'xmlns': xmpp.NS_ACTIVITY}) - if activity != '': + if activity: i = item.addChild(activity) - if subactivity != '': + if subactivity: i.addChild(subactivity) - if message != '': + if message: i = item.addChild('text') i.addData(message) @@ -523,22 +524,22 @@ items=None): common.gajim.connections[account].pep_supported): return item = xmpp.Node('tune', {'xmlns': xmpp.NS_TUNE}) - if artist != '': + if artist: i = item.addChild('artist') i.addData(artist) - if title != '': + if title: i = item.addChild('title') i.addData(title) - if source != '': + if source: i = item.addChild('source') i.addData(source) - if track != 0: + if track: i = item.addChild('track') i.addData(track) - if length != 0: + if length: i = item.addChild('length') i.addData(length) - if items is not None: + if items: item.addChild(payload=items) common.gajim.connections[account].send_pb_publish('', xmpp.NS_TUNE, item, @@ -570,20 +571,14 @@ def delete_pep(jid, name): if jid == common.gajim.get_jid_from_account(name): acc = common.gajim.connections[name] - del acc.activity acc.activity = {} user_send_tune(name) - del acc.tune acc.tune = {} - del acc.mood acc.mood = {} for contact in common.gajim.contacts.get_contacts(name, user): - del contact.activity contact.activity = {} - del contact.tune contact.tune = {} - del contact.mood contact.mood = {} if jid == common.gajim.get_jid_from_account(name): diff --git a/src/roster_window.py b/src/roster_window.py index e425c9cb3..046684b57 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -1934,8 +1934,7 @@ class RosterWindow: gajim.connections[account].send_custom_status(status, txt, to) else: if status in ('invisible', 'offline'): - pep.delete_pep(gajim.get_jid_from_account(account), \ - account) + pep.delete_pep(gajim.get_jid_from_account(account), account) was_invisible = gajim.connections[account].connected == \ gajim.SHOW_LIST.index('invisible') gajim.connections[account].change_status(status, txt, auto)