Skip to content

Commit

Permalink
Renamed pymsn to papyon
Browse files Browse the repository at this point in the history
  • Loading branch information
Kjir committed May 5, 2009
1 parent 4982775 commit e276b04
Show file tree
Hide file tree
Showing 20 changed files with 113 additions and 113 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
@@ -1,3 +1,3 @@
[submodule "pymsn"]
path = pymsn
url = git://github.com/Kjir/pymsn.git
[submodule "papyon"]
path = papyon
url = git://github.com/Kjir/papyon.git
2 changes: 1 addition & 1 deletion README
Expand Up @@ -5,7 +5,7 @@ python-pyopenssl
python-crypto
maybe some other stuff...

Before launching amsn2 you have to fetch the submodules (pymsn). Instructions can be found on the aMSN forum:
Before launching amsn2 you have to fetch the submodules (papyon). Instructions can be found on the aMSN forum:
http://www.amsn-project.net/forums/viewtopic.php?t=5994

If you launch ./amsn2.py and it gives an error, that error probably tells you which dependency you need...
Expand Down
2 changes: 1 addition & 1 deletion amsn2.py
Expand Up @@ -2,7 +2,7 @@
import sys
import os
import optparse
sys.path.insert(0, "./pymsn")
sys.path.insert(0, "./papyon")
import locale
locale.setlocale(locale.LC_ALL, '')

Expand Down
34 changes: 17 additions & 17 deletions amsn2/core/amsn.py
Expand Up @@ -21,7 +21,7 @@
import profile
from amsn2 import gui
from amsn2 import protocol
import pymsn
import papyon
from views import *
from contactlist_manager import *
from conversation_manager import *
Expand Down Expand Up @@ -53,15 +53,15 @@ def __init__(self, options):
self._oim_manager = aMSNOIMManager(self)
self._conversation_manager = aMSNConversationManager(self)

self.p2s = {pymsn.Presence.ONLINE:"online",
pymsn.Presence.BUSY:"busy",
pymsn.Presence.IDLE:"idle",
pymsn.Presence.AWAY:"away",
pymsn.Presence.BE_RIGHT_BACK:"brb",
pymsn.Presence.ON_THE_PHONE:"phone",
pymsn.Presence.OUT_TO_LUNCH:"lunch",
pymsn.Presence.INVISIBLE:"hidden",
pymsn.Presence.OFFLINE:"offline"}
self.p2s = {papyon.Presence.ONLINE:"online",
papyon.Presence.BUSY:"busy",
papyon.Presence.IDLE:"idle",
papyon.Presence.AWAY:"away",
papyon.Presence.BE_RIGHT_BACK:"brb",
papyon.Presence.ON_THE_PHONE:"phone",
papyon.Presence.OUT_TO_LUNCH:"lunch",
papyon.Presence.INVISIBLE:"hidden",
papyon.Presence.OFFLINE:"offline"}

if self._options.debug:
import logging
Expand Down Expand Up @@ -135,17 +135,17 @@ def connectionStateChanged(self, profile, state):

status_str = \
{
pymsn.event.ClientState.CONNECTING : 'Connecting to server...',
pymsn.event.ClientState.CONNECTED : 'Connected',
pymsn.event.ClientState.AUTHENTICATING : 'Authenticating...',
pymsn.event.ClientState.AUTHENTICATED : 'Password accepted',
pymsn.event.ClientState.SYNCHRONIZING : 'Please wait while your contact list\nis being downloaded...',
pymsn.event.ClientState.SYNCHRONIZED : 'Contact list downloaded successfully.\nHappy Chatting'
papyon.event.ClientState.CONNECTING : 'Connecting to server...',
papyon.event.ClientState.CONNECTED : 'Connected',
papyon.event.ClientState.AUTHENTICATING : 'Authenticating...',
papyon.event.ClientState.AUTHENTICATED : 'Password accepted',
papyon.event.ClientState.SYNCHRONIZING : 'Please wait while your contact list\nis being downloaded...',
papyon.event.ClientState.SYNCHRONIZED : 'Contact list downloaded successfully.\nHappy Chatting'
}

if state in status_str:
profile.login.onConnecting((state + 1)/ 7., status_str[state])
elif state == pymsn.event.ClientState.OPEN:
elif state == papyon.event.ClientState.OPEN:
clwin = self._gui.gui.aMSNContactListWindow(self, self._main)
clwin.profile = profile
profile.clwin = clwin
Expand Down
54 changes: 27 additions & 27 deletions amsn2/core/contactlist_manager.py
@@ -1,7 +1,7 @@
from views import *
import os
import tempfile
import pymsn
import papyon


class aMSNContactListManager:
Expand All @@ -18,7 +18,7 @@ def __init__(self, core):

self._contacts = {}
self._groups = {}
self._pymsn_addressbook = None
self._papyon_addressbook = None

#TODO: sorting contacts & groups

Expand All @@ -44,25 +44,25 @@ def unregister(self, event, callback):



def onContactPresenceChanged(self, pymsn_contact):
def onContactPresenceChanged(self, papyon_contact):
#1st/ update the aMSNContact object
c = self.getContact(pymsn_contact.id, pymsn_contact)
c.fill(self._core, pymsn_contact)
c = self.getContact(papyon_contact.id, papyon_contact)
c.fill(self._core, papyon_contact)
#2nd/ update the ContactView
cv = ContactView(self._core, c)
self.emit(self.CONTACTVIEW_UPDATED, cv)

#TODO: update the group view

#Request the DP...
if (pymsn_contact.presence is not pymsn.Presence.OFFLINE and
pymsn_contact.msn_object):
self._core._profile.client._msn_object_store.request(pymsn_contact.msn_object,
if (papyon_contact.presence is not papyon.Presence.OFFLINE and
papyon_contact.msn_object):
self._core._profile.client._msn_object_store.request(papyon_contact.msn_object,
(self.onDPdownloaded,
pymsn_contact.id))
papyon_contact.id))

def onCLDownloaded(self, address_book):
self._pymsn_addressbook = address_book
self._papyon_addressbook = address_book
grpviews = []
cviews = []
clv = ContactListView()
Expand All @@ -80,7 +80,7 @@ def onCLDownloaded(self, address_book):
grpviews.append(gv)
clv.group_ids.append(group.id)

contacts = address_book.contacts.search_by_memberships(pymsn.Membership.FORWARD)
contacts = address_book.contacts.search_by_memberships(papyon.Membership.FORWARD)
no_group_ids= []
for contact in contacts:
if len(contact.groups) == 0:
Expand Down Expand Up @@ -116,13 +116,13 @@ def onDPdownloaded(self, msn_object, uid):
self.emit(self.CONTACTVIEW_UPDATED, cv)


def getContact(self, cid, pymsn_contact=None):
def getContact(self, cid, papyon_contact=None):
#TODO: should raise UnknownContact or sthg like that
try:
return self._contacts[cid]
except KeyError:
if pymsn_contact is not None:
c = aMSNContact(self._core, pymsn_contact)
if papyon_contact is not None:
c = aMSNContact(self._core, papyon_contact)
self._contacts[cid] = c
self.emit(self.AMSNCONTACT_UPDATED, c)
return c
Expand All @@ -135,29 +135,29 @@ def getContact(self, cid, pymsn_contact=None):
everytime
"""
class aMSNContact():
def __init__(self, core, pymsn_contact):
self.uid = pymsn_contact.id
self.fill(core, pymsn_contact)
def __init__(self, core, papyon_contact):
self.uid = papyon_contact.id
self.fill(core, papyon_contact)

def fill(self, core, pymsn_contact):
def fill(self, core, papyon_contact):
self.icon = ImageView()
self.icon.load("Theme","buddy_" + core.p2s[pymsn_contact.presence])
self.icon.load("Theme","buddy_" + core.p2s[papyon_contact.presence])
self.dp = ImageView()
#TODO: for the moment, use default dp
self.dp.load("Theme", "dp_nopic")
self.emblem = ImageView()
self.emblem.load("Theme", "emblem_" + core.p2s[pymsn_contact.presence])
self.emblem.load("Theme", "emblem_" + core.p2s[papyon_contact.presence])
#TODO: PARSE ONLY ONCE
self.nickname = StringView()
self.nickname.appendText(pymsn_contact.display_name)
self.nickname.appendText(papyon_contact.display_name)
self.personal_message = StringView()
self.personal_message.appendText(pymsn_contact.personal_message)
self.personal_message.appendText(papyon_contact.personal_message)
self.current_media = StringView()
self.current_media.appendText(pymsn_contact.current_media)
self.current_media.appendText(papyon_contact.current_media)
self.status = StringView()
self.status.appendText(core.p2s[pymsn_contact.presence])
#for the moment, we store the pymsn_contact object, but we shouldn't have to
#TODO: getPymsnContact(self, core...) or _pymsn_contact?
self._pymsn_contact = pymsn_contact
self.status.appendText(core.p2s[papyon_contact.presence])
#for the moment, we store the papyon_contact object, but we shouldn't have to
#TODO: getPymsnContact(self, core...) or _papyon_contact?
self._papyon_contact = papyon_contact


12 changes: 6 additions & 6 deletions amsn2/core/conversation.py
Expand Up @@ -21,7 +21,7 @@
from amsn2.protocol import conversation
from amsn2.core.contactlist_manager import *
from amsn2.core.views import *
import pymsn
import papyon

class aMSNConversation:
def __init__(self, core, conv_manager, conv = None, contacts_uid = None):
Expand All @@ -33,10 +33,10 @@ def __init__(self, core, conv_manager, conv = None, contacts_uid = None):
self._contacts_uid = contacts_uid
if conv is None:
#New conversation
pymsn_contacts = [core._contactlist_manager.getContact(uid) for uid in contacts_uid]
pymsn_contacts = [c._pymsn_contact for c in pymsn_contacts if c is not None]
papyon_contacts = [core._contactlist_manager.getContact(uid) for uid in contacts_uid]
papyon_contacts = [c._papyon_contact for c in papyon_contacts if c is not None]
#if c was None.... wtf?
self._conv = pymsn.Conversation(self._core._profile.client, pymsn_contacts)
self._conv = papyon.Conversation(self._core._profile.client, papyon_contacts)
else:
#From an existing conversation
self._conv = conv
Expand Down Expand Up @@ -90,7 +90,7 @@ def sendMessage(self, msg, formatting=None):
# for the moment, no formatting, no smiley substitution... (TODO)
# peacey: Added formatting of styles
self.onMessageReceived(msg, formatting=formatting)
message = pymsn.ConversationMessage(msg.toString(), formatting)
message = papyon.ConversationMessage(msg.toString(), formatting)
self._conv.send_text_message(message)

def sendNudge(self):
Expand All @@ -105,6 +105,6 @@ def leave(self):
def inviteContact(self, contact_uid):
""" contact_uid is the Id of the contact to invite """
c = self._core._contactlist_manager.getContact(contact_uid)
self._conv.invite_user(contact.pymsn_contact)
self._conv.invite_user(contact.papyon_contact)

#TODO: ...
22 changes: 11 additions & 11 deletions amsn2/gui/front_ends/console/contact_list.py
@@ -1,23 +1,23 @@
from amsn2.gui import base
import pymsn
import papyon

class Contact(object):
def __init__(self, name, presence):
self.name = name
self.presence = presence
self.p2s = {pymsn.Presence.ONLINE:"online",
pymsn.Presence.BUSY:"busy",
pymsn.Presence.IDLE:"idle",
pymsn.Presence.AWAY:"away",
pymsn.Presence.BE_RIGHT_BACK:"brb",
pymsn.Presence.ON_THE_PHONE:"phone",
pymsn.Presence.OUT_TO_LUNCH:"lunch",
pymsn.Presence.INVISIBLE:"hidden",
pymsn.Presence.OFFLINE:"offline"}
self.p2s = {papyon.Presence.ONLINE:"online",
papyon.Presence.BUSY:"busy",
papyon.Presence.IDLE:"idle",
papyon.Presence.AWAY:"away",
papyon.Presence.BE_RIGHT_BACK:"brb",
papyon.Presence.ON_THE_PHONE:"phone",
papyon.Presence.OUT_TO_LUNCH:"lunch",
papyon.Presence.INVISIBLE:"hidden",
papyon.Presence.OFFLINE:"offline"}


def is_online(self):
return self.presence != pymsn.Presence.OFFLINE
return self.presence != papyon.Presence.OFFLINE

def status(self):
return self.p2s[self.presence]
Expand Down
2 changes: 1 addition & 1 deletion amsn2/gui/front_ends/efl/contact_list.py
Expand Up @@ -10,7 +10,7 @@

from amsn2.core.views import StringView
from amsn2.gui import base
import pymsn
import papyon

class aMSNContactListWindow(base.aMSNContactListWindow):
def __init__(self, amsn_core, parent):
Expand Down
22 changes: 11 additions & 11 deletions amsn2/gui/front_ends/gtk/chat_window.py
Expand Up @@ -30,7 +30,7 @@
from amsn2.gui import base
from amsn2.core.views import StringView
import gtk_extras
import pymsn
import papyon

class aMSNChatWindow(base.aMSNChatWindow, gtk.Window):
def __init__(self, amsn_core):
Expand Down Expand Up @@ -247,14 +247,14 @@ def __on_chat_send(self, entry, event_keyval, event_keymod):

color = self.button_color.get_color()
hex8 = "%.2x%.2x%.2x" % ((color.red/0x101), (color.green/0x101), (color.blue/0x101))
style = pymsn.TextFormat.NO_EFFECT
if self.button_bold.get_active(): style |= pymsn.TextFormat.BOLD
if self.button_italic.get_active(): style |= pymsn.TextFormat.ITALIC
if self.button_underline.get_active(): style |= pymsn.TextFormat.UNDERLINE
if self.button_strikethrough.get_active(): style |= pymsn.TextFormat.STRIKETHROUGH
style = papyon.TextFormat.NO_EFFECT
if self.button_bold.get_active(): style |= papyon.TextFormat.BOLD
if self.button_italic.get_active(): style |= papyon.TextFormat.ITALIC
if self.button_underline.get_active(): style |= papyon.TextFormat.UNDERLINE
if self.button_strikethrough.get_active(): style |= papyon.TextFormat.STRIKETHROUGH
font_name = self.button_font.get_font_name()
font_family = pango.FontDescription(font_name).get_family()
format = pymsn.TextFormat(font=font_family, color=hex8, style=style)
format = papyon.TextFormat(font=font_family, color=hex8, style=style)
strv = StringView()
strv.appendText(msg)
self._amsn_conversation.sendMessage(strv, format)
Expand Down Expand Up @@ -308,13 +308,13 @@ def onMessageReceived(self, messageview, formatting=None):
fmsg += "font-family: %s;" % formatting.font
if formatting.color:
fmsg += "color: %s;" % ("#"+formatting.color)
if formatting.style & pymsn.TextFormat.BOLD == pymsn.TextFormat.BOLD:
if formatting.style & papyon.TextFormat.BOLD == papyon.TextFormat.BOLD:
fmsg += "font-weight: bold;"
if formatting.style & pymsn.TextFormat.ITALIC == pymsn.TextFormat.ITALIC:
if formatting.style & papyon.TextFormat.ITALIC == papyon.TextFormat.ITALIC:
fmsg += "font-style: italic;"
if formatting.style & pymsn.TextFormat.UNDERLINE == pymsn.TextFormat.UNDERLINE:
if formatting.style & papyon.TextFormat.UNDERLINE == papyon.TextFormat.UNDERLINE:
fmsg += "text-decoration: underline;"
if formatting.style & pymsn.TextFormat.STRIKETHROUGH == pymsn.TextFormat.STRIKETHROUGH:
if formatting.style & papyon.TextFormat.STRIKETHROUGH == papyon.TextFormat.STRIKETHROUGH:
fmsg += "text-decoration: line-through;"
if formatting.right_alignment:
fmsg += "text-align: right;"
Expand Down
2 changes: 1 addition & 1 deletion amsn2/gui/front_ends/gtk/contact_list.py
Expand Up @@ -27,7 +27,7 @@
import pango
import gobject

#import pymsn
#import papyon
from image import *
from amsn2.core.views import StringView
from amsn2.core.views import GroupView
Expand Down
10 changes: 5 additions & 5 deletions amsn2/protocol/addressbook.py
Expand Up @@ -18,13 +18,13 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

import pymsn
import pymsn.event
import papyon
import papyon.event

class AddressBookEvents(pymsn.event.AddressBookEventInterface):
class AddressBookEvents(papyon.event.AddressBookEventInterface):
def __init__(self, client, amsn_core):
self._amsn_core = amsn_core
pymsn.event.AddressBookEventInterface.__init__(self, client)
papyon.event.AddressBookEventInterface.__init__(self, client)

def on_addressbook_messenger_contact_added(self, contact):
pass
Expand Down Expand Up @@ -52,4 +52,4 @@ def on_addressbook_group_contact_added(self, group, contact):

def on_addressbook_group_contact_deleted(self, group, contact):
pass


12 changes: 6 additions & 6 deletions amsn2/protocol/client.py
@@ -1,19 +1,19 @@

import pymsn
import pymsn.event
import papyon
import papyon.event


class ClientEvents(pymsn.event.ClientEventInterface):
class ClientEvents(papyon.event.ClientEventInterface):
def __init__(self, client, amsn_core):
self._amsn_core = amsn_core
pymsn.event.ClientEventInterface.__init__(self, client)
papyon.event.ClientEventInterface.__init__(self, client)

def on_client_state_changed(self, state):
self._amsn_core.connectionStateChanged(self._client._amsn_profile, state)

if state == pymsn.event.ClientState.OPEN:
if state == papyon.event.ClientState.OPEN:
self._client.profile.display_name = "aMSN2"
self._client.profile.presence = pymsn.Presence.ONLINE
self._client.profile.presence = papyon.Presence.ONLINE
self._client.profile.current_media = ("I listen to", "Nothing")
self._client.profile.personal_message = "Testing aMSN2!"

Expand Down

0 comments on commit e276b04

Please sign in to comment.