remove pep options from pref window, store them per account, store caps_hash per account. see #3954

This commit is contained in:
Yann Leboulanger 2008-05-27 10:24:29 +00:00
parent e09c93621e
commit c127493e58
8 changed files with 82 additions and 342 deletions

View file

@ -734,220 +734,6 @@ Disabled</property>
<property name="expand">False</property> <property name="expand">False</property>
</packing> </packing>
</child> </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">&lt;b&gt;Publish and Subscribe&lt;/b&gt;</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> </widget>
<packing> <packing>
<property name="position">2</property> <property name="position">2</property>

View file

@ -150,10 +150,11 @@ class CapsCache(object):
# prepopulate data which we are sure of; note: we do not log these info # prepopulate data which we are sure of; note: we do not log these info
gajimcaps = self[('sha-1', gajim.caps_hash)] for account in gajim.connections:
gajimcaps.identities = [gajim.gajim_identity] gajimcaps = self[('sha-1', gajim.caps_hash[accout])]
gajimcaps.features = gajim.gajim_common_features + \ gajimcaps.identities = [gajim.gajim_identity]
gajim.gajim_optional_features gajimcaps.features = gajim.gajim_common_features + \
gajim.gajim_optional_features[account]
# start logging data from the net # start logging data from the net
self.logger = logger self.logger = logger

View file

@ -749,12 +749,12 @@ class ConnectionDisco:
extension = None extension = None
if node and node.find('#') != -1: if node and node.find('#') != -1:
extension = node[node.index('#') + 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): if node in (None, client_version):
for f in gajim.gajim_common_features: for f in gajim.gajim_common_features:
q.addChild('feature', attrs = {'var': f}) 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}) q.addChild('feature', attrs = {'var': f})
if q.getChildren(): if q.getChildren():
@ -857,7 +857,7 @@ class ConnectionVcard:
c = p.setTag('c', namespace = common.xmpp.NS_CAPS) c = p.setTag('c', namespace = common.xmpp.NS_CAPS)
c.setAttr('hash', 'sha-1') c.setAttr('hash', 'sha-1')
c.setAttr('node', 'http://gajim.org') c.setAttr('node', 'http://gajim.org')
c.setAttr('ver', gajim.caps_hash) c.setAttr('ver', gajim.caps_hash[self.name])
return p return p
def node_to_dict(self, node): def node_to_dict(self, node):

View file

@ -182,10 +182,12 @@ gajim_common_features = [xmpp.NS_BYTESTREAM, xmpp.NS_SI,
xmpp.NS_VERSION, xmpp.NS_DATA, xmpp.NS_ENCRYPTED, xmpp.NS_VERSION, xmpp.NS_DATA, xmpp.NS_ENCRYPTED,
'msglog', 'sslc2s', 'stringprep', xmpp.NS_PING, 'msglog', 'sslc2s', 'stringprep', xmpp.NS_PING,
xmpp.NS_TIME_REVISED, xmpp.NS_GAMING] 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): def get_nick_from_jid(jid):
pos = jid.find('@') pos = jid.find('@')

View file

@ -1304,35 +1304,39 @@ def compute_caps_hash(identities, features, dataforms=[], hash_method='sha-1'):
return '' return ''
return base64.b64encode(hash.digest()) return base64.b64encode(hash.digest())
def update_optional_features(): def update_optional_features(account = None):
gajim.gajim_optional_features = [] if account:
if gajim.config.get('publish_mood'): accounts = [account]
gajim.gajim_optional_features.append(xmpp.NS_MOOD) else:
if gajim.config.get('subscribe_mood'): accounts = [a for a in gajim.connections]
gajim.gajim_optional_features.append(xmpp.NS_MOOD + '+notify') for a in accounts:
if gajim.config.get('publish_activity'): gajim.gajim_optional_features[a] = []
gajim.gajim_optional_features.append(xmpp.NS_ACTIVITY) if gajim.config.get_per('accounts', a, 'publish_mood'):
if gajim.config.get('subscribe_activity'): gajim.gajim_optional_features[a].append(xmpp.NS_MOOD)
gajim.gajim_optional_features.append(xmpp.NS_ACTIVITY + '+notify') if gajim.config.get_per('accounts', a, 'subscribe_mood'):
if gajim.config.get('publish_tune'): gajim.gajim_optional_features[a].append(xmpp.NS_MOOD + '+notify')
gajim.gajim_optional_features.append(xmpp.NS_TUNE) if gajim.config.get_per('accounts', a, 'publish_activity'):
if gajim.config.get('subscribe_tune'): gajim.gajim_optional_features[a].append(xmpp.NS_ACTIVITY)
gajim.gajim_optional_features.append(xmpp.NS_TUNE + '+notify') if gajim.config.get_per('accounts', a, 'subscribe_activity'):
if gajim.config.get('publish_nick'): gajim.gajim_optional_features[a].append(xmpp.NS_ACTIVITY + '+notify')
gajim.gajim_optional_features.append(xmpp.NS_NICK) if gajim.config.get_per('accounts', a, 'publish_tune'):
if gajim.config.get('subscribe_nick'): gajim.gajim_optional_features[a].append(xmpp.NS_TUNE)
gajim.gajim_optional_features.append(xmpp.NS_NICK + '+notify') if gajim.config.get_per('accounts', a, 'subscribe_tune'):
if gajim.config.get('outgoing_chat_state_notifactions') != 'disabled': gajim.gajim_optional_features[a].append(xmpp.NS_TUNE + '+notify')
gajim.gajim_optional_features.append(xmpp.NS_CHATSTATES) if gajim.config.get_per('accounts', a, 'publish_nick'):
if not gajim.config.get('ignore_incoming_xhtml'): gajim.gajim_optional_features[a].append(xmpp.NS_NICK)
gajim.gajim_optional_features.append(xmpp.NS_XHTML_IM) if gajim.config.get_per('accounts', a, 'subscribe_nick'):
if gajim.HAVE_PYCRYPTO: gajim.gajim_optional_features[a].append(xmpp.NS_NICK + '+notify')
gajim.gajim_optional_features.append(xmpp.NS_ESESSION_INIT) if gajim.config.get('outgoing_chat_state_notifactions') != 'disabled':
gajim.caps_hash = compute_caps_hash([gajim.gajim_identity], gajim.gajim_optional_features[a].append(xmpp.NS_CHATSTATES)
gajim.gajim_common_features + gajim.gajim_optional_features) if not gajim.config.get('ignore_incoming_xhtml'):
# re-send presence with new hash gajim.gajim_optional_features[a].append(xmpp.NS_XHTML_IM)
for account in gajim.connections: if gajim.HAVE_PYCRYPTO:
connected = gajim.connections[account].connected 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': if connected > 1 and gajim.SHOW_LIST[connected] != 'invisible':
gajim.connections[account].change_status(gajim.SHOW_LIST[connected], gajim.connections[a].change_status(gajim.SHOW_LIST[connected],
gajim.connections[account].status) gajim.connections[a].status)

View file

@ -48,16 +48,11 @@ from common import gajim
from common import connection from common import connection
from common import passwords from common import passwords
from common import zeroconf from common import zeroconf
from common import dbus_support
from common import dataforms from common import dataforms
from common import pep from common import pep
from common.exceptions import GajimGeneralException from common.exceptions import GajimGeneralException
if dbus_support.supported:
from music_track_listener import MusicTrackListener
import dbus
#---------- PreferencesWindow class -------------# #---------- PreferencesWindow class -------------#
class PreferencesWindow: class PreferencesWindow:
'''Class for Preferences window''' '''Class for Preferences window'''
@ -257,30 +252,6 @@ class PreferencesWindow:
else: # disabled else: # disabled
combo.set_active(2) 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 ### ### Notifications tab ###
# On new event # On new event
@ -542,64 +513,6 @@ class PreferencesWindow:
w.set_sensitive(widget.get_active()) w.set_sensitive(widget.get_active())
gajim.interface.save_config() 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): def on_sort_by_show_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'sort_by_show') self.on_checkbutton_toggled(widget, 'sort_by_show')
gajim.interface.roster.draw_roster() gajim.interface.roster.draw_roster()
@ -1796,6 +1709,9 @@ class AccountsWindow:
gajim.status_before_autoaway[new_name] = \ gajim.status_before_autoaway[new_name] = \
gajim.status_before_autoaway[old_name] gajim.status_before_autoaway[old_name]
gajim.transport_avatar[new_name] = gajim.transport_avatar[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.contacts.change_account_name(old_name, new_name)
gajim.events.change_account_name(old_name, new_name) gajim.events.change_account_name(old_name, new_name)
@ -1824,6 +1740,8 @@ class AccountsWindow:
del gajim.last_message_time[old_name] del gajim.last_message_time[old_name]
del gajim.status_before_autoaway[old_name] del gajim.status_before_autoaway[old_name]
del gajim.transport_avatar[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[old_name].name = new_name
gajim.connections[new_name] = gajim.connections[old_name] gajim.connections[new_name] = gajim.connections[old_name]
del gajim.connections[old_name] del gajim.connections[old_name]
@ -2194,6 +2112,8 @@ class AccountsWindow:
del gajim.last_message_time[gajim.ZEROCONF_ACC_NAME] del gajim.last_message_time[gajim.ZEROCONF_ACC_NAME]
del gajim.status_before_autoaway[gajim.ZEROCONF_ACC_NAME] del gajim.status_before_autoaway[gajim.ZEROCONF_ACC_NAME]
del gajim.transport_avatar[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: if len(gajim.connections) >= 2:
# Do not merge accounts if only one exists # Do not merge accounts if only one exists
gajim.interface.roster.regroup = gajim.config.get('mergeaccounts') gajim.interface.roster.regroup = gajim.config.get('mergeaccounts')
@ -2228,6 +2148,8 @@ class AccountsWindow:
gajim.last_message_time[gajim.ZEROCONF_ACC_NAME] = {} gajim.last_message_time[gajim.ZEROCONF_ACC_NAME] = {}
gajim.status_before_autoaway[gajim.ZEROCONF_ACC_NAME] = '' gajim.status_before_autoaway[gajim.ZEROCONF_ACC_NAME] = ''
gajim.transport_avatar[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 # refresh roster
if len(gajim.connections) >= 2: if len(gajim.connections) >= 2:
# Do not merge accounts if only one exists # Do not merge accounts if only one exists
@ -2659,6 +2581,8 @@ class RemoveAccountWindow:
del gajim.last_message_time[self.account] del gajim.last_message_time[self.account]
del gajim.status_before_autoaway[self.account] del gajim.status_before_autoaway[self.account]
del gajim.transport_avatar[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 if len(gajim.connections) >= 2: # Do not merge accounts if only one exists
gajim.interface.roster.regroup = gajim.config.get('mergeaccounts') gajim.interface.roster.regroup = gajim.config.get('mergeaccounts')
else: else:
@ -3487,6 +3411,8 @@ class AccountCreationWizardWindow:
gajim.last_message_time[self.account] = {} gajim.last_message_time[self.account] = {}
gajim.status_before_autoaway[self.account] = '' gajim.status_before_autoaway[self.account] = ''
gajim.transport_avatar[self.account] = {} gajim.transport_avatar[self.account] = {}
gajim.gajim_optional_features[self.account] = []
gajim.caps_hash[self.account] = ''
# refresh accounts window # refresh accounts window
if gajim.interface.instances.has_key('accounts'): if gajim.interface.instances.has_key('accounts'):
gajim.interface.instances['accounts'].init_accounts() gajim.interface.instances['accounts'].init_accounts()

View file

@ -3349,6 +3349,8 @@ class Interface:
gajim.last_message_time[a] = {} gajim.last_message_time[a] = {}
gajim.status_before_autoaway[a] = '' gajim.status_before_autoaway[a] = ''
gajim.transport_avatar[a] = {} gajim.transport_avatar[a] = {}
gajim.gajim_optional_features[a] = []
gajim.caps_hash[a] = ''
if gajim.config.get('remote_control'): if gajim.config.get('remote_control'):
try: try:

View file

@ -3130,6 +3130,25 @@ class RosterWindow:
else: else:
gajim.interface.instances['preferences'] = config.PreferencesWindow() 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): def on_pep_services_menuitem_activate(self, widget, account):
if gajim.interface.instances[account].has_key('pep_services'): if gajim.interface.instances[account].has_key('pep_services'):
gajim.interface.instances[account]['pep_services'].window.present() gajim.interface.instances[account]['pep_services'].window.present()