Author: asterix Date: 2008-05-27 12:24:29 +0200 (Tue, 27 May 2008) New Revision: 9699
Modified: trunk/data/glade/preferences_window.glade trunk/src/common/caps.py trunk/src/common/connection_handlers.py trunk/src/common/gajim.py trunk/src/common/helpers.py trunk/src/config.py trunk/src/gajim.py trunk/src/roster_window.py Log: remove pep options from pref window, store them per account, store caps_hash per account. see #3954
Modified: trunk/data/glade/preferences_window.glade =================================================================== --- trunk/data/glade/preferences_window.glade 2008-05-26 23:53:40 UTC (rev 9698) +++ trunk/data/glade/preferences_window.glade 2008-05-27 10:24:29 UTC (rev 9699) @@ -734,220 +734,6 @@ <property name="expand">False</property> </packing> </child> - <child> - <widget class="GtkFrame" id="frame_pep"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label_xalign">0</property> - <property name="shadow_type">GTK_SHADOW_NONE</property> - <child> - <widget class="GtkAlignment" id="alignment7"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="border_width">6</property> - <property name="left_padding">12</property> - <child> - <widget class="GtkTable" id="table10"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="n_rows">2</property> - <property name="n_columns">5</property> - <property name="column_spacing">6</property> - <property name="row_spacing">6</property> - <child> - <widget class="GtkCheckButton" id="subscribe_mood_checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Mood</property> - <property name="use_underline">True</property> - <property name="response_id">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_subscribe_mood_checkbutton_toggled"/> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - <child> - <widget class="GtkCheckButton" id="subscribe_activity_checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Activity</property> - <property name="use_underline">True</property> - <property name="response_id">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_subscribe_activity_checkbutton_toggled"/> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - <child> - <widget class="GtkCheckButton" id="subscribe_nick_checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Nickname</property> - <property name="use_underline">True</property> - <property name="response_id">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_subscribe_nick_checkbutton_toggled"/> - </widget> - <packing> - <property name="left_attach">4</property> - <property name="right_attach">5</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - <child> - <widget class="GtkCheckButton" id="publish_mood_checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Mood</property> - <property name="use_underline">True</property> - <property name="response_id">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_publish_mood_checkbutton_toggled"/> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - <child> - <widget class="GtkCheckButton" id="publish_activity_checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Activity</property> - <property name="use_underline">True</property> - <property name="response_id">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_publish_activity_checkbutton_toggled"/> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - <child> - <widget class="GtkCheckButton" id="publish_tune_checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Tune</property> - <property name="use_underline">True</property> - <property name="response_id">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_publish_tune_checkbutton_toggled"/> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - <child> - <widget class="GtkCheckButton" id="publish_nick_checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Nickname</property> - <property name="use_underline">True</property> - <property name="response_id">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_publish_nick_checkbutton_toggled"/> - </widget> - <packing> - <property name="left_attach">4</property> - <property name="right_attach">5</property> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label43"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="xpad">1</property> - <property name="label" translatable="yes">Receive your contact's:</property> - <property name="use_underline">True</property> - <property name="wrap">True</property> - <property name="mnemonic_widget">one_window_type_combobox</property> - </widget> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - <child> - <widget class="GtkCheckButton" id="subscribe_tune_checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Tune</property> - <property name="use_underline">True</property> - <property name="response_id">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_subscribe_tune_checkbutton_toggled"/> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label47"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="xpad">1</property> - <property name="label" translatable="yes">Allow others to see your:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">one_window_type_combobox</property> - </widget> - <packing> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - <child> - <widget class="GtkLabel" id="label11"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes"><b>Publish and Subscribe</b></property> - <property name="use_markup">True</property> - </widget> - <packing> - <property name="type">label_item</property> - </packing> - </child> - </widget> - <packing> - <property name="expand">False</property> - <property name="position">1</property> - </packing> - </child> </widget> <packing> <property name="position">2</property>
Modified: trunk/src/common/caps.py =================================================================== --- trunk/src/common/caps.py 2008-05-26 23:53:40 UTC (rev 9698) +++ trunk/src/common/caps.py 2008-05-27 10:24:29 UTC (rev 9699) @@ -150,10 +150,11 @@
# prepopulate data which we are sure of; note: we do not log these info
- gajimcaps = self[('sha-1', gajim.caps_hash)] - gajimcaps.identities = [gajim.gajim_identity] - gajimcaps.features = gajim.gajim_common_features + \ - gajim.gajim_optional_features + for account in gajim.connections: + gajimcaps = self[('sha-1', gajim.caps_hash[accout])] + gajimcaps.identities = [gajim.gajim_identity] + gajimcaps.features = gajim.gajim_common_features + \ + gajim.gajim_optional_features[account]
# start logging data from the net self.logger = logger
Modified: trunk/src/common/connection_handlers.py =================================================================== --- trunk/src/common/connection_handlers.py 2008-05-26 23:53:40 UTC (rev 9698) +++ trunk/src/common/connection_handlers.py 2008-05-27 10:24:29 UTC (rev 9699) @@ -749,12 +749,12 @@ extension = None if node and node.find('#') != -1: extension = node[node.index('#') + 1:] - client_version = 'http://gajim.org#' + gajim.caps_hash + client_version = 'http://gajim.org#' + gajim.caps_hash[self.name]
if node in (None, client_version): for f in gajim.gajim_common_features: q.addChild('feature', attrs = {'var': f}) - for f in gajim.gajim_optional_features: + for f in gajim.gajim_optional_features[self.name]: q.addChild('feature', attrs = {'var': f})
if q.getChildren(): @@ -857,7 +857,7 @@ c = p.setTag('c', namespace = common.xmpp.NS_CAPS) c.setAttr('hash', 'sha-1') c.setAttr('node', 'http://gajim.org') - c.setAttr('ver', gajim.caps_hash) + c.setAttr('ver', gajim.caps_hash[self.name]) return p
def node_to_dict(self, node):
Modified: trunk/src/common/gajim.py =================================================================== --- trunk/src/common/gajim.py 2008-05-26 23:53:40 UTC (rev 9698) +++ trunk/src/common/gajim.py 2008-05-27 10:24:29 UTC (rev 9699) @@ -182,11 +182,13 @@ xmpp.NS_VERSION, xmpp.NS_DATA, xmpp.NS_ENCRYPTED, 'msglog', 'sslc2s', 'stringprep', xmpp.NS_PING, xmpp.NS_TIME_REVISED, xmpp.NS_GAMING] -# Optional features gajim supports -gajim_optional_features = []
-caps_hash = '' +# Optional features gajim supports per account +gajim_optional_features = {}
+# Capabilities hash per account +caps_hash = {} + def get_nick_from_jid(jid): pos = jid.find('@') return jid[:pos]
Modified: trunk/src/common/helpers.py =================================================================== --- trunk/src/common/helpers.py 2008-05-26 23:53:40 UTC (rev 9698) +++ trunk/src/common/helpers.py 2008-05-27 10:24:29 UTC (rev 9699) @@ -1304,35 +1304,39 @@ return '' return base64.b64encode(hash.digest())
-def update_optional_features(): - gajim.gajim_optional_features = [] - if gajim.config.get('publish_mood'): - gajim.gajim_optional_features.append(xmpp.NS_MOOD) - if gajim.config.get('subscribe_mood'): - gajim.gajim_optional_features.append(xmpp.NS_MOOD + '+notify') - if gajim.config.get('publish_activity'): - gajim.gajim_optional_features.append(xmpp.NS_ACTIVITY) - if gajim.config.get('subscribe_activity'): - gajim.gajim_optional_features.append(xmpp.NS_ACTIVITY + '+notify') - if gajim.config.get('publish_tune'): - gajim.gajim_optional_features.append(xmpp.NS_TUNE) - if gajim.config.get('subscribe_tune'): - gajim.gajim_optional_features.append(xmpp.NS_TUNE + '+notify') - if gajim.config.get('publish_nick'): - gajim.gajim_optional_features.append(xmpp.NS_NICK) - if gajim.config.get('subscribe_nick'): - gajim.gajim_optional_features.append(xmpp.NS_NICK + '+notify') - if gajim.config.get('outgoing_chat_state_notifactions') != 'disabled': - gajim.gajim_optional_features.append(xmpp.NS_CHATSTATES) - if not gajim.config.get('ignore_incoming_xhtml'): - gajim.gajim_optional_features.append(xmpp.NS_XHTML_IM) - if gajim.HAVE_PYCRYPTO: - gajim.gajim_optional_features.append(xmpp.NS_ESESSION_INIT) - gajim.caps_hash = compute_caps_hash([gajim.gajim_identity], - gajim.gajim_common_features + gajim.gajim_optional_features) - # re-send presence with new hash - for account in gajim.connections: - connected = gajim.connections[account].connected +def update_optional_features(account = None): + if account: + accounts = [account] + else: + accounts = [a for a in gajim.connections] + for a in accounts: + gajim.gajim_optional_features[a] = [] + if gajim.config.get_per('accounts', a, 'publish_mood'): + gajim.gajim_optional_features[a].append(xmpp.NS_MOOD) + if gajim.config.get_per('accounts', a, 'subscribe_mood'): + gajim.gajim_optional_features[a].append(xmpp.NS_MOOD + '+notify') + if gajim.config.get_per('accounts', a, 'publish_activity'): + gajim.gajim_optional_features[a].append(xmpp.NS_ACTIVITY) + if gajim.config.get_per('accounts', a, 'subscribe_activity'): + gajim.gajim_optional_features[a].append(xmpp.NS_ACTIVITY + '+notify') + if gajim.config.get_per('accounts', a, 'publish_tune'): + gajim.gajim_optional_features[a].append(xmpp.NS_TUNE) + if gajim.config.get_per('accounts', a, 'subscribe_tune'): + gajim.gajim_optional_features[a].append(xmpp.NS_TUNE + '+notify') + if gajim.config.get_per('accounts', a, 'publish_nick'): + gajim.gajim_optional_features[a].append(xmpp.NS_NICK) + if gajim.config.get_per('accounts', a, 'subscribe_nick'): + gajim.gajim_optional_features[a].append(xmpp.NS_NICK + '+notify') + if gajim.config.get('outgoing_chat_state_notifactions') != 'disabled': + gajim.gajim_optional_features[a].append(xmpp.NS_CHATSTATES) + if not gajim.config.get('ignore_incoming_xhtml'): + gajim.gajim_optional_features[a].append(xmpp.NS_XHTML_IM) + if gajim.HAVE_PYCRYPTO: + gajim.gajim_optional_features[a].append(xmpp.NS_ESESSION_INIT) + gajim.caps_hash[a] = compute_caps_hash([gajim.gajim_identity], + gajim.gajim_common_features + gajim.gajim_optional_features[a]) + # re-send presence with new hash + connected = gajim.connections[a].connected if connected > 1 and gajim.SHOW_LIST[connected] != 'invisible': - gajim.connections[account].change_status(gajim.SHOW_LIST[connected], - gajim.connections[account].status) + gajim.connections[a].change_status(gajim.SHOW_LIST[connected], + gajim.connections[a].status)
Modified: trunk/src/config.py =================================================================== --- trunk/src/config.py 2008-05-26 23:53:40 UTC (rev 9698) +++ trunk/src/config.py 2008-05-27 10:24:29 UTC (rev 9699) @@ -48,16 +48,11 @@ from common import connection from common import passwords from common import zeroconf -from common import dbus_support from common import dataforms from common import pep
from common.exceptions import GajimGeneralException
-if dbus_support.supported: - from music_track_listener import MusicTrackListener - import dbus - #---------- PreferencesWindow class -------------# class PreferencesWindow: '''Class for Preferences window''' @@ -257,31 +252,7 @@ else: # disabled combo.set_active(2)
- # PEP - st = gajim.config.get('publish_mood') - self.xml.get_widget('publish_mood_checkbutton').set_active(st)
- st = gajim.config.get('publish_activity') - self.xml.get_widget('publish_activity_checkbutton').set_active(st) - - st = gajim.config.get('publish_tune') - self.xml.get_widget('publish_tune_checkbutton').set_active(st) - - st = gajim.config.get('publish_nick') - self.xml.get_widget('publish_nick_checkbutton').set_active(st) - - st = gajim.config.get('subscribe_mood') - self.xml.get_widget('subscribe_mood_checkbutton').set_active(st) - - st = gajim.config.get('subscribe_activity') - self.xml.get_widget('subscribe_activity_checkbutton').set_active(st) - - st = gajim.config.get('subscribe_tune') - self.xml.get_widget('subscribe_tune_checkbutton').set_active(st) - - st = gajim.config.get('subscribe_nick') - self.xml.get_widget('subscribe_nick_checkbutton').set_active(st) - ### Notifications tab ### # On new event on_event_combobox = self.xml.get_widget('on_event_combobox') @@ -542,64 +513,6 @@ w.set_sensitive(widget.get_active()) gajim.interface.save_config()
- def on_publish_mood_checkbutton_toggled(self, widget): - if not widget.get_active(): - for account in gajim.connections: - if gajim.connections[account].pep_supported: - pep.user_retract_mood(account) - self.on_checkbutton_toggled(widget, 'publish_mood') - helpers.update_optional_features() - - def on_publish_activity_checkbutton_toggled(self, widget): - if not widget.get_active(): - for account in gajim.connections: - if gajim.connections[account].pep_supported: - pep.user_retract_activity(account) - self.on_checkbutton_toggled(widget, 'publish_activity') - helpers.update_optional_features() - - def on_publish_tune_checkbutton_toggled(self, widget): - if widget.get_active(): - listener = MusicTrackListener.get() - gajim.interface.roster.music_track_changed_signal = listener.connect( - 'music-track-changed', gajim.interface.roster.music_track_changed) - track = listener.get_playing_track() - gajim.interface.roster.music_track_changed(listener, track) - else: - gajim.interface.roster.music_track_changed_signal = None - - for account in gajim.connections: - if gajim.connections[account].pep_supported: - # As many implementations don't support retracting items, we send a "Stopped" event first - pep.user_send_tune(account, '') - pep.user_retract_tune(account) - self.on_checkbutton_toggled(widget, 'publish_tune') - helpers.update_optional_features() - - def on_publish_nick_checkbutton_toggled(self, widget): - if not widget.get_active(): - for account in gajim.connections: - if gajim.connections[account].pep_supported: - pep.user_retract_nickname(account) - self.on_checkbutton_toggled(widget, 'publish_nick') - helpers.update_optional_features() - - def on_subscribe_mood_checkbutton_toggled(self, widget): - self.on_checkbutton_toggled(widget, 'subscribe_mood') - helpers.update_optional_features() - - def on_subscribe_activity_checkbutton_toggled(self, widget): - self.on_checkbutton_toggled(widget, 'subscribe_activity') - helpers.update_optional_features() - - def on_subscribe_tune_checkbutton_toggled(self, widget): - self.on_checkbutton_toggled(widget, 'subscribe_tune') - helpers.update_optional_features() - - def on_subscribe_nick_checkbutton_toggled(self, widget): - self.on_checkbutton_toggled(widget, 'subscribe_nick') - helpers.update_optional_features() - def on_sort_by_show_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'sort_by_show') gajim.interface.roster.draw_roster() @@ -1796,6 +1709,9 @@ gajim.status_before_autoaway[new_name] = \ gajim.status_before_autoaway[old_name] gajim.transport_avatar[new_name] = gajim.transport_avatar[old_name] + gajim.gajim_optional_features[new_name] = \ + gajim.gajim_optional_features[old_name] + gajim.caps_hash[new_name] = gajim.caps_hash[old_name]
gajim.contacts.change_account_name(old_name, new_name) gajim.events.change_account_name(old_name, new_name) @@ -1824,6 +1740,8 @@ del gajim.last_message_time[old_name] del gajim.status_before_autoaway[old_name] del gajim.transport_avatar[old_name] + del gajim.gajim_optional_features[old_name] + del gajim.caps_hash[old_name] gajim.connections[old_name].name = new_name gajim.connections[new_name] = gajim.connections[old_name] del gajim.connections[old_name] @@ -2194,6 +2112,8 @@ del gajim.last_message_time[gajim.ZEROCONF_ACC_NAME] del gajim.status_before_autoaway[gajim.ZEROCONF_ACC_NAME] del gajim.transport_avatar[gajim.ZEROCONF_ACC_NAME] + del gajim.gajim_optional_features[gajim.ZEROCONF_ACC_NAME] + del gajim.caps_hash[gajim.ZEROCONF_ACC_NAME] if len(gajim.connections) >= 2: # Do not merge accounts if only one exists gajim.interface.roster.regroup = gajim.config.get('mergeaccounts') @@ -2228,6 +2148,8 @@ gajim.last_message_time[gajim.ZEROCONF_ACC_NAME] = {} gajim.status_before_autoaway[gajim.ZEROCONF_ACC_NAME] = '' gajim.transport_avatar[gajim.ZEROCONF_ACC_NAME] = {} + gajim.gajim_optional_features[gajim.ZEROCONF_ACC_NAME] = [] + gajim.caps_hash[gajim.ZEROCONF_ACC_NAME] = '' # refresh roster if len(gajim.connections) >= 2: # Do not merge accounts if only one exists @@ -2659,6 +2581,8 @@ del gajim.last_message_time[self.account] del gajim.status_before_autoaway[self.account] del gajim.transport_avatar[self.account] + del gajim.gajim_optional_features[self.account] + del gajim.caps_hash[self.account] if len(gajim.connections) >= 2: # Do not merge accounts if only one exists gajim.interface.roster.regroup = gajim.config.get('mergeaccounts') else: @@ -3487,6 +3411,8 @@ gajim.last_message_time[self.account] = {} gajim.status_before_autoaway[self.account] = '' gajim.transport_avatar[self.account] = {} + gajim.gajim_optional_features[self.account] = [] + gajim.caps_hash[self.account] = '' # refresh accounts window if gajim.interface.instances.has_key('accounts'): gajim.interface.instances['accounts'].init_accounts()
Modified: trunk/src/gajim.py =================================================================== --- trunk/src/gajim.py 2008-05-26 23:53:40 UTC (rev 9698) +++ trunk/src/gajim.py 2008-05-27 10:24:29 UTC (rev 9699) @@ -3349,6 +3349,8 @@ gajim.last_message_time[a] = {} gajim.status_before_autoaway[a] = '' gajim.transport_avatar[a] = {} + gajim.gajim_optional_features[a] = [] + gajim.caps_hash[a] = ''
if gajim.config.get('remote_control'): try:
Modified: trunk/src/roster_window.py =================================================================== --- trunk/src/roster_window.py 2008-05-26 23:53:40 UTC (rev 9698) +++ trunk/src/roster_window.py 2008-05-27 10:24:29 UTC (rev 9699) @@ -3130,6 +3130,25 @@ else: gajim.interface.instances['preferences'] = config.PreferencesWindow()
+ def on_publish_tune_checkbutton_toggled(self, widget, account): + if widget.get_active(): + listener = MusicTrackListener.get() + self.music_track_changed_signal = listener.connect( + 'music-track-changed', gajim.interface.roster.music_track_changed) + track = listener.get_playing_track() + self.music_track_changed(listener, track) + else: + self.music_track_changed_signal = None + + for account in gajim.connections: + if gajim.connections[account].pep_supported: + # As many implementations don't support retracting items, we send a "Stopped" event first + pep.user_send_tune(account, '') + pep.user_retract_tune(account) + #TODO: + #self.on_checkbutton_toggled(widget, 'publish_tune') + helpers.update_optional_features(account) + def on_pep_services_menuitem_activate(self, widget, account): if gajim.interface.instances[account].has_key('pep_services'): gajim.interface.instances[account]['pep_services'].window.present()