From cc7f010aed20c726b69f99b58f9c7578e5ff1dc1 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 9 Nov 2011 14:07:10 +0100 Subject: Do not create a private tab when receiving only a chatstate --- src/core.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index e2ba8ce1..f1f48a2b 100644 --- a/src/core.py +++ b/src/core.py @@ -560,13 +560,14 @@ class Core(object): jid = message['from'] nick_from = jid.resource room_from = jid.bare + body = xhtml.get_body_from_message_stanza(message) tab = self.get_tab_by_name(jid.full, tabs.PrivateTab) # get the tab with the private conversation if not tab: # It's the first message we receive: create the tab - tab = self.open_private_window(room_from, nick_from, False) + if body: + tab = self.open_private_window(room_from, nick_from, False) if not tab: return self.events.trigger('private_msg', message) - body = xhtml.get_body_from_message_stanza(message) if not body: return tab.add_message(body, time=None, nickname=nick_from, -- cgit v1.2.3 From 5e840e64373522c484dfd4e24d4a60bcb7c21825 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 9 Nov 2011 14:23:38 +0100 Subject: Give the concerned tab to the _msg handlers --- src/core.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index f1f48a2b..a7c331ef 100644 --- a/src/core.py +++ b/src/core.py @@ -567,7 +567,7 @@ class Core(object): tab = self.open_private_window(room_from, nick_from, False) if not tab: return - self.events.trigger('private_msg', message) + self.events.trigger('private_msg', message, tab) if not body: return tab.add_message(body, time=None, nickname=nick_from, @@ -616,13 +616,17 @@ class Core(object): When receiving "normal" messages (from someone in our roster) """ jid = message['from'] - self.events.trigger('conversation_msg', message) body = xhtml.get_body_from_message_stanza(message) + conversation = self.get_tab_of_conversation_with_jid(jid, create=False) if not body: if message['type'] == 'error': self.information(self.get_error_message_from_error_stanza(message), 'Error') - return + return + elif not conversation: + return conversation = self.get_tab_of_conversation_with_jid(jid, create=True) + self.events.trigger('conversation_msg', message, conversation) + body = xhtml.get_body_from_message_stanza(message) if roster.get_contact_by_jid(jid.bare): remote_nick = roster.get_contact_by_jid(jid.bare).get_name() or jid.user else: @@ -1057,7 +1061,7 @@ class Core(object): if tab.get_user_by_name(nick_from) and\ tab.get_user_by_name(nick_from) in tab.ignores: return - self.events.trigger('muc_msg', message) + self.events.trigger('muc_msg', message, tab) body = xhtml.get_body_from_message_stanza(message) if body: date = date if delayed == True else None -- cgit v1.2.3 From 0e10c04cce83b7b3c0bedd128457d797b605bdbe Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 9 Nov 2011 17:55:43 +0100 Subject: Fixed a display bug (the info buffer popped even in the RosterInfoTab) --- src/core.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index a7c331ef..35e2040f 100644 --- a/src/core.py +++ b/src/core.py @@ -1537,7 +1537,9 @@ class Core(object): Displays an informational message in the "Info" buffer """ nb_lines = self.information_buffer.add_message(msg, nickname=typ) - if typ != '' and typ.lower() in config.get('information_buffer_popup_on', + if isinstance(self.current_tab(), tabs.RosterInfoTab): + self.refresh_window() + elif typ != '' and typ.lower() in config.get('information_buffer_popup_on', 'error roster warning help info').split(): popup_time = config.get('popup_time', 4) + (nb_lines - 1) * 2 self.pop_information_win_up(nb_lines, popup_time) -- cgit v1.2.3 From e6663c317c27efba3cfeea498d9ff91695e913ec Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 9 Nov 2011 21:02:37 +0100 Subject: Do not display an empty message when only a chatstate is received (again). --- src/core.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index 35e2040f..b352f627 100644 --- a/src/core.py +++ b/src/core.py @@ -621,9 +621,7 @@ class Core(object): if not body: if message['type'] == 'error': self.information(self.get_error_message_from_error_stanza(message), 'Error') - return - elif not conversation: - return + return conversation = self.get_tab_of_conversation_with_jid(jid, create=True) self.events.trigger('conversation_msg', message, conversation) body = xhtml.get_body_from_message_stanza(message) -- cgit v1.2.3 From 1f5d1048344b3e68b5fb294371f269c398c8f69a Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 9 Nov 2011 22:00:38 +0100 Subject: -get -set +@property +@property.setter --- src/core.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index b352f627..9109cff6 100644 --- a/src/core.py +++ b/src/core.py @@ -372,13 +372,13 @@ class Core(object): return # If a resource got offline, display the message in the conversation with this # precise resource. - self.add_information_message_to_conversation_tab(jid.full, '\x195}%s is \x191}offline' % (resource.get_jid().full)) + self.add_information_message_to_conversation_tab(jid.full, '\x195}%s is \x191}offline' % (resource.jid.full)) contact.remove_resource(resource) # Display the message in the conversation with the bare JID only if that was # the only resource online (i.e. now the contact is completely disconnected) if not contact.get_highest_priority_resource(): # No resource left: that was the last one self.add_information_message_to_conversation_tab(jid.bare, '\x195}%s is \x191}offline' % (jid.bare)) - self.information('\x193}%s \x195}is \x191}offline' % (resource.get_jid().bare), "Roster") + self.information('\x193}%s \x195}is \x191}offline' % (resource.jid.bare), "Roster") if isinstance(self.current_tab(), tabs.RosterInfoTab): self.refresh_window() @@ -395,18 +395,18 @@ class Core(object): status = presence['type'] status_message = presence['status'] priority = presence.getPriority() or 0 - resource.set_status(status_message) - resource.set_presence(status) - resource.set_priority(priority) + resource.status = status_message + resource.presence = status + resource.priority = priority self.add_information_message_to_conversation_tab(jid.full, '\x195}%s is \x194}online' % (jid.full)) if not contact.get_highest_priority_resource(): # No connected resource yet: the user's just connecting if time.time() - self.connection_time > 12: # We do not display messages if we recently logged in if status_message: - self.information("\x193}%s \x195}is \x194}online\x195} (\x19o%s\x195})" % (resource.get_jid().bare, status_message), "Roster") + self.information("\x193}%s \x195}is \x194}online\x195} (\x19o%s\x195})" % (resource.jid.bare, status_message), "Roster") else: - self.information("\x193}%s \x195}is \x194}online\x195}" % resource.get_jid().bare, "Roster") + self.information("\x193}%s \x195}is \x194}online\x195}" % resource.jid.bare, "Roster") self.add_information_message_to_conversation_tab(jid.bare, '\x195}%s is \x194}online' % (jid.bare)) contact.add_resource(resource) if isinstance(self.current_tab(), tabs.RosterInfoTab): @@ -655,9 +655,9 @@ class Core(object): status = presence['type'] status_message = presence['status'] priority = presence.getPriority() or 0 - resource.set_presence(status) - resource.set_priority(priority) - resource.set_status(status_message) + resource.presence = status + resource.priority = priority + resource.status = status_message if isinstance(self.current_tab(), tabs.RosterInfoTab): self.refresh_window() @@ -673,19 +673,19 @@ class Core(object): contact = Contact(jid) roster.add_contact(contact, jid) if 'ask' in item.attrib: - contact.set_ask(item.attrib['ask']) + contact.ask = item.attrib['ask'] else: - contact.set_ask(None) + contact.ask = None if 'name' in item.attrib: - contact.set_name(item.attrib['name']) + contact.name = item.attrib['name'] else: - contact.set_name(None) + contact.name = None if item.attrib['subscription']: - contact.set_subscription(item.attrib['subscription']) + contact.subscription = item.attrib['subscription'] groups = item.findall('{jabber:iq:roster}group') roster.edit_groups_of_contact(contact, [group.text for group in groups]) if item.attrib['subscription'] == 'remove': - roster.remove_contact(contact.get_bare_jid()) + roster.remove_contact(contact.bare_jid) if isinstance(self.current_tab(), tabs.RosterInfoTab): self.refresh_window() @@ -700,7 +700,7 @@ class Core(object): contact = Contact(jid) roster.add_contact(contact, jid) roster.edit_groups_of_contact(contact, []) - contact.set_ask('asked') + contact.ask = 'asked' self.get_tab_by_number(0).state = 'highlight' self.information('%s wants to subscribe to your presence'%jid, 'Roster') if isinstance(self.current_tab(), tabs.RosterInfoTab): -- cgit v1.2.3 From f55a0c92f21e8b0c5cbd1e0413f2c2a95b29a8ae Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 9 Nov 2011 22:34:16 +0100 Subject: Do not send chatstates when the contact is offline --- src/core.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index 9109cff6..e6b1239b 100644 --- a/src/core.py +++ b/src/core.py @@ -626,7 +626,7 @@ class Core(object): self.events.trigger('conversation_msg', message, conversation) body = xhtml.get_body_from_message_stanza(message) if roster.get_contact_by_jid(jid.bare): - remote_nick = roster.get_contact_by_jid(jid.bare).get_name() or jid.user + remote_nick = roster.get_contact_by_jid(jid.bare).name or jid.user else: remote_nick = jid.user conversation._text_buffer.add_message(body, nickname=remote_nick, nick_color=get_theme().COLOR_REMOTE_USER) @@ -1590,10 +1590,10 @@ class Core(object): when enter is pressed on the roster window """ if isinstance(roster_row, Contact): - if not self.get_conversation_by_jid(roster_row.get_bare_jid()): - self.open_conversation_window(roster_row.get_bare_jid()) + if not self.get_conversation_by_jid(roster_row.bare_jid): + self.open_conversation_window(roster_row.bare_jid) else: - self.focus_tab_named(roster_row.get_bare_jid()) + self.focus_tab_named(roster_row.bare_jid) if isinstance(roster_row, Resource): if not self.get_conversation_by_jid(roster_row.get_jid().full): self.open_conversation_window(roster_row.get_jid().full) -- cgit v1.2.3 From 4e0c1b0820432460750ea69c5bdeb47670f4c013 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 9 Nov 2011 23:17:00 +0100 Subject: New events in the plugins API --- src/core.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index e6b1239b..986d1222 100644 --- a/src/core.py +++ b/src/core.py @@ -325,6 +325,7 @@ class Core(object): tab = self.get_tab_of_conversation_with_jid(message['from'], False) if not tab: return False + self.events.trigger('normal_chatstate', message, tab) tab.chatstate = state if tab == self.current_tab(): tab.refresh_info_header() @@ -335,6 +336,7 @@ class Core(object): tab = self.get_tab_by_name(message['from'].full, tabs.PrivateTab) if not tab: return + self.events.trigger('private_chatstate', message, tab) tab.chatstate = state if tab == self.current_tab(): tab.refresh_info_header() @@ -346,6 +348,7 @@ class Core(object): room_from = message.getMucroom() tab = self.get_tab_by_name(room_from, tabs.MucTab) if tab and tab.get_user_by_name(nick): + self.events.trigger('muc_chatstate', message, tab) tab.get_user_by_name(nick).chatstate = state if tab == self.current_tab(): tab.user_win.refresh(tab.users) @@ -487,6 +490,7 @@ class Core(object): from_room = presence['from'].bare tab = self.get_tab_by_name(from_room, tabs.MucTab) if tab: + self.events.trigger('muc_presence', presence, tab) tab.handle_presence(presence) def rename_private_tabs(self, room_name, old_nick, new_nick): @@ -652,6 +656,7 @@ class Core(object): resource = contact.get_resource_by_fulljid(jid.full) if not resource: return + self.events.trigger('normal_presence', presence, resource) status = presence['type'] status_message = presence['status'] priority = presence.getPriority() or 0 -- cgit v1.2.3 From bd2d1caa0ab8f83500633d011b8c01b4213484fc Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 10 Nov 2011 17:06:28 +0100 Subject: Autoload plugins in session_start instead of core.__init__ --- src/core.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index 986d1222..3ecf76f2 100644 --- a/src/core.py +++ b/src/core.py @@ -177,8 +177,6 @@ class Core(object): self.connected_events = {} - self.autoload_plugins() - def autoload_plugins(self): plugins = config.get('plugins_autoload', '') for plugin in plugins.split(): @@ -456,6 +454,7 @@ class Core(object): Called when we are connected and authenticated """ self.connection_time = time.time() + self.autoload_plugins() self.information(_("Authentication success.")) self.information(_("Your JID is %s") % self.xmpp.boundjid.full) if not self.xmpp.anon: -- cgit v1.2.3 From 0cb9a5a61f1ee01e1b9e2543393f0ee52580dfbc Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 10 Nov 2011 21:12:33 +0100 Subject: Fixes #2271 --- src/core.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index 3ecf76f2..993b40ca 100644 --- a/src/core.py +++ b/src/core.py @@ -1378,7 +1378,12 @@ class Core(object): else: tab.own_nick = nick tab.users = [] - self.enable_private_tabs(room) + if tab and tab.joined: + self.enable_private_tabs(room) + tab.state = "normal" + if tab == self.current_tab(): + tab.refresh() + self.doupdate() def get_bookmark_nickname(self, room_name): """ -- cgit v1.2.3 From ea5692544ad196b90d64e46d7b43ae8c68c34e64 Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 11 Nov 2011 21:47:52 +0100 Subject: Fixes presence handhake --- src/core.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index 993b40ca..50acf784 100644 --- a/src/core.py +++ b/src/core.py @@ -697,16 +697,30 @@ class Core(object): """ Triggered whenever a presence stanza with a type of subscribe, subscribed, unsubscribe, or unsubscribed is received. """ + jid = presence['from'].bare + contact = roster.get_contact_by_jid(jid) if presence['type'] == 'subscribe': - jid = presence['from'].bare - contact = roster.get_contact_by_jid(jid) if not contact: contact = Contact(jid) roster.add_contact(contact, jid) + log.debug("CONTACT: %s" % contact) + if contact.subscription in ('from', 'both'): + log.debug('FROM OR BOTH') + return + elif contact.subscription in ('to'): + log.debug('TO') + self.xmpp.sendPresence(pto=jid, ptype='subscribed') + self.xmpp.sendPresence(pto=jid, ptype='') + return roster.edit_groups_of_contact(contact, []) contact.ask = 'asked' self.get_tab_by_number(0).state = 'highlight' self.information('%s wants to subscribe to your presence'%jid, 'Roster') + elif presence['type'] == 'unsubscribed': + self.information('%s unsubscribed you from his presence'%jid, 'Roster') + elif presence['type'] == 'unsubscribe': + self.information('%s unsubscribed from your presence'%jid, 'Roster') + if isinstance(self.current_tab(), tabs.RosterInfoTab): self.refresh_window() -- cgit v1.2.3 From e53446a7b2061f7e52dfbf19b0ad23b18b213bda Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 11 Nov 2011 22:15:04 +0100 Subject: Add a /presence command for directed presences --- src/core.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index 50acf784..a4211a3f 100644 --- a/src/core.py +++ b/src/core.py @@ -15,6 +15,7 @@ import threading import traceback from datetime import datetime +from xml.etree import cElementTree as ET from inspect import getargspec @@ -131,6 +132,7 @@ class Core(object): 'load': (self.command_load, _('Usage: /load \nLoad: Load the specified plugin'), self.plugin_manager.completion_load), 'unload': (self.command_unload, _('Usage: /unload \nUnload: Unload the specified plugin'), self.plugin_manager.completion_unload), 'plugins': (self.command_plugins, _('Usage: /plugins\nPlugins: Show the plugins in use.'), None), + 'presence': (self.command_presence, _('Usage: /presence\nPresence: Send a directed presence.'), None), } self.key_func = { @@ -1156,6 +1158,19 @@ class Core(object): if isinstance(current, tabs.MucTab) and current.joined and show not in ('away', 'xa'): current.send_chat_state('active') + def command_presence(self, arg): + """ + /presence + """ + if not arg: + return + try: + self.xmpp.Presence(xml=ET.fromstring(arg)).send() + except : + import traceback + self.information(_('Could not send directed presence'), 'Error') + log.debug(_("Could not send directed presence:\n") + traceback.format_exc()) + def completion_status(self, the_input): return the_input.auto_completion([status for status in possible_show], ' ') -- cgit v1.2.3 From b13f8786cf2ef229e5dcaa3c5fd8770ec0c6ee10 Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 11 Nov 2011 22:36:43 +0100 Subject: Modify /presence --- src/core.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index a4211a3f..04f89172 100644 --- a/src/core.py +++ b/src/core.py @@ -132,7 +132,7 @@ class Core(object): 'load': (self.command_load, _('Usage: /load \nLoad: Load the specified plugin'), self.plugin_manager.completion_load), 'unload': (self.command_unload, _('Usage: /unload \nUnload: Unload the specified plugin'), self.plugin_manager.completion_unload), 'plugins': (self.command_plugins, _('Usage: /plugins\nPlugins: Show the plugins in use.'), None), - 'presence': (self.command_presence, _('Usage: /presence\nPresence: Send a directed presence.'), None), + 'presence': (self.command_presence, _('Usage: /presence [type] [status]\nPresence: Send a directed presence to and using [type] and [status] if provided.'), None), } self.key_func = { @@ -1160,12 +1160,21 @@ class Core(object): def command_presence(self, arg): """ - /presence + /presence [type] [status] """ - if not arg: + args = common.shell_split(arg) + if len(args) == 1: + jid, type, status = args[0], None, None + elif len(args) == 2: + jid, type, status = args[0], args[1], None + elif len(args) == 3: + jid, type, status = args[0], args[1], args[2] + else: return + if type == 'available': + type = None try: - self.xmpp.Presence(xml=ET.fromstring(arg)).send() + self.xmpp.make_presence(pto=jid, ptype=type, pstatus=status).send() except : import traceback self.information(_('Could not send directed presence'), 'Error') -- cgit v1.2.3 From 101b20724f897824e047b32dcd01bf365d4aa9ba Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 11 Nov 2011 22:45:44 +0100 Subject: Fix a refresh issue in the ConversationTab on status change --- src/core.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index 04f89172..5f173d63 100644 --- a/src/core.py +++ b/src/core.py @@ -664,8 +664,12 @@ class Core(object): resource.presence = status resource.priority = priority resource.status = status_message + tab = self.get_tab_of_conversation_with_jid(jid, create=False) if isinstance(self.current_tab(), tabs.RosterInfoTab): self.refresh_window() + elif self.current_tab() == tab: + tab.refresh() + self.doupdate() def on_roster_update(self, iq): """ -- cgit v1.2.3 From 1cca4b8a1fa125ab1cb6d5e9ce806c053e4a95f3 Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 11 Nov 2011 22:58:48 +0100 Subject: /rawxml command --- src/core.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index 5f173d63..6cd7b97b 100644 --- a/src/core.py +++ b/src/core.py @@ -26,6 +26,7 @@ import singleton import collections from sleekxmpp.xmlstream.stanzabase import JID +from sleekxmpp.xmlstream.stanzabase import StanzaBase log = logging.getLogger(__name__) @@ -133,6 +134,7 @@ class Core(object): 'unload': (self.command_unload, _('Usage: /unload \nUnload: Unload the specified plugin'), self.plugin_manager.completion_unload), 'plugins': (self.command_plugins, _('Usage: /plugins\nPlugins: Show the plugins in use.'), None), 'presence': (self.command_presence, _('Usage: /presence [type] [status]\nPresence: Send a directed presence to and using [type] and [status] if provided.'), None), + 'rawxml': (self.command_rawxml, _('Usage: /rawxml\nRawXML: Send a custom xml stanza.'), None), } self.key_func = { @@ -1162,6 +1164,20 @@ class Core(object): if isinstance(current, tabs.MucTab) and current.joined and show not in ('away', 'xa'): current.send_chat_state('active') + def command_rawxml(self, arg): + """" + /rawxml + """ + if not arg: + return + + try: + StanzaBase(self.xmpp, xml=ET.fromstring(arg)).send() + except: + import traceback + self.information(_('Could not send custom stanza'), 'Error') + log.debug(_("Could not send custom stanza:\n") + traceback.format_exc()) + def command_presence(self, arg): """ /presence [type] [status] -- cgit v1.2.3 From 0c7674efb1e922f5aee2a2fe6efa7c4a794ba4de Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sat, 12 Nov 2011 02:40:24 +0100 Subject: New event: send_normal_presence --- src/core.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index 6cd7b97b..b7e24c50 100644 --- a/src/core.py +++ b/src/core.py @@ -397,6 +397,7 @@ class Core(object): resource = contact.get_resource_by_fulljid(jid.full) assert not resource resource = Resource(jid.full) + self.events.trigger('normal_presence', presence, resource) status = presence['type'] status_message = presence['status'] priority = presence.getPriority() or 0 @@ -465,7 +466,9 @@ class Core(object): # request the roster self.xmpp.getRoster() # send initial presence - self.xmpp.makePresence().send() + pres = self.xmpp.make_presence() + self.events.trigger('send_normal_presence', pres) + pres.send() rooms = config.get('rooms', '') if rooms == '' or not isinstance(rooms, str): return @@ -1153,6 +1156,7 @@ class Core(object): if msg: pres['status'] = msg pres['type'] = show + self.events.trigger('send_normal_presence', pres) pres.send() current = self.current_tab() if isinstance(current, tabs.MucTab) and current.joined and show in ('away', 'xa'): @@ -1194,7 +1198,9 @@ class Core(object): if type == 'available': type = None try: - self.xmpp.make_presence(pto=jid, ptype=type, pstatus=status).send() + pres = self.xmpp.make_presence(pto=jid, ptype=type, pstatus=status) + self.events.trigger('send_normal_presence', pres) + pres.send() except : import traceback self.information(_('Could not send directed presence'), 'Error') -- cgit v1.2.3 From 3dda32ea5b2e5329e035f2b3f8ee49271e1512b3 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sat, 12 Nov 2011 02:46:44 +0100 Subject: Do not ignore presence coming from a JID not in our roster. --- src/core.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index b7e24c50..9622c0a0 100644 --- a/src/core.py +++ b/src/core.py @@ -658,11 +658,12 @@ class Core(object): jid = presence['from'] contact = roster.get_contact_by_jid(jid.bare) if not contact: - return - resource = contact.get_resource_by_fulljid(jid.full) + resource = None + else: + resource = contact.get_resource_by_fulljid(jid.full) + self.events.trigger('normal_presence', presence, resource) if not resource: return - self.events.trigger('normal_presence', presence, resource) status = presence['type'] status_message = presence['status'] priority = presence.getPriority() or 0 -- cgit v1.2.3 From a1096281e0c344846c4a86fe5b5a385c94604a13 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sat, 12 Nov 2011 06:02:05 +0100 Subject: Fix an tb because the get_jid method was changed. --- src/core.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index 9622c0a0..ddb63502 100644 --- a/src/core.py +++ b/src/core.py @@ -1669,10 +1669,10 @@ class Core(object): else: self.focus_tab_named(roster_row.bare_jid) if isinstance(roster_row, Resource): - if not self.get_conversation_by_jid(roster_row.get_jid().full): - self.open_conversation_window(roster_row.get_jid().full) + if not self.get_conversation_by_jid(roster_row.jid.full): + self.open_conversation_window(roster_row.jid.full) else: - self.focus_tab_named(roster_row.get_jid().full) + self.focus_tab_named(roster_row.jid.full) self.refresh_window() def remove_timed_event(self, event): -- cgit v1.2.3 From e677a5bec1fec0bca3131754dd7cb3260ff10c94 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sat, 12 Nov 2011 06:09:22 +0100 Subject: When we receive a message, open a tab with the concerned FULL jid. --- src/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index ddb63502..1f93324d 100644 --- a/src/core.py +++ b/src/core.py @@ -615,8 +615,8 @@ class Core(object): conversation = self.get_tab_by_name(jid.bare, tabs.ConversationTab) if not conversation: if create: - # We create the conversation with the bare Jid if nothing was found - conversation = self.open_conversation_window(jid.bare, False) + # We create the conversation with the full Jid if nothing was found + conversation = self.open_conversation_window(jid.full, False) else: conversation = None return conversation -- cgit v1.2.3