Fix some bugs and improve coding of minimized groupchats.
This commit is contained in:
parent
fb95530daf
commit
19df2a0f9e
|
@ -553,6 +553,7 @@ class ChatControlBase(MessageControl):
|
|||
subject = None, old_kind = None, xhtml = None):
|
||||
'''prints 'chat' type messages'''
|
||||
jid = self.contact.jid
|
||||
account = self.account
|
||||
full_jid = self.get_full_jid()
|
||||
textview = self.conv_textview
|
||||
end = False
|
||||
|
@ -566,24 +567,27 @@ class ChatControlBase(MessageControl):
|
|||
return
|
||||
if kind == 'incoming':
|
||||
gajim.last_message_time[self.account][full_jid] = time.time()
|
||||
if (not self.parent_win.get_active_jid() or \
|
||||
full_jid != self.parent_win.get_active_jid() or \
|
||||
not self.parent_win.is_active() or not end) and \
|
||||
kind in ('incoming', 'incoming_queue'):
|
||||
|
||||
if kind in ('incoming', 'incoming_queue'):
|
||||
gc_message = False
|
||||
if self.type_id == message_control.TYPE_GC:
|
||||
gc_message = True
|
||||
if not gc_message or \
|
||||
(gc_message and (other_tags_for_text == ['marked'] or \
|
||||
gajim.config.get('notify_on_all_muc_messages'))):
|
||||
gajim.config.get('notify_on_all_muc_messages'))) or \
|
||||
(gc_message and \
|
||||
gajim.interface.minimized_controls.has_key(account) and \
|
||||
jid in gajim.interface.minimized_controls[account]):
|
||||
# we want to have save this message in events list
|
||||
# other_tags_for_text == ['marked'] --> highlighted gc message
|
||||
type_ = 'printed_' + self.type_id
|
||||
event = 'message_received'
|
||||
if gc_message:
|
||||
type_ = 'printed_gc_msg'
|
||||
show_in_roster = notify.get_show_in_roster('message_received',
|
||||
event = 'gc_message_received'
|
||||
show_in_roster = notify.get_show_in_roster(event,
|
||||
self.account, self.contact)
|
||||
show_in_systray = notify.get_show_in_systray('message_received',
|
||||
show_in_systray = notify.get_show_in_systray(event,
|
||||
self.account, self.contact)
|
||||
event = gajim.events.create_event(type_, None,
|
||||
show_in_roster = show_in_roster,
|
||||
|
@ -593,6 +597,14 @@ class ChatControlBase(MessageControl):
|
|||
if show_in_roster:
|
||||
gajim.interface.roster.draw_contact(self.contact.jid,
|
||||
self.account)
|
||||
|
||||
if not self.parent_win:
|
||||
return
|
||||
|
||||
if (not self.parent_win.get_active_jid() or \
|
||||
full_jid != self.parent_win.get_active_jid() or \
|
||||
not self.parent_win.is_active() or not end) and \
|
||||
kind in ('incoming', 'incoming_queue'):
|
||||
self.parent_win.redraw_tab(self)
|
||||
ctrl = gajim.interface.msg_win_mgr.get_control(full_jid, self.account)
|
||||
if not self.parent_win.is_active():
|
||||
|
@ -669,8 +681,12 @@ class ChatControlBase(MessageControl):
|
|||
|
||||
win.notebook.remove_page(ctrl_page)
|
||||
control.unparent()
|
||||
ctrl.parent_win = None
|
||||
|
||||
if not gajim.interface.minimized_controls.has_key(self.account):
|
||||
gajim.interface.minimized_controls[self.account] = {}
|
||||
gajim.interface.minimized_controls[self.account][self.contact.jid] = ctrl
|
||||
|
||||
gajim.connections[self.account].hidden_groupchats[self.contact.jid] = ctrl
|
||||
del win._controls[self.account][self.contact.jid]
|
||||
|
||||
win.check_tabs()
|
||||
|
@ -788,6 +804,8 @@ class ChatControlBase(MessageControl):
|
|||
if not len(gajim.events.get_events(self.account, jid, ['printed_' + type_,
|
||||
type_])):
|
||||
return
|
||||
if not self.parent_win:
|
||||
return
|
||||
if self.conv_textview.at_the_end() and \
|
||||
self.parent_win.get_active_control() == self and \
|
||||
self.parent_win.window.is_active():
|
||||
|
|
|
@ -70,7 +70,6 @@ class Connection(ConnectionHandlers):
|
|||
self.last_time_to_reconnect = None
|
||||
self.new_account_info = None
|
||||
self.bookmarks = []
|
||||
self.hidden_groupchats = {}
|
||||
self.annotations = {}
|
||||
self.on_purpose = False
|
||||
self.last_io = gajim.idlequeue.current_time()
|
||||
|
|
|
@ -155,9 +155,8 @@ class Events:
|
|||
self._events[account][new_jid] = self._events[account][old_jid]
|
||||
del self._events[account][old_jid]
|
||||
|
||||
def get_nb_events(self, types = [], account = None, ignore_types = []):
|
||||
return self._get_nb_events(types = types, account = account,
|
||||
ignore_types = ignore_types)
|
||||
def get_nb_events(self, types = [], account = None):
|
||||
return self._get_nb_events(types = types, account = account)
|
||||
|
||||
def get_events(self, account, jid = None, types = []):
|
||||
'''if event is not specified, get all events from this jid,
|
||||
|
@ -187,7 +186,7 @@ class Events:
|
|||
return first_event
|
||||
|
||||
def _get_nb_events(self, account = None, jid = None, attribute = None,
|
||||
types = [], ignore_types = []):
|
||||
types = []):
|
||||
'''return the number of pending events'''
|
||||
nb = 0
|
||||
if account:
|
||||
|
@ -207,8 +206,6 @@ class Events:
|
|||
for event in self._events[acct][j]:
|
||||
if types and event.type_ not in types:
|
||||
continue
|
||||
if ignore_types and event.type_ in ignore_types:
|
||||
continue
|
||||
if not attribute or \
|
||||
attribute == 'systray' and event.show_in_systray or \
|
||||
attribute == 'roster' and event.show_in_roster:
|
||||
|
|
114
src/gajim.py
114
src/gajim.py
|
@ -1052,9 +1052,10 @@ class Interface:
|
|||
show = array[1]
|
||||
status = array[2]
|
||||
|
||||
ctrl = self.msg_win_mgr.get_control(fjid, account)
|
||||
|
||||
# print status in chat window and update status/GPG image
|
||||
if self.msg_win_mgr.has_window(fjid, account):
|
||||
ctrl = self.msg_win_mgr.get_control(fjid, account)
|
||||
if ctrl:
|
||||
contact = ctrl.contact
|
||||
contact.show = show
|
||||
contact.status = status
|
||||
|
@ -1066,44 +1067,42 @@ class Interface:
|
|||
else:
|
||||
ctrl.print_conversation(_('%s is now %s') % (nick, uf_show),
|
||||
'status')
|
||||
ctrl.parent_win.redraw_tab(ctrl)
|
||||
if ctrl.parent_win:
|
||||
ctrl.parent_win.redraw_tab(ctrl)
|
||||
if self.remote_ctrl:
|
||||
self.remote_ctrl.raise_signal('GCPresence', (account, array))
|
||||
|
||||
if room_jid in gajim.connections[account].hidden_groupchats:
|
||||
my_nick = gajim.connections[account].hidden_groupchats[room_jid].nick
|
||||
first = False
|
||||
if not gajim.events.get_events(account, room_jid, ['change_status']):
|
||||
first = True
|
||||
array = array + (time.localtime(),)
|
||||
event = gajim.events.create_event('change_status', array,
|
||||
show_in_roster = False, show_in_systray = False)
|
||||
gajim.events.add_event(account, room_jid, event)
|
||||
|
||||
# Change status icon if kicked or deconnected from gc
|
||||
if array[3] == my_nick and array[1] in ('offline', 'error') and \
|
||||
array[9] != '303':
|
||||
gajim.gc_connected[account][room_jid] = False
|
||||
gajim.interface.roster.draw_contact(room_jid, account)
|
||||
elif array[3] == my_nick:
|
||||
gajim.gc_connected[account][room_jid] = True
|
||||
gajim.interface.roster.draw_contact(room_jid, account)
|
||||
return
|
||||
|
||||
# Get the window and control for the updated status, this may be a
|
||||
# PrivateChatControl
|
||||
control = self.msg_win_mgr.get_control(room_jid, account)
|
||||
if not control and \
|
||||
self.minimized_controls.has_key(account) and \
|
||||
room_jid in self.minimized_controls[account]:
|
||||
control = self.minimized_controls[account][room_jid]
|
||||
|
||||
if control and control.type_id != message_control.TYPE_GC:
|
||||
return
|
||||
if control:
|
||||
control.chg_contact_status(nick, show, status, array[4], array[5],
|
||||
array[6], array[7], array[8], array[9], array[10])
|
||||
if not control.parent_win:
|
||||
gajim.interface.roster.draw_contact(room_jid, account)
|
||||
|
||||
def handle_event_gc_msg(self, account, array):
|
||||
# ('GC_MSG', account, (jid, msg, time, has_timestamp, htmlmsg))
|
||||
jids = array[0].split('/', 1)
|
||||
room_jid = jids[0]
|
||||
|
||||
gc_control = self.msg_win_mgr.get_control(room_jid, account)
|
||||
if not gc_control and \
|
||||
self.minimized_controls.has_key(account) and \
|
||||
room_jid in self.minimized_controls[account]:
|
||||
gc_control = self.minimized_controls[account][room_jid]
|
||||
|
||||
if not gc_control:
|
||||
return
|
||||
xhtml = array[4]
|
||||
|
||||
if gajim.config.get('ignore_incoming_xhtml'):
|
||||
xhtml = None
|
||||
if len(jids) == 1:
|
||||
|
@ -1113,47 +1112,13 @@ class Interface:
|
|||
# message from someone
|
||||
nick = jids[1]
|
||||
|
||||
if room_jid in gajim.connections[account].hidden_groupchats:
|
||||
message = array[1]
|
||||
tim = array[2]
|
||||
first = False
|
||||
|
||||
if not gajim.events.get_events(account, room_jid, ['gc_msg',
|
||||
'gc_chat']):
|
||||
first = True
|
||||
contact = gajim.contacts.get_contact_with_highest_priority(
|
||||
account, room_jid)
|
||||
advanced_notif_num = notify.get_advanced_notification\
|
||||
('message_received', account, contact)
|
||||
ctrl = gajim.connections[account].hidden_groupchats[room_jid]
|
||||
|
||||
type_event = 'gc_msg'
|
||||
do_popup = False
|
||||
is_history = False
|
||||
show_in_systray = False
|
||||
show_in_roster = True
|
||||
if not array[3] and ctrl.needs_visual_notification(message):
|
||||
do_popup = True
|
||||
show_in_systray = True
|
||||
if array[3] or nick == '':
|
||||
is_history = True
|
||||
type_event = 'gc_history'
|
||||
show_in_roster = False
|
||||
if not array[3]:
|
||||
notify.notify('new_gc_message', room_jid, account, [do_popup,
|
||||
first, nick, message, is_history], advanced_notif_num)
|
||||
event = gajim.events.create_event(type_event, (nick, array[1],
|
||||
array[2], array[3], xhtml), show_in_roster = show_in_roster,
|
||||
show_in_systray = show_in_systray)
|
||||
gajim.events.add_event(account, room_jid, event)
|
||||
gajim.interface.roster.draw_contact(room_jid, account)
|
||||
gajim.interface.roster.show_title()
|
||||
return
|
||||
|
||||
gc_control = self.msg_win_mgr.get_control(room_jid, account)
|
||||
if not gc_control:
|
||||
return
|
||||
gc_control.on_message(nick, array[1], array[2], array[3], xhtml)
|
||||
|
||||
contact = gajim.contacts.\
|
||||
get_contact_with_highest_priority(account, room_jid)
|
||||
if contact:
|
||||
gajim.interface.roster.draw_contact(room_jid, account)
|
||||
|
||||
if self.remote_ctrl:
|
||||
self.remote_ctrl.raise_signal('GCMessage', (account, array))
|
||||
|
||||
|
@ -1161,18 +1126,20 @@ class Interface:
|
|||
#('GC_SUBJECT', account, (jid, subject, body, has_timestamp))
|
||||
jids = array[0].split('/', 1)
|
||||
jid = jids[0]
|
||||
if jid in gajim.connections[account].hidden_groupchats:
|
||||
array = (array[0], array[1], array[2]) + (time.localtime(),)
|
||||
event = gajim.events.create_event('change_subject',
|
||||
array, show_in_roster = False, show_in_systray = False)
|
||||
gajim.events.add_event(account, jid, event)
|
||||
contact = gajim.contacts.\
|
||||
get_contact_with_highest_priority(account, jid)
|
||||
contact.status = array[1]
|
||||
gajim.interface.roster.draw_contact(jid, account)
|
||||
return
|
||||
|
||||
gc_control = self.msg_win_mgr.get_control(jid, account)
|
||||
|
||||
if not gc_control and \
|
||||
self.minimized_controls.has_key(account) and \
|
||||
jid in self.minimized_controls[account]:
|
||||
gc_control = self.minimized_controls[account][jid]
|
||||
|
||||
contact = gajim.contacts.\
|
||||
get_contact_with_highest_priority(account, jid)
|
||||
if contact:
|
||||
contact.status = array[1]
|
||||
gajim.interface.roster.draw_contact(jid, account)
|
||||
|
||||
if not gc_control:
|
||||
return
|
||||
gc_control.set_subject(array[1])
|
||||
|
@ -2203,6 +2170,7 @@ class Interface:
|
|||
self.emoticons_menu = None
|
||||
# handler when an emoticon is clicked in emoticons_menu
|
||||
self.emoticon_menuitem_clicked = None
|
||||
self.minimized_controls = {}
|
||||
self.default_colors = {
|
||||
'inmsgcolor': gajim.config.get('inmsgcolor'),
|
||||
'outmsgcolor': gajim.config.get('outmsgcolor'),
|
||||
|
|
|
@ -614,7 +614,8 @@ class GroupchatControl(ChatControlBase):
|
|||
else:
|
||||
kind = 'incoming'
|
||||
# muc-specific chatstate
|
||||
self.parent_win.redraw_tab(self, 'newmsg')
|
||||
if self.parent_win:
|
||||
self.parent_win.redraw_tab(self, 'newmsg')
|
||||
else:
|
||||
kind = 'status'
|
||||
|
||||
|
@ -636,7 +637,8 @@ class GroupchatControl(ChatControlBase):
|
|||
str(self.gc_count_nicknames_colors))
|
||||
if highlight:
|
||||
# muc-specific chatstate
|
||||
self.parent_win.redraw_tab(self, 'attention')
|
||||
if self.parent_win:
|
||||
self.parent_win.redraw_tab(self, 'attention')
|
||||
other_tags_for_name.append('bold')
|
||||
other_tags_for_text.append('marked')
|
||||
if sound == 'received':
|
||||
|
@ -647,7 +649,8 @@ class GroupchatControl(ChatControlBase):
|
|||
other_tags_for_text.append('gc_nickname_color_' + \
|
||||
str(self.gc_custom_colors[contact]))
|
||||
|
||||
self.check_and_possibly_add_focus_out_line()
|
||||
if self.parent_win:
|
||||
self.check_and_possibly_add_focus_out_line()
|
||||
|
||||
ChatControlBase.print_conversation_line(self, text, kind, contact, tim,
|
||||
other_tags_for_name, [], other_tags_for_text, xhtml = xhtml)
|
||||
|
@ -918,7 +921,12 @@ class GroupchatControl(ChatControlBase):
|
|||
c.status = status
|
||||
if nick == self.nick and statusCode != '303': # We became offline
|
||||
self.got_disconnected()
|
||||
self.parent_win.redraw_tab(self)
|
||||
contact = gajim.contacts.\
|
||||
get_contact_with_highest_priority(self.account, self.room_jid)
|
||||
if contact:
|
||||
gajim.interface.roster.draw_contact(self.room_jid, self.account)
|
||||
if self.parent_win:
|
||||
self.parent_win.redraw_tab(self)
|
||||
else:
|
||||
iter = self.get_contact_iter(nick)
|
||||
if not iter:
|
||||
|
@ -943,8 +951,8 @@ class GroupchatControl(ChatControlBase):
|
|||
c.affiliation = affiliation
|
||||
c.status = status
|
||||
self.draw_contact(nick)
|
||||
|
||||
self.parent_win.redraw_tab(self)
|
||||
if self.parent_win:
|
||||
self.parent_win.redraw_tab(self)
|
||||
if (time.time() - self.room_creation) > 30 and \
|
||||
nick != self.nick and statusCode != '303':
|
||||
st = ''
|
||||
|
@ -2017,47 +2025,47 @@ class GroupchatControl(ChatControlBase):
|
|||
else:
|
||||
self.revoke_owner(widget, jid)
|
||||
|
||||
def read_queue(self, jid, account):
|
||||
'''read queue and print messages containted in it'''
|
||||
events = gajim.events.get_events(account, jid)
|
||||
#~ def read_queue(self, jid, account):
|
||||
#~ '''read queue and print messages containted in it'''
|
||||
#~ events = gajim.events.get_events(account, jid)
|
||||
|
||||
for event in events:
|
||||
if event.type_ == 'change_subject':
|
||||
array = event.parameters
|
||||
jids = array[0].split('/', 1)
|
||||
jid = jids[0]
|
||||
self.set_subject(array[1])
|
||||
text = None
|
||||
if len(jids) > 1:
|
||||
text = _('%s has set the subject to %s') % (jids[1], array[1])
|
||||
elif array[2]:
|
||||
text = array[2]
|
||||
if text is not None:
|
||||
self.print_conversation(text, tim = array[3])
|
||||
#~ for event in events:
|
||||
#~ if event.type_ == 'change_subject':
|
||||
#~ array = event.parameters
|
||||
#~ jids = array[0].split('/', 1)
|
||||
#~ jid = jids[0]
|
||||
#~ self.set_subject(array[1])
|
||||
#~ text = None
|
||||
#~ if len(jids) > 1:
|
||||
#~ text = _('%s has set the subject to %s') % (jids[1], array[1])
|
||||
#~ elif array[2]:
|
||||
#~ text = array[2]
|
||||
#~ if text is not None:
|
||||
#~ self.print_conversation(text, tim = array[3])
|
||||
|
||||
if event.type_ == 'change_status':
|
||||
array = event.parameters
|
||||
nick = array[3]
|
||||
if not nick:
|
||||
return
|
||||
room_jid = array[0]
|
||||
fjid = room_jid + '/' + nick
|
||||
show = array[1]
|
||||
status = array[2]
|
||||
self.chg_contact_status(nick, show, status, array[4], array[5],
|
||||
array[6], array[7], array[8], array[9], array[10], array[11])
|
||||
#~ if event.type_ == 'change_status':
|
||||
#~ array = event.parameters
|
||||
#~ nick = array[3]
|
||||
#~ if not nick:
|
||||
#~ return
|
||||
#~ room_jid = array[0]
|
||||
#~ fjid = room_jid + '/' + nick
|
||||
#~ show = array[1]
|
||||
#~ status = array[2]
|
||||
#~ self.chg_contact_status(nick, show, status, array[4], array[5],
|
||||
#~ array[6], array[7], array[8], array[9], array[10], array[11])
|
||||
|
||||
self.parent_win.redraw_tab(self)
|
||||
#~ self.parent_win.redraw_tab(self)
|
||||
|
||||
if event.type_ in ['gc_msg', 'gc_history']:
|
||||
array = event.parameters
|
||||
kind = array[0]
|
||||
if kind == 'error' or kind == 'status':
|
||||
kind = 'info'
|
||||
self.on_message(kind, array[1], array[2], array[3], array[4])
|
||||
#~ if event.type_ in ['gc_msg', 'gc_history']:
|
||||
#~ array = event.parameters
|
||||
#~ kind = array[0]
|
||||
#~ if kind == 'error' or kind == 'status':
|
||||
#~ kind = 'info'
|
||||
#~ self.on_message(kind, array[1], array[2], array[3], array[4])
|
||||
|
||||
gajim.events.remove_events(account, jid,
|
||||
types = ['change_status', 'gc_msg', 'gc_history',
|
||||
'change_subject'])
|
||||
gajim.interface.roster.draw_contact(jid, account)
|
||||
gajim.interface.roster.show_title()
|
||||
#~ gajim.events.remove_events(account, jid,
|
||||
#~ types = ['change_status', 'gc_msg', 'gc_history',
|
||||
#~ 'change_subject'])
|
||||
#~ gajim.interface.roster.draw_contact(jid, account)
|
||||
#~ gajim.interface.roster.show_title()
|
||||
|
|
|
@ -42,6 +42,8 @@ except ImportError:
|
|||
|
||||
def get_show_in_roster(event, account, contact):
|
||||
'''Return True if this event must be shown in roster, else False'''
|
||||
if event == 'gc_message_received':
|
||||
return True
|
||||
num = get_advanced_notification(event, account, contact)
|
||||
if num != None:
|
||||
if gajim.config.get_per('notifications', str(num), 'roster') == 'yes':
|
||||
|
@ -153,25 +155,10 @@ def notify(event, jid, account, parameters, advanced_notif_num = None):
|
|||
is_first_message = parameters[1]
|
||||
nickname = parameters[2]
|
||||
message = parameters[3]
|
||||
if is_first_message and helpers.allow_sound_notification(
|
||||
'first_message_received', advanced_notif_num):
|
||||
do_sound = True
|
||||
elif not is_first_message and helpers.allow_sound_notification(
|
||||
'next_message_received', advanced_notif_num):
|
||||
do_sound = True
|
||||
if helpers.allow_showing_notification(account, 'notify_on_new_message',
|
||||
advanced_notif_num, is_first_message):
|
||||
do_popup = True
|
||||
elif event == 'new_gc_message':
|
||||
message_type = 'gc_msg'
|
||||
do_popup = parameters[0]
|
||||
is_first_message = parameters[1]
|
||||
nickname = parameters[2]
|
||||
message = parameters[3]
|
||||
is_history = parameters[4]
|
||||
if is_history:
|
||||
pass
|
||||
elif is_first_message and helpers.allow_sound_notification(
|
||||
if is_first_message and helpers.allow_sound_notification(
|
||||
'first_message_received', advanced_notif_num):
|
||||
do_sound = True
|
||||
elif not is_first_message and helpers.allow_sound_notification(
|
||||
|
@ -260,19 +247,6 @@ def notify(event, jid, account, parameters, advanced_notif_num = None):
|
|||
path = gtkgui_helpers.get_path_to_generic_or_avatar(img)
|
||||
popup(event_type, jid, account, message_type,
|
||||
path_to_image = path, title = title, text = text)
|
||||
elif event == 'new_gc_message':
|
||||
event_type = _('New Groupchat Message')
|
||||
room_jid = jid
|
||||
name = gajim.connections[account].hidden_groupchats[room_jid].name
|
||||
img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events',
|
||||
'gc_invitation.png')
|
||||
title = _('New Message on %s') % name
|
||||
text = _('%(nickname)s: %(message)s') % {'nickname': nickname,
|
||||
'message': message}
|
||||
path = gtkgui_helpers.get_path_to_generic_or_avatar(img)
|
||||
popup(event_type, jid, account, message_type,
|
||||
path_to_image = path, title = title, text = text)
|
||||
|
||||
|
||||
if do_sound:
|
||||
snd_file = None
|
||||
|
@ -462,8 +436,6 @@ class DesktopNotification:
|
|||
ntype = 'presence.status'
|
||||
elif event_type == _('Connection Failed'):
|
||||
ntype = 'connection.failed'
|
||||
elif event_type == _('New Groupchat Message'):
|
||||
ntype = 'im'
|
||||
else:
|
||||
# default failsafe values
|
||||
self.path_to_image = os.path.abspath(
|
||||
|
|
|
@ -728,7 +728,8 @@ class RosterWindow:
|
|||
win.set_active_tab(room_jid, account)
|
||||
dialogs.ErrorDialog(_('You are already in group chat %s') % room_jid)
|
||||
return
|
||||
if gajim.connections[account].hidden_groupchats.has_key(room_jid):
|
||||
if gajim.interface.minimized_controls.has_key(account) and \
|
||||
room_jid in gajim.interface.minimized_controls[account]:
|
||||
self.on_groupchat_maximized(None, room_jid, account)
|
||||
return
|
||||
invisible_show = gajim.SHOW_LIST.index('invisible')
|
||||
|
@ -739,7 +740,11 @@ class RosterWindow:
|
|||
if minimize:
|
||||
contact = gajim.contacts.create_contact(jid = room_jid, name = nick)
|
||||
gc_control = GroupchatControl(None, contact, account)
|
||||
gajim.connections[account].hidden_groupchats[room_jid] = gc_control
|
||||
|
||||
if not gajim.interface.minimized_controls.has_key(account):
|
||||
gajim.interface.minimized_controls[account] = {}
|
||||
gajim.interface.minimized_controls[account][room_jid] = gc_control
|
||||
|
||||
self.add_groupchat_to_roster(account, room_jid)
|
||||
gajim.connections[account].join_gc(nick, room_jid, password)
|
||||
if password:
|
||||
|
@ -2401,7 +2406,13 @@ class RosterWindow:
|
|||
|
||||
def on_groupchat_maximized(self, widget, jid, account):
|
||||
'''When a groupshat is maximised'''
|
||||
ctrl = gajim.connections[account].hidden_groupchats[jid]
|
||||
if not gajim.interface.minimized_controls.has_key(account):
|
||||
return
|
||||
if not gajim.interface.minimized_controls[account].has_key(jid):
|
||||
return
|
||||
|
||||
|
||||
ctrl = gajim.interface.minimized_controls[account][jid]
|
||||
mw = gajim.interface.msg_win_mgr.get_window(ctrl.contact.jid, ctrl.account)
|
||||
if not mw:
|
||||
mw = gajim.interface.msg_win_mgr.create_window(ctrl.contact, \
|
||||
|
@ -2410,12 +2421,12 @@ class RosterWindow:
|
|||
mw.new_tab(ctrl)
|
||||
mw.set_active_tab(jid, account)
|
||||
mw.window.present()
|
||||
ctrl.read_queue(jid, account)
|
||||
|
||||
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
||||
self.remove_contact(contact, account)
|
||||
gajim.contacts.remove_contact(account, contact)
|
||||
self.draw_group(_('Groupchats'), account)
|
||||
del gajim.connections[account].hidden_groupchats[jid]
|
||||
del gajim.interface.minimized_controls[account][jid]
|
||||
|
||||
def make_group_menu(self, event, iter):
|
||||
'''Make group's popup menu'''
|
||||
|
@ -3177,8 +3188,11 @@ class RosterWindow:
|
|||
else:
|
||||
gajim.connections[account].change_status(status, txt, auto)
|
||||
|
||||
if not gajim.interface.minimized_controls.has_key(account):
|
||||
gajim.interface.minimized_controls[account] = {}
|
||||
for gc_control in gajim.interface.msg_win_mgr.get_controls(
|
||||
message_control.TYPE_GC):
|
||||
message_control.TYPE_GC) + \
|
||||
gajim.interface.minimized_controls[account].values():
|
||||
if gc_control.account == account:
|
||||
if gajim.gc_connected[account][gc_control.room_jid]:
|
||||
gajim.connections[account].send_gc_status(gc_control.nick,
|
||||
|
@ -3786,8 +3800,7 @@ class RosterWindow:
|
|||
# check if we have unread or recent mesages
|
||||
unread = False
|
||||
recent = False
|
||||
if gajim.events.get_nb_events(ignore_types = ['gc_history',
|
||||
'change_status', 'change_subject']) > 0:
|
||||
if gajim.events.get_nb_events() > 0:
|
||||
unread = True
|
||||
for win in gajim.interface.msg_win_mgr.windows():
|
||||
unrd = 0
|
||||
|
@ -3908,7 +3921,8 @@ class RosterWindow:
|
|||
self.tree.collapse_row(path)
|
||||
else:
|
||||
self.tree.expand_row(path, False)
|
||||
elif gajim.connections[account].hidden_groupchats.has_key(jid):
|
||||
elif gajim.interface.minimized_controls.has_key(account) and \
|
||||
gajim.interface.minimized_controls[account].has_key(jid):
|
||||
self.on_groupchat_maximized(None, jid, account)
|
||||
else:
|
||||
first_ev = gajim.events.get_first_event(account, jid)
|
||||
|
|
|
@ -412,8 +412,9 @@ class RosterTooltip(NotificationAreaTooltip):
|
|||
if self.account and prim_contact.jid in gajim.connections[
|
||||
self.account].blocked_contacts:
|
||||
name_markup += _(' [blocked]')
|
||||
if self.account and gajim.connections[self.account].\
|
||||
hidden_groupchats.has_key(prim_contact.jid):
|
||||
if self.account and \
|
||||
gajim.interface.minimized_controls.has_key(self.account) and \
|
||||
prim_contact.jid in gajim.interface.minimized_controls[self.account]:
|
||||
name_markup += _(' [minimized]')
|
||||
properties.append((name_markup, None))
|
||||
|
||||
|
|
Loading…
Reference in New Issue