fix indentation and 80 char width
This commit is contained in:
parent
fc5e91a039
commit
469d496dcb
|
@ -86,9 +86,11 @@ def tree_cell_data_func(column, renderer, model, iter_, tv=None):
|
||||||
renderer.set_property('xalign', 1) # align pixbuf to the right
|
renderer.set_property('xalign', 1) # align pixbuf to the right
|
||||||
else:
|
else:
|
||||||
renderer.set_property('xalign', 0.5)
|
renderer.set_property('xalign', 0.5)
|
||||||
if parent_iter and (model[iter_][C_AVATAR] or avatar_position == 'left'):
|
if parent_iter and (model[iter_][C_AVATAR] or avatar_position == \
|
||||||
|
'left'):
|
||||||
renderer.set_property('visible', True)
|
renderer.set_property('visible', True)
|
||||||
renderer.set_property('width', gajim.config.get('roster_avatar_width'))
|
renderer.set_property('width', gajim.config.get(
|
||||||
|
'roster_avatar_width'))
|
||||||
else:
|
else:
|
||||||
renderer.set_property('visible', False)
|
renderer.set_property('visible', False)
|
||||||
if parent_iter:
|
if parent_iter:
|
||||||
|
@ -132,7 +134,8 @@ class PrivateChatControl(ChatControl):
|
||||||
|
|
||||||
def __init__(self, parent_win, gc_contact, contact, account, session):
|
def __init__(self, parent_win, gc_contact, contact, account, session):
|
||||||
room_jid = gc_contact.room_jid
|
room_jid = gc_contact.room_jid
|
||||||
room_ctrl = gajim.interface.msg_win_mgr.get_gc_control(room_jid, account)
|
room_ctrl = gajim.interface.msg_win_mgr.get_gc_control(room_jid,
|
||||||
|
account)
|
||||||
if room_jid in gajim.interface.minimized_controls[account]:
|
if room_jid in gajim.interface.minimized_controls[account]:
|
||||||
room_ctrl = gajim.interface.minimized_controls[account][room_jid]
|
room_ctrl = gajim.interface.minimized_controls[account][room_jid]
|
||||||
if room_ctrl:
|
if room_ctrl:
|
||||||
|
@ -163,8 +166,8 @@ class PrivateChatControl(ChatControl):
|
||||||
dialogs.ErrorDialog(
|
dialogs.ErrorDialog(
|
||||||
_('Sending private message failed'),
|
_('Sending private message failed'),
|
||||||
#in second %s code replaces with nickname
|
#in second %s code replaces with nickname
|
||||||
_('You are no longer in group chat "%(room)s" or "%(nick)s" has '
|
_('You are no longer in group chat "%(room)s" or '
|
||||||
'left.') % {'room': room, 'nick': nick})
|
'"%(nick)s" has left.') % {'room': room, 'nick': nick})
|
||||||
return
|
return
|
||||||
|
|
||||||
ChatControl.send_message(self, message, xhtml=xhtml,
|
ChatControl.send_message(self, message, xhtml=xhtml,
|
||||||
|
@ -185,7 +188,8 @@ class PrivateChatControl(ChatControl):
|
||||||
|
|
||||||
if not self.session:
|
if not self.session:
|
||||||
fjid = self.gc_contact.get_full_jid()
|
fjid = self.gc_contact.get_full_jid()
|
||||||
new_sess = gajim.connections[self.account].make_new_session(fjid, type_=self.type_id)
|
new_sess = gajim.connections[self.account].make_new_session(fjid,
|
||||||
|
type_=self.type_id)
|
||||||
self.set_session(new_sess)
|
self.set_session(new_sess)
|
||||||
|
|
||||||
self.session.negotiate_e2e(False)
|
self.session.negotiate_e2e(False)
|
||||||
|
@ -201,7 +205,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
ChatControlBase.__init__(self, self.TYPE_ID, parent_win,
|
ChatControlBase.__init__(self, self.TYPE_ID, parent_win,
|
||||||
'groupchat_control', contact, acct)
|
'groupchat_control', contact, acct)
|
||||||
|
|
||||||
self.is_continued=is_continued
|
self.is_continued = is_continued
|
||||||
self.is_anonymous = True
|
self.is_anonymous = True
|
||||||
|
|
||||||
# Controls the state of autorejoin.
|
# Controls the state of autorejoin.
|
||||||
|
@ -222,7 +226,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.handlers[id_] = widget
|
self.handlers[id_] = widget
|
||||||
|
|
||||||
widget = self.xml.get_object('change_subject_button')
|
widget = self.xml.get_object('change_subject_button')
|
||||||
id_ = widget.connect('clicked', self._on_change_subject_menuitem_activate)
|
id_ = widget.connect('clicked',
|
||||||
|
self._on_change_subject_menuitem_activate)
|
||||||
self.handlers[id_] = widget
|
self.handlers[id_] = widget
|
||||||
|
|
||||||
widget = self.xml.get_object('bookmark_button')
|
widget = self.xml.get_object('bookmark_button')
|
||||||
|
@ -240,7 +245,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
id_ = widget.connect('row_expanded', self.on_list_treeview_row_expanded)
|
id_ = widget.connect('row_expanded', self.on_list_treeview_row_expanded)
|
||||||
self.handlers[id_] = widget
|
self.handlers[id_] = widget
|
||||||
|
|
||||||
id_ = widget.connect('row_collapsed', self.on_list_treeview_row_collapsed)
|
id_ = widget.connect('row_collapsed',
|
||||||
|
self.on_list_treeview_row_collapsed)
|
||||||
self.handlers[id_] = widget
|
self.handlers[id_] = widget
|
||||||
|
|
||||||
id_ = widget.connect('row_activated',
|
id_ = widget.connect('row_activated',
|
||||||
|
@ -348,7 +354,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
if gajim.config.get('avatar_position_in_roster') == 'left':
|
if gajim.config.get('avatar_position_in_roster') == 'left':
|
||||||
add_avatar_renderer()
|
add_avatar_renderer()
|
||||||
|
|
||||||
renderer_image = cell_renderer_image.CellRendererImage(0, 0) # status img
|
# status img
|
||||||
|
renderer_image = cell_renderer_image.CellRendererImage(0, 0)
|
||||||
renderer_image.set_property('width', 26)
|
renderer_image.set_property('width', 26)
|
||||||
column.pack_start(renderer_image, expand=False)
|
column.pack_start(renderer_image, expand=False)
|
||||||
column.add_attribute(renderer_image, 'image', C_IMG)
|
column.add_attribute(renderer_image, 'image', C_IMG)
|
||||||
|
@ -442,7 +449,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.room_jid)):
|
self.room_jid)):
|
||||||
item = gtk.MenuItem(nick, use_underline=False)
|
item = gtk.MenuItem(nick, use_underline=False)
|
||||||
submenu.append(item)
|
submenu.append(item)
|
||||||
id_ = item.connect('activate', self.append_nick_in_msg_textview, nick)
|
id_ = item.connect('activate', self.append_nick_in_msg_textview,
|
||||||
|
nick)
|
||||||
self.handlers[id_] = item
|
self.handlers[id_] = item
|
||||||
|
|
||||||
menu.show_all()
|
menu.show_all()
|
||||||
|
@ -533,8 +541,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.attention_flag = False
|
self.attention_flag = False
|
||||||
# get active color from gtk
|
# get active color from gtk
|
||||||
color = self.parent_win.notebook.style.fg[gtk.STATE_ACTIVE]
|
color = self.parent_win.notebook.style.fg[gtk.STATE_ACTIVE]
|
||||||
elif chatstate == 'newmsg' and (not has_focus or not current_tab) and\
|
elif chatstate == 'newmsg' and (not has_focus or not current_tab) \
|
||||||
not self.attention_flag:
|
and not self.attention_flag:
|
||||||
color_name = gajim.config.get_per('themes', theme,
|
color_name = gajim.config.get_per('themes', theme,
|
||||||
'state_muc_msg_color')
|
'state_muc_msg_color')
|
||||||
if color_name:
|
if color_name:
|
||||||
|
@ -637,7 +645,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
subject = helpers.reduce_chars_newlines(self.subject, max_lines=2)
|
subject = helpers.reduce_chars_newlines(self.subject, max_lines=2)
|
||||||
subject = gobject.markup_escape_text(subject)
|
subject = gobject.markup_escape_text(subject)
|
||||||
subject_text = self.urlfinder.sub(self.make_href, subject)
|
subject_text = self.urlfinder.sub(self.make_href, subject)
|
||||||
subject_text = '<span %s>%s</span>' % (font_attrs_small, subject_text)
|
subject_text = '<span %s>%s</span>' % (font_attrs_small,
|
||||||
|
subject_text)
|
||||||
|
|
||||||
# tooltip must always hold ALL the subject
|
# tooltip must always hold ALL the subject
|
||||||
self.event_box.set_tooltip_text(self.subject)
|
self.event_box.set_tooltip_text(self.subject)
|
||||||
|
@ -807,7 +816,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
gajim.connections[self.account].connected > 2):
|
gajim.connections[self.account].connected > 2):
|
||||||
if no_queue: # We didn't have a queue: we change icons
|
if no_queue: # We didn't have a queue: we change icons
|
||||||
model = self.list_treeview.get_model()
|
model = self.list_treeview.get_model()
|
||||||
state_images =\
|
state_images = \
|
||||||
gajim.interface.roster.get_appropriate_state_images(
|
gajim.interface.roster.get_appropriate_state_images(
|
||||||
self.room_jid, icon_name='event')
|
self.room_jid, icon_name='event')
|
||||||
image = state_images['event']
|
image = state_images['event']
|
||||||
|
@ -821,8 +830,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.list_treeview.expand_row(path[0:1], False)
|
self.list_treeview.expand_row(path[0:1], False)
|
||||||
self.list_treeview.scroll_to_cell(path)
|
self.list_treeview.scroll_to_cell(path)
|
||||||
self.list_treeview.set_cursor(path)
|
self.list_treeview.set_cursor(path)
|
||||||
contact = gajim.contacts.get_contact_with_highest_priority(self.account, \
|
contact = gajim.contacts.get_contact_with_highest_priority(
|
||||||
self.room_jid)
|
self.account, self.room_jid)
|
||||||
if contact:
|
if contact:
|
||||||
gajim.interface.roster.draw_contact(self.room_jid, self.account)
|
gajim.interface.roster.draw_contact(self.room_jid, self.account)
|
||||||
|
|
||||||
|
@ -939,8 +948,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
def get_nb_unread_pm(self):
|
def get_nb_unread_pm(self):
|
||||||
nb = 0
|
nb = 0
|
||||||
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):
|
||||||
nb += len(gajim.events.get_events(self.account, self.room_jid + '/' + \
|
nb += len(gajim.events.get_events(self.account, self.room_jid + \
|
||||||
nick, ['pm']))
|
'/' + nick, ['pm']))
|
||||||
return nb
|
return nb
|
||||||
|
|
||||||
def highlighting_for_message(self, text, tim):
|
def highlighting_for_message(self, text, tim):
|
||||||
|
@ -974,7 +983,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
does not already have it as last event. If it goes to add this line
|
does not already have it as last event. If it goes to add this line
|
||||||
- remove previous line first
|
- remove previous line first
|
||||||
"""
|
"""
|
||||||
win = gajim.interface.msg_win_mgr.get_window(self.room_jid, self.account)
|
win = gajim.interface.msg_win_mgr.get_window(self.room_jid,
|
||||||
|
self.account)
|
||||||
if win and self.room_jid == win.get_active_jid() and\
|
if win and self.room_jid == win.get_active_jid() and\
|
||||||
win.window.get_property('has-toplevel-focus') and\
|
win.window.get_property('has-toplevel-focus') and\
|
||||||
self.parent_win.get_active_control() == self:
|
self.parent_win.get_active_control() == self:
|
||||||
|
@ -1033,8 +1043,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
for nick in nick_list:
|
for nick in nick_list:
|
||||||
# Update pm chat window
|
# Update pm chat window
|
||||||
fjid = self.room_jid + '/' + nick
|
fjid = self.room_jid + '/' + nick
|
||||||
gc_contact = gajim.contacts.get_gc_contact(self.account, self.room_jid,
|
gc_contact = gajim.contacts.get_gc_contact(self.account,
|
||||||
nick)
|
self.room_jid, nick)
|
||||||
|
|
||||||
ctrl = gajim.interface.msg_win_mgr.get_control(fjid, self.account)
|
ctrl = gajim.interface.msg_win_mgr.get_control(fjid, self.account)
|
||||||
if ctrl:
|
if ctrl:
|
||||||
|
@ -1060,7 +1070,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
if self.autorejoin is None and gajim.account_is_connected(self.account):
|
if self.autorejoin is None and gajim.account_is_connected(self.account):
|
||||||
ar_to = gajim.config.get('muc_autorejoin_timeout')
|
ar_to = gajim.config.get('muc_autorejoin_timeout')
|
||||||
if ar_to:
|
if ar_to:
|
||||||
self.autorejoin = gobject.timeout_add_seconds(ar_to, self.rejoin)
|
self.autorejoin = gobject.timeout_add_seconds(ar_to,
|
||||||
|
self.rejoin)
|
||||||
|
|
||||||
def rejoin(self):
|
def rejoin(self):
|
||||||
if not self.autorejoin:
|
if not self.autorejoin:
|
||||||
|
@ -1073,8 +1084,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
def draw_roster(self):
|
def draw_roster(self):
|
||||||
self.list_treeview.get_model().clear()
|
self.list_treeview.get_model().clear()
|
||||||
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,
|
gc_contact = gajim.contacts.get_gc_contact(self.account,
|
||||||
nick)
|
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,
|
||||||
gc_contact.affiliation, gc_contact.status, gc_contact.jid)
|
gc_contact.affiliation, gc_contact.status, gc_contact.jid)
|
||||||
self.draw_all_roles()
|
self.draw_all_roles()
|
||||||
|
@ -1108,7 +1119,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
gc_contact = gajim.contacts.get_gc_contact(self.account, self.room_jid,
|
gc_contact = gajim.contacts.get_gc_contact(self.account, self.room_jid,
|
||||||
nick)
|
nick)
|
||||||
state_images = gajim.interface.jabber_state_images['16']
|
state_images = gajim.interface.jabber_state_images['16']
|
||||||
if len(gajim.events.get_events(self.account, self.room_jid + '/' + nick)):
|
if len(gajim.events.get_events(self.account, self.room_jid + '/' + \
|
||||||
|
nick)):
|
||||||
image = state_images['event']
|
image = state_images['event']
|
||||||
else:
|
else:
|
||||||
image = state_images[gc_contact.show]
|
image = state_images[gc_contact.show]
|
||||||
|
@ -1129,9 +1141,11 @@ class GroupchatControl(ChatControlBase):
|
||||||
# escape markup entities and make them small italic and fg color
|
# escape markup entities and make them small italic and fg color
|
||||||
color = gtkgui_helpers.get_fade_color(self.list_treeview,
|
color = gtkgui_helpers.get_fade_color(self.list_treeview,
|
||||||
selected, focus)
|
selected, focus)
|
||||||
colorstring = "#%04x%04x%04x" % (color.red, color.green, color.blue)
|
colorstring = "#%04x%04x%04x" % (color.red, color.green,
|
||||||
|
color.blue)
|
||||||
name += ('\n<span size="small" style="italic" foreground="%s">'
|
name += ('\n<span size="small" style="italic" foreground="%s">'
|
||||||
'%s</span>') % (colorstring, gobject.markup_escape_text(status))
|
'%s</span>') % (colorstring, gobject.markup_escape_text(
|
||||||
|
status))
|
||||||
|
|
||||||
if image.get_storage_type() == gtk.IMAGE_PIXBUF and \
|
if image.get_storage_type() == gtk.IMAGE_PIXBUF and \
|
||||||
gc_contact.affiliation != 'none' and gajim.config.get(
|
gc_contact.affiliation != 'none' and gajim.config.get(
|
||||||
|
@ -1207,14 +1221,17 @@ class GroupchatControl(ChatControlBase):
|
||||||
nick_jid += ' (%s)' % simple_jid
|
nick_jid += ' (%s)' % simple_jid
|
||||||
|
|
||||||
# statusCode
|
# statusCode
|
||||||
# http://www.xmpp.org/extensions/xep-0045.html#registrar-statuscodes-init
|
# http://www.xmpp.org/extensions/xep-0045.html#registrar-statuscodes-\
|
||||||
|
# init
|
||||||
if statusCode:
|
if statusCode:
|
||||||
if '100' in statusCode:
|
if '100' in statusCode:
|
||||||
# Can be a message (see handle_event_gc_config_change in gajim.py)
|
# Can be a message (see handle_event_gc_config_change in
|
||||||
|
# gajim.py)
|
||||||
self.print_conversation(\
|
self.print_conversation(\
|
||||||
_('Any occupant is allowed to see your full JID'))
|
_('Any occupant is allowed to see your full JID'))
|
||||||
if '170' in statusCode:
|
if '170' in statusCode:
|
||||||
# Can be a message (see handle_event_gc_config_change in gajim.py)
|
# Can be a message (see handle_event_gc_config_change in
|
||||||
|
# gajim.py)
|
||||||
self.print_conversation(_('Room logging is enabled'))
|
self.print_conversation(_('Room logging is enabled'))
|
||||||
if '201' in statusCode:
|
if '201' in statusCode:
|
||||||
self.print_conversation(_('A new room has been created'))
|
self.print_conversation(_('A new room has been created'))
|
||||||
|
@ -1230,9 +1247,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
'nick': nick,
|
'nick': nick,
|
||||||
'reason': reason }
|
'reason': reason }
|
||||||
else:
|
else:
|
||||||
s = _('%(nick)s has been kicked by %(who)s: %(reason)s') % {
|
s = _('%(nick)s has been kicked by %(who)s: '
|
||||||
'nick': nick,
|
'%(reason)s') % {'nick': nick, 'who': actor,
|
||||||
'who': actor,
|
|
||||||
'reason': reason }
|
'reason': reason }
|
||||||
self.print_conversation(s, 'info', tim=tim, graphics=False)
|
self.print_conversation(s, 'info', tim=tim, graphics=False)
|
||||||
if nick == self.nick and not gajim.config.get(
|
if nick == self.nick and not gajim.config.get(
|
||||||
|
@ -1241,12 +1257,10 @@ class GroupchatControl(ChatControlBase):
|
||||||
elif '301' in statusCode:
|
elif '301' in statusCode:
|
||||||
if actor is None: # do not print 'banned by None'
|
if actor is None: # do not print 'banned by None'
|
||||||
s = _('%(nick)s has been banned: %(reason)s') % {
|
s = _('%(nick)s has been banned: %(reason)s') % {
|
||||||
'nick': nick,
|
'nick': nick, 'reason': reason }
|
||||||
'reason': reason }
|
|
||||||
else:
|
else:
|
||||||
s = _('%(nick)s has been banned by %(who)s: %(reason)s') % {
|
s = _('%(nick)s has been banned by %(who)s: '
|
||||||
'nick': nick,
|
'%(reason)s') % { 'nick': nick, 'who': actor,
|
||||||
'who': actor,
|
|
||||||
'reason': reason }
|
'reason': reason }
|
||||||
self.print_conversation(s, 'info', tim=tim, graphics=False)
|
self.print_conversation(s, 'info', tim=tim, graphics=False)
|
||||||
if nick == self.nick:
|
if nick == self.nick:
|
||||||
|
@ -1262,24 +1276,25 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.room_jid)
|
self.room_jid)
|
||||||
for nick_ in nick_list:
|
for nick_ in nick_list:
|
||||||
fjid_ = self.room_jid + '/' + nick_
|
fjid_ = self.room_jid + '/' + nick_
|
||||||
ctrl = gajim.interface.msg_win_mgr.get_control(fjid_,
|
ctrl = gajim.interface.msg_win_mgr.get_control(
|
||||||
self.account)
|
fjid_, self.account)
|
||||||
if ctrl and ctrl.session and \
|
if ctrl and ctrl.session and \
|
||||||
ctrl.session.enable_encryption:
|
ctrl.session.enable_encryption:
|
||||||
thread_id = ctrl.session.thread_id
|
thread_id = ctrl.session.thread_id
|
||||||
ctrl.session.terminate_e2e()
|
ctrl.session.terminate_e2e()
|
||||||
gajim.connections[self.account].delete_session(fjid_,
|
gajim.connections[self.account].delete_session(
|
||||||
thread_id)
|
fjid_, thread_id)
|
||||||
ctrl.no_autonegotiation = False
|
ctrl.no_autonegotiation = False
|
||||||
else:
|
else:
|
||||||
s = _('%(nick)s is now known as %(new_nick)s') % {
|
s = _('%(nick)s is now known as %(new_nick)s') % {
|
||||||
'nick': nick, 'new_nick': new_nick}
|
'nick': nick, 'new_nick': new_nick}
|
||||||
# We add new nick to muc roster here, so we don't see
|
# We add new nick to muc roster here, so we don't see
|
||||||
# that "new_nick has joined the room" when he just changed nick.
|
# that "new_nick has joined the room" when he just changed
|
||||||
|
# nick.
|
||||||
# add_contact_to_roster will be called a second time
|
# add_contact_to_roster will be called a second time
|
||||||
# after that, but that doesn't hurt
|
# after that, but that doesn't hurt
|
||||||
self.add_contact_to_roster(new_nick, show, role, affiliation,
|
self.add_contact_to_roster(new_nick, show, role,
|
||||||
status, jid)
|
affiliation, status, jid)
|
||||||
if nick in self.attention_list:
|
if nick in self.attention_list:
|
||||||
self.attention_list.remove(nick)
|
self.attention_list.remove(nick)
|
||||||
# keep nickname color
|
# keep nickname color
|
||||||
|
@ -1290,7 +1305,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
puny_jid = helpers.sanitize_filename(self.room_jid)
|
puny_jid = helpers.sanitize_filename(self.room_jid)
|
||||||
puny_nick = helpers.sanitize_filename(nick)
|
puny_nick = helpers.sanitize_filename(nick)
|
||||||
puny_new_nick = helpers.sanitize_filename(new_nick)
|
puny_new_nick = helpers.sanitize_filename(new_nick)
|
||||||
old_path = os.path.join(gajim.VCARD_PATH, puny_jid, puny_nick)
|
old_path = os.path.join(gajim.VCARD_PATH, puny_jid,
|
||||||
|
puny_nick)
|
||||||
new_path = os.path.join(gajim.VCARD_PATH, puny_jid,
|
new_path = os.path.join(gajim.VCARD_PATH, puny_jid,
|
||||||
puny_new_nick)
|
puny_new_nick)
|
||||||
files = {old_path: new_path}
|
files = {old_path: new_path}
|
||||||
|
@ -1301,22 +1317,26 @@ class GroupchatControl(ChatControlBase):
|
||||||
files[os.path.join(path, puny_nick + ext)] = \
|
files[os.path.join(path, puny_nick + ext)] = \
|
||||||
os.path.join(path, puny_new_nick + ext)
|
os.path.join(path, puny_new_nick + ext)
|
||||||
for old_file in files:
|
for old_file in files:
|
||||||
if os.path.exists(old_file) and old_file != files[old_file]:
|
if os.path.exists(old_file) and old_file != \
|
||||||
if os.path.exists(files[old_file]) and helpers.windowsify(
|
files[old_file]:
|
||||||
old_file) != helpers.windowsify(files[old_file]):
|
if os.path.exists(files[old_file]) and \
|
||||||
# Windows require this, but os.remove('test') will also
|
helpers.windowsify(old_file) != helpers.windowsify(
|
||||||
# remove 'TEST'
|
files[old_file]):
|
||||||
|
# Windows require this, but os.remove('test')
|
||||||
|
# will also remove 'TEST'
|
||||||
os.remove(files[old_file])
|
os.remove(files[old_file])
|
||||||
os.rename(old_file, files[old_file])
|
os.rename(old_file, files[old_file])
|
||||||
self.print_conversation(s, 'info', tim=tim, graphics=False)
|
self.print_conversation(s, 'info', tim=tim, graphics=False)
|
||||||
elif '321' in statusCode:
|
elif '321' in statusCode:
|
||||||
s = _('%(nick)s has been removed from the room (%(reason)s)') % {
|
s = _('%(nick)s has been removed from the room '
|
||||||
'nick': nick, 'reason': _('affiliation changed') }
|
'(%(reason)s)') % { 'nick': nick,
|
||||||
|
'reason': _('affiliation changed') }
|
||||||
self.print_conversation(s, 'info', tim=tim, graphics=False)
|
self.print_conversation(s, 'info', tim=tim, graphics=False)
|
||||||
elif '322' in statusCode:
|
elif '322' in statusCode:
|
||||||
s = _('%(nick)s has been removed from the room (%(reason)s)') % {
|
s = _('%(nick)s has been removed from the room '
|
||||||
'nick': nick,
|
'(%(reason)s)') % { 'nick': nick,
|
||||||
'reason': _('room configuration changed to members-only') }
|
'reason': _('room configuration changed to '
|
||||||
|
'members-only') }
|
||||||
self.print_conversation(s, 'info', tim=tim, graphics=False)
|
self.print_conversation(s, 'info', tim=tim, graphics=False)
|
||||||
elif '332' in statusCode:
|
elif '332' in statusCode:
|
||||||
s = _('%(nick)s has been removed from the room '
|
s = _('%(nick)s has been removed from the room '
|
||||||
|
@ -1420,17 +1440,17 @@ class GroupchatControl(ChatControlBase):
|
||||||
actual_role = self.get_role(nick)
|
actual_role = self.get_role(nick)
|
||||||
if role != actual_role:
|
if role != actual_role:
|
||||||
self.remove_contact(nick)
|
self.remove_contact(nick)
|
||||||
self.add_contact_to_roster(nick, show, role,
|
self.add_contact_to_roster(nick, show, role, affiliation,
|
||||||
affiliation, status, jid)
|
status, jid)
|
||||||
self.draw_role(actual_role)
|
self.draw_role(actual_role)
|
||||||
self.draw_role(role)
|
self.draw_role(role)
|
||||||
if actor:
|
if actor:
|
||||||
st = _('** Role of %(nick)s has been set to %(role)s by '
|
st = _('** Role of %(nick)s has been set to %(role)s '
|
||||||
'%(actor)s') % {'nick': nick_jid, 'role': role,
|
'by %(actor)s') % {'nick': nick_jid, 'role': role,
|
||||||
'actor': actor}
|
'actor': actor}
|
||||||
else:
|
else:
|
||||||
st = _('** Role of %(nick)s has been set to %(role)s') % {
|
st = _('** Role of %(nick)s has been set to '
|
||||||
'nick': nick_jid, 'role': role}
|
'%(role)s') % {'nick': nick_jid, 'role': role}
|
||||||
if reason:
|
if reason:
|
||||||
st += ' (%s)' % reason
|
st += ' (%s)' % reason
|
||||||
self.print_conversation(st, tim=tim, graphics=False)
|
self.print_conversation(st, tim=tim, graphics=False)
|
||||||
|
@ -1622,10 +1642,11 @@ class GroupchatControl(ChatControlBase):
|
||||||
for nick in nick_list:
|
for nick in nick_list:
|
||||||
# Update pm chat window
|
# Update pm chat window
|
||||||
fjid = self.room_jid + '/' + nick
|
fjid = self.room_jid + '/' + nick
|
||||||
ctrl = gajim.interface.msg_win_mgr.get_gc_control(fjid, self.account)
|
ctrl = gajim.interface.msg_win_mgr.get_gc_control(fjid,
|
||||||
|
self.account)
|
||||||
if ctrl:
|
if ctrl:
|
||||||
contact = gajim.contacts.get_gc_contact(self.account, self.room_jid,
|
contact = gajim.contacts.get_gc_contact(self.account,
|
||||||
nick)
|
self.room_jid, nick)
|
||||||
contact.show = 'offline'
|
contact.show = 'offline'
|
||||||
contact.status = ''
|
contact.status = ''
|
||||||
ctrl.update_ui()
|
ctrl.update_ui()
|
||||||
|
@ -1658,9 +1679,9 @@ class GroupchatControl(ChatControlBase):
|
||||||
includes = gajim.config.get('confirm_close_muc_rooms').split(' ')
|
includes = gajim.config.get('confirm_close_muc_rooms').split(' ')
|
||||||
excludes = gajim.config.get('noconfirm_close_muc_rooms').split(' ')
|
excludes = gajim.config.get('noconfirm_close_muc_rooms').split(' ')
|
||||||
# whether to ask for comfirmation before closing muc
|
# whether to ask for comfirmation before closing muc
|
||||||
if (gajim.config.get('confirm_close_muc') or self.room_jid in includes) \
|
if (gajim.config.get('confirm_close_muc') or self.room_jid in includes)\
|
||||||
and gajim.gc_connected[self.account][self.room_jid] and self.room_jid not\
|
and gajim.gc_connected[self.account][self.room_jid] and self.room_jid \
|
||||||
in excludes:
|
not in excludes:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -1677,9 +1698,9 @@ class GroupchatControl(ChatControlBase):
|
||||||
includes = gajim.config.get('confirm_close_muc_rooms').split(' ')
|
includes = gajim.config.get('confirm_close_muc_rooms').split(' ')
|
||||||
excludes = gajim.config.get('noconfirm_close_muc_rooms').split(' ')
|
excludes = gajim.config.get('noconfirm_close_muc_rooms').split(' ')
|
||||||
# whether to ask for comfirmation before closing muc
|
# whether to ask for comfirmation before closing muc
|
||||||
if (gajim.config.get('confirm_close_muc') or self.room_jid in includes) \
|
if (gajim.config.get('confirm_close_muc') or self.room_jid in includes)\
|
||||||
and gajim.gc_connected[self.account][self.room_jid] and self.room_jid not\
|
and gajim.gc_connected[self.account][self.room_jid] and self.room_jid \
|
||||||
in excludes:
|
not in excludes:
|
||||||
|
|
||||||
def on_ok(clicked):
|
def on_ok(clicked):
|
||||||
if clicked:
|
if clicked:
|
||||||
|
@ -1730,7 +1751,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
def on_ok(subject):
|
def on_ok(subject):
|
||||||
# Note, we don't update self.subject since we don't know whether it
|
# Note, we don't update self.subject since we don't know whether it
|
||||||
# will work yet
|
# will work yet
|
||||||
gajim.connections[self.account].send_gc_subject(self.room_jid, subject)
|
gajim.connections[self.account].send_gc_subject(self.room_jid,
|
||||||
|
subject)
|
||||||
|
|
||||||
dialogs.InputTextDialog(_('Changing Subject'),
|
dialogs.InputTextDialog(_('Changing Subject'),
|
||||||
_('Please specify the new subject:'), input_str=self.subject,
|
_('Please specify the new subject:'), input_str=self.subject,
|
||||||
|
@ -1747,14 +1769,16 @@ class GroupchatControl(ChatControlBase):
|
||||||
prompt, change_nick=True)
|
prompt, change_nick=True)
|
||||||
|
|
||||||
def _on_configure_room_menuitem_activate(self, widget):
|
def _on_configure_room_menuitem_activate(self, widget):
|
||||||
c = gajim.contacts.get_gc_contact(self.account, self.room_jid, self.nick)
|
c = gajim.contacts.get_gc_contact(self.account, self.room_jid,
|
||||||
|
self.nick)
|
||||||
if c.affiliation == 'owner':
|
if c.affiliation == 'owner':
|
||||||
gajim.connections[self.account].request_gc_config(self.room_jid)
|
gajim.connections[self.account].request_gc_config(self.room_jid)
|
||||||
elif c.affiliation == 'admin':
|
elif c.affiliation == 'admin':
|
||||||
if self.room_jid not in gajim.interface.instances[self.account][
|
if self.room_jid not in gajim.interface.instances[self.account][
|
||||||
'gc_config']:
|
'gc_config']:
|
||||||
gajim.interface.instances[self.account]['gc_config'][self.room_jid]\
|
gajim.interface.instances[self.account]['gc_config'][
|
||||||
= config.GroupchatConfigWindow(self.account, self.room_jid)
|
self.room_jid] = config.GroupchatConfigWindow(self.account,
|
||||||
|
self.room_jid)
|
||||||
|
|
||||||
def _on_destroy_room_menuitem_activate(self, widget):
|
def _on_destroy_room_menuitem_activate(self, widget):
|
||||||
def on_ok(reason, jid):
|
def on_ok(reason, jid):
|
||||||
|
@ -1766,8 +1790,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
dialogs.ErrorDialog(_('Invalid group chat Jabber ID'),
|
dialogs.ErrorDialog(_('Invalid group chat Jabber ID'),
|
||||||
_('The group chat Jabber ID has not allowed characters.'))
|
_('The group chat Jabber ID has not allowed characters.'))
|
||||||
return
|
return
|
||||||
gajim.connections[self.account].destroy_gc_room(self.room_jid, reason,
|
gajim.connections[self.account].destroy_gc_room(self.room_jid,
|
||||||
jid)
|
reason, jid)
|
||||||
|
|
||||||
# Ask for a reason
|
# Ask for a reason
|
||||||
dialogs.DoubleInputDialog(_('Destroying %s') % self.room_jid,
|
dialogs.DoubleInputDialog(_('Destroying %s') % self.room_jid,
|
||||||
|
@ -1780,7 +1804,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
Bookmark the room, without autojoin and not minimized
|
Bookmark the room, without autojoin and not minimized
|
||||||
"""
|
"""
|
||||||
password = gajim.gc_passwords.get(self.room_jid, '')
|
password = gajim.gc_passwords.get(self.room_jid, '')
|
||||||
gajim.interface.add_gc_bookmark(self.account, self.name, self.room_jid, \
|
gajim.interface.add_gc_bookmark(self.account, self.name, self.room_jid,\
|
||||||
'0', '0', password, self.nick)
|
'0', '0', password, self.nick)
|
||||||
|
|
||||||
def _on_drag_data_received(self, widget, context, x, y, selection,
|
def _on_drag_data_received(self, widget, context, x, y, selection,
|
||||||
|
@ -1824,9 +1848,10 @@ class GroupchatControl(ChatControlBase):
|
||||||
|
|
||||||
# HACK: Not the best soltution.
|
# HACK: Not the best soltution.
|
||||||
if (text.startswith(self.COMMAND_PREFIX) and not
|
if (text.startswith(self.COMMAND_PREFIX) and not
|
||||||
text.startswith(self.COMMAND_PREFIX * 2) and len(splitted_text) == 1):
|
text.startswith(self.COMMAND_PREFIX * 2) and \
|
||||||
return super(GroupchatControl,
|
len(splitted_text) == 1):
|
||||||
self).handle_message_textview_mykey_press(widget, event_keyval,
|
return super(GroupchatControl, self).\
|
||||||
|
handle_message_textview_mykey_press(widget, event_keyval,
|
||||||
event_keymod)
|
event_keymod)
|
||||||
|
|
||||||
# nick completion
|
# nick completion
|
||||||
|
@ -1848,8 +1873,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
if len(self.nick_hits) and self.last_key_tabs and \
|
if len(self.nick_hits) and self.last_key_tabs and \
|
||||||
text[:-after_nick_len].endswith(self.nick_hits[0]):
|
text[:-after_nick_len].endswith(self.nick_hits[0]):
|
||||||
# we should cycle
|
# we should cycle
|
||||||
# Previous nick in list may had a space inside, so we check text and
|
# Previous nick in list may had a space inside, so we check text
|
||||||
# not splitted_text and store it into 'begin' var
|
# and not splitted_text and store it into 'begin' var
|
||||||
self.nick_hits.append(self.nick_hits[0])
|
self.nick_hits.append(self.nick_hits[0])
|
||||||
begin = self.nick_hits.pop(0)
|
begin = self.nick_hits.pop(0)
|
||||||
else:
|
else:
|
||||||
|
@ -1894,8 +1919,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
|
|
||||||
message_buffer.delete(start_iter, end_iter)
|
message_buffer.delete(start_iter, end_iter)
|
||||||
# get a shell-like completion
|
# get a shell-like completion
|
||||||
# if there's more than one nick for this completion, complete only
|
# if there's more than one nick for this completion, complete
|
||||||
# the part that all these nicks have in common
|
# only the part that all these nicks have in common
|
||||||
if gajim.config.get('shell_like_completion') and \
|
if gajim.config.get('shell_like_completion') and \
|
||||||
len(self.nick_hits) > 1:
|
len(self.nick_hits) > 1:
|
||||||
end = False
|
end = False
|
||||||
|
@ -1909,7 +1934,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
completion = completion[:-1]
|
completion = completion[:-1]
|
||||||
break
|
break
|
||||||
# if the current nick matches a COMPLETE existing nick,
|
# if the current nick matches a COMPLETE existing nick,
|
||||||
# and if the user tab TWICE, complete that nick (with the "add")
|
# and if the user tab TWICE, complete that nick (with the
|
||||||
|
# "add")
|
||||||
if self.last_key_tabs:
|
if self.last_key_tabs:
|
||||||
for nick in self.nick_hits:
|
for nick in self.nick_hits:
|
||||||
if nick == completion:
|
if nick == completion:
|
||||||
|
@ -2023,23 +2049,27 @@ class GroupchatControl(ChatControlBase):
|
||||||
item = xml.get_object('member_checkmenuitem')
|
item = xml.get_object('member_checkmenuitem')
|
||||||
item.set_active(target_affiliation != 'none')
|
item.set_active(target_affiliation != 'none')
|
||||||
if not user_affiliation in ('admin', 'owner') or \
|
if not user_affiliation in ('admin', 'owner') or \
|
||||||
(user_affiliation != 'owner' and target_affiliation in ('admin', 'owner')):
|
(user_affiliation != 'owner' and target_affiliation in ('admin',
|
||||||
|
'owner')):
|
||||||
item.set_sensitive(False)
|
item.set_sensitive(False)
|
||||||
id_ = item.connect('activate', self.on_member_checkmenuitem_activate, jid)
|
id_ = item.connect('activate', self.on_member_checkmenuitem_activate,
|
||||||
|
jid)
|
||||||
self.handlers[id_] = item
|
self.handlers[id_] = item
|
||||||
|
|
||||||
item = xml.get_object('admin_checkmenuitem')
|
item = xml.get_object('admin_checkmenuitem')
|
||||||
item.set_active(target_affiliation in ('admin', 'owner'))
|
item.set_active(target_affiliation in ('admin', 'owner'))
|
||||||
if not user_affiliation == 'owner':
|
if not user_affiliation == 'owner':
|
||||||
item.set_sensitive(False)
|
item.set_sensitive(False)
|
||||||
id_ = item.connect('activate', self.on_admin_checkmenuitem_activate, jid)
|
id_ = item.connect('activate', self.on_admin_checkmenuitem_activate,
|
||||||
|
jid)
|
||||||
self.handlers[id_] = item
|
self.handlers[id_] = item
|
||||||
|
|
||||||
item = xml.get_object('owner_checkmenuitem')
|
item = xml.get_object('owner_checkmenuitem')
|
||||||
item.set_active(target_affiliation == 'owner')
|
item.set_active(target_affiliation == 'owner')
|
||||||
if not user_affiliation == 'owner':
|
if not user_affiliation == 'owner':
|
||||||
item.set_sensitive(False)
|
item.set_sensitive(False)
|
||||||
id_ = item.connect('activate', self.on_owner_checkmenuitem_activate, jid)
|
id_ = item.connect('activate', self.on_owner_checkmenuitem_activate,
|
||||||
|
jid)
|
||||||
self.handlers[id_] = item
|
self.handlers[id_] = item
|
||||||
|
|
||||||
item = xml.get_object('information_menuitem')
|
item = xml.get_object('information_menuitem')
|
||||||
|
@ -2216,8 +2246,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.tooltip.id = row
|
self.tooltip.id = row
|
||||||
nick = model[iter_][C_NICK].decode('utf-8')
|
nick = model[iter_][C_NICK].decode('utf-8')
|
||||||
self.tooltip.timeout = gobject.timeout_add(500,
|
self.tooltip.timeout = gobject.timeout_add(500,
|
||||||
self.show_tooltip, gajim.contacts.get_gc_contact(account,
|
self.show_tooltip, gajim.contacts.get_gc_contact(
|
||||||
self.room_jid, nick))
|
account, self.room_jid, nick))
|
||||||
|
|
||||||
def on_list_treeview_leave_notify_event(self, widget, event):
|
def on_list_treeview_leave_notify_event(self, widget, event):
|
||||||
props = widget.get_path_at_pos(int(event.x), int(event.y))
|
props = widget.get_path_at_pos(int(event.x), int(event.y))
|
||||||
|
@ -2274,8 +2304,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
Ban a user
|
Ban a user
|
||||||
"""
|
"""
|
||||||
def on_ok(reason):
|
def on_ok(reason):
|
||||||
gajim.connections[self.account].gc_set_affiliation(self.room_jid, jid,
|
gajim.connections[self.account].gc_set_affiliation(self.room_jid,
|
||||||
'outcast', reason)
|
jid, 'outcast', reason)
|
||||||
|
|
||||||
# to ban we know the real jid. so jid is not fakejid
|
# to ban we know the real jid. so jid is not fakejid
|
||||||
nick = gajim.get_nick_from_jid(jid)
|
nick = gajim.get_nick_from_jid(jid)
|
||||||
|
@ -2329,11 +2359,12 @@ class GroupchatControl(ChatControlBase):
|
||||||
"""
|
"""
|
||||||
Call vcard_information_window class to display user's information
|
Call vcard_information_window class to display user's information
|
||||||
"""
|
"""
|
||||||
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)
|
||||||
contact = gc_contact.as_contact()
|
contact = gc_contact.as_contact()
|
||||||
if contact.jid in gajim.interface.instances[self.account]['infos']:
|
if contact.jid in gajim.interface.instances[self.account]['infos']:
|
||||||
gajim.interface.instances[self.account]['infos'][contact.jid].window.\
|
gajim.interface.instances[self.account]['infos'][contact.jid].\
|
||||||
present()
|
window.present()
|
||||||
else:
|
else:
|
||||||
gajim.interface.instances[self.account]['infos'][contact.jid] = \
|
gajim.interface.instances[self.account]['infos'][contact.jid] = \
|
||||||
vcard.VcardWindow(contact, self.account, gc_contact)
|
vcard.VcardWindow(contact, self.account, gc_contact)
|
||||||
|
|
Loading…
Reference in New Issue