Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of git@github.com:drf/amsn2
Conflicts: README
- Loading branch information
Showing
315 changed files
with
2,789 additions
and
20,749 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
*.pyc | ||
*.pyo | ||
build/ | ||
*~ | ||
.project | ||
|
@@ -8,3 +9,5 @@ build/ | |
.svn/ | ||
Debug/ | ||
ui_* | ||
.*.swp | ||
pymsn/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "papyon"] | ||
path = papyon | ||
url = git://github.com/Kjir/papyon.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
import core | ||
import backend | ||
import gui | ||
import protocol | ||
import gui.front_ends |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from backend import aMSNBackendManager | ||
__all__ = ['aMSNBackendManager', 'defaultbackend'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"""ElementTree independent from the available distribution""" | ||
try: | ||
from xml.etree.cElementTree import * | ||
except ImportError: | ||
try: | ||
from cElementTree import * | ||
except ImportError: | ||
from elementtree.ElementTree import * | ||
|
||
class aMSNBackendManager(object): | ||
def __init__(self): | ||
self.switchToBackend('nullbackend') | ||
|
||
def setBackendForFunc(self, funcname, backendname): | ||
try: | ||
m = __import__(backendname, globals(), locals(), [], -1) | ||
except ImportError: | ||
m = __import__('defaultbackend', globals(), locals(), [], -1) | ||
try: | ||
f = getattr(m, funcname) | ||
self.__setattr__(funcname, f) | ||
except AttributeError: | ||
self.__setattr__(funcname, self.__missingFunc) | ||
|
||
def switchToBackend(self, backend): | ||
self.setBackendForFunc('getPassword', backend) | ||
self.setBackendForFunc('setPassword', backend) | ||
self.setBackendForFunc('saveConfig', backend) | ||
self.setBackendForFunc('loadConfig', backend) | ||
|
||
def __missingFunc(*args): | ||
print 'Function not implemented for this backend' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
""" | ||
Base backend, should be used as a model to implement others backends | ||
As it is right now it's not used directly by aMSN2's code | ||
""" | ||
|
||
def getPassword(passwdElmt): | ||
raise NotImplementedError | ||
|
||
def setPassword(password, root_section): | ||
raise NotImplementedError | ||
|
||
def saveConfig(account, config): | ||
raise NotImplementedError | ||
|
||
def loadConfig(account): | ||
raise NotImplementedError | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
""" Backend used to save the config on the home directory of the user """ | ||
|
||
import os | ||
"""ElementTree independent from the available distribution""" | ||
try: | ||
from xml.etree.cElementTree import * | ||
except ImportError: | ||
try: | ||
from cElementTree import * | ||
except ImportError: | ||
from elementtree.ElementTree import * | ||
from amsn2.core.config import aMSNConfig | ||
|
||
def getPassword(passwdElmt): | ||
return passwdElmt.text | ||
|
||
def setPassword(password, root_section): | ||
elmt = SubElement(root_section, "password", backend='DefaultBackend') | ||
elmt.text = password | ||
return elmt | ||
|
||
|
||
def saveConfig(account, config): | ||
#TODO: improve | ||
root_section = Element("aMSNConfig") | ||
for e in config._config: | ||
val = config._config[e] | ||
elmt = SubElement(root_section, "entry", | ||
type=type(val).__name__, | ||
name=str(e)) | ||
elmt.text = str(val) | ||
|
||
accpath = os.path.join(account.account_dir, "config.xml") | ||
xml_tree = ElementTree(root_section) | ||
xml_tree.write(accpath, encoding='utf-8') | ||
|
||
def loadConfig(account): | ||
c = aMSNConfig() | ||
c.setKey("ns_server", "messenger.hotmail.com") | ||
c.setKey("ns_port", 1863) | ||
configpath = os.path.join(account.account_dir, "config.xml") | ||
try: | ||
configfile = file(configpath, "r") | ||
except IOError: | ||
return c | ||
configfile = file(configpath, "r") | ||
root_tree = ElementTree(file=configfile) | ||
configfile.close() | ||
config = root_tree.getroot() | ||
if config.tag == "aMSNConfig": | ||
lst = config.findall("entry") | ||
for elmt in lst: | ||
if elmt.attrib['type'] == 'int': | ||
c.setKey(elmt.attrib['name'], int(elmt.text)) | ||
else: | ||
c.setKey(elmt.attrib['name'], elmt.text) | ||
return c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
""" Backend that will not save anything, used for on-the-fly-sessions """ | ||
|
||
from amsn2.core.config import aMSNConfig | ||
|
||
def getPassword(passwdElmt): | ||
return passwdElmt.text | ||
|
||
def setPassword(password, root_section): | ||
elmt = SubElement(root_section, "password", backend='NullBackend') | ||
elmt.text = password | ||
return elmt | ||
|
||
def saveConfig(account, config): | ||
pass | ||
|
||
def loadConfig(account): | ||
c = aMSNConfig() | ||
c._config = {"ns_server":'messenger.hotmail.com', | ||
"ns_port":1863, | ||
} | ||
return c | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
|
||
from amsn import * | ||
from profile import * | ||
from views import * | ||
from lang import * | ||
from config import * | ||
from contactlist_manager import * | ||
from account_manager import * | ||
from personalinfo_manager import * |
Oops, something went wrong.