use of in: code is cleaner

This commit is contained in:
Nikos Kouremenos 2005-07-23 15:23:45 +00:00
parent 9550e80220
commit 3722402bbc
1 changed files with 10 additions and 10 deletions

View File

@ -97,8 +97,7 @@ class RosterWindow:
tls_pixbuf = None tls_pixbuf = None
if gajim.con_types.has_key(account) and \ if gajim.con_types.has_key(account) and \
(gajim.con_types[account] == 'tls' or \ gajim.con_types[account] in ('tls', 'ssl'):
gajim.con_types[account] == 'ssl'):
tls_pixbuf = self.window.render_icon(gtk.STOCK_DIALOG_AUTHENTICATION, tls_pixbuf = self.window.render_icon(gtk.STOCK_DIALOG_AUTHENTICATION,
gtk.ICON_SIZE_MENU) # the only way to create a pixbuf from stock gtk.ICON_SIZE_MENU) # the only way to create a pixbuf from stock
@ -122,7 +121,7 @@ class RosterWindow:
elif user.groups == []: elif user.groups == []:
user.groups.append(_('General')) user.groups.append(_('General'))
if (user.show == 'offline' or user.show == 'error') and \ if user.show in ('offline', 'error') and \
not showOffline and (not _('Transports') in user.groups or \ not showOffline and (not _('Transports') in user.groups or \
gajim.connections[account].connected < 2) and \ gajim.connections[account].connected < 2) and \
not gajim.awaiting_messages[account].has_key(user.jid): not gajim.awaiting_messages[account].has_key(user.jid):
@ -428,7 +427,8 @@ class RosterWindow:
continue continue
item = gtk.MenuItem(_('using %s account') % account) item = gtk.MenuItem(_('using %s account') % account)
sub_menu.append(item) sub_menu.append(item)
item.connect('activate', self.on_service_disco_menuitem_activate, account) item.connect('activate', self.on_service_disco_menuitem_activate,
account)
sub_menu.show_all() sub_menu.show_all()
#new message #new message
@ -599,7 +599,7 @@ class RosterWindow:
contact_instances = gajim.contacts[account][contact.jid] contact_instances = gajim.contacts[account][contact.jid]
contact.show = show contact.show = show
contact.status = status contact.status = status
if (show == 'offline' or show == 'error') and \ if show in ('offline', 'error') and \
not gajim.awaiting_messages[account].has_key(contact.jid): not gajim.awaiting_messages[account].has_key(contact.jid):
if len(contact_instances) > 1: # if multiple resources if len(contact_instances) > 1: # if multiple resources
contact_instances.remove(contact) contact_instances.remove(contact)
@ -878,7 +878,7 @@ class RosterWindow:
icon = gtk.image_new_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_MENU) icon = gtk.image_new_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_MENU)
item.set_image(icon) item.set_image(icon)
menu.append(item) menu.append(item)
if show == 'offline' or show == 'error': if show in ('offline', 'error'):
item.set_sensitive(False) item.set_sensitive(False)
item.connect('activate', self.on_agent_logging, jid, 'unavailable', item.connect('activate', self.on_agent_logging, jid, 'unavailable',
account) account)
@ -1042,7 +1042,7 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
if not iter: if not iter:
return return
type = model[iter][2] type = model[iter][2]
if type == 'contact' or type == 'group': if type in ('contact', 'group'):
path = model.get_path(iter) path = model.get_path(iter)
self.on_rename(widget, iter, path) self.on_rename(widget, iter, path)
@ -1113,7 +1113,7 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
model = self.tree.get_model() model = self.tree.get_model()
iter = model.get_iter(path) iter = model.get_iter(path)
type = model[iter][2] type = model[iter][2]
if type == 'agent' or type == 'contact': if type in ('agent', 'contact'):
account = model[iter][4] account = model[iter][4]
jid = model[iter][3] jid = model[iter][3]
if self.plugin.windows[account]['chats'].has_key(jid): if self.plugin.windows[account]['chats'].has_key(jid):
@ -1577,7 +1577,7 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
account = model[iter][4] account = model[iter][4]
type = model[iter][2] type = model[iter][2]
jid = model[iter][3] jid = model[iter][3]
if type == 'group' or type == 'account': if type in ('group', 'account'):
if self.tree.row_expanded(path): if self.tree.row_expanded(path):
self.tree.collapse_row(path) self.tree.collapse_row(path)
else: else:
@ -1691,7 +1691,7 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
elif type == 'group': elif type == 'group':
old_name = model[iter][1] old_name = model[iter][1]
# Groups maynot change name from or to 'not in the roster' # Groups maynot change name from or to 'not in the roster'
if _('not in the roster') in [new_text, old_name]: if _('not in the roster') in (new_text, old_name):
return return
#get all users in that group #get all users in that group
for jid in gajim.contacts[account]: for jid in gajim.contacts[account]: