[telepathy-butterfly/master] Modified to use papyon instead of pymsn
Louis-Francis Ratte-Boulianne
lfrb at lfrb-desktop.no-domain-set.bellcanada
Thu Jul 2 07:47:56 PDT 2009
---
butterfly/aliasing.py | 18 +++++-----
butterfly/avatars.py | 22 +++++++-------
butterfly/channel/contact_list.py | 50 +++++++++++++++---------------
butterfly/channel/group.py | 12 ++++----
butterfly/channel/text.py | 20 ++++++------
butterfly/channel_manager.py | 4 +-
butterfly/connection.py | 40 ++++++++++++------------
butterfly/contacts.py | 10 +++---
butterfly/handle.py | 4 +-
butterfly/presence.py | 60 ++++++++++++++++++------------------
10 files changed, 120 insertions(+), 120 deletions(-)
diff --git a/butterfly/aliasing.py b/butterfly/aliasing.py
index 45848f9..d894b72 100644
--- a/butterfly/aliasing.py
+++ b/butterfly/aliasing.py
@@ -20,8 +20,8 @@ import logging
import telepathy
import telepathy.constants
-import pymsn
-from pymsn.service.description.AB.constants import \
+import papyon
+from papyon.service.description.AB.constants import \
ContactGeneral, ContactAnnotations
from butterfly.handle import ButterflyHandleFactory
@@ -33,11 +33,11 @@ logger = logging.getLogger('Butterfly.Aliasing')
class ButterflyAliasing(
telepathy.server.ConnectionInterfaceAliasing,
- pymsn.event.ContactEventInterface):
+ papyon.event.ContactEventInterface):
def __init__(self):
telepathy.server.ConnectionInterfaceAliasing.__init__(self)
- pymsn.event.ContactEventInterface.__init__(self, self.msn_client)
+ papyon.event.ContactEventInterface.__init__(self, self.msn_client)
def GetAliasFlags(self):
return telepathy.constants.CONNECTION_ALIAS_FLAG_USER_SET
@@ -62,7 +62,7 @@ class ButterflyAliasing(
alias = u""
contact = handle.contact
if contact is None or \
- (not contact.is_member(pymsn.Membership.FORWARD)):
+ (not contact.is_member(papyon.Membership.FORWARD)):
handle.pending_alias = alias
continue
infos = {ContactGeneral.ANNOTATIONS : \
@@ -75,11 +75,11 @@ class ButterflyAliasing(
logger.info("Self alias changed to '%s'" % alias)
self.AliasesChanged(((ButterflyHandleFactory(self, 'self'), alias), ))
- # pymsn.event.ContactEventInterface
+ # papyon.event.ContactEventInterface
def on_contact_display_name_changed(self, contact):
self._contact_alias_changed(contact)
- # pymsn.event.ContactEventInterface
+ # papyon.event.ContactEventInterface
def on_contact_infos_changed(self, contact, updated_infos):
alias = updated_infos.get(ContactGeneral.ANNOTATIONS, {}).\
get(ContactAnnotations.NICKNAME, None)
@@ -87,11 +87,11 @@ class ButterflyAliasing(
if alias is not None or alias != "":
self._contact_alias_changed(contact)
- # pymsn.event.ContactEventInterface
+ # papyon.event.ContactEventInterface
def on_contact_memberships_changed(self, contact):
handle = ButterflyHandleFactory(self, 'contact',
contact.account, contact.network_id)
- if contact.is_member(pymsn.Membership.FORWARD):
+ if contact.is_member(papyon.Membership.FORWARD):
alias = handle.pending_alias
if alias is not None:
infos = {ContactGeneral.ANNOTATIONS : \
diff --git a/butterfly/avatars.py b/butterfly/avatars.py
index b235863..17e75a6 100644
--- a/butterfly/avatars.py
+++ b/butterfly/avatars.py
@@ -22,9 +22,9 @@ import sha
import dbus
import telepathy
-import pymsn
-import pymsn.event
-import pymsn.util.string_io as StringIO
+import papyon
+import papyon.event
+import papyon.util.string_io as StringIO
from butterfly.handle import ButterflyHandleFactory
from butterfly.util.decorator import async
@@ -36,14 +36,14 @@ logger = logging.getLogger('Butterfly.Avatars')
class ButterflyAvatars(\
telepathy.server.ConnectionInterfaceAvatars,
- pymsn.event.ContactEventInterface,
- pymsn.event.ProfileEventInterface):
+ papyon.event.ContactEventInterface,
+ papyon.event.ProfileEventInterface):
def __init__(self):
self._avatar_known = False
telepathy.server.ConnectionInterfaceAvatars.__init__(self)
- pymsn.event.ContactEventInterface.__init__(self, self.msn_client)
- pymsn.event.ProfileEventInterface.__init__(self, self.msn_client)
+ papyon.event.ContactEventInterface.__init__(self, self.msn_client)
+ papyon.event.ProfileEventInterface.__init__(self, self.msn_client)
def GetAvatarRequirements(self):
mime_types = ("image/png","image/jpeg","image/gif")
@@ -89,9 +89,9 @@ class ButterflyAvatars(\
self._avatar_known = True
if not isinstance(avatar, str):
avatar = "".join([chr(b) for b in avatar])
- msn_object = pymsn.p2p.MSNObject(self.msn_client.profile,
+ msn_object = papyon.p2p.MSNObject(self.msn_client.profile,
len(avatar),
- pymsn.p2p.MSNObjectType.DISPLAY_PICTURE,
+ papyon.p2p.MSNObjectType.DISPLAY_PICTURE,
sha.new(avatar).hexdigest() + '.tmp',
"",
data=StringIO.StringIO(avatar))
@@ -104,7 +104,7 @@ class ButterflyAvatars(\
self.msn_client.profile.msn_object = None
self._avatar_known = True
- # pymsn.event.ContactEventInterface
+ # papyon.event.ContactEventInterface
def on_contact_msn_object_changed(self, contact):
if contact.msn_object is not None:
avatar_token = contact.msn_object._data_sha.encode("hex")
@@ -114,7 +114,7 @@ class ButterflyAvatars(\
contact.account, contact.network_id)
self.AvatarUpdated(handle, avatar_token)
- # pymsn.event.ProfileEventInterface
+ # papyon.event.ProfileEventInterface
def on_profile_msn_object_changed(self):
msn_object = self.msn_client.profile.msn_object
if msn_object is not None:
diff --git a/butterfly/channel/contact_list.py b/butterfly/channel/contact_list.py
index c9444c1..afef20b 100644
--- a/butterfly/channel/contact_list.py
+++ b/butterfly/channel/contact_list.py
@@ -20,8 +20,8 @@ import logging
import weakref
import telepathy
-import pymsn
-import pymsn.event
+import papyon
+import papyon.event
from butterfly.util.decorator import async
from butterfly.handle import ButterflyHandleFactory
@@ -48,20 +48,20 @@ def ButterflyContactListChannelFactory(connection, handle):
class ButterflyListChannel(
telepathy.server.ChannelTypeContactList,
telepathy.server.ChannelInterfaceGroup,
- pymsn.event.AddressBookEventInterface):
+ papyon.event.AddressBookEventInterface):
"Abstract Contact List channels"
def __init__(self, connection, handle):
self._conn_ref = weakref.ref(connection)
telepathy.server.ChannelTypeContactList.__init__(self, connection, handle)
telepathy.server.ChannelInterfaceGroup.__init__(self)
- pymsn.event.AddressBookEventInterface.__init__(self, connection.msn_client)
+ papyon.event.AddressBookEventInterface.__init__(self, connection.msn_client)
self._populate(connection)
def GetLocalPendingMembersWithInfo(self):
return []
- # pymsn.event.AddressBookEventInterface
+ # papyon.event.AddressBookEventInterface
def on_addressbook_messenger_contact_added(self, contact):
added = set()
local_pending = set()
@@ -77,7 +77,7 @@ class ButterflyListChannel(
self.MembersChanged('', added, (), local_pending, remote_pending, 0,
telepathy.CHANNEL_GROUP_CHANGE_REASON_NONE)
- # pymsn.event.AddressBookEventInterface
+ # papyon.event.AddressBookEventInterface
def on_addressbook_contact_deleted(self, contact):
handle = ButterflyHandleFactory(self._conn_ref(), 'contact',
contact.account, contact.network_id)
@@ -85,11 +85,11 @@ class ButterflyListChannel(
self.MembersChanged('', (), [handle], (), (), 0,
telepathy.CHANNEL_GROUP_CHANGE_REASON_NONE)
- # pymsn.event.AddressBookEventInterface
+ # papyon.event.AddressBookEventInterface
def on_addressbook_contact_blocked(self, contact):
pass
- # pymsn.event.AddressBookEventInterface
+ # papyon.event.AddressBookEventInterface
def on_addressbook_contact_unblocked(self, contact):
pass
@@ -120,7 +120,7 @@ class ButterflyListChannel(
class ButterflySubscribeListChannel(ButterflyListChannel,
- pymsn.event.ContactEventInterface):
+ papyon.event.ContactEventInterface):
"""Subscribe List channel.
This channel contains the list of contact to whom the current used is
@@ -129,7 +129,7 @@ class ButterflySubscribeListChannel(ButterflyListChannel,
def __init__(self, connection, handle):
ButterflyListChannel.__init__(self, connection, handle)
- pymsn.event.ContactEventInterface.__init__(self, connection.msn_client)
+ papyon.event.ContactEventInterface.__init__(self, connection.msn_client)
self.GroupFlagsChanged(telepathy.CHANNEL_GROUP_FLAG_CAN_ADD |
telepathy.CHANNEL_GROUP_FLAG_CAN_REMOVE, 0)
@@ -140,7 +140,7 @@ class ButterflySubscribeListChannel(ButterflyListChannel,
contact = handle.contact
if contact is None:
account = handle.account
- elif contact.is_member(pymsn.Membership.FORWARD):
+ elif contact.is_member(papyon.Membership.FORWARD):
continue
else:
account = contact.account
@@ -155,18 +155,18 @@ class ButterflySubscribeListChannel(ButterflyListChannel,
for h in contacts:
handle = self._conn.handle(telepathy.HANDLE_TYPE_CONTACT, h)
contact = handle.contact
- if contact.is_member(pymsn.Membership.FORWARD):
+ if contact.is_member(papyon.Membership.FORWARD):
ab.delete_contact(contact)
def _filter_contact(self, contact):
- return (contact.is_member(pymsn.Membership.FORWARD) and not
- contact.is_member(pymsn.Membership.PENDING), False, False)
+ return (contact.is_member(papyon.Membership.FORWARD) and not
+ contact.is_member(papyon.Membership.PENDING), False, False)
- # pymsn.event.ContactEventInterface
+ # papyon.event.ContactEventInterface
def on_contact_memberships_changed(self, contact):
handle = ButterflyHandleFactory(self._conn_ref(), 'contact',
contact.account, contact.network_id)
- if contact.is_member(pymsn.Membership.FORWARD):
+ if contact.is_member(papyon.Membership.FORWARD):
self.MembersChanged('', [handle], (), (), (), 0,
telepathy.CHANNEL_GROUP_CHANGE_REASON_INVITED)
if len(handle.pending_groups) > 0:
@@ -177,11 +177,11 @@ class ButterflySubscribeListChannel(ButterflyListChannel,
class ButterflyPublishListChannel(ButterflyListChannel,
- pymsn.event.ContactEventInterface):
+ papyon.event.ContactEventInterface):
def __init__(self, connection, handle):
ButterflyListChannel.__init__(self, connection, handle)
- pymsn.event.ContactEventInterface.__init__(self, connection.msn_client)
+ papyon.event.ContactEventInterface.__init__(self, connection.msn_client)
self.GroupFlagsChanged(0, 0)
def AddMembers(self, contacts, message):
@@ -198,13 +198,13 @@ class ButterflyPublishListChannel(ButterflyListChannel,
contact_handle = self._conn.handle(telepathy.HANDLE_TYPE_CONTACT,
contact_handle_id)
contact = contact_handle.contact
- if contact.is_member(pymsn.Membership.PENDING):
+ if contact.is_member(papyon.Membership.PENDING):
ab.decline_contact_invitation(contact)
def GetLocalPendingMembersWithInfo(self):
result = []
for contact in self._conn.msn_client.address_book.contacts:
- if not contact.is_member(pymsn.Membership.PENDING):
+ if not contact.is_member(papyon.Membership.PENDING):
continue
handle = ButterflyHandleFactory(self._conn_ref(), 'contact',
contact.account, contact.network_id)
@@ -214,21 +214,21 @@ class ButterflyPublishListChannel(ButterflyListChannel,
return result
def _filter_contact(self, contact):
- return (contact.is_member(pymsn.Membership.REVERSE),
- contact.is_member(pymsn.Membership.PENDING),
+ return (contact.is_member(papyon.Membership.REVERSE),
+ contact.is_member(papyon.Membership.PENDING),
False)
- # pymsn.event.ContactEventInterface
+ # papyon.event.ContactEventInterface
def on_contact_memberships_changed(self, contact):
handle = ButterflyHandleFactory(self._conn_ref(), 'contact',
contact.account, contact.network_id)
if self._contains_handle(handle):
contact = handle.contact
- if contact.is_member(pymsn.Membership.PENDING):
+ if contact.is_member(papyon.Membership.PENDING):
# Nothing worth our attention
return
- if contact.is_member(pymsn.Membership.FORWARD):
+ if contact.is_member(papyon.Membership.FORWARD):
# Contact accepted
self.MembersChanged('', [handle], (), (), (), 0,
telepathy.CHANNEL_GROUP_CHANGE_REASON_INVITED)
diff --git a/butterfly/channel/group.py b/butterfly/channel/group.py
index 0295c24..d0ae9cb 100644
--- a/butterfly/channel/group.py
+++ b/butterfly/channel/group.py
@@ -20,8 +20,8 @@
import logging
import telepathy
-import pymsn
-import pymsn.event
+import papyon
+import papyon.event
from butterfly.util.decorator import async
from butterfly.handle import ButterflyHandleFactory
@@ -33,13 +33,13 @@ logger = logging.getLogger('Butterfly.GroupChannel')
class ButterflyGroupChannel(ButterflyListChannel,
- pymsn.event.AddressBookEventInterface):
+ papyon.event.AddressBookEventInterface):
def __init__(self, connection, handle):
self.__pending_add = []
self.__pending_remove = []
ButterflyListChannel.__init__(self, connection, handle)
- pymsn.event.AddressBookEventInterface.__init__(self, connection.msn_client)
+ papyon.event.AddressBookEventInterface.__init__(self, connection.msn_client)
self.GroupFlagsChanged(telepathy.CHANNEL_GROUP_FLAG_CAN_ADD |
telepathy.CHANNEL_GROUP_FLAG_CAN_REMOVE, 0)
# Create this group on the server if not existant
@@ -71,7 +71,7 @@ class ButterflyGroupChannel(ButterflyListChannel,
(contact_handle, self._handle))
contact = contact_handle.contact
group = self._handle.group
- if contact is not None and contact.is_member(pymsn.Membership.FORWARD):
+ if contact is not None and contact.is_member(papyon.Membership.FORWARD):
ab.add_contact_to_group(group, contact)
else:
contact_handle.pending_groups.add(group)
@@ -97,7 +97,7 @@ class ButterflyGroupChannel(ButterflyListChannel,
(contact_handle, self._handle))
contact = contact_handle.contact
group = self._handle.group
- if contact is not None and contact.is_member(pymsn.Membership.FORWARD):
+ if contact is not None and contact.is_member(papyon.Membership.FORWARD):
ab.delete_contact_from_group(group, contact)
else:
contact_handle.pending_groups.discard(group)
diff --git a/butterfly/channel/text.py b/butterfly/channel/text.py
index cbcfd74..1bd9be8 100644
--- a/butterfly/channel/text.py
+++ b/butterfly/channel/text.py
@@ -22,8 +22,8 @@ import weakref
import time
import telepathy
-import pymsn
-import pymsn.event
+import papyon
+import papyon.event
from butterfly.util.decorator import async
from butterfly.handle import ButterflyHandleFactory
@@ -37,7 +37,7 @@ class ButterflyTextChannel(
telepathy.server.ChannelTypeText,
telepathy.server.ChannelInterfaceGroup,
telepathy.server.ChannelInterfaceChatState,
- pymsn.event.ConversationEventInterface):
+ papyon.event.ConversationEventInterface):
def __init__(self, connection, conversation, chan_manager):
self._recv_id = 0
@@ -48,7 +48,7 @@ class ButterflyTextChannel(
telepathy.server.ChannelTypeText.__init__(self, connection, None)
telepathy.server.ChannelInterfaceGroup.__init__(self)
telepathy.server.ChannelInterfaceChatState.__init__(self)
- pymsn.event.ConversationEventInterface.__init__(self, self._conversation)
+ papyon.event.ConversationEventInterface.__init__(self, self._conversation)
self.GroupFlagsChanged(telepathy.CHANNEL_GROUP_FLAG_CAN_ADD, 0)
self.__add_initial_participants()
@@ -61,7 +61,7 @@ class ButterflyTextChannel(
def Send(self, message_type, text):
if message_type == telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL:
- self._conversation.send_text_message(pymsn.ConversationMessage(text))
+ self._conversation.send_text_message(papyon.ConversationMessage(text))
elif message_type == telepathy.CHANNEL_TEXT_MESSAGE_TYPE_ACTION and \
text == u"nudge":
self._conversation.send_nudge()
@@ -80,7 +80,7 @@ class ButterflyTextChannel(
def GetSelfHandle(self):
return self._conn.GetSelfHandle()
- # pymsn.event.ConversationEventInterface
+ # papyon.event.ConversationEventInterface
def on_conversation_user_joined(self, contact):
handle = ButterflyHandleFactory(self._conn_ref(), 'contact',
contact.account, contact.network_id)
@@ -88,7 +88,7 @@ class ButterflyTextChannel(
self.MembersChanged('', [handle], [], [], [],
handle, telepathy.CHANNEL_GROUP_CHANGE_REASON_INVITED)
- # pymsn.event.ConversationEventInterface
+ # papyon.event.ConversationEventInterface
def on_conversation_user_left(self, contact):
handle = ButterflyHandleFactory(self._conn_ref(), 'contact',
contact.account, contact.network_id)
@@ -99,14 +99,14 @@ class ButterflyTextChannel(
self.MembersChanged('', [], [handle], [], [],
handle, telepathy.CHANNEL_GROUP_CHANGE_REASON_NONE)
- # pymsn.event.ConversationEventInterface
+ # papyon.event.ConversationEventInterface
def on_conversation_user_typing(self, contact):
handle = ButterflyHandleFactory(self._conn_ref(), 'contact',
contact.account, contact.network_id)
logger.info("User %r is typing" % handle)
self.ChatStateChanged(handle, telepathy.CHANNEL_CHAT_STATE_COMPOSING)
- # pymsn.event.ConversationEventInterface
+ # papyon.event.ConversationEventInterface
def on_conversation_message_received(self, sender, message):
id = self._recv_id
timestamp = int(time.time())
@@ -118,7 +118,7 @@ class ButterflyTextChannel(
self.Received(id, timestamp, handle, type, 0, message)
self._recv_id += 1
- # pymsn.event.ConversationEventInterface
+ # papyon.event.ConversationEventInterface
def on_conversation_nudge_received(self, sender):
id = self._recv_id
timestamp = int(time.time())
diff --git a/butterfly/channel_manager.py b/butterfly/channel_manager.py
index 8592586..f5eb4e5 100644
--- a/butterfly/channel_manager.py
+++ b/butterfly/channel_manager.py
@@ -20,7 +20,7 @@ import logging
import weakref
import telepathy
-import pymsn
+import papyon
from butterfly.channel.contact_list import ButterflyContactListChannelFactory
from butterfly.channel.group import ButterflyGroupChannel
@@ -65,7 +65,7 @@ class ChannelManager(object):
if conversation is None:
client = self._conn_ref().msn_client
- conversation = pymsn.Conversation(client, [contact])
+ conversation = papyon.Conversation(client, [contact])
channel = ButterflyTextChannel(self._conn_ref(), conversation, self)
self._text_channels[handle] = channel
self._conn_ref().add_channel(channel, handle, suppress_handler)
diff --git a/butterfly/connection.py b/butterfly/connection.py
index ae9643a..8ff2a4e 100644
--- a/butterfly/connection.py
+++ b/butterfly/connection.py
@@ -21,8 +21,8 @@ import weakref
import logging
import telepathy
-import pymsn
-import pymsn.event
+import papyon
+import papyon.event
from butterfly.presence import ButterflyPresence
from butterfly.aliasing import ButterflyAliasing
@@ -41,8 +41,8 @@ class ButterflyConnection(telepathy.server.Connection,
ButterflyAliasing,
ButterflyAvatars,
ButterflyContacts,
- pymsn.event.ClientEventInterface,
- pymsn.event.InviteEventInterface):
+ papyon.event.ClientEventInterface,
+ papyon.event.InviteEventInterface):
_mandatory_parameters = {
'account' : 's',
@@ -82,7 +82,7 @@ class ButterflyConnection(telepathy.server.Connection,
proxies['https'] = proxy
self._manager = weakref.proxy(manager)
- self._msn_client = pymsn.Client(server, proxies)
+ self._msn_client = papyon.Client(server, proxies)
self._account = (parameters['account'].encode('utf-8'),
parameters['password'].encode('utf-8'))
self._channel_manager = ChannelManager(self)
@@ -93,13 +93,13 @@ class ButterflyConnection(telepathy.server.Connection,
ButterflyAliasing.__init__(self)
ButterflyAvatars.__init__(self)
ButterflyContacts.__init__(self)
- pymsn.event.ClientEventInterface.__init__(self, self._msn_client)
- pymsn.event.InviteEventInterface.__init__(self, self._msn_client)
+ papyon.event.ClientEventInterface.__init__(self, self._msn_client)
+ papyon.event.InviteEventInterface.__init__(self, self._msn_client)
self.set_self_handle(ButterflyHandleFactory(self, 'self'))
self.__disconnect_reason = telepathy.CONNECTION_STATUS_REASON_NONE_SPECIFIED
- self._initial_presence = pymsn.Presence.INVISIBLE
+ self._initial_presence = papyon.Presence.INVISIBLE
self._initial_personal_message = None
logger.info("Connection to the account %s created" % account)
@@ -143,7 +143,7 @@ class ButterflyConnection(telepathy.server.Connection,
if len(name) > 1:
network_id = int(name[1])
else:
- network_id = pymsn.NetworkID.MSN
+ network_id = papyon.NetworkID.MSN
contacts = self.msn_client.address_book.contacts.\
search_by_account(contact_name).\
search_by_network_id(network_id)
@@ -178,7 +178,7 @@ class ButterflyConnection(telepathy.server.Connection,
if handle_type != telepathy.HANDLE_TYPE_CONTACT:
raise telepathy.NotImplemented("Only Contacts are allowed")
contact = handle.contact
- if contact.presence == pymsn.Presence.OFFLINE:
+ if contact.presence == papyon.Presence.OFFLINE:
raise telepathy.NotAvailable('Contact not available')
channel = channel_manager.channel_for_text(handle, None, suppress_handler)
else:
@@ -186,12 +186,12 @@ class ButterflyConnection(telepathy.server.Connection,
return channel._object_path
- # pymsn.event.ClientEventInterface
+ # papyon.event.ClientEventInterface
def on_client_state_changed(self, state):
- if state == pymsn.event.ClientState.CONNECTING:
+ if state == papyon.event.ClientState.CONNECTING:
self.StatusChanged(telepathy.CONNECTION_STATUS_CONNECTING,
telepathy.CONNECTION_STATUS_REASON_REQUESTED)
- elif state == pymsn.event.ClientState.SYNCHRONIZED:
+ elif state == papyon.event.ClientState.SYNCHRONIZED:
handle = ButterflyHandleFactory(self, 'list', 'subscribe')
self._channel_manager.channel_for_list(handle)
handle = ButterflyHandleFactory(self, 'list', 'publish')
@@ -206,7 +206,7 @@ class ButterflyConnection(telepathy.server.Connection,
for group in self.msn_client.address_book.groups:
handle = ButterflyHandleFactory(self, 'group', group.name)
self._channel_manager.channel_for_list(handle)
- elif state == pymsn.event.ClientState.OPEN:
+ elif state == papyon.event.ClientState.OPEN:
self.StatusChanged(telepathy.CONNECTION_STATUS_CONNECTED,
telepathy.CONNECTION_STATUS_REASON_REQUESTED)
presence = self._initial_presence
@@ -220,23 +220,23 @@ class ButterflyConnection(telepathy.server.Connection,
self._presence_changed(ButterflyHandleFactory(self, 'self'),
self._client.profile.presence,
self._client.profile.personal_message)
- elif state == pymsn.event.ClientState.CLOSED:
+ elif state == papyon.event.ClientState.CLOSED:
self.StatusChanged(telepathy.CONNECTION_STATUS_DISCONNECTED,
self.__disconnect_reason)
#FIXME
self._channel_manager.close()
self._advertise_disconnected()
- # pymsn.event.ClientEventInterface
+ # papyon.event.ClientEventInterface
def on_client_error(self, type, error):
- if type == pymsn.event.ClientErrorType.NETWORK:
+ if type == papyon.event.ClientErrorType.NETWORK:
self.__disconnect_reason = telepathy.CONNECTION_STATUS_REASON_NETWORK_ERROR
- elif type == pymsn.event.ClientErrorType.AUTHENTICATION:
+ elif type == papyon.event.ClientErrorType.AUTHENTICATION:
self.__disconnect_reason = telepathy.CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED
else:
self.__disconnect_reason = telepathy.CONNECTION_STATUS_REASON_NONE_SPECIFIED
- # pymsn.event.InviteEventInterface
+ # papyon.event.InviteEventInterface
def on_invite_conversation(self, conversation):
logger.debug("Conversation invite")
#FIXME: get rid of this crap and implement group support
@@ -258,7 +258,7 @@ def build_proxy_infos(self, parameters, proxy_type='http'):
username_key = proxy_type + '-proxy-username'
password_key = proxy_type + '-proxy-password'
if server_key in parameters and port_key in parameters:
- return pymsn.ProxyInfos(host = parameters[server_key],
+ return papyon.ProxyInfos(host = parameters[server_key],
port = parameters[port_key],
type = proxy_type,
user = parameters.get(username_key, None),
diff --git a/butterfly/contacts.py b/butterfly/contacts.py
index e7485fb..26700ba 100644
--- a/butterfly/contacts.py
+++ b/butterfly/contacts.py
@@ -22,7 +22,7 @@ import time
import telepathy
import telepathy.errors
-import pymsn
+import papyon
import dbus
__all__ = ['ButterflyContacts']
@@ -31,8 +31,8 @@ logger = logging.getLogger('Butterfly.Contacts')
class ButterflyContacts(
telepathy.server.ConnectionInterfaceContacts,
- pymsn.event.ContactEventInterface,
- pymsn.event.ProfileEventInterface):
+ papyon.event.ContactEventInterface,
+ papyon.event.ProfileEventInterface):
attributes = {
telepathy.CONNECTION : 'contact-id',
@@ -43,8 +43,8 @@ class ButterflyContacts(
def __init__(self):
telepathy.server.ConnectionInterfaceContacts.__init__(self)
- pymsn.event.ContactEventInterface.__init__(self, self.msn_client)
- pymsn.event.ProfileEventInterface.__init__(self, self.msn_client)
+ papyon.event.ContactEventInterface.__init__(self, self.msn_client)
+ papyon.event.ProfileEventInterface.__init__(self, self.msn_client)
dbus_interface = telepathy.CONNECTION_INTERFACE_CONTACTS
diff --git a/butterfly/handle.py b/butterfly/handle.py
index 9ea3a20..360769c 100644
--- a/butterfly/handle.py
+++ b/butterfly/handle.py
@@ -20,7 +20,7 @@ import logging
import weakref
import telepathy
-import pymsn
+import papyon
__all__ = ['ButterflyHandleFactory']
@@ -81,7 +81,7 @@ class ButterflySelfHandle(ButterflyHandle):
def __init__(self, connection, id):
handle_type = telepathy.HANDLE_TYPE_CONTACT
- handle_name = connection._account[0] + "#" + str(pymsn.NetworkID.MSN)
+ handle_name = connection._account[0] + "#" + str(papyon.NetworkID.MSN)
self._connection = connection
ButterflyHandle.__init__(self, connection, id, handle_type, handle_name)
diff --git a/butterfly/presence.py b/butterfly/presence.py
index 25746ba..1a5c934 100644
--- a/butterfly/presence.py
+++ b/butterfly/presence.py
@@ -25,7 +25,7 @@ import time
import telepathy
import telepathy.constants
import telepathy.errors
-import pymsn
+import papyon
from butterfly.handle import ButterflyHandleFactory
from butterfly.util.decorator import async
@@ -46,28 +46,28 @@ class ButterflyPresenceMapping(object):
INVISIBLE = 'hidden'
OFFLINE = 'offline'
- to_pymsn = {
- ONLINE: pymsn.Presence.ONLINE,
- AWAY: pymsn.Presence.AWAY,
- BUSY: pymsn.Presence.BUSY,
- IDLE: pymsn.Presence.IDLE,
- BRB: pymsn.Presence.BE_RIGHT_BACK,
- PHONE: pymsn.Presence.ON_THE_PHONE,
- LUNCH: pymsn.Presence.OUT_TO_LUNCH,
- INVISIBLE: pymsn.Presence.INVISIBLE,
- OFFLINE: pymsn.Presence.OFFLINE
+ to_papyon = {
+ ONLINE: papyon.Presence.ONLINE,
+ AWAY: papyon.Presence.AWAY,
+ BUSY: papyon.Presence.BUSY,
+ IDLE: papyon.Presence.IDLE,
+ BRB: papyon.Presence.BE_RIGHT_BACK,
+ PHONE: papyon.Presence.ON_THE_PHONE,
+ LUNCH: papyon.Presence.OUT_TO_LUNCH,
+ INVISIBLE: papyon.Presence.INVISIBLE,
+ OFFLINE: papyon.Presence.OFFLINE
}
to_telepathy = {
- pymsn.Presence.ONLINE: ONLINE,
- pymsn.Presence.AWAY: AWAY,
- pymsn.Presence.BUSY: BUSY,
- pymsn.Presence.IDLE: IDLE,
- pymsn.Presence.BE_RIGHT_BACK: BRB,
- pymsn.Presence.ON_THE_PHONE: PHONE,
- pymsn.Presence.OUT_TO_LUNCH: LUNCH,
- pymsn.Presence.INVISIBLE: INVISIBLE,
- pymsn.Presence.OFFLINE: OFFLINE
+ papyon.Presence.ONLINE: ONLINE,
+ papyon.Presence.AWAY: AWAY,
+ papyon.Presence.BUSY: BUSY,
+ papyon.Presence.IDLE: IDLE,
+ papyon.Presence.BE_RIGHT_BACK: BRB,
+ papyon.Presence.ON_THE_PHONE: PHONE,
+ papyon.Presence.OUT_TO_LUNCH: LUNCH,
+ papyon.Presence.INVISIBLE: INVISIBLE,
+ papyon.Presence.OFFLINE: OFFLINE
}
to_presence_type = {
@@ -84,14 +84,14 @@ class ButterflyPresenceMapping(object):
class ButterflyPresence(telepathy.server.ConnectionInterfacePresence,
telepathy.server.ConnectionInterfaceSimplePresence,
- pymsn.event.ContactEventInterface,
- pymsn.event.ProfileEventInterface):
+ papyon.event.ContactEventInterface,
+ papyon.event.ProfileEventInterface):
def __init__(self):
telepathy.server.ConnectionInterfacePresence.__init__(self)
telepathy.server.ConnectionInterfaceSimplePresence.__init__(self)
- pymsn.event.ContactEventInterface.__init__(self, self.msn_client)
- pymsn.event.ProfileEventInterface.__init__(self, self.msn_client)
+ papyon.event.ContactEventInterface.__init__(self, self.msn_client)
+ papyon.event.ProfileEventInterface.__init__(self, self.msn_client)
dbus_interface = 'org.freedesktop.Telepathy.Connection.Interface.SimplePresence'
@@ -146,7 +146,7 @@ class ButterflyPresence(telepathy.server.ConnectionInterfacePresence,
if status == ButterflyPresenceMapping.OFFLINE:
self.Disconnect()
- presence = ButterflyPresenceMapping.to_pymsn[status]
+ presence = ButterflyPresenceMapping.to_papyon[status]
message = arguments.get('message', u'').encode("utf-8")
logger.info("Setting Presence to '%s'" % presence)
@@ -193,7 +193,7 @@ class ButterflyPresence(telepathy.server.ConnectionInterfacePresence,
self.Disconnect()
try:
- presence = ButterflyPresenceMapping.to_pymsn[status]
+ presence = ButterflyPresenceMapping.to_papyon[status]
except KeyError:
raise telepathy.errors.InvalidArgument
message = message.encode("utf-8")
@@ -262,23 +262,23 @@ class ButterflyPresence(telepathy.server.ConnectionInterfacePresence,
True, False)
}
- # pymsn.event.ContactEventInterface
+ # papyon.event.ContactEventInterface
def on_contact_presence_changed(self, contact):
handle = ButterflyHandleFactory(self, 'contact',
contact.account, contact.network_id)
logger.info("Contact %r presence changed to '%s'" % (handle, contact.presence))
self._presence_changed(handle, contact.presence, contact.personal_message)
- # pymsn.event.ContactEventInterface
+ # papyon.event.ContactEventInterface
on_contact_personal_message_changed = on_contact_presence_changed
- # pymsn.event.ProfileEventInterface
+ # papyon.event.ProfileEventInterface
def on_profile_presence_changed(self):
profile = self.msn_client.profile
self._presence_changed(ButterflyHandleFactory(self, 'self'),
profile.presence, profile.personal_message)
- # pymsn.event.ProfileEventInterface
+ # papyon.event.ProfileEventInterface
on_profile_personal_message_changed = on_profile_presence_changed
@async
--
1.5.6.5
More information about the telepathy-commits
mailing list