Trying to fix PM regression since merge
This commit is contained in:
parent
bafcaace1e
commit
e53e786182
8
Makefile
8
Makefile
|
@ -155,5 +155,11 @@ tags:
|
||||||
-rm tags
|
-rm tags
|
||||||
exuberant-ctags -R
|
exuberant-ctags -R
|
||||||
|
|
||||||
|
sloccount:
|
||||||
|
if test -n "`which sloccount`"; then\
|
||||||
|
sloccount ./src;\
|
||||||
|
sloccount --cached --details ./src;\
|
||||||
|
fi
|
||||||
|
|
||||||
.PHONY: all translation trayicon gtkspell idle clean dist install help\
|
.PHONY: all translation trayicon gtkspell idle clean dist install help\
|
||||||
uninstall tags
|
uninstall tags sloccount
|
||||||
|
|
|
@ -744,9 +744,8 @@ class ChatControl(ChatControlBase):
|
||||||
ChatControlBase.draw_widgets(self)
|
ChatControlBase.draw_widgets(self)
|
||||||
|
|
||||||
def _update_banner_state_image(self):
|
def _update_banner_state_image(self):
|
||||||
# FIXME: The cyling of contact_list ... is this necessary if I have the contact
|
contact = gajim.contacts.get_contact_with_highest_priority(self.account,
|
||||||
# This will need to be triumphant when sending directly to a resource
|
self.contact.jid)
|
||||||
contact = self.contact
|
|
||||||
show = contact.show
|
show = contact.show
|
||||||
jid = contact.jid
|
jid = contact.jid
|
||||||
|
|
||||||
|
@ -1030,7 +1029,9 @@ class ChatControl(ChatControlBase):
|
||||||
if num_unread and gajim.config.get('show_unread_tab_icon'):
|
if num_unread and gajim.config.get('show_unread_tab_icon'):
|
||||||
tab_img = img_16['message']
|
tab_img = img_16['message']
|
||||||
else:
|
else:
|
||||||
tab_img = img_16[self.contact.show]
|
contact = gajim.contacts.get_contact_with_highest_priority(self.account,
|
||||||
|
self.contact.jid)
|
||||||
|
tab_img = img_16[contact.show]
|
||||||
|
|
||||||
return tab_img
|
return tab_img
|
||||||
|
|
||||||
|
@ -1407,7 +1408,6 @@ class ChatControl(ChatControlBase):
|
||||||
gajim.interface.roster.on_info(widget, self.contact, self.account)
|
gajim.interface.roster.on_info(widget, self.contact, self.account)
|
||||||
|
|
||||||
def on_toggle_gpg_menuitem_activate(self, widget):
|
def on_toggle_gpg_menuitem_activate(self, widget):
|
||||||
print "toggling"
|
|
||||||
jid = self.get_active_jid()
|
jid = self.get_active_jid()
|
||||||
tb = self.xml.get_widget('gpg_togglebutton')
|
tb = self.xml.get_widget('gpg_togglebutton')
|
||||||
tb.set_active(not tb.get_active())
|
tb.set_active(not tb.get_active())
|
||||||
|
|
|
@ -99,6 +99,7 @@ class Contacts:
|
||||||
def create_contact(self, jid='', name='', groups=[], show='', status='',
|
def create_contact(self, jid='', name='', groups=[], show='', status='',
|
||||||
sub='', ask='', resource='', priority=5, keyID='', our_chatstate=None,
|
sub='', ask='', resource='', priority=5, keyID='', our_chatstate=None,
|
||||||
chatstate=None):
|
chatstate=None):
|
||||||
|
print "Creating contact:", jid
|
||||||
return Contact(jid, name, groups, show, status, sub, ask, resource,
|
return Contact(jid, name, groups, show, status, sub, ask, resource,
|
||||||
priority, keyID, our_chatstate, chatstate)
|
priority, keyID, our_chatstate, chatstate)
|
||||||
|
|
||||||
|
@ -110,6 +111,7 @@ class Contacts:
|
||||||
our_chatstate = contact.our_chatstate, chatstate = contact.chatstate)
|
our_chatstate = contact.our_chatstate, chatstate = contact.chatstate)
|
||||||
|
|
||||||
def add_contact(self, account, contact):
|
def add_contact(self, account, contact):
|
||||||
|
print "Adding contact:", contact.jid
|
||||||
# No such account before ?
|
# No such account before ?
|
||||||
if not self._contacts.has_key(account):
|
if not self._contacts.has_key(account):
|
||||||
self._contacts[account] = {contact.jid : [contact]}
|
self._contacts[account] = {contact.jid : [contact]}
|
||||||
|
@ -130,6 +132,7 @@ class Contacts:
|
||||||
contacts.append(contact)
|
contacts.append(contact)
|
||||||
|
|
||||||
def remove_contact(self, account, contact):
|
def remove_contact(self, account, contact):
|
||||||
|
print "Removing contact:", contact.jid
|
||||||
if not self._contacts.has_key(account):
|
if not self._contacts.has_key(account):
|
||||||
return
|
return
|
||||||
if not self._contacts[account].has_key(contact.jid):
|
if not self._contacts[account].has_key(contact.jid):
|
||||||
|
@ -138,6 +141,7 @@ class Contacts:
|
||||||
self._contacts[account][contact.jid].remove(contact)
|
self._contacts[account][contact.jid].remove(contact)
|
||||||
|
|
||||||
def remove_jid(self, account, jid):
|
def remove_jid(self, account, jid):
|
||||||
|
print "Adding jid:", jid
|
||||||
'''Removes all contacts for a given jid'''
|
'''Removes all contacts for a given jid'''
|
||||||
if not self._contacts.has_key(account):
|
if not self._contacts.has_key(account):
|
||||||
return
|
return
|
||||||
|
@ -165,7 +169,7 @@ class Contacts:
|
||||||
|
|
||||||
def get_contacts_from_jid(self, account, jid):
|
def get_contacts_from_jid(self, account, jid):
|
||||||
''' we may have two or more resources on that jid '''
|
''' we may have two or more resources on that jid '''
|
||||||
if jid in self._contacts[account]:
|
if jid in self._contacts[account].keys():
|
||||||
contacts_instances = self._contacts[account][jid]
|
contacts_instances = self._contacts[account][jid]
|
||||||
return contacts_instances
|
return contacts_instances
|
||||||
return []
|
return []
|
||||||
|
@ -175,12 +179,14 @@ class Contacts:
|
||||||
return None
|
return None
|
||||||
prim_contact = contacts[0]
|
prim_contact = contacts[0]
|
||||||
for contact in contacts[1:]:
|
for contact in contacts[1:]:
|
||||||
|
print "checking priority of", contact.jid
|
||||||
if int(contact.priority) > int(prim_contact.priority):
|
if int(contact.priority) > int(prim_contact.priority):
|
||||||
prim_contact = contact
|
prim_contact = contact
|
||||||
return prim_contact
|
return prim_contact
|
||||||
|
|
||||||
def get_contact_with_highest_priority(self, account, jid):
|
def get_contact_with_highest_priority(self, account, jid):
|
||||||
contacts = self.get_contacts_from_jid(account, jid)
|
contacts = self.get_contacts_from_jid(account, jid)
|
||||||
|
print "contacts:", contacts
|
||||||
return self.get_highest_prio_contact_from_contacts(contacts)
|
return self.get_highest_prio_contact_from_contacts(contacts)
|
||||||
|
|
||||||
def get_first_contact_from_jid(self, account, jid):
|
def get_first_contact_from_jid(self, account, jid):
|
||||||
|
@ -235,10 +241,12 @@ class Contacts:
|
||||||
|
|
||||||
def create_gc_contact(self, room_jid='', name='', show='', status='',
|
def create_gc_contact(self, room_jid='', name='', show='', status='',
|
||||||
role='', affiliation='', jid='', resource=''):
|
role='', affiliation='', jid='', resource=''):
|
||||||
|
print "Creating GC contact:", room_jid, jid
|
||||||
return GC_Contact(room_jid, name, show, status, role, affiliation, jid,
|
return GC_Contact(room_jid, name, show, status, role, affiliation, jid,
|
||||||
resource)
|
resource)
|
||||||
|
|
||||||
def add_gc_contact(self, account, gc_contact):
|
def add_gc_contact(self, account, gc_contact):
|
||||||
|
print "Adding GC contact:", gc_contact.room_jid
|
||||||
# No such account before ?
|
# No such account before ?
|
||||||
if not self._gc_contacts.has_key(account):
|
if not self._gc_contacts.has_key(account):
|
||||||
self._contacts[account] = {gc_contact.room_jid : {gc_contact.name: \
|
self._contacts[account] = {gc_contact.room_jid : {gc_contact.name: \
|
||||||
|
@ -253,6 +261,7 @@ class Contacts:
|
||||||
gc_contact
|
gc_contact
|
||||||
|
|
||||||
def remove_gc_contact(self, account, gc_contact):
|
def remove_gc_contact(self, account, gc_contact):
|
||||||
|
print "Adding GC contact:", gc_contact.room_jid
|
||||||
if not self._gc_contacts.has_key(account):
|
if not self._gc_contacts.has_key(account):
|
||||||
return
|
return
|
||||||
if not self._gc_contacts[account].has_key(gc_contact.room_jid):
|
if not self._gc_contacts[account].has_key(gc_contact.room_jid):
|
||||||
|
@ -266,6 +275,7 @@ class Contacts:
|
||||||
del self._gc_contacts[account][gc_contact.room_jid]
|
del self._gc_contacts[account][gc_contact.room_jid]
|
||||||
|
|
||||||
def remove_room(self, account, room_jid):
|
def remove_room(self, account, room_jid):
|
||||||
|
print "Removing room:", room_jid
|
||||||
if not self._gc_contacts.has_key(account):
|
if not self._gc_contacts.has_key(account):
|
||||||
return
|
return
|
||||||
if not self._gc_contacts[account].has_key(room_jid):
|
if not self._gc_contacts[account].has_key(room_jid):
|
||||||
|
|
|
@ -560,7 +560,6 @@ class GroupchatControl(ChatControlBase):
|
||||||
def draw_roster(self):
|
def draw_roster(self):
|
||||||
model = self.list_treeview.get_model()
|
model = self.list_treeview.get_model()
|
||||||
model.clear()
|
model.clear()
|
||||||
print "draw_roster"
|
|
||||||
for nick in gajim.contacts.get_nick_list(self.account, self.room_jid):
|
for nick in gajim.contacts.get_nick_list(self.account, self.room_jid):
|
||||||
gc_contact = gajim.contacts.get_gc_contact(self.account, self.room_jid, nick)
|
gc_contact = gajim.contacts.get_gc_contact(self.account, self.room_jid, nick)
|
||||||
self.add_contact_to_roster(nick, gc_contact.show, gc_contact.role,
|
self.add_contact_to_roster(nick, gc_contact.show, gc_contact.role,
|
||||||
|
|
|
@ -381,9 +381,9 @@ class MessageWindow:
|
||||||
def popup_menu(self, event):
|
def popup_menu(self, event):
|
||||||
menu = self.get_active_control().prepare_context_menu()
|
menu = self.get_active_control().prepare_context_menu()
|
||||||
# common menuitems (tab switches)
|
# common menuitems (tab switches)
|
||||||
if len(self.controls) > 1: # if there is more than one tab
|
if len(self._controls) > 1: # if there is more than one tab
|
||||||
menu.append(gtk.SeparatorMenuItem()) # seperator
|
menu.append(gtk.SeparatorMenuItem()) # seperator
|
||||||
for ctl in self.controls.values():
|
for ctl in self._controls.values():
|
||||||
jid = ctl.contact.jid
|
jid = ctl.contact.jid
|
||||||
if jid != self.get_active_jid():
|
if jid != self.get_active_jid():
|
||||||
item = gtk.ImageMenuItem(_('Switch to %s') %\
|
item = gtk.ImageMenuItem(_('Switch to %s') %\
|
||||||
|
|
|
@ -169,9 +169,9 @@ class RosterWindow:
|
||||||
if hide:
|
if hide:
|
||||||
return
|
return
|
||||||
if contact.show in ('offline', 'error') and \
|
if contact.show in ('offline', 'error') and \
|
||||||
not showOffline and (not _('Transports') in contact.groups or \
|
not showOffline and (not _('Transports') in contact.groups or \
|
||||||
gajim.connections[account].connected < 2) and \
|
gajim.connections[account].connected < 2) and \
|
||||||
not gajim.awaiting_events[account].has_key(jid):
|
not gajim.awaiting_events[account].has_key(jid):
|
||||||
return
|
return
|
||||||
|
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
|
@ -431,8 +431,8 @@ class RosterWindow:
|
||||||
'''create the main window's menus'''
|
'''create the main window's menus'''
|
||||||
new_message_menuitem = self.xml.get_widget('new_message_menuitem')
|
new_message_menuitem = self.xml.get_widget('new_message_menuitem')
|
||||||
join_gc_menuitem = self.xml.get_widget('join_gc_menuitem')
|
join_gc_menuitem = self.xml.get_widget('join_gc_menuitem')
|
||||||
add_new_contact_menuitem = self.xml.get_widget('add_new_contact_menuitem')
|
add_new_contact_menuitem = self.xml.get_widget('add_new_contact_menuitem')
|
||||||
service_disco_menuitem = self.xml.get_widget('service_disco_menuitem')
|
service_disco_menuitem = self.xml.get_widget('service_disco_menuitem')
|
||||||
advanced_menuitem = self.xml.get_widget('advanced_menuitem')
|
advanced_menuitem = self.xml.get_widget('advanced_menuitem')
|
||||||
show_offline_contacts_menuitem = self.xml.get_widget(
|
show_offline_contacts_menuitem = self.xml.get_widget(
|
||||||
'show_offline_contacts_menuitem')
|
'show_offline_contacts_menuitem')
|
||||||
|
@ -634,7 +634,7 @@ class RosterWindow:
|
||||||
for win in gajim.interface.msg_win_mgr.windows():
|
for win in gajim.interface.msg_win_mgr.windows():
|
||||||
win.repaint_themed_widgets()
|
win.repaint_themed_widgets()
|
||||||
# update gc's roster
|
# update gc's roster
|
||||||
for ctl in gajim.interface.msg_win_mgr.controls():
|
for ctl in gajim.interface.msg_win_mgr.controls():
|
||||||
if ctl.type_id == message_control.TYPE_GC:
|
if ctl.type_id == message_control.TYPE_GC:
|
||||||
ctl.draw_widgets()
|
ctl.draw_widgets()
|
||||||
|
|
||||||
|
@ -709,7 +709,7 @@ class RosterWindow:
|
||||||
contact.show = show
|
contact.show = show
|
||||||
contact.status = status
|
contact.status = status
|
||||||
if show in ('offline', 'error') and \
|
if show in ('offline', 'error') and \
|
||||||
not gajim.awaiting_events[account].has_key(contact.jid):
|
not gajim.awaiting_events[account].has_key(contact.jid):
|
||||||
if len(contact_instances) > 1:
|
if len(contact_instances) > 1:
|
||||||
# if multiple resources
|
# if multiple resources
|
||||||
gajim.contacts.remove_contact(account, contact)
|
gajim.contacts.remove_contact(account, contact)
|
||||||
|
@ -755,7 +755,7 @@ class RosterWindow:
|
||||||
if props and self.tooltip.id == props[0]:
|
if props and self.tooltip.id == props[0]:
|
||||||
# check if the current pointer is at the same path
|
# check if the current pointer is at the same path
|
||||||
# as it was before setting the timeout
|
# as it was before setting the timeout
|
||||||
rect = self.tree.get_cell_area(props[0], props[1])
|
rect = self.tree.get_cell_area(props[0], props[1])
|
||||||
position = self.tree.window.get_origin()
|
position = self.tree.window.get_origin()
|
||||||
pointer = self.window.get_pointer()
|
pointer = self.window.get_pointer()
|
||||||
self.tooltip.show_tooltip(contact, (pointer[0], rect.height),
|
self.tooltip.show_tooltip(contact, (pointer[0], rect.height),
|
||||||
|
@ -1905,7 +1905,7 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
||||||
if self._last_selected_contact is not None:
|
if self._last_selected_contact is not None:
|
||||||
jid, account = self._last_selected_contact
|
jid, account = self._last_selected_contact
|
||||||
self.draw_contact(jid, account, selected = True,
|
self.draw_contact(jid, account, selected = True,
|
||||||
focus = True)
|
focus = True)
|
||||||
|
|
||||||
def on_roster_window_focus_out_event(self, widget, event):
|
def on_roster_window_focus_out_event(self, widget, event):
|
||||||
# if a contact row is selected, update colors (eg. for status msg)
|
# if a contact row is selected, update colors (eg. for status msg)
|
||||||
|
@ -1914,7 +1914,7 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
||||||
if self._last_selected_contact is not None:
|
if self._last_selected_contact is not None:
|
||||||
jid, account = self._last_selected_contact
|
jid, account = self._last_selected_contact
|
||||||
self.draw_contact(jid, account, selected = True,
|
self.draw_contact(jid, account, selected = True,
|
||||||
focus = False)
|
focus = False)
|
||||||
|
|
||||||
def on_roster_window_key_press_event(self, widget, event):
|
def on_roster_window_key_press_event(self, widget, event):
|
||||||
if event.keyval == gtk.keysyms.Escape:
|
if event.keyval == gtk.keysyms.Escape:
|
||||||
|
@ -2102,7 +2102,7 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
||||||
self.collapsed_rows.append(account)
|
self.collapsed_rows.append(account)
|
||||||
|
|
||||||
def on_editing_started(self, cell, event, row):
|
def on_editing_started(self, cell, event, row):
|
||||||
''' start editing a cell in the tree '''
|
''' start editing a cell in the tree'''
|
||||||
path = self.tree.get_cursor()[0]
|
path = self.tree.get_cursor()[0]
|
||||||
self.editing_path = path
|
self.editing_path = path
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue