PEP prefs added
This commit is contained in:
parent
a18e21c476
commit
947ec8e933
8 changed files with 3773 additions and 2163 deletions
19
TODO.pep
19
TODO.pep
|
@ -1,5 +1,18 @@
|
|||
• configure access model when changing it in the combobox
|
||||
• tab in preferences for PEP
|
||||
• configure tab in preferences for PEP
|
||||
• PEP in status change
|
||||
• possible transport of Mood in message
|
||||
• Tune not set to none on connection
|
||||
|
||||
Tune use cases:
|
||||
• on connection of an account set Tune to current track
|
||||
• on disconnection of an account set Tune to None
|
||||
• on change of a track set Tune to a new value
|
||||
|
||||
Tooltips use cases:
|
||||
• Show PEP in contact tooltips
|
||||
• Show PEP in GC tooltips
|
||||
• Show PEP in account tooltips
|
||||
|
||||
Mood/Activity use cases
|
||||
• on connection of an account set them to None
|
||||
• on disconnection of an account set them to None
|
||||
• on explicit set publish them
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -229,6 +229,12 @@ class Config:
|
|||
'use_latex': [opt_bool, False, _('If True, Gajim will convert string between $$ and $$ to an image using dvips and convert before insterting it in chat window.')],
|
||||
'change_status_window_timeout': [opt_int, 15, _('Time of inactivity needed before the change status window closes down.')],
|
||||
'max_conversation_lines': [opt_int, 500, _('Maximum number of lines that are printed in conversations. Oldest lines are cleared.')],
|
||||
'publish_mood': [opt_bool, False],
|
||||
'publish_activity': [opt_bool, False],
|
||||
'publish_tune': [opt_bool, False],
|
||||
'subscribe_mood': [opt_bool, True],
|
||||
'subscribe_activity': [opt_bool, True],
|
||||
'subscribe_tune': [opt_bool, True],
|
||||
}
|
||||
|
||||
__options_per_key = {
|
||||
|
|
|
@ -50,6 +50,11 @@ log = logging.getLogger('gajim.c.connection')
|
|||
|
||||
import gtkgui_helpers
|
||||
|
||||
from common import dbus_support
|
||||
if dbus_support.supported:
|
||||
from music_track_listener import MusicTrackListener
|
||||
import dbus
|
||||
|
||||
ssl_error = {
|
||||
2: "Unable to get issuer certificate",
|
||||
3: "Unable to get certificate CRL",
|
||||
|
@ -181,6 +186,8 @@ class Connection(ConnectionHandlers):
|
|||
|
||||
# We are doing disconnect at so many places, better use one function in all
|
||||
def disconnect(self, on_purpose = False):
|
||||
#FIXME: set the Tune to None before disconnection per account
|
||||
#gajim.interface.roster._music_track_changed(None, None)
|
||||
self.on_purpose = on_purpose
|
||||
self.connected = 0
|
||||
self.time_to_reconnect = None
|
||||
|
@ -525,6 +532,11 @@ class Connection(ConnectionHandlers):
|
|||
if self.on_connect_auth:
|
||||
self.on_connect_auth(con)
|
||||
self.on_connect_auth = None
|
||||
#FIXME: should set the Tune per account only
|
||||
listener = MusicTrackListener.get()
|
||||
track = listener.get_playing_track()
|
||||
gajim.interface.roster._music_track_changed(listener, track)
|
||||
# print "%s - %s" % (track.artist, track.title)
|
||||
else:
|
||||
# Forget password if needed
|
||||
if not gajim.config.get_per('accounts', self.name, 'savepass'):
|
||||
|
|
|
@ -74,8 +74,12 @@ def user_activity(items, name, jid):
|
|||
contact.activity['text'] = ch.getData()
|
||||
|
||||
def user_send_mood(account, mood, message = ''):
|
||||
print "Sending %s: %s" % (mood, message)
|
||||
if gajim.config.get('publish_mood') == False:
|
||||
return
|
||||
item = xmpp.Node('mood', {'xmlns': xmpp.NS_MOOD})
|
||||
item.addChild(mood)
|
||||
if mood != '':
|
||||
item.addChild(mood)
|
||||
if message != '':
|
||||
i = item.addChild('text')
|
||||
i.addData(message)
|
||||
|
@ -83,8 +87,11 @@ def user_send_mood(account, mood, message = ''):
|
|||
gajim.connections[account].send_pb_publish('', xmpp.NS_MOOD, item, '0')
|
||||
|
||||
def user_send_activity(account, activity, subactivity = '', message = ''):
|
||||
if gajim.config.get('publish_activity') == False:
|
||||
return
|
||||
item = xmpp.Node('activity', {'xmlns': xmpp.NS_ACTIVITY})
|
||||
i = item.addChild(activity)
|
||||
if activity != '':
|
||||
i = item.addChild(activity)
|
||||
if subactivity != '':
|
||||
i.addChild(subactivity)
|
||||
if message != '':
|
||||
|
@ -94,6 +101,8 @@ def user_send_activity(account, activity, subactivity = '', message = ''):
|
|||
gajim.connections[account].send_pb_publish('', xmpp.NS_ACTIVITY, item, '0')
|
||||
|
||||
def user_send_tune(account, artist = '', title = '', source = '', track = 0,length = 0, items = None):
|
||||
if gajim.config.get('publish_tune') == False:
|
||||
return
|
||||
item = xmpp.Node('tune', {'xmlns': xmpp.NS_TUNE})
|
||||
if artist != '':
|
||||
i = item.addChild('artist')
|
||||
|
|
|
@ -43,6 +43,7 @@ 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
|
||||
|
||||
|
@ -496,6 +497,25 @@ class PreferencesWindow:
|
|||
widget.set_active(st)
|
||||
else:
|
||||
widget.set_sensitive(False)
|
||||
|
||||
# PEP
|
||||
st = gajim.config.get('publish_mood')
|
||||
self.xml.get_widget('pub_mood').set_active(st)
|
||||
|
||||
st = gajim.config.get('publish_activity')
|
||||
self.xml.get_widget('pub_activity').set_active(st)
|
||||
|
||||
st = gajim.config.get('publish_tune')
|
||||
self.xml.get_widget('pub_tune').set_active(st)
|
||||
|
||||
st = gajim.config.get('subscribe_mood')
|
||||
self.xml.get_widget('sub_mood').set_active(st)
|
||||
|
||||
st = gajim.config.get('subscribe_activity')
|
||||
self.xml.get_widget('sub_activity').set_active(st)
|
||||
|
||||
st = gajim.config.get('subscribe_tune')
|
||||
self.xml.get_widget('sub_tune').set_active(st)
|
||||
|
||||
# Notify user of new gmail e-mail messages,
|
||||
# only show checkbox if user has a gtalk account
|
||||
|
@ -561,6 +581,38 @@ class PreferencesWindow:
|
|||
gajim.interface.roster.draw_roster()
|
||||
gajim.interface.save_config()
|
||||
|
||||
def on_pub_mood_toggled(self, widget):
|
||||
if widget.get_active() == False:
|
||||
for account in gajim.connections:
|
||||
if gajim.connections[account].pep_supported:
|
||||
pep.user_send_mood(account, '')
|
||||
self.on_checkbutton_toggled(widget, 'publish_mood')
|
||||
|
||||
def on_pub_activity_toggled(self, widget):
|
||||
if widget.get_active() == False:
|
||||
for account in gajim.connections:
|
||||
if gajim.connections[account].pep_supported:
|
||||
pep.user_send_activity(account, '')
|
||||
self.on_checkbutton_toggled(widget, 'publish_activity')
|
||||
|
||||
def on_pub_tune_toggled(self, widget):
|
||||
if widget.get_active() == False:
|
||||
for account in gajim.connections:
|
||||
if gajim.connections[account].pep_supported:
|
||||
pep.user_send_tune(account, '')
|
||||
self.on_checkbutton_toggled(widget, 'publish_tune')
|
||||
gajim.interface.roster.enable_syncing_status_msg_from_current_music_track(
|
||||
widget.get_active())
|
||||
|
||||
def on_sub_mood_toggled(self, widget):
|
||||
self.on_checkbutton_toggled(widget, 'subscribe_mood')
|
||||
|
||||
def on_sub_activity_toggled(self, widget):
|
||||
self.on_checkbutton_toggled(widget, 'subscribe_activity')
|
||||
|
||||
def on_sub_tune_toggled(self, widget):
|
||||
self.on_checkbutton_toggled(widget, 'subscribe_tune')
|
||||
|
||||
def on_save_position_checkbutton_toggled(self, widget):
|
||||
self.on_checkbutton_toggled(widget, 'saveposition')
|
||||
|
||||
|
|
|
@ -2942,12 +2942,14 @@ class RosterWindow:
|
|||
if gajim.connections[account].pep_supported:
|
||||
pep_submenu = gtk.Menu()
|
||||
pep_menuitem.set_submenu(pep_submenu)
|
||||
item = gtk.MenuItem('Mood')
|
||||
pep_submenu.append(item)
|
||||
item.connect('activate', self.on_change_mood_activate, account)
|
||||
item = gtk.MenuItem('Activity')
|
||||
pep_submenu.append(item)
|
||||
item.connect('activate', self.on_change_activity_activate, account)
|
||||
if gajim.config.get('publish_mood'):
|
||||
item = gtk.MenuItem('Mood')
|
||||
pep_submenu.append(item)
|
||||
item.connect('activate', self.on_change_mood_activate, account)
|
||||
if gajim.config.get('publish_activity'):
|
||||
item = gtk.MenuItem('Activity')
|
||||
pep_submenu.append(item)
|
||||
item.connect('activate', self.on_change_activity_activate, account)
|
||||
else:
|
||||
pep_menuitem.set_no_show_all(True)
|
||||
pep_menuitem.hide()
|
||||
|
@ -5273,7 +5275,7 @@ class RosterWindow:
|
|||
## accounts has no effect until they are connected.
|
||||
gobject.timeout_add(1000,
|
||||
self.enable_syncing_status_msg_from_current_music_track,
|
||||
gajim.config.get('set_status_msg_from_current_music_track'))
|
||||
gajim.config.get('pub_tune'))
|
||||
|
||||
if gajim.config.get('show_roster_on_startup'):
|
||||
self.window.show_all()
|
||||
|
|
|
@ -458,6 +458,10 @@ class RosterTooltip(NotificationAreaTooltip):
|
|||
contact.last_status_time)
|
||||
properties.append((self.table, None))
|
||||
else: # only one resource
|
||||
|
||||
#FIXME: User {Mood, Activity, Tune} not shown if there are
|
||||
#multiple resources
|
||||
#FIXME: User {Mood, Activity, Tune} not shown for self
|
||||
if contact.show:
|
||||
show = helpers.get_uf_show(contact.show)
|
||||
if contact.last_status_time:
|
||||
|
|
Loading…
Add table
Reference in a new issue