Remove XEP-0136 support
This commit is contained in:
parent
1e313cc7e2
commit
9ff601d03b
|
@ -1,322 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<object class="GtkListStore" id="liststore1">
|
||||
<columns>
|
||||
<!-- column-name item -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">No</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Yes</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkListStore" id="liststore2">
|
||||
<columns>
|
||||
<!-- column-name item -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Prefer</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Concede</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Forbid</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkListStore" id="liststore3">
|
||||
<columns>
|
||||
<!-- column-name item -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Prefer</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Concede</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Forbid</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkListStore" id="liststore4">
|
||||
<columns>
|
||||
<!-- column-name item -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Prefer</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Concede</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Forbid</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkWindow" id="archiving_preferences_window">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<signal name="destroy" handler="on_archiving_preferences_window_destroy" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Auto</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes"><i>Method Auto</i></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes"><i>Method Local</i></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes"><i>Method Manual</i></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="auto_combobox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="model">liststore1</property>
|
||||
<signal name="changed" handler="on_auto_combobox_changed" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext1"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="method_auto_combobox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="model">liststore2</property>
|
||||
<signal name="changed" handler="on_method_foo_combobox_changed" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext2"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="method_local_combobox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="model">liststore3</property>
|
||||
<signal name="changed" handler="on_method_foo_combobox_changed" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext3"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="method_manual_combobox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="model">liststore4</property>
|
||||
<signal name="changed" handler="on_method_foo_combobox_changed" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext4"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="item_treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<signal name="cursor-changed" handler="on_item_treeview_cursor_changed" swapped="no"/>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButtonBox" id="hbuttonbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">spread</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="add_button">
|
||||
<property name="label">gtk-add</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="on_add_item_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="remove_button">
|
||||
<property name="label">gtk-remove</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="on_remove_item_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="edit_button">
|
||||
<property name="label">gtk-edit</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="on_edit_item_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="close_button">
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="on_close_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
|
@ -1,244 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<object class="GtkListStore" id="liststore1">
|
||||
<columns>
|
||||
<!-- column-name item -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">body</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">false</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">message</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">stream</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkListStore" id="liststore2">
|
||||
<columns>
|
||||
<!-- column-name item -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">approve</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">concede</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">forbid</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">oppose</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">prefer</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">require</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkWindow" id="item_archiving_preferences_window">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<signal name="destroy" handler="on_item_archiving_preferences_window_destroy" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">jid</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label8">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">expire</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label9">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">otr</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label10">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">save</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="jid_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="expire_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="otr_combobox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="model">liststore2</property>
|
||||
<signal name="changed" handler="on_otr_combobox_changed" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext2"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="save_combobox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="model">liststore1</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext1"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkProgressBar" id="progressbar">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="cancel_button">
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="on_cancel_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="ok_button">
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="on_ok_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
|
@ -145,12 +145,8 @@ class AppActions():
|
|||
gajim.interface.instances[account]['archiving_preferences'].window.\
|
||||
present()
|
||||
else:
|
||||
if gajim.connections[account].archiving_313_supported:
|
||||
gajim.interface.instances[account]['archiving_preferences'] = \
|
||||
dialogs.Archiving313PreferencesWindow(account)
|
||||
else:
|
||||
gajim.interface.instances[account]['archiving_preferences'] = \
|
||||
dialogs.ArchivingPreferencesWindow(account)
|
||||
gajim.interface.instances[account]['archiving_preferences'] = \
|
||||
dialogs.Archiving313PreferencesWindow(account)
|
||||
|
||||
def on_history_sync(self, action, param):
|
||||
account = param.get_string()
|
||||
|
|
|
@ -1399,9 +1399,6 @@ class ChatControl(ChatControlBase):
|
|||
if textbuffer.get_char_count() and self.encryption:
|
||||
gajim.plugin_manager.extension_point(
|
||||
'typing' + self.encryption, self)
|
||||
if (not self.session or not self.session.status) and \
|
||||
gajim.connections[self.account].archiving_136_supported:
|
||||
self.begin_archiving_negotiation()
|
||||
|
||||
def restore_conversation(self):
|
||||
jid = self.contact.jid
|
||||
|
@ -1622,10 +1619,6 @@ class ChatControl(ChatControlBase):
|
|||
self.session.resource = self.contact.resource
|
||||
self.session.negotiate_e2e(False)
|
||||
|
||||
def begin_archiving_negotiation(self):
|
||||
self.begin_negotiation()
|
||||
self.session.negotiate_archiving()
|
||||
|
||||
def _nec_failed_decrypt(self, obj):
|
||||
if obj.session != self.session:
|
||||
return
|
||||
|
|
|
@ -411,7 +411,6 @@ class Config:
|
|||
'send_idle_time': [ opt_bool, True ],
|
||||
'roster_version': [opt_str, ''],
|
||||
'subscription_request_msg': [opt_str, '', _('Message that is sent to contacts you want to add')],
|
||||
'last_archiving_time': [opt_str, '1970-01-01T00:00:00Z', _('Last time we syncronized with logs from server.')],
|
||||
'enable_message_carbons': [ opt_bool, True, _('If enabled and if server supports this feature, Gajim will receive messages sent and received by other resources.')],
|
||||
'ft_send_local_ips': [ opt_bool, True, _('If enabled, Gajim will send your local IPs so your contact can connect to your machine to transfer files.')],
|
||||
'oauth2_refresh_token': [ opt_str, '', _('Latest token for OAuth 2.0 authentication.')],
|
||||
|
|
|
@ -166,8 +166,6 @@ class CommonConnection:
|
|||
self.archiving_namespace = None
|
||||
self.archiving_supported = False
|
||||
self.archiving_313_supported = False
|
||||
self.archiving_136_supported = False
|
||||
self.archive_pref_supported = False
|
||||
self.roster_supported = True
|
||||
self.blocking_supported = False
|
||||
self.addressing_supported = False
|
||||
|
@ -1947,18 +1945,6 @@ class Connection(CommonConnection, ConnectionHandlers):
|
|||
# Remove stored bookmarks accessible to everyone.
|
||||
self.send_pb_purge(our_jid, 'storage:bookmarks')
|
||||
self.send_pb_delete(our_jid, 'storage:bookmarks')
|
||||
if nbxmpp.NS_ARCHIVE in obj.features:
|
||||
self.archiving_supported = True
|
||||
self.archiving_136_supported = True
|
||||
self.request_message_archiving_preferences()
|
||||
if nbxmpp.NS_ARCHIVE_AUTO in obj.features:
|
||||
self.archive_auto_supported = True
|
||||
if nbxmpp.NS_ARCHIVE_MANAGE in obj.features:
|
||||
self.archive_manage_supported = True
|
||||
if nbxmpp.NS_ARCHIVE_MANUAL in obj.features:
|
||||
self.archive_manual_supported = True
|
||||
if nbxmpp.NS_ARCHIVE_PREF in obj.features:
|
||||
self.archive_pref_supported = True
|
||||
if nbxmpp.NS_BLOCKING in obj.features:
|
||||
self.blocking_supported = True
|
||||
if nbxmpp.NS_ADDRESS in obj.features:
|
||||
|
|
|
@ -52,7 +52,6 @@ from common.pubsub import ConnectionPubSub
|
|||
from common.protocol.caps import ConnectionCaps
|
||||
from common.protocol.bytestream import ConnectionSocks5Bytestream
|
||||
from common.protocol.bytestream import ConnectionIBBytestream
|
||||
from common.message_archiving import ConnectionArchive136
|
||||
from common.message_archiving import ConnectionArchive313
|
||||
from common.connection_handlers_events import *
|
||||
|
||||
|
@ -1324,13 +1323,12 @@ class ConnectionHandlersBase:
|
|||
|
||||
return sess
|
||||
|
||||
class ConnectionHandlers(ConnectionArchive136, ConnectionArchive313,
|
||||
class ConnectionHandlers(ConnectionArchive313,
|
||||
ConnectionVcard, ConnectionSocks5Bytestream, ConnectionDisco,
|
||||
ConnectionCommands, ConnectionPubSub, ConnectionPEP, ConnectionCaps,
|
||||
ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
||||
def __init__(self):
|
||||
global HAS_IDLE
|
||||
ConnectionArchive136.__init__(self)
|
||||
ConnectionArchive313.__init__(self)
|
||||
ConnectionVcard.__init__(self)
|
||||
ConnectionSocks5Bytestream.__init__(self)
|
||||
|
@ -1385,8 +1383,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
|||
gajim.nec.register_incoming_event(StreamOtherHostReceivedEvent)
|
||||
gajim.nec.register_incoming_event(MessageReceivedEvent)
|
||||
gajim.nec.register_incoming_event(ArchivingErrorReceivedEvent)
|
||||
gajim.nec.register_incoming_event(
|
||||
ArchivingPreferencesChangedReceivedEvent)
|
||||
gajim.nec.register_incoming_event(
|
||||
Archiving313PreferencesChangedReceivedEvent)
|
||||
gajim.nec.register_incoming_event(
|
||||
|
@ -1439,7 +1435,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
|||
def cleanup(self):
|
||||
ConnectionHandlersBase.cleanup(self)
|
||||
ConnectionCaps.cleanup(self)
|
||||
ConnectionArchive136.cleanup(self)
|
||||
ConnectionArchive313.cleanup(self)
|
||||
ConnectionPubSub.cleanup(self)
|
||||
gajim.ged.remove_event_handler('http-auth-received', ged.CORE,
|
||||
|
@ -2272,7 +2267,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
|||
con.RegisterHandler('iq', self._IqPingCB, 'get', nbxmpp.NS_PING)
|
||||
con.RegisterHandler('iq', self._SearchCB, 'result', nbxmpp.NS_SEARCH)
|
||||
con.RegisterHandler('iq', self._PrivacySetCB, 'set', nbxmpp.NS_PRIVACY)
|
||||
con.RegisterHandler('iq', self._ArchiveCB, ns=nbxmpp.NS_ARCHIVE)
|
||||
con.RegisterHandler('iq', self._ArchiveCB, ns=nbxmpp.NS_MAM)
|
||||
con.RegisterHandler('iq', self._ArchiveCB, ns=nbxmpp.NS_MAM_1)
|
||||
con.RegisterHandler('iq', self._ArchiveCB, ns=nbxmpp.NS_MAM_2)
|
||||
|
|
|
@ -1736,59 +1736,6 @@ class ArchivingErrorReceivedEvent(nec.NetworkIncomingEvent):
|
|||
self.error_msg = self.stanza.getErrorMsg()
|
||||
return True
|
||||
|
||||
class ArchivingPreferencesChangedReceivedEvent(nec.NetworkIncomingEvent):
|
||||
name = 'archiving-preferences-changed-received'
|
||||
base_network_events = ['archiving-received']
|
||||
|
||||
def generate(self):
|
||||
self.conn = self.base_event.conn
|
||||
self.stanza = self.base_event.stanza
|
||||
self.type_ = self.base_event.type_
|
||||
|
||||
if self.type_ not in ('result', 'set'):
|
||||
return
|
||||
|
||||
self.conf = {}
|
||||
self.new_items = {}
|
||||
self.removed_items = []
|
||||
pref = self.stanza.getTag('pref', namespace=nbxmpp.NS_ARCHIVE)
|
||||
if pref:
|
||||
if pref.getTag('auto'):
|
||||
self.conf['auto'] = pref.getTagAttr('auto', 'save')
|
||||
|
||||
method_auto = pref.getTag('method', attrs={'type': 'auto'})
|
||||
if method_auto:
|
||||
self.conf['method_auto'] = method_auto.getAttr('use')
|
||||
|
||||
method_local = pref.getTag('method', attrs={'type': 'local'})
|
||||
if method_local:
|
||||
self.conf['method_local'] = method_local.getAttr('use')
|
||||
|
||||
method_manual = pref.getTag('method', attrs={'type': 'manual'})
|
||||
if method_manual:
|
||||
self.conf['method_manual'] = method_manual.getAttr('use')
|
||||
|
||||
default = pref.getTag('default')
|
||||
if default:
|
||||
self.conf['default'] = {
|
||||
'expire': default.getAttr('expire'),
|
||||
'otr': default.getAttr('otr'),
|
||||
'save': default.getAttr('save'),
|
||||
'unset': default.getAttr('unset')}
|
||||
|
||||
for item in pref.getTags('item'):
|
||||
self.new_items[item.getAttr('jid')] = {
|
||||
'expire': item.getAttr('expire'),
|
||||
'otr': item.getAttr('otr'),
|
||||
'save': item.getAttr('save')}
|
||||
|
||||
elif self.stanza.getTag('itemremove'):
|
||||
for item in pref.getTags('item'):
|
||||
self.removed_items.append(item.getAttr('jid'))
|
||||
else:
|
||||
return
|
||||
return True
|
||||
|
||||
class Archiving313PreferencesChangedReceivedEvent(nec.NetworkIncomingEvent):
|
||||
name = 'archiving-313-preferences-changed-received'
|
||||
base_network_events = ['archiving-received']
|
||||
|
|
|
@ -18,31 +18,20 @@
|
|||
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||
##
|
||||
|
||||
import nbxmpp
|
||||
from common import gajim
|
||||
from common import ged
|
||||
from common import helpers
|
||||
import common.connection_handlers_events as ev
|
||||
|
||||
from calendar import timegm
|
||||
from time import localtime
|
||||
import logging
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import logging
|
||||
import nbxmpp
|
||||
|
||||
from common import gajim
|
||||
from common import ged
|
||||
import common.connection_handlers_events as ev
|
||||
|
||||
log = logging.getLogger('gajim.c.message_archiving')
|
||||
|
||||
ARCHIVING_COLLECTIONS_ARRIVED = 'archiving_collections_arrived'
|
||||
ARCHIVING_COLLECTION_ARRIVED = 'archiving_collection_arrived'
|
||||
ARCHIVING_MODIFICATIONS_ARRIVED = 'archiving_modifications_arrived'
|
||||
|
||||
class ConnectionArchive:
|
||||
class ConnectionArchive313:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
class ConnectionArchive313(ConnectionArchive):
|
||||
def __init__(self):
|
||||
ConnectionArchive.__init__(self)
|
||||
self.archiving_313_supported = False
|
||||
self.mam_awaiting_disco_result = {}
|
||||
self.iq_answer = []
|
||||
|
@ -211,281 +200,7 @@ class ConnectionArchive313(ConnectionArchive):
|
|||
never.addChild(name='jid').setData(jid)
|
||||
self.connection.send(iq)
|
||||
|
||||
class ConnectionArchive136(ConnectionArchive):
|
||||
def __init__(self):
|
||||
ConnectionArchive.__init__(self)
|
||||
self.archiving_136_supported = False
|
||||
self.archive_auto_supported = False
|
||||
self.archive_manage_supported = False
|
||||
self.archive_manual_supported = False
|
||||
self.archive_pref_supported = False
|
||||
self.auto = None
|
||||
self.method_auto = None
|
||||
self.method_local = None
|
||||
self.method_manual = None
|
||||
self.default = None
|
||||
self.items = {}
|
||||
gajim.ged.register_event_handler(
|
||||
'archiving-preferences-changed-received', ged.CORE,
|
||||
self._nec_archiving_changed_received)
|
||||
gajim.ged.register_event_handler('raw-iq-received', ged.CORE,
|
||||
self._nec_raw_iq_136_received)
|
||||
|
||||
def cleanup(self):
|
||||
gajim.ged.remove_event_handler(
|
||||
'archiving-preferences-changed-received', ged.CORE,
|
||||
self._nec_archiving_changed_received)
|
||||
gajim.ged.remove_event_handler('raw-iq-received', ged.CORE,
|
||||
self._nec_raw_iq_136_received)
|
||||
|
||||
def _nec_raw_iq_136_received(self, obj):
|
||||
if obj.conn.name != self.name:
|
||||
return
|
||||
|
||||
id_ = obj.stanza.getID()
|
||||
if id_ not in self.awaiting_answers:
|
||||
return
|
||||
|
||||
if self.awaiting_answers[id_][0] == ARCHIVING_COLLECTIONS_ARRIVED:
|
||||
del self.awaiting_answers[id_]
|
||||
# TODO
|
||||
print('ARCHIVING_COLLECTIONS_ARRIVED')
|
||||
|
||||
elif self.awaiting_answers[id_][0] == ARCHIVING_COLLECTION_ARRIVED:
|
||||
def save_if_not_exists(with_, nick, direction, tim, payload):
|
||||
assert len(payload) == 1, 'got several archiving messages in' +\
|
||||
' the same time %s' % ''.join(payload)
|
||||
if payload[0].getName() == 'body':
|
||||
gajim.logger.save_if_not_exists(with_, direction, tim,
|
||||
msg=payload[0].getData(), nick=nick)
|
||||
elif payload[0].getName() == 'message':
|
||||
print('Not implemented')
|
||||
chat = obj.stanza.getTag('chat')
|
||||
if chat:
|
||||
with_ = chat.getAttr('with')
|
||||
start_ = chat.getAttr('start')
|
||||
tim = helpers.datetime_tuple(start_)
|
||||
tim = timegm(tim)
|
||||
nb = 0
|
||||
for element in chat.getChildren():
|
||||
try:
|
||||
secs = int(element.getAttr('secs'))
|
||||
except TypeError:
|
||||
secs = 0
|
||||
if secs:
|
||||
tim += secs
|
||||
nick = element.getAttr('name')
|
||||
if element.getName() == 'from':
|
||||
save_if_not_exists(with_, nick, 'from', localtime(tim),
|
||||
element.getPayload())
|
||||
nb += 1
|
||||
if element.getName() == 'to':
|
||||
save_if_not_exists(with_, nick, 'to', localtime(tim),
|
||||
element.getPayload())
|
||||
nb += 1
|
||||
set_ = chat.getTag('set')
|
||||
first = set_.getTag('first')
|
||||
if first:
|
||||
try:
|
||||
index = int(first.getAttr('index'))
|
||||
except TypeError:
|
||||
index = 0
|
||||
try:
|
||||
count = int(set_.getTagData('count'))
|
||||
except TypeError:
|
||||
count = 0
|
||||
if count > index + nb:
|
||||
# Request the next page
|
||||
after = element.getTagData('last')
|
||||
self.request_collection_page(with_, start_, after=after)
|
||||
del self.awaiting_answers[id_]
|
||||
|
||||
elif self.awaiting_answers[id_][0] == ARCHIVING_MODIFICATIONS_ARRIVED:
|
||||
modified = obj.stanza.getTag('modified')
|
||||
if modified:
|
||||
for element in modified.getChildren():
|
||||
if element.getName() == 'changed':
|
||||
with_ = element.getAttr('with')
|
||||
start_ = element.getAttr('start')
|
||||
self.request_collection_page(with_, start_)
|
||||
#elif element.getName() == 'removed':
|
||||
# do nothing
|
||||
del self.awaiting_answers[id_]
|
||||
|
||||
def request_message_archiving_preferences(self):
|
||||
iq_ = nbxmpp.Iq('get')
|
||||
iq_.setTag('pref', namespace=nbxmpp.NS_ARCHIVE)
|
||||
self.connection.send(iq_)
|
||||
|
||||
def set_pref(self, name, **data):
|
||||
'''
|
||||
data contains names and values of pref name attributes.
|
||||
'''
|
||||
iq_ = nbxmpp.Iq('set')
|
||||
pref = iq_.setTag('pref', namespace=nbxmpp.NS_ARCHIVE)
|
||||
tag = pref.setTag(name)
|
||||
for key, value in data.items():
|
||||
if value is not None:
|
||||
tag.setAttr(key, value)
|
||||
self.connection.send(iq_)
|
||||
|
||||
def set_auto(self, save):
|
||||
self.set_pref('auto', save=save)
|
||||
|
||||
def set_method(self, type, use):
|
||||
self.set_pref('method', type=type, use=use)
|
||||
|
||||
def set_default(self, otr, save, expire=None):
|
||||
self.set_pref('default', otr=otr, save=save, expire=expire)
|
||||
|
||||
def append_or_update_item(self, jid, otr, save, expire):
|
||||
self.set_pref('item', jid=jid, otr=otr, save=save)
|
||||
|
||||
def remove_item(self, jid):
|
||||
iq_ = nbxmpp.Iq('set')
|
||||
itemremove = iq_.setTag('itemremove', namespace=nbxmpp.NS_ARCHIVE)
|
||||
item = itemremove.setTag('item')
|
||||
item.setAttr('jid', jid)
|
||||
self.connection.send(iq_)
|
||||
|
||||
def stop_archiving_session(self, thread_id):
|
||||
iq_ = nbxmpp.Iq('set')
|
||||
pref = iq_.setTag('pref', namespace=nbxmpp.NS_ARCHIVE)
|
||||
session = pref.setTag('session', attrs={'thread': thread_id,
|
||||
'save': 'false', 'otr': 'concede'})
|
||||
self.connection.send(iq_)
|
||||
|
||||
def get_item_pref(self, jid):
|
||||
jid = nbxmpp.JID(jid)
|
||||
if str(jid) in self.items:
|
||||
return self.items[jid]
|
||||
|
||||
if jid.getStripped() in self.items:
|
||||
return self.items[jid.getStripped()]
|
||||
|
||||
if jid.getDomain() in self.items:
|
||||
return self.items[jid.getDomain()]
|
||||
|
||||
return self.default
|
||||
|
||||
def logging_preference(self, jid, initiator_options=None):
|
||||
otr = self.get_item_pref(jid)
|
||||
if not otr:
|
||||
return
|
||||
otr = otr['otr']
|
||||
if initiator_options:
|
||||
if ((initiator_options == ['mustnot'] and otr == 'forbid') or
|
||||
(initiator_options == ['may'] and otr == 'require')):
|
||||
return None
|
||||
|
||||
if (initiator_options == ['mustnot'] or
|
||||
(initiator_options[0] == 'mustnot' and
|
||||
otr not in ('opppose', 'forbid')) or
|
||||
(initiator_options == ['may', 'mustnot'] and
|
||||
otr in ('require', 'prefer'))):
|
||||
return 'mustnot'
|
||||
|
||||
return 'may'
|
||||
|
||||
if otr == 'require':
|
||||
return ['mustnot']
|
||||
|
||||
if otr in ('prefer', 'approve'):
|
||||
return ['mustnot', 'may']
|
||||
|
||||
if otr in ('concede', 'oppose'):
|
||||
return ['may', 'mustnot']
|
||||
|
||||
# otr == 'forbid'
|
||||
return ['may']
|
||||
|
||||
def _ArchiveCB(self, con, iq_obj):
|
||||
gajim.nec.push_incoming_event(ev.ArchivingReceivedEvent(None, conn=self,
|
||||
stanza=iq_obj))
|
||||
raise nbxmpp.NodeProcessed
|
||||
|
||||
def _nec_archiving_changed_received(self, obj):
|
||||
if obj.conn.name != self.name:
|
||||
return
|
||||
for key in ('auto', 'default'):
|
||||
if key not in obj.conf:
|
||||
self.archiving_136_supported = False
|
||||
self.archive_auto_supported = False
|
||||
self.archive_manage_supported = False
|
||||
self.archive_manual_supported = False
|
||||
self.archive_pref_supported = False
|
||||
return True
|
||||
for key in ('auto', 'method_auto', 'method_local', 'method_manual',
|
||||
'default'):
|
||||
if key in obj.conf:
|
||||
self.__dict__[key] = obj.conf[key]
|
||||
|
||||
for jid, pref in obj.new_items.items():
|
||||
self.items[jid] = pref
|
||||
|
||||
for jid in obj.removed_items:
|
||||
del self.items[jid]
|
||||
|
||||
def request_collections_list_page(self, with_='', start=None, end=None,
|
||||
after=None, max=30, exact_match=False):
|
||||
iq_ = nbxmpp.Iq('get')
|
||||
list_ = iq_.setTag('list', namespace=nbxmpp.NS_ARCHIVE)
|
||||
if with_:
|
||||
list_.setAttr('with', with_)
|
||||
if exact_match:
|
||||
list_.setAttr('exactmatch', 'true')
|
||||
if start:
|
||||
list_.setAttr('start', start)
|
||||
if end:
|
||||
list_.setAttr('end', end)
|
||||
set_ = list_.setTag('set', namespace=nbxmpp.NS_RSM)
|
||||
set_.setTagData('max', max)
|
||||
if after:
|
||||
set_.setTagData('after', after)
|
||||
id_ = self.connection.getAnID()
|
||||
iq_.setID(id_)
|
||||
self.awaiting_answers[id_] = (ARCHIVING_COLLECTIONS_ARRIVED, )
|
||||
self.connection.send(iq_)
|
||||
|
||||
def request_collection_page(self, with_, start, end=None, after=None,
|
||||
max=30, exact_match=False):
|
||||
iq_ = nbxmpp.Iq('get')
|
||||
retrieve = iq_.setTag('retrieve', namespace=nbxmpp.NS_ARCHIVE,
|
||||
attrs={'with': with_, 'start': start})
|
||||
if exact_match:
|
||||
retrieve.setAttr('exactmatch', 'true')
|
||||
set_ = retrieve.setTag('set', namespace=nbxmpp.NS_RSM)
|
||||
set_.setTagData('max', max)
|
||||
if after:
|
||||
set_.setTagData('after', after)
|
||||
id_ = self.connection.getAnID()
|
||||
iq_.setID(id_)
|
||||
self.awaiting_answers[id_] = (ARCHIVING_COLLECTION_ARRIVED, )
|
||||
self.connection.send(iq_)
|
||||
|
||||
def remove_collection(self, with_='', start=None, end=None,
|
||||
exact_match=False, open=False):
|
||||
iq_ = nbxmpp.Iq('set')
|
||||
remove = iq_.setTag('remove', namespace=nbxmpp.NS_ARCHIVE)
|
||||
if with_:
|
||||
remove.setAttr('with', with_)
|
||||
if exact_match:
|
||||
remove.setAttr('exactmatch', 'true')
|
||||
if start:
|
||||
remove.setAttr('start', start)
|
||||
if end:
|
||||
remove.setAttr('end', end)
|
||||
if open:
|
||||
remove.setAttr('open', 'true')
|
||||
self.connection.send(iq_)
|
||||
|
||||
def request_modifications_page(self, start, max=30):
|
||||
iq_ = nbxmpp.Iq('get')
|
||||
moified = iq_.setTag('modified', namespace=nbxmpp.NS_ARCHIVE,
|
||||
attrs={'start': start})
|
||||
set_ = moified.setTag('set', namespace=nbxmpp.NS_RSM)
|
||||
set_.setTagData('max', max)
|
||||
id_ = self.connection.getAnID()
|
||||
iq_.setID(id_)
|
||||
self.awaiting_answers[id_] = (ARCHIVING_MODIFICATIONS_ARRIVED, )
|
||||
self.connection.send(iq_)
|
||||
|
|
363
gajim/dialogs.py
363
gajim/dialogs.py
|
@ -3751,369 +3751,6 @@ class RosterItemExchangeWindow:
|
|||
self.window.destroy()
|
||||
|
||||
|
||||
class ItemArchivingPreferencesWindow:
|
||||
otr_name = ('approve', 'concede', 'forbid', 'oppose', 'prefer', 'require')
|
||||
otr_index = dict([(j, i) for i, j in enumerate(otr_name)])
|
||||
save_name = ('body', 'false', 'message', 'stream')
|
||||
save_index = dict([(j, i) for i, j in enumerate(save_name)])
|
||||
|
||||
def __init__(self, account, item):
|
||||
self.account = account
|
||||
self.item = item
|
||||
if self.item and self.item != 'Default':
|
||||
self.item_config = gajim.connections[self.account].items[self.item]
|
||||
else:
|
||||
self.item_config = gajim.connections[self.account].default
|
||||
self.waiting = None
|
||||
|
||||
# Connect to gtk builder
|
||||
self.xml = gtkgui_helpers.get_gtk_builder(
|
||||
'item_archiving_preferences_window.ui')
|
||||
self.window = self.xml.get_object('item_archiving_preferences_window')
|
||||
|
||||
# Add Widgets
|
||||
for widget_to_add in ('jid_entry', 'expire_entry', 'otr_combobox',
|
||||
'save_combobox', 'cancel_button', 'ok_button', 'progressbar'):
|
||||
self.__dict__[widget_to_add] = self.xml.get_object(widget_to_add)
|
||||
|
||||
if self.item:
|
||||
self.jid_entry.set_text(self.item)
|
||||
expire_value = self.item_config['expire'] or ''
|
||||
self.otr_combobox.set_active(self.otr_index[self.item_config['otr']])
|
||||
self.save_combobox.set_active(
|
||||
self.save_index[self.item_config['save']])
|
||||
self.expire_entry.set_text(expire_value)
|
||||
|
||||
self.window.set_title(_('Archiving Preferences for %s') % self.account)
|
||||
|
||||
self.window.show_all()
|
||||
self.progressbar.hide()
|
||||
self.xml.connect_signals(self)
|
||||
|
||||
def update_progressbar(self):
|
||||
if self.waiting:
|
||||
self.progressbar.pulse()
|
||||
return True
|
||||
return False
|
||||
|
||||
def on_otr_combobox_changed(self, widget):
|
||||
otr = self.otr_name[self.otr_combobox.get_active()]
|
||||
if otr == 'require':
|
||||
self.save_combobox.set_active(self.save_index['false'])
|
||||
|
||||
def on_ok_button_clicked(self, widget):
|
||||
# Return directly if operation in progress
|
||||
if self.waiting:
|
||||
return
|
||||
|
||||
item = self.jid_entry.get_text()
|
||||
otr = self.otr_name[self.otr_combobox.get_active()]
|
||||
save = self.save_name[self.save_combobox.get_active()]
|
||||
expire = self.expire_entry.get_text()
|
||||
|
||||
if self.item != 'Default':
|
||||
try:
|
||||
item = helpers.parse_jid(item)
|
||||
except helpers.InvalidFormat as s:
|
||||
pritext = _('Invalid User ID')
|
||||
ErrorDialog(pritext, str(s))
|
||||
return
|
||||
|
||||
if expire:
|
||||
try:
|
||||
if int(expire) < 0 or str(int(expire)) != expire:
|
||||
raise ValueError
|
||||
except ValueError:
|
||||
pritext = _('Invalid expire value')
|
||||
sectext = _('Expire must be a valid positive integer.')
|
||||
ErrorDialog(pritext, sectext)
|
||||
return
|
||||
|
||||
if not (item == self.item and expire == self.item_config['expire'] and
|
||||
otr == self.item_config['otr'] and save == self.item_config['save']):
|
||||
if not self.item or self.item == item:
|
||||
if self.item == 'Default':
|
||||
self.waiting = 'default'
|
||||
gajim.connections[self.account].set_default(
|
||||
otr, save, expire)
|
||||
else:
|
||||
self.waiting = 'item'
|
||||
gajim.connections[self.account].append_or_update_item(
|
||||
item, otr, save, expire)
|
||||
else:
|
||||
self.waiting = 'item'
|
||||
gajim.connections[self.account].append_or_update_item(
|
||||
item, otr, save, expire)
|
||||
gajim.connections[self.account].remove_item(self.item)
|
||||
self.launch_progressbar()
|
||||
#self.window.destroy()
|
||||
|
||||
def on_cancel_button_clicked(self, widget):
|
||||
self.window.destroy()
|
||||
|
||||
def on_item_archiving_preferences_window_destroy(self, widget):
|
||||
if self.item:
|
||||
key_name = 'edit_item_archiving_preferences_%s' % self.item
|
||||
else:
|
||||
key_name = 'new_item_archiving_preferences'
|
||||
if key_name in gajim.interface.instances[self.account]:
|
||||
del gajim.interface.instances[self.account][key_name]
|
||||
|
||||
def launch_progressbar(self):
|
||||
self.progressbar.show()
|
||||
self.update_progressbar_timeout_id = GLib.timeout_add(100,
|
||||
self.update_progressbar)
|
||||
|
||||
def response_arrived(self, data):
|
||||
if self.waiting:
|
||||
self.window.destroy()
|
||||
|
||||
def error_arrived(self, error):
|
||||
if self.waiting:
|
||||
self.waiting = None
|
||||
self.progressbar.hide()
|
||||
pritext = _('There is an error with the form')
|
||||
sectext = error
|
||||
ErrorDialog(pritext, sectext)
|
||||
|
||||
|
||||
class ArchivingPreferencesWindow:
|
||||
auto_name = ('false', 'true')
|
||||
auto_index = dict([(j, i) for i, j in enumerate(auto_name)])
|
||||
method_foo_name = ('prefer', 'concede', 'forbid')
|
||||
method_foo_index = dict([(j, i) for i, j in enumerate(method_foo_name)])
|
||||
|
||||
def __init__(self, account):
|
||||
self.account = account
|
||||
self.waiting = []
|
||||
|
||||
# Connect to glade
|
||||
self.xml = gtkgui_helpers.get_gtk_builder(
|
||||
'archiving_preferences_window.ui')
|
||||
self.window = self.xml.get_object('archiving_preferences_window')
|
||||
|
||||
# Add Widgets
|
||||
for widget_to_add in ('auto_combobox', 'method_auto_combobox',
|
||||
'method_local_combobox', 'method_manual_combobox', 'close_button',
|
||||
'item_treeview', 'item_notebook', 'otr_combobox', 'save_combobox',
|
||||
'expire_entry', 'remove_button', 'edit_button'):
|
||||
self.__dict__[widget_to_add] = self.xml.get_object(widget_to_add)
|
||||
|
||||
self.auto_combobox.set_active(
|
||||
self.auto_index[gajim.connections[self.account].auto])
|
||||
self.method_auto_combobox.set_active(
|
||||
self.method_foo_index[gajim.connections[self.account].method_auto])
|
||||
self.method_local_combobox.set_active(
|
||||
self.method_foo_index[gajim.connections[self.account].method_local])
|
||||
self.method_manual_combobox.set_active(
|
||||
self.method_foo_index[gajim.connections[self.account].\
|
||||
method_manual])
|
||||
|
||||
model = Gtk.ListStore(str, str, str, str)
|
||||
self.item_treeview.set_model(model)
|
||||
col = Gtk.TreeViewColumn('jid')
|
||||
self.item_treeview.append_column(col)
|
||||
renderer = Gtk.CellRendererText()
|
||||
col.pack_start(renderer, True, True, 0)
|
||||
col.set_attributes(renderer, text=0)
|
||||
|
||||
col = Gtk.TreeViewColumn('expire')
|
||||
col.pack_start(renderer, True, True, 0)
|
||||
col.set_attributes(renderer, text=1)
|
||||
self.item_treeview.append_column(col)
|
||||
|
||||
col = Gtk.TreeViewColumn('otr')
|
||||
col.pack_start(renderer, True, True, 0)
|
||||
col.set_attributes(renderer, text=2)
|
||||
self.item_treeview.append_column(col)
|
||||
|
||||
col = Gtk.TreeViewColumn('save')
|
||||
col.pack_start(renderer, True, True, 0)
|
||||
col.set_attributes(renderer, text=3)
|
||||
self.item_treeview.append_column(col)
|
||||
|
||||
self.fill_items()
|
||||
|
||||
self.current_item = None
|
||||
|
||||
def sort_items(model, iter1, iter2, data=None):
|
||||
item1 = model.get_value(iter1, 0)
|
||||
item2 = model.get_value(iter2, 0)
|
||||
if item1 == 'Default':
|
||||
return -1
|
||||
if item2 == 'Default':
|
||||
return 1
|
||||
if '@' in item1:
|
||||
if '@' not in item2:
|
||||
return 1
|
||||
elif '@' in item2:
|
||||
return -1
|
||||
if item1 < item2:
|
||||
return -1
|
||||
if item1 > item2:
|
||||
return 1
|
||||
# item1 == item2 ? WTF?
|
||||
return 0
|
||||
|
||||
model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
||||
model.set_sort_func(0, sort_items)
|
||||
|
||||
self.remove_button.set_sensitive(False)
|
||||
self.edit_button.set_sensitive(False)
|
||||
|
||||
self.window.set_title(_('Archiving Preferences for %s') % self.account)
|
||||
|
||||
gajim.ged.register_event_handler(
|
||||
'archiving-preferences-changed-received', ged.GUI1,
|
||||
self._nec_archiving_changed_received)
|
||||
gajim.ged.register_event_handler('archiving-error-received', ged.GUI1,
|
||||
self._nec_archiving_error)
|
||||
|
||||
self.window.show_all()
|
||||
|
||||
self.xml.connect_signals(self)
|
||||
|
||||
def on_add_item_button_clicked(self, widget):
|
||||
key_name = 'new_item_archiving_preferences'
|
||||
if key_name in gajim.interface.instances[self.account]:
|
||||
gajim.interface.instances[self.account][key_name].window.present()
|
||||
else:
|
||||
gajim.interface.instances[self.account][key_name] = \
|
||||
ItemArchivingPreferencesWindow(self.account, '')
|
||||
|
||||
def on_remove_item_button_clicked(self, widget):
|
||||
if not self.current_item:
|
||||
return
|
||||
|
||||
self.waiting.append('itemremove')
|
||||
sel = self.item_treeview.get_selection()
|
||||
(model, iter_) = sel.get_selected()
|
||||
gajim.connections[self.account].remove_item(model[iter_][0])
|
||||
model.remove(iter_)
|
||||
self.remove_button.set_sensitive(False)
|
||||
self.edit_button.set_sensitive(False)
|
||||
|
||||
def on_edit_item_button_clicked(self, widget):
|
||||
if not self.current_item:
|
||||
return
|
||||
|
||||
key_name = 'edit_item_archiving_preferences_%s' % self.current_item
|
||||
if key_name in gajim.interface.instances[self.account]:
|
||||
gajim.interface.instances[self.account][key_name].window.present()
|
||||
else:
|
||||
gajim.interface.instances[self.account][key_name] = \
|
||||
ItemArchivingPreferencesWindow(self.account, self.current_item)
|
||||
|
||||
def on_item_treeview_cursor_changed(self, widget):
|
||||
sel = self.item_treeview.get_selection()
|
||||
(model, iter_) = sel.get_selected()
|
||||
item = None
|
||||
if iter_:
|
||||
item = model[iter_][0]
|
||||
if self.current_item and self.current_item == item:
|
||||
return
|
||||
|
||||
self.current_item = item
|
||||
if self.current_item == 'Default':
|
||||
self.remove_button.set_sensitive(False)
|
||||
self.edit_button.set_sensitive(True)
|
||||
elif self.current_item:
|
||||
self.remove_button.set_sensitive(True)
|
||||
self.edit_button.set_sensitive(True)
|
||||
else:
|
||||
self.remove_button.set_sensitive(False)
|
||||
self.edit_button.set_sensitive(False)
|
||||
|
||||
def on_auto_combobox_changed(self, widget):
|
||||
save = self.auto_name[widget.get_active()]
|
||||
gajim.connections[self.account].set_auto(save)
|
||||
|
||||
def on_method_foo_combobox_changed(self, widget):
|
||||
# We retrieve method type from widget name
|
||||
# ('foo' in 'method_foo_combobox')
|
||||
method_type = widget.name.split('_')[1]
|
||||
use = self.method_foo_name[widget.get_active()]
|
||||
self.waiting.append('method_%s' % method_type)
|
||||
gajim.connections[self.account].set_method(method_type, use)
|
||||
|
||||
def get_child_window(self):
|
||||
edit_key_name = 'edit_item_archiving_preferences_%s' % self.current_item
|
||||
new_key_name = 'new_item_archiving_preferences'
|
||||
|
||||
if edit_key_name in gajim.interface.instances[self.account]:
|
||||
return gajim.interface.instances[self.account][edit_key_name]
|
||||
|
||||
if new_key_name in gajim.interface.instances[self.account]:
|
||||
return gajim.interface.instances[self.account][new_key_name]
|
||||
|
||||
def _nec_archiving_changed_received(self, obj):
|
||||
if obj.conn.name != self.account:
|
||||
return
|
||||
for key in ('auto', 'method_auto', 'method_local', 'method_manual'):
|
||||
if key in obj.conf and key in self.waiting:
|
||||
self.waiting.remove(key)
|
||||
if 'default' in obj.conf:
|
||||
key_name = 'edit_item_archiving_preferences_%s' % \
|
||||
self.current_item
|
||||
if key_name in gajim.interface.instances[self.account]:
|
||||
gajim.interface.instances[self.account][key_name].\
|
||||
response_arrived(obj.conf['default'])
|
||||
self.fill_items(True)
|
||||
for jid, pref in obj.new_items.items():
|
||||
child = self.get_child_window()
|
||||
if child:
|
||||
is_new = not child.item
|
||||
child.response_arrived(pref)
|
||||
if is_new:
|
||||
model = self.item_treeview.get_model()
|
||||
model.append((jid, pref['expire'], pref['otr'],
|
||||
pref['save']))
|
||||
continue
|
||||
self.fill_items(True)
|
||||
if 'itemremove' in self.waiting and obj.removed_items:
|
||||
self.waiting.remove('itemremove')
|
||||
self.fill_items(True)
|
||||
|
||||
def fill_items(self, clear=False):
|
||||
model = self.item_treeview.get_model()
|
||||
if clear:
|
||||
model.clear()
|
||||
default_config = gajim.connections[self.account].default
|
||||
expire_value = default_config['expire'] or ''
|
||||
model.append(('Default', expire_value,
|
||||
default_config['otr'], default_config['save']))
|
||||
for item, item_config in \
|
||||
gajim.connections[self.account].items.items():
|
||||
expire_value = item_config['expire'] or ''
|
||||
model.append((item, expire_value, item_config['otr'],
|
||||
item_config['save']))
|
||||
|
||||
def _nec_archiving_error(self, obj):
|
||||
if obj.conn.name != self.account:
|
||||
return
|
||||
if self.waiting:
|
||||
pritext = _('There is an error')
|
||||
sectext = obj.error_msg
|
||||
ErrorDialog(pritext, sectext)
|
||||
self.waiting.pop()
|
||||
else:
|
||||
child = self.get_child_window()
|
||||
if child:
|
||||
child.error_arrived(obj.error_msg)
|
||||
|
||||
def on_close_button_clicked(self, widget):
|
||||
self.window.destroy()
|
||||
|
||||
def on_archiving_preferences_window_destroy(self, widget):
|
||||
gajim.ged.remove_event_handler(
|
||||
'archiving-preferences-changed-received', ged.GUI1,
|
||||
self._nec_archiving_changed_received)
|
||||
gajim.ged.remove_event_handler('archiving-error-received', ged.GUI1,
|
||||
self._nec_archiving_error)
|
||||
if 'archiving_preferences' in gajim.interface.instances[self.account]:
|
||||
del gajim.interface.instances[self.account]['archiving_preferences']
|
||||
|
||||
|
||||
class Archiving313PreferencesWindow:
|
||||
|
||||
default_dict = {'always': 0, 'roster': 1, 'never': 2}
|
||||
|
|
|
@ -1178,13 +1178,6 @@ class Interface:
|
|||
# Else disable autoaway
|
||||
gajim.sleeper_state[account] = 'off'
|
||||
|
||||
if obj.conn.archiving_136_supported and gajim.config.get_per('accounts',
|
||||
account, 'sync_logs_with_server'):
|
||||
# Start merging logs from server
|
||||
obj.conn.request_modifications_page(gajim.config.get_per('accounts',
|
||||
account, 'last_archiving_time'))
|
||||
gajim.config.set_per('accounts', account, 'last_archiving_time',
|
||||
time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()))
|
||||
if obj.conn.archiving_313_supported and gajim.config.get_per('accounts',
|
||||
account, 'sync_logs_with_server'):
|
||||
obj.conn.request_archive_on_signin()
|
||||
|
|
|
@ -5544,8 +5544,7 @@ class RosterWindow:
|
|||
self.on_privacy_lists_menuitem_activate, account)
|
||||
else:
|
||||
privacy_lists_menuitem.set_sensitive(False)
|
||||
if gajim.connections[account].archive_pref_supported or \
|
||||
gajim.connections[account].archiving_313_supported:
|
||||
if gajim.connections[account].archiving_313_supported:
|
||||
archiving_preferences_menuitem.connect(
|
||||
'activate',
|
||||
self.on_archiving_preferences_menuitem_activate, account)
|
||||
|
|
Loading…
Reference in New Issue