Author: asterix
Date: 2007-04-25 17:54:58 +0200 (Wed, 25 Apr 2007)
New Revision: 8106
Modified:
trunk/data/glade/advanced_menuitem_menu.glade
trunk/data/glade/blocked_contacts_window.glade
trunk/data/glade/roster_contact_context_menu.glade
trunk/src/dialogs.py
trunk/src/roster_window.py
Log:
[roidelapluie] ability to block several contacts in the same time. fixes #3128
Modified: trunk/data/glade/advanced_menuitem_menu.glade
===================================================================
--- trunk/data/glade/advanced_menuitem_menu.glade 2007-04-25 14:32:32 UTC (rev 8105)
+++ trunk/data/glade/advanced_menuitem_menu.glade 2007-04-25 15:54:58 UTC (rev 8106)
@@ -11,7 +11,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1461">
+ <widget class="GtkImage" id="image1466">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@@ -32,11 +32,23 @@
</child>
<child>
- <widget class="GtkMenuItem" id="blocked_contacts_menuitem">
+ <widget class="GtkImageMenuItem" id="blocked_contacts_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">_Blocked Contacts</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_blocked_contacts_menuitem_activate" last_modification_time="Thu, 19 Apr 2007 15:32:47 GMT"/>
+
+ <child internal-child="image">
+ <widget class="GtkImage" id="image1467">
+ <property name="visible">True</property>
+ <property name="stock">gtk-stop</property>
+ <property name="icon_size">1</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
</widget>
</child>
@@ -67,7 +79,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1462">
+ <widget class="GtkImage" id="image1468">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@@ -109,7 +121,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1463">
+ <widget class="GtkImage" id="image1469">
<property name="visible">True</property>
<property name="stock">gtk-clear</property>
<property name="icon_size">1</property>
Modified: trunk/data/glade/blocked_contacts_window.glade
===================================================================
--- trunk/data/glade/blocked_contacts_window.glade 2007-04-25 14:32:32 UTC (rev 8105)
+++ trunk/data/glade/blocked_contacts_window.glade 2007-04-25 15:54:58 UTC (rev 8106)
@@ -50,6 +50,7 @@
<property name="fixed_height_mode">False</property>
<property name="hover_selection">False</property>
<property name="hover_expand">False</property>
+ <signal name="row_activated" handler="on_contacts_treeview_row_activated" last_modification_time="Wed, 25 Apr 2007 13:09:39 GMT"/>
</widget>
</child>
</widget>
@@ -65,11 +66,73 @@
<property name="border_width">3</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label">gtk-remove</property>
- <property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_remove_button_clicked" last_modification_time="Sun, 22 Apr 2007 14:02:48 GMT"/>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-remove</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label">_Unblock</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
Modified: trunk/data/glade/roster_contact_context_menu.glade
===================================================================
--- trunk/data/glade/roster_contact_context_menu.glade 2007-04-25 14:32:32 UTC (rev 8105)
+++ trunk/data/glade/roster_contact_context_menu.glade 2007-04-25 15:54:58 UTC (rev 8106)
@@ -12,7 +12,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1650">
+ <widget class="GtkImage" id="image1701">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
@@ -32,7 +32,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1651">
+ <widget class="GtkImage" id="image1702">
<property name="visible">True</property>
<property name="stock">gtk-go-up</property>
<property name="icon_size">1</property>
@@ -52,7 +52,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1652">
+ <widget class="GtkImage" id="image1703">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@@ -72,7 +72,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1653">
+ <widget class="GtkImage" id="image1704">
<property name="visible">True</property>
<property name="stock">gtk-go-back</property>
<property name="icon_size">1</property>
@@ -91,7 +91,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1654">
+ <widget class="GtkImage" id="image1705">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@@ -112,48 +112,6 @@
</child>
<child>
- <widget class="GtkImageMenuItem" id="block_menuitem">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Block</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="on_block_menuitem_activate" last_modification_time="Sun, 22 Apr 2007 10:35:33 GMT"/>
-
- <child internal-child="image">
- <widget class="GtkImage" id="image1655">
- <property name="visible">True</property>
- <property name="stock">gtk-stop</property>
- <property name="icon_size">1</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkImageMenuItem" id="unblock_menuitem">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Unblock</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="on_unblock_menuitem_activate" last_modification_time="Sun, 22 Apr 2007 12:08:00 GMT"/>
-
- <child internal-child="image">
- <widget class="GtkImage" id="image1656">
- <property name="visible">True</property>
- <property name="stock">gtk-stop</property>
- <property name="icon_size">1</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
<widget class="GtkSeparatorMenuItem" id="above_send_file_separator">
<property name="visible">True</property>
</widget>
@@ -166,7 +124,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1657">
+ <widget class="GtkImage" id="image1706">
<property name="visible">True</property>
<property name="stock">gtk-file</property>
<property name="icon_size">1</property>
@@ -186,7 +144,7 @@
<signal name="activate" handler="on_assign_openpgp_key_menuitem_activate" last_modification_time="Thu, 30 Jun 2005 22:57:59 GMT"/>
<child internal-child="image">
- <widget class="GtkImage" id="image1658">
+ <widget class="GtkImage" id="image1707">
<property name="visible">True</property>
<property name="stock">gtk-dialog-authentication</property>
<property name="icon_size">1</property>
@@ -206,7 +164,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1659">
+ <widget class="GtkImage" id="image1708">
<property name="visible">True</property>
<property name="stock">gtk-info</property>
<property name="icon_size">1</property>
@@ -226,7 +184,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1660">
+ <widget class="GtkImage" id="image1709">
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="icon_size">1</property>
@@ -251,7 +209,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1661">
+ <widget class="GtkImage" id="image1710">
<property name="visible">True</property>
<property name="stock">gtk-dialog-question</property>
<property name="icon_size">1</property>
@@ -272,7 +230,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1662">
+ <widget class="GtkImage" id="image1711">
<property name="visible">True</property>
<property name="stock">gtk-go-up</property>
<property name="icon_size">1</property>
@@ -292,7 +250,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1663">
+ <widget class="GtkImage" id="image1712">
<property name="visible">True</property>
<property name="stock">gtk-go-down</property>
<property name="icon_size">1</property>
@@ -312,7 +270,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1664">
+ <widget class="GtkImage" id="image1713">
<property name="visible">True</property>
<property name="stock">gtk-stop</property>
<property name="icon_size">1</property>
@@ -330,12 +288,54 @@
</child>
<child>
+ <widget class="GtkImageMenuItem" id="block_menuitem">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Block</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_block_menuitem_activate" last_modification_time="Sun, 22 Apr 2007 10:35:33 GMT"/>
+
+ <child internal-child="image">
+ <widget class="GtkImage" id="image1714">
+ <property name="visible">True</property>
+ <property name="stock">gtk-no</property>
+ <property name="icon_size">1</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkImageMenuItem" id="unblock_menuitem">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Unblock</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_unblock_menuitem_activate" last_modification_time="Sun, 22 Apr 2007 12:08:00 GMT"/>
+
+ <child internal-child="image">
+ <widget class="GtkImage" id="image1715">
+ <property name="visible">True</property>
+ <property name="stock">gtk-yes</property>
+ <property name="icon_size">1</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
<widget class="GtkImageMenuItem" id="add_to_roster_menuitem">
<property name="label" translatable="yes">_Add to Roster</property>
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1665">
+ <widget class="GtkImage" id="image1716">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@@ -354,7 +354,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1666">
+ <widget class="GtkImage" id="image1717">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
@@ -386,7 +386,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image1667">
+ <widget class="GtkImage" id="image1718">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property>
Modified: trunk/src/dialogs.py
===================================================================
--- trunk/src/dialogs.py 2007-04-25 14:32:32 UTC (rev 8105)
+++ trunk/src/dialogs.py 2007-04-25 15:54:58 UTC (rev 8106)
@@ -56,7 +56,7 @@
if len(list_) == 1:
contact = list_[0][0]
self.xml.get_widget('nickname_label').set_markup(
- _("Contact name: <i>%s</i>") % contact.get_shown_name())
+ _('Contact name: <i>%s</i>') % contact.get_shown_name())
self.xml.get_widget('jid_label').set_markup(
_('Jabber ID: <i>%s</i>') % contact.jid)
else:
@@ -2308,12 +2308,11 @@
self.remove_button = self.xml.get_widget('remove_button')
self.contacts_treeview = self.xml.get_widget('contacts_treeview')
renderer = gtk.CellRendererText()
-
self.store = gtk.ListStore(str)
self.contacts_treeview.set_model(self.store)
- column = gtk.TreeViewColumn("Contact", renderer, text=0)
+ column = gtk.TreeViewColumn('Contact', renderer, text=0)
self.contacts_treeview.append_column(column)
if len(gajim.connections) > 1:
@@ -2321,7 +2320,6 @@
else:
title = _('Blocked Contacts')
self.window.set_title(title)
-
self.window.show_all()
self.xml.signal_autoconnect(self)
gajim.connections[self.account].get_privacy_list('block')
@@ -2332,38 +2330,53 @@
del gajim.interface.instances[self.account][key_name]
def on_remove_button_clicked(self, widget):
- tags=[]
+ if self.contacts_treeview.get_selection().get_selected()[1] == None:
+ return
+ tags = []
rule_selected = self.store.get_path(
self.contacts_treeview.get_selection().get_selected()[1])[0]
for i in range(0,len(self.global_rules)):
if i != rule_selected:
tags.append(self.global_rules[i])
+ else:
+ deleted_rule = self.global_rules[i]
for rule in self.global_rules_to_append:
tags.append(rule)
gajim.connections[self.account].set_privacy_list(
'block', tags)
- gajim.connections[self.account].set_active_list('block')
- gajim.connections[self.account].set_default_list('block')
gajim.connections[self.account].get_privacy_list('block')
if len(tags) == 0:
self.privacy_list_received([])
gajim.connections[self.account].blocked_contacts = []
+ gajim.connections[self.account].blocked_groups = []
gajim.connections[self.account].blocked_list = []
gajim.connections[self.account].set_default_list('')
gajim.connections[self.account].set_active_list('')
gajim.connections[self.account].del_privacy_list('block')
-
+ status = gajim.connections[self.account].connected
+ msg = gajim.connections[self.account].status
+ show = gajim.SHOW_LIST[gajim.connections[self.account].connected]
+ if deleted_rule['type'] == 'jid':
+ gajim.connections[self.account].send_custom_status(show, msg,
+ deleted_rule['value'])
+ else:
+ for jid in gajim.contacts.get_jid_list(self.account):
+ contact = gajim.contacts.get_contact_with_highest_priority(
+ self.account, jid)
+ if deleted_rule['value'] in contact.groups:
+ gajim.connections[self.account].send_custom_status(show, msg,
+ contact.jid)
def privacy_list_received(self, rules):
self.store.clear()
self.global_rules = []
self.global_rules_to_append = []
for rule in rules:
- if rule['type'] == "jid" and rule['action'] == "deny":
+ if rule['type'] == 'jid' and rule['action'] == 'deny':
#self.global_rules[text_item] = rule
self.store.append([rule['value']])
self.global_rules.append(rule)
- elif rule['type'] == "group" and rule['action'] == "deny":
+ elif rule['type'] == 'group' and rule['action'] == 'deny':
text_item = _('Group %s') % rule['value']
self.store.append([text_item])
self.global_rules.append(rule)
Modified: trunk/src/roster_window.py
===================================================================
--- trunk/src/roster_window.py 2007-04-25 14:32:32 UTC (rev 8105)
+++ trunk/src/roster_window.py 2007-04-25 15:54:58 UTC (rev 8106)
@@ -1425,6 +1425,7 @@
on_response_ok = (remove, list_))
def on_block(self, widget, iter, blockedlist):
+ ''' When clicked on the 'block' button in context menu. '''
model = self.tree.get_model()
accounts = []
if blockedlist == None:
@@ -1435,50 +1436,86 @@
self.send_status(account, 'offline', msg, to = jid)
new_rule = {'order': u'1', 'type': u'jid', 'action': u'deny',
'value' : jid, 'child': [u'message', u'iq', u'presence-out']}
+ gajim.connections[account].blocked_list.append(new_rule)
else:
- model = self.tree.get_model()
- group = model[iter][C_JID].decode('utf-8')
msg = self.get_status_message('offline')
- for (contact, account) in blockedlist:
- if account not in accounts:
- if gajim.connections[account].privacy_rules_supported:
- accounts.append(account)
+ if iter == None:
+ for (contact, account) in blockedlist:
+ if account not in accounts:
+ if gajim.connections[account].privacy_rules_supported:
+ accounts.append(account)
+ self.send_status(account, 'offline', msg, to = contact.jid)
+ new_rule = {'order': u'1', 'type': u'jid',
+ 'action': u'deny', 'value' : contact.jid,
+ 'child': [u'message', u'iq', u'presence-out']}
+ gajim.connections[account].blocked_list.append(new_rule)
+ else:
self.send_status(account, 'offline', msg, to = contact.jid)
- else:
- self.send_status(account, 'offline', msg, to = contact.jid)
- new_rule = {'order': u'1', 'type': u'group', 'action': u'deny',
- 'value' : group, 'child': [u'message', u'iq', u'presence-out']}
- for account in accounts:
- gajim.connections[account].blocked_list.append(new_rule)
- gajim.connections[account].set_privacy_list(
+ new_rule = {'order': u'1', 'type': u'jid',
+ 'action': u'deny', 'value' : contact.jid,
+ 'child': [u'message', u'iq', u'presence-out']}
+ gajim.connections[account].blocked_list.append(new_rule)
+ else:
+ group = model[iter][C_JID].decode('utf-8')
+ msg = self.get_status_message('offline')
+ for (contact, account) in blockedlist:
+ if account not in accounts:
+ if gajim.connections[account].privacy_rules_supported:
+ accounts.append(account)
+ self.send_status(account, 'offline', msg, to = contact.jid)
+ else:
+ self.send_status(account, 'offline', msg, to = contact.jid)
+ new_rule = {'order': u'1', 'type': u'group', 'action': u'deny',
+ 'value' : group, 'child': [u'message', u'iq', u'presence-out']}
+ gajim.connections[account].blocked_list.append(new_rule)
+ for account in accounts:
+ gajim.connections[account].set_privacy_list(
'block', gajim.connections[account].blocked_list)
if len(gajim.connections[account].blocked_list) == 1:
gajim.connections[account].set_active_list('block')
gajim.connections[account].set_default_list('block')
gajim.connections[account].get_privacy_list('block')
- def on_unblock(self, widget, iter, blockedlist):
+ def on_unblock(self, widget, iter, group_list):
+ ''' When clicked on the 'unblock' button in context menu. '''
model = self.tree.get_model()
accounts = []
- if blockedlist == None:
+ if group_list == None:
jid = model[iter][C_JID].decode('utf-8')
jid_account = model[iter][C_ACCOUNT].decode('utf-8')
accounts.append(jid_account)
gajim.connections[jid_account].new_blocked_list = []
for rule in gajim.connections[jid_account].blocked_list:
- if rule['action'] != 'deny' or rule['type'] != 'jid' or rule['value'] != jid:
+ if rule['action'] != 'deny' or rule['type'] != 'jid' \
+ or rule['value'] != jid:
gajim.connections[jid_account].new_blocked_list.append(rule)
else:
- model = self.tree.get_model()
- group = model[iter][C_JID].decode('utf-8')
- for (contact, account) in blockedlist:
- if account not in accounts:
- if gajim.connections[account].privacy_rules_supported:
- accounts.append(account)
- gajim.connections[account].new_blocked_list = []
- for rule in gajim.connections[account].blocked_list:
- if rule['action'] != 'deny' or rule['type'] != 'group' or rule['value'] != group:
- gajim.connections[account].new_blocked_list.append(rule)
+ if iter == None:
+ for (contact, account) in group_list:
+ if account not in accounts:
+ if gajim.connections[account].privacy_rules_supported:
+ accounts.append(account)
+ gajim.connections[account].new_blocked_list = []
+ gajim.connections[account].to_unblock = []
+ gajim.connections[account].to_unblock.append(contact.jid)
+ else:
+ gajim.connections[account].to_unblock.append(contact.jid)
+ for account in accounts:
+ for rule in gajim.connections[account].blocked_list:
+ if rule['action'] != 'deny' or rule['type'] != 'jid' \
+ or rule['value'] not in gajim.connections[account].to_unblock:
+ gajim.connections[account].new_blocked_list.append(rule)
+ else:
+ group = model[iter][C_JID].decode('utf-8')
+ for (contact, account) in group_list:
+ if account not in accounts:
+ if gajim.connections[account].privacy_rules_supported:
+ accounts.append(account)
+ gajim.connections[account].new_blocked_list = []
+ for rule in gajim.connections[account].blocked_list:
+ if rule['action'] != 'deny' or rule['type'] != 'group' \
+ or rule['value'] != group:
+ gajim.connections[account].new_blocked_list.append(rule)
for account in accounts:
gajim.connections[account].set_privacy_list(
'block', gajim.connections[account].new_blocked_list)
@@ -1490,7 +1527,10 @@
gajim.connections[account].set_default_list('')
gajim.connections[account].set_active_list('')
gajim.connections[account].del_privacy_list('block')
- if blockedlist == None:
+ if gajim.interface.instances[account].has_key('blocked_contacts'):
+ gajim.interface.instances[account]['blocked_contacts'].\
+ privacy_list_received([])
+ if group_list == None:
status = gajim.connections[jid_account].connected
msg = gajim.connections[jid_account].status
if not self.regroup:
@@ -1499,7 +1539,7 @@
show = helpers.get_global_show()
self.send_status(jid_account, show, msg, to = jid)
else:
- for (contact, account) in blockedlist:
+ for (contact, account) in group_list:
if not self.regroup:
show = gajim.SHOW_LIST[gajim.connections[account].connected]
else: # accounts merged
@@ -2146,6 +2186,7 @@
connected_accounts = []
contacts_transport = -1
# -1 is at start, False when not from the same, None when jabber
+ is_blocked = True
for iter in iters:
jid = model[iter][C_JID].decode('utf-8')
account = model[iter][C_ACCOUNT].decode('utf-8')
@@ -2160,6 +2201,8 @@
contacts_transport = transport
if contacts_transport != transport:
contacts_transport = False
+ if jid not in gajim.connections[account].blocked_contacts:
+ is_blocked = False
list_.append((contact, account))
menu = gtk.Menu()
@@ -2229,6 +2272,18 @@
send_group_message_item.connect('activate',
self.on_send_single_message_menuitem_activate, account, list_)
+ if is_blocked:
+ unblock_menuitem = gtk.ImageMenuItem(_('_Unblock'))
+ icon = gtk.image_new_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_MENU)
+ unblock_menuitem.set_image(icon)
+ unblock_menuitem.connect('activate', self.on_unblock, None, list_)
+ menu.append(unblock_menuitem)
+ else:
+ block_menuitem = gtk.ImageMenuItem(_('_Block'))
+ icon = gtk.image_new_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_MENU)
+ block_menuitem.set_image(icon)
+ block_menuitem.connect('activate', self.on_block, None, list_)
+ menu.append(block_menuitem)
# unsensitive if one account is not connected
if one_account_offline:
remove_item.set_sensitive(False)
@@ -2330,13 +2385,13 @@
if group not in helpers.special_groups + (_('General'),):
if is_blocked:
unblock_menuitem = gtk.ImageMenuItem(_('_Unblock'))
- icon = gtk.image_new_from_stock(gtk.STOCK_STOP, gtk.ICON_SIZE_MENU)
+ icon = gtk.image_new_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_MENU)
unblock_menuitem.set_image(icon)
unblock_menuitem.connect('activate', self.on_unblock, iter, list_)
menu.append(unblock_menuitem)
else:
block_menuitem = gtk.ImageMenuItem(_('_Block'))
- icon = gtk.image_new_from_stock(gtk.STOCK_STOP, gtk.ICON_SIZE_MENU)
+ icon = gtk.image_new_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_MENU)
block_menuitem.set_image(icon)
block_menuitem.connect('activate', self.on_block, iter, list_)
menu.append(block_menuitem)