[roidelapluie & asterix] Privacy lists. Fixes #253

This commit is contained in:
Yann Leboulanger 2006-07-03 20:49:20 +00:00
parent d3d82f3e66
commit 96b21bbc6f
9 changed files with 1591 additions and 31 deletions

View file

@ -30,6 +30,13 @@
</widget> </widget>
</child> </child>
<child>
<widget class="GtkMenuItem" id="privacy_lists_menuitem">
<property name="label" translatable="yes">_Privacy Lists</property>
<property name="use_underline">True</property>
</widget>
</child>
<child> <child>
<widget class="GtkSeparatorMenuItem" id="separator8"> <widget class="GtkSeparatorMenuItem" id="separator8">
</widget> </widget>

View file

@ -0,0 +1,779 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkWindow" id="privacy_list_edit_window">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Privacy List</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<signal name="destroy" handler="on_privacy_list_edit_window_destroy" last_modification_time="Sun, 02 Jul 2006 22:34:41 GMT"/>
<child>
<widget class="GtkVBox" id="main_vbox">
<property name="width_request">600</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkHBox" id="title_hbox">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="privacy_lists_title_label">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;i&gt;Privacy List&lt;/i&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</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>
<child>
<widget class="GtkCheckButton" id="privacy_list_active_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Active</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_privacy_list_active_checkbutton_toggled" last_modification_time="Sat, 01 Jul 2006 13:09:51 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="privacy_list_default_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Default</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_privacy_list_default_checkbutton_toggled" last_modification_time="Sat, 01 Jul 2006 13:10:00 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHSeparator" id="title_hseparator">
<property name="visible">True</property>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="list_of_rules_label">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;List of rules&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</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">5</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="list_of_rules_combobox">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
<signal name="changed" handler="on_list_of_rules_combobox_changed" last_modification_time="Mon, 03 Jul 2006 20:44:19 GMT"/>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="delete_open_buttons_hbox">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">0</property>
<child>
<widget class="GtkButton" id="new_rule_button">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-add</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_new_rule_button_clicked" last_modification_time="Sat, 01 Jul 2006 13:09:03 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="delete_rule_button">
<property name="border_width">5</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_delete_rule_button_clicked" last_modification_time="Sat, 01 Jul 2006 13:08:57 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="open_rule_button">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-edit</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_open_rule_button_clicked" last_modification_time="Sat, 01 Jul 2006 13:08:50 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="add_edit_vbox">
<property name="border_width">5</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkHSeparator" id="edit_between_list_edit_hseparator">
<property name="visible">True</property>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="add_edit_rule_label">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Add / Edit a rule&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</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">5</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="edit_fields_hbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkVBox" id="edit_allow_deny_vbox">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">0</property>
<child>
<widget class="GtkRadioButton" id="edit_allow_radiobutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Allow</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="edit_deny_radiobutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Deny</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">edit_allow_radiobutton</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="edit_type_vbox">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">0</property>
<child>
<widget class="GtkHBox" id="edit_type_jabberid_hbox">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkRadioButton" id="edit_type_jabberid_radiobutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">JabberID</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="edit_type_jabberid_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">●</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="edit_type_group_hbox">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkRadioButton" id="edit_type_group_radiobutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">all in the group</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">edit_type_jabberid_radiobutton</property>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="edit_type_group_combobox">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="edit_type_subscription_hbox">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkRadioButton" id="edit_type_subscription_radiobutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">all by subscription</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">edit_type_jabberid_radiobutton</property>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="edit_type_subscription_combobox">
<property name="visible">True</property>
<property name="items" translatable="yes">none
both
from
to</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="edit_type_select_all_hbox">
<property name="border_width">10</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkRadioButton" id="edit_type_select_all_radiobutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">All</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">edit_type_jabberid_radiobutton</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="edit_items_vbox">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">0</property>
<child>
<widget class="GtkCheckButton" id="edit_send_messages_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">to send me messages</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="edit_queries_send_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">to send me queries</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="edit_send_status_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">to view my status</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="edit_view_status_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">to send me status</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="edit_order_new_save_buttons_hbox">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">0</property>
<child>
<widget class="GtkHBox" id="edit_order_hbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="edit_order_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Order:</property>
<property name="use_underline">False</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">5</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="edit_order_spinbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
<property name="digits">0</property>
<property name="numeric">False</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
<property name="adjustment">1 0 100 1 10 10</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="save_rule_button">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-save</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_save_rule_button_clicked" last_modification_time="Sat, 01 Jul 2006 13:08:40 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHSeparator" id="edit_last_buttons_separator">
<property name="visible">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="last_buttons_hbox">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">0</property>
<child>
<widget class="GtkButton" id="privacy_list_refresh_button">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-refresh</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_privacy_list_refresh_button_clicked" last_modification_time="Sat, 01 Jul 2006 13:09:35 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="privacy_list_close_button">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</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_privacy_list_close_button_clicked" last_modification_time="Sat, 01 Jul 2006 13:09:28 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View file

@ -0,0 +1,255 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkWindow" id="privacy_lists_first_window">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="title" translatable="yes">window1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<signal name="destroy" handler="on_privacy_lists_first_window_destroy" last_modification_time="Sun, 02 Jul 2006 20:56:21 GMT"/>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="Server-based_privacy_lists_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Server-based Privacy Lists</property>
<property name="use_underline">False</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">5</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>
<child>
<widget class="GtkComboBox" id="list_of_privacy_lists_combobox">
<property name="border_width">4</property>
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="buttons_hbox">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">0</property>
<child>
<widget class="GtkButton" id="delete_privacy_list_button">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-delete</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_delete_privacy_list_button_clicked" last_modification_time="Sun, 02 Jul 2006 16:47:54 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="open_privacy_list_button">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-open</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_open_privacy_list_button_clicked" last_modification_time="Sun, 02 Jul 2006 16:47:34 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHSeparator" id="hseparator1">
<property name="visible">True</property>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="create_privacy_list_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Create your own Privacy Lists</property>
<property name="use_underline">False</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">5</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>
<child>
<widget class="GtkEntry" id="new_privacy_list_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">●</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="padding">4</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="new_privacy_list_button">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-new</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_new_privacy_list_button_clicked" last_modification_time="Sun, 02 Jul 2006 16:47:16 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkHSeparator" id="hseparator2">
<property name="visible">True</property>
</widget>
<packing>
<property name="padding">5</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">0</property>
<child>
<widget class="GtkButton" id="privacy_lists_refresh_button">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-refresh</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_privacy_lists_refresh_button_clicked" last_modification_time="Sun, 02 Jul 2006 16:46:48 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="close_privacy_lists_window_button">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</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_close_button_clicked" last_modification_time="Sun, 02 Jul 2006 20:53:03 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View file

@ -217,6 +217,34 @@ class Connection(ConnectionHandlers):
else: else:
conf = data[1].asDict() conf = data[1].asDict()
self.dispatch('REGISTER_AGENT_INFO', (data[0], conf, is_form)) self.dispatch('REGISTER_AGENT_INFO', (data[0], conf, is_form))
elif realm == common.xmpp.NS_PRIVACY:
if event == common.xmpp.features_nb.PRIVACY_LISTS_RECEIVED:
# data is (list)
self.dispatch('PRIVACY_LISTS_RECEIVED', (data))
elif event == common.xmpp.features_nb.PRIVACY_LIST_RECEIVED:
# data is (resp)
if not data:
return
rules = []
name = data.getTag('query').getTag('list').getAttr('name')
for child in data.getTag('query').getTag('list').getChildren():
dict_item = child.getAttrs()
childs = []
if dict_item.has_key('type'):
for scnd_child in child.getChildren():
childs += [scnd_child.getName()]
rules.append({'action':dict_item['action'],
'type':dict_item['type'], 'order':dict_item['order'],
'value':dict_item['value'], 'child':childs})
else:
for scnd_child in child.getChildren():
childs.append(scnd_child.getName())
rules.append({'action':dict_item['action'],
'order':dict_item['order'], 'child':childs})
self.dispatch('PRIVACY_LIST_RECEIVED', (name, rules))
elif event == common.xmpp.features_nb.PRIVACY_LISTS_ACTIVE_DEFAULT:
# data is (dict)
self.dispatch('PRIVACY_LISTS_ACTIVE_DEFAULT', (data))
elif realm == '': elif realm == '':
if event == common.xmpp.transports.DATA_RECEIVED: if event == common.xmpp.transports.DATA_RECEIVED:
self.dispatch('STANZA_ARRIVED', unicode(data, errors = 'ignore')) self.dispatch('STANZA_ARRIVED', unicode(data, errors = 'ignore'))
@ -439,6 +467,41 @@ class Connection(ConnectionHandlers):
if kill_core and self.connected > 1: if kill_core and self.connected > 1:
self.disconnect(on_purpose = True) self.disconnect(on_purpose = True)
def get_privacy_lists(self):
if not self.connection:
return
common.xmpp.features_nb.getPrivacyLists(self.connection)
def get_active_default_lists(self):
if not self.connection:
return
common.xmpp.features_nb.getActiveAndDefaultPrivacyLists(self.connection)
def del_privacy_list(self, privacy_list):
if not self.connection:
return
common.xmpp.features_nb.delPrivacyList(self.connection, privacy_list)
def get_privacy_list(self, title):
if not self.connection:
return
common.xmpp.features_nb.getPrivacyList(self.connection, title)
def set_privacy_list(self, listname, tags):
if not self.connection:
return
common.xmpp.features_nb.setPrivacyList(self.connection, listname, tags)
def set_active_list(self, listname):
if not self.connection:
return
common.xmpp.features_nb.setActivePrivacyList(self.connection, listname, 'active')
def set_default_list(self, listname):
if not self.connection:
return
common.xmpp.features_nb.setDefaultPrivacyList(self.connection, listname)
def build_privacy_rule(self, name, action): def build_privacy_rule(self, name, action):
'''Build a Privacy rule stanza for invisibility''' '''Build a Privacy rule stanza for invisibility'''
iq = common.xmpp.Iq('set', common.xmpp.NS_PRIVACY, xmlns = '') iq = common.xmpp.Iq('set', common.xmpp.NS_PRIVACY, xmlns = '')
@ -448,6 +511,8 @@ class Connection(ConnectionHandlers):
return iq return iq
def activate_privacy_rule(self, name): def activate_privacy_rule(self, name):
if not self.connection:
return
'''activate a privacy rule''' '''activate a privacy rule'''
iq = common.xmpp.Iq('set', common.xmpp.NS_PRIVACY, xmlns = '') iq = common.xmpp.Iq('set', common.xmpp.NS_PRIVACY, xmlns = '')
iq.getTag('query').setTag('active', {'name': name}) iq.getTag('query').setTag('active', {'name': name})

View file

@ -27,6 +27,9 @@ All these methods takes 'disp' first argument that should be already connected
from protocol import * from protocol import *
REGISTER_DATA_RECEIVED='REGISTER DATA RECEIVED' REGISTER_DATA_RECEIVED='REGISTER DATA RECEIVED'
PRIVACY_LISTS_RECEIVED='PRIVACY LISTS RECEIVED'
PRIVACY_LIST_RECEIVED='PRIVACY LIST RECEIVED'
PRIVACY_LISTS_ACTIVE_DEFAULT='PRIVACY LISTS ACTIVE DEFAULT'
### DISCO ### http://jabber.org/protocol/disco ### JEP-0030 #################### ### DISCO ### http://jabber.org/protocol/disco ### JEP-0030 ####################
### Browse ### jabber:iq:browse ### JEP-0030 ################################### ### Browse ### jabber:iq:browse ### JEP-0030 ###################################

View file

@ -14,7 +14,7 @@
# $Id: features.py,v 1.22 2005/09/30 20:13:04 mikealbon Exp $ # $Id: features.py,v 1.22 2005/09/30 20:13:04 mikealbon Exp $
from features import REGISTER_DATA_RECEIVED from features import REGISTER_DATA_RECEIVED, PRIVACY_LISTS_RECEIVED, PRIVACY_LIST_RECEIVED, PRIVACY_LISTS_ACTIVE_DEFAULT
from protocol import * from protocol import *
def _on_default_response(disp, iq, cb): def _on_default_response(disp, iq, cb):
@ -172,37 +172,46 @@ def changePasswordTo(disp, newpassword, host=None, cb = None):
#type=[jid|group|subscription] #type=[jid|group|subscription]
#action=[allow|deny] #action=[allow|deny]
def getPrivacyLists(disp, cb): def getPrivacyLists(disp):
""" Requests privacy lists from connected server. """ Requests privacy lists from connected server.
Returns dictionary of existing lists on success.""" Returns dictionary of existing lists on success."""
iq = Iq('get', NS_PRIVACY) iq = Iq('get', NS_PRIVACY)
def _on_response(resp): def _on_response(resp):
dict = {'lists': []} dict = {'lists': []}
try:
if not isResultNode(resp): if not isResultNode(resp):
cb(False) disp.Event(NS_PRIVACY, PRIVACY_LISTS_RECEIVED, (False))
return return
for list in resp.getQueryPayload(): for list in resp.getQueryPayload():
if list.getName()=='list': if list.getName()=='list':
dict['lists'].append(list.getAttr('name')) dict['lists'].append(list.getAttr('name'))
else: else:
dict[list.getName()]=list.getAttr('name') dict[list.getName()]=list.getAttr('name')
cb(dict) disp.Event(NS_PRIVACY, PRIVACY_LISTS_RECEIVED, (dict))
except: disp.SendAndCallForResponse(iq, _on_response)
pass
cb(False)
disp.SendAndCallForResponse(iq, _on_respons)
def getPrivacyList(disp, listname, cb): def getActiveAndDefaultPrivacyLists(disp):
iq = Iq('get', NS_PRIVACY)
def _on_response(resp):
dict = {'active': '', 'default': ''}
if not isResultNode(resp):
disp.Event(NS_PRIVACY, PRIVACY_LISTS_ACTIVE_DEFAULT, (False))
return
for list in resp.getQueryPayload():
if list.getName() == 'active':
dict['active'] = list.getAttr('name')
elif list.getName() == 'default':
dict['default'] = list.getAttr('name')
disp.Event(NS_PRIVACY, PRIVACY_LISTS_ACTIVE_DEFAULT, (dict))
disp.SendAndCallForResponse(iq, _on_response)
def getPrivacyList(disp, listname):
""" Requests specific privacy list listname. Returns list of XML nodes (rules) """ Requests specific privacy list listname. Returns list of XML nodes (rules)
taken from the server responce.""" taken from the server responce."""
def _on_response(resp): def _on_response(resp):
try: if not isResultNode(resp):
if isResultNode(resp): disp.Event(NS_PRIVACY, PRIVACY_LIST_RECEIVED, (False))
return cb(resp.getQueryPayload()[0]) return
except: disp.Event(NS_PRIVACY, PRIVACY_LIST_RECEIVED, (resp))
pass
cb(False)
iq = Iq('get', NS_PRIVACY, payload=[Node('list', {'name': listname})]) iq = Iq('get', NS_PRIVACY, payload=[Node('list', {'name': listname})])
disp.SendAndCallForResponse(iq, _on_response) disp.SendAndCallForResponse(iq, _on_response)
@ -220,14 +229,25 @@ def setDefaultPrivacyList(disp, listname=None):
""" Sets the default privacy list as 'listname'. Returns true on success.""" """ Sets the default privacy list as 'listname'. Returns true on success."""
return setActivePrivacyList(disp, listname,'default') return setActivePrivacyList(disp, listname,'default')
def setPrivacyList(disp, list, cb): def setPrivacyList(disp, listname, tags):
""" Set the ruleset. 'list' should be the simpleXML node formatted """ Set the ruleset. 'list' should be the simpleXML node formatted
according to RFC 3921 (XMPP-IM) (I.e. Node('list',{'name':listname},payload=[...]) ) according to RFC 3921 (XMPP-IM) (I.e. Node('list',{'name':listname},payload=[...]) )
Returns true on success.""" Returns true on success."""
iq=Iq('set',NS_PRIVACY,payload=[list]) iq = Iq('set', NS_PRIVACY, xmlns = '')
_on_default_response(disp, iq, cb) list_query = iq.getTag('query').setTag('list', {'name': listname})
for item in tags:
if item.has_key('type') and item.has_key('value'):
item_tag = list_query.setTag('item', {'action': item['action'],
'order': item['order'], 'type': item['type'], 'value': item['value']})
else:
item_tag = list_query.setTag('item', {'action': item['action'],
'order': item['order']})
if item.has_key('child'):
for child_tag in item['child']:
item_tag.setTag(child_tag)
_on_default_response(disp, iq, None)
def delPrivacyList(disp,listname, cb): def delPrivacyList(disp,listname):
""" Deletes privacy list 'listname'. Returns true on success.""" """ Deletes privacy list 'listname'. Returns true on success."""
iq = Iq('set',NS_PRIVACY,payload=[Node('list',{'name':listname})]) iq = Iq('set',NS_PRIVACY,payload=[Node('list',{'name':listname})])
_on_default_response(disp, iq, cb) _on_default_response(disp, iq, None)

View file

@ -1577,6 +1577,397 @@ class XMLConsoleWindow:
# it's expanded!! # it's expanded!!
self.input_textview.grab_focus() self.input_textview.grab_focus()
class PrivacyListWindow:
def __init__(self, account, privacy_list, list_type):
'''list_type can be 0 if list is created or 1 if it id edited'''
self.account = account
self.privacy_list = privacy_list
# Dicts and Default Values
self.active_rule = ''
self.global_rules = {}
self.list_of_groups = {}
# Default Edit Values
self.edit_rule_type = 'jid'
self.allow_deny = 'allow'
# Connect to glade
self.xml = gtkgui_helpers.get_glade('privacy_list_edit_window.glade')
self.window = self.xml.get_widget('privacy_list_edit_window')
# Add Widgets
for widget_to_add in ['title_hbox', 'privacy_lists_title_label',
'list_of_rules_label', 'add_edit_rule_label', 'delete_open_buttons_hbox',
'privacy_list_active_checkbutton', 'privacy_list_default_checkbutton',
'list_of_rules_combobox', 'delete_open_buttons_hbox',
'delete_rule_button', 'open_rule_button', 'edit_allow_radiobutton',
'edit_deny_radiobutton', 'edit_type_jabberid_radiobutton',
'edit_type_jabberid_entry', 'edit_type_group_radiobutton',
'edit_type_group_combobox', 'edit_type_subscription_radiobutton',
'edit_type_subscription_combobox', 'edit_type_select_all_radiobutton',
'edit_queries_send_checkbutton', 'edit_send_messages_checkbutton',
'edit_view_status_checkbutton', 'edit_order_spinbutton',
'new_rule_button', 'save_rule_button', 'privacy_list_refresh_button',
'privacy_list_close_button', 'edit_send_status_checkbutton',
'add_edit_vbox']:
self.__dict__[widget_to_add] = self.xml.get_widget(widget_to_add)
# Send translations
self.privacy_lists_title_label.set_label(
_('Privacy List <b><i>%s</i></b>') % \
gtkgui_helpers.escape_for_pango_markup(self.privacy_list))
if len(gajim.connections) > 1:
title = _('Privacy List for %s') % self.account
else:
title = _('Privacy List')
self.delete_rule_button.set_sensitive(False)
self.open_rule_button.set_sensitive(False)
# Check if list is created (0) or edited (1)
if list_type == 1:
self.refresh_rules()
count = 0
for group in gajim.groups[self.account]:
self.list_of_groups[group] = count
count += 1
self.edit_type_group_combobox.append_text(group)
self.edit_type_group_combobox.set_active(0)
self.window.set_title(title)
self.add_edit_vbox.set_no_show_all(True)
self.window.show_all()
self.add_edit_vbox.hide()
self.xml.signal_autoconnect(self)
def on_privacy_list_edit_window_destroy(self, widget):
'''close window'''
if gajim.interface.instances[self.account].has_key('privacy_list_%s' % \
self.privacy_list):
del gajim.interface.instances[self.account]['privacy_list_%s' % \
self.privacy_list]
def check_active_default(self, a_d_dict):
if a_d_dict['active'] == self.privacy_list:
self.privacy_list_active_checkbutton.set_active(True)
else:
self.privacy_list_active_checkbutton.set_active(False)
if a_d_dict['default'] == self.privacy_list:
self.privacy_list_default_checkbutton.set_active(True)
else:
self.privacy_list_default_checkbutton.set_active(False)
def privacy_list_received(self, rules):
self.list_of_rules_combobox.get_model().clear()
self.global_rules = {}
for rule in rules:
if rule.has_key('type'):
text_item = 'Order: %s, action: %s, type: %s, value: %s' % \
(rule['order'], rule['action'], rule['type'],
rule['value'])
else:
text_item = 'Order: %s, action: %s' % (rule['order'],
rule['action'])
self.global_rules[text_item] = rule
self.list_of_rules_combobox.append_text(text_item)
if len(rules) == 0:
self.title_hbox.set_sensitive(False)
self.list_of_rules_combobox.set_sensitive(False)
self.delete_rule_button.set_sensitive(False)
self.open_rule_button.set_sensitive(False)
else:
self.list_of_rules_combobox.set_active(0)
self.title_hbox.set_sensitive(True)
self.list_of_rules_combobox.set_sensitive(True)
self.delete_rule_button.set_sensitive(True)
self.open_rule_button.set_sensitive(True)
self.reset_fields()
gajim.connections[self.account].get_active_default_lists()
def refresh_rules(self):
gajim.connections[self.account].get_privacy_list(self.privacy_list)
def on_delete_rule_button_clicked(self, widget):
tags = []
for rule in self.global_rules:
if rule != \
self.list_of_rules_combobox.get_active_text().decode('utf-8'):
tags.append(self.global_rules[rule])
gajim.connections[self.account].set_privacy_list(
self.privacy_list, tags)
self.privacy_list_received(tags)
self.add_edit_vbox.hide()
def on_open_rule_button_clicked(self, widget):
self.add_edit_rule_label.set_label(
_('<b>Edit a rule</b>'))
active_num = self.list_of_rules_combobox.get_active()
if active_num == -1:
self.active_rule = ''
else:
self.active_rule = \
self.list_of_rules_combobox.get_active_text().decode('utf-8')
if self.active_rule != '':
rule_info = self.global_rules[self.active_rule]
self.edit_order_spinbutton.set_value(int(rule_info['order']))
if rule_info.has_key('type'):
if rule_info['type'] == 'jid':
self.edit_type_jabberid_radiobutton.set_active(True)
self.edit_type_jabberid_entry.set_text(rule_info['value'])
elif rule_info['type'] == 'group':
self.edit_type_group_radiobutton.set_active(True)
if self.list_of_groups.has_key(rule_info['value']):
self.edit_type_group_combobox.set_active(
self.list_of_groups[rule_info['value']])
else:
self.edit_type_group_combobox.set_active(0)
elif rule_info['type'] == 'subscription':
self.edit_type_subscription_radiobutton.set_active(True)
sub_value = rule_info['value']
if sub_value == 'none':
self.edit_type_subscription_combobox.set_active(0)
elif sub_value == 'both':
self.edit_type_subscription_combobox.set_active(1)
elif sub_value == 'from':
self.edit_type_subscription_combobox.set_active(2)
elif sub_value == 'to':
self.edit_type_subscription_combobox.set_active(3)
else:
self.edit_type_select_all_radiobutton.set_active(True)
else:
self.edit_type_select_all_radiobutton.set_active(True)
self.edit_send_messages_checkbutton.set_active(False)
self.edit_queries_send_checkbutton.set_active(False)
self.edit_view_status_checkbutton.set_active(False)
self.edit_send_status_checkbutton.set_active(False)
for child in rule_info['child']:
if child == 'presence-out':
self.edit_send_status_checkbutton.set_active(True)
elif child == 'presence-in':
self.edit_view_status_checkbutton.set_active(True)
elif child == 'iq':
self.edit_queries_send_checkbutton.set_active(True)
elif child == 'message':
self.edit_send_messages_checkbutton.set_active(True)
if rule_info['action'] == 'allow':
self.edit_allow_radiobutton.set_active(True)
else:
self.edit_deny_radiobutton.set_active(True)
self.add_edit_vbox.show()
def on_privacy_list_active_checkbutton_toggled(self, widget):
if widget.get_active():
gajim.connections[self.account].set_active_list(self.privacy_list)
else:
gajim.connections[self.account].set_active_list(None)
def on_privacy_list_default_checkbutton_toggled(self, widget):
if widget.get_active():
gajim.connections[self.account].set_default_list(self.privacy_list)
else:
gajim.connections[self.account].set_default_list(None)
def on_new_rule_button_clicked(self, widget):
self.reset_fields()
self.add_edit_vbox.show()
def reset_fields(self):
self.edit_type_jabberid_entry.set_text('')
self.edit_allow_radiobutton.set_active(True)
self.edit_type_jabberid_radiobutton.set_active(True)
self.active_rule = ''
self.edit_send_messages_checkbutton.set_active(False)
self.edit_queries_send_checkbutton.set_active(False)
self.edit_view_status_checkbutton.set_active(False)
self.edit_send_status_checkbutton.set_active(False)
self.edit_order_spinbutton.set_value(1)
self.edit_type_group_combobox.set_active(0)
self.edit_type_subscription_combobox.set_active(0)
self.add_edit_rule_label.set_label(
_('<b>Add a rule</b>'))
def get_current_tags(self):
if self.edit_type_jabberid_radiobutton.get_active():
edit_type = 'jid'
edit_value = \
self.edit_type_jabberid_entry.get_text().decode('utf-8')
elif self.edit_type_group_radiobutton.get_active():
edit_type = 'group'
edit_value = \
self.edit_type_group_combobox.get_active_text().decode('utf-8')
elif self.edit_type_subscription_radiobutton.get_active():
edit_type = 'subscription'
edit_value = self.edit_type_subscription_combobox.get_active_text()
elif self.edit_type_select_all_radiobutton.get_active():
edit_type = ''
edit_value = ''
edit_order = str(self.edit_order_spinbutton.get_value_as_int())
if self.edit_allow_radiobutton.get_active():
edit_deny = 'allow'
else:
edit_deny = 'deny'
child = []
if self.edit_send_messages_checkbutton.get_active():
child.append('message')
if self.edit_queries_send_checkbutton.get_active():
child.append('iq')
if self.edit_send_status_checkbutton.get_active():
child.append('presence-out')
if self.edit_view_status_checkbutton.get_active():
child.append('presence-in')
if edit_type != '':
return {'order': edit_order, 'action': edit_deny,
'type': edit_type, 'value': edit_value, 'child': child}
return {'order': edit_order, 'action': edit_deny, 'child': child}
def on_save_rule_button_clicked(self, widget):
tags=[]
current_tags = self.get_current_tags()
if self.active_rule == '':
tags.append(current_tags)
for rule in self.global_rules:
if rule != self.active_rule:
tags.append(self.global_rules[rule])
else:
tags.append(current_tags)
gajim.connections[self.account].set_privacy_list(self.privacy_list, tags)
self.privacy_list_received(tags)
self.add_edit_vbox.hide()
def on_list_of_rules_combobox_changed(self, widget):
self.add_edit_vbox.hide()
def on_edit_type_radiobutton_changed(self, widget, radiobutton):
active_bool = widget.get_active()
if active_bool:
self.edit_rule_type = radiobutton
def on_edit_allow_radiobutton_changed(self, widget, radiobutton):
active_bool = widget.get_active()
if active_bool:
self.allow_deny = radiobutton
def on_privacy_list_close_button_clicked(self, widget):
self.window.destroy()
def on_privacy_list_refresh_button_clicked(self, widget):
self.refresh_rules()
self.add_edit_vbox.hide()
class PrivacyListsWindow:
# To do: UTF-8 ???????
def __init__(self, account):
self.account = account
self.privacy_lists = []
self.privacy_lists_save = []
self.xml = gtkgui_helpers.get_glade('privacy_lists_first_window.glade')
self.window = self.xml.get_widget('privacy_lists_first_window')
for widget_to_add in ['list_of_privacy_lists_combobox',
'delete_privacy_list_button', 'open_privacy_list_button',
'new_privacy_list_button', 'new_privacy_list_entry', 'buttons_hbox',
'privacy_lists_refresh_button', 'close_privacy_lists_window_button']:
self.__dict__[widget_to_add] = self.xml.get_widget(widget_to_add)
self.privacy_lists_refresh()
self.enabled = True
if len(gajim.connections) > 1:
title = _('Privacy Lists for %s') % self.account
else:
title = _('Privacy Lists')
self.window.set_title(title)
self.window.show_all()
self.xml.signal_autoconnect(self)
def on_privacy_lists_first_window_destroy(self, widget):
'''close window'''
if gajim.interface.instances[self.account].has_key('privacy_lists'):
del gajim.interface.instances[self.account]['privacy_lists']
def draw_privacy_lists_in_combobox(self):
self.list_of_privacy_lists_combobox.set_active(-1)
self.list_of_privacy_lists_combobox.get_model().clear()
self.privacy_lists_save = self.privacy_lists
for add_item in self.privacy_lists:
self.list_of_privacy_lists_combobox.append_text(add_item)
if len(self.privacy_lists) == 0:
self.list_of_privacy_lists_combobox.set_sensitive(False)
self.buttons_hbox.set_sensitive(False)
elif len(self.privacy_lists) == 1:
self.list_of_privacy_lists_combobox.set_active(0)
self.list_of_privacy_lists_combobox.set_sensitive(False)
self.buttons_hbox.set_sensitive(True)
else:
self.list_of_privacy_lists_combobox.set_sensitive(True)
self.buttons_hbox.set_sensitive(True)
self.list_of_privacy_lists_combobox.set_active(0)
self.privacy_lists = []
def on_privacy_lists_refresh_button_clicked(self, widget):
self.privacy_lists_refresh()
def on_close_button_clicked(self, widget):
self.window.destroy()
def on_delete_privacy_list_button_clicked(self, widget):
active_list = self.privacy_lists_save[
self.list_of_privacy_lists_combobox.get_active()]
gajim.connections[self.account].del_privacy_list(active_list)
self.privacy_lists_save.remove(active_list)
self.privacy_lists_received({'lists':self.privacy_lists_save})
def privacy_lists_received(self, lists):
if not lists:
return
for privacy_list in lists['lists']:
self.privacy_lists += [privacy_list]
self.draw_privacy_lists_in_combobox()
def privacy_lists_refresh(self):
gajim.connections[self.account].get_privacy_lists()
def on_new_privacy_list_button_clicked(self, widget):
name = self.new_privacy_list_entry.get_text().decode('utf-8')
if gajim.interface.instances[self.account].has_key(
'privacy_list_%s' % name):
gajim.interface.instances[self.account]['privacy_list_%s' % name].\
window.present()
else:
gajim.interface.instances[self.account]['privacy_list_%s' % name] = \
PrivacyListWindow(self.account, name, 0)
self.new_privacy_list_entry.set_text('')
def on_privacy_lists_refresh_button_clicked(self, widget):
self.privacy_lists_refresh()
def on_open_privacy_list_button_clicked(self, widget):
name = self.privacy_lists_save[
self.list_of_privacy_lists_combobox.get_active()]
if gajim.interface.instances[self.account].has_key(
'privacy_list_%s' % name):
gajim.interface.instances[self.account]['privacy_list_%s' % name].\
window.present()
else:
gajim.interface.instances[self.account]['privacy_list_%s' % name] = \
PrivacyListWindow(self.account, name, 1)
class InvitationReceivedDialog: class InvitationReceivedDialog:
def __init__(self, account, room_jid, contact_jid, password = None, comment = None): def __init__(self, account, room_jid, contact_jid, password = None, comment = None):

View file

@ -1336,6 +1336,31 @@ class Interface:
def handle_event_metacontacts(self, account, tags_list): def handle_event_metacontacts(self, account, tags_list):
gajim.contacts.define_metacontacts(account, tags_list) gajim.contacts.define_metacontacts(account, tags_list)
def handle_event_privacy_lists_received(self, account, data):
# ('PRIVACY_LISTS_RECEIVED', account, list)
if not self.instances.has_key(account):
return
if self.instances[account].has_key('privacy_lists'):
self.instances[account]['privacy_lists'].privacy_lists_received(data)
def handle_event_privacy_list_received(self, account, data):
# ('PRIVACY_LISTS_RECEIVED', account, (name, rules))
if not self.instances.has_key(account):
return
name = data[0]
rules = data[1]
if self.instances[account].has_key('privacy_list_%s' % name):
self.instances[account]['privacy_list_%s' % name].\
privacy_list_received(rules)
def handle_event_privacy_lists_active_default(self, account, data):
if not data:
return
# Send to all privacy_list_* windows as we can't know which one asked
for win in self.instances[account]:
if win.startswith('privacy_list_'):
self.instances[account][win].check_active_default(data)
def read_sleepy(self): def read_sleepy(self):
'''Check idle status and change that status if needed''' '''Check idle status and change that status if needed'''
if not self.sleeper.poll(): if not self.sleeper.poll():
@ -1636,6 +1661,10 @@ class Interface:
'ASK_NEW_NICK': self.handle_event_ask_new_nick, 'ASK_NEW_NICK': self.handle_event_ask_new_nick,
'SIGNED_IN': self.handle_event_signed_in, 'SIGNED_IN': self.handle_event_signed_in,
'METACONTACTS': self.handle_event_metacontacts, 'METACONTACTS': self.handle_event_metacontacts,
'PRIVACY_LISTS_RECEIVED': self.handle_event_privacy_lists_received,
'PRIVACY_LIST_RECEIVED': self.handle_event_privacy_list_received,
'PRIVACY_LISTS_ACTIVE_DEFAULT': \
self.handle_event_privacy_lists_active_default,
} }
gajim.handlers = self.handlers gajim.handlers = self.handlers

View file

@ -584,6 +584,13 @@ class RosterWindow:
gajim.interface.instances[account]['xml_console'] = \ gajim.interface.instances[account]['xml_console'] = \
dialogs.XMLConsoleWindow(account) dialogs.XMLConsoleWindow(account)
def on_privacy_lists_menuitem_activate(self, widget, account):
if gajim.interface.instances[account].has_key('privacy_lists'):
gajim.interface.instances[account]['privacy_lists'].window.present()
else:
gajim.interface.instances[account]['privacy_lists'] = \
dialogs.PrivacyListsWindow(account)
def on_set_motd_menuitem_activate(self, widget, account): def on_set_motd_menuitem_activate(self, widget, account):
server = gajim.config.get_per('accounts', account, 'hostname') server = gajim.config.get_per('accounts', account, 'hostname')
server += '/announce/motd' server += '/announce/motd'
@ -619,6 +626,7 @@ class RosterWindow:
send_single_message_menuitem = xml.get_widget( send_single_message_menuitem = xml.get_widget(
'send_single_message_menuitem') 'send_single_message_menuitem')
xml_console_menuitem = xml.get_widget('xml_console_menuitem') xml_console_menuitem = xml.get_widget('xml_console_menuitem')
privacy_lists_menuitem = xml.get_widget('privacy_lists_menuitem')
administrator_menuitem = xml.get_widget('administrator_menuitem') administrator_menuitem = xml.get_widget('administrator_menuitem')
send_server_message_menuitem = xml.get_widget( send_server_message_menuitem = xml.get_widget(
'send_server_message_menuitem') 'send_server_message_menuitem')
@ -632,6 +640,9 @@ class RosterWindow:
xml_console_menuitem.connect('activate', xml_console_menuitem.connect('activate',
self.on_xml_console_menuitem_activate, account) self.on_xml_console_menuitem_activate, account)
privacy_lists_menuitem.connect('activate',
self.on_privacy_lists_menuitem_activate, account)
send_server_message_menuitem.connect('activate', send_server_message_menuitem.connect('activate',
self.on_send_server_message_menuitem_activate, account) self.on_send_server_message_menuitem_activate, account)