Hello community,
here is the log from the commit of package telepathy-butterfly for openSUSE:Factory
checked in at Fri Apr 16 01:42:41 CEST 2010.
--------
--- telepathy-butterfly/telepathy-butterfly.changes 2010-03-22 15:25:47.000000000 +0100
+++ /mounts/work_src_done/STABLE/telepathy-butterfly/telepathy-butterfly.changes 2010-04-09 11:04:20.000000000 +0200
@@ -1,0 +2,16 @@
+Fri Apr 9 11:01:19 CEST 2010 - vuntz@opensuse.org
+
+- Update to version 0.5.8:
+ + Enhancements:
+ - Implement ContactCapabilities connection interface.
+ (fdo#27138)
+ - Implement Messages text channel interface. (fdo#27201)
+ - Add support for HTTP connections. (fdo#22508)
+ + Fixes:
+ - fdo#27120: Register new connections with the CM so
+ NewConnection is fired.
+ - fdo#27325: Make GetContactAttributes more tolerant.
+ - fdo#27122: Raise NotAvailable when started with an invalid
+ contact.
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
telepathy-butterfly-0.5.7.tar.bz2
New:
----
telepathy-butterfly-0.5.8.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ telepathy-butterfly.spec ++++++
--- /var/tmp/diff_new_pack.vjHBl4/_old 2010-04-16 01:41:52.000000000 +0200
+++ /var/tmp/diff_new_pack.vjHBl4/_new 2010-04-16 01:41:52.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package telepathy-butterfly (Version 0.5.7)
+# spec file for package telepathy-butterfly (Version 0.5.8)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -18,7 +18,7 @@
Name: telepathy-butterfly
-Version: 0.5.7
+Version: 0.5.8
Release: 1
License: GPLv2+
Summary: MSN (butterfly) connection manager for Telepathy
++++++ telepathy-butterfly-0.5.7.tar.bz2 -> telepathy-butterfly-0.5.8.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telepathy-butterfly-0.5.7/ChangeLog new/telepathy-butterfly-0.5.8/ChangeLog
--- old/telepathy-butterfly-0.5.7/ChangeLog 2010-03-22 02:13:24.000000000 +0100
+++ new/telepathy-butterfly-0.5.8/ChangeLog 2010-04-08 15:13:42.000000000 +0200
@@ -1,3 +1,114 @@
+commit a9187b5e59f9bc14d8a9425f5610626bd9a2558c
+Author: Jonny Lamb
+Date: 2010-04-08 14:07:48 +0100
+
+ Version 0.5.8.
+
+ Signed-off-by: Jonny Lamb
+
+commit 7fcf2daaa1b1ccbfc155215a0112c90d487257b9
+Author: Jonny Lamb
+Date: 2010-04-08 14:07:29 +0100
+
+ NEWS: update
+
+ Signed-off-by: Jonny Lamb
+
+commit 5b229826b54ef29f942d42196dca50be92334bcc
+Merge: 7e62e6d 8eefb12
+Author: Jonny Lamb
+Date: 2010-04-08 14:01:59 +0100
+
+ Merge branch 'http'
+
+ Signed-off-by: Jonny Lamb
+
+commit 7e62e6de36f316e43d67355d2dacd71c1691597a
+Author: Olivier Le Thanh Duong
+Date: 2010-04-05 13:30:44 +0200
+
+ Message iface: Use async_callbacks to return before emitting the signals
+
+commit 7b3c91b609d2b988777941b6f7469a0a841e808a
+Author: Olivier Le Thanh Duong
+Date: 2010-04-05 13:13:53 +0200
+
+ Message iface: Use constants instead of magic strings
+
+commit f35aa4e37fa479a3781709ae3a942829a81444bb
+Author: Olivier Le Thanh Duong
+Date: 2010-03-31 01:05:24 +0200
+
+ Messages: correct stylistic comments from review
+
+commit 1bf636da4f710d8fb47266f1e572a5ddfe17c52b
+Author: Olivier Le Thanh Duong
+Date: 2010-03-29 04:07:35 +0200
+
+ Implement the Messages interface (fd.o #27201)
+
+commit e5beb9eeffe4da9b3f6c546595e633f98c0624b4
+Author: Jonny Lamb
+Date: 2010-04-02 17:50:02 +0100
+
+ NEWS: updated
+
+ Signed-off-by: Jonny Lamb
+
+commit 62b821c90c461a5ab441bf66ad9fb35741a213a9
+Merge: d5134bc 07bd347
+Author: Jonny Lamb
+Date: 2010-04-02 17:48:43 +0100
+
+ Merge remote branch 'wjt/fd.o-27325-GetContactAttributes-tolerance'
+
+commit d5134bc148c46c0a78721c656af40121780ead83
+Merge: fbbb71a 84821ee
+Author: Jonny Lamb
+Date: 2010-03-31 12:08:40 +0100
+
+ Merge branch 'chat-to-non-contact'
+
+commit 84821ee05eb76a1979140a9316df55863871882a
+Author: Jonny Lamb
+Date: 2010-03-17 02:23:53 +0000
+
+ im/conference channel: raise NotAvailable when started with an invalid contact
+
+ If you create a text channel with TargetID="ajksdad" then it'll work
+ because butterfly just thinks the contact is offline. If there is no
+ contact available from looking in the addressbook, then we won't even
+ be able to send offline messages, so fail when creating the channel.
+
+ Ditto for the conference channel when specifying initial invitees.
+
+ Fixes fd.o#27122
+
+ Signed-off-by: Jonny Lamb
+
+commit 07bd347f89195f357f69622b8d02239f663a1a3d
+Author: Will Thompson
+Date: 2010-03-26 11:54:53 +0000
+
+ Make GetContactAttributes() more tolerant.
+
+ See http://bugs.freedesktop.org/show_bug.cgi?id=27325
+
+commit fbbb71a170876d87358a84c06011d76bc8b0d960
+Merge: 478a169 89ac716
+Author: Jonny Lamb
+Date: 2010-03-30 15:51:56 +0100
+
+ Merge branch 'contactcaps'
+
+commit 478a16906b4cb3fd1c870a9bf5161e84865d10c9
+Author: Jonny Lamb
+Date: 2010-03-22 01:19:04 +0000
+
+ Start 0.5.8 development.
+
+ Signed-off-by: Jonny Lamb
+
commit 71a8717f201cfd5ca343671f1b24cc9c6fa2e686
Author: Jonny Lamb
Date: 2010-03-22 01:12:58 +0000
@@ -34,6 +145,22 @@
Signed-off-by: Jonny Lamb
+commit 89ac7165248cd95e0e15084bbaaeb7bbeab7d9d0
+Author: Jonny Lamb
+Date: 2010-03-17 21:43:39 +0000
+
+ contacts: add ContactCapabilities contact attributes
+
+ Signed-off-by: Jonny Lamb
+
+commit 7fc26614724831e83b0f389bd683c8fa83ba19b8
+Author: Jonny Lamb
+Date: 2010-03-17 21:43:28 +0000
+
+ capabilities: implement ContactCapabilities
+
+ Signed-off-by: Jonny Lamb
+
commit 665bc341c44741e452197f7da7c1092cb79c7bb5
Author: Jonny Lamb
Date: 2010-03-17 12:58:16 +0000
@@ -68,6 +195,16 @@
Signed-off-by: Jonny Lamb
+commit 8eefb12027b045f41d4d2b34ca44e6174bde8624
+Author: Jonny Lamb
+Date: 2010-03-14 13:39:02 +0000
+
+ connection: add support for HTTP connections
+
+ Fixes fd.o#22508
+
+ Signed-off-by: Jonny Lamb
+
commit 3f951cb9495cfb4e41d12c667a86662c873d94c4
Author: Jonny Lamb
Date: 2010-03-14 02:20:43 +0000
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telepathy-butterfly-0.5.7/NEWS new/telepathy-butterfly-0.5.8/NEWS
--- old/telepathy-butterfly-0.5.7/NEWS 2010-03-22 02:12:21.000000000 +0100
+++ new/telepathy-butterfly-0.5.8/NEWS 2010-04-08 15:06:45.000000000 +0200
@@ -1,3 +1,24 @@
+telepathy-butterfly-0.5.8 (2010-04-08)
+======================================
+
+Enhancements:
+
+ * Implement ContactCapabilities connection interface. (fd.o#27138)
+
+ * Implement Messages text channel interface. (fd.o#27201)
+
+ * Add support for HTTP connections. (fd.o#22508)
+
+Fixes:
+
+ * fd.o#27120: Register new connections with the CM so NewConnection
+ is fired.
+
+ * fd.o#27325: Make GetContactAttributes more tolerant. (Will)
+
+ * fd.o#27122: Raise NotAvailable when started with an invalid
+ contact.
+
telepathy-butterfly-0.5.7 (2010-03-22)
======================================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telepathy-butterfly-0.5.7/butterfly/capabilities.py new/telepathy-butterfly-0.5.8/butterfly/capabilities.py
--- old/telepathy-butterfly-0.5.7/butterfly/capabilities.py 2010-03-21 22:51:56.000000000 +0100
+++ new/telepathy-butterfly-0.5.8/butterfly/capabilities.py 2010-04-08 15:00:08.000000000 +0200
@@ -23,6 +23,9 @@
import papyon
import papyon.event
+from telepathy._generated.Connection_Interface_Contact_Capabilities \
+ import ConnectionInterfaceContactCapabilities
+
from butterfly.util.decorator import async
from butterfly.handle import ButterflyHandleFactory
@@ -32,12 +35,46 @@
class ButterflyCapabilities(
telepathy.server.ConnectionInterfaceCapabilities,
+ ConnectionInterfaceContactCapabilities,
papyon.event.ContactEventInterface):
+ text_chat_class = \
+ ({telepathy.CHANNEL_INTERFACE + '.ChannelType':
+ telepathy.CHANNEL_TYPE_TEXT,
+ telepathy.CHANNEL_INTERFACE + '.TargetHandleType':
+ dbus.UInt32(telepathy.HANDLE_TYPE_CONTACT)},
+ [telepathy.CHANNEL_INTERFACE + '.TargetHandle',
+ telepathy.CHANNEL_INTERFACE + '.TargetID'])
+
+ audio_chat_class = \
+ ({telepathy.CHANNEL_INTERFACE + '.ChannelType':
+ telepathy.CHANNEL_TYPE_STREAMED_MEDIA,
+ telepathy.CHANNEL_INTERFACE + '.TargetHandleType':
+ dbus.UInt32(telepathy.HANDLE_TYPE_CONTACT)},
+ [telepathy.CHANNEL_INTERFACE + '.TargetHandle',
+ telepathy.CHANNEL_INTERFACE + '.TargetID',
+ telepathy.CHANNEL_TYPE_STREAMED_MEDIA + '.InitialAudio'])
+
+ av_chat_class = \
+ ({telepathy.CHANNEL_INTERFACE + '.ChannelType':
+ telepathy.CHANNEL_TYPE_STREAMED_MEDIA,
+ telepathy.CHANNEL_INTERFACE + '.TargetHandleType':
+ dbus.UInt32(telepathy.HANDLE_TYPE_CONTACT)},
+ [telepathy.CHANNEL_INTERFACE + '.TargetHandle',
+ telepathy.CHANNEL_INTERFACE + '.TargetID',
+ telepathy.CHANNEL_TYPE_STREAMED_MEDIA + '.InitialAudio',
+ telepathy.CHANNEL_TYPE_STREAMED_MEDIA + '.InitialVideo'])
+
+
def __init__(self):
telepathy.server.ConnectionInterfaceCapabilities.__init__(self)
+ ConnectionInterfaceContactCapabilities.__init__(self)
papyon.event.ContactEventInterface.__init__(self, self.msn_client)
- dbus_interface = telepathy.CONNECTION_INTERFACE_CAPABILITIES
+
+ # handle -> list(RCC)
+ self._contact_caps = {}
+ self._video_clients = []
+ self._update_capabilities_calls = []
def AdvertiseCapabilities(self, add, remove):
#for caps, specs in add:
@@ -52,6 +89,58 @@
return telepathy.server.ConnectionInterfaceCapabilities.\
AdvertiseCapabilities(self, add, remove)
+ def GetContactCapabilities(self, handles):
+ if 0 in handles:
+ raise telepathy.InvalidHandle('Contact handle list contains zero')
+
+ ret = dbus.Dictionary({}, signature='ua(a{sv}as)')
+ for i in handles:
+ handle = self.handle(telepathy.HANDLE_TYPE_CONTACT, i)
+ ret[handle] = self._contact_caps[handle]
+
+ return ret
+
+ def UpdateCapabilities(self, caps):
+ if self._state != telepathy.CONNECTION_STATUS_CONNECTED:
+ self._update_capabilities_calls.append(caps)
+ return
+
+ # butterfly voip is disabled, so
+ return
+
+ # We only care about voip.
+ for client, classes, capabilities in caps:
+ video = False
+ for channel_class in classes:
+ # Does this client support video?
+ if channel_class[telepathy.CHANNEL_INTERFACE + '.ChannelType'] == \
+ telepathy.CHANNEL_TYPE_STREAMED_MEDIA:
+ video = True
+ self._video_clients.append(client)
+ else:
+ # *Did* it used to support video?
+ if client in self._video_clients:
+ self._video_clients.remove(client)
+
+ changed = False
+
+ # We've got no more clients that support video; remove the cap.
+ if not video and not self._video_clients:
+ self._self_handle.profile.client_id.has_webcam = False
+ changed = True
+
+ # We want video.
+ if video and not self._self_handle.profile.client_id.has_webcam:
+ self._self_handle.profile.client_id.has_webcam = True
+ self._self_handle.profile.client_id.supports_rtc_video = True
+ changed = True
+
+ # Signal.
+ if changed:
+ updated = dbus.Dictionary({self._self_handle: self._contact_caps[self._self_handle]},
+ signature='ua(a{sv}as)')
+ self.ContactCapabilitiesChanged(updated)
+
# papyon.event.ContactEventInterface
def on_contact_client_capabilities_changed(self, contact):
self._update_capabilities(contact)
@@ -68,6 +157,7 @@
def add_text_capabilities(self, contacts_handles):
"""Add the create capability for text channel to these contacts."""
ret = []
+ cc_ret = dbus.Dictionary({}, signature='ua(a{sv}as)')
for handle in contacts_handles:
ctype = telepathy.CHANNEL_TYPE_TEXT
if handle in self._caps:
@@ -81,30 +171,55 @@
diff = (int(handle), ctype, old_gen, new_gen, old_spec, old_spec)
ret.append(diff)
+ # ContactCapabilities
+ self._contact_caps.setdefault(handle, []).append(self.text_chat_class)
+ cc_ret[handle] = self._contact_caps[handle]
+
self.CapabilitiesChanged(ret)
+ self.ContactCapabilitiesChanged(cc_ret)
def _update_capabilities(self, contact):
handle = ButterflyHandleFactory(self, 'contact',
contact.account, contact.network_id)
ctype = telepathy.CHANNEL_TYPE_STREAMED_MEDIA
- new_gen, new_spec = self._get_capabilities(contact)
+ new_gen, new_spec, rcc = self._get_capabilities(contact)
if handle in self._caps:
old_gen, old_spec = self._caps[handle][ctype]
else:
old_gen = 0
old_spec = 0
- if old_gen == new_gen and old_spec == new_spec:
+ if old_gen != new_gen or old_spec != new_spec:
+ diff = (int(handle), ctype, old_gen, new_gen, old_spec, new_spec)
+ self.CapabilitiesChanged([diff])
+
+ if rcc is None:
+ return
+
+ self._contact_caps.setdefault(handle, [])
+
+ if rcc in self._contact_caps[handle]:
return
- diff = (int(handle), ctype, old_gen, new_gen, old_spec, new_spec)
- self.CapabilitiesChanged([diff])
+ if self.audio_chat_class in self._contact_caps[handle]:
+ self._contact_caps[handle].remove(self.audio_chat_class)
+
+ if self.audio_chat_class in self._contact_caps[handle]:
+ self._contact_caps[handle].remove(self.audio_chat_class)
+
+ self._contact_caps[handle].append(rcc)
+
+ ret = dbus.Dictionary({handle: self._contact_caps[handle]},
+ signature='ua(a{sv}as)')
+ self.ContactCapabilitiesChanged(ret)
def _get_capabilities(self, contact):
gen_caps = 0
spec_caps = 0
+ rcc = None
+
caps = contact.client_capabilities
#if caps.supports_sip_invite:
#gen_caps |= telepathy.CONNECTION_CAPABILITY_FLAG_CREATE
@@ -114,14 +229,17 @@
#if caps.has_webcam:
#spec_caps |= telepathy.CHANNEL_MEDIA_CAPABILITY_VIDEO
+ #rcc = self.av_chat_class
+ #else:
+ #rcc = self.audio_chat_class
- return gen_caps, spec_caps
+ return gen_caps, spec_caps, rcc
@async
def _populate_capabilities(self):
""" Add the capability to create text channels to all contacts in our
contacts list."""
- handles = set()
+ handles = set([self._self_handle])
for contact in self.msn_client.address_book.contacts:
if contact.is_member(papyon.Membership.FORWARD):
handle = ButterflyHandleFactory(self, 'contact',
@@ -129,3 +247,7 @@
handles.add(handle)
self.add_text_capabilities(handles)
+ # These caps were updated before we were online.
+ for caps in self._update_capabilities_calls:
+ self.UpdateCapabilities(caps)
+ self._update_capabilities_calls = []
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telepathy-butterfly-0.5.7/butterfly/channel/conference.py new/telepathy-butterfly-0.5.8/butterfly/channel/conference.py
--- old/telepathy-butterfly-0.5.7/butterfly/channel/conference.py 2010-03-14 15:30:32.000000000 +0100
+++ new/telepathy-butterfly-0.5.8/butterfly/channel/conference.py 2010-04-08 15:00:08.000000000 +0200
@@ -128,7 +128,11 @@
# Get IntitialInviteeHandles
for invitee_handle in props.get(CHANNEL_INTERFACE_CONFERENCE + '.InitialInviteeHandles', []):
handle = self._conn_ref().handle(telepathy.HANDLE_TYPE_CONTACT, invitee_handle)
- if handle is not None and handle not in self._conference_initial_invitees:
+
+ if handle is None or handle.contact is None:
+ raise telepathy.NotAvailable('Contact with handle %u not available' % invitee_handle)
+
+ if handle not in self._conference_initial_invitees:
self._conference_initial_invitees.append(handle)
# Get InitialInviteeIDs
@@ -139,7 +143,10 @@
handle = h
break
- if handle is not None and handle not in self._conference_initial_invitees:
+ if handle is None or handle.contact is None:
+ raise telepathy.NotAvailable('Contact "%s" not available' % invitee_id)
+
+ if handle not in self._conference_initial_invitees:
self._conference_initial_invitees.append(handle)
# Actually invite all the initial invitees
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telepathy-butterfly-0.5.7/butterfly/channel/im.py new/telepathy-butterfly-0.5.8/butterfly/channel/im.py
--- old/telepathy-butterfly-0.5.7/butterfly/channel/im.py 2010-03-18 18:02:42.000000000 +0100
+++ new/telepathy-butterfly-0.5.8/butterfly/channel/im.py 2010-04-08 15:00:17.000000000 +0200
@@ -43,6 +43,9 @@
_, _, handle = manager._get_type_requested_handle(props)
+ if handle.contact is None:
+ raise telepathy.NotAvailable('Contact not available')
+
self._pending_offline_messages = {}
contact = handle.contact
if conversation is None:
@@ -88,7 +91,7 @@
else:
return set([self._initial_handle.contact])
- def Send(self, message_type, text):
+ def _send_text_message(self, message_type, text):
if self._conversation is None and self._offline_contact.presence != papyon.Presence.OFFLINE:
contact = self._offline_contact
logger.info('Contact %s still connected, inviting him to the text channel before sending message' % unicode(contact))
@@ -100,7 +103,7 @@
if self._conversation is not None:
# Actually send the message.
- ButterflyTextChannel.Send(self, message_type, text)
+ return ButterflyTextChannel._send_text_message(self, message_type, text)
else:
if message_type == telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL:
logger.info("Sending offline message : %s" % unicode(text))
@@ -108,12 +111,12 @@
#FIXME : Check if the message was sent correctly?
else:
raise telepathy.NotImplemented("Unhandled message type for offline contact")
- self.Sent(int(time.time()), message_type, text)
+ return True
# Rededefine AcknowledgePendingMessages to remove offline messages
# from the oim box.
def AcknowledgePendingMessages(self, ids):
- telepathy.server.ChannelTypeText.AcknowledgePendingMessages(self, ids)
+ ButterflyTextChannel.AcknowledgePendingMessages(self, ids)
messages = []
for id in ids:
@@ -128,7 +131,7 @@
if clear:
messages = self._pending_offline_messages.values()
self._oim_box_ref().delete_messages(messages)
- return telepathy.server.ChannelTypeText.ListPendingMessages(self, clear)
+ return ButterflyTextChannel.ListPendingMessages(self, clear)
# papyon.event.ConversationEventInterface
def on_conversation_user_joined(self, contact):
@@ -185,7 +188,7 @@
sender.account, sender.network_id)
type = telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL
logger.info("User %r sent a offline message" % handle)
- self.Received(id, timestamp, handle, type, 0, text)
+ self._signal_text_received(id, timestamp, handle, type, 0, text)
self._recv_id += 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telepathy-butterfly-0.5.7/butterfly/channel/text.py new/telepathy-butterfly-0.5.8/butterfly/channel/text.py
--- old/telepathy-butterfly-0.5.7/butterfly/channel/text.py 2010-03-18 19:03:36.000000000 +0100
+++ new/telepathy-butterfly-0.5.8/butterfly/channel/text.py 2010-04-08 15:00:17.000000000 +0200
@@ -23,9 +23,12 @@
import weakref
import time
+import dbus
import telepathy
import papyon
import papyon.event
+from telepathy._generated.Channel_Interface_Messages import ChannelInterfaceMessages
+from telepathy.interfaces import CHANNEL_INTERFACE_MESSAGES
from butterfly.handle import ButterflyHandleFactory
@@ -36,6 +39,7 @@
class ButterflyTextChannel(
telepathy.server.ChannelTypeText,
telepathy.server.ChannelInterfaceChatState,
+ ChannelInterfaceMessages,
papyon.event.ContactEventInterface,
papyon.event.ConversationEventInterface):
@@ -46,12 +50,28 @@
self._typing_notifications = dict()
self._conversation = None
+ self._pending_messages2 = {}
telepathy.server.ChannelTypeText.__init__(self, conn, manager, props,
object_path=object_path)
telepathy.server.ChannelInterfaceChatState.__init__(self)
+ ChannelInterfaceMessages.__init__(self)
papyon.event.ConversationEventInterface.__init__(self, conn.msn_client)
+ self._implement_property_get(CHANNEL_INTERFACE_MESSAGES, {
+ 'SupportedContentTypes': lambda: ["text/plain"] ,
+ 'MessagePartSupportFlags': lambda: 0,
+ 'DeliveryReportingSupport': lambda: telepathy.DELIVERY_REPORTING_SUPPORT_FLAG_RECEIVE_FAILURES,
+ 'PendingMessages': lambda: self._pending_messages2
+ })
+
+ self._add_immutables({
+ 'SupportedContentTypes': CHANNEL_INTERFACE_MESSAGES,
+ 'MessagePartSupportFlags': CHANNEL_INTERFACE_MESSAGES,
+ 'DeliveryReportingSupport': CHANNEL_INTERFACE_MESSAGES,
+ })
+
+
def __del__(self):
self._remove_typing_timeouts()
@@ -107,6 +127,44 @@
self._send_typing_notification_timeout = 0
return False
+ def _send_text_message(self, message_type, text):
+ "Send a simple text message, return true if sent correctly"
+ if self._conversation is not None:
+ if message_type == telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL:
+ logger.info("Sending message : %s" % unicode(text))
+ self._conversation.send_text_message(papyon.ConversationMessage(text))
+ else:
+ raise telepathy.NotImplemented("Unhandled message type")
+ return True
+ else:
+ logger.warning('Tried sending a message with no conversation')
+ return False
+
+ def _signal_text_sent(self, timestamp, message_type, text):
+ headers = {'message-sent' : timestamp,
+ 'message-type' : message_type
+ }
+ body = {'content-type': 'text/plain',
+ 'content': text
+ }
+ message = [headers, body]
+ self.Sent(timestamp, message_type, text)
+ self.MessageSent(message, 0, '')
+
+ def _signal_text_received(self, id, timestamp, sender, type, flags, text):
+ self.Received(id, timestamp, sender, type, flags, text)
+ headers = {'message-received' : timestamp,
+ 'pending-message-id' : int(id),
+ 'message-sender' : int(sender),
+ 'message-type' : type
+ }
+
+ body = {'content-type': 'text/plain',
+ 'content': text
+ }
+ message = [headers, body]
+ self.MessageReceived(message)
+
def SetChatState(self, state):
# Not useful if we dont have a conversation.
if self._conversation is not None:
@@ -129,16 +187,14 @@
handle = ButterflyHandleFactory(self._conn_ref(), 'self')
self.ChatStateChanged(handle, state)
- def Send(self, message_type, text):
- if self._conversation is not None:
- if message_type == telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL:
- logger.info("Sending message : %s" % unicode(text))
- self._conversation.send_text_message(papyon.ConversationMessage(text))
- else:
- raise telepathy.NotImplemented("Unhandled message type")
- self.Sent(int(time.time()), message_type, text)
- else:
- logger.warning('Tried sending a message with no conversation')
+ @dbus.service.method(telepathy.CHANNEL_TYPE_TEXT, in_signature='us', out_signature='',
+ async_callbacks=('_success', '_error'))
+ def Send(self, message_type, text, _success, _error):
+ if self._send_text_message(message_type, text):
+ # The function MUST return before emitting the signals
+ _success()
+ timestamp = int(time.time())
+ self._signal_text_sent(timestamp, message_type, text)
def Close(self):
if self._conversation is not None:
@@ -147,6 +203,45 @@
telepathy.server.ChannelTypeText.Close(self)
self.remove_from_connection()
+ def GetPendingMessageContent(self, message_id, parts):
+ # We don't support pending message
+ raise telepathy.InvalidArgument()
+
+ @dbus.service.method(telepathy.CHANNEL_INTERFACE_MESSAGES, in_signature='aa{sv}u',
+ out_signature='s', async_callbacks=('_success', '_error'))
+ def SendMessage(self, message, flags, _success, _error):
+ headers = message.pop(0)
+ message_type = int(headers['message-type'])
+ if message_type != telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL:
+ raise telepathy.NotImplemented("Unhandled message type")
+ text = None
+ for part in message:
+ if part.get("content-type", None) == "text/plain":
+ text = part['content']
+ break
+ if text is None:
+ raise telepathy.NotImplemented("Unhandled message type")
+
+ if self._send_text_message(message_type, text):
+ timestamp = int(time.time())
+ # The function MUST return before emitting the signals
+ _success('')
+ self._signal_text_sent(timestamp, message_type, text)
+
+ def AcknowledgePendingMessages(self, ids):
+ for id in ids:
+ if id in self._pending_messages2:
+ del self._pending_messages2[id]
+
+ telepathy.server.ChannelTypeText.AcknowledgePendingMessages(self, ids)
+ self.PendingMessagesRemoved(ids)
+
+ def ListPendingMessages(self, clear):
+ ids = self._pending_messages2.keys()
+ self._pending_messages2 = {}
+ self.PendingMessagesRemoved(ids)
+ return telepathy.server.ChannelTypeText.ListPendingMessages(self, clear)
+
# Redefine GetSelfHandle since we use our own handle
# as Butterfly doesn't have channel specific handles
def GetSelfHandle(self):
@@ -187,7 +282,7 @@
type = telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL
message = message.content
logger.info("User %s sent a message" % unicode(handle))
- self.Received(id, timestamp, handle, type, 0, message)
+ self._signal_text_received(id, timestamp, handle, type, 0, message)
self._recv_id += 1
# papyon.event.ConversationEventInterface
@@ -198,3 +293,9 @@
handle = ButterflyHandleFactory(self._conn_ref(), 'contact',
sender.account, sender.network_id)
logger.info("User %s sent a nudge" % unicode(handle))
+
+ @dbus.service.signal(telepathy.CHANNEL_INTERFACE_MESSAGES, signature='aa{sv}')
+ def MessageReceived(self, message):
+ id = message[0]['pending-message-id']
+ self._pending_messages2[id] = message
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telepathy-butterfly-0.5.7/butterfly/connection.py new/telepathy-butterfly-0.5.8/butterfly/connection.py
--- old/telepathy-butterfly-0.5.7/butterfly/connection.py 2010-03-22 01:57:42.000000000 +0100
+++ new/telepathy-butterfly-0.5.8/butterfly/connection.py 2010-04-08 15:01:31.000000000 +0200
@@ -70,11 +70,13 @@
'https-proxy-server' : 's',
'https-proxy-port' : 'q',
'https-proxy-username' : 's',
- 'https-proxy-password' : 's'
+ 'https-proxy-password' : 's',
+ 'http-method' : 'b',
}
_parameter_defaults = {
'server' : 'messenger.hotmail.com',
- 'port' : 1863
+ 'port' : 1863,
+ 'http-method' : False
}
def __init__(self, manager, parameters):
@@ -82,19 +84,19 @@
try:
account = unicode(parameters['account'])
- server = (parameters['server'].encode('utf-8'), parameters['port'])
+ self._server = (parameters['server'].encode('utf-8'), parameters['port'])
# Build the proxies configurations
- proxies = {}
+ self._proxies = {}
proxy = build_proxy_infos(parameters, 'http')
if proxy is not None:
- proxies['http'] = proxy
+ self._proxies['http'] = proxy
proxy = build_proxy_infos(parameters, 'https')
if proxy is not None:
- proxies['https'] = proxy
+ self._proxies['https'] = proxy
self._manager = weakref.proxy(manager)
- self._msn_client = papyon.Client(server, proxies)
+ self._new_client(use_http=parameters['http-method'])
self._account = (parameters['account'].encode('utf-8'),
parameters['password'].encode('utf-8'))
self._channel_manager = ButterflyChannelManager(self)
@@ -108,10 +110,6 @@
ButterflyCapabilities.__init__(self)
ButterflyContacts.__init__(self)
ButterflyMailNotification.__init__(self)
- papyon.event.ClientEventInterface.__init__(self, self._msn_client)
- papyon.event.InviteEventInterface.__init__(self, self._msn_client)
- papyon.event.OfflineMessagesEventInterface.__init__(self, self._msn_client)
-
self.set_self_handle(ButterflyHandleFactory(self, 'self'))
@@ -127,6 +125,23 @@
logger.exception("Failed to create Connection")
raise
+ def _new_client(self, use_http=False):
+ if hasattr(self, '_msn_client') and self._msn_client:
+ self._msn_client.logout()
+ self._msn_client._events_handlers.remove(self)
+
+ if use_http:
+ self._tried_http = True
+ self._msn_client = papyon.Client(self._server, self._proxies,
+ papyon.transport.HTTPPollConnection)
+ else:
+ self._tried_http = False
+ self._msn_client = papyon.Client(self._server, self._proxies)
+
+ papyon.event.ClientEventInterface.__init__(self, self._msn_client)
+ papyon.event.InviteEventInterface.__init__(self, self._msn_client)
+ papyon.event.OfflineMessagesEventInterface.__init__(self, self._msn_client)
+
@property
def manager(self):
return self._manager
@@ -292,7 +307,12 @@
# papyon.event.ClientEventInterface
def on_client_error(self, type, error):
if type == papyon.event.ClientErrorType.NETWORK:
- self.__disconnect_reason = telepathy.CONNECTION_STATUS_REASON_NETWORK_ERROR
+ if self._tried_http is False:
+ logger.info("Failed to connect directly, trying HTTP")
+ self._new_client(use_http=True)
+ self._msn_client.login(*self._account)
+ else:
+ self.__disconnect_reason = telepathy.CONNECTION_STATUS_REASON_NETWORK_ERROR
elif type == papyon.event.ClientErrorType.AUTHENTICATION:
self.__disconnect_reason = telepathy.CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED
elif type == papyon.event.ClientErrorType.PROTOCOL and \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telepathy-butterfly-0.5.7/butterfly/contacts.py new/telepathy-butterfly-0.5.8/butterfly/contacts.py
--- old/telepathy-butterfly-0.5.7/butterfly/contacts.py 2010-03-18 16:49:19.000000000 +0100
+++ new/telepathy-butterfly-0.5.8/butterfly/contacts.py 2010-04-08 15:00:08.000000000 +0200
@@ -39,7 +39,8 @@
telepathy.CONNECTION_INTERFACE_SIMPLE_PRESENCE : 'presence',
telepathy.CONNECTION_INTERFACE_ALIASING : 'alias',
telepathy.CONNECTION_INTERFACE_AVATARS : 'token',
- telepathy.CONNECTION_INTERFACE_CAPABILITIES : 'caps'
+ telepathy.CONNECTION_INTERFACE_CAPABILITIES : 'caps',
+ telepathy.CONNECTION_INTERFACE_CONTACT_CAPABILITIES : 'capabilities'
}
def __init__(self):
@@ -57,10 +58,12 @@
out_signature='a{ua{sv}}', sender_keyword='sender')
def GetContactAttributes(self, handles, interfaces, hold, sender):
#InspectHandle already checks we're connected, the handles and handle type.
+ supported_interfaces = set()
for interface in interfaces:
- if interface not in self.attributes:
- raise telepathy.errors.InvalidArgument(
- 'Interface %s is not supported by GetContactAttributes' % (interface))
+ if interface in self.attributes:
+ supported_interfaces.add(interface)
+ else:
+ logger.debug("Ignoring unsupported interface %s" % interface)
handle_type = telepathy.HANDLE_TYPE_CONTACT
ret = {}
@@ -77,7 +80,9 @@
telepathy.CONNECTION_INTERFACE_AVATARS :
lambda x: self.GetKnownAvatarTokens(x).items(),
telepathy.CONNECTION_INTERFACE_CAPABILITIES :
- lambda x: self.GetCapabilities(x).items()
+ lambda x: self.GetCapabilities(x).items(),
+ telepathy.CONNECTION_INTERFACE_CONTACT_CAPABILITIES :
+ lambda x: self.GetContactCapabilities(x).items()
}
#Hold handles if needed
@@ -86,8 +91,9 @@
# Attributes from the interface org.freedesktop.Telepathy.Connection
# are always returned, and need not be requested explicitly.
- interfaces = set(interfaces + [telepathy.CONNECTION])
- for interface in interfaces:
+ supported_interfaces.add(telepathy.CONNECTION)
+
+ for interface in supported_interfaces:
interface_attribute = interface + '/' + self.attributes[interface]
results = functions[interface](handles)
for handle, value in results:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telepathy-butterfly-0.5.7/configure new/telepathy-butterfly-0.5.8/configure
--- old/telepathy-butterfly-0.5.7/configure 2010-03-22 02:13:17.000000000 +0100
+++ new/telepathy-butterfly-0.5.8/configure 2010-04-08 15:13:31.000000000 +0200
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.65 for telepathy-butterfly 0.5.7.
+# Generated by GNU Autoconf 2.65 for telepathy-butterfly 0.5.8.
#
# Report bugs to http://bugs.freedesktop.org/enter_bug.cgi?product=Telepathy&component=butterfly.
#
@@ -552,8 +552,8 @@
# Identity of this package.
PACKAGE_NAME='telepathy-butterfly'
PACKAGE_TARNAME='telepathy-butterfly'
-PACKAGE_VERSION='0.5.7'
-PACKAGE_STRING='telepathy-butterfly 0.5.7'
+PACKAGE_VERSION='0.5.8'
+PACKAGE_STRING='telepathy-butterfly 0.5.8'
PACKAGE_BUGREPORT='http://bugs.freedesktop.org/enter_bug.cgi?product=Telepathy&component=butterfly'
PACKAGE_URL=''
@@ -1180,7 +1180,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures telepathy-butterfly 0.5.7 to adapt to many kinds of systems.
+\`configure' configures telepathy-butterfly 0.5.8 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1247,7 +1247,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of telepathy-butterfly 0.5.7:";;
+ short | recursive ) echo "Configuration of telepathy-butterfly 0.5.8:";;
esac
cat <<\_ACEOF
@@ -1321,7 +1321,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-telepathy-butterfly configure 0.5.7
+telepathy-butterfly configure 0.5.8
generated by GNU Autoconf 2.65
Copyright (C) 2009 Free Software Foundation, Inc.
@@ -1338,7 +1338,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by telepathy-butterfly $as_me 0.5.7, which was
+It was created by telepathy-butterfly $as_me 0.5.8, which was
generated by GNU Autoconf 2.65. Invocation command line was
$ $0 $@
@@ -2146,7 +2146,7 @@
# Define the identity of the package.
PACKAGE='telepathy-butterfly'
- VERSION='0.5.7'
+ VERSION='0.5.8'
cat >>confdefs.h <<_ACEOF
@@ -2971,7 +2971,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by telepathy-butterfly $as_me 0.5.7, which was
+This file was extended by telepathy-butterfly $as_me 0.5.8, which was
generated by GNU Autoconf 2.65. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -3024,7 +3024,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-telepathy-butterfly config.status 0.5.7
+telepathy-butterfly config.status 0.5.8
configured by $0, generated by GNU Autoconf 2.65,
with options \\"\$ac_cs_config\\"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telepathy-butterfly-0.5.7/configure.ac new/telepathy-butterfly-0.5.8/configure.ac
--- old/telepathy-butterfly-0.5.7/configure.ac 2010-03-22 02:12:55.000000000 +0100
+++ new/telepathy-butterfly-0.5.8/configure.ac 2010-04-08 15:07:17.000000000 +0200
@@ -6,7 +6,7 @@
dnl The telepathy-python version number (must actually be numeric at the moment)
m4_define(telepathy_butterfly_major_version, 0)
m4_define(telepathy_butterfly_minor_version, 5)
-m4_define(telepathy_butterfly_micro_version, 7)
+m4_define(telepathy_butterfly_micro_version, 8)
m4_define(telepathy_butterfly_maybe_datestamp,
m4_esyscmd([if test x]telepathy_butterfly_released[ != x1; then date +.%Y%m%d | tr -d '\n\r'; fi]))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telepathy-butterfly-0.5.7/data/butterfly.manager new/telepathy-butterfly-0.5.8/data/butterfly.manager
--- old/telepathy-butterfly-0.5.7/data/butterfly.manager 2010-03-17 03:18:33.000000000 +0100
+++ new/telepathy-butterfly-0.5.8/data/butterfly.manager 2010-04-08 15:01:31.000000000 +0200
@@ -16,5 +16,7 @@
param-https-proxy-port = q
param-https-proxy-username = s
param-https-proxy-password = s secret
+param-http-method = b
default-server = messenger.hotmail.com
default-port = 1863
+default-http-method = false
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org