diff options
author | Yann Leboulanger <asterix@lagaule.org> | 2008-11-12 23:04:25 +0300 |
---|---|---|
committer | Yann Leboulanger <asterix@lagaule.org> | 2008-11-12 23:04:25 +0300 |
commit | 8babbb1de3542841495a33b2f755bac394d9f3ae (patch) | |
tree | 94d7aacdb27e37c011880d7c513c66ef1126da5e | |
parent | 7aa4dd860de3af8e13aa9e81c7d22e1518464e22 (diff) |
revert [10593]. see #4449gajim-0.12-beta1
-rw-r--r-- | src/common/connection.py | 9 | ||||
-rw-r--r-- | src/common/connection_handlers.py | 12 | ||||
-rw-r--r-- | src/common/pep.py | 43 | ||||
-rw-r--r-- | src/dialogs.py | 15 | ||||
-rw-r--r-- | src/roster_window.py | 18 |
5 files changed, 33 insertions, 64 deletions
diff --git a/src/common/connection.py b/src/common/connection.py index 2b5a5990b..626948916 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -1132,16 +1132,9 @@ class Connection(ConnectionHandlers): # XEP-0172: user_nickname 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) - # 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 # reproduce that ugly if somewhere else. if resource: diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index 652f2a411..1aa57e95d 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -1805,18 +1805,6 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, session.control.conv_textview.hide_xep0184_warning( 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: encmsg = encTag.getData() diff --git a/src/common/pep.py b/src/common/pep.py index 49698454b..7fdba4fee 100644 --- a/src/common/pep.py +++ b/src/common/pep.py @@ -207,18 +207,10 @@ def user_mood(items, name, jid): text = ch.getData() if items.getTag('retract') is not None: 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(account): - acc = gajim.connections[account] - if retract: - if 'mood' in acc.mood: - del acc.mood['mood'] - if 'text' in acc.mood: - del acc.mood['text'] - else: + if jid == gajim.get_jid_from_account(name): + acc = gajim.connections[name] + if has_child: if 'mood' in acc.mood: del acc.mood['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 if text is not None: 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) - for contact in gajim.contacts.get_contacts(account, user): - if retract: - if 'mood' in contact.mood: - del contact.mood['mood'] - if 'text' in contact.mood: - del contact.mood['text'] - else: + for contact in gajim.contacts.get_contacts(name, user): + if has_child: if 'mood' in contact.mood: del contact.mood['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 if text is not None: 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): - gajim.interface.roster.draw_account(account) - gajim.interface.roster.draw_mood(user, account) - ctrl = gajim.interface.msg_win_mgr.get_control(user, account) - if ctrl and ctrl.type_id == 'chat': + if jid == gajim.get_jid_from_account(name): + gajim.interface.roster.draw_account(name) + gajim.interface.roster.draw_mood(user, name) + ctrl = gajim.interface.msg_win_mgr.get_control(user, name) + if ctrl: ctrl.update_mood() def user_tune(items, name, jid): diff --git a/src/dialogs.py b/src/dialogs.py index c34c30f46..485ba838b 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -528,19 +528,10 @@ class ChangeMoodDialog: def on_ok_button_clicked(self, widget): '''Return mood and messsage (None if no mood selected)''' message = self.entry.get_text().decode('utf-8') - if gajim.connections[self.account].pep_supported: - if self.mood is None: - pep.user_retract_mood(self.account) - else: - pep.user_send_mood(self.account, self.mood, message) + if self.mood is None: + pep.user_retract_mood(self.account) else: - # Do as we we sent through pep and got the answer - 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) + pep.user_send_mood(self.account, self.mood, message) self.window.destroy() def on_cancel_button_clicked(self, widget): diff --git a/src/roster_window.py b/src/roster_window.py index 6d96919f1..9c958998d 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -4857,11 +4857,11 @@ class RosterWindow: item.connect('activate', self.change_status, account, 'offline') pep_menuitem = xml.get_widget('pep_menuitem') - pep_submenu = gtk.Menu() - pep_menuitem.set_submenu(pep_submenu) if gajim.connections[account].pep_supported: have_tune = gajim.config.get_per('accounts', account, 'publish_tune') + pep_submenu = gtk.Menu() + pep_menuitem.set_submenu(pep_submenu) item = gtk.CheckMenuItem(_('Publish Tune')) pep_submenu.append(item) if not dbus_support.supported: @@ -4869,13 +4869,10 @@ class RosterWindow: else: item.set_active(have_tune) item.connect('toggled', self.on_publish_tune_toggled, account) - - item = gtk.CheckMenuItem(_('Mood')) - pep_submenu.append(item) - item.set_active(len(gajim.connections[account].mood) > 0) - item.connect('activate', self.on_change_mood_activate, account) - - if gajim.connections[account].pep_supported: + item = gtk.CheckMenuItem(_('Mood')) + pep_submenu.append(item) + item.set_active(len(gajim.connections[account].mood) > 0) + item.connect('activate', self.on_change_mood_activate, account) item = gtk.CheckMenuItem(_('Activity')) pep_submenu.append(item) item.set_active(len(gajim.connections[account].activity) > 0) @@ -4892,6 +4889,9 @@ class RosterWindow: gtk.ICON_SIZE_MENU) pep_config.set_image(img) + else: + pep_menuitem.set_sensitive(False) + if not gajim.connections[account].gmail_url: open_gmail_inbox_menuitem.set_no_show_all(True) open_gmail_inbox_menuitem.hide() |