Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
9ff601d0
by Philipp Hörist at 2017-07-28T00:07:49+02:00
12 changed files:
- − data/gui/archiving_preferences_window.ui
- − data/gui/item_archiving_preferences_window.ui
- gajim/app_actions.py
- gajim/chat_control.py
- gajim/common/config.py
- gajim/common/connection.py
- gajim/common/connection_handlers.py
- gajim/common/connection_handlers_events.py
- gajim/common/message_archiving.py
- gajim/dialogs.py
- gajim/gui_interface.py
- gajim/roster_window.py
Changes:
| 1 |
-<?xml version="1.0" encoding="UTF-8"?>
|
|
| 2 |
-<!-- Generated with glade 3.18.3 -->
|
|
| 3 |
-<interface>
|
|
| 4 |
- <requires lib="gtk+" version="3.12"/>
|
|
| 5 |
- <object class="GtkListStore" id="liststore1">
|
|
| 6 |
- <columns>
|
|
| 7 |
- <!-- column-name item -->
|
|
| 8 |
- <column type="gchararray"/>
|
|
| 9 |
- </columns>
|
|
| 10 |
- <data>
|
|
| 11 |
- <row>
|
|
| 12 |
- <col id="0" translatable="yes">No</col>
|
|
| 13 |
- </row>
|
|
| 14 |
- <row>
|
|
| 15 |
- <col id="0" translatable="yes">Yes</col>
|
|
| 16 |
- </row>
|
|
| 17 |
- </data>
|
|
| 18 |
- </object>
|
|
| 19 |
- <object class="GtkListStore" id="liststore2">
|
|
| 20 |
- <columns>
|
|
| 21 |
- <!-- column-name item -->
|
|
| 22 |
- <column type="gchararray"/>
|
|
| 23 |
- </columns>
|
|
| 24 |
- <data>
|
|
| 25 |
- <row>
|
|
| 26 |
- <col id="0" translatable="yes">Prefer</col>
|
|
| 27 |
- </row>
|
|
| 28 |
- <row>
|
|
| 29 |
- <col id="0" translatable="yes">Concede</col>
|
|
| 30 |
- </row>
|
|
| 31 |
- <row>
|
|
| 32 |
- <col id="0" translatable="yes">Forbid</col>
|
|
| 33 |
- </row>
|
|
| 34 |
- </data>
|
|
| 35 |
- </object>
|
|
| 36 |
- <object class="GtkListStore" id="liststore3">
|
|
| 37 |
- <columns>
|
|
| 38 |
- <!-- column-name item -->
|
|
| 39 |
- <column type="gchararray"/>
|
|
| 40 |
- </columns>
|
|
| 41 |
- <data>
|
|
| 42 |
- <row>
|
|
| 43 |
- <col id="0" translatable="yes">Prefer</col>
|
|
| 44 |
- </row>
|
|
| 45 |
- <row>
|
|
| 46 |
- <col id="0" translatable="yes">Concede</col>
|
|
| 47 |
- </row>
|
|
| 48 |
- <row>
|
|
| 49 |
- <col id="0" translatable="yes">Forbid</col>
|
|
| 50 |
- </row>
|
|
| 51 |
- </data>
|
|
| 52 |
- </object>
|
|
| 53 |
- <object class="GtkListStore" id="liststore4">
|
|
| 54 |
- <columns>
|
|
| 55 |
- <!-- column-name item -->
|
|
| 56 |
- <column type="gchararray"/>
|
|
| 57 |
- </columns>
|
|
| 58 |
- <data>
|
|
| 59 |
- <row>
|
|
| 60 |
- <col id="0" translatable="yes">Prefer</col>
|
|
| 61 |
- </row>
|
|
| 62 |
- <row>
|
|
| 63 |
- <col id="0" translatable="yes">Concede</col>
|
|
| 64 |
- </row>
|
|
| 65 |
- <row>
|
|
| 66 |
- <col id="0" translatable="yes">Forbid</col>
|
|
| 67 |
- </row>
|
|
| 68 |
- </data>
|
|
| 69 |
- </object>
|
|
| 70 |
- <object class="GtkWindow" id="archiving_preferences_window">
|
|
| 71 |
- <property name="can_focus">False</property>
|
|
| 72 |
- <property name="border_width">12</property>
|
|
| 73 |
- <property name="type_hint">dialog</property>
|
|
| 74 |
- <signal name="destroy" handler="on_archiving_preferences_window_destroy" swapped="no"/>
|
|
| 75 |
- <child>
|
|
| 76 |
- <object class="GtkBox" id="vbox1">
|
|
| 77 |
- <property name="visible">True</property>
|
|
| 78 |
- <property name="can_focus">False</property>
|
|
| 79 |
- <property name="orientation">vertical</property>
|
|
| 80 |
- <property name="spacing">6</property>
|
|
| 81 |
- <child>
|
|
| 82 |
- <object class="GtkGrid" id="grid1">
|
|
| 83 |
- <property name="visible">True</property>
|
|
| 84 |
- <property name="can_focus">False</property>
|
|
| 85 |
- <property name="row_spacing">6</property>
|
|
| 86 |
- <property name="column_spacing">6</property>
|
|
| 87 |
- <child>
|
|
| 88 |
- <object class="GtkLabel" id="label5">
|
|
| 89 |
- <property name="visible">True</property>
|
|
| 90 |
- <property name="can_focus">False</property>
|
|
| 91 |
- <property name="label" translatable="yes">Auto</property>
|
|
| 92 |
- </object>
|
|
| 93 |
- <packing>
|
|
| 94 |
- <property name="left_attach">0</property>
|
|
| 95 |
- <property name="top_attach">0</property>
|
|
| 96 |
- </packing>
|
|
| 97 |
- </child>
|
|
| 98 |
- <child>
|
|
| 99 |
- <object class="GtkLabel" id="label2">
|
|
| 100 |
- <property name="visible">True</property>
|
|
| 101 |
- <property name="can_focus">False</property>
|
|
| 102 |
- <property name="label" translatable="yes"><i>Method Auto</i></property>
|
|
| 103 |
- <property name="use_markup">True</property>
|
|
| 104 |
- </object>
|
|
| 105 |
- <packing>
|
|
| 106 |
- <property name="left_attach">0</property>
|
|
| 107 |
- <property name="top_attach">1</property>
|
|
| 108 |
- </packing>
|
|
| 109 |
- </child>
|
|
| 110 |
- <child>
|
|
| 111 |
- <object class="GtkLabel" id="label3">
|
|
| 112 |
- <property name="visible">True</property>
|
|
| 113 |
- <property name="can_focus">False</property>
|
|
| 114 |
- <property name="label" translatable="yes"><i>Method Local</i></property>
|
|
| 115 |
- <property name="use_markup">True</property>
|
|
| 116 |
- </object>
|
|
| 117 |
- <packing>
|
|
| 118 |
- <property name="left_attach">0</property>
|
|
| 119 |
- <property name="top_attach">2</property>
|
|
| 120 |
- </packing>
|
|
| 121 |
- </child>
|
|
| 122 |
- <child>
|
|
| 123 |
- <object class="GtkLabel" id="label4">
|
|
| 124 |
- <property name="visible">True</property>
|
|
| 125 |
- <property name="can_focus">False</property>
|
|
| 126 |
- <property name="label" translatable="yes"><i>Method Manual</i></property>
|
|
| 127 |
- <property name="use_markup">True</property>
|
|
| 128 |
- </object>
|
|
| 129 |
- <packing>
|
|
| 130 |
- <property name="left_attach">0</property>
|
|
| 131 |
- <property name="top_attach">3</property>
|
|
| 132 |
- </packing>
|
|
| 133 |
- </child>
|
|
| 134 |
- <child>
|
|
| 135 |
- <object class="GtkComboBox" id="auto_combobox">
|
|
| 136 |
- <property name="visible">True</property>
|
|
| 137 |
- <property name="can_focus">False</property>
|
|
| 138 |
- <property name="model">liststore1</property>
|
|
| 139 |
- <signal name="changed" handler="on_auto_combobox_changed" swapped="no"/>
|
|
| 140 |
- <child>
|
|
| 141 |
- <object class="GtkCellRendererText" id="cellrenderertext1"/>
|
|
| 142 |
- <attributes>
|
|
| 143 |
- <attribute name="text">0</attribute>
|
|
| 144 |
- </attributes>
|
|
| 145 |
- </child>
|
|
| 146 |
- </object>
|
|
| 147 |
- <packing>
|
|
| 148 |
- <property name="left_attach">1</property>
|
|
| 149 |
- <property name="top_attach">0</property>
|
|
| 150 |
- </packing>
|
|
| 151 |
- </child>
|
|
| 152 |
- <child>
|
|
| 153 |
- <object class="GtkComboBox" id="method_auto_combobox">
|
|
| 154 |
- <property name="visible">True</property>
|
|
| 155 |
- <property name="can_focus">False</property>
|
|
| 156 |
- <property name="model">liststore2</property>
|
|
| 157 |
- <signal name="changed" handler="on_method_foo_combobox_changed" swapped="no"/>
|
|
| 158 |
- <child>
|
|
| 159 |
- <object class="GtkCellRendererText" id="cellrenderertext2"/>
|
|
| 160 |
- <attributes>
|
|
| 161 |
- <attribute name="text">0</attribute>
|
|
| 162 |
- </attributes>
|
|
| 163 |
- </child>
|
|
| 164 |
- </object>
|
|
| 165 |
- <packing>
|
|
| 166 |
- <property name="left_attach">1</property>
|
|
| 167 |
- <property name="top_attach">1</property>
|
|
| 168 |
- </packing>
|
|
| 169 |
- </child>
|
|
| 170 |
- <child>
|
|
| 171 |
- <object class="GtkComboBox" id="method_local_combobox">
|
|
| 172 |
- <property name="visible">True</property>
|
|
| 173 |
- <property name="can_focus">False</property>
|
|
| 174 |
- <property name="model">liststore3</property>
|
|
| 175 |
- <signal name="changed" handler="on_method_foo_combobox_changed" swapped="no"/>
|
|
| 176 |
- <child>
|
|
| 177 |
- <object class="GtkCellRendererText" id="cellrenderertext3"/>
|
|
| 178 |
- <attributes>
|
|
| 179 |
- <attribute name="text">0</attribute>
|
|
| 180 |
- </attributes>
|
|
| 181 |
- </child>
|
|
| 182 |
- </object>
|
|
| 183 |
- <packing>
|
|
| 184 |
- <property name="left_attach">1</property>
|
|
| 185 |
- <property name="top_attach">2</property>
|
|
| 186 |
- </packing>
|
|
| 187 |
- </child>
|
|
| 188 |
- <child>
|
|
| 189 |
- <object class="GtkComboBox" id="method_manual_combobox">
|
|
| 190 |
- <property name="visible">True</property>
|
|
| 191 |
- <property name="can_focus">False</property>
|
|
| 192 |
- <property name="model">liststore4</property>
|
|
| 193 |
- <signal name="changed" handler="on_method_foo_combobox_changed" swapped="no"/>
|
|
| 194 |
- <child>
|
|
| 195 |
- <object class="GtkCellRendererText" id="cellrenderertext4"/>
|
|
| 196 |
- <attributes>
|
|
| 197 |
- <attribute name="text">0</attribute>
|
|
| 198 |
- </attributes>
|
|
| 199 |
- </child>
|
|
| 200 |
- </object>
|
|
| 201 |
- <packing>
|
|
| 202 |
- <property name="left_attach">1</property>
|
|
| 203 |
- <property name="top_attach">3</property>
|
|
| 204 |
- </packing>
|
|
| 205 |
- </child>
|
|
| 206 |
- </object>
|
|
| 207 |
- <packing>
|
|
| 208 |
- <property name="expand">False</property>
|
|
| 209 |
- <property name="fill">True</property>
|
|
| 210 |
- <property name="position">0</property>
|
|
| 211 |
- </packing>
|
|
| 212 |
- </child>
|
|
| 213 |
- <child>
|
|
| 214 |
- <object class="GtkScrolledWindow" id="scrolledwindow1">
|
|
| 215 |
- <property name="visible">True</property>
|
|
| 216 |
- <property name="can_focus">True</property>
|
|
| 217 |
- <child>
|
|
| 218 |
- <object class="GtkTreeView" id="item_treeview">
|
|
| 219 |
- <property name="visible">True</property>
|
|
| 220 |
- <property name="can_focus">True</property>
|
|
| 221 |
- <signal name="cursor-changed" handler="on_item_treeview_cursor_changed" swapped="no"/>
|
|
| 222 |
- <child internal-child="selection">
|
|
| 223 |
- <object class="GtkTreeSelection" id="treeview-selection"/>
|
|
| 224 |
- </child>
|
|
| 225 |
- </object>
|
|
| 226 |
- </child>
|
|
| 227 |
- </object>
|
|
| 228 |
- <packing>
|
|
| 229 |
- <property name="expand">False</property>
|
|
| 230 |
- <property name="fill">True</property>
|
|
| 231 |
- <property name="position">1</property>
|
|
| 232 |
- </packing>
|
|
| 233 |
- </child>
|
|
| 234 |
- <child>
|
|
| 235 |
- <object class="GtkButtonBox" id="hbuttonbox2">
|
|
| 236 |
- <property name="visible">True</property>
|
|
| 237 |
- <property name="can_focus">False</property>
|
|
| 238 |
- <property name="layout_style">spread</property>
|
|
| 239 |
- <child>
|
|
| 240 |
- <object class="GtkButton" id="add_button">
|
|
| 241 |
- <property name="label">gtk-add</property>
|
|
| 242 |
- <property name="visible">True</property>
|
|
| 243 |
- <property name="can_focus">True</property>
|
|
| 244 |
- <property name="receives_default">True</property>
|
|
| 245 |
- <property name="use_stock">True</property>
|
|
| 246 |
- <signal name="clicked" handler="on_add_item_button_clicked" swapped="no"/>
|
|
| 247 |
- </object>
|
|
| 248 |
- <packing>
|
|
| 249 |
- <property name="expand">False</property>
|
|
| 250 |
- <property name="fill">False</property>
|
|
| 251 |
- <property name="position">0</property>
|
|
| 252 |
- </packing>
|
|
| 253 |
- </child>
|
|
| 254 |
- <child>
|
|
| 255 |
- <object class="GtkButton" id="remove_button">
|
|
| 256 |
- <property name="label">gtk-remove</property>
|
|
| 257 |
- <property name="visible">True</property>
|
|
| 258 |
- <property name="can_focus">True</property>
|
|
| 259 |
- <property name="receives_default">True</property>
|
|
| 260 |
- <property name="use_stock">True</property>
|
|
| 261 |
- <signal name="clicked" handler="on_remove_item_button_clicked" swapped="no"/>
|
|
| 262 |
- </object>
|
|
| 263 |
- <packing>
|
|
| 264 |
- <property name="expand">False</property>
|
|
| 265 |
- <property name="fill">False</property>
|
|
| 266 |
- <property name="position">1</property>
|
|
| 267 |
- </packing>
|
|
| 268 |
- </child>
|
|
| 269 |
- <child>
|
|
| 270 |
- <object class="GtkButton" id="edit_button">
|
|
| 271 |
- <property name="label">gtk-edit</property>
|
|
| 272 |
- <property name="visible">True</property>
|
|
| 273 |
- <property name="can_focus">True</property>
|
|
| 274 |
- <property name="receives_default">True</property>
|
|
| 275 |
- <property name="use_stock">True</property>
|
|
| 276 |
- <signal name="clicked" handler="on_edit_item_button_clicked" swapped="no"/>
|
|
| 277 |
- </object>
|
|
| 278 |
- <packing>
|
|
| 279 |
- <property name="expand">False</property>
|
|
| 280 |
- <property name="fill">False</property>
|
|
| 281 |
- <property name="position">2</property>
|
|
| 282 |
- </packing>
|
|
| 283 |
- </child>
|
|
| 284 |
- </object>
|
|
| 285 |
- <packing>
|
|
| 286 |
- <property name="expand">False</property>
|
|
| 287 |
- <property name="fill">True</property>
|
|
| 288 |
- <property name="position">2</property>
|
|
| 289 |
- </packing>
|
|
| 290 |
- </child>
|
|
| 291 |
- <child>
|
|
| 292 |
- <object class="GtkButtonBox" id="hbuttonbox1">
|
|
| 293 |
- <property name="visible">True</property>
|
|
| 294 |
- <property name="can_focus">False</property>
|
|
| 295 |
- <property name="layout_style">end</property>
|
|
| 296 |
- <child>
|
|
| 297 |
- <object class="GtkButton" id="close_button">
|
|
| 298 |
- <property name="label">gtk-close</property>
|
|
| 299 |
- <property name="visible">True</property>
|
|
| 300 |
- <property name="can_focus">True</property>
|
|
| 301 |
- <property name="can_default">True</property>
|
|
| 302 |
- <property name="receives_default">False</property>
|
|
| 303 |
- <property name="use_stock">True</property>
|
|
| 304 |
- <signal name="clicked" handler="on_close_button_clicked" swapped="no"/>
|
|
| 305 |
- </object>
|
|
| 306 |
- <packing>
|
|
| 307 |
- <property name="expand">False</property>
|
|
| 308 |
- <property name="fill">False</property>
|
|
| 309 |
- <property name="position">0</property>
|
|
| 310 |
- </packing>
|
|
| 311 |
- </child>
|
|
| 312 |
- </object>
|
|
| 313 |
- <packing>
|
|
| 314 |
- <property name="expand">False</property>
|
|
| 315 |
- <property name="fill">True</property>
|
|
| 316 |
- <property name="position">3</property>
|
|
| 317 |
- </packing>
|
|
| 318 |
- </child>
|
|
| 319 |
- </object>
|
|
| 320 |
- </child>
|
|
| 321 |
- </object>
|
|
| 322 |
-</interface>
|
| 1 |
-<?xml version="1.0" encoding="UTF-8"?>
|
|
| 2 |
-<!-- Generated with glade 3.18.3 -->
|
|
| 3 |
-<interface>
|
|
| 4 |
- <requires lib="gtk+" version="3.12"/>
|
|
| 5 |
- <object class="GtkListStore" id="liststore1">
|
|
| 6 |
- <columns>
|
|
| 7 |
- <!-- column-name item -->
|
|
| 8 |
- <column type="gchararray"/>
|
|
| 9 |
- </columns>
|
|
| 10 |
- <data>
|
|
| 11 |
- <row>
|
|
| 12 |
- <col id="0" translatable="yes">body</col>
|
|
| 13 |
- </row>
|
|
| 14 |
- <row>
|
|
| 15 |
- <col id="0" translatable="yes">false</col>
|
|
| 16 |
- </row>
|
|
| 17 |
- <row>
|
|
| 18 |
- <col id="0" translatable="yes">message</col>
|
|
| 19 |
- </row>
|
|
| 20 |
- <row>
|
|
| 21 |
- <col id="0" translatable="yes">stream</col>
|
|
| 22 |
- </row>
|
|
| 23 |
- </data>
|
|
| 24 |
- </object>
|
|
| 25 |
- <object class="GtkListStore" id="liststore2">
|
|
| 26 |
- <columns>
|
|
| 27 |
- <!-- column-name item -->
|
|
| 28 |
- <column type="gchararray"/>
|
|
| 29 |
- </columns>
|
|
| 30 |
- <data>
|
|
| 31 |
- <row>
|
|
| 32 |
- <col id="0" translatable="yes">approve</col>
|
|
| 33 |
- </row>
|
|
| 34 |
- <row>
|
|
| 35 |
- <col id="0" translatable="yes">concede</col>
|
|
| 36 |
- </row>
|
|
| 37 |
- <row>
|
|
| 38 |
- <col id="0" translatable="yes">forbid</col>
|
|
| 39 |
- </row>
|
|
| 40 |
- <row>
|
|
| 41 |
- <col id="0" translatable="yes">oppose</col>
|
|
| 42 |
- </row>
|
|
| 43 |
- <row>
|
|
| 44 |
- <col id="0" translatable="yes">prefer</col>
|
|
| 45 |
- </row>
|
|
| 46 |
- <row>
|
|
| 47 |
- <col id="0" translatable="yes">require</col>
|
|
| 48 |
- </row>
|
|
| 49 |
- </data>
|
|
| 50 |
- </object>
|
|
| 51 |
- <object class="GtkWindow" id="item_archiving_preferences_window">
|
|
| 52 |
- <property name="can_focus">False</property>
|
|
| 53 |
- <property name="border_width">12</property>
|
|
| 54 |
- <property name="type_hint">dialog</property>
|
|
| 55 |
- <signal name="destroy" handler="on_item_archiving_preferences_window_destroy" swapped="no"/>
|
|
| 56 |
- <child>
|
|
| 57 |
- <object class="GtkBox" id="vbox1">
|
|
| 58 |
- <property name="visible">True</property>
|
|
| 59 |
- <property name="can_focus">False</property>
|
|
| 60 |
- <property name="orientation">vertical</property>
|
|
| 61 |
- <property name="spacing">12</property>
|
|
| 62 |
- <child>
|
|
| 63 |
- <object class="GtkGrid" id="grid1">
|
|
| 64 |
- <property name="visible">True</property>
|
|
| 65 |
- <property name="can_focus">False</property>
|
|
| 66 |
- <property name="row_spacing">6</property>
|
|
| 67 |
- <property name="column_spacing">6</property>
|
|
| 68 |
- <child>
|
|
| 69 |
- <object class="GtkLabel" id="label1">
|
|
| 70 |
- <property name="visible">True</property>
|
|
| 71 |
- <property name="can_focus">False</property>
|
|
| 72 |
- <property name="label" translatable="yes">jid</property>
|
|
| 73 |
- </object>
|
|
| 74 |
- <packing>
|
|
| 75 |
- <property name="left_attach">0</property>
|
|
| 76 |
- <property name="top_attach">0</property>
|
|
| 77 |
- </packing>
|
|
| 78 |
- </child>
|
|
| 79 |
- <child>
|
|
| 80 |
- <object class="GtkLabel" id="label8">
|
|
| 81 |
- <property name="visible">True</property>
|
|
| 82 |
- <property name="can_focus">False</property>
|
|
| 83 |
- <property name="label" translatable="yes">expire</property>
|
|
| 84 |
- </object>
|
|
| 85 |
- <packing>
|
|
| 86 |
- <property name="left_attach">0</property>
|
|
| 87 |
- <property name="top_attach">1</property>
|
|
| 88 |
- </packing>
|
|
| 89 |
- </child>
|
|
| 90 |
- <child>
|
|
| 91 |
- <object class="GtkLabel" id="label9">
|
|
| 92 |
- <property name="visible">True</property>
|
|
| 93 |
- <property name="can_focus">False</property>
|
|
| 94 |
- <property name="label" translatable="yes">otr</property>
|
|
| 95 |
- </object>
|
|
| 96 |
- <packing>
|
|
| 97 |
- <property name="left_attach">0</property>
|
|
| 98 |
- <property name="top_attach">2</property>
|
|
| 99 |
- </packing>
|
|
| 100 |
- </child>
|
|
| 101 |
- <child>
|
|
| 102 |
- <object class="GtkLabel" id="label10">
|
|
| 103 |
- <property name="visible">True</property>
|
|
| 104 |
- <property name="can_focus">False</property>
|
|
| 105 |
- <property name="label" translatable="yes">save</property>
|
|
| 106 |
- </object>
|
|
| 107 |
- <packing>
|
|
| 108 |
- <property name="left_attach">0</property>
|
|
| 109 |
- <property name="top_attach">3</property>
|
|
| 110 |
- </packing>
|
|
| 111 |
- </child>
|
|
| 112 |
- <child>
|
|
| 113 |
- <object class="GtkEntry" id="jid_entry">
|
|
| 114 |
- <property name="visible">True</property>
|
|
| 115 |
- <property name="can_focus">True</property>
|
|
| 116 |
- <property name="hexpand">True</property>
|
|
| 117 |
- <property name="invisible_char">•</property>
|
|
| 118 |
- </object>
|
|
| 119 |
- <packing>
|
|
| 120 |
- <property name="left_attach">1</property>
|
|
| 121 |
- <property name="top_attach">0</property>
|
|
| 122 |
- </packing>
|
|
| 123 |
- </child>
|
|
| 124 |
- <child>
|
|
| 125 |
- <object class="GtkEntry" id="expire_entry">
|
|
| 126 |
- <property name="visible">True</property>
|
|
| 127 |
- <property name="can_focus">True</property>
|
|
| 128 |
- <property name="invisible_char">•</property>
|
|
| 129 |
- </object>
|
|
| 130 |
- <packing>
|
|
| 131 |
- <property name="left_attach">1</property>
|
|
| 132 |
- <property name="top_attach">1</property>
|
|
| 133 |
- </packing>
|
|
| 134 |
- </child>
|
|
| 135 |
- <child>
|
|
| 136 |
- <object class="GtkComboBox" id="otr_combobox">
|
|
| 137 |
- <property name="visible">True</property>
|
|
| 138 |
- <property name="can_focus">False</property>
|
|
| 139 |
- <property name="model">liststore2</property>
|
|
| 140 |
- <signal name="changed" handler="on_otr_combobox_changed" swapped="no"/>
|
|
| 141 |
- <child>
|
|
| 142 |
- <object class="GtkCellRendererText" id="cellrenderertext2"/>
|
|
| 143 |
- <attributes>
|
|
| 144 |
- <attribute name="text">0</attribute>
|
|
| 145 |
- </attributes>
|
|
| 146 |
- </child>
|
|
| 147 |
- </object>
|
|
| 148 |
- <packing>
|
|
| 149 |
- <property name="left_attach">1</property>
|
|
| 150 |
- <property name="top_attach">2</property>
|
|
| 151 |
- </packing>
|
|
| 152 |
- </child>
|
|
| 153 |
- <child>
|
|
| 154 |
- <object class="GtkComboBox" id="save_combobox">
|
|
| 155 |
- <property name="visible">True</property>
|
|
| 156 |
- <property name="can_focus">False</property>
|
|
| 157 |
- <property name="model">liststore1</property>
|
|
| 158 |
- <child>
|
|
| 159 |
- <object class="GtkCellRendererText" id="cellrenderertext1"/>
|
|
| 160 |
- <attributes>
|
|
| 161 |
- <attribute name="text">0</attribute>
|
|
| 162 |
- </attributes>
|
|
| 163 |
- </child>
|
|
| 164 |
- </object>
|
|
| 165 |
- <packing>
|
|
| 166 |
- <property name="left_attach">1</property>
|
|
| 167 |
- <property name="top_attach">3</property>
|
|
| 168 |
- </packing>
|
|
| 169 |
- </child>
|
|
| 170 |
- </object>
|
|
| 171 |
- <packing>
|
|
| 172 |
- <property name="expand">False</property>
|
|
| 173 |
- <property name="fill">True</property>
|
|
| 174 |
- <property name="position">0</property>
|
|
| 175 |
- </packing>
|
|
| 176 |
- </child>
|
|
| 177 |
- <child>
|
|
| 178 |
- <object class="GtkBox" id="hbox1">
|
|
| 179 |
- <property name="visible">True</property>
|
|
| 180 |
- <property name="can_focus">False</property>
|
|
| 181 |
- <child>
|
|
| 182 |
- <object class="GtkProgressBar" id="progressbar">
|
|
| 183 |
- <property name="can_focus">False</property>
|
|
| 184 |
- <property name="hexpand">True</property>
|
|
| 185 |
- </object>
|
|
| 186 |
- <packing>
|
|
| 187 |
- <property name="expand">False</property>
|
|
| 188 |
- <property name="fill">False</property>
|
|
| 189 |
- <property name="position">0</property>
|
|
| 190 |
- </packing>
|
|
| 191 |
- </child>
|
|
| 192 |
- <child>
|
|
| 193 |
- <object class="GtkButtonBox" id="hbuttonbox1">
|
|
| 194 |
- <property name="visible">True</property>
|
|
| 195 |
- <property name="can_focus">False</property>
|
|
| 196 |
- <property name="layout_style">end</property>
|
|
| 197 |
- <child>
|
|
| 198 |
- <object class="GtkButton" id="cancel_button">
|
|
| 199 |
- <property name="label">gtk-cancel</property>
|
|
| 200 |
- <property name="visible">True</property>
|
|
| 201 |
- <property name="can_focus">True</property>
|
|
| 202 |
- <property name="receives_default">True</property>
|
|
| 203 |
- <property name="use_stock">True</property>
|
|
| 204 |
- <signal name="clicked" handler="on_cancel_button_clicked" swapped="no"/>
|
|
| 205 |
- </object>
|
|
| 206 |
- <packing>
|
|
| 207 |
- <property name="expand">False</property>
|
|
| 208 |
- <property name="fill">False</property>
|
|
| 209 |
- <property name="position">0</property>
|
|
| 210 |
- </packing>
|
|
| 211 |
- </child>
|
|
| 212 |
- <child>
|
|
| 213 |
- <object class="GtkButton" id="ok_button">
|
|
| 214 |
- <property name="label">gtk-ok</property>
|
|
| 215 |
- <property name="visible">True</property>
|
|
| 216 |
- <property name="can_focus">True</property>
|
|
| 217 |
- <property name="receives_default">True</property>
|
|
| 218 |
- <property name="use_stock">True</property>
|
|
| 219 |
- <signal name="clicked" handler="on_ok_button_clicked" swapped="no"/>
|
|
| 220 |
- </object>
|
|
| 221 |
- <packing>
|
|
| 222 |
- <property name="expand">False</property>
|
|
| 223 |
- <property name="fill">False</property>
|
|
| 224 |
- <property name="position">1</property>
|
|
| 225 |
- </packing>
|
|
| 226 |
- </child>
|
|
| 227 |
- </object>
|
|
| 228 |
- <packing>
|
|
| 229 |
- <property name="expand">False</property>
|
|
| 230 |
- <property name="fill">True</property>
|
|
| 231 |
- <property name="position">1</property>
|
|
| 232 |
- </packing>
|
|
| 233 |
- </child>
|
|
| 234 |
- </object>
|
|
| 235 |
- <packing>
|
|
| 236 |
- <property name="expand">False</property>
|
|
| 237 |
- <property name="fill">True</property>
|
|
| 238 |
- <property name="position">1</property>
|
|
| 239 |
- </packing>
|
|
| 240 |
- </child>
|
|
| 241 |
- </object>
|
|
| 242 |
- </child>
|
|
| 243 |
- </object>
|
|
| 244 |
-</interface>
|
| ... | ... | @@ -145,12 +145,8 @@ class AppActions(): |
| 145 | 145 |
gajim.interface.instances[account]['archiving_preferences'].window.\
|
| 146 | 146 |
present()
|
| 147 | 147 |
else:
|
| 148 |
- if gajim.connections[account].archiving_313_supported:
|
|
| 149 |
- gajim.interface.instances[account]['archiving_preferences'] = \
|
|
| 150 |
- dialogs.Archiving313PreferencesWindow(account)
|
|
| 151 |
- else:
|
|
| 152 |
- gajim.interface.instances[account]['archiving_preferences'] = \
|
|
| 153 |
- dialogs.ArchivingPreferencesWindow(account)
|
|
| 148 |
+ gajim.interface.instances[account]['archiving_preferences'] = \
|
|
| 149 |
+ dialogs.Archiving313PreferencesWindow(account)
|
|
| 154 | 150 |
|
| 155 | 151 |
def on_history_sync(self, action, param):
|
| 156 | 152 |
account = param.get_string()
|
| ... | ... | @@ -1399,9 +1399,6 @@ class ChatControl(ChatControlBase): |
| 1399 | 1399 |
if textbuffer.get_char_count() and self.encryption:
|
| 1400 | 1400 |
gajim.plugin_manager.extension_point(
|
| 1401 | 1401 |
'typing' + self.encryption, self)
|
| 1402 |
- if (not self.session or not self.session.status) and \
|
|
| 1403 |
- gajim.connections[self.account].archiving_136_supported:
|
|
| 1404 |
- self.begin_archiving_negotiation()
|
|
| 1405 | 1402 |
|
| 1406 | 1403 |
def restore_conversation(self):
|
| 1407 | 1404 |
jid = self.contact.jid
|
| ... | ... | @@ -1622,10 +1619,6 @@ class ChatControl(ChatControlBase): |
| 1622 | 1619 |
self.session.resource = self.contact.resource
|
| 1623 | 1620 |
self.session.negotiate_e2e(False)
|
| 1624 | 1621 |
|
| 1625 |
- def begin_archiving_negotiation(self):
|
|
| 1626 |
- self.begin_negotiation()
|
|
| 1627 |
- self.session.negotiate_archiving()
|
|
| 1628 |
- |
|
| 1629 | 1622 |
def _nec_failed_decrypt(self, obj):
|
| 1630 | 1623 |
if obj.session != self.session:
|
| 1631 | 1624 |
return
|
| ... | ... | @@ -411,7 +411,6 @@ class Config: |
| 411 | 411 |
'send_idle_time': [ opt_bool, True ],
|
| 412 | 412 |
'roster_version': [opt_str, ''],
|
| 413 | 413 |
'subscription_request_msg': [opt_str, '', _('Message that is sent to contacts you want to add')],
|
| 414 |
- 'last_archiving_time': [opt_str, '1970-01-01T00:00:00Z', _('Last time we syncronized with logs from server.')],
|
|
| 415 | 414 |
'enable_message_carbons': [ opt_bool, True, _('If enabled and if server supports this feature, Gajim will receive messages sent and received by other resources.')],
|
| 416 | 415 |
'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.')],
|
| 417 | 416 |
'oauth2_refresh_token': [ opt_str, '', _('Latest token for OAuth 2.0 authentication.')],
|
| ... | ... | @@ -166,8 +166,6 @@ class CommonConnection: |
| 166 | 166 |
self.archiving_namespace = None
|
| 167 | 167 |
self.archiving_supported = False
|
| 168 | 168 |
self.archiving_313_supported = False
|
| 169 |
- self.archiving_136_supported = False
|
|
| 170 |
- self.archive_pref_supported = False
|
|
| 171 | 169 |
self.roster_supported = True
|
| 172 | 170 |
self.blocking_supported = False
|
| 173 | 171 |
self.addressing_supported = False
|
| ... | ... | @@ -1947,18 +1945,6 @@ class Connection(CommonConnection, ConnectionHandlers): |
| 1947 | 1945 |
# Remove stored bookmarks accessible to everyone.
|
| 1948 | 1946 |
self.send_pb_purge(our_jid, 'storage:bookmarks')
|
| 1949 | 1947 |
self.send_pb_delete(our_jid, 'storage:bookmarks')
|
| 1950 |
- if nbxmpp.NS_ARCHIVE in obj.features:
|
|
| 1951 |
- self.archiving_supported = True
|
|
| 1952 |
- self.archiving_136_supported = True
|
|
| 1953 |
- self.request_message_archiving_preferences()
|
|
| 1954 |
- if nbxmpp.NS_ARCHIVE_AUTO in obj.features:
|
|
| 1955 |
- self.archive_auto_supported = True
|
|
| 1956 |
- if nbxmpp.NS_ARCHIVE_MANAGE in obj.features:
|
|
| 1957 |
- self.archive_manage_supported = True
|
|
| 1958 |
- if nbxmpp.NS_ARCHIVE_MANUAL in obj.features:
|
|
| 1959 |
- self.archive_manual_supported = True
|
|
| 1960 |
- if nbxmpp.NS_ARCHIVE_PREF in obj.features:
|
|
| 1961 |
- self.archive_pref_supported = True
|
|
| 1962 | 1948 |
if nbxmpp.NS_BLOCKING in obj.features:
|
| 1963 | 1949 |
self.blocking_supported = True
|
| 1964 | 1950 |
if nbxmpp.NS_ADDRESS in obj.features:
|
| ... | ... | @@ -52,7 +52,6 @@ from common.pubsub import ConnectionPubSub |
| 52 | 52 |
from common.protocol.caps import ConnectionCaps
|
| 53 | 53 |
from common.protocol.bytestream import ConnectionSocks5Bytestream
|
| 54 | 54 |
from common.protocol.bytestream import ConnectionIBBytestream
|
| 55 |
-from common.message_archiving import ConnectionArchive136
|
|
| 56 | 55 |
from common.message_archiving import ConnectionArchive313
|
| 57 | 56 |
from common.connection_handlers_events import *
|
| 58 | 57 |
|
| ... | ... | @@ -1324,13 +1323,12 @@ class ConnectionHandlersBase: |
| 1324 | 1323 |
|
| 1325 | 1324 |
return sess
|
| 1326 | 1325 |
|
| 1327 |
-class ConnectionHandlers(ConnectionArchive136, ConnectionArchive313,
|
|
| 1326 |
+class ConnectionHandlers(ConnectionArchive313,
|
|
| 1328 | 1327 |
ConnectionVcard, ConnectionSocks5Bytestream, ConnectionDisco,
|
| 1329 | 1328 |
ConnectionCommands, ConnectionPubSub, ConnectionPEP, ConnectionCaps,
|
| 1330 | 1329 |
ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
|
| 1331 | 1330 |
def __init__(self):
|
| 1332 | 1331 |
global HAS_IDLE
|
| 1333 |
- ConnectionArchive136.__init__(self)
|
|
| 1334 | 1332 |
ConnectionArchive313.__init__(self)
|
| 1335 | 1333 |
ConnectionVcard.__init__(self)
|
| 1336 | 1334 |
ConnectionSocks5Bytestream.__init__(self)
|
| ... | ... | @@ -1386,8 +1384,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream): |
| 1386 | 1384 |
gajim.nec.register_incoming_event(MessageReceivedEvent)
|
| 1387 | 1385 |
gajim.nec.register_incoming_event(ArchivingErrorReceivedEvent)
|
| 1388 | 1386 |
gajim.nec.register_incoming_event(
|
| 1389 |
- ArchivingPreferencesChangedReceivedEvent)
|
|
| 1390 |
- gajim.nec.register_incoming_event(
|
|
| 1391 | 1387 |
Archiving313PreferencesChangedReceivedEvent)
|
| 1392 | 1388 |
gajim.nec.register_incoming_event(
|
| 1393 | 1389 |
ArchivingFinishedLegacyReceivedEvent)
|
| ... | ... | @@ -1439,7 +1435,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream): |
| 1439 | 1435 |
def cleanup(self):
|
| 1440 | 1436 |
ConnectionHandlersBase.cleanup(self)
|
| 1441 | 1437 |
ConnectionCaps.cleanup(self)
|
| 1442 |
- ConnectionArchive136.cleanup(self)
|
|
| 1443 | 1438 |
ConnectionArchive313.cleanup(self)
|
| 1444 | 1439 |
ConnectionPubSub.cleanup(self)
|
| 1445 | 1440 |
gajim.ged.remove_event_handler('http-auth-received', ged.CORE,
|
| ... | ... | @@ -2272,7 +2267,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream): |
| 2272 | 2267 |
con.RegisterHandler('iq', self._IqPingCB, 'get', nbxmpp.NS_PING)
|
| 2273 | 2268 |
con.RegisterHandler('iq', self._SearchCB, 'result', nbxmpp.NS_SEARCH)
|
| 2274 | 2269 |
con.RegisterHandler('iq', self._PrivacySetCB, 'set', nbxmpp.NS_PRIVACY)
|
| 2275 |
- con.RegisterHandler('iq', self._ArchiveCB, ns=nbxmpp.NS_ARCHIVE)
|
|
| 2276 | 2270 |
con.RegisterHandler('iq', self._ArchiveCB, ns=nbxmpp.NS_MAM)
|
| 2277 | 2271 |
con.RegisterHandler('iq', self._ArchiveCB, ns=nbxmpp.NS_MAM_1)
|
| 2278 | 2272 |
con.RegisterHandler('iq', self._ArchiveCB, ns=nbxmpp.NS_MAM_2)
|
| ... | ... | @@ -1736,59 +1736,6 @@ class ArchivingErrorReceivedEvent(nec.NetworkIncomingEvent): |
| 1736 | 1736 |
self.error_msg = self.stanza.getErrorMsg()
|
| 1737 | 1737 |
return True
|
| 1738 | 1738 |
|
| 1739 |
-class ArchivingPreferencesChangedReceivedEvent(nec.NetworkIncomingEvent):
|
|
| 1740 |
- name = 'archiving-preferences-changed-received'
|
|
| 1741 |
- base_network_events = ['archiving-received']
|
|
| 1742 |
- |
|
| 1743 |
- def generate(self):
|
|
| 1744 |
- self.conn = self.base_event.conn
|
|
| 1745 |
- self.stanza = self.base_event.stanza
|
|
| 1746 |
- self.type_ = self.base_event.type_
|
|
| 1747 |
- |
|
| 1748 |
- if self.type_ not in ('result', 'set'):
|
|
| 1749 |
- return
|
|
| 1750 |
- |
|
| 1751 |
- self.conf = {}
|
|
| 1752 |
- self.new_items = {}
|
|
| 1753 |
- self.removed_items = []
|
|
| 1754 |
- pref = self.stanza.getTag('pref', namespace=nbxmpp.NS_ARCHIVE)
|
|
| 1755 |
- if pref:
|
|
| 1756 |
- if pref.getTag('auto'):
|
|
| 1757 |
- self.conf['auto'] = pref.getTagAttr('auto', 'save')
|
|
| 1758 |
- |
|
| 1759 |
- method_auto = pref.getTag('method', attrs={'type': 'auto'})
|
|
| 1760 |
- if method_auto:
|
|
| 1761 |
- self.conf['method_auto'] = method_auto.getAttr('use')
|
|
| 1762 |
- |
|
| 1763 |
- method_local = pref.getTag('method', attrs={'type': 'local'})
|
|
| 1764 |
- if method_local:
|
|
| 1765 |
- self.conf['method_local'] = method_local.getAttr('use')
|
|
| 1766 |
- |
|
| 1767 |
- method_manual = pref.getTag('method', attrs={'type': 'manual'})
|
|
| 1768 |
- if method_manual:
|
|
| 1769 |
- self.conf['method_manual'] = method_manual.getAttr('use')
|
|
| 1770 |
- |
|
| 1771 |
- default = pref.getTag('default')
|
|
| 1772 |
- if default:
|
|
| 1773 |
- self.conf['default'] = {
|
|
| 1774 |
- 'expire': default.getAttr('expire'),
|
|
| 1775 |
- 'otr': default.getAttr('otr'),
|
|
| 1776 |
- 'save': default.getAttr('save'),
|
|
| 1777 |
- 'unset': default.getAttr('unset')}
|
|
| 1778 |
- |
|
| 1779 |
- for item in pref.getTags('item'):
|
|
| 1780 |
- self.new_items[item.getAttr('jid')] = {
|
|
| 1781 |
- 'expire': item.getAttr('expire'),
|
|
| 1782 |
- 'otr': item.getAttr('otr'),
|
|
| 1783 |
- 'save': item.getAttr('save')}
|
|
| 1784 |
- |
|
| 1785 |
- elif self.stanza.getTag('itemremove'):
|
|
| 1786 |
- for item in pref.getTags('item'):
|
|
| 1787 |
- self.removed_items.append(item.getAttr('jid'))
|
|
| 1788 |
- else:
|
|
| 1789 |
- return
|
|
| 1790 |
- return True
|
|
| 1791 |
- |
|
| 1792 | 1739 |
class Archiving313PreferencesChangedReceivedEvent(nec.NetworkIncomingEvent):
|
| 1793 | 1740 |
name = 'archiving-313-preferences-changed-received'
|
| 1794 | 1741 |
base_network_events = ['archiving-received']
|
| ... | ... | @@ -18,31 +18,20 @@ |
| 18 | 18 |
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
| 19 | 19 |
##
|
| 20 | 20 |
|
| 21 |
+import logging
|
|
| 22 |
+from datetime import datetime, timedelta
|
|
| 23 |
+ |
|
| 21 | 24 |
import nbxmpp
|
| 25 |
+ |
|
| 22 | 26 |
from common import gajim
|
| 23 | 27 |
from common import ged
|
| 24 |
-from common import helpers
|
|
| 25 | 28 |
import common.connection_handlers_events as ev
|
| 26 | 29 |
|
| 27 |
-from calendar import timegm
|
|
| 28 |
-from time import localtime
|
|
| 29 |
-from datetime import datetime, timedelta
|
|
| 30 |
- |
|
| 31 |
-import logging
|
|
| 32 | 30 |
log = logging.getLogger('gajim.c.message_archiving')
|
| 33 | 31 |
|
| 34 |
-ARCHIVING_COLLECTIONS_ARRIVED = 'archiving_collections_arrived'
|
|
| 35 |
-ARCHIVING_COLLECTION_ARRIVED = 'archiving_collection_arrived'
|
|
| 36 |
-ARCHIVING_MODIFICATIONS_ARRIVED = 'archiving_modifications_arrived'
|
|
| 37 | 32 |
|
| 38 |
-class ConnectionArchive:
|
|
| 33 |
+class ConnectionArchive313:
|
|
| 39 | 34 |
def __init__(self):
|
| 40 |
- pass
|
|
| 41 |
- |
|
| 42 |
- |
|
| 43 |
-class ConnectionArchive313(ConnectionArchive):
|
|
| 44 |
- def __init__(self):
|
|
| 45 |
- ConnectionArchive.__init__(self)
|
|
| 46 | 35 |
self.archiving_313_supported = False
|
| 47 | 36 |
self.mam_awaiting_disco_result = {}
|
| 48 | 37 |
self.iq_answer = []
|
| ... | ... | @@ -211,281 +200,7 @@ class ConnectionArchive313(ConnectionArchive): |
| 211 | 200 |
never.addChild(name='jid').setData(jid)
|
| 212 | 201 |
self.connection.send(iq)
|
| 213 | 202 |
|
| 214 |
-class ConnectionArchive136(ConnectionArchive):
|
|
| 215 |
- def __init__(self):
|
|
| 216 |
- ConnectionArchive.__init__(self)
|
|
| 217 |
- self.archiving_136_supported = False
|
|
| 218 |
- self.archive_auto_supported = False
|
|
| 219 |
- self.archive_manage_supported = False
|
|
| 220 |
- self.archive_manual_supported = False
|
|
| 221 |
- self.archive_pref_supported = False
|
|
| 222 |
- self.auto = None
|
|
| 223 |
- self.method_auto = None
|
|
| 224 |
- self.method_local = None
|
|
| 225 |
- self.method_manual = None
|
|
| 226 |
- self.default = None
|
|
| 227 |
- self.items = {}
|
|
| 228 |
- gajim.ged.register_event_handler(
|
|
| 229 |
- 'archiving-preferences-changed-received', ged.CORE,
|
|
| 230 |
- self._nec_archiving_changed_received)
|
|
| 231 |
- gajim.ged.register_event_handler('raw-iq-received', ged.CORE,
|
|
| 232 |
- self._nec_raw_iq_136_received)
|
|
| 233 |
- |
|
| 234 |
- def cleanup(self):
|
|
| 235 |
- gajim.ged.remove_event_handler(
|
|
| 236 |
- 'archiving-preferences-changed-received', ged.CORE,
|
|
| 237 |
- self._nec_archiving_changed_received)
|
|
| 238 |
- gajim.ged.remove_event_handler('raw-iq-received', ged.CORE,
|
|
| 239 |
- self._nec_raw_iq_136_received)
|
|
| 240 |
- |
|
| 241 |
- def _nec_raw_iq_136_received(self, obj):
|
|
| 242 |
- if obj.conn.name != self.name:
|
|
| 243 |
- return
|
|
| 244 |
- |
|
| 245 |
- id_ = obj.stanza.getID()
|
|
| 246 |
- if id_ not in self.awaiting_answers:
|
|
| 247 |
- return
|
|
| 248 |
- |
|
| 249 |
- if self.awaiting_answers[id_][0] == ARCHIVING_COLLECTIONS_ARRIVED:
|
|
| 250 |
- del self.awaiting_answers[id_]
|
|
| 251 |
- # TODO
|
|
| 252 |
- print('ARCHIVING_COLLECTIONS_ARRIVED')
|
|
| 253 |
- |
|
| 254 |
- elif self.awaiting_answers[id_][0] == ARCHIVING_COLLECTION_ARRIVED:
|
|
| 255 |
- def save_if_not_exists(with_, nick, direction, tim, payload):
|
|
| 256 |
- assert len(payload) == 1, 'got several archiving messages in' +\
|
|
| 257 |
- ' the same time %s' % ''.join(payload)
|
|
| 258 |
- if payload[0].getName() == 'body':
|
|
| 259 |
- gajim.logger.save_if_not_exists(with_, direction, tim,
|
|
| 260 |
- msg=payload[0].getData(), nick=nick)
|
|
| 261 |
- elif payload[0].getName() == 'message':
|
|
| 262 |
- print('Not implemented')
|
|
| 263 |
- chat = obj.stanza.getTag('chat')
|
|
| 264 |
- if chat:
|
|
| 265 |
- with_ = chat.getAttr('with')
|
|
| 266 |
- start_ = chat.getAttr('start')
|
|
| 267 |
- tim = helpers.datetime_tuple(start_)
|
|
| 268 |
- tim = timegm(tim)
|
|
| 269 |
- nb = 0
|
|
| 270 |
- for element in chat.getChildren():
|
|
| 271 |
- try:
|
|
| 272 |
- secs = int(element.getAttr('secs'))
|
|
| 273 |
- except TypeError:
|
|
| 274 |
- secs = 0
|
|
| 275 |
- if secs:
|
|
| 276 |
- tim += secs
|
|
| 277 |
- nick = element.getAttr('name')
|
|
| 278 |
- if element.getName() == 'from':
|
|
| 279 |
- save_if_not_exists(with_, nick, 'from', localtime(tim),
|
|
| 280 |
- element.getPayload())
|
|
| 281 |
- nb += 1
|
|
| 282 |
- if element.getName() == 'to':
|
|
| 283 |
- save_if_not_exists(with_, nick, 'to', localtime(tim),
|
|
| 284 |
- element.getPayload())
|
|
| 285 |
- nb += 1
|
|
| 286 |
- set_ = chat.getTag('set')
|
|
| 287 |
- first = set_.getTag('first')
|
|
| 288 |
- if first:
|
|
| 289 |
- try:
|
|
| 290 |
- index = int(first.getAttr('index'))
|
|
| 291 |
- except TypeError:
|
|
| 292 |
- index = 0
|
|
| 293 |
- try:
|
|
| 294 |
- count = int(set_.getTagData('count'))
|
|
| 295 |
- except TypeError:
|
|
| 296 |
- count = 0
|
|
| 297 |
- if count > index + nb:
|
|
| 298 |
- # Request the next page
|
|
| 299 |
- after = element.getTagData('last')
|
|
| 300 |
- self.request_collection_page(with_, start_, after=after)
|
|
| 301 |
- del self.awaiting_answers[id_]
|
|
| 302 |
- |
|
| 303 |
- elif self.awaiting_answers[id_][0] == ARCHIVING_MODIFICATIONS_ARRIVED:
|
|
| 304 |
- modified = obj.stanza.getTag('modified')
|
|
| 305 |
- if modified:
|
|
| 306 |
- for element in modified.getChildren():
|
|
| 307 |
- if element.getName() == 'changed':
|
|
| 308 |
- with_ = element.getAttr('with')
|
|
| 309 |
- start_ = element.getAttr('start')
|
|
| 310 |
- self.request_collection_page(with_, start_)
|
|
| 311 |
- #elif element.getName() == 'removed':
|
|
| 312 |
- # do nothing
|
|
| 313 |
- del self.awaiting_answers[id_]
|
|
| 314 |
- |
|
| 315 |
- def request_message_archiving_preferences(self):
|
|
| 316 |
- iq_ = nbxmpp.Iq('get')
|
|
| 317 |
- iq_.setTag('pref', namespace=nbxmpp.NS_ARCHIVE)
|
|
| 318 |
- self.connection.send(iq_)
|
|
| 319 |
- |
|
| 320 |
- def set_pref(self, name, **data):
|
|
| 321 |
- '''
|
|
| 322 |
- data contains names and values of pref name attributes.
|
|
| 323 |
- '''
|
|
| 324 |
- iq_ = nbxmpp.Iq('set')
|
|
| 325 |
- pref = iq_.setTag('pref', namespace=nbxmpp.NS_ARCHIVE)
|
|
| 326 |
- tag = pref.setTag(name)
|
|
| 327 |
- for key, value in data.items():
|
|
| 328 |
- if value is not None:
|
|
| 329 |
- tag.setAttr(key, value)
|
|
| 330 |
- self.connection.send(iq_)
|
|
| 331 |
- |
|
| 332 |
- def set_auto(self, save):
|
|
| 333 |
- self.set_pref('auto', save=save)
|
|
| 334 |
- |
|
| 335 |
- def set_method(self, type, use):
|
|
| 336 |
- self.set_pref('method', type=type, use=use)
|
|
| 337 |
- |
|
| 338 |
- def set_default(self, otr, save, expire=None):
|
|
| 339 |
- self.set_pref('default', otr=otr, save=save, expire=expire)
|
|
| 340 |
- |
|
| 341 |
- def append_or_update_item(self, jid, otr, save, expire):
|
|
| 342 |
- self.set_pref('item', jid=jid, otr=otr, save=save)
|
|
| 343 |
- |
|
| 344 |
- def remove_item(self, jid):
|
|
| 345 |
- iq_ = nbxmpp.Iq('set')
|
|
| 346 |
- itemremove = iq_.setTag('itemremove', namespace=nbxmpp.NS_ARCHIVE)
|
|
| 347 |
- item = itemremove.setTag('item')
|
|
| 348 |
- item.setAttr('jid', jid)
|
|
| 349 |
- self.connection.send(iq_)
|
|
| 350 |
- |
|
| 351 |
- def stop_archiving_session(self, thread_id):
|
|
| 352 |
- iq_ = nbxmpp.Iq('set')
|
|
| 353 |
- pref = iq_.setTag('pref', namespace=nbxmpp.NS_ARCHIVE)
|
|
| 354 |
- session = pref.setTag('session', attrs={'thread': thread_id,
|
|
| 355 |
- 'save': 'false', 'otr': 'concede'})
|
|
| 356 |
- self.connection.send(iq_)
|
|
| 357 |
- |
|
| 358 |
- def get_item_pref(self, jid):
|
|
| 359 |
- jid = nbxmpp.JID(jid)
|
|
| 360 |
- if str(jid) in self.items:
|
|
| 361 |
- return self.items[jid]
|
|
| 362 |
- |
|
| 363 |
- if jid.getStripped() in self.items:
|
|
| 364 |
- return self.items[jid.getStripped()]
|
|
| 365 |
- |
|
| 366 |
- if jid.getDomain() in self.items:
|
|
| 367 |
- return self.items[jid.getDomain()]
|
|
| 368 |
- |
|
| 369 |
- return self.default
|
|
| 370 |
- |
|
| 371 |
- def logging_preference(self, jid, initiator_options=None):
|
|
| 372 |
- otr = self.get_item_pref(jid)
|
|
| 373 |
- if not otr:
|
|
| 374 |
- return
|
|
| 375 |
- otr = otr['otr']
|
|
| 376 |
- if initiator_options:
|
|
| 377 |
- if ((initiator_options == ['mustnot'] and otr == 'forbid') or
|
|
| 378 |
- (initiator_options == ['may'] and otr == 'require')):
|
|
| 379 |
- return None
|
|
| 380 |
- |
|
| 381 |
- if (initiator_options == ['mustnot'] or
|
|
| 382 |
- (initiator_options[0] == 'mustnot' and
|
|
| 383 |
- otr not in ('opppose', 'forbid')) or
|
|
| 384 |
- (initiator_options == ['may', 'mustnot'] and
|
|
| 385 |
- otr in ('require', 'prefer'))):
|
|
| 386 |
- return 'mustnot'
|
|
| 387 |
- |
|
| 388 |
- return 'may'
|
|
| 389 |
- |
|
| 390 |
- if otr == 'require':
|
|
| 391 |
- return ['mustnot']
|
|
| 392 |
- |
|
| 393 |
- if otr in ('prefer', 'approve'):
|
|
| 394 |
- return ['mustnot', 'may']
|
|
| 395 |
- |
|
| 396 |
- if otr in ('concede', 'oppose'):
|
|
| 397 |
- return ['may', 'mustnot']
|
|
| 398 |
- |
|
| 399 |
- # otr == 'forbid'
|
|
| 400 |
- return ['may']
|
|
| 401 |
- |
|
| 402 | 203 |
def _ArchiveCB(self, con, iq_obj):
|
| 403 | 204 |
gajim.nec.push_incoming_event(ev.ArchivingReceivedEvent(None, conn=self,
|
| 404 | 205 |
stanza=iq_obj))
|
| 405 | 206 |
raise nbxmpp.NodeProcessed
|
| 406 |
- |
|
| 407 |
- def _nec_archiving_changed_received(self, obj):
|
|
| 408 |
- if obj.conn.name != self.name:
|
|
| 409 |
- return
|
|
| 410 |
- for key in ('auto', 'default'):
|
|
| 411 |
- if key not in obj.conf:
|
|
| 412 |
- self.archiving_136_supported = False
|
|
| 413 |
- self.archive_auto_supported = False
|
|
| 414 |
- self.archive_manage_supported = False
|
|
| 415 |
- self.archive_manual_supported = False
|
|
| 416 |
- self.archive_pref_supported = False
|
|
| 417 |
- return True
|
|
| 418 |
- for key in ('auto', 'method_auto', 'method_local', 'method_manual',
|
|
| 419 |
- 'default'):
|
|
| 420 |
- if key in obj.conf:
|
|
| 421 |
- self.__dict__[key] = obj.conf[key]
|
|
| 422 |
- |
|
| 423 |
- for jid, pref in obj.new_items.items():
|
|
| 424 |
- self.items[jid] = pref
|
|
| 425 |
- |
|
| 426 |
- for jid in obj.removed_items:
|
|
| 427 |
- del self.items[jid]
|
|
| 428 |
- |
|
| 429 |
- def request_collections_list_page(self, with_='', start=None, end=None,
|
|
| 430 |
- after=None, max=30, exact_match=False):
|
|
| 431 |
- iq_ = nbxmpp.Iq('get')
|
|
| 432 |
- list_ = iq_.setTag('list', namespace=nbxmpp.NS_ARCHIVE)
|
|
| 433 |
- if with_:
|
|
| 434 |
- list_.setAttr('with', with_)
|
|
| 435 |
- if exact_match:
|
|
| 436 |
- list_.setAttr('exactmatch', 'true')
|
|
| 437 |
- if start:
|
|
| 438 |
- list_.setAttr('start', start)
|
|
| 439 |
- if end:
|
|
| 440 |
- list_.setAttr('end', end)
|
|
| 441 |
- set_ = list_.setTag('set', namespace=nbxmpp.NS_RSM)
|
|
| 442 |
- set_.setTagData('max', max)
|
|
| 443 |
- if after:
|
|
| 444 |
- set_.setTagData('after', after)
|
|
| 445 |
- id_ = self.connection.getAnID()
|
|
| 446 |
- iq_.setID(id_)
|
|
| 447 |
- self.awaiting_answers[id_] = (ARCHIVING_COLLECTIONS_ARRIVED, )
|
|
| 448 |
- self.connection.send(iq_)
|
|
| 449 |
- |
|
| 450 |
- def request_collection_page(self, with_, start, end=None, after=None,
|
|
| 451 |
- max=30, exact_match=False):
|
|
| 452 |
- iq_ = nbxmpp.Iq('get')
|
|
| 453 |
- retrieve = iq_.setTag('retrieve', namespace=nbxmpp.NS_ARCHIVE,
|
|
| 454 |
- attrs={'with': with_, 'start': start})
|
|
| 455 |
- if exact_match:
|
|
| 456 |
- retrieve.setAttr('exactmatch', 'true')
|
|
| 457 |
- set_ = retrieve.setTag('set', namespace=nbxmpp.NS_RSM)
|
|
| 458 |
- set_.setTagData('max', max)
|
|
| 459 |
- if after:
|
|
| 460 |
- set_.setTagData('after', after)
|
|
| 461 |
- id_ = self.connection.getAnID()
|
|
| 462 |
- iq_.setID(id_)
|
|
| 463 |
- self.awaiting_answers[id_] = (ARCHIVING_COLLECTION_ARRIVED, )
|
|
| 464 |
- self.connection.send(iq_)
|
|
| 465 |
- |
|
| 466 |
- def remove_collection(self, with_='', start=None, end=None,
|
|
| 467 |
- exact_match=False, open=False):
|
|
| 468 |
- iq_ = nbxmpp.Iq('set')
|
|
| 469 |
- remove = iq_.setTag('remove', namespace=nbxmpp.NS_ARCHIVE)
|
|
| 470 |
- if with_:
|
|
| 471 |
- remove.setAttr('with', with_)
|
|
| 472 |
- if exact_match:
|
|
| 473 |
- remove.setAttr('exactmatch', 'true')
|
|
| 474 |
- if start:
|
|
| 475 |
- remove.setAttr('start', start)
|
|
| 476 |
- if end:
|
|
| 477 |
- remove.setAttr('end', end)
|
|
| 478 |
- if open:
|
|
| 479 |
- remove.setAttr('open', 'true')
|
|
| 480 |
- self.connection.send(iq_)
|
|
| 481 |
- |
|
| 482 |
- def request_modifications_page(self, start, max=30):
|
|
| 483 |
- iq_ = nbxmpp.Iq('get')
|
|
| 484 |
- moified = iq_.setTag('modified', namespace=nbxmpp.NS_ARCHIVE,
|
|
| 485 |
- attrs={'start': start})
|
|
| 486 |
- set_ = moified.setTag('set', namespace=nbxmpp.NS_RSM)
|
|
| 487 |
- set_.setTagData('max', max)
|
|
| 488 |
- id_ = self.connection.getAnID()
|
|
| 489 |
- iq_.setID(id_)
|
|
| 490 |
- self.awaiting_answers[id_] = (ARCHIVING_MODIFICATIONS_ARRIVED, )
|
|
| 491 |
- self.connection.send(iq_)
|
| ... | ... | @@ -3751,369 +3751,6 @@ class RosterItemExchangeWindow: |
| 3751 | 3751 |
self.window.destroy()
|
| 3752 | 3752 |
|
| 3753 | 3753 |
|
| 3754 |
-class ItemArchivingPreferencesWindow:
|
|
| 3755 |
- otr_name = ('approve', 'concede', 'forbid', 'oppose', 'prefer', 'require')
|
|
| 3756 |
- otr_index = dict([(j, i) for i, j in enumerate(otr_name)])
|
|
| 3757 |
- save_name = ('body', 'false', 'message', 'stream')
|
|
| 3758 |
- save_index = dict([(j, i) for i, j in enumerate(save_name)])
|
|
| 3759 |
- |
|
| 3760 |
- def __init__(self, account, item):
|
|
| 3761 |
- self.account = account
|
|
| 3762 |
- self.item = item
|
|
| 3763 |
- if self.item and self.item != 'Default':
|
|
| 3764 |
- self.item_config = gajim.connections[self.account].items[self.item]
|
|
| 3765 |
- else:
|
|
| 3766 |
- self.item_config = gajim.connections[self.account].default
|
|
| 3767 |
- self.waiting = None
|
|
| 3768 |
- |
|
| 3769 |
- # Connect to gtk builder
|
|
| 3770 |
- self.xml = gtkgui_helpers.get_gtk_builder(
|
|
| 3771 |
- 'item_archiving_preferences_window.ui')
|
|
| 3772 |
- self.window = self.xml.get_object('item_archiving_preferences_window')
|
|
| 3773 |
- |
|
| 3774 |
- # Add Widgets
|
|
| 3775 |
- for widget_to_add in ('jid_entry', 'expire_entry', 'otr_combobox',
|
|
| 3776 |
- 'save_combobox', 'cancel_button', 'ok_button', 'progressbar'):
|
|
| 3777 |
- self.__dict__[widget_to_add] = self.xml.get_object(widget_to_add)
|
|
| 3778 |
- |
|
| 3779 |
- if self.item:
|
|
| 3780 |
- self.jid_entry.set_text(self.item)
|
|
| 3781 |
- expire_value = self.item_config['expire'] or ''
|
|
| 3782 |
- self.otr_combobox.set_active(self.otr_index[self.item_config['otr']])
|
|
| 3783 |
- self.save_combobox.set_active(
|
|
| 3784 |
- self.save_index[self.item_config['save']])
|
|
| 3785 |
- self.expire_entry.set_text(expire_value)
|
|
| 3786 |
- |
|
| 3787 |
- self.window.set_title(_('Archiving Preferences for %s') % self.account)
|
|
| 3788 |
- |
|
| 3789 |
- self.window.show_all()
|
|
| 3790 |
- self.progressbar.hide()
|
|
| 3791 |
- self.xml.connect_signals(self)
|
|
| 3792 |
- |
|
| 3793 |
- def update_progressbar(self):
|
|
| 3794 |
- if self.waiting:
|
|
| 3795 |
- self.progressbar.pulse()
|
|
| 3796 |
- return True
|
|
| 3797 |
- return False
|
|
| 3798 |
- |
|
| 3799 |
- def on_otr_combobox_changed(self, widget):
|
|
| 3800 |
- otr = self.otr_name[self.otr_combobox.get_active()]
|
|
| 3801 |
- if otr == 'require':
|
|
| 3802 |
- self.save_combobox.set_active(self.save_index['false'])
|
|
| 3803 |
- |
|
| 3804 |
- def on_ok_button_clicked(self, widget):
|
|
| 3805 |
- # Return directly if operation in progress
|
|
| 3806 |
- if self.waiting:
|
|
| 3807 |
- return
|
|
| 3808 |
- |
|
| 3809 |
- item = self.jid_entry.get_text()
|
|
| 3810 |
- otr = self.otr_name[self.otr_combobox.get_active()]
|
|
| 3811 |
- save = self.save_name[self.save_combobox.get_active()]
|
|
| 3812 |
- expire = self.expire_entry.get_text()
|
|
| 3813 |
- |
|
| 3814 |
- if self.item != 'Default':
|
|
| 3815 |
- try:
|
|
| 3816 |
- item = helpers.parse_jid(item)
|
|
| 3817 |
- except helpers.InvalidFormat as s:
|
|
| 3818 |
- pritext = _('Invalid User ID')
|
|
| 3819 |
- ErrorDialog(pritext, str(s))
|
|
| 3820 |
- return
|
|
| 3821 |
- |
|
| 3822 |
- if expire:
|
|
| 3823 |
- try:
|
|
| 3824 |
- if int(expire) < 0 or str(int(expire)) != expire:
|
|
| 3825 |
- raise ValueError
|
|
| 3826 |
- except ValueError:
|
|
| 3827 |
- pritext = _('Invalid expire value')
|
|
| 3828 |
- sectext = _('Expire must be a valid positive integer.')
|
|
| 3829 |
- ErrorDialog(pritext, sectext)
|
|
| 3830 |
- return
|
|
| 3831 |
- |
|
| 3832 |
- if not (item == self.item and expire == self.item_config['expire'] and
|
|
| 3833 |
- otr == self.item_config['otr'] and save == self.item_config['save']):
|
|
| 3834 |
- if not self.item or self.item == item:
|
|
| 3835 |
- if self.item == 'Default':
|
|
| 3836 |
- self.waiting = 'default'
|
|
| 3837 |
- gajim.connections[self.account].set_default(
|
|
| 3838 |
- otr, save, expire)
|
|
| 3839 |
- else:
|
|
| 3840 |
- self.waiting = 'item'
|
|
| 3841 |
- gajim.connections[self.account].append_or_update_item(
|
|
| 3842 |
- item, otr, save, expire)
|
|
| 3843 |
- else:
|
|
| 3844 |
- self.waiting = 'item'
|
|
| 3845 |
- gajim.connections[self.account].append_or_update_item(
|
|
| 3846 |
- item, otr, save, expire)
|
|
| 3847 |
- gajim.connections[self.account].remove_item(self.item)
|
|
| 3848 |
- self.launch_progressbar()
|
|
| 3849 |
- #self.window.destroy()
|
|
| 3850 |
- |
|
| 3851 |
- def on_cancel_button_clicked(self, widget):
|
|
| 3852 |
- self.window.destroy()
|
|
| 3853 |
- |
|
| 3854 |
- def on_item_archiving_preferences_window_destroy(self, widget):
|
|
| 3855 |
- if self.item:
|
|
| 3856 |
- key_name = 'edit_item_archiving_preferences_%s' % self.item
|
|
| 3857 |
- else:
|
|
| 3858 |
- key_name = 'new_item_archiving_preferences'
|
|
| 3859 |
- if key_name in gajim.interface.instances[self.account]:
|
|
| 3860 |
- del gajim.interface.instances[self.account][key_name]
|
|
| 3861 |
- |
|
| 3862 |
- def launch_progressbar(self):
|
|
| 3863 |
- self.progressbar.show()
|
|
| 3864 |
- self.update_progressbar_timeout_id = GLib.timeout_add(100,
|
|
| 3865 |
- self.update_progressbar)
|
|
| 3866 |
- |
|
| 3867 |
- def response_arrived(self, data):
|
|
| 3868 |
- if self.waiting:
|
|
| 3869 |
- self.window.destroy()
|
|
| 3870 |
- |
|
| 3871 |
- def error_arrived(self, error):
|
|
| 3872 |
- if self.waiting:
|
|
| 3873 |
- self.waiting = None
|
|
| 3874 |
- self.progressbar.hide()
|
|
| 3875 |
- pritext = _('There is an error with the form')
|
|
| 3876 |
- sectext = error
|
|
| 3877 |
- ErrorDialog(pritext, sectext)
|
|
| 3878 |
- |
|
| 3879 |
- |
|
| 3880 |
-class ArchivingPreferencesWindow:
|
|
| 3881 |
- auto_name = ('false', 'true')
|
|
| 3882 |
- auto_index = dict([(j, i) for i, j in enumerate(auto_name)])
|
|
| 3883 |
- method_foo_name = ('prefer', 'concede', 'forbid')
|
|
| 3884 |
- method_foo_index = dict([(j, i) for i, j in enumerate(method_foo_name)])
|
|
| 3885 |
- |
|
| 3886 |
- def __init__(self, account):
|
|
| 3887 |
- self.account = account
|
|
| 3888 |
- self.waiting = []
|
|
| 3889 |
- |
|
| 3890 |
- # Connect to glade
|
|
| 3891 |
- self.xml = gtkgui_helpers.get_gtk_builder(
|
|
| 3892 |
- 'archiving_preferences_window.ui')
|
|
| 3893 |
- self.window = self.xml.get_object('archiving_preferences_window')
|
|
| 3894 |
- |
|
| 3895 |
- # Add Widgets
|
|
| 3896 |
- for widget_to_add in ('auto_combobox', 'method_auto_combobox',
|
|
| 3897 |
- 'method_local_combobox', 'method_manual_combobox', 'close_button',
|
|
| 3898 |
- 'item_treeview', 'item_notebook', 'otr_combobox', 'save_combobox',
|
|
| 3899 |
- 'expire_entry', 'remove_button', 'edit_button'):
|
|
| 3900 |
- self.__dict__[widget_to_add] = self.xml.get_object(widget_to_add)
|
|
| 3901 |
- |
|
| 3902 |
- self.auto_combobox.set_active(
|
|
| 3903 |
- self.auto_index[gajim.connections[self.account].auto])
|
|
| 3904 |
- self.method_auto_combobox.set_active(
|
|
| 3905 |
- self.method_foo_index[gajim.connections[self.account].method_auto])
|
|
| 3906 |
- self.method_local_combobox.set_active(
|
|
| 3907 |
- self.method_foo_index[gajim.connections[self.account].method_local])
|
|
| 3908 |
- self.method_manual_combobox.set_active(
|
|
| 3909 |
- self.method_foo_index[gajim.connections[self.account].\
|
|
| 3910 |
- method_manual])
|
|
| 3911 |
- |
|
| 3912 |
- model = Gtk.ListStore(str, str, str, str)
|
|
| 3913 |
- self.item_treeview.set_model(model)
|
|
| 3914 |
- col = Gtk.TreeViewColumn('jid')
|
|
| 3915 |
- self.item_treeview.append_column(col)
|
|
| 3916 |
- renderer = Gtk.CellRendererText()
|
|
| 3917 |
- col.pack_start(renderer, True, True, 0)
|
|
| 3918 |
- col.set_attributes(renderer, text=0)
|
|
| 3919 |
- |
|
| 3920 |
- col = Gtk.TreeViewColumn('expire')
|
|
| 3921 |
- col.pack_start(renderer, True, True, 0)
|
|
| 3922 |
- col.set_attributes(renderer, text=1)
|
|
| 3923 |
- self.item_treeview.append_column(col)
|
|
| 3924 |
- |
|
| 3925 |
- col = Gtk.TreeViewColumn('otr')
|
|
| 3926 |
- col.pack_start(renderer, True, True, 0)
|
|
| 3927 |
- col.set_attributes(renderer, text=2)
|
|
| 3928 |
- self.item_treeview.append_column(col)
|
|
| 3929 |
- |
|
| 3930 |
- col = Gtk.TreeViewColumn('save')
|
|
| 3931 |
- col.pack_start(renderer, True, True, 0)
|
|
| 3932 |
- col.set_attributes(renderer, text=3)
|
|
| 3933 |
- self.item_treeview.append_column(col)
|
|
| 3934 |
- |
|
| 3935 |
- self.fill_items()
|
|
| 3936 |
- |
|
| 3937 |
- self.current_item = None
|
|
| 3938 |
- |
|
| 3939 |
- def sort_items(model, iter1, iter2, data=None):
|
|
| 3940 |
- item1 = model.get_value(iter1, 0)
|
|
| 3941 |
- item2 = model.get_value(iter2, 0)
|
|
| 3942 |
- if item1 == 'Default':
|
|
| 3943 |
- return -1
|
|
| 3944 |
- if item2 == 'Default':
|
|
| 3945 |
- return 1
|
|
| 3946 |
- if '@' in item1:
|
|
| 3947 |
- if '@' not in item2:
|
|
| 3948 |
- return 1
|
|
| 3949 |
- elif '@' in item2:
|
|
| 3950 |
- return -1
|
|
| 3951 |
- if item1 < item2:
|
|
| 3952 |
- return -1
|
|
| 3953 |
- if item1 > item2:
|
|
| 3954 |
- return 1
|
|
| 3955 |
- # item1 == item2 ? WTF?
|
|
| 3956 |
- return 0
|
|
| 3957 |
- |
|
| 3958 |
- model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
|
| 3959 |
- model.set_sort_func(0, sort_items)
|
|
| 3960 |
- |
|
| 3961 |
- self.remove_button.set_sensitive(False)
|
|
| 3962 |
- self.edit_button.set_sensitive(False)
|
|
| 3963 |
- |
|
| 3964 |
- self.window.set_title(_('Archiving Preferences for %s') % self.account)
|
|
| 3965 |
- |
|
| 3966 |
- gajim.ged.register_event_handler(
|
|
| 3967 |
- 'archiving-preferences-changed-received', ged.GUI1,
|
|
| 3968 |
- self._nec_archiving_changed_received)
|
|
| 3969 |
- gajim.ged.register_event_handler('archiving-error-received', ged.GUI1,
|
|
| 3970 |
- self._nec_archiving_error)
|
|
| 3971 |
- |
|
| 3972 |
- self.window.show_all()
|
|
| 3973 |
- |
|
| 3974 |
- self.xml.connect_signals(self)
|
|
| 3975 |
- |
|
| 3976 |
- def on_add_item_button_clicked(self, widget):
|
|
| 3977 |
- key_name = 'new_item_archiving_preferences'
|
|
| 3978 |
- if key_name in gajim.interface.instances[self.account]:
|
|
| 3979 |
- gajim.interface.instances[self.account][key_name].window.present()
|
|
| 3980 |
- else:
|
|
| 3981 |
- gajim.interface.instances[self.account][key_name] = \
|
|
| 3982 |
- ItemArchivingPreferencesWindow(self.account, '')
|
|
| 3983 |
- |
|
| 3984 |
- def on_remove_item_button_clicked(self, widget):
|
|
| 3985 |
- if not self.current_item:
|
|
| 3986 |
- return
|
|
| 3987 |
- |
|
| 3988 |
- self.waiting.append('itemremove')
|
|
| 3989 |
- sel = self.item_treeview.get_selection()
|
|
| 3990 |
- (model, iter_) = sel.get_selected()
|
|
| 3991 |
- gajim.connections[self.account].remove_item(model[iter_][0])
|
|
| 3992 |
- model.remove(iter_)
|
|
| 3993 |
- self.remove_button.set_sensitive(False)
|
|
| 3994 |
- self.edit_button.set_sensitive(False)
|
|
| 3995 |
- |
|
| 3996 |
- def on_edit_item_button_clicked(self, widget):
|
|
| 3997 |
- if not self.current_item:
|
|
| 3998 |
- return
|
|
| 3999 |
- |
|
| 4000 |
- key_name = 'edit_item_archiving_preferences_%s' % self.current_item
|
|
| 4001 |
- if key_name in gajim.interface.instances[self.account]:
|
|
| 4002 |
- gajim.interface.instances[self.account][key_name].window.present()
|
|
| 4003 |
- else:
|
|
| 4004 |
- gajim.interface.instances[self.account][key_name] = \
|
|
| 4005 |
- ItemArchivingPreferencesWindow(self.account, self.current_item)
|
|
| 4006 |
- |
|
| 4007 |
- def on_item_treeview_cursor_changed(self, widget):
|
|
| 4008 |
- sel = self.item_treeview.get_selection()
|
|
| 4009 |
- (model, iter_) = sel.get_selected()
|
|
| 4010 |
- item = None
|
|
| 4011 |
- if iter_:
|
|
| 4012 |
- item = model[iter_][0]
|
|
| 4013 |
- if self.current_item and self.current_item == item:
|
|
| 4014 |
- return
|
|
| 4015 |
- |
|
| 4016 |
- self.current_item = item
|
|
| 4017 |
- if self.current_item == 'Default':
|
|
| 4018 |
- self.remove_button.set_sensitive(False)
|
|
| 4019 |
- self.edit_button.set_sensitive(True)
|
|
| 4020 |
- elif self.current_item:
|
|
| 4021 |
- self.remove_button.set_sensitive(True)
|
|
| 4022 |
- self.edit_button.set_sensitive(True)
|
|
| 4023 |
- else:
|
|
| 4024 |
- self.remove_button.set_sensitive(False)
|
|
| 4025 |
- self.edit_button.set_sensitive(False)
|
|
| 4026 |
- |
|
| 4027 |
- def on_auto_combobox_changed(self, widget):
|
|
| 4028 |
- save = self.auto_name[widget.get_active()]
|
|
| 4029 |
- gajim.connections[self.account].set_auto(save)
|
|
| 4030 |
- |
|
| 4031 |
- def on_method_foo_combobox_changed(self, widget):
|
|
| 4032 |
- # We retrieve method type from widget name
|
|
| 4033 |
- # ('foo' in 'method_foo_combobox')
|
|
| 4034 |
- method_type = widget.name.split('_')[1]
|
|
| 4035 |
- use = self.method_foo_name[widget.get_active()]
|
|
| 4036 |
- self.waiting.append('method_%s' % method_type)
|
|
| 4037 |
- gajim.connections[self.account].set_method(method_type, use)
|
|
| 4038 |
- |
|
| 4039 |
- def get_child_window(self):
|
|
| 4040 |
- edit_key_name = 'edit_item_archiving_preferences_%s' % self.current_item
|
|
| 4041 |
- new_key_name = 'new_item_archiving_preferences'
|
|
| 4042 |
- |
|
| 4043 |
- if edit_key_name in gajim.interface.instances[self.account]:
|
|
| 4044 |
- return gajim.interface.instances[self.account][edit_key_name]
|
|
| 4045 |
- |
|
| 4046 |
- if new_key_name in gajim.interface.instances[self.account]:
|
|
| 4047 |
- return gajim.interface.instances[self.account][new_key_name]
|
|
| 4048 |
- |
|
| 4049 |
- def _nec_archiving_changed_received(self, obj):
|
|
| 4050 |
- if obj.conn.name != self.account:
|
|
| 4051 |
- return
|
|
| 4052 |
- for key in ('auto', 'method_auto', 'method_local', 'method_manual'):
|
|
| 4053 |
- if key in obj.conf and key in self.waiting:
|
|
| 4054 |
- self.waiting.remove(key)
|
|
| 4055 |
- if 'default' in obj.conf:
|
|
| 4056 |
- key_name = 'edit_item_archiving_preferences_%s' % \
|
|
| 4057 |
- self.current_item
|
|
| 4058 |
- if key_name in gajim.interface.instances[self.account]:
|
|
| 4059 |
- gajim.interface.instances[self.account][key_name].\
|
|
| 4060 |
- response_arrived(obj.conf['default'])
|
|
| 4061 |
- self.fill_items(True)
|
|
| 4062 |
- for jid, pref in obj.new_items.items():
|
|
| 4063 |
- child = self.get_child_window()
|
|
| 4064 |
- if child:
|
|
| 4065 |
- is_new = not child.item
|
|
| 4066 |
- child.response_arrived(pref)
|
|
| 4067 |
- if is_new:
|
|
| 4068 |
- model = self.item_treeview.get_model()
|
|
| 4069 |
- model.append((jid, pref['expire'], pref['otr'],
|
|
| 4070 |
- pref['save']))
|
|
| 4071 |
- continue
|
|
| 4072 |
- self.fill_items(True)
|
|
| 4073 |
- if 'itemremove' in self.waiting and obj.removed_items:
|
|
| 4074 |
- self.waiting.remove('itemremove')
|
|
| 4075 |
- self.fill_items(True)
|
|
| 4076 |
- |
|
| 4077 |
- def fill_items(self, clear=False):
|
|
| 4078 |
- model = self.item_treeview.get_model()
|
|
| 4079 |
- if clear:
|
|
| 4080 |
- model.clear()
|
|
| 4081 |
- default_config = gajim.connections[self.account].default
|
|
| 4082 |
- expire_value = default_config['expire'] or ''
|
|
| 4083 |
- model.append(('Default', expire_value,
|
|
| 4084 |
- default_config['otr'], default_config['save']))
|
|
| 4085 |
- for item, item_config in \
|
|
| 4086 |
- gajim.connections[self.account].items.items():
|
|
| 4087 |
- expire_value = item_config['expire'] or ''
|
|
| 4088 |
- model.append((item, expire_value, item_config['otr'],
|
|
| 4089 |
- item_config['save']))
|
|
| 4090 |
- |
|
| 4091 |
- def _nec_archiving_error(self, obj):
|
|
| 4092 |
- if obj.conn.name != self.account:
|
|
| 4093 |
- return
|
|
| 4094 |
- if self.waiting:
|
|
| 4095 |
- pritext = _('There is an error')
|
|
| 4096 |
- sectext = obj.error_msg
|
|
| 4097 |
- ErrorDialog(pritext, sectext)
|
|
| 4098 |
- self.waiting.pop()
|
|
| 4099 |
- else:
|
|
| 4100 |
- child = self.get_child_window()
|
|
| 4101 |
- if child:
|
|
| 4102 |
- child.error_arrived(obj.error_msg)
|
|
| 4103 |
- |
|
| 4104 |
- def on_close_button_clicked(self, widget):
|
|
| 4105 |
- self.window.destroy()
|
|
| 4106 |
- |
|
| 4107 |
- def on_archiving_preferences_window_destroy(self, widget):
|
|
| 4108 |
- gajim.ged.remove_event_handler(
|
|
| 4109 |
- 'archiving-preferences-changed-received', ged.GUI1,
|
|
| 4110 |
- self._nec_archiving_changed_received)
|
|
| 4111 |
- gajim.ged.remove_event_handler('archiving-error-received', ged.GUI1,
|
|
| 4112 |
- self._nec_archiving_error)
|
|
| 4113 |
- if 'archiving_preferences' in gajim.interface.instances[self.account]:
|
|
| 4114 |
- del gajim.interface.instances[self.account]['archiving_preferences']
|
|
| 4115 |
- |
|
| 4116 |
- |
|
| 4117 | 3754 |
class Archiving313PreferencesWindow:
|
| 4118 | 3755 |
|
| 4119 | 3756 |
default_dict = {'always': 0, 'roster': 1, 'never': 2}
|
| ... | ... | @@ -1178,13 +1178,6 @@ class Interface: |
| 1178 | 1178 |
# Else disable autoaway
|
| 1179 | 1179 |
gajim.sleeper_state[account] = 'off'
|
| 1180 | 1180 |
|
| 1181 |
- if obj.conn.archiving_136_supported and gajim.config.get_per('accounts',
|
|
| 1182 |
- account, 'sync_logs_with_server'):
|
|
| 1183 |
- # Start merging logs from server
|
|
| 1184 |
- obj.conn.request_modifications_page(gajim.config.get_per('accounts',
|
|
| 1185 |
- account, 'last_archiving_time'))
|
|
| 1186 |
- gajim.config.set_per('accounts', account, 'last_archiving_time',
|
|
| 1187 |
- time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()))
|
|
| 1188 | 1181 |
if obj.conn.archiving_313_supported and gajim.config.get_per('accounts',
|
| 1189 | 1182 |
account, 'sync_logs_with_server'):
|
| 1190 | 1183 |
obj.conn.request_archive_on_signin()
|
| ... | ... | @@ -5544,8 +5544,7 @@ class RosterWindow: |
| 5544 | 5544 |
self.on_privacy_lists_menuitem_activate, account)
|
| 5545 | 5545 |
else:
|
| 5546 | 5546 |
privacy_lists_menuitem.set_sensitive(False)
|
| 5547 |
- if gajim.connections[account].archive_pref_supported or \
|
|
| 5548 |
- gajim.connections[account].archiving_313_supported:
|
|
| 5547 |
+ if gajim.connections[account].archiving_313_supported:
|
|
| 5549 | 5548 |
archiving_preferences_menuitem.connect(
|
| 5550 | 5549 |
'activate',
|
| 5551 | 5550 |
self.on_archiving_preferences_menuitem_activate, account)
|