revert [10593]. see #4449
This commit is contained in:
parent
7aa4dd860d
commit
8babbb1de3
|
@ -1132,16 +1132,9 @@ class Connection(ConnectionHandlers):
|
||||||
|
|
||||||
# XEP-0172: user_nickname
|
# XEP-0172: user_nickname
|
||||||
if user_nick:
|
if user_nick:
|
||||||
msg_iq.setTag('nick', namespace=common.xmpp.NS_NICK).setData(
|
msg_iq.setTag('nick', namespace = common.xmpp.NS_NICK).setData(
|
||||||
user_nick)
|
user_nick)
|
||||||
|
|
||||||
# XEP-0107: User Mood
|
|
||||||
if 'mood' in self.mood and not self.pep_supported:
|
|
||||||
mood_iq = msg_iq.setTag('mood', namespace=common.xmpp.NS_MOOD)
|
|
||||||
mood_iq.setTag(self.mood['mood'])
|
|
||||||
if 'text' in self.mood and self.mood['text']:
|
|
||||||
mood_iq.setTagData('text', self.mood['text'])
|
|
||||||
|
|
||||||
# TODO: We might want to write a function so we don't need to
|
# TODO: We might want to write a function so we don't need to
|
||||||
# reproduce that ugly if somewhere else.
|
# reproduce that ugly if somewhere else.
|
||||||
if resource:
|
if resource:
|
||||||
|
|
|
@ -1805,18 +1805,6 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
|
||||||
session.control.conv_textview.hide_xep0184_warning(
|
session.control.conv_textview.hide_xep0184_warning(
|
||||||
msg.getID())
|
msg.getID())
|
||||||
|
|
||||||
# Check mood in message
|
|
||||||
if msg.getTag('mood', namespace=common.xmpp.NS_MOOD):
|
|
||||||
mood_iq = msg.getTag('mood', namespace=common.xmpp.NS_MOOD)
|
|
||||||
mood = None
|
|
||||||
text = None
|
|
||||||
for ch in mood_iq.getChildren():
|
|
||||||
if ch.getName() != 'text':
|
|
||||||
mood = ch.getName()
|
|
||||||
else:
|
|
||||||
text = ch.getData()
|
|
||||||
pep.handle_mood(self.name, jid, mood=mood, text=text, retract=False)
|
|
||||||
|
|
||||||
if encTag and self.USE_GPG:
|
if encTag and self.USE_GPG:
|
||||||
encmsg = encTag.getData()
|
encmsg = encTag.getData()
|
||||||
|
|
||||||
|
|
|
@ -207,18 +207,10 @@ def user_mood(items, name, jid):
|
||||||
text = ch.getData()
|
text = ch.getData()
|
||||||
if items.getTag('retract') is not None:
|
if items.getTag('retract') is not None:
|
||||||
retract = True
|
retract = True
|
||||||
if has_child or retract:
|
|
||||||
handle_mood(name, jid, mood=mood, text=text, retract=retract)
|
|
||||||
|
|
||||||
def handle_mood(account, jid, mood=None, text=None, retract=False):
|
if jid == gajim.get_jid_from_account(name):
|
||||||
if jid == gajim.get_jid_from_account(account):
|
acc = gajim.connections[name]
|
||||||
acc = gajim.connections[account]
|
if has_child:
|
||||||
if retract:
|
|
||||||
if 'mood' in acc.mood:
|
|
||||||
del acc.mood['mood']
|
|
||||||
if 'text' in acc.mood:
|
|
||||||
del acc.mood['text']
|
|
||||||
else:
|
|
||||||
if 'mood' in acc.mood:
|
if 'mood' in acc.mood:
|
||||||
del acc.mood['mood']
|
del acc.mood['mood']
|
||||||
if 'text' in acc.mood:
|
if 'text' in acc.mood:
|
||||||
|
@ -227,15 +219,15 @@ def handle_mood(account, jid, mood=None, text=None, retract=False):
|
||||||
acc.mood['mood'] = mood
|
acc.mood['mood'] = mood
|
||||||
if text is not None:
|
if text is not None:
|
||||||
acc.mood['text'] = text
|
acc.mood['text'] = text
|
||||||
|
elif retract:
|
||||||
|
if 'mood' in acc.mood:
|
||||||
|
del acc.mood['mood']
|
||||||
|
if 'text' in acc.mood:
|
||||||
|
del acc.mood['text']
|
||||||
|
|
||||||
(user, resource) = gajim.get_room_and_nick_from_fjid(jid)
|
(user, resource) = gajim.get_room_and_nick_from_fjid(jid)
|
||||||
for contact in gajim.contacts.get_contacts(account, user):
|
for contact in gajim.contacts.get_contacts(name, user):
|
||||||
if retract:
|
if has_child:
|
||||||
if 'mood' in contact.mood:
|
|
||||||
del contact.mood['mood']
|
|
||||||
if 'text' in contact.mood:
|
|
||||||
del contact.mood['text']
|
|
||||||
else:
|
|
||||||
if 'mood' in contact.mood:
|
if 'mood' in contact.mood:
|
||||||
del contact.mood['mood']
|
del contact.mood['mood']
|
||||||
if 'text' in contact.mood:
|
if 'text' in contact.mood:
|
||||||
|
@ -244,12 +236,17 @@ def handle_mood(account, jid, mood=None, text=None, retract=False):
|
||||||
contact.mood['mood'] = mood
|
contact.mood['mood'] = mood
|
||||||
if text is not None:
|
if text is not None:
|
||||||
contact.mood['text'] = text
|
contact.mood['text'] = text
|
||||||
|
elif retract:
|
||||||
|
if 'mood' in contact.mood:
|
||||||
|
del contact.mood['mood']
|
||||||
|
if 'text' in contact.mood:
|
||||||
|
del contact.mood['text']
|
||||||
|
|
||||||
if jid == gajim.get_jid_from_account(account):
|
if jid == gajim.get_jid_from_account(name):
|
||||||
gajim.interface.roster.draw_account(account)
|
gajim.interface.roster.draw_account(name)
|
||||||
gajim.interface.roster.draw_mood(user, account)
|
gajim.interface.roster.draw_mood(user, name)
|
||||||
ctrl = gajim.interface.msg_win_mgr.get_control(user, account)
|
ctrl = gajim.interface.msg_win_mgr.get_control(user, name)
|
||||||
if ctrl and ctrl.type_id == 'chat':
|
if ctrl:
|
||||||
ctrl.update_mood()
|
ctrl.update_mood()
|
||||||
|
|
||||||
def user_tune(items, name, jid):
|
def user_tune(items, name, jid):
|
||||||
|
|
|
@ -528,19 +528,10 @@ class ChangeMoodDialog:
|
||||||
def on_ok_button_clicked(self, widget):
|
def on_ok_button_clicked(self, widget):
|
||||||
'''Return mood and messsage (None if no mood selected)'''
|
'''Return mood and messsage (None if no mood selected)'''
|
||||||
message = self.entry.get_text().decode('utf-8')
|
message = self.entry.get_text().decode('utf-8')
|
||||||
if gajim.connections[self.account].pep_supported:
|
if self.mood is None:
|
||||||
if self.mood is None:
|
pep.user_retract_mood(self.account)
|
||||||
pep.user_retract_mood(self.account)
|
|
||||||
else:
|
|
||||||
pep.user_send_mood(self.account, self.mood, message)
|
|
||||||
else:
|
else:
|
||||||
# Do as we we sent through pep and got the answer
|
pep.user_send_mood(self.account, self.mood, message)
|
||||||
our_jid = gajim.get_jid_from_account(self.account)
|
|
||||||
if self.mood is None:
|
|
||||||
pep.handle_mood(self.account, our_jid, retract=True)
|
|
||||||
else:
|
|
||||||
pep.handle_mood(self.account, our_jid, mood=self.mood,
|
|
||||||
text=message)
|
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def on_cancel_button_clicked(self, widget):
|
def on_cancel_button_clicked(self, widget):
|
||||||
|
|
|
@ -4857,11 +4857,11 @@ class RosterWindow:
|
||||||
item.connect('activate', self.change_status, account, 'offline')
|
item.connect('activate', self.change_status, account, 'offline')
|
||||||
|
|
||||||
pep_menuitem = xml.get_widget('pep_menuitem')
|
pep_menuitem = xml.get_widget('pep_menuitem')
|
||||||
pep_submenu = gtk.Menu()
|
|
||||||
pep_menuitem.set_submenu(pep_submenu)
|
|
||||||
if gajim.connections[account].pep_supported:
|
if gajim.connections[account].pep_supported:
|
||||||
have_tune = gajim.config.get_per('accounts', account,
|
have_tune = gajim.config.get_per('accounts', account,
|
||||||
'publish_tune')
|
'publish_tune')
|
||||||
|
pep_submenu = gtk.Menu()
|
||||||
|
pep_menuitem.set_submenu(pep_submenu)
|
||||||
item = gtk.CheckMenuItem(_('Publish Tune'))
|
item = gtk.CheckMenuItem(_('Publish Tune'))
|
||||||
pep_submenu.append(item)
|
pep_submenu.append(item)
|
||||||
if not dbus_support.supported:
|
if not dbus_support.supported:
|
||||||
|
@ -4869,13 +4869,10 @@ class RosterWindow:
|
||||||
else:
|
else:
|
||||||
item.set_active(have_tune)
|
item.set_active(have_tune)
|
||||||
item.connect('toggled', self.on_publish_tune_toggled, account)
|
item.connect('toggled', self.on_publish_tune_toggled, account)
|
||||||
|
item = gtk.CheckMenuItem(_('Mood'))
|
||||||
item = gtk.CheckMenuItem(_('Mood'))
|
pep_submenu.append(item)
|
||||||
pep_submenu.append(item)
|
item.set_active(len(gajim.connections[account].mood) > 0)
|
||||||
item.set_active(len(gajim.connections[account].mood) > 0)
|
item.connect('activate', self.on_change_mood_activate, account)
|
||||||
item.connect('activate', self.on_change_mood_activate, account)
|
|
||||||
|
|
||||||
if gajim.connections[account].pep_supported:
|
|
||||||
item = gtk.CheckMenuItem(_('Activity'))
|
item = gtk.CheckMenuItem(_('Activity'))
|
||||||
pep_submenu.append(item)
|
pep_submenu.append(item)
|
||||||
item.set_active(len(gajim.connections[account].activity) > 0)
|
item.set_active(len(gajim.connections[account].activity) > 0)
|
||||||
|
@ -4892,6 +4889,9 @@ class RosterWindow:
|
||||||
gtk.ICON_SIZE_MENU)
|
gtk.ICON_SIZE_MENU)
|
||||||
pep_config.set_image(img)
|
pep_config.set_image(img)
|
||||||
|
|
||||||
|
else:
|
||||||
|
pep_menuitem.set_sensitive(False)
|
||||||
|
|
||||||
if not gajim.connections[account].gmail_url:
|
if not gajim.connections[account].gmail_url:
|
||||||
open_gmail_inbox_menuitem.set_no_show_all(True)
|
open_gmail_inbox_menuitem.set_no_show_all(True)
|
||||||
open_gmail_inbox_menuitem.hide()
|
open_gmail_inbox_menuitem.hide()
|
||||||
|
|
Loading…
Reference in New Issue