Typo + Really delete unused make_groups_submenus_for_chat_with() + redraw pm tab AFTER muc contact
disconnected + fix reference before assignement TB
This commit is contained in:
parent
14187e6eee
commit
30f83fc2cb
|
@ -1,4 +1,4 @@
|
|||
#i# config.py
|
||||
## config.py
|
||||
##
|
||||
## Copyright (C) 2003-2006 Yann Le Boulanger <asterix@lagaule.org>
|
||||
## Copyright (C) 2005-2006 Nikos Kouremenos <nkour@jabber.org>
|
||||
|
|
|
@ -837,12 +837,6 @@ class Interface:
|
|||
if control:
|
||||
control.chg_contact_status(nick, show, status, array[4], array[5], array[6],
|
||||
array[7], array[8], array[9], array[10])
|
||||
# Find any PM chat through this room, and tell it to update.
|
||||
pm_control = self.msg_win_mgr.get_control(fjid, account)
|
||||
if pm_control:
|
||||
pm_control.parent_win.redraw_tab(pm_control)
|
||||
if self.remote_ctrl:
|
||||
self.remote_ctrl.raise_signal('GCPresence', (account, array))
|
||||
|
||||
# print status in chat window and update status/GPG image
|
||||
if self.msg_win_mgr.has_window(fjid, account):
|
||||
|
@ -855,6 +849,9 @@ class Interface:
|
|||
ctrl.print_conversation(_('%s is now %s (%s)') % (nick, uf_show, status),
|
||||
'status')
|
||||
ctrl.draw_banner()
|
||||
ctrl.parent_win.redraw_tab(ctrl)
|
||||
if self.remote_ctrl:
|
||||
self.remote_ctrl.raise_signal('GCPresence', (account, array))
|
||||
|
||||
|
||||
def handle_event_gc_msg(self, account, array):
|
||||
|
|
|
@ -847,6 +847,7 @@ class GroupchatControl(ChatControlBase):
|
|||
nick != self.nick and statusCode != '303':
|
||||
st = ''
|
||||
found = False
|
||||
print_status = None
|
||||
for bookmark in gajim.connections[self.account].bookmarks:
|
||||
if bookmark['jid'] == self.room_jid:
|
||||
print_status = bookmark['print_status']
|
||||
|
|
|
@ -260,90 +260,6 @@ class Systray:
|
|||
def on_quit_menuitem_activate(self, widget):
|
||||
gajim.interface.roster.on_quit_menuitem_activate(widget)
|
||||
|
||||
# XXX delete this function (no longer used)
|
||||
def make_groups_submenus_for_chat_with(self, account):
|
||||
iconset = gajim.config.get('iconset')
|
||||
if not iconset:
|
||||
iconset = 'dcraven'
|
||||
path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16')
|
||||
state_images = gajim.interface.roster.load_iconset(path)
|
||||
|
||||
groups_menu = gtk.Menu()
|
||||
sort_by_show = gajim.config.get('sort_by_show')
|
||||
# store contact infos in a table so we can easily sort by group,
|
||||
# status and lower.name
|
||||
# if we sort_by_show : contacts_table = [group, status, lowered name, jid, (real) name]
|
||||
# else : contacts_table = [group, lowered name, status, jid, (real) name]
|
||||
contacts_table = []
|
||||
show_list = list(gajim.SHOW_LIST) # copy gajim.SHOW_LIST in show_list
|
||||
# not in roster is not in this list but we need it
|
||||
show_list.append('not in roster')
|
||||
for jid in gajim.contacts.get_jid_list(account):
|
||||
contact = gajim.contacts.get_contact_with_highest_priority(account,
|
||||
jid)
|
||||
if contact.show not in ('offline', 'error'):
|
||||
if contact.show == 'not in roster':
|
||||
# show user in not in roster group
|
||||
contact_groups = [_('Not in Roster')]
|
||||
elif contact.groups == []: # user has no group, print him in General
|
||||
contact_groups = [_('General')]
|
||||
else:
|
||||
contact_groups = contact.groups
|
||||
for group in contact_groups:
|
||||
# the user can be in mutiple groups, see in all of them
|
||||
if group == _('Transports'):
|
||||
continue
|
||||
contact_name = contact.get_shown_name()
|
||||
try:
|
||||
show = show_list.index(contact.show)
|
||||
except ValueError: # unknown show
|
||||
show = 0 # offline
|
||||
if sort_by_show: # see comment about contacts_table above
|
||||
contacts_table.append ([group, show, contact_name.lower(),
|
||||
contact.jid, contact_name])
|
||||
else:
|
||||
contacts_table.append ([group, contact_name.lower(),
|
||||
show, contact.jid, contact_name])
|
||||
|
||||
# Sort : first column before, last column in the end
|
||||
# In theory we sort full table, including columns that don't need sorting,
|
||||
# but as python sort() seems intelligent the table will be ordered before we
|
||||
# sort lasts columns in most case.
|
||||
contacts_table.sort()
|
||||
|
||||
previous_group = None
|
||||
for contact_item in contacts_table:
|
||||
if sort_by_show: # see comment about contacts_table above
|
||||
contact_show = show_list[contact_item[1]]
|
||||
else:
|
||||
contact_show = show_list[contact_item[2]]
|
||||
contact_jid = contact_item[3]
|
||||
contact_name = contact_item[4]
|
||||
#we don't care about lowered name now
|
||||
if contact_item[0] != previous_group:
|
||||
# It's a new group, add the submenu
|
||||
item = gtk.MenuItem(contact_item[0])
|
||||
contacts_menu = gtk.Menu()
|
||||
self.popup_menus.append(contacts_menu)
|
||||
item.set_submenu(contacts_menu)
|
||||
groups_menu.append(item)
|
||||
previous_group = contact_item[0]
|
||||
# add contact in group submenu
|
||||
s = gtkgui_helpers.escape_underscore(contact_name)
|
||||
item_contact = gtk.ImageMenuItem(s)
|
||||
# any given gtk widget can only be used in one place
|
||||
# (here we use it in status menu too)
|
||||
# gtk.Image is a widget, it's better we refactor to use
|
||||
# gdk.gdk.Pixbuf allover
|
||||
img = state_images[contact_show]
|
||||
img_copy = gobject.new(gtk.Image, pixbuf=img.get_pixbuf())
|
||||
item_contact.set_image(img_copy)
|
||||
item_contact.connect('activate', self.start_chat, account,
|
||||
contact_jid)
|
||||
contacts_menu.append(item_contact)
|
||||
|
||||
return groups_menu
|
||||
|
||||
def on_left_click(self):
|
||||
win = gajim.interface.roster.window
|
||||
if len(self.jids) == 0:
|
||||
|
|
Loading…
Reference in New Issue