pymoul-svn Mailing List for pyMoul
Status: Alpha
Brought to you by:
tiran
You can subscribe to this list here.
| 2007 |
Jan
(89) |
Feb
(108) |
Mar
(62) |
Apr
(8) |
May
(9) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|
|
From: <ti...@us...> - 2007-06-09 06:50:03
|
Revision: 299
http://pymoul.svn.sourceforge.net/pymoul/?rev=299&view=rev
Author: tiran
Date: 2007-06-08 23:49:56 -0700 (Fri, 08 Jun 2007)
Log Message:
-----------
Fixed a bug in the crypt stream read() method. Don't know how the line got in there ... :(
Modified Paths:
--------------
pymoul/trunk/src/moul/crypt/stream.py
Modified: pymoul/trunk/src/moul/crypt/stream.py
===================================================================
--- pymoul/trunk/src/moul/crypt/stream.py 2007-06-01 01:49:57 UTC (rev 298)
+++ pymoul/trunk/src/moul/crypt/stream.py 2007-06-09 06:49:56 UTC (rev 299)
@@ -34,8 +34,10 @@
magic = 12 * '\x00'
blockSize = 1024
- def __init__(self, fdname, cipher):
+ def __init__(self, fdname, cipher, magic=None):
self._cipher = cipher
+ if magic:
+ self.magic = magic
if isinstance(fdname, basestring):
fd = BinaryFile(fdname)
@@ -71,6 +73,7 @@
return self._fd.close()
def read(self):
+ self.seek(0)
fd = self._fd
remain = self._size
bs = self.blockSize
@@ -85,5 +88,4 @@
data = data[:remain]
buf.append(data)
remain -= bs
- remain -= bs
return ''.join(buf)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-06-01 01:49:58
|
Revision: 298
http://pymoul.svn.sourceforge.net/pymoul/?rev=298&view=rev
Author: tiran
Date: 2007-05-31 18:49:57 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Added plugin
More work on the infrastructure
Modified Paths:
--------------
pymoul/trunk/src/moul/chatrelay/chatrelay.ini
pymoul/trunk/src/moul/chatrelay/config.py
pymoul/trunk/src/moul/chatrelay/interfaces.py
pymoul/trunk/src/moul/chatrelay/ircrelay.py
pymoul/trunk/src/moul/chatrelay/service.py
Added Paths:
-----------
pymoul/trunk/src/twisted/
pymoul/trunk/src/twisted/plugins/
pymoul/trunk/src/twisted/plugins/chatrelay.py
Removed Paths:
-------------
pymoul/trunk/src/moul/chatrelay/app.py
Deleted: pymoul/trunk/src/moul/chatrelay/app.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/app.py 2007-05-30 14:49:24 UTC (rev 297)
+++ pymoul/trunk/src/moul/chatrelay/app.py 2007-06-01 01:49:57 UTC (rev 298)
@@ -1,19 +0,0 @@
-from twisted.application import internet, service
-from twisted.internet import reactor
-
-from moul.chatrelay.service import PollingFileAppendWatchService
-from moul.chatrelay.config import config
-from moul.chatrelay.ircrelay import IRCChatRelayFactory
-
-application = service.Application("MOUL Chat Relay")
-
-appendWatchService = PollingFileAppendWatchService(config.watch_interval)
-appendWatchService.setName("AppendWatch")
-appendWatchService.setServiceParent(application)
-
-ircFactory = IRCChatRelayFactory()
-ircFactory.config = config
-ircRelayService = internet.TCPClient(config.network, config.port,
- ircFactory)
-ircRelayService.setName("IRC Relay")
-ircRelayService.setServiceParent(application)
Modified: pymoul/trunk/src/moul/chatrelay/chatrelay.ini
===================================================================
--- pymoul/trunk/src/moul/chatrelay/chatrelay.ini 2007-05-30 14:49:24 UTC (rev 297)
+++ pymoul/trunk/src/moul/chatrelay/chatrelay.ini 2007-06-01 01:49:57 UTC (rev 298)
@@ -1,6 +1,6 @@
[ircrelay]
nickname=Tiran
-channel=#urubot
+channel=#urutestbot
network=tsunami.justirc.net
port=6667
adminpasswd=moul
Modified: pymoul/trunk/src/moul/chatrelay/config.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/config.py 2007-05-30 14:49:24 UTC (rev 297)
+++ pymoul/trunk/src/moul/chatrelay/config.py 2007-06-01 01:49:57 UTC (rev 298)
@@ -1,7 +1,10 @@
import os
from ConfigParser import SafeConfigParser
from ConfigParser import NoOptionError
+from zope.interface import implements
+from moul.chatrelay.interfaces import IConfiguration
+
_marker = object()
required = object()
@@ -25,6 +28,7 @@
class Configuration(object):
"""Config object
"""
+ implements(IConfiguration)
options = ['nickname', 'channel', 'network', 'port', 'adminpasswd',
'serverpasswd', 'nickpasswd', 'defaultprofile']
@@ -66,5 +70,3 @@
self.port = int(self.port)
self.nickname = self.nickname + self.nicksuffix
-
-config = FileConfiguration(defaultcfg)
Modified: pymoul/trunk/src/moul/chatrelay/interfaces.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/interfaces.py 2007-05-30 14:49:24 UTC (rev 297)
+++ pymoul/trunk/src/moul/chatrelay/interfaces.py 2007-06-01 01:49:57 UTC (rev 298)
@@ -170,3 +170,7 @@
def listFilters():
"""Return a list of filters
"""
+
+class IConfiguration(Interface):
+ """Configuration object
+ """
Modified: pymoul/trunk/src/moul/chatrelay/ircrelay.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/ircrelay.py 2007-05-30 14:49:24 UTC (rev 297)
+++ pymoul/trunk/src/moul/chatrelay/ircrelay.py 2007-06-01 01:49:57 UTC (rev 298)
@@ -30,10 +30,13 @@
from twisted.internet import reactor, protocol
from twisted.internet.task import LoopingCall
from twisted.python import log, failure
+from twisted.application import internet
from moul.chatrelay.io import MessageWriter
from moul.chatrelay.io import LogFileReader
from moul.chatrelay.io import MOULLogFormatter
+from moul.chatrelay.interfaces import IConfiguration
+from moul.chatrelay.service import getAppendWatchService
from moul.osdependent import getMoulUserDataDir
datadir = getMoulUserDataDir()
@@ -64,6 +67,9 @@
class IRCChatRelay(irc.IRCClient):
"""A chat relay bot"""
+ def __init__(self, *args, **kwargs):
+ #irc.IRCClient.__init__()
+ self.chan2user = {}
@property
def config(self):
@@ -91,20 +97,77 @@
# callbacks for events
def signedOn(self):
+ log.msg("I signed on")
if self.config.nickpasswd:
self.msg("Nickserv", "IDENTIFY %s" % self.config.nickpasswd)
- self.join(self.config.channel)
+ # XXX
+ if 1:
+ self.join(self.config.channel)
def joined(self, channel):
log.msg("I have joined", channel)
+ self.chan2user[channel] = []
def left(self, channel):
log.msg("I have left", channel)
+ del self.chan2user[channel]
def kickedFrom(self, channel, kicker, message):
log.msg("I have been kicked from %s by %s: %s" %
(channel, kicker, message))
+ del self.chan2user[channel]
+ def topicUpdated(self, user, channel, newTopic):
+ """In channel, user changed the topic to newTopic.
+ """
+ log.msg("The topic in %s is ''" % (channel, newTopic))
+
+ def userJoined(self, user, channel):
+ log.msg("User %s has joined channel %s" % (user, channel))
+ users = self.chan2user.setdefault(channel, [])
+ if not user in users:
+ users.append(user)
+
+ def userLeft(self, user, channel):
+ """Called when I see another user leaving a channel.
+ """
+ log.msg("User %s has left channel %s" % (user, channel))
+ users = self.chan2user.get(channel, [])
+ try:
+ users.remove(user)
+ except ValueError:
+ pass
+
+ def userQuit(self, user, quitMessage):
+ """Called when I see another user disconnect from the network.
+ """
+ log.msg("User %s has quit" % user)
+ for users in self.chan2user.values():
+ try:
+ users.remove(user)
+ except ValueError:
+ pass
+
+ def userKicked(self, kickee, channel, kicker, message):
+ """Called when I observe someone else being kicked from a channel.
+ """
+ log.msg("User %s was kicked from channel %s" % (kickee, channel))
+ users = self.chan2user.get(channel, [])
+ try:
+ users.remove(kickee)
+ except ValueError:
+ pass
+
+ def userRenamed(self, oldname, newname):
+ log.msg("User %s is now known as %s" % (oldname, newname))
+ for users in self.chan2user.values():
+ if oldname in users:
+ users.remove(oldname)
+ users.append(newname)
+
+ def irc_unknown(self, prefix, command, params):
+ print prefix, command, params
+
class IRCChatRelayFactory(protocol.ReconnectingClientFactory):
protocol = IRCChatRelay
config = None
@@ -114,3 +177,21 @@
p = self.protocol()
p.factory = self
return p
+
+_services = {}
+def getIRCRelayService(name="IRC Relay", config=None):
+ """
+ """
+ global _services
+ service = _services.get(name, None)
+ if service is not None:
+ return service
+ config = IConfiguration(config)
+ factory = IRCChatRelayFactory()
+ factory.config = config
+ service = internet.TCPClient(config.network, config.port, factory)
+ service.setName(name)
+ _services[name] = service
+ return service
+
+
Modified: pymoul/trunk/src/moul/chatrelay/service.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/service.py 2007-05-30 14:49:24 UTC (rev 297)
+++ pymoul/trunk/src/moul/chatrelay/service.py 2007-06-01 01:49:57 UTC (rev 298)
@@ -110,3 +110,19 @@
data = fp.read()
if data:
funcs[0](path, data)
+
+_services = {}
+def getAppendWatchService(name="AppendWatch", interval=None):
+ """Service factory, holds a global service per name
+ """
+ global _services
+ service = _services.get(name, None)
+ if service is not None:
+ return service
+ if interval is None:
+ raise KeyError(name)
+ service = PollingFileAppendWatchService(interval)
+ service.setName(name)
+ _services[name] = service
+ return service
+
Property changes on: pymoul/trunk/src/twisted/plugins
___________________________________________________________________
Name: svn:ignore
+ dropin.cache
dropin.cache.new
Added: pymoul/trunk/src/twisted/plugins/chatrelay.py
===================================================================
--- pymoul/trunk/src/twisted/plugins/chatrelay.py (rev 0)
+++ pymoul/trunk/src/twisted/plugins/chatrelay.py 2007-06-01 01:49:57 UTC (rev 298)
@@ -0,0 +1,33 @@
+from zope.interface import implements
+
+from twisted.python import usage
+from twisted.plugin import IPlugin
+from twisted.application.service import IServiceMaker
+from twisted.application import service
+
+from moul.chatrelay.config import FileConfiguration
+from moul.chatrelay.config import defaultcfg
+
+from moul.chatrelay.service import getAppendWatchService
+from moul.chatrelay.ircrelay import getIRCRelayService
+
+class Options(usage.Options):
+ optParameters = [["configfile", "c", defaultcfg, "Path to the config.ini"]]
+
+class ChatRelayMaker(object):
+ implements(IServiceMaker, IPlugin)
+ tapname = "chatrelay"
+ description = "MOUL IRC Chat relay."
+ options = Options
+
+ def makeService(self, options):
+ root = service.MultiService()
+ root.setName(self.tapname)
+ config = FileConfiguration(options['configfile'])
+ watchService = getAppendWatchService(interval=config.watch_interval)
+ watchService.setServiceParent(root)
+ ircService = getIRCRelayService(config=config)
+ ircService.setServiceParent(root)
+ return root
+
+serviceMaker = ChatRelayMaker()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-05-30 14:49:34
|
Revision: 297
http://pymoul.svn.sourceforge.net/pymoul/?rev=297&view=rev
Author: tiran
Date: 2007-05-30 07:49:24 -0700 (Wed, 30 May 2007)
Log Message:
-----------
Created configuration, main application and new bot
Modified Paths:
--------------
pymoul/trunk/src/moul/chatrelay/filter.py
pymoul/trunk/src/moul/chatrelay/interfaces.py
Added Paths:
-----------
pymoul/trunk/src/moul/chatrelay/app.py
pymoul/trunk/src/moul/chatrelay/chatrelay.ini
pymoul/trunk/src/moul/chatrelay/config.py
pymoul/trunk/src/moul/chatrelay/ircrelay.py
pymoul/trunk/src/moul/chatrelay/service.py
Added: pymoul/trunk/src/moul/chatrelay/app.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/app.py (rev 0)
+++ pymoul/trunk/src/moul/chatrelay/app.py 2007-05-30 14:49:24 UTC (rev 297)
@@ -0,0 +1,19 @@
+from twisted.application import internet, service
+from twisted.internet import reactor
+
+from moul.chatrelay.service import PollingFileAppendWatchService
+from moul.chatrelay.config import config
+from moul.chatrelay.ircrelay import IRCChatRelayFactory
+
+application = service.Application("MOUL Chat Relay")
+
+appendWatchService = PollingFileAppendWatchService(config.watch_interval)
+appendWatchService.setName("AppendWatch")
+appendWatchService.setServiceParent(application)
+
+ircFactory = IRCChatRelayFactory()
+ircFactory.config = config
+ircRelayService = internet.TCPClient(config.network, config.port,
+ ircFactory)
+ircRelayService.setName("IRC Relay")
+ircRelayService.setServiceParent(application)
Added: pymoul/trunk/src/moul/chatrelay/chatrelay.ini
===================================================================
--- pymoul/trunk/src/moul/chatrelay/chatrelay.ini (rev 0)
+++ pymoul/trunk/src/moul/chatrelay/chatrelay.ini 2007-05-30 14:49:24 UTC (rev 297)
@@ -0,0 +1,9 @@
+[ircrelay]
+nickname=Tiran
+channel=#urubot
+network=tsunami.justirc.net
+port=6667
+adminpasswd=moul
+#serverpassd=
+#nickpasswd=
+#defaultprofil=
\ No newline at end of file
Added: pymoul/trunk/src/moul/chatrelay/config.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/config.py (rev 0)
+++ pymoul/trunk/src/moul/chatrelay/config.py 2007-05-30 14:49:24 UTC (rev 297)
@@ -0,0 +1,70 @@
+import os
+from ConfigParser import SafeConfigParser
+from ConfigParser import NoOptionError
+
+_marker = object()
+required = object()
+
+dirname = os.path.dirname(__file__)
+defaultcfg = os.path.join(dirname, 'chatrelay.ini')
+
+class RequiredError(ValueError):
+ pass
+
+class DefaultConfigParser(SafeConfigParser):
+
+ def get(self, sec, name, default=_marker):
+ try:
+ return SafeConfigParser.get(self, sec, name)
+ except NoOptionError:
+ if default is not _marker:
+ return default
+ else:
+ raise
+
+class Configuration(object):
+ """Config object
+ """
+ options = ['nickname', 'channel', 'network', 'port', 'adminpasswd',
+ 'serverpasswd', 'nickpasswd', 'defaultprofile']
+
+ nickname = required
+ channel = required
+ network = required
+ port = 6667
+ adminpasswd = required
+ serverpasswd = None
+ nickpasswd = None
+ defaultprofile = None
+ # internal, DO NOT MESS AROUND
+ realname = "Tiran's MOUL relay bot"
+ username = "TiransRelay"
+ nicksuffix = "[Relay]"
+ watch_interval = 5 # seconds
+
+ def __init__(self):
+ self.profiles = []
+
+class FileConfiguration(Configuration):
+ """Load configuration from a file
+ """
+
+ def __init__(self, cfgfile):
+ super(FileConfiguration, self).__init__()
+ cfg = DefaultConfigParser()
+ cfg.readfp(open(cfgfile))
+ self._loadcfg(cfg)
+
+ def _loadcfg(self, cfg):
+ sec = 'ircrelay'
+ for name in self.options:
+ default = getattr(self, name)
+ value = cfg.get(sec, name, default=default)
+ if value is required:
+ raise RequiredError(name)
+ setattr(self, name, value)
+
+ self.port = int(self.port)
+ self.nickname = self.nickname + self.nicksuffix
+
+config = FileConfiguration(defaultcfg)
Modified: pymoul/trunk/src/moul/chatrelay/filter.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/filter.py 2007-05-29 13:44:29 UTC (rev 296)
+++ pymoul/trunk/src/moul/chatrelay/filter.py 2007-05-30 14:49:24 UTC (rev 297)
@@ -3,6 +3,7 @@
from moul.chatrelay.interfaces import ILineFilter
from moul.chatrelay.interfaces import ISnoopyLineFilter
from moul.chatrelay.interfaces import IConfigureableFilter
+from moul.chatrelay.interfaces import IFilterProfile
from moul.file.chatlog import (CHAT_UNKNOWN, CHAT_PRIVMSG, CHAT_PRIVMSGTO,
CHAT_PRIVMSGFROM, CHAT_ACTION, CHAT_ERROR,
CHAT_MSG)
@@ -17,6 +18,23 @@
def filter(self, line, **kwargs):
return line, kwargs
+class FilterProfile(object):
+ # TODO: support ISnoopy and IConfigurable
+ name = None
+
+ def __init__(self, name):
+ self.name = name
+ self.filters = []
+
+ def registerFilters(self, *filters):
+ for filter in self.filters:
+ self.filters.append(filter)
+
+ def filter(self, line, **kwargs):
+ for filter in self.filters:
+ line, kwargs = filter.filter(line, **kwargs)
+ return line, kwargs
+
class HightlightImportantFilter(object):
"""Highlight important people
"""
Modified: pymoul/trunk/src/moul/chatrelay/interfaces.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/interfaces.py 2007-05-29 13:44:29 UTC (rev 296)
+++ pymoul/trunk/src/moul/chatrelay/interfaces.py 2007-05-30 14:49:24 UTC (rev 297)
@@ -112,6 +112,15 @@
"""List commands XXX: finish me
"""
+class IFilterProfile(ILineFilter):
+ """A filter profile
+ """
+ name = Attribute("Filter profile name")
+
+ def registerFilters(*filters):
+ """Register one or more filters
+ """
+
class IOutputFormatter(Interface):
"""A line formatter
"""
Added: pymoul/trunk/src/moul/chatrelay/ircrelay.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/ircrelay.py (rev 0)
+++ pymoul/trunk/src/moul/chatrelay/ircrelay.py 2007-05-30 14:49:24 UTC (rev 297)
@@ -0,0 +1,116 @@
+# pyMoul - Python interface to Myst Online URU Live
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""Chat relay using Twisted IRC
+
+Partly based on Buildbot's IRC support
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id: ircclient.py 295 2007-05-28 16:53:00Z tiran $"
+__revision__ = "$Revision: 295 $"
+
+import sys
+import os
+
+from twisted.words.protocols import irc
+from twisted.internet import reactor, protocol
+from twisted.internet.task import LoopingCall
+from twisted.python import log, failure
+
+from moul.chatrelay.io import MessageWriter
+from moul.chatrelay.io import LogFileReader
+from moul.chatrelay.io import MOULLogFormatter
+from moul.osdependent import getMoulUserDataDir
+
+datadir = getMoulUserDataDir()
+chatlog = os.path.join(datadir, 'Log', 'chat.0.log')
+
+def requirePasswd(func):
+ """@decorator"""
+ func.requirePassword = True
+ return func
+
+def doesRequirePasswd(func):
+ return getattr(func, 'requirePassword', False)
+
+def usage(usage):
+ """@decorator"""
+ def wrapper(func):
+ func.usage = usage
+ return func
+ return wrapper
+
+class UsageError(ValueError):
+ def __init__(self, string = "Invalid usage", *more):
+ ValueError.__init__(self, string, *more)
+
+class InvalidPassword(UsageError):
+ def __init__(self, string = "Invalid password", *more):
+ ValueError.__init__(self, string, *more)
+
+class IRCChatRelay(irc.IRCClient):
+ """A chat relay bot"""
+
+ @property
+ def config(self):
+ return self.factory.config
+
+ @property
+ def nickname(self):
+ return self.factory.config.nickname
+ @property
+ def password(self):
+ return self.factory.config.serverpasswd
+ @property
+ def realname(self):
+ return self.factory.config.realname
+ @property
+ def username(self):
+ return self.factory.config.username
+
+ def connectionMade(self):
+ irc.IRCClient.connectionMade(self)
+
+ def connectionLost(self, reason):
+ irc.IRCClient.connectionLost(self, reason)
+
+ # callbacks for events
+
+ def signedOn(self):
+ if self.config.nickpasswd:
+ self.msg("Nickserv", "IDENTIFY %s" % self.config.nickpasswd)
+ self.join(self.config.channel)
+
+ def joined(self, channel):
+ log.msg("I have joined", channel)
+
+ def left(self, channel):
+ log.msg("I have left", channel)
+
+ def kickedFrom(self, channel, kicker, message):
+ log.msg("I have been kicked from %s by %s: %s" %
+ (channel, kicker, message))
+
+class IRCChatRelayFactory(protocol.ReconnectingClientFactory):
+ protocol = IRCChatRelay
+ config = None
+
+ def buildProtocol(self, address):
+ self.resetDelay()
+ p = self.protocol()
+ p.factory = self
+ return p
Added: pymoul/trunk/src/moul/chatrelay/service.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/service.py (rev 0)
+++ pymoul/trunk/src/moul/chatrelay/service.py 2007-05-30 14:49:24 UTC (rev 297)
@@ -0,0 +1,112 @@
+from zope.interface import implements
+
+from moul.chatrelay.interfaces import IFileAppendWatchService
+
+from twisted.python import log
+from twisted.application import service
+from twisted.application import internet
+from twisted.internet import task
+
+class PollingFileAppendWatchService(internet.TimerService):
+ """Watch log files for new lines
+
+ @ivar _files: mapping of file names -> (callback, errback)
+ @ivar _paused: mapping of paused file -> position
+ @ivar _fps: mapping of file names -> open file descriptors
+
+ Based on twisted.mail.mail.FileMonitorService
+ """
+ implements(IFileAppendWatchService)
+
+ _volatile = ['_fds', '_loop']
+ default_interval = 5
+ filemode = 'r'
+
+ def __init__(self, interval=None):
+ self._files = {}
+ self._paused = {}
+ self._fps = {}
+ self._call = None
+ self._interval = interval if interval else self.default_interval
+
+ def startService(self):
+ service.Service.startService(self)
+ self._setupMonitor()
+
+ def stopService(self):
+ self._stopMonitor()
+ return service.Service.stopService(self)
+
+ def monitorFile(self, path, callback, errback=None):
+ if path in self._files:
+ raise ValueError("File '%s' is already registered" % path)
+ errback = errback if errback else callback
+ self._files[path] = (callback, errback)
+
+ def unmonitorFile(self, path):
+ del self._files[path]
+ if path in self._fps:
+ self._fps[path].close()
+ del self._fps[path]
+ if path in self._paused:
+ del self._paused[path]
+
+ def pauseFile(self, path):
+ if path in self._paused:
+ raise ValueError("Already paused: '%s'" % path)
+ if path in self._fps:
+ fp = self._fps[path]
+ pos = fp.tell()
+ fp.close()
+ del self._fps[path]
+ else:
+ pos = None
+ self._paused[path] = pos
+
+ def resumeFile(self, path, fromEnd=True):
+ if path not in self._paused:
+ raise ValueError("Not paused: '%s'" % path)
+ pos = None if fromEnd else self._paused[path]
+ del self._paused[path]
+ self._getFile(path, pos)
+
+ def _getFile(self, path, pos=None):
+ if path in self._paused:
+ return None
+ try:
+ return self._fds[path]
+ except KeyError:
+ pass
+ try:
+ fp = open(path, self.filemode)
+ except IOError, err:
+ log.err()
+ self._files[path][1](path, err)
+ return
+ if pos is None:
+ fp.seek(0, 2)
+ else:
+ try:
+ fp.seek(pos, 0)
+ except IOError, err:
+ log.err()
+ self._files[path][1](path, err)
+ fp.seek(0, 2)
+ self._fps[path] = fp
+ return fp
+
+ def _setupMonitor(self):
+ self._loop = task.LoopingCall(self._monitor)
+ self._loop.start(self._interval, now=True).addErrback(self._failed)
+
+ def _stopMonitor(self):
+ if self._loop.running:
+ self._loop.stop()
+ self._loop = None
+
+ def _monitor(self):
+ for path, funcs in self._files.items():
+ fp = self._getFile(path)
+ data = fp.read()
+ if data:
+ funcs[0](path, data)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-05-29 13:49:35
|
Revision: 296
http://pymoul.svn.sourceforge.net/pymoul/?rev=296&view=rev
Author: tiran
Date: 2007-05-29 06:44:29 -0700 (Tue, 29 May 2007)
Log Message:
-----------
More work on the IRC chat relay system
Modified Paths:
--------------
pymoul/trunk/src/moul/chatrelay/filter.py
pymoul/trunk/src/moul/chatrelay/formatter.py
pymoul/trunk/src/moul/chatrelay/interfaces.py
pymoul/trunk/src/moul/file/chatlog.py
pymoul/trunk/src/moul/file/tests/test_chatlog.py
Added Paths:
-----------
pymoul/trunk/src/moul/chatrelay/handler.py
Removed Paths:
-------------
pymoul/trunk/src/moul/chatrelay/parser.py
Modified: pymoul/trunk/src/moul/chatrelay/filter.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/filter.py 2007-05-28 16:53:00 UTC (rev 295)
+++ pymoul/trunk/src/moul/chatrelay/filter.py 2007-05-29 13:44:29 UTC (rev 296)
@@ -2,6 +2,7 @@
from moul.chatrelay.interfaces import ILineFilter
from moul.chatrelay.interfaces import ISnoopyLineFilter
+from moul.chatrelay.interfaces import IConfigureableFilter
from moul.file.chatlog import (CHAT_UNKNOWN, CHAT_PRIVMSG, CHAT_PRIVMSGTO,
CHAT_PRIVMSGFROM, CHAT_ACTION, CHAT_ERROR,
CHAT_MSG)
@@ -9,42 +10,43 @@
__all__ = [obj for obj in globals() if ILineFilter.isImplementedBy(obj)]
class NullFilter(object):
+ """Filter nothing
+ """
implements(ILineFilter)
- name = 'Null filter'
def filter(self, line, **kwargs):
return line, kwargs
class HightlightImportantFilter(object):
+ """Highlight important people
+ """
implements(ILineFilter)
- name = 'Highlight important people'
def filter(self, line, **kwargs):
if kwargs.get('important', False):
kwargs['highlight'] = True
return line, kwargs
-class AbstractMessageFilter(object):
+class _AbstractMessageFilter(object):
implements(ILineFilter)
- name = None
- msg_type = None
+ msg_flags = None
def __init__(self):
- assert self.msg_type, "No message type applied"
+ assert self.msg_flags, "No message type applied"
def filter(self, line, **kwargs):
typ = kwargs.get('type', CHAT_UNKNOWN)
- if typ & self.msg_type:
- return None, None
+ if typ & self.msg_flags:
+ kwargs['skip'] = True
return line, kwargs
-class PrivateMessageFilter(AbstractMessageFilter):
+class PrivateMessageFilter(_AbstractMessageFilter):
name = 'Private message filter'
- msg_type = CHAT_PRIVMSG
+ msg_flags = CHAT_PRIVMSG
-class ErrorMessageFilter(AbstractMessageFilter):
+class ErrorMessageFilter(_AbstractMessageFilter):
name = 'Error message filter'
- msg_type = CHAT_ERROR
+ msg_flags = CHAT_ERROR
class NonImportantFilter(object):
implements(ILineFilter)
@@ -52,5 +54,6 @@
def filter(self, line, **kwargs):
if not kwargs.get('important', False):
- return None, None
+ kwargs['skip'] = True
return line, kwargs
+
Modified: pymoul/trunk/src/moul/chatrelay/formatter.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/formatter.py 2007-05-28 16:53:00 UTC (rev 295)
+++ pymoul/trunk/src/moul/chatrelay/formatter.py 2007-05-29 13:44:29 UTC (rev 296)
@@ -8,25 +8,41 @@
__all__ = [obj for obj in globals() if IOutputFormatter.isImplementedBy(obj)]
class NullFormatter(object):
+ """Null formatter
+
+ The null formatter returns the line without changing it.
+ """
implements(IOutputFormatter)
- name = 'Null formatter'
def format(self, line, **kwargs):
+ if kwargs.get('skip', False):
+ return None
return line
class MOULFormatter(object):
+ """MOUL formatter
+
+ The MOUL formatter formats the text based on its type. It also understands
+ some additional keyword arguments:
+
+ * highlight: text is highlighted with bold characters
+ * skip: text is skipped (no output)
+ """
implements(IOutputFormatter)
name = 'MOUL formatter'
def format(self, line, **kwargs):
+ if not line:
+ return
typ = kwargs.get('type', CHAT_UNKNOWN)
- highlight = kwargs.get('highlight', False)
if typ == CHAT_PRIVMSGTO:
line = "-> %s" % line
elif typ == CHAT_PRIVMSGFROM:
line = "<- %s" % line
elif typ == CHAT_ACTION:
line = "* %s" % line
- if highlight:
+ if kwargs.get('highlight', False):
line = "%B%s" % line
+ if kwargs.get('skip', False):
+ return None
return line
Copied: pymoul/trunk/src/moul/chatrelay/handler.py (from rev 295, pymoul/trunk/src/moul/chatrelay/parser.py)
===================================================================
--- pymoul/trunk/src/moul/chatrelay/handler.py (rev 0)
+++ pymoul/trunk/src/moul/chatrelay/handler.py 2007-05-29 13:44:29 UTC (rev 296)
@@ -0,0 +1,37 @@
+import os
+from zope.interface import implements
+from moul.file.chatlog import ChatlogParser
+from moul.chatrelay.interfaces import IInputHandler
+
+__all__ = [obj for obj in globals() if IInputHandler.isImplementedBy(obj)]
+
+class NullHandler(object):
+ implements(IInputHandler)
+ name = 'Null parser'
+ delimiter = '\n'
+
+ def __init__(self, delimiter=None, **kwargs):
+ if delimiter:
+ self.delimiter = delimiter
+ self._buffer = ''
+
+ def handle(self, raw):
+ data = self._buffer + raw
+ lines = data.split(self.delimiter)
+ self._buffer = lines.pop(-1)
+ for line in lines:
+ yield self.parse(line)
+
+ def parse(self, line):
+ return line, {}
+
+class MOULChatlogHandler(NullHandler):
+ name = 'MOUL chatlog parser'
+ delimiter = os.linesep
+
+ def __init__(self):
+ super(MOULChatlogHandler).__init__()
+ self._parser = ChatlogParser([])
+
+ def parse(self, line):
+ return self._parser.parse(line)
Modified: pymoul/trunk/src/moul/chatrelay/interfaces.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/interfaces.py 2007-05-28 16:53:00 UTC (rev 295)
+++ pymoul/trunk/src/moul/chatrelay/interfaces.py 2007-05-29 13:44:29 UTC (rev 296)
@@ -4,8 +4,9 @@
class IFileAppendWatchService(Interface):
"""A service which monitors text files and calls the callback for new lines
"""
+ default_interval = Attribute("Default interval length in seconds")
- def monitorFile(path, callback, errback=None):
+ def monitorFile(path, callback, errback=None, interval=None):
"""Monitor a file
@param path: path to a file
@@ -14,8 +15,26 @@
@type callback: callable
@param errback: errback function(path, error)
@type errback: callable
+ @param interval: interval in seconds (None for default interval
+ @type interval: int or None
"""
+
+ def pauseFile(path):
+ """Pause monitoring the file (closes fd)
+ @param path: path to a registered file
+ @type path: string
+ """
+
+ def resumeFile(path, fromEnd=True):
+ """Pause monitoring the file (closes fd)
+
+ @param path: path to a registered file
+ @type path: string
+ @param fromEnd: start from EOF or last position
+ @type fromEnd: bool
+ """
+
def unmonitorFile(path):
"""Stop monitoring files
@@ -30,10 +49,19 @@
@rtype: list
"""
-class IInputParser(Interface):
- """Parse input data
+class IInputHandler(Interface):
+ """Handle raw input and parse it
"""
- name = Attribute("name of the parser")
+ delimiter = Attribute("line delimiter (default: '\n')")
+
+ def handle(raw):
+ """Handle raw data
+
+ @param raw: raw data
+ @type raw: string
+ @return: parsed data as an iterable
+ @rtype: generator yielding (str, dict)
+ """
def parse(line):
"""Parse a single line
@@ -46,17 +74,19 @@
class ILineFilter(Interface):
"""A line filter
+
+ In order to suppress the output of a line the filter may set
+ kwargs['skip'] to True.
"""
- name = Attribute("name of the filter")
def filter(line, **kwargs):
- """
+ """Filter a line
@param line: the line to filter
@type line: string
@param kwargs: additional information
- @return: (filtered line, kwargs) or None, None
- @rtype: (string, dict) / None, None
+ @return: (filtered line, kwargs)
+ @rtype: (string, dict)
"""
class ISnoopyLineFilter(ILineFilter):
@@ -75,10 +105,16 @@
@return: None
"""
+class IConfigureableFilter(ILineFilter):
+ """A filter which may be configured using commands
+ """
+ def listCommands():
+ """List commands XXX: finish me
+ """
+
class IOutputFormatter(Interface):
"""A line formatter
"""
- name = Attribute("name of the output formatter")
def format(line, **kwargs):
"""Format a line
@@ -86,8 +122,8 @@
@param line: the line to filter
@type line: string
@param kwargs: additional information
- @return: a formatted line
- @rtype: string
+ @return: a formatted line or None
+ @rtype: string, None
"""
class IChatRelay(Interface):
@@ -121,3 +157,7 @@
@param name: name of the filter
@type name: string
"""
+
+ def listFilters():
+ """Return a list of filters
+ """
Deleted: pymoul/trunk/src/moul/chatrelay/parser.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/parser.py 2007-05-28 16:53:00 UTC (rev 295)
+++ pymoul/trunk/src/moul/chatrelay/parser.py 2007-05-29 13:44:29 UTC (rev 296)
@@ -1,27 +0,0 @@
-from zope.interface import implements
-
-from moul.file.chatlog import ChatlogParser
-
-from moul.chatrelay.interfaces import IInputParser
-
-__all__ = [obj for obj in globals() if IInputParser.isImplementedBy(obj)]
-
-class NullParser(object):
- implements(IInputParser)
- name = 'Null parser'
-
- def __init__(self, *args, **kwargs):
- pass
-
- def parse(self, line):
- return line, {}
-
-class MOULChatlogParser(ChatlogParser):
- implements(IInputParser)
- name = 'MOUL chatlog parser'
-
- def __init__(self, year):
- self.setYear(year)
-
- def setYear(self, year):
- self._year = int(year)
Modified: pymoul/trunk/src/moul/file/chatlog.py
===================================================================
--- pymoul/trunk/src/moul/file/chatlog.py 2007-05-28 16:53:00 UTC (rev 295)
+++ pymoul/trunk/src/moul/file/chatlog.py 2007-05-29 13:44:29 UTC (rev 296)
@@ -349,17 +349,17 @@
New idea, new design
"""
- def __init__(self, iterable=[], year=2007):
+ def __init__(self, iterable):
self._iterable = iterable
- self._year = year # XXX
def parse(self, line):
mo = CHAT_RE.match(line)
if mo is None:
- return ChatLine(line, (1970, 1, 1, 0, 0, 0), CHAT_UNKNOWN)
+ return line, {'type' : CHAT_UNKNOWN}
d = mo.groupdict()
- dt = (self._year, int(d['M']), int(d['D']),
+ dt = (0, int(d['M']), int(d['D']),
int(d['h']), int(d['m']), int(d['s']))
+ dt = self.estimateDT(dt)
msg = d['msg']
info = {'type' : CHAT_UNKNOWN, 'datetime' : dt, 'important' : False}
if len(d['space']) == 2:
@@ -393,6 +393,13 @@
if user in USER_IMPORTANT:
info['important'] = True
return msg, info
+
+ def estimateDT(self, lst):
+ lt = localtime()
+ year = lt[0]
+ if lst[1:2] == (12, 31) and lt[1:2] == (1, 1):
+ year = year - 1
+ return (year,) + lst[1:]
def __iter__(self):
for line in self._iterable:
Modified: pymoul/trunk/src/moul/file/tests/test_chatlog.py
===================================================================
--- pymoul/trunk/src/moul/file/tests/test_chatlog.py 2007-05-28 16:53:00 UTC (rev 295)
+++ pymoul/trunk/src/moul/file/tests/test_chatlog.py 2007-05-29 13:44:29 UTC (rev 296)
@@ -41,17 +41,14 @@
parser = ChatlogParser(TEST_LOG)
results = list(iter(parser))
fue = self.failUnlessEqual
- for result in results:
- fue(result.datetime, (2007, 1, 2, 3, 4, 5))
- fue(results[0].typ, CHAT_START)
- fue(results[1].typ, CHAT_STOP)
- fue(results[2].typ, CHAT_PRIVMSGFROM)
- fue(results[3].typ, CHAT_ERROR)
- fue(results[4].typ, CHAT_MSG)
- fue(results[5].typ, CHAT_PRIVMSGTO)
- fue(results[6].typ, CHAT_ACTION)
+ for msg, info in results:
+ fue(info['datetime'], (2007, 1, 2, 3, 4, 5))
+ for i, t in enumerate((CHAT_START, CHAT_STOP, CHAT_PRIVMSGFROM,
+ CHAT_ERROR, CHAT_MSG, CHAT_PRIVMSGTO)):
+ msg, info = results[i]
+ fue(info['type'], t)
for i in (2, 4, 5):
- fue(results[i].info['user'], 'USER')
+ fue(results[i][1]['user'], 'USER')
def test_suite():
return unittest.TestSuite((
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-05-28 16:53:04
|
Revision: 295
http://pymoul.svn.sourceforge.net/pymoul/?rev=295&view=rev
Author: tiran
Date: 2007-05-28 09:53:00 -0700 (Mon, 28 May 2007)
Log Message:
-----------
Switching to a new implementation of the IRC chat relay system
Modified Paths:
--------------
pymoul/trunk/src/moul/chatrelay/__init__.py
pymoul/trunk/src/moul/chatrelay/io.py
pymoul/trunk/src/moul/chatrelay/ircclient.py
pymoul/trunk/src/moul/file/chatlog.py
Added Paths:
-----------
pymoul/trunk/src/moul/chatrelay/filter.py
pymoul/trunk/src/moul/chatrelay/formatter.py
pymoul/trunk/src/moul/chatrelay/interfaces.py
pymoul/trunk/src/moul/chatrelay/parser.py
Modified: pymoul/trunk/src/moul/chatrelay/__init__.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/__init__.py 2007-05-24 22:50:20 UTC (rev 294)
+++ pymoul/trunk/src/moul/chatrelay/__init__.py 2007-05-28 16:53:00 UTC (rev 295)
@@ -5,7 +5,7 @@
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
Added: pymoul/trunk/src/moul/chatrelay/filter.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/filter.py (rev 0)
+++ pymoul/trunk/src/moul/chatrelay/filter.py 2007-05-28 16:53:00 UTC (rev 295)
@@ -0,0 +1,56 @@
+from zope.interface import implements
+
+from moul.chatrelay.interfaces import ILineFilter
+from moul.chatrelay.interfaces import ISnoopyLineFilter
+from moul.file.chatlog import (CHAT_UNKNOWN, CHAT_PRIVMSG, CHAT_PRIVMSGTO,
+ CHAT_PRIVMSGFROM, CHAT_ACTION, CHAT_ERROR,
+ CHAT_MSG)
+
+__all__ = [obj for obj in globals() if ILineFilter.isImplementedBy(obj)]
+
+class NullFilter(object):
+ implements(ILineFilter)
+ name = 'Null filter'
+
+ def filter(self, line, **kwargs):
+ return line, kwargs
+
+class HightlightImportantFilter(object):
+ implements(ILineFilter)
+ name = 'Highlight important people'
+
+ def filter(self, line, **kwargs):
+ if kwargs.get('important', False):
+ kwargs['highlight'] = True
+ return line, kwargs
+
+class AbstractMessageFilter(object):
+ implements(ILineFilter)
+ name = None
+ msg_type = None
+
+ def __init__(self):
+ assert self.msg_type, "No message type applied"
+
+ def filter(self, line, **kwargs):
+ typ = kwargs.get('type', CHAT_UNKNOWN)
+ if typ & self.msg_type:
+ return None, None
+ return line, kwargs
+
+class PrivateMessageFilter(AbstractMessageFilter):
+ name = 'Private message filter'
+ msg_type = CHAT_PRIVMSG
+
+class ErrorMessageFilter(AbstractMessageFilter):
+ name = 'Error message filter'
+ msg_type = CHAT_ERROR
+
+class NonImportantFilter(object):
+ implements(ILineFilter)
+ name = 'Filter non important'
+
+ def filter(self, line, **kwargs):
+ if not kwargs.get('important', False):
+ return None, None
+ return line, kwargs
Property changes on: pymoul/trunk/src/moul/chatrelay/filter.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: pymoul/trunk/src/moul/chatrelay/formatter.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/formatter.py (rev 0)
+++ pymoul/trunk/src/moul/chatrelay/formatter.py 2007-05-28 16:53:00 UTC (rev 295)
@@ -0,0 +1,32 @@
+from zope.interface import implements
+
+from moul.chatrelay.interfaces import IOutputFormatter
+from moul.file.chatlog import (CHAT_UNKNOWN, CHAT_PRIVMSG, CHAT_PRIVMSGTO,
+ CHAT_PRIVMSGFROM, CHAT_ACTION, CHAT_ERROR,
+ CHAT_MSG)
+
+__all__ = [obj for obj in globals() if IOutputFormatter.isImplementedBy(obj)]
+
+class NullFormatter(object):
+ implements(IOutputFormatter)
+ name = 'Null formatter'
+
+ def format(self, line, **kwargs):
+ return line
+
+class MOULFormatter(object):
+ implements(IOutputFormatter)
+ name = 'MOUL formatter'
+
+ def format(self, line, **kwargs):
+ typ = kwargs.get('type', CHAT_UNKNOWN)
+ highlight = kwargs.get('highlight', False)
+ if typ == CHAT_PRIVMSGTO:
+ line = "-> %s" % line
+ elif typ == CHAT_PRIVMSGFROM:
+ line = "<- %s" % line
+ elif typ == CHAT_ACTION:
+ line = "* %s" % line
+ if highlight:
+ line = "%B%s" % line
+ return line
Property changes on: pymoul/trunk/src/moul/chatrelay/formatter.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: pymoul/trunk/src/moul/chatrelay/interfaces.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/interfaces.py (rev 0)
+++ pymoul/trunk/src/moul/chatrelay/interfaces.py 2007-05-28 16:53:00 UTC (rev 295)
@@ -0,0 +1,123 @@
+from zope.interface import Attribute
+from zope.interface import Interface
+
+class IFileAppendWatchService(Interface):
+ """A service which monitors text files and calls the callback for new lines
+ """
+
+ def monitorFile(path, callback, errback=None):
+ """Monitor a file
+
+ @param path: path to a file
+ @type path: string
+ @param callback: callback function(path, line)
+ @type callback: callable
+ @param errback: errback function(path, error)
+ @type errback: callable
+ """
+
+ def unmonitorFile(path):
+ """Stop monitoring files
+
+ @param path: path to a file
+ @type path: string
+ """
+
+ def listFiles():
+ """List monitored files
+
+ @return: a list of file names
+ @rtype: list
+ """
+
+class IInputParser(Interface):
+ """Parse input data
+ """
+ name = Attribute("name of the parser")
+
+ def parse(line):
+ """Parse a single line
+
+ @param line: input line
+ @type line: string
+ @return: parsed line, dict with additional information
+ @rtype: (string, dict)
+ """
+
+class ILineFilter(Interface):
+ """A line filter
+ """
+ name = Attribute("name of the filter")
+
+ def filter(line, **kwargs):
+ """
+
+ @param line: the line to filter
+ @type line: string
+ @param kwargs: additional information
+ @return: (filtered line, kwargs) or None, None
+ @rtype: (string, dict) / None, None
+ """
+
+class ISnoopyLineFilter(ILineFilter):
+ """A line filter that snoops the ongoing chat in the channel
+ """
+
+ def snoop(channel, user, msg):
+ """
+
+ @param channel: channel name
+ @type channel: string
+ @param user: user name with hostmask
+ @type user: string
+ @param msg: message
+ @type msg: string
+ @return: None
+ """
+
+class IOutputFormatter(Interface):
+ """A line formatter
+ """
+ name = Attribute("name of the output formatter")
+
+ def format(line, **kwargs):
+ """Format a line
+
+ @param line: the line to filter
+ @type line: string
+ @param kwargs: additional information
+ @return: a formatted line
+ @rtype: string
+ """
+
+class IChatRelay(Interface):
+ """A chat relay
+ """
+
+ def registerInputParser(parser):
+ """Register the input parser, overriding the old one
+
+ @param parser: an input parser object
+ @type parser: object providing IInputParser
+ """
+
+ def registerOutputFormatter(formatter):
+ """Register the output formatter, overriding the old one
+
+ @param formatter: an output formatter object
+ @type formatter: object providing IOutputFormatter
+ """
+
+ def registerFilters(*filters):
+ """
+
+ @param formatter: an output formatter object
+ @type formatter: object providing IOutputFormatter
+ """
+
+ def removeFilter(name):
+ """Remove a filter from the list of filters
+
+ @param name: name of the filter
+ @type name: string
+ """
Property changes on: pymoul/trunk/src/moul/chatrelay/interfaces.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Modified: pymoul/trunk/src/moul/chatrelay/io.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/io.py 2007-05-24 22:50:20 UTC (rev 294)
+++ pymoul/trunk/src/moul/chatrelay/io.py 2007-05-28 16:53:00 UTC (rev 295)
@@ -5,7 +5,7 @@
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
@@ -34,7 +34,7 @@
class MOULLogFormatter(NullFormatter):
"""Formatter for MOUL
"""
-
+
def __init__(self, skipprivate=False, onlyimportant=False):
self.skipprivate = skipprivate
self.onlyimportant = onlyimportant
@@ -44,7 +44,7 @@
return None
typ = getattr(msg, 'typ', CHAT_UNKNOWN)
important = getattr(msg, 'important', False)
-
+
if self.onlyimportant and not important:
return None
if self.skipprivate and typ & CHAT_PRIVMSG:
@@ -74,7 +74,7 @@
def open(self):
self._fd = open(self._fname, 'r')
self._fd.seek(0, 2) # eof
-
+
def close(self):
if self._fd:
self._fd.close()
@@ -85,7 +85,7 @@
@property
def isOpen(self):
return self._fd is not None
-
+
def _read(self):
data = self._fd.read()
if not data:
@@ -104,7 +104,7 @@
return self._fifo.pop(0)
except IndexError:
raise StopIteration
-
+
class MessageWriter(object):
"""Write messages to a channel
"""
Modified: pymoul/trunk/src/moul/chatrelay/ircclient.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/ircclient.py 2007-05-24 22:50:20 UTC (rev 294)
+++ pymoul/trunk/src/moul/chatrelay/ircclient.py 2007-05-28 16:53:00 UTC (rev 295)
@@ -5,7 +5,7 @@
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
@@ -68,7 +68,7 @@
reader = None
writer = None
interval = 5
-
+
def __init__(self, nickname, channel, realname=None, username=None,
serverpasswd=None, nickpasswd=None, adminpasswd=None):
"""
@@ -80,7 +80,7 @@
self.password = serverpasswd
self.nickpasswd = nickpasswd
self.adminpasswd = adminpasswd
-
+
self.loop = LoopingCall(self.checkLogfile)
self.identified = []
@@ -95,7 +95,7 @@
def checkLogfile(self):
for line in iter(self.reader):
self.writer.log(line)
-
+
def start(self):
#if not self.reader.isOpen:
# return
@@ -117,10 +117,10 @@
def joined(self, channel):
log.msg("I have joined", channel)
-
+
def left(self, channel):
log.msg("I have left", channel)
-
+
def kickedFrom(self, channel, kicker, message):
log.msg("I have been kicked from %s by %s: %s" %
(channel, kicker, message))
@@ -172,7 +172,7 @@
#self.say(channel, "count %d" % self.counter)
#self.counter += 1
-
+
def reply(self, dest, message):
# maybe self.notice(dest, message) instead?
self.msg(dest, message)
@@ -210,7 +210,7 @@
commands.append(name)
commands.sort()
return commands
-
+
@usage("help <command> - Give help for <command>")
def command_HELP(self, user, reply, args):
args = args.split()
@@ -272,7 +272,7 @@
readerClass = LogFileReader
writerClass = MessageWriter
formatter = MOULLogFormatter(skipprivate=False, onlyimportant=False)
-
+
def __init__(self, nickname, channel, realname=None, username=None,
serverpasswd=None, nickpasswd=None, adminpasswd=None):
"""
@@ -289,7 +289,7 @@
d = self.__dict__.copy()
del d['p']
return d
-
+
def shutdown(self):
self.shuttingDown = True
if self.p:
Added: pymoul/trunk/src/moul/chatrelay/parser.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/parser.py (rev 0)
+++ pymoul/trunk/src/moul/chatrelay/parser.py 2007-05-28 16:53:00 UTC (rev 295)
@@ -0,0 +1,27 @@
+from zope.interface import implements
+
+from moul.file.chatlog import ChatlogParser
+
+from moul.chatrelay.interfaces import IInputParser
+
+__all__ = [obj for obj in globals() if IInputParser.isImplementedBy(obj)]
+
+class NullParser(object):
+ implements(IInputParser)
+ name = 'Null parser'
+
+ def __init__(self, *args, **kwargs):
+ pass
+
+ def parse(self, line):
+ return line, {}
+
+class MOULChatlogParser(ChatlogParser):
+ implements(IInputParser)
+ name = 'MOUL chatlog parser'
+
+ def __init__(self, year):
+ self.setYear(year)
+
+ def setYear(self, year):
+ self._year = int(year)
Property changes on: pymoul/trunk/src/moul/chatrelay/parser.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Modified: pymoul/trunk/src/moul/file/chatlog.py
===================================================================
--- pymoul/trunk/src/moul/file/chatlog.py 2007-05-24 22:50:20 UTC (rev 294)
+++ pymoul/trunk/src/moul/file/chatlog.py 2007-05-28 16:53:00 UTC (rev 295)
@@ -53,17 +53,9 @@
CHAT_ACTION = 1 << 6
# users
-USER_CYAN = [
- 'gregbert', 'greydragon', 'Rand Miller', 'ResEng B. Mathias',
- 'ResEng B.Dreschel', 'ResEng C. Lambert', 'ResEng KJohnson',
- 'ResEng 102', 'ResEng 233',
- ]
-USER_DRC = [
- 'Cate Alexander', 'Dr. Kodama', 'Marie Sutherland', 'Michael Engberg',
- 'Victor Laxman', 'Wheely', 'Douglas Sharper', 'Phil Henderson',
- 'Nick White'
- ]
-
+USER_CYAN = ['gregbert', 'greydragon']
+USER_DRC = ['Marie Sutherland', 'Douglas Sharper', 'Nick White',
+ 'Dr. Kodama', 'Victor Laxman', 'Michael Engberg']
USER_IMPORTANT = USER_CYAN + USER_DRC
RE_FLAGS = re.LOCALE
@@ -357,7 +349,7 @@
New idea, new design
"""
- def __init__(self, iterable, year=2007):
+ def __init__(self, iterable=[], year=2007):
self._iterable = iterable
self._year = year # XXX
@@ -366,58 +358,42 @@
if mo is None:
return ChatLine(line, (1970, 1, 1, 0, 0, 0), CHAT_UNKNOWN)
d = mo.groupdict()
- date = (self._year, int(d['M']), int(d['D']),
- int(d['h']), int(d['m']), int(d['s']))
- typ = CHAT_UNKNOWN
+ dt = (self._year, int(d['M']), int(d['D']),
+ int(d['h']), int(d['m']), int(d['s']))
msg = d['msg']
- info = {}
- important = False
+ info = {'type' : CHAT_UNKNOWN, 'datetime' : dt, 'important' : False}
if len(d['space']) == 2:
- typ = CHAT_MSG
mo = MSG_RE.match(msg)
if mo is None:
- return ChatLine(msg, dte, CHAT_UNKNOWN)
- info = mo.groupdict()
+ return msg, info
+ info['type'] = CHAT_MSG
+ info.update(mo.groupdict())
else:
if msg == CHATLOG_START:
- typ = CHAT_START
+ info['type'] = CHAT_START
elif msg == CHATLOG_STOP:
- typ = CHAT_STOP
+ info['type'] = CHAT_STOP
else:
for t, r in ((CHAT_PRIVMSGFROM, PRIVMSGFROM_RE),
(CHAT_PRIVMSGTO, PRIVMSGTO_RE),
(CHAT_ERROR, ERROR_RE)):
mo = r.match(msg)
if mo:
- typ = t
- info = mo.groupdict()
+ info['type'] = t
+ info.update(mo.groupdict())
break
- if typ == CHAT_UNKNOWN: # XXX check this
- typ = CHAT_ACTION
+ if info['type'] == CHAT_UNKNOWN: # XXX check this
+ info['type'] = CHAT_ACTION
for user in USER_IMPORTANT:
if user in msg:
- important = True
+ info['important'] = True
user = info.get('user', None)
if user:
if user in USER_IMPORTANT:
- important = True
- return ChatLine(msg, date, typ, important, info)
+ info['important'] = True
+ return msg, info
def __iter__(self):
for line in self._iterable:
yield self.parse(line)
-
-class ChatLine(unicode):
- __slots__ = ('datetime', 'typ', 'important', 'info')
-
- def __new__(cls, ustr, datetime, typ=None, important=False, info={}):
- self = unicode.__new__(cls, ustr)
- self.datetime = datetime
- self.typ = typ
- self.important = important
- self.info = info
- return self
-
- def asDatetime(self):
- return datetime(*self.date)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-05-24 22:50:20
|
Revision: 294
http://pymoul.svn.sourceforge.net/pymoul/?rev=294&view=rev
Author: tiran
Date: 2007-05-24 15:50:20 -0700 (Thu, 24 May 2007)
Log Message:
-----------
Added more official DRC and Cyan members
Added filter for non important people
Modified Paths:
--------------
pymoul/trunk/src/moul/chatrelay/__init__.py
pymoul/trunk/src/moul/chatrelay/io.py
pymoul/trunk/src/moul/chatrelay/ircclient.py
pymoul/trunk/src/moul/file/chatlog.py
Property Changed:
----------------
pymoul/trunk/src/moul/chatrelay/__init__.py
pymoul/trunk/src/moul/chatrelay/io.py
pymoul/trunk/src/moul/chatrelay/ircclient.py
Modified: pymoul/trunk/src/moul/chatrelay/__init__.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/__init__.py 2007-05-24 17:53:52 UTC (rev 293)
+++ pymoul/trunk/src/moul/chatrelay/__init__.py 2007-05-24 22:50:20 UTC (rev 294)
@@ -18,5 +18,5 @@
"""
"""
__author__ = "Christian Heimes"
-__version__ = "$Id: __init__.py 108 2007-01-31 14:46:54Z tiran $"
-__revision__ = "$Revision: 108 $"
+__version__ = "$Id$"
+__revision__ = "$Revision$"
Property changes on: pymoul/trunk/src/moul/chatrelay/__init__.py
___________________________________________________________________
Name: svn:keywords
- 'Id Revision'
+ Id Revision
Modified: pymoul/trunk/src/moul/chatrelay/io.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/io.py 2007-05-24 17:53:52 UTC (rev 293)
+++ pymoul/trunk/src/moul/chatrelay/io.py 2007-05-24 22:50:20 UTC (rev 294)
@@ -18,12 +18,11 @@
"""
"""
__author__ = "Christian Heimes"
-__version__ = "$Id: __init__.py 108 2007-01-31 14:46:54Z tiran $"
-__revision__ = "$Revision: 108 $"
+__version__ = "$Id$"
+__revision__ = "$Revision$"
import os
-from moul.file.chatlog import ChatlogParser
from moul.file.chatlog import *
class NullFormatter(object):
@@ -36,16 +35,18 @@
"""Formatter for MOUL
"""
- def __init__(self, skipprivate=True):
+ def __init__(self, skipprivate=False, onlyimportant=False):
self.skipprivate = skipprivate
+ self.onlyimportant = onlyimportant
def format(self, msg):
- print msg.typ, msg
if not msg:
return None
typ = getattr(msg, 'typ', CHAT_UNKNOWN)
important = getattr(msg, 'important', False)
-
+
+ if self.onlyimportant and not important:
+ return None
if self.skipprivate and typ & CHAT_PRIVMSG:
return None
elif typ == CHAT_PRIVMSGTO:
@@ -54,7 +55,7 @@
msg = "<- %s" % msg
elif typ == CHAT_ACTION:
msg = "* %s" % msg
- if important:
+ if not self.onlyimportant and important:
msg = "%B%s" % msg
return str(msg)
Property changes on: pymoul/trunk/src/moul/chatrelay/io.py
___________________________________________________________________
Name: svn:keywords
- 'Id Revision'
+ Id Revision
Modified: pymoul/trunk/src/moul/chatrelay/ircclient.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/ircclient.py 2007-05-24 17:53:52 UTC (rev 293)
+++ pymoul/trunk/src/moul/chatrelay/ircclient.py 2007-05-24 22:50:20 UTC (rev 294)
@@ -20,8 +20,8 @@
Partly based on Buildbot's IRC support
"""
__author__ = "Christian Heimes"
-__version__ = "$Id: __init__.py 108 2007-01-31 14:46:54Z tiran $"
-__revision__ = "$Revision: 108 $"
+__version__ = "$Id$"
+__revision__ = "$Revision$"
import sys
import os
@@ -271,6 +271,7 @@
p = None
readerClass = LogFileReader
writerClass = MessageWriter
+ formatter = MOULLogFormatter(skipprivate=False, onlyimportant=False)
def __init__(self, nickname, channel, realname=None, username=None,
serverpasswd=None, nickpasswd=None, adminpasswd=None):
@@ -300,7 +301,7 @@
self.adminpasswd)
p.factory = self
p.reader = self.readerClass(chatlog)
- p.writer = self.writerClass(p, self.channel, formatter=MOULLogFormatter(False))
+ p.writer = self.writerClass(p, self.channel, formatter=self.formatter)
self.p = p
return p
Property changes on: pymoul/trunk/src/moul/chatrelay/ircclient.py
___________________________________________________________________
Name: svn:keywords
- 'Id Revision'
+ Id Revision
Modified: pymoul/trunk/src/moul/file/chatlog.py
===================================================================
--- pymoul/trunk/src/moul/file/chatlog.py 2007-05-24 17:53:52 UTC (rev 293)
+++ pymoul/trunk/src/moul/file/chatlog.py 2007-05-24 22:50:20 UTC (rev 294)
@@ -53,9 +53,17 @@
CHAT_ACTION = 1 << 6
# users
-USER_CYAN = ['gregbert', 'greydragon']
-USER_DRC = ['Marie Sutherland', 'Douglas Sharper', 'Nick White',
- 'Dr. Kodama', 'Victor Laxman', 'Michael Engberg']
+USER_CYAN = [
+ 'gregbert', 'greydragon', 'Rand Miller', 'ResEng B. Mathias',
+ 'ResEng B.Dreschel', 'ResEng C. Lambert', 'ResEng KJohnson',
+ 'ResEng 102', 'ResEng 233',
+ ]
+USER_DRC = [
+ 'Cate Alexander', 'Dr. Kodama', 'Marie Sutherland', 'Michael Engberg',
+ 'Victor Laxman', 'Wheely', 'Douglas Sharper', 'Phil Henderson',
+ 'Nick White'
+ ]
+
USER_IMPORTANT = USER_CYAN + USER_DRC
RE_FLAGS = re.LOCALE
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-05-24 17:53:50
|
Revision: 293
http://pymoul.svn.sourceforge.net/pymoul/?rev=293&view=rev
Author: tiran
Date: 2007-05-24 10:53:52 -0700 (Thu, 24 May 2007)
Log Message:
-----------
Fixed misc bugs in the formatter and writer
Modified Paths:
--------------
pymoul/trunk/src/moul/chatrelay/io.py
pymoul/trunk/src/moul/chatrelay/ircclient.py
pymoul/trunk/src/moul/file/chatlog.py
Modified: pymoul/trunk/src/moul/chatrelay/io.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/io.py 2007-05-24 17:41:19 UTC (rev 292)
+++ pymoul/trunk/src/moul/chatrelay/io.py 2007-05-24 17:53:52 UTC (rev 293)
@@ -40,16 +40,22 @@
self.skipprivate = skipprivate
def format(self, msg):
- if self.skipprivate and msg.typ & CHAT_PRIVMSG:
- result = None
- elif msg.typ == CHAT_PRIVMSGTO:
- result = "-> %s" % msg
- elif msg.typ == CHAT_PRIVMSGFROM:
- result = "<- %s" % msg
- elif msg.typ == CHAT_ACTION:
- result = "* %s" % msg
- if msg.important:
- result = "%B%s" msg
+ print msg.typ, msg
+ if not msg:
+ return None
+ typ = getattr(msg, 'typ', CHAT_UNKNOWN)
+ important = getattr(msg, 'important', False)
+
+ if self.skipprivate and typ & CHAT_PRIVMSG:
+ return None
+ elif typ == CHAT_PRIVMSGTO:
+ msg = "-> %s" % msg
+ elif typ == CHAT_PRIVMSGFROM:
+ msg = "<- %s" % msg
+ elif typ == CHAT_ACTION:
+ msg = "* %s" % msg
+ if important:
+ msg = "%B%s" % msg
return str(msg)
class LogFileReader(object):
Modified: pymoul/trunk/src/moul/chatrelay/ircclient.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/ircclient.py 2007-05-24 17:41:19 UTC (rev 292)
+++ pymoul/trunk/src/moul/chatrelay/ircclient.py 2007-05-24 17:53:52 UTC (rev 293)
@@ -33,6 +33,7 @@
from moul.chatrelay.io import MessageWriter
from moul.chatrelay.io import LogFileReader
+from moul.chatrelay.io import MOULLogFormatter
from moul.osdependent import getMoulUserDataDir
datadir = getMoulUserDataDir()
@@ -299,7 +300,7 @@
self.adminpasswd)
p.factory = self
p.reader = self.readerClass(chatlog)
- p.writer = self.writerClass(p, self.channel)
+ p.writer = self.writerClass(p, self.channel, formatter=MOULLogFormatter(False))
self.p = p
return p
Modified: pymoul/trunk/src/moul/file/chatlog.py
===================================================================
--- pymoul/trunk/src/moul/file/chatlog.py 2007-05-24 17:41:19 UTC (rev 292)
+++ pymoul/trunk/src/moul/file/chatlog.py 2007-05-24 17:53:52 UTC (rev 293)
@@ -384,7 +384,7 @@
typ = t
info = mo.groupdict()
break
- if typ is None:
+ if typ == CHAT_UNKNOWN: # XXX check this
typ = CHAT_ACTION
for user in USER_IMPORTANT:
if user in msg:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-05-24 17:41:18
|
Revision: 292
http://pymoul.svn.sourceforge.net/pymoul/?rev=292&view=rev
Author: tiran
Date: 2007-05-24 10:41:19 -0700 (Thu, 24 May 2007)
Log Message:
-----------
Enhanced formatter
Modified Paths:
--------------
pymoul/trunk/src/moul/chatrelay/io.py
pymoul/trunk/src/moul/file/chatlog.py
Modified: pymoul/trunk/src/moul/chatrelay/io.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/io.py 2007-05-24 17:19:06 UTC (rev 291)
+++ pymoul/trunk/src/moul/chatrelay/io.py 2007-05-24 17:41:19 UTC (rev 292)
@@ -24,15 +24,34 @@
import os
from moul.file.chatlog import ChatlogParser
-from moul.file.chatlog import ChatLineError
-from moul.file.chatlog import CHAT_PRIVMSG
+from moul.file.chatlog import *
class NullFormatter(object):
"""A formatter that doesn't change the msg
"""
def format(self, msg):
- return msg
+ return str(msg)
+class MOULLogFormatter(NullFormatter):
+ """Formatter for MOUL
+ """
+
+ def __init__(self, skipprivate=True):
+ self.skipprivate = skipprivate
+
+ def format(self, msg):
+ if self.skipprivate and msg.typ & CHAT_PRIVMSG:
+ result = None
+ elif msg.typ == CHAT_PRIVMSGTO:
+ result = "-> %s" % msg
+ elif msg.typ == CHAT_PRIVMSGFROM:
+ result = "<- %s" % msg
+ elif msg.typ == CHAT_ACTION:
+ result = "* %s" % msg
+ if msg.important:
+ result = "%B%s" msg
+ return str(msg)
+
class LogFileReader(object):
"""Read log file
"""
@@ -67,15 +86,7 @@
lines = data.split(os.linesep)
# XXX - KISS, don't check for imcomplete lines
for line in ChatlogParser(lines):
- if isinstance(ChatLineError):
- self._fifo.append("PARSER ERROR: " + line)
- else:
- if line.typ & CHAT_PRIVMSG:
- continue
- elif line.important:
- self._fifo.append("*** " + line)
- else:
- self._fifo.append(line)
+ self._fifo.append(line)
def __iter__(self):
self._read()
@@ -99,4 +110,6 @@
def log(self, msg):
msg = self._fmt.format(msg)
+ if not msg:
+ return
self._client.say(self._channel, msg)
Modified: pymoul/trunk/src/moul/file/chatlog.py
===================================================================
--- pymoul/trunk/src/moul/file/chatlog.py 2007-05-24 17:19:06 UTC (rev 291)
+++ pymoul/trunk/src/moul/file/chatlog.py 2007-05-24 17:41:19 UTC (rev 292)
@@ -42,6 +42,7 @@
from moul.file.utils import fileModTime
# Chat line types
+CHAT_UNKNOWN = -1
CHAT_START = 1 << 0
CHAT_STOP = 1 << 1
CHAT_ERROR = 1 << 2
@@ -355,12 +356,11 @@
def parse(self, line):
mo = CHAT_RE.match(line)
if mo is None:
- self.error(line)
- return
+ return ChatLine(line, (1970, 1, 1, 0, 0, 0), CHAT_UNKNOWN)
d = mo.groupdict()
date = (self._year, int(d['M']), int(d['D']),
int(d['h']), int(d['m']), int(d['s']))
- typ = None
+ typ = CHAT_UNKNOWN
msg = d['msg']
info = {}
important = False
@@ -368,7 +368,7 @@
typ = CHAT_MSG
mo = MSG_RE.match(msg)
if mo is None:
- return ChatLineError(line)
+ return ChatLine(msg, dte, CHAT_UNKNOWN)
info = mo.groupdict()
else:
if msg == CHATLOG_START:
@@ -394,10 +394,7 @@
if user:
if user in USER_IMPORTANT:
important = True
- if typ is not None:
- return ChatLine(msg, date, typ, important, info)
- else:
- return ChatLineError(line)
+ return ChatLine(msg, date, typ, important, info)
def __iter__(self):
for line in self._iterable:
@@ -416,11 +413,3 @@
def asDatetime(self):
return datetime(*self.date)
-
-class ChatLineError(unicode):
- def __new__(cls, ustr):
- self = unicode.__new__(cls, ustr)
- return self
-
- def __nonzero(self):
- return False
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-05-24 17:19:05
|
Revision: 291
http://pymoul.svn.sourceforge.net/pymoul/?rev=291&view=rev
Author: tiran
Date: 2007-05-24 10:19:06 -0700 (Thu, 24 May 2007)
Log Message:
-----------
Chatlog parser enhancements
Modified Paths:
--------------
pymoul/trunk/src/moul/chatrelay/io.py
pymoul/trunk/src/moul/chatrelay/ircclient.py
pymoul/trunk/src/moul/file/chatlog.py
pymoul/trunk/src/moul/file/tests/test_chatlog.py
Modified: pymoul/trunk/src/moul/chatrelay/io.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/io.py 2007-05-24 14:00:41 UTC (rev 290)
+++ pymoul/trunk/src/moul/chatrelay/io.py 2007-05-24 17:19:06 UTC (rev 291)
@@ -23,6 +23,10 @@
import os
+from moul.file.chatlog import ChatlogParser
+from moul.file.chatlog import ChatLineError
+from moul.file.chatlog import CHAT_PRIVMSG
+
class NullFormatter(object):
"""A formatter that doesn't change the msg
"""
@@ -62,10 +66,16 @@
return
lines = data.split(os.linesep)
# XXX - KISS, don't check for imcomplete lines
- for line in lines:
- line = line.strip()
- if line:
- self._fifo.append(line)
+ for line in ChatlogParser(lines):
+ if isinstance(ChatLineError):
+ self._fifo.append("PARSER ERROR: " + line)
+ else:
+ if line.typ & CHAT_PRIVMSG:
+ continue
+ elif line.important:
+ self._fifo.append("*** " + line)
+ else:
+ self._fifo.append(line)
def __iter__(self):
self._read()
@@ -80,8 +90,6 @@
class MessageWriter(object):
"""Write messages to a channel
"""
- maxlength = 80
-
def __init__(self, client, channel, formatter=None):
self._client = client
self._channel = channel
@@ -91,4 +99,4 @@
def log(self, msg):
msg = self._fmt.format(msg)
- self._client.say(self._channel, msg, self.maxlength)
+ self._client.say(self._channel, msg)
Modified: pymoul/trunk/src/moul/chatrelay/ircclient.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/ircclient.py 2007-05-24 14:00:41 UTC (rev 290)
+++ pymoul/trunk/src/moul/chatrelay/ircclient.py 2007-05-24 17:19:06 UTC (rev 291)
@@ -238,7 +238,7 @@
reactor.callLater(3.0, self.reply, reply, "0-/")
reactor.callLater(3.5, self.reply, reply, "0-\\")
- #@requirePasswd
+ @requirePasswd
@usage("Open the chatlog and start relaying")
def command_STARTLOG(self, user, reply, args):
self.reply(reply, 'Opening chatlog ...')
@@ -248,12 +248,12 @@
return
self.msg(self.channel, "*** I'm relaying chat ***")
- #@requirePasswd
+ @requirePasswd
@usage("Stop relaying")
def command_STOPLOG(self, user, reply, args):
self.stop()
self.reply(reply, 'chatlog closed')
- self.msg(self.channel, "*** I've stopped to relay chat ***")
+ self.msg(self.channel, "*** I've stopped relaying chat ***")
class ThrottledClientFactory(protocol.ClientFactory):
lostDelay = 2
Modified: pymoul/trunk/src/moul/file/chatlog.py
===================================================================
--- pymoul/trunk/src/moul/file/chatlog.py 2007-05-24 14:00:41 UTC (rev 290)
+++ pymoul/trunk/src/moul/file/chatlog.py 2007-05-24 17:19:06 UTC (rev 291)
@@ -41,7 +41,22 @@
from moul.file.utils import fileModTime
+# Chat line types
+CHAT_START = 1 << 0
+CHAT_STOP = 1 << 1
+CHAT_ERROR = 1 << 2
+CHAT_PRIVMSGFROM = 1 << 3
+CHAT_PRIVMSGTO = 1 << 4
+CHAT_PRIVMSG = CHAT_PRIVMSGFROM | CHAT_PRIVMSGTO
+CHAT_MSG = 1 << 5
+CHAT_ACTION = 1 << 6
+# users
+USER_CYAN = ['gregbert', 'greydragon']
+USER_DRC = ['Marie Sutherland', 'Douglas Sharper', 'Nick White',
+ 'Dr. Kodama', 'Victor Laxman', 'Michael Engberg']
+USER_IMPORTANT = USER_CYAN + USER_DRC
+
RE_FLAGS = re.LOCALE
CHAT_RE = re.compile(
r"^\((?P<M>\d{1,2})/(?P<D>\d{1,2})\ " # MM/DD
@@ -52,20 +67,20 @@
r"^\((?P<date>[\d/]*)\ (?P<time>[\d:]*)\)" # (date time)
r"(?P<space>\s{1,2})" # spaces
r"(?P<msg>.*)$", # message
- RE_FLAGS)
-CHATLOG_STARTED = "Chat.log started..."
-CHATLOG_STOPPED = "...Chat.log stopped."
-TEXT_MSGFROM_RE = re.compile(
+ RE_FLAGS)
+CHATLOG_START = "Chat.log started..."
+CHATLOG_STOP = "...Chat.log stopped."
+PRIVMSGFROM_RE = re.compile(
# From USER in LOCATION: msg
r"From (?P<user>.*) in (?P<location>.*): (?P<msg>.*)",
RE_FLAGS)
-TEXT_MSGTO_RE = re.compile(
+PRIVMSGTO_RE = re.compile(
r"To (?P<user>.*): (?P<msg>.*)", # From USER in LOCATION: msg
RE_FLAGS)
-TEXT_ERROR_RE = re.compile(
+ERROR_RE = re.compile(
r"Error: (?P<msg>.*)", # Error: message
RE_FLAGS)
-TEXT_RE = re.compile(
+MSG_RE = re.compile(
r"(?P<user>.*): (?P<msg>.*)", # User: message
RE_FLAGS)
CHATLOG_DATE_FNAME_RE = re.compile(
@@ -76,7 +91,6 @@
LOG = getLogger('moul.chat')
-
class ChatlogMover(object):
"""
"""
@@ -147,7 +161,7 @@
created = None
if mo:
data = mo.groupdict()
- if data['msg'].startswith(CHATLOG_STARTED):
+ if data['msg'].startswith(CHATLOG_START):
d = mo.groupdict()
created = (None, int(d['M']), int(d['D']), int(d['h']),
int(d['m']), int(d['s']), None, None, None)
@@ -255,6 +269,8 @@
class ChatlogView(object):
"""A view of a single chat log file
+
+ XXX replace it with ChatlogParser
"""
def __init__(self, fname):
@@ -326,3 +342,85 @@
"""
self.open()
return self._fd.read()
+
+class ChatlogParser(object):
+ """Yet another chatlog parser
+
+ New idea, new design
+ """
+ def __init__(self, iterable, year=2007):
+ self._iterable = iterable
+ self._year = year # XXX
+
+ def parse(self, line):
+ mo = CHAT_RE.match(line)
+ if mo is None:
+ self.error(line)
+ return
+ d = mo.groupdict()
+ date = (self._year, int(d['M']), int(d['D']),
+ int(d['h']), int(d['m']), int(d['s']))
+ typ = None
+ msg = d['msg']
+ info = {}
+ important = False
+ if len(d['space']) == 2:
+ typ = CHAT_MSG
+ mo = MSG_RE.match(msg)
+ if mo is None:
+ return ChatLineError(line)
+ info = mo.groupdict()
+ else:
+ if msg == CHATLOG_START:
+ typ = CHAT_START
+ elif msg == CHATLOG_STOP:
+ typ = CHAT_STOP
+ else:
+ for t, r in ((CHAT_PRIVMSGFROM, PRIVMSGFROM_RE),
+ (CHAT_PRIVMSGTO, PRIVMSGTO_RE),
+ (CHAT_ERROR, ERROR_RE)):
+ mo = r.match(msg)
+ if mo:
+ typ = t
+ info = mo.groupdict()
+ break
+ if typ is None:
+ typ = CHAT_ACTION
+ for user in USER_IMPORTANT:
+ if user in msg:
+ important = True
+
+ user = info.get('user', None)
+ if user:
+ if user in USER_IMPORTANT:
+ important = True
+ if typ is not None:
+ return ChatLine(msg, date, typ, important, info)
+ else:
+ return ChatLineError(line)
+
+ def __iter__(self):
+ for line in self._iterable:
+ yield self.parse(line)
+
+class ChatLine(unicode):
+ __slots__ = ('datetime', 'typ', 'important', 'info')
+
+ def __new__(cls, ustr, datetime, typ=None, important=False, info={}):
+ self = unicode.__new__(cls, ustr)
+ self.datetime = datetime
+ self.typ = typ
+ self.important = important
+ self.info = info
+ return self
+
+ def asDatetime(self):
+ return datetime(*self.date)
+
+class ChatLineError(unicode):
+ def __new__(cls, ustr):
+ self = unicode.__new__(cls, ustr)
+ return self
+
+ def __nonzero(self):
+ return False
\ No newline at end of file
Modified: pymoul/trunk/src/moul/file/tests/test_chatlog.py
===================================================================
--- pymoul/trunk/src/moul/file/tests/test_chatlog.py 2007-05-24 14:00:41 UTC (rev 290)
+++ pymoul/trunk/src/moul/file/tests/test_chatlog.py 2007-05-24 17:19:06 UTC (rev 291)
@@ -25,10 +25,37 @@
from doctest import DocTestSuite
import moul.file.chatlog
+from moul.file.chatlog import *
+TEST_LOG = """(01/02 03:04:05) Chat.log started...
+(01/02 03:04:05) ...Chat.log stopped.
+(01/02 03:04:05) From USER in LOCATION: MSG
+(01/02 03:04:05) Error: ERRORMSG
+(01/02 03:04:05) USER: TEXT (note the two spaces!)
+(01/02 03:04:05) To USER: TEXT
+(01/02 03:04:05) USER action""".split('\n')
+class ChatlogParserTest(unittest.TestCase):
+
+ def test_parse(self):
+ parser = ChatlogParser(TEST_LOG)
+ results = list(iter(parser))
+ fue = self.failUnlessEqual
+ for result in results:
+ fue(result.datetime, (2007, 1, 2, 3, 4, 5))
+ fue(results[0].typ, CHAT_START)
+ fue(results[1].typ, CHAT_STOP)
+ fue(results[2].typ, CHAT_PRIVMSGFROM)
+ fue(results[3].typ, CHAT_ERROR)
+ fue(results[4].typ, CHAT_MSG)
+ fue(results[5].typ, CHAT_PRIVMSGTO)
+ fue(results[6].typ, CHAT_ACTION)
+ for i in (2, 4, 5):
+ fue(results[i].info['user'], 'USER')
+
def test_suite():
return unittest.TestSuite((
+ unittest.makeSuite(ChatlogParserTest),
DocTestSuite('moul.file.chatlog')
))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-05-24 14:00:54
|
Revision: 290
http://pymoul.svn.sourceforge.net/pymoul/?rev=290&view=rev
Author: tiran
Date: 2007-05-24 07:00:41 -0700 (Thu, 24 May 2007)
Log Message:
-----------
First working version
Modified Paths:
--------------
pymoul/trunk/src/moul/chatrelay/io.py
pymoul/trunk/src/moul/chatrelay/ircclient.py
Modified: pymoul/trunk/src/moul/chatrelay/io.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/io.py 2007-05-24 00:30:38 UTC (rev 289)
+++ pymoul/trunk/src/moul/chatrelay/io.py 2007-05-24 14:00:41 UTC (rev 290)
@@ -34,45 +34,48 @@
"""
def __init__(self, fname):
self._fname = fname
- self._fd = None
+ self._fd = None
self._fifo = []
self._incomplete = []
-
+
def exists(self):
return os.path.isfile(self._fname)
def open(self):
self._fd = open(self._fname, 'r')
- self._fd.seek(0, 2) # eof
+ self._fd.seek(0, 2) # eof
def close(self):
if self._fd:
- self._fd.close()
+ self._fd.close()
self._fd = None
self._fifo = []
- self._incomplete = []
-
+ self._incomplete = []
+
+ @property
+ def isOpen(self):
+ return self._fd is not None
+
def _read(self):
- fd = self._fd
- data = self.read()
- if not data:
- return
- lines = data.split(os.linesep)
- # XXX - KISS, don't check for imcomplete lines
- for line in lines:
- line = line.strip()
- if line:
- self._fifo.append(line)
+ data = self._fd.read()
+ if not data:
+ return
+ lines = data.split(os.linesep)
+ # XXX - KISS, don't check for imcomplete lines
+ for line in lines:
+ line = line.strip()
+ if line:
+ self._fifo.append(line)
def __iter__(self):
- self._read()
- return self
+ self._read()
+ return self
def next(self):
try:
- return self._fifo.pop(0)
- except IndexError:
- raise StopIteration
+ return self._fifo.pop(0)
+ except IndexError:
+ raise StopIteration
class MessageWriter(object):
"""Write messages to a channel
@@ -81,11 +84,11 @@
def __init__(self, client, channel, formatter=None):
self._client = client
- self._channel = channel
- if formatter is None:
- formatter = NullFormatter()
- self._fmt = formatter
+ self._channel = channel
+ if formatter is None:
+ formatter = NullFormatter()
+ self._fmt = formatter
def log(self, msg):
msg = self._fmt.format(msg)
- self._client.say(self._channel, msg, self.maxlength)
+ self._client.say(self._channel, msg, self.maxlength)
Modified: pymoul/trunk/src/moul/chatrelay/ircclient.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/ircclient.py 2007-05-24 00:30:38 UTC (rev 289)
+++ pymoul/trunk/src/moul/chatrelay/ircclient.py 2007-05-24 14:00:41 UTC (rev 290)
@@ -24,14 +24,21 @@
__revision__ = "$Revision: 108 $"
import sys
+import os
from twisted.words.protocols import irc
from twisted.internet import reactor, protocol
+from twisted.internet.task import LoopingCall
from twisted.python import log, failure
from moul.chatrelay.io import MessageWriter
from moul.chatrelay.io import LogFileReader
+from moul.osdependent import getMoulUserDataDir
+datadir = getMoulUserDataDir()
+chatlog = os.path.join(datadir, 'Log', 'chat.0.log')
+print chatlog
+
def requirePasswd(func):
"""@decorator"""
func.requirePassword = True
@@ -57,6 +64,10 @@
class ChatRelayBot(irc.IRCClient):
"""A chat relay bot"""
+ reader = None
+ writer = None
+ interval = 5
+
def __init__(self, nickname, channel, realname=None, username=None,
serverpasswd=None, nickpasswd=None, adminpasswd=None):
"""
@@ -68,13 +79,34 @@
self.password = serverpasswd
self.nickpasswd = nickpasswd
self.adminpasswd = adminpasswd
-
+
+ self.loop = LoopingCall(self.checkLogfile)
+ self.identified = []
+
def connectionMade(self):
irc.IRCClient.connectionMade(self)
def connectionLost(self, reason):
irc.IRCClient.connectionLost(self, reason)
+ # core method - check log file
+
+ def checkLogfile(self):
+ for line in iter(self.reader):
+ self.writer.log(line)
+
+ def start(self):
+ #if not self.reader.isOpen:
+ # return
+ if not self.reader.exists():
+ return "File does not exist"
+ self.reader.open()
+ self.loop.start(self.interval)
+
+ def stop(self):
+ self.loop.stop()
+ self.reader.close()
+
# callbacks for events
def signedOn(self):
@@ -206,15 +238,22 @@
reactor.callLater(3.0, self.reply, reply, "0-/")
reactor.callLater(3.5, self.reply, reply, "0-\\")
- @usage("Open the chatlog")
- @requirePasswd
- def command_OPENLOG(self, user, reply, args):
- self.reply(reply, 'Opening chatlog')
+ #@requirePasswd
+ @usage("Open the chatlog and start relaying")
+ def command_STARTLOG(self, user, reply, args):
+ self.reply(reply, 'Opening chatlog ...')
+ msg = self.start()
+ if msg is not None:
+ self.reply(reply, 'Error: %s' % msg)
+ return
+ self.msg(self.channel, "*** I'm relaying chat ***")
- @usage("Close the chatlog")
- @requirePasswd
- def command_CLOSELOG(self, user, reply, args):
- self.reply(reply, 'Closing chatlog')
+ #@requirePasswd
+ @usage("Stop relaying")
+ def command_STOPLOG(self, user, reply, args):
+ self.stop()
+ self.reply(reply, 'chatlog closed')
+ self.msg(self.channel, "*** I've stopped to relay chat ***")
class ThrottledClientFactory(protocol.ClientFactory):
lostDelay = 2
@@ -229,6 +268,8 @@
shuttingDown = False
p = None
+ readerClass = LogFileReader
+ writerClass = MessageWriter
def __init__(self, nickname, channel, realname=None, username=None,
serverpasswd=None, nickpasswd=None, adminpasswd=None):
@@ -257,6 +298,8 @@
self.username, self.password, self.nickpasswd,
self.adminpasswd)
p.factory = self
+ p.reader = self.readerClass(chatlog)
+ p.writer = self.writerClass(p, self.channel)
self.p = p
return p
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-05-24 00:30:39
|
Revision: 289
http://pymoul.svn.sourceforge.net/pymoul/?rev=289&view=rev
Author: tiran
Date: 2007-05-23 17:30:38 -0700 (Wed, 23 May 2007)
Log Message:
-----------
Adding first code of the chat relay IRC bot daemon.
Modified Paths:
--------------
pymoul/trunk/src/moul/time/podage.py
Added Paths:
-----------
pymoul/trunk/src/moul/chatrelay/
pymoul/trunk/src/moul/chatrelay/__init__.py
pymoul/trunk/src/moul/chatrelay/io.py
pymoul/trunk/src/moul/chatrelay/ircclient.py
Added: pymoul/trunk/src/moul/chatrelay/__init__.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/__init__.py (rev 0)
+++ pymoul/trunk/src/moul/chatrelay/__init__.py 2007-05-24 00:30:38 UTC (rev 289)
@@ -0,0 +1,22 @@
+# pyMoul - Python interface to Myst Online URU Live
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id: __init__.py 108 2007-01-31 14:46:54Z tiran $"
+__revision__ = "$Revision: 108 $"
Property changes on: pymoul/trunk/src/moul/chatrelay/__init__.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: pymoul/trunk/src/moul/chatrelay/io.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/io.py (rev 0)
+++ pymoul/trunk/src/moul/chatrelay/io.py 2007-05-24 00:30:38 UTC (rev 289)
@@ -0,0 +1,91 @@
+# pyMoul - Python interface to Myst Online URU Live
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id: __init__.py 108 2007-01-31 14:46:54Z tiran $"
+__revision__ = "$Revision: 108 $"
+
+import os
+
+class NullFormatter(object):
+ """A formatter that doesn't change the msg
+ """
+ def format(self, msg):
+ return msg
+
+class LogFileReader(object):
+ """Read log file
+ """
+ def __init__(self, fname):
+ self._fname = fname
+ self._fd = None
+ self._fifo = []
+ self._incomplete = []
+
+ def exists(self):
+ return os.path.isfile(self._fname)
+
+ def open(self):
+ self._fd = open(self._fname, 'r')
+ self._fd.seek(0, 2) # eof
+
+ def close(self):
+ if self._fd:
+ self._fd.close()
+ self._fd = None
+ self._fifo = []
+ self._incomplete = []
+
+ def _read(self):
+ fd = self._fd
+ data = self.read()
+ if not data:
+ return
+ lines = data.split(os.linesep)
+ # XXX - KISS, don't check for imcomplete lines
+ for line in lines:
+ line = line.strip()
+ if line:
+ self._fifo.append(line)
+
+ def __iter__(self):
+ self._read()
+ return self
+
+ def next(self):
+ try:
+ return self._fifo.pop(0)
+ except IndexError:
+ raise StopIteration
+
+class MessageWriter(object):
+ """Write messages to a channel
+ """
+ maxlength = 80
+
+ def __init__(self, client, channel, formatter=None):
+ self._client = client
+ self._channel = channel
+ if formatter is None:
+ formatter = NullFormatter()
+ self._fmt = formatter
+
+ def log(self, msg):
+ msg = self._fmt.format(msg)
+ self._client.say(self._channel, msg, self.maxlength)
Property changes on: pymoul/trunk/src/moul/chatrelay/io.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: pymoul/trunk/src/moul/chatrelay/ircclient.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/ircclient.py (rev 0)
+++ pymoul/trunk/src/moul/chatrelay/ircclient.py 2007-05-24 00:30:38 UTC (rev 289)
@@ -0,0 +1,285 @@
+# pyMoul - Python interface to Myst Online URU Live
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""Chat relay using Twisted IRC
+
+Partly based on Buildbot's IRC support
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id: __init__.py 108 2007-01-31 14:46:54Z tiran $"
+__revision__ = "$Revision: 108 $"
+
+import sys
+
+from twisted.words.protocols import irc
+from twisted.internet import reactor, protocol
+from twisted.python import log, failure
+
+from moul.chatrelay.io import MessageWriter
+from moul.chatrelay.io import LogFileReader
+
+def requirePasswd(func):
+ """@decorator"""
+ func.requirePassword = True
+ return func
+
+def doesRequirePasswd(func):
+ return getattr(func, 'requirePassword', False)
+
+def usage(usage):
+ """@decorator"""
+ def wrapper(func):
+ func.usage = usage
+ return func
+ return wrapper
+
+class UsageError(ValueError):
+ def __init__(self, string = "Invalid usage", *more):
+ ValueError.__init__(self, string, *more)
+
+class InvalidPassword(UsageError):
+ def __init__(self, string = "Invalid password", *more):
+ ValueError.__init__(self, string, *more)
+
+class ChatRelayBot(irc.IRCClient):
+ """A chat relay bot"""
+ def __init__(self, nickname, channel, realname=None, username=None,
+ serverpasswd=None, nickpasswd=None, adminpasswd=None):
+ """
+ """
+ self.nickname = nickname
+ self.channel = channel
+ self.realname = realname
+ self.username = username
+ self.password = serverpasswd
+ self.nickpasswd = nickpasswd
+ self.adminpasswd = adminpasswd
+
+ def connectionMade(self):
+ irc.IRCClient.connectionMade(self)
+
+ def connectionLost(self, reason):
+ irc.IRCClient.connectionLost(self, reason)
+
+ # callbacks for events
+
+ def signedOn(self):
+ if self.nickpasswd:
+ self.msg("Nickserv", "IDENTIFY %s" % self.nickpasswd)
+ self.join(self.channel)
+
+ def joined(self, channel):
+ log.msg("I have joined", channel)
+
+ def left(self, channel):
+ log.msg("I have left", channel)
+
+ def kickedFrom(self, channel, kicker, message):
+ log.msg("I have been kicked from %s by %s: %s" %
+ (channel, kicker, message))
+
+ def privmsg(self, user, channel, message):
+ """This will get called when the bot receives a message."""
+ user = user.split('!', 1)[0]
+ channel = channel.lower()
+ if channel == self.nickname.lower():
+ # private message
+ message = "%s: %s" % (self.nickname, message)
+ reply = user
+ private = True
+ else:
+ reply = channel
+ private = False
+
+ if message.startswith("%s:" % self.nickname):
+ message = message[len("%s:" % self.nickname):]
+
+ message = message.lstrip()
+
+ parts = message.split(' ', 1)
+ if len(parts) == 1:
+ parts = parts + ['']
+ cmd, args = parts
+ log.msg("irc command", cmd)
+
+ error = None
+ try:
+ meth, args = self.getCommandMethod(cmd, args, private)
+ if not meth and message[-1] == '!':
+ meth = self.command_EXCITED
+
+ if meth:
+ meth(user, reply, args.strip())
+ except UsageError, e:
+ self.reply(reply, str(e))
+ except:
+ f = failure.Failure()
+ log.err(f)
+ error = "Something bad happened (see logs): %s" % f.type
+
+ if error:
+ try:
+ self.reply(reply, error)
+ except:
+ log.err()
+
+ #self.say(channel, "count %d" % self.counter)
+ #self.counter += 1
+
+ def reply(self, dest, message):
+ # maybe self.notice(dest, message) instead?
+ self.msg(dest, message)
+
+ def getCommandMethod(self, command, args, private):
+ meth = getattr(self, 'command_' + command.upper(), None)
+ if meth is not None:
+ if doesRequirePasswd(meth):
+ if not private:
+ raise UsageError("This command requires a password.")
+ parts = args.split(' ', 1)
+ if len(parts) == 1:
+ parts = parts + ['']
+ password, args = parts
+ if password != self.adminpasswd:
+ raise InvalidPassword()
+ return meth, args
+
+ @usage("Say hello")
+ def command_HELLO(self, user, reply, args):
+ self.reply(reply, "yes?")
+
+ @usage("Say something exciting")
+ def command_EXCITED(self, user, reply, args):
+ # like 'buildbot: destroy the sun!'
+ self.reply(reply, "What you say!")
+
+ def build_commands(self):
+ commands = []
+ for k, v in self.__class__.__dict__.items():
+ if k.startswith('command_'):
+ name = k[8:].lower()
+ if doesRequirePasswd(v):
+ name = name+'*'
+ commands.append(name)
+ commands.sort()
+ return commands
+
+ @usage("help <command> - Give help for <command>")
+ def command_HELP(self, user, reply, args):
+ args = args.split()
+ if len(args) == 0:
+ self.reply(reply, "Get help on what? (try 'help <foo>', or 'commands' for a command list)")
+ return
+ command = args[0]
+ meth = self.getCommandMethod(command)
+ if not meth:
+ raise UsageError, "no such command '%s'" % command
+ usage = getattr(meth, 'usage', None)
+ if usage:
+ self.reply(reply, "Usage: %s" % usage)
+ else:
+ self.reply(reply, "No usage info for '%s'" % command)
+
+ @usage("commands - List available commands")
+ def command_COMMANDS(self, user, reply, args):
+ commands = self.build_commands()
+ msg = "Chat Relay commands: " + ", ".join(commands)
+ self.reply(reply, msg)
+
+ @usage("Dance! Let's do the time warp!")
+ def command_DANCE(self, user, reply, args):
+ reactor.callLater(1.0, self.reply, reply, "0-<")
+ reactor.callLater(3.0, self.reply, reply, "0-/")
+ reactor.callLater(3.5, self.reply, reply, "0-\\")
+
+ @usage("Open the chatlog")
+ @requirePasswd
+ def command_OPENLOG(self, user, reply, args):
+ self.reply(reply, 'Opening chatlog')
+
+ @usage("Close the chatlog")
+ @requirePasswd
+ def command_CLOSELOG(self, user, reply, args):
+ self.reply(reply, 'Closing chatlog')
+
+class ThrottledClientFactory(protocol.ClientFactory):
+ lostDelay = 2
+ failedDelay = 60
+ def clientConnectionLost(self, connector, reason):
+ reactor.callLater(self.lostDelay, connector.connect)
+ def clientConnectionFailed(self, connector, reason):
+ reactor.callLater(self.failedDelay, connector.connect)
+
+class ChatRelayBotFactory(ThrottledClientFactory):
+ protocol = ChatRelayBot
+
+ shuttingDown = False
+ p = None
+
+ def __init__(self, nickname, channel, realname=None, username=None,
+ serverpasswd=None, nickpasswd=None, adminpasswd=None):
+ """
+ """
+ self.nickname = nickname
+ self.channel = channel
+ self.realname = realname
+ self.username = username
+ self.password = serverpasswd
+ self.nickpasswd = nickpasswd
+ self.adminpasswd = adminpasswd
+
+ def __getstate__(self):
+ d = self.__dict__.copy()
+ del d['p']
+ return d
+
+ def shutdown(self):
+ self.shuttingDown = True
+ if self.p:
+ self.p.quit("Shutting down")
+
+ def buildProtocol(self, address):
+ p = self.protocol(self.nickname, self.channel, self.realname,
+ self.username, self.password, self.nickpasswd,
+ self.adminpasswd)
+ p.factory = self
+ self.p = p
+ return p
+
+ def clientConnectionLost(self, connector, reason):
+ if self.shuttingDown:
+ log.msg("not scheduling reconnection attempt")
+ return
+ ThrottledClientFactory.clientConnectionLost(self, connector, reason)
+
+ def clientConnectionFailed(self, connector, reason):
+ if self.shuttingDown:
+ log.msg("not scheduling reconnection attempt")
+ return
+ ThrottledClientFactory.clientConnectionFailed(self, connector, reason)
+
+def main():
+ log.startLogging(sys.stdout)
+ f = ChatRelayBotFactory('TiransRelay', '#urubot', adminpasswd="moul")
+ # connect factory to this host and port
+ reactor.connectTCP("tsunami.justirc.net", 6667, f)
+
+ # run bot
+ reactor.run()
+
+if __name__ == '__main__':
+ main()
Property changes on: pymoul/trunk/src/moul/chatrelay/ircclient.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Modified: pymoul/trunk/src/moul/time/podage.py
===================================================================
--- pymoul/trunk/src/moul/time/podage.py 2007-04-28 13:27:31 UTC (rev 288)
+++ pymoul/trunk/src/moul/time/podage.py 2007-05-24 00:30:38 UTC (rev 289)
@@ -303,9 +303,9 @@
fd.close()
if __name__ == '__main__':
- forumTimeTable(tzlist=('CET',))
- #forumTimeTable(tzlist=('UTC',))
+ #forumTimeTable(tzlist=('CET',))
+ forumTimeTable(tzlist=('UTC',))
#forumTimeTable(tzlist=('US/Pacific',))
#forumTimeTable()
- #allTzList()
+ allTzList()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-04-28 13:27:30
|
Revision: 288
http://pymoul.svn.sourceforge.net/pymoul/?rev=288&view=rev
Author: tiran
Date: 2007-04-28 06:27:31 -0700 (Sat, 28 Apr 2007)
Log Message:
-----------
Changed binary file class from file subclass to proxy class
Modified Paths:
--------------
binaryfile/trunk/src/binaryfile/binary.py
Modified: binaryfile/trunk/src/binaryfile/binary.py
===================================================================
--- binaryfile/trunk/src/binaryfile/binary.py 2007-04-28 13:25:46 UTC (rev 287)
+++ binaryfile/trunk/src/binaryfile/binary.py 2007-04-28 13:27:31 UTC (rev 288)
@@ -37,12 +37,14 @@
from binaryfile.binaryrecord import parseRecord
from binaryfile.binaryrecord import registerRecord
+_marker = object()
-class BinaryFile(file):
- """Binary file
-
- A file based class with additional methods to read and write binary data.
-
+class BinaryFile(object):
+ """Binary file proxy
+
+ A file wrapper for binary files with additional methods to read and write
+ binary data.
+
The class supports reading and writing:
- char: readChar / writeChar
- byte: readByte / writeByte
@@ -69,12 +71,28 @@
The class is using some optimization tricks like binding functions to the
local namespace of a method.
"""
- def __new__(cls, fname, mode='rb'):
+ NULL = '\x00'
+ _methods = ('read', 'write', 'seek', 'tell')
+
+ def __init__(self, fdname, mode='rb', buffer=4096):
assert 'b' in mode
- self = file.__new__(cls, fname, mode)
- self.NULL = '\x00'
- return self
+ if isinstance(fdname, basestring):
+ fd = open(fdname, mode, buffer)
+ else:
+ for name in self._methods:
+ if not hasattr(fdname, name):
+ raise TypeError("%s is missing %s" % (type(fdname), name))
+ fd = fdname
+ self._fd = fd
+ for name in self._methods:
+ setattr(self, name, getattr(fd, name))
+ def __getattr__(self, name, default=_marker):
+ result = getattr(self._fd, name, _marker)
+ if result is _marker:
+ raise AttributeError(name)
+ return result
+
def size(self):
pos = self.tell()
try:
@@ -234,7 +252,7 @@
def set(self, s):
"""Replace current data with s
"""
- self._data = s
+ self._data = s
def __repr__(self):
"""repr(self)
@@ -300,4 +318,3 @@
else:
fd.write16(size)
fd.write(self._data)
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-04-28 13:25:48
|
Revision: 287
http://pymoul.svn.sourceforge.net/pymoul/?rev=287&view=rev
Author: tiran
Date: 2007-04-28 06:25:46 -0700 (Sat, 28 Apr 2007)
Log Message:
-----------
Propset and minor tweaks for crypt
Modified Paths:
--------------
pymoul/trunk/src/moul/crypt/stream.py
pymoul/trunk/src/moul/file/pak.py
pymoul/trunk/src/moul/file/sdl.py
pymoul/trunk/src/moul/file/tests/test_sdl.py
Property Changed:
----------------
pymoul/trunk/src/moul/crypt/stream.py
pymoul/trunk/src/moul/file/pak.py
pymoul/trunk/src/moul/file/sdl.py
pymoul/trunk/src/moul/file/tests/test_sdl.py
Modified: pymoul/trunk/src/moul/crypt/stream.py
===================================================================
--- pymoul/trunk/src/moul/crypt/stream.py 2007-04-19 00:33:11 UTC (rev 286)
+++ pymoul/trunk/src/moul/crypt/stream.py 2007-04-28 13:25:46 UTC (rev 287)
@@ -18,8 +18,8 @@
"""Encrypted file stream
"""
__author__ = "Christian Heimes"
-__version__ = "$Id: elf.py 275 2007-03-21 12:39:25Z tiran $"
-__revision__ = "$Revision: 275 $"
+__version__ = "$Id$"
+__revision__ = "$Revision$"
import os
@@ -35,27 +35,43 @@
blockSize = 1024
def __init__(self, fdname, cipher):
+ self._cipher = cipher
+
if isinstance(fdname, basestring):
fd = BinaryFile(fdname)
elif isinstance(fdname, BinaryFile):
fd = fdname
else:
raise TypeError(fdname)
+ self._fd = fd
+
header = fd.read(12)
if header != self.magic:
HeaderError(header)
self._size = fd.read32()
- fd.seek(0, 2)
- fsize = fd.tell()
- fd.seek(16)
- if fsize-16 < self._size:
+
+ self.seek(0, 2)
+ fsize = self.tell()
+ self.seek(0)
+ if fsize < self._size:
raise ValueError("Size mismatch %i/%i" % (fsize, self._size))
- self._cipher = cipher
- self._fd = fd
+ def seek(self, offset, whence=0):
+ if whence == 0:
+ offset += 16
+ self._fd.seek(offset, whence)
+
+ def tell(self):
+ return self._fd.tell()-16
+
+ def flush(self):
+ return self._fd.flush()
+
+ def close(self):
+ return self._fd.close()
+
def read(self):
fd = self._fd
- fd.seek(16)
remain = self._size
bs = self.blockSize
decrypt = self._cipher.decrypt
@@ -69,4 +85,5 @@
data = data[:remain]
buf.append(data)
remain -= bs
+ remain -= bs
return ''.join(buf)
Property changes on: pymoul/trunk/src/moul/crypt/stream.py
___________________________________________________________________
Name: svn:keywords
- 'Id Revision'
+ Id Revision
Modified: pymoul/trunk/src/moul/file/pak.py
===================================================================
--- pymoul/trunk/src/moul/file/pak.py 2007-04-19 00:33:11 UTC (rev 286)
+++ pymoul/trunk/src/moul/file/pak.py 2007-04-28 13:25:46 UTC (rev 287)
@@ -18,8 +18,8 @@
"""Python PAK reader (for TPOS)
"""
__author__ = "Christian Heimes"
-__version__ = "$Id: utils.py 187 2007-02-23 16:41:50Z tiran $"
-__revision__ = "$Revision: 187 $"
+__version__ = "$Id$"
+__revision__ = "$Revision$"
import os
from hashlib import md5
Property changes on: pymoul/trunk/src/moul/file/pak.py
___________________________________________________________________
Name: svn:keywords
- 'Id Revision'
+ Id Revision
Modified: pymoul/trunk/src/moul/file/sdl.py
===================================================================
--- pymoul/trunk/src/moul/file/sdl.py 2007-04-19 00:33:11 UTC (rev 286)
+++ pymoul/trunk/src/moul/file/sdl.py 2007-04-28 13:25:46 UTC (rev 287)
@@ -18,8 +18,8 @@
"""SDL files (for TPOS)
"""
__author__ = "Christian Heimes"
-__version__ = "$Id: utils.py 187 2007-02-23 16:41:50Z tiran $"
-__revision__ = "$Revision: 187 $"
+__version__ = "$Id$"
+__revision__ = "$Revision$"
import os
import re
Property changes on: pymoul/trunk/src/moul/file/sdl.py
___________________________________________________________________
Name: svn:keywords
- 'Id Revision'
+ Id Revision
Modified: pymoul/trunk/src/moul/file/tests/test_sdl.py
===================================================================
--- pymoul/trunk/src/moul/file/tests/test_sdl.py 2007-04-19 00:33:11 UTC (rev 286)
+++ pymoul/trunk/src/moul/file/tests/test_sdl.py 2007-04-28 13:25:46 UTC (rev 287)
@@ -18,8 +18,8 @@
"""moul.file.sdl unit tests
"""
__author__ = "Christian Heimes"
-__version__ = "$Id: test_plasmalog.py 140 2007-02-05 14:51:30Z tiran $"
-__revision__ = "$Revision: 140 $"
+__version__ = "$Id$"
+__revision__ = "$Revision$"
import os
import unittest
Property changes on: pymoul/trunk/src/moul/file/tests/test_sdl.py
___________________________________________________________________
Name: svn:keywords
- 'Id Revision'
+ Id Revision
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-04-19 00:33:30
|
Revision: 286
http://pymoul.svn.sourceforge.net/pymoul/?rev=286&view=rev
Author: tiran
Date: 2007-04-18 17:33:11 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Fixes to SDL and Stream class
Modified Paths:
--------------
crypttea/trunk/src/crypttea/_common.py
pymoul/trunk/src/moul/crypt/stream.py
pymoul/trunk/src/moul/file/sdl.py
Modified: crypttea/trunk/src/crypttea/_common.py
===================================================================
--- crypttea/trunk/src/crypttea/_common.py 2007-04-18 23:46:47 UTC (rev 285)
+++ crypttea/trunk/src/crypttea/_common.py 2007-04-19 00:33:11 UTC (rev 286)
@@ -208,7 +208,7 @@
fmt = self._endian+"2L"
result = []
if l % bs != 0:
- raise ValueError
+ raise ValueError(l)
for i in range(l/bs):
v = unpack(fmt, block[i*bs:(i+1)*bs])
w = func(v, key, rounds)
Modified: pymoul/trunk/src/moul/crypt/stream.py
===================================================================
--- pymoul/trunk/src/moul/crypt/stream.py 2007-04-18 23:46:47 UTC (rev 285)
+++ pymoul/trunk/src/moul/crypt/stream.py 2007-04-19 00:33:11 UTC (rev 286)
@@ -32,11 +32,10 @@
"""Encrypted stream
"""
magic = 12 * '\x00'
- cipherClass = None
blockSize = 1024
- def __init__(self, fdname, key, **kwargs):
- if isinstane(fdname, basestring):
+ def __init__(self, fdname, cipher):
+ if isinstance(fdname, basestring):
fd = BinaryFile(fdname)
elif isinstance(fdname, BinaryFile):
fd = fdname
@@ -51,22 +50,23 @@
fd.seek(16)
if fsize-16 < self._size:
raise ValueError("Size mismatch %i/%i" % (fsize, self._size))
- self._cipher = self.cipherClass(key, **kwargs)
+ self._cipher = cipher
self._fd = fd
def read(self):
+ fd = self._fd
fd.seek(16)
remain = self._size
bs = self.blockSize
- fd = self._fd
decrypt = self._cipher.decrypt
buf = []
while True:
- if remain == 0:
+ if remain <= 0:
break
+ data = fd.read(bs)
+ data = decrypt(data)
if remain < bs:
- bs = remain
- data = fd.read(bs)
- buf.append(decrypt(data))
+ data = data[:remain]
+ buf.append(data)
+ remain -= bs
return ''.join(buf)
-
Modified: pymoul/trunk/src/moul/file/sdl.py
===================================================================
--- pymoul/trunk/src/moul/file/sdl.py 2007-04-18 23:46:47 UTC (rev 285)
+++ pymoul/trunk/src/moul/file/sdl.py 2007-04-19 00:33:11 UTC (rev 286)
@@ -25,30 +25,30 @@
import re
-class SDLReader(object):
- """Read Python pak
+class SDLParser(object):
+ """Read SDL Files
- >>> mo = SDLReader.comment.match('abc # def # efg')
+ >>> mo = SDLParser.comment.match('abc # def # efg')
>>> mo.group('content')
'abc '
- >>> mo = SDLReader.comment.match('abc')
+ >>> mo = SDLParser.comment.match('abc')
>>> mo.group('content')
'abc'
- >>> mo = SDLReader.comment.match('# abc')
+ >>> mo = SDLParser.comment.match('# abc')
>>> mo.group('content')
''
- >>> mo = SDLReader.statedesc.match('STATEDESC testage')
+ >>> mo = SDLParser.statedesc.match('STATEDESC testage')
>>> mo.group('name')
'testage'
- >>> mo = SDLReader.version.match(' VERSION 5')
+ >>> mo = SDLParser.version.match(' VERSION 5')
>>> mo.group('version')
'5'
- >>> mo = SDLReader.var.search('VAR BOOL testvar[1] DEFAULT=1')
+ >>> mo = SDLParser.var.search('VAR BOOL testvar[1] DEFAULT=1')
>>> mo.group('type')
'BOOL'
>>> mo.group('name')
@@ -60,9 +60,11 @@
statedesc = re.compile("^STATEDESC[ ]+(?P<name>\w+)")
version = re.compile("[ \t]*VERSION[ ]+(?P<version>\d+)")
var = re.compile("VAR[ ]+(?P<type>\w+)[ ]+(?P<name>[$\w]+)\[1\](?P<tail>.*)")
- def __init__(self, fname):
- self._fname = fname
- self._fd = open(fname, 'r')
+ def __init__(self, fdname):
+ if isinstance(fdname, basestring):
+ self._fd = open(fdname, 'r')
+ else:
+ self._fd = fdname
self.states = []
self._parseFile()
@@ -71,7 +73,7 @@
#line = self.comment.match(line).group('content')
mo = self.statedesc.match(line)
if mo:
- self.states.append(mo.group('name')
+ self.states.append(mo.group('name'))
class SDLStates(object):
"""SDL state object
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-04-18 23:46:46
|
Revision: 285
http://pymoul.svn.sourceforge.net/pymoul/?rev=285&view=rev
Author: tiran
Date: 2007-04-18 16:46:47 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Skip dump of pyc file if the same file is already in the directory - uses md5 hash
Modified Paths:
--------------
pymoul/trunk/src/moul/file/pak.py
Modified: pymoul/trunk/src/moul/file/pak.py
===================================================================
--- pymoul/trunk/src/moul/file/pak.py 2007-04-18 21:43:14 UTC (rev 284)
+++ pymoul/trunk/src/moul/file/pak.py 2007-04-18 23:46:47 UTC (rev 285)
@@ -22,6 +22,7 @@
__revision__ = "$Revision: 187 $"
import os
+from hashlib import md5
from moul.crypt.binary import BinaryFile
@@ -48,9 +49,13 @@
self._files[name] = offset
def names():
+ """List all pyc file names
+ """
return self._files.keys()
def getPycFile(self, name):
+ """Extract pyc file
+ """
fd = self._fd
offset = self._files[name]
fd.seek(offset)
@@ -58,15 +63,26 @@
data = fd.read(size)
return self.magic + data
- def dump(self, path, create=False):
- if create:
+ def dump(self, path, create=False, overwrite=True):
+ """Dump all pyc to a directory
+ """
+ if create and not os.path.isdir(path):
os.mkdir(path)
for name in self._files:
- fd = open(os.path.join(path, name), 'wb')
- fd.write(self.getPycFile(name))
+ pyc = self.getPycFile(name)
+ pathname = os.path.join(path, name)
+ if not overwrite and os.path.isfile(pathname):
+ pycmd5 = md5()
+ pycmd5.update(pyc)
+ fmd5 = md5()
+ fmd5.update(open(pathname, 'rb').read())
+ if pycmd5.digest() == fmd5.digest():
+ #print "Equal: %s" % name
+ continue
+ fd = open(pathname, 'wb')
+ fd.write(pyc)
fd.close()
if __name__ == '__main__':
pak = PAKReader('python.pak')
- pak.dump('pyc', True)
-
+ pak.dump('pyc', create=True, overwrite=False)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-04-18 21:43:17
|
Revision: 284
http://pymoul.svn.sourceforge.net/pymoul/?rev=284&view=rev
Author: tiran
Date: 2007-04-18 14:43:14 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Added encrypted stream class
Added Paths:
-----------
pymoul/trunk/src/moul/crypt/stream.py
Added: pymoul/trunk/src/moul/crypt/stream.py
===================================================================
--- pymoul/trunk/src/moul/crypt/stream.py (rev 0)
+++ pymoul/trunk/src/moul/crypt/stream.py 2007-04-18 21:43:14 UTC (rev 284)
@@ -0,0 +1,72 @@
+# pyMoul - Python interface to Myst Online URU Live
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""Encrypted file stream
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id: elf.py 275 2007-03-21 12:39:25Z tiran $"
+__revision__ = "$Revision: 275 $"
+
+import os
+
+from moul.crypt.binary import BinaryFile
+
+class HeaderError(ValueError):
+ pass
+
+class EncryptedStream(object):
+ """Encrypted stream
+ """
+ magic = 12 * '\x00'
+ cipherClass = None
+ blockSize = 1024
+
+ def __init__(self, fdname, key, **kwargs):
+ if isinstane(fdname, basestring):
+ fd = BinaryFile(fdname)
+ elif isinstance(fdname, BinaryFile):
+ fd = fdname
+ else:
+ raise TypeError(fdname)
+ header = fd.read(12)
+ if header != self.magic:
+ HeaderError(header)
+ self._size = fd.read32()
+ fd.seek(0, 2)
+ fsize = fd.tell()
+ fd.seek(16)
+ if fsize-16 < self._size:
+ raise ValueError("Size mismatch %i/%i" % (fsize, self._size))
+ self._cipher = self.cipherClass(key, **kwargs)
+ self._fd = fd
+
+ def read(self):
+ fd.seek(16)
+ remain = self._size
+ bs = self.blockSize
+ fd = self._fd
+ decrypt = self._cipher.decrypt
+ buf = []
+ while True:
+ if remain == 0:
+ break
+ if remain < bs:
+ bs = remain
+ data = fd.read(bs)
+ buf.append(decrypt(data))
+ return ''.join(buf)
+
Property changes on: pymoul/trunk/src/moul/crypt/stream.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-04-16 18:45:32
|
Revision: 283
http://pymoul.svn.sourceforge.net/pymoul/?rev=283&view=rev
Author: tiran
Date: 2007-04-16 11:45:31 -0700 (Mon, 16 Apr 2007)
Log Message:
-----------
Added pak and sdl reader. Fixed Uru String
Modified Paths:
--------------
pymoul/trunk/src/moul/crypt/binary.py
Added Paths:
-----------
pymoul/trunk/src/moul/file/pak.py
pymoul/trunk/src/moul/file/sdl.py
pymoul/trunk/src/moul/file/tests/test_sdl.py
Modified: pymoul/trunk/src/moul/crypt/binary.py
===================================================================
--- pymoul/trunk/src/moul/crypt/binary.py 2007-04-15 22:27:52 UTC (rev 282)
+++ pymoul/trunk/src/moul/crypt/binary.py 2007-04-16 18:45:31 UTC (rev 283)
@@ -102,17 +102,19 @@
if self.version in (0, 5):
size = size & 0x0FFF
if size > 1024: # XXX: ???
- raise ValueError("size '%i' > 1024 at position %s(%s)" %
+ raise ValueError("size '%i' > 1024 at position %s(%s)" %
(size, fd.tell(), repr(fd)))
if self.version == 5:
# XXX: testme
# read data as tuple of integeres
- data = fd.readPacked("<%iI" % size)
+ #data = fd.readPacked("<%iB" % size)
+ data = fd.read(size)
# OR integers with 0xff and write their char equivalent to string
- result = ''.join([chr(d ^ 0xff) for d in data])
+ result = ''.join([chr(ord(d) ^ 0xff) for d in data])
elif self.version == 6:
- data = fd.readPacked("<%iI" % size)
- result = ''.join([chr(d ^ self.MYST5KEY[i%8])
+ #data = fd.readPacked("<%iB" % size)
+ data = fd.read(size)
+ result = ''.join([chr(ord(d) ^ self.MYST5KEY[i%8])
for i, d in enumerate(data)])
else:
result = fd.read(size)
Added: pymoul/trunk/src/moul/file/pak.py
===================================================================
--- pymoul/trunk/src/moul/file/pak.py (rev 0)
+++ pymoul/trunk/src/moul/file/pak.py 2007-04-16 18:45:31 UTC (rev 283)
@@ -0,0 +1,72 @@
+# pyMoul - Python interface to Myst Online URU Live
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""Python PAK reader (for TPOS)
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id: utils.py 187 2007-02-23 16:41:50Z tiran $"
+__revision__ = "$Revision: 187 $"
+
+import os
+
+from moul.crypt.binary import BinaryFile
+
+class PAKReader(object):
+ """Read Python pak
+ """
+ magic = '\x3b\xf2\x0d\x0a\x00\x00\x00\x00'
+
+ def __init__(self, fname):
+ self._fname = fname
+ self._fd = BinaryFile(fname, 'rb')
+ self._files = {}
+ self._parseHeader()
+
+ def _parseHeader(self):
+ """Parse PAK header
+ """
+ fd = self._fd
+ fd.seek(0)
+ count = fd.read32()
+ for i in range(count):
+ name = fd.readUruString() + 'c' # pyc
+ offset = fd.read32()
+ self._files[name] = offset
+
+ def names():
+ return self._files.keys()
+
+ def getPycFile(self, name):
+ fd = self._fd
+ offset = self._files[name]
+ fd.seek(offset)
+ size = fd.read32()
+ data = fd.read(size)
+ return self.magic + data
+
+ def dump(self, path, create=False):
+ if create:
+ os.mkdir(path)
+ for name in self._files:
+ fd = open(os.path.join(path, name), 'wb')
+ fd.write(self.getPycFile(name))
+ fd.close()
+
+if __name__ == '__main__':
+ pak = PAKReader('python.pak')
+ pak.dump('pyc', True)
+
Property changes on: pymoul/trunk/src/moul/file/pak.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: pymoul/trunk/src/moul/file/sdl.py
===================================================================
--- pymoul/trunk/src/moul/file/sdl.py (rev 0)
+++ pymoul/trunk/src/moul/file/sdl.py 2007-04-16 18:45:31 UTC (rev 283)
@@ -0,0 +1,117 @@
+# pyMoul - Python interface to Myst Online URU Live
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""SDL files (for TPOS)
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id: utils.py 187 2007-02-23 16:41:50Z tiran $"
+__revision__ = "$Revision: 187 $"
+
+import os
+import re
+
+
+class SDLReader(object):
+ """Read Python pak
+
+ >>> mo = SDLReader.comment.match('abc # def # efg')
+ >>> mo.group('content')
+ 'abc '
+
+ >>> mo = SDLReader.comment.match('abc')
+ >>> mo.group('content')
+ 'abc'
+
+ >>> mo = SDLReader.comment.match('# abc')
+ >>> mo.group('content')
+ ''
+
+ >>> mo = SDLReader.statedesc.match('STATEDESC testage')
+ >>> mo.group('name')
+ 'testage'
+
+ >>> mo = SDLReader.version.match(' VERSION 5')
+ >>> mo.group('version')
+ '5'
+
+ >>> mo = SDLReader.var.search('VAR BOOL testvar[1] DEFAULT=1')
+ >>> mo.group('type')
+ 'BOOL'
+ >>> mo.group('name')
+ 'testvar'
+ >>> mo.group('tail')
+ ' DEFAULT=1'
+ """
+ comment = re.compile("^(?P<content>[^#]*)") # non greedy match
+ statedesc = re.compile("^STATEDESC[ ]+(?P<name>\w+)")
+ version = re.compile("[ \t]*VERSION[ ]+(?P<version>\d+)")
+ var = re.compile("VAR[ ]+(?P<type>\w+)[ ]+(?P<name>[$\w]+)\[1\](?P<tail>.*)")
+ def __init__(self, fname):
+ self._fname = fname
+ self._fd = open(fname, 'r')
+ self.states = []
+ self._parseFile()
+
+ def _parseFile(self):
+ for line in self._fd:
+ #line = self.comment.match(line).group('content')
+ mo = self.statedesc.match(line)
+ if mo:
+ self.states.append(mo.group('name')
+
+class SDLStates(object):
+ """SDL state object
+ """
+ def __init__(self, name):
+ self._name = name.strip()
+ self._version = None
+ self._vars = []
+
+ def _getVersion(self):
+ return self._version
+ def _setVersion(self, version):
+ self._version = int(version)
+ version = property(_getVersion, _setVersion)
+
+ @property
+ def id(self):
+ return "%s:%i" % (self.name, self.version)
+
+ @property
+ def name(self):
+ return self._name
+
+ def addVarTail(self, name, typ, tail):
+ elements = [el.strip() for el in tail.split('=')]
+ kwargs = {}
+ for name in ('DEFAULT', 'DEFAULTOPTION', 'DISPLAYOPTION'):
+ idx = elements.index(name)
+ if idx > -1:
+ kwargs[name.lower()] = elements[idx+1]
+ sdl = SDLVar(name, typ, **kwargs)
+ self._vars.append(sdl)
+
+class SDLVar(object):
+ """SDL variable
+ """
+ def __init__(self, name, typ, default=None, defaultoption=None,
+ displayoption=None):
+ self._name = name
+ self._typ = typ
+ self._default = default
+ self._defaultoption = defaultoption
+ self._displayoption = displayoption
Property changes on: pymoul/trunk/src/moul/file/sdl.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: pymoul/trunk/src/moul/file/tests/test_sdl.py
===================================================================
--- pymoul/trunk/src/moul/file/tests/test_sdl.py (rev 0)
+++ pymoul/trunk/src/moul/file/tests/test_sdl.py 2007-04-16 18:45:31 UTC (rev 283)
@@ -0,0 +1,34 @@
+# pyMoul - Python interface to Myst Online URU Live
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""moul.file.sdl unit tests
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id: test_plasmalog.py 140 2007-02-05 14:51:30Z tiran $"
+__revision__ = "$Revision: 140 $"
+
+import os
+import unittest
+from doctest import DocTestSuite
+
+def test_suite():
+ return unittest.TestSuite((
+ DocTestSuite('moul.file.sdl')
+ ))
+
+if __name__ == '__main__':
+ unittest.main(defaultTest="test_suite")
Property changes on: pymoul/trunk/src/moul/file/tests/test_sdl.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-04-15 22:27:52
|
Revision: 282
http://pymoul.svn.sourceforge.net/pymoul/?rev=282&view=rev
Author: tiran
Date: 2007-04-15 15:27:52 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
Added Payiferen and Tetsonot
Modified Paths:
--------------
pymoul/trunk/src/moul/time/podage.py
Modified: pymoul/trunk/src/moul/time/podage.py
===================================================================
--- pymoul/trunk/src/moul/time/podage.py 2007-04-15 13:01:05 UTC (rev 281)
+++ pymoul/trunk/src/moul/time/podage.py 2007-04-15 22:27:52 UTC (rev 282)
@@ -58,10 +58,7 @@
PODDAY_SEC = 13 * PAHRTAHVO_SEC
PODDAY_TD = timedelta(seconds=PODDAY_SEC)
# base datetime for calculations
-#BASE_DT = datetime(2007, 3, 4, 10, 16, 0, tzinfo=UTC)
-# XXX Uru's main game server is off 3min 35sec
-BASE_DT = datetime(2007, 3, 7, 1, 7, 0, tzinfo=UTC)
-#BASE_DT = datetime(2007, 3, 7, 1, 10, 9, tzinfo=UTC)
+BASE_DT = datetime(2007, 4, 16, 1, 45, 15, tzinfo=UTC)
class PodAgeRegistry(dict):
"""Registry for pod ages
@@ -85,7 +82,7 @@
return dict.__delitem__(self, key)
def register(self, pod):
- if pod.gatenumber < 0:
+ if pod.gatenumber is None:
return False
self[pod.name] = pod
@@ -188,7 +185,7 @@
@return: Iterator that yields (number, date)
@rtype: iterator (int, datetime)
"""
- dt = self._base #+ PODDAY_TD
+ dt = self._base - 3*PODDAY_TD
n = 0
while True:
yield (n, dt)
@@ -199,15 +196,28 @@
registerPodAge(PodAgeInformation(
name = 'Negilahn',
gatenumber = 18,
- offset = 0, # Pahrtahvotee
+ offset = -1.49, # Pahrtahvotee
))
registerPodAge(PodAgeInformation(
name = 'Dereno',
gatenumber = 25,
- offset = 1, # Pahrtahvo
+ offset = -0.46, # Pahrtahvo
))
+registerPodAge(PodAgeInformation(
+ name = 'Payiferen',
+ gatenumber = 13,
+ offset = 0, # Pahrtahvo
+ ))
+
+registerPodAge(PodAgeInformation(
+ name = 'Tetsonot',
+ gatenumber = None,
+ offset = 0, # Pahrtahvotee
+ ))
+
+
from moul.time.dni import DniTime
from moul.time.utils import normalizeTZ
@@ -293,8 +303,9 @@
fd.close()
if __name__ == '__main__':
- #forumTimeTable(tzlist=('CET',))
+ forumTimeTable(tzlist=('CET',))
#forumTimeTable(tzlist=('UTC',))
- forumTimeTable(tzlist=('US/Pacific',))
+ #forumTimeTable(tzlist=('US/Pacific',))
#forumTimeTable()
#allTzList()
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-04-15 13:01:07
|
Revision: 281
http://pymoul.svn.sourceforge.net/pymoul/?rev=281&view=rev
Author: tiran
Date: 2007-04-15 06:01:05 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
Fixed small bugs
Added btea algorithm
Modified Paths:
--------------
crypttea/trunk/setup.py
crypttea/trunk/src/crypttea/__init__.py
crypttea/trunk/src/crypttea/_pyxtea.c
crypttea/trunk/src/crypttea/_pyxtea.pyx
crypttea/trunk/src/crypttea/ctea.c
crypttea/trunk/src/crypttea/ctea.h
crypttea/trunk/src/crypttea/xxtea.py
crypttea/trunk/src/crypttea.egg-info/PKG-INFO
crypttea/trunk/src/crypttea.egg-info/SOURCES.txt
crypttea/trunk/src/crypttea.egg-info/top_level.txt
Added Paths:
-----------
crypttea/trunk/src/crypttea/btea.py
Modified: crypttea/trunk/setup.py
===================================================================
--- crypttea/trunk/setup.py 2007-03-26 07:01:58 UTC (rev 280)
+++ crypttea/trunk/setup.py 2007-04-15 13:01:05 UTC (rev 281)
@@ -23,13 +23,12 @@
from setuptools import find_packages
from setuptools import Extension
-from distutils.core import setup
-
VERSION = "0.1"
me = "Christian Heimes"
email = "chr...@ch..."
+from setuptools import Extension
cxtea = Extension('crypttea._pyxtea',
['src/crypttea/_pyxtea.pyx', 'src/crypttea/ctea.c']
)
Modified: crypttea/trunk/src/crypttea/__init__.py
===================================================================
--- crypttea/trunk/src/crypttea/__init__.py 2007-03-26 07:01:58 UTC (rev 280)
+++ crypttea/trunk/src/crypttea/__init__.py 2007-04-15 13:01:05 UTC (rev 281)
@@ -26,6 +26,7 @@
# POSSIBILITY OF SUCH DAMAGE.
"""TEA, XTEA and XXTEA cipher package
"""
+from crypttea.btea import BTEA
from crypttea.tea import TEA
from crypttea.xtea import XTEA
from crypttea.xxtea import XXTEA
Modified: crypttea/trunk/src/crypttea/_pyxtea.c
===================================================================
--- crypttea/trunk/src/crypttea/_pyxtea.c 2007-03-26 07:01:58 UTC (rev 280)
+++ crypttea/trunk/src/crypttea/_pyxtea.c 2007-04-15 13:01:05 UTC (rev 281)
@@ -1,4 +1,4 @@
-/* Generated by Pyrex 0.9.5.1a on Mon Mar 5 02:36:03 2007 */
+/* Generated by Pyrex 0.9.5.1a on Sun Apr 15 14:56:10 2007 */
#include "Python.h"
#include "structmember.h"
@@ -42,6 +42,8 @@
/* Implementation of _pyxtea */
+static PyObject *__pyx_n__c_btea_encrypt;
+static PyObject *__pyx_n__c_btea_decrypt;
static PyObject *__pyx_n__c_tea_encrypt;
static PyObject *__pyx_n__c_tea_decrypt;
static PyObject *__pyx_n__c_xtea_encrypt;
@@ -49,6 +51,170 @@
static PyObject *__pyx_n__c_xxtea_encrypt;
static PyObject *__pyx_n__c_xxtea_decrypt;
+static PyObject *__pyx_n_NotImplementedError;
+
+static PyObject *__pyx_f_7_pyxtea__c_btea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_7_pyxtea__c_btea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_block = 0;
+ PyObject *__pyx_v_key = 0;
+ unsigned int __pyx_v_rounds;
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ static char *__pyx_argnames[] = {"block","key","rounds",0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
+ Py_INCREF(__pyx_v_block);
+ Py_INCREF(__pyx_v_key);
+
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":53 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_NotImplementedError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
+ __Pyx_Raise(__pyx_1, 0, 0);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ __Pyx_AddTraceback("_pyxtea._c_btea_encrypt");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_block);
+ Py_DECREF(__pyx_v_key);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_n_ValueError;
+static PyObject *__pyx_n_rounds;
+
+
+static PyObject *__pyx_f_7_pyxtea__c_btea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_7_pyxtea__c_btea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_block = 0;
+ PyObject *__pyx_v_key = 0;
+ unsigned int __pyx_v_rounds;
+ unsigned long (__pyx_v_v[2]);
+ unsigned long (__pyx_v_k[4]);
+ PyObject *__pyx_v_rc;
+ PyObject *__pyx_v_result;
+ PyObject *__pyx_r;
+ int __pyx_1;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ unsigned long __pyx_5;
+ static char *__pyx_argnames[] = {"block","key","rounds",0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
+ Py_INCREF(__pyx_v_block);
+ Py_INCREF(__pyx_v_key);
+ __pyx_v_rc = Py_None; Py_INCREF(Py_None);
+ __pyx_v_result = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":58 */
+ __pyx_1 = (__pyx_v_rounds != 2);
+ if (__pyx_1) {
+
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":59 */
+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_INCREF(__pyx_n_rounds);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_n_rounds);
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __Pyx_Raise(__pyx_4, 0, 0);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":60 */
+ __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetItem(__pyx_v_block, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_5 = PyInt_AsUnsignedLongMask(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ (__pyx_v_v[0]) = __pyx_5;
+
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":60 */
+ __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_5 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[1]) = __pyx_5;
+
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":61 */
+ __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_5 = PyInt_AsUnsignedLongMask(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ (__pyx_v_k[0]) = __pyx_5;
+
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":61 */
+ __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetItem(__pyx_v_key, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_5 = PyInt_AsUnsignedLongMask(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ (__pyx_v_k[1]) = __pyx_5;
+
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":61 */
+ __pyx_4 = PyInt_FromLong(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_5 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[2]) = __pyx_5;
+
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":61 */
+ __pyx_3 = PyInt_FromLong(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_5 = PyInt_AsUnsignedLongMask(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ (__pyx_v_k[3]) = __pyx_5;
+
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":62 */
+ __pyx_2 = PyInt_FromLong(btea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_rc);
+ __pyx_v_rc = __pyx_2;
+ __pyx_2 = 0;
+
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":63 */
+ __pyx_3 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
+ __pyx_4 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
+ __pyx_2 = PyList_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
+ PyList_SET_ITEM(__pyx_2, 0, __pyx_3);
+ PyList_SET_ITEM(__pyx_2, 1, __pyx_4);
+ __pyx_3 = 0;
+ __pyx_4 = 0;
+ Py_DECREF(__pyx_v_result);
+ __pyx_v_result = __pyx_2;
+ __pyx_2 = 0;
+
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":64 */
+ Py_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("_pyxtea._c_btea_decrypt");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_rc);
+ Py_DECREF(__pyx_v_result);
+ Py_DECREF(__pyx_v_block);
+ Py_DECREF(__pyx_v_key);
+ return __pyx_r;
+}
+
static PyObject *__pyx_f_7_pyxtea__c_tea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_7_pyxtea__c_tea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_block = 0;
@@ -70,64 +236,64 @@
__pyx_v_rc = Py_None; Py_INCREF(Py_None);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":53 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":70 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":53 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":70 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":54 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":71 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":54 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":71 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":54 */
- __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":71 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[2]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":54 */
- __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":71 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[3]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":55 */
- __pyx_1 = PyInt_FromLong(tea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":72 */
+ __pyx_1 = PyInt_FromLong(tea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
Py_DECREF(__pyx_v_rc);
__pyx_v_rc = __pyx_1;
__pyx_1 = 0;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":56 */
- __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; goto __pyx_L1;}
- __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; goto __pyx_L1;}
- __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":73 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
__pyx_2 = 0;
@@ -136,7 +302,7 @@
__pyx_v_result = __pyx_4;
__pyx_4 = 0;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":57 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":74 */
Py_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L0;
@@ -178,64 +344,64 @@
__pyx_v_rc = Py_None; Py_INCREF(Py_None);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":62 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":79 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":62 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":79 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":63 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":80 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":63 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":80 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":63 */
- __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":80 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[2]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":63 */
- __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":80 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[3]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":64 */
- __pyx_1 = PyInt_FromLong(tea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":81 */
+ __pyx_1 = PyInt_FromLong(tea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
Py_DECREF(__pyx_v_rc);
__pyx_v_rc = __pyx_1;
__pyx_1 = 0;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":65 */
- __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; goto __pyx_L1;}
- __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; goto __pyx_L1;}
- __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":82 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
__pyx_2 = 0;
@@ -244,7 +410,7 @@
__pyx_v_result = __pyx_4;
__pyx_4 = 0;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":66 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":83 */
Py_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L0;
@@ -286,64 +452,64 @@
__pyx_v_rc = Py_None; Py_INCREF(Py_None);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":72 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":89 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":72 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":89 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":73 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":90 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":73 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":90 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":73 */
- __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":90 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[2]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":73 */
- __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":90 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[3]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":74 */
- __pyx_1 = PyInt_FromLong(xtea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":91 */
+ __pyx_1 = PyInt_FromLong(xtea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
Py_DECREF(__pyx_v_rc);
__pyx_v_rc = __pyx_1;
__pyx_1 = 0;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":75 */
- __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
- __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
- __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":92 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
__pyx_2 = 0;
@@ -352,7 +518,7 @@
__pyx_v_result = __pyx_4;
__pyx_4 = 0;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":76 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":93 */
Py_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L0;
@@ -394,64 +560,64 @@
__pyx_v_rc = Py_None; Py_INCREF(Py_None);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":81 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":98 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":81 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":98 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":82 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":99 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":82 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":99 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":82 */
- __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":99 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[2]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":82 */
- __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":99 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[3]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":83 */
- __pyx_1 = PyInt_FromLong(xtea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":100 */
+ __pyx_1 = PyInt_FromLong(xtea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L1;}
Py_DECREF(__pyx_v_rc);
__pyx_v_rc = __pyx_1;
__pyx_1 = 0;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":84 */
- __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
- __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
- __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":101 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L1;}
PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
__pyx_2 = 0;
@@ -460,7 +626,7 @@
__pyx_v_result = __pyx_4;
__pyx_4 = 0;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":85 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":102 */
Py_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L0;
@@ -482,12 +648,11 @@
}
static PyObject *__pyx_n_len;
-static PyObject *__pyx_n_ValueError;
static PyObject *__pyx_n_append;
-static PyObject *__pyx_k1p;
+static PyObject *__pyx_k2p;
-static char (__pyx_k1[]) = "len(block) %i != rounds %i";
+static char (__pyx_k2[]) = "len(block) %i != rounds %i";
static PyObject *__pyx_f_7_pyxtea__c_xxtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_7_pyxtea__c_xxtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
@@ -513,116 +678,116 @@
Py_INCREF(__pyx_v_key);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":91 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":108 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
Py_INCREF(__pyx_v_block);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_block);
- __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
- __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
+ __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_v_size = __pyx_4;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":92 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":109 */
__pyx_4 = (__pyx_v_size != __pyx_v_rounds);
if (__pyx_4) {
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":93 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
- __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
- __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_rounds); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
- __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":110 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
+ __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
+ __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_rounds); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
__pyx_2 = 0;
__pyx_3 = 0;
- __pyx_2 = PyNumber_Remainder(__pyx_k1p, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
+ __pyx_2 = PyNumber_Remainder(__pyx_k2p, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
__Pyx_Raise(__pyx_1, __pyx_2, 0);
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
goto __pyx_L2;
}
__pyx_L2:;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":94 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":111 */
__pyx_v_v = ((unsigned long (*))malloc(((sizeof(unsigned long )) * __pyx_v_size)));
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":95 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":112 */
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":96 */
- __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L1;}
- __pyx_5 = PyObject_GetItem(__pyx_v_block, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":113 */
+ __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_block, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L1;}
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
(__pyx_v_v[__pyx_v_i]) = __pyx_6;
}
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":97 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":114 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[0]) = __pyx_6;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":97 */
- __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
- __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":114 */
+ __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
(__pyx_v_k[1]) = __pyx_6;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":97 */
- __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":114 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[2]) = __pyx_6;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":97 */
- __pyx_3 = PyInt_FromLong(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
- __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":114 */
+ __pyx_3 = PyInt_FromLong(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
(__pyx_v_k[3]) = __pyx_6;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":98 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":115 */
__pyx_v_rc = xxtea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds);
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":99 */
- __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":116 */
+ __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}
Py_DECREF(__pyx_v_result);
__pyx_v_result = __pyx_1;
__pyx_1 = 0;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":100 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":117 */
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":101 */
- __pyx_2 = PyObject_GetAttr(__pyx_v_result, __pyx_n_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L1;}
- __pyx_3 = PyLong_FromUnsignedLong((__pyx_v_v[__pyx_v_i])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L1;}
- __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":118 */
+ __pyx_2 = PyObject_GetAttr(__pyx_v_result, __pyx_n_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; goto __pyx_L1;}
+ __pyx_3 = PyLong_FromUnsignedLong((__pyx_v_v[__pyx_v_i])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
__pyx_3 = 0;
- __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L1;}
+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_5); __pyx_5 = 0;
Py_DECREF(__pyx_1); __pyx_1 = 0;
}
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":102 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":119 */
free(__pyx_v_v);
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":103 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":120 */
Py_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L0;
@@ -643,9 +808,9 @@
return __pyx_r;
}
-static PyObject *__pyx_k2p;
+static PyObject *__pyx_k3p;
-static char (__pyx_k2[]) = "len(block) %i != rounds %i";
+static char (__pyx_k3[]) = "len(block) %i != rounds %i";
static PyObject *__pyx_f_7_pyxtea__c_xxtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_7_pyxtea__c_xxtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
@@ -671,116 +836,116 @@
Py_INCREF(__pyx_v_key);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":108 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":125 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
Py_INCREF(__pyx_v_block);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_block);
- __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
- __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
+ __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_v_size = __pyx_4;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":109 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":126 */
__pyx_4 = (__pyx_v_size != __pyx_v_rounds);
if (__pyx_4) {
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":110 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
- __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
- __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_rounds); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
- __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":127 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
+ __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
+ __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_rounds); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
__pyx_2 = 0;
__pyx_3 = 0;
- __pyx_2 = PyNumber_Remainder(__pyx_k2p, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
+ __pyx_2 = PyNumber_Remainder(__pyx_k3p, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
__Pyx_Raise(__pyx_1, __pyx_2, 0);
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
goto __pyx_L2;
}
__pyx_L2:;
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":111 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":128 */
__pyx_v_v = ((unsigned long (*))malloc(((sizeof(unsigned long )) * __pyx_v_size)));
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":112 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":129 */
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":113 */
- __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; goto __pyx_L1;}
- __pyx_5 = PyObject_GetItem(__pyx_v_block, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":130 */
+ __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_block, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; goto __pyx_L1;}
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
(__pyx_v_v[__pyx_v_i]) = __pyx_6;
}
- /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":114 */
- __pyx_...
[truncated message content] |
|
From: <ti...@us...> - 2007-03-26 07:01:59
|
Revision: 280
http://pymoul.svn.sourceforge.net/pymoul/?rev=280&view=rev
Author: tiran
Date: 2007-03-26 00:01:58 -0700 (Mon, 26 Mar 2007)
Log Message:
-----------
Added HTML table creator for podage lists
Modified Paths:
--------------
pymoul/trunk/src/moul/time/podage.py
Modified: pymoul/trunk/src/moul/time/podage.py
===================================================================
--- pymoul/trunk/src/moul/time/podage.py 2007-03-25 17:55:31 UTC (rev 279)
+++ pymoul/trunk/src/moul/time/podage.py 2007-03-26 07:01:58 UTC (rev 280)
@@ -126,6 +126,10 @@
else:
dict.__getattribute__(self, name)
+ def __str__(self):
+ return ("%s (gate: %i, offset: %0.2f Pahrtahvotee)" %
+ (self['name'], self['gatenumber'], self['offset']))
+
class PodAgeTime(object):
"""A pod age day cycle and gate event timer
"""
@@ -207,32 +211,49 @@
from moul.time.dni import DniTime
from moul.time.utils import normalizeTZ
+def _createTimeList(limit):
+ data = {}
+ for name in listPodAges():
+ age = getPodAge(name)
+ pat = PodAgeTime(name)
+ agedata = data[name] = {}
+ dts = agedata['dt'] = []
+ dnis = agedata['dni'] = []
+ agedata['age'] = age
+ for n, dt in iter(pat):
+ if n > limit:
+ break
+ dnis.append(DniTime.fromUTC(dt))
+ dts.append(dt)
+ return data
+
def forumTimeTable(limit=5, fmt="%Y-%m-%d %H:%M:%S %Z", tzlist=('UTC', 'CET',
'US/Mountain', 'US/Pacific', 'US/Eastern',
'Australia/Sydney')):
"""Small utility function to create a nice list for the forum
"""
+ data = _createTimeList(limit)
for tz in tzlist:
print "[spoiler=%s]" % tz
- for age in listPodAges():
- pat = PodAgeTime(age)
- print
+ for name in listPodAges():
+ agedata = data[name]
+ age = agedata['age']
print age
- print 20 * "-"
- for n, dt in iter(pat):
- if n > limit:
- break
+ print 50 * "-"
+ for dt, dni in zip(agedata['dt'], agedata['dni']):
#dni = DniTime.fromUTC(dt)
ldt = normalizeTZ(tz, dt)
print ldt.strftime(fmt)
#print "Earth: %s, D'ni: %s, %i" % (ldt.strftime(fmt),
# str(dni), dni.pahrtahvo)
+ print
print "[/spoiler]"
def allTzList(limit=50, fmt="%Y-%m-%d %H:%M %Z"):
"""Small utility function to create a nice list for the forum
"""
from pytz import common_timezones
+ data = _createTimeList(limit)
base = os.path.join(os.path.dirname(__file__), 'out')
if not os.path.isdir(base):
os.mkdir(base)
@@ -241,24 +262,34 @@
if continent not in ('UTC', 'US', 'Australia', 'Europe', 'America'):
continue
tzname = tz.replace('/', '_')
- fd = open(os.path.join(base, "%s.html" % tzname), 'w')
- print >>fd, "<html><head><title>%s</title></head><body><pre>" % tz
+ fd = open(os.path.join(base, "%s.html" % tzname), 'w', 16*1024)
+ print >>fd, "<html><head><title>%s</title></head><body><table border='1'>" % tz
print tzname
- for age in listPodAges():
- pat = PodAgeTime(age)
- print >>fd
- print >>fd, age
- print >>fd, 20*"-"
- for n, dt in iter(pat):
- if n > limit:
- break
+ th = []
+ tr = []
+ for i in range(limit):
+ tr.append([])
+ for name in listPodAges():
+ agedata = data[name]
+ #th.append(str(agedata['age']))
+ th.append(name)
+ for i in range(limit):
#dni = DniTime.fromUTC(dt)
+ dt = agedata['dt'][i]
ldt = normalizeTZ(tz, dt)
- #print >>fd, "Earth: %s, D'ni: %s, %i" % (ldt.strftime(fmt),
+ tr[i].append(ldt.strftime(fmt))
+ #print "Earth: %s, D'ni: %s, %i" % (ldt.strftime(fmt),
# str(dni), dni.pahrtahvo)
- print >>fd, ldt.strftime(fmt)
- print >>fd, "\n"
- print >>fd, "</pre></body></html>"
+ print >>fd, "<tr>"
+ for td in th:
+ print >>fd, "<td>%s</td>" % td
+ print >>fd, "</tr>"
+ for row in tr:
+ print >>fd, "<tr>"
+ for d in row:
+ print >>fd, "<td>%s</td>" % d
+ print >>fd, "</tr>"
+ print >>fd, "</table></body></html>"
fd.close()
if __name__ == '__main__':
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-25 17:55:35
|
Revision: 279
http://pymoul.svn.sourceforge.net/pymoul/?rev=279&view=rev
Author: tiran
Date: 2007-03-25 10:55:31 -0700 (Sun, 25 Mar 2007)
Log Message:
-----------
Updated pod age code
Modified Paths:
--------------
pymoul/trunk/Makefile.in
pymoul/trunk/src/moul/time/podage.py
Modified: pymoul/trunk/Makefile.in
===================================================================
--- pymoul/trunk/Makefile.in 2007-03-23 17:40:11 UTC (rev 278)
+++ pymoul/trunk/Makefile.in 2007-03-25 17:55:31 UTC (rev 279)
@@ -103,5 +103,8 @@
serverlist:
PYTHONPATH="src" $(PYTHON) src/moul/server/serverlist.py
+podage:
+ PYTHONPATH="src" $(PYTHON) src/moul/time/podage.py
+
infrastructure: clean inplace ui languages xxxreport propset fixlineendings doc_html serverlist
Modified: pymoul/trunk/src/moul/time/podage.py
===================================================================
--- pymoul/trunk/src/moul/time/podage.py 2007-03-23 17:40:11 UTC (rev 278)
+++ pymoul/trunk/src/moul/time/podage.py 2007-03-25 17:55:31 UTC (rev 279)
@@ -101,7 +101,12 @@
registerPodAge = _podRegistry.register
def listPodAges():
- return [name for name in _podRegistry if name]
+ """List pod ages sorted by offset
+ """
+ dec = [(age.offset, name)
+ for name, age in _podRegistry.items() if name]
+ dec.sort()
+ return [v[1] for v in dec]
class PodAgeInformation(dict):
"""Information about a pod age
@@ -113,6 +118,7 @@
for key in ('name', 'gatenumber', 'offset'):
if key not in self:
raise KeyError(key)
+ self['offset_td'] = timedelta(seconds=self['offset']*PAHRTAHVO_SEC)
def __getattribute__(self, name):
if name in self:
@@ -155,7 +161,7 @@
"""
if startdt is None:
startdt = utcnow()
- base_dt = BASE_DT + self._age.offset
+ base_dt = BASE_DT + self._age.offset_td
# calculate completed cycles since base_dt
sec = td2sec(startdt - base_dt)
cycles = floor(sec / PODDAY_SEC)
@@ -178,7 +184,7 @@
@return: Iterator that yields (number, date)
@rtype: iterator (int, datetime)
"""
- dt = self._base + PODDAY_TD
+ dt = self._base #+ PODDAY_TD
n = 0
while True:
yield (n, dt)
@@ -187,34 +193,21 @@
# pod ages
registerPodAge(PodAgeInformation(
- name = 'Dereno',
- gatenumber = 25,
- offset = timedelta(seconds=1*PAHRTAHVO_SEC)
- ))
-
-registerPodAge(PodAgeInformation(
name = 'Negilahn',
gatenumber = 18,
- offset = timedelta(seconds=0)
+ offset = 0, # Pahrtahvotee
))
registerPodAge(PodAgeInformation(
- name = 'Payiferen',
- gatenumber = -1,
- offset = timedelta(seconds=-1)
+ name = 'Dereno',
+ gatenumber = 25,
+ offset = 1, # Pahrtahvo
))
-registerPodAge(PodAgeInformation(
- name = 'Tetsonot',
- gatenumber = -1,
- offset = timedelta(seconds=-1)
- ))
-
-
from moul.time.dni import DniTime
from moul.time.utils import normalizeTZ
-def forumTimeTable(limit=10, fmt="%Y-%m-%d %H:%M:%S %Z", tzlist=('UTC', 'CET',
+def forumTimeTable(limit=5, fmt="%Y-%m-%d %H:%M:%S %Z", tzlist=('UTC', 'CET',
'US/Mountain', 'US/Pacific', 'US/Eastern',
'Australia/Sydney')):
"""Small utility function to create a nice list for the forum
@@ -223,18 +216,20 @@
print "[spoiler=%s]" % tz
for age in listPodAges():
pat = PodAgeTime(age)
+ print
print age
- print "--------------------------------------------------------------------"
+ print 20 * "-"
for n, dt in iter(pat):
if n > limit:
break
- dni = DniTime.fromUTC(dt)
+ #dni = DniTime.fromUTC(dt)
ldt = normalizeTZ(tz, dt)
- print "Earth: %s, D'ni: %s, %i" % (ldt.strftime(fmt),
- str(dni), dni.pahrtahvo)
+ print ldt.strftime(fmt)
+ #print "Earth: %s, D'ni: %s, %i" % (ldt.strftime(fmt),
+ # str(dni), dni.pahrtahvo)
print "[/spoiler]"
-def allTzList(limit=50, fmt="%Y-%m-%d %H:%M:%S %Z"):
+def allTzList(limit=50, fmt="%Y-%m-%d %H:%M %Z"):
"""Small utility function to create a nice list for the forum
"""
from pytz import common_timezones
@@ -251,8 +246,9 @@
print tzname
for age in listPodAges():
pat = PodAgeTime(age)
+ print >>fd
print >>fd, age
- print >>fd, "--------------------------------------------------------------------"
+ print >>fd, 20*"-"
for n, dt in iter(pat):
if n > limit:
break
@@ -266,5 +262,8 @@
fd.close()
if __name__ == '__main__':
- forumTimeTable(tzlist=('UTC',))
+ #forumTimeTable(tzlist=('CET',))
+ #forumTimeTable(tzlist=('UTC',))
+ forumTimeTable(tzlist=('US/Pacific',))
+ #forumTimeTable()
#allTzList()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-23 17:40:10
|
Revision: 278
http://pymoul.svn.sourceforge.net/pymoul/?rev=278&view=rev
Author: tiran
Date: 2007-03-23 10:40:11 -0700 (Fri, 23 Mar 2007)
Log Message:
-----------
Merge r277:276 setup.py
Backmerge to fix erroneous checkin. Next time please check with svn st and svn diff before you commit
Modified Paths:
--------------
pymoul/trunk/setup.py
Modified: pymoul/trunk/setup.py
===================================================================
--- pymoul/trunk/setup.py 2007-03-23 00:50:23 UTC (rev 277)
+++ pymoul/trunk/setup.py 2007-03-23 17:40:11 UTC (rev 278)
@@ -1,19 +1,121 @@
-"""
-This is a setup.py script generated by py2applet
+#!/usr/bin/env python2.5
+"""pyMoul: Python tools for Myst Online - URU Live (MOUL)
-Usage:
- python setup.py py2app
+TODO: Long description of pyMoul
"""
+__author__ = "Christian Heimes"
+__version__ = "$Id$"
+__revision__ = "$Revision$"
+import sys
+import os
+import time
+from glob import glob
+
+if sys.version_info < (2,5):
+ raise RuntimeError("Python 2.5+ required:\n%s" % sys.version)
+
+# boot strap easy setup
+SETUPTOOLS_VERSION = "0.6c1"
+from utilities.ez_setup import use_setuptools
+use_setuptools(version=SETUPTOOLS_VERSION)
+
+# import the rest
from setuptools import setup
+from setuptools import find_packages
+from setuptools import Extension
-APP = ['src/moul/qt/moulqt.py']
-DATA_FILES = []
-OPTIONS = {'argv_emulation': True}
+from utilities.compileui import compileUi
-setup(
- app=APP,
- data_files=DATA_FILES,
- options={'py2app': OPTIONS},
- setup_requires=['py2app'],
+VERSION = "0.0"
+
+ctea = Extension('crypttea._pyxtea',
+ ['src/crypttea/_pyxtea.pyx', 'src/crypttea/ctea.c']
+ )
+ext_modules = [ctea]
+#if os.name == 'posix':
+# ext_modules.append(ctea)
+
+setup_infos = dict(
+ name = "pyMoul",
+ version = VERSION,
+ description = __doc__[:__doc__.find('\n')].strip(),
+ long_description = '\n'.join([line
+ for line in __doc__.split('\n')[1:]]),
+ author = "Christian Heimes",
+ author_email = "chr...@ch...",
+ url = "http://sourceforge.net/projects/pymoul/",
+ #download_url = "http://sourceforge.net/projects/pymoul/",
+ license = "GPL",
+ keywords = "myst online uru live moul cyan",
+ classifiers = (
+ 'Development Status :: 2 - Alpha',
+ 'Environment :: Win32 (MS Windows)',
+ 'Intended Audience :: End Users/Desktop',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: GNU General Public License (GPL)',
+ 'Natural Language :: English',
+ 'Operating System :: Microsoft :: Windows',
+ 'Operating System :: POSIX',
+ 'Programming Language :: Python',
+ 'Topic :: Games/Entertainment :: Multi-User Dungeons (MUD)',
+ ),
)
+
+setup_options = dict(
+ setup_requires = ["setuptools>="+SETUPTOOLS_VERSION,],
+ install_requires = ["pytz>=2006p"],
+ data_files = [
+ ('docs', list(glob('*.txt'))),
+ ('i18n', list(glob('src/moul/qt/i18n/pymoul_*.qm'))),
+ ],
+ package_dir = {'' : 'src'},
+ packages = find_packages('src', exclude="moul.qt"),
+ include_package_data = True,
+ zip_safe = False,
+ namespace_packages = ['moul'],
+ ext_modules = ext_modules,
+)
+
+def writeMetadata():
+ dirname = os.path.dirname(__file__)
+ ver = os.path.join(dirname, 'version.txt')
+ open(ver, 'w').write(VERSION)
+ meta = os.path.join(dirname, 'src', 'moul', 'metadata.py')
+ fd = open(meta, 'w')
+ fd.write("# pyMoul metadata informations\n")
+ fd.write("# THIS FILE IS AUTO GENERATED. DO NOT ALTER!\n\n")
+ fd.write("__version__ = '%s'\n\n" % VERSION)
+ for name, value in setup_infos.items():
+ if not isinstance(value, basestring):
+ continue
+ fd.write("%s = '''%s'''\n" % (name, value))
+ fd.write("\nREADME = '''%s'''\n" % open('README.txt', 'r').read())
+ fd.write("\nLICENSE = '''%s'''\n" % open('GPL.txt', 'r').read())
+ fd.close()
+
+###
+# Write Metadata and compile UI files
+writeMetadata()
+compileUi()
+
+kwargs = {}
+kwargs.update(setup_infos)
+kwargs.update(setup_options)
+
+# Do some windows stuff
+_plat = sys.platform.startswith
+if _plat('win32'):
+ from utilities.setup_win32 import updateSetupOptions
+ from utilities.setup_win32 import updateSetupOptionsQT
+ updateSetupOptions(kwargs)
+ updateSetupOptionsQT(kwargs)
+elif _plat('darwin'):
+ from utilities.setup_darwin import updateSetupOptions
+ updateSetupOptions(kwargs)
+elif _plat('linux2'):
+ kwargs['packages'].append('moul.qt')
+else:
+ raise OSError(sys.platform)
+
+setup(**kwargs)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wal...@us...> - 2007-03-23 01:31:19
|
Revision: 277
http://pymoul.svn.sourceforge.net/pymoul/?rev=277&view=rev
Author: walt_scrivens
Date: 2007-03-22 17:50:23 -0700 (Thu, 22 Mar 2007)
Log Message:
-----------
Corrected MOUL_DIR in darwin/__init__.py
Modified Paths:
--------------
pymoul/trunk/setup.py
pymoul/trunk/src/moul/osdependent/darwin/__init__.py
pymoul/trunk/src/moul/qt/ui/mainwindow.py
Modified: pymoul/trunk/setup.py
===================================================================
--- pymoul/trunk/setup.py 2007-03-22 18:58:49 UTC (rev 276)
+++ pymoul/trunk/setup.py 2007-03-23 00:50:23 UTC (rev 277)
@@ -1,121 +1,19 @@
-#!/usr/bin/env python2.5
-"""pyMoul: Python tools for Myst Online - URU Live (MOUL)
+"""
+This is a setup.py script generated by py2applet
-TODO: Long description of pyMoul
+Usage:
+ python setup.py py2app
"""
-__author__ = "Christian Heimes"
-__version__ = "$Id$"
-__revision__ = "$Revision$"
-import sys
-import os
-import time
-from glob import glob
-
-if sys.version_info < (2,5):
- raise RuntimeError("Python 2.5+ required:\n%s" % sys.version)
-
-# boot strap easy setup
-SETUPTOOLS_VERSION = "0.6c1"
-from utilities.ez_setup import use_setuptools
-use_setuptools(version=SETUPTOOLS_VERSION)
-
-# import the rest
from setuptools import setup
-from setuptools import find_packages
-from setuptools import Extension
-from utilities.compileui import compileUi
+APP = ['src/moul/qt/moulqt.py']
+DATA_FILES = []
+OPTIONS = {'argv_emulation': True}
-VERSION = "0.0"
-
-ctea = Extension('crypttea._pyxtea',
- ['src/crypttea/_pyxtea.pyx', 'src/crypttea/ctea.c']
- )
-ext_modules = [ctea]
-#if os.name == 'posix':
-# ext_modules.append(ctea)
-
-setup_infos = dict(
- name = "pyMoul",
- version = VERSION,
- description = __doc__[:__doc__.find('\n')].strip(),
- long_description = '\n'.join([line
- for line in __doc__.split('\n')[1:]]),
- author = "Christian Heimes",
- author_email = "chr...@ch...",
- url = "http://sourceforge.net/projects/pymoul/",
- #download_url = "http://sourceforge.net/projects/pymoul/",
- license = "GPL",
- keywords = "myst online uru live moul cyan",
- classifiers = (
- 'Development Status :: 2 - Alpha',
- 'Environment :: Win32 (MS Windows)',
- 'Intended Audience :: End Users/Desktop',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: GNU General Public License (GPL)',
- 'Natural Language :: English',
- 'Operating System :: Microsoft :: Windows',
- 'Operating System :: POSIX',
- 'Programming Language :: Python',
- 'Topic :: Games/Entertainment :: Multi-User Dungeons (MUD)',
- ),
+setup(
+ app=APP,
+ data_files=DATA_FILES,
+ options={'py2app': OPTIONS},
+ setup_requires=['py2app'],
)
-
-setup_options = dict(
- setup_requires = ["setuptools>="+SETUPTOOLS_VERSION,],
- install_requires = ["pytz>=2006p"],
- data_files = [
- ('docs', list(glob('*.txt'))),
- ('i18n', list(glob('src/moul/qt/i18n/pymoul_*.qm'))),
- ],
- package_dir = {'' : 'src'},
- packages = find_packages('src', exclude="moul.qt"),
- include_package_data = True,
- zip_safe = False,
- namespace_packages = ['moul'],
- ext_modules = ext_modules,
-)
-
-def writeMetadata():
- dirname = os.path.dirname(__file__)
- ver = os.path.join(dirname, 'version.txt')
- open(ver, 'w').write(VERSION)
- meta = os.path.join(dirname, 'src', 'moul', 'metadata.py')
- fd = open(meta, 'w')
- fd.write("# pyMoul metadata informations\n")
- fd.write("# THIS FILE IS AUTO GENERATED. DO NOT ALTER!\n\n")
- fd.write("__version__ = '%s'\n\n" % VERSION)
- for name, value in setup_infos.items():
- if not isinstance(value, basestring):
- continue
- fd.write("%s = '''%s'''\n" % (name, value))
- fd.write("\nREADME = '''%s'''\n" % open('README.txt', 'r').read())
- fd.write("\nLICENSE = '''%s'''\n" % open('GPL.txt', 'r').read())
- fd.close()
-
-###
-# Write Metadata and compile UI files
-writeMetadata()
-compileUi()
-
-kwargs = {}
-kwargs.update(setup_infos)
-kwargs.update(setup_options)
-
-# Do some windows stuff
-_plat = sys.platform.startswith
-if _plat('win32'):
- from utilities.setup_win32 import updateSetupOptions
- from utilities.setup_win32 import updateSetupOptionsQT
- updateSetupOptions(kwargs)
- updateSetupOptionsQT(kwargs)
-elif _plat('darwin'):
- from utilities.setup_darwin import updateSetupOptions
- updateSetupOptions(kwargs)
-elif _plat('linux2'):
- kwargs['packages'].append('moul.qt')
-else:
- raise OSError(sys.platform)
-
-setup(**kwargs)
Modified: pymoul/trunk/src/moul/osdependent/darwin/__init__.py
===================================================================
--- pymoul/trunk/src/moul/osdependent/darwin/__init__.py 2007-03-22 18:58:49 UTC (rev 276)
+++ pymoul/trunk/src/moul/osdependent/darwin/__init__.py 2007-03-23 00:50:23 UTC (rev 277)
@@ -31,7 +31,7 @@
LOG.warning('Mac/Darwin support is experimental')
HOME = os.path.expanduser('~')
-MOUL_DIR = "%s/Library/Preferences/UruLive Preferences/p_drive/My Documents/Uru Live" % HOME
+MOUL_DIR = "%s/Library/Preferences/Myst Online Preferences/p_drive/My Documents/Uru Live" % HOME
#APP_NAME = "Uru Live.app"
APP_NAME = "Myst Online.app"
DATA_DIR = "Contents/Resources/Myst Online.app/Contents/Resources/transgaming/c_drive/Program Files/Uru Live"
Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py
===================================================================
--- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-03-22 18:58:49 UTC (rev 276)
+++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-03-23 00:50:23 UTC (rev 277)
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file './src/moul/qt/ui/mainwindow.ui'
#
-# Created: Wed Mar 21 13:00:59 2007
+# Created: Wed Mar 21 14:50:01 2007
# by: PyQt4 UI code generator 4.1.1
#
# WARNING! All changes made in this file will be lost!
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-22 18:59:05
|
Revision: 276
http://pymoul.svn.sourceforge.net/pymoul/?rev=276&view=rev
Author: tiran
Date: 2007-03-22 11:58:49 -0700 (Thu, 22 Mar 2007)
Log Message:
-----------
Fixed Mac path definitions. The Mac version should pick up the correct pathes and be able to load the journals now. Please test and debug ;)
Modified Paths:
--------------
pymoul/trunk/src/moul/osdependent/darwin/__init__.py
Modified: pymoul/trunk/src/moul/osdependent/darwin/__init__.py
===================================================================
--- pymoul/trunk/src/moul/osdependent/darwin/__init__.py 2007-03-21 12:39:25 UTC (rev 275)
+++ pymoul/trunk/src/moul/osdependent/darwin/__init__.py 2007-03-22 18:58:49 UTC (rev 276)
@@ -32,10 +32,11 @@
HOME = os.path.expanduser('~')
MOUL_DIR = "%s/Library/Preferences/UruLive Preferences/p_drive/My Documents/Uru Live" % HOME
-APP_PATH = "Uru Live.app/Contents/Resources/Game.app/Contents/Resources/transgaming/c_drive/Program Files/Uru Live/"
-APP_NAME = "Uru Live.app"
+#APP_NAME = "Uru Live.app"
+APP_NAME = "Myst Online.app"
+DATA_DIR = "Contents/Resources/Myst Online.app/Contents/Resources/transgaming/c_drive/Program Files/Uru Live"
+UPDATER = "Contents/Resources/Myst Online.app/Contents/Resources/transgaming/c_drive/Program Files/Uru Live/Cider/URU Live Updater.app/Contents/MacOS/URU Live Updater"
EXEC_NAME = "???" # XXX
-UPDATER = "Uru Live.app/Contents/Resources/Game.app/Contents/Resources/URU Live Updater.app/Contents/MacOS/URU Live Updater"
LOCATIONS = [
"/Applications",
"%s/Applications" % HOME,
@@ -56,12 +57,15 @@
return PYMOUL_DIR
def getMoulInstallDir():
- """Get path to MOUL install dir
+ """Get path to MOUL data root dir
"""
for path in LOCATIONS:
- if os.path.isfile(os.path.join(path, UPDATER)):
+ updater = os.path.join(path, APP_NAME, UPDATER)
+ data_dir = os.path.join(path, APP_NAME, DATA_DIR)
+ if os.path.isfile(updater) and os.path.isdir(data_dir):
LOG.info("Uru directory found: %s" % path)
- return path
+ LOG.debug("Uru data dir is %s" % data_dir)
+ return data_dir
LOG.warning("Uru directory NOT found! Search path was: \n %s" %
repr(LOCATIONS))
return 'INVALID'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-21 12:39:25
|
Revision: 275
http://pymoul.svn.sourceforge.net/pymoul/?rev=275&view=rev
Author: tiran
Date: 2007-03-21 05:39:25 -0700 (Wed, 21 Mar 2007)
Log Message:
-----------
Removed usage of crypt functions and disabled UI for audio and graphics settings
Modified Paths:
--------------
pymoul/trunk/Makefile.in
pymoul/trunk/src/moul/crypt/elf.py
pymoul/trunk/src/moul/crypt/whatdoyousee.py
pymoul/trunk/src/moul/file/directory.py
pymoul/trunk/src/moul/file/plasmalog.py
pymoul/trunk/src/moul/file/tests/test_directory.py
pymoul/trunk/src/moul/qt/mainwindow.py
pymoul/trunk/src/moul/qt/ui/mainwindow.py
pymoul/trunk/src/moul/qt/ui/mainwindow.ui
Modified: pymoul/trunk/Makefile.in
===================================================================
--- pymoul/trunk/Makefile.in 2007-03-21 12:33:30 UTC (rev 274)
+++ pymoul/trunk/Makefile.in 2007-03-21 12:39:25 UTC (rev 275)
@@ -39,13 +39,13 @@
$(PYTHON) utilities/compileui.py ./src/moul/
test_build: build
- PYTHONPATH="src" $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS)
+ MOUL_ALLOW_CRYPT="YES" PYTHONPATH="src" $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS)
test_inplace: inplace
- PYTHONPATH="src" $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS)
+ MOUL_ALLOW_CRYPT="YES" PYTHONPATH="src" $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS)
doc_html:
- PYTHONPATH="src" $(EPYDOC) -v --html --no-sourcecode \
+ MOUL_ALLOW_CRYPT="YES" PYTHONPATH="src" $(EPYDOC) -v --html --no-sourcecode \
--output="doc/html" moul
doc_html_graph:
Modified: pymoul/trunk/src/moul/crypt/elf.py
===================================================================
--- pymoul/trunk/src/moul/crypt/elf.py 2007-03-21 12:33:30 UTC (rev 274)
+++ pymoul/trunk/src/moul/crypt/elf.py 2007-03-21 12:39:25 UTC (rev 275)
@@ -23,6 +23,10 @@
__version__ = "$Id$"
__revision__ = "$Revision$"
+import os
+if not os.environ.get("MOUL_ALLOW_CRYPT"):
+ raise ImportError("The import of this module has been restricted")
+
import struct
# TODO: use BinaryFile
Modified: pymoul/trunk/src/moul/crypt/whatdoyousee.py
===================================================================
--- pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-03-21 12:33:30 UTC (rev 274)
+++ pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-03-21 12:39:25 UTC (rev 275)
@@ -28,6 +28,7 @@
__version__ = "$Id$"
__revision__ = "$Revision$"
+import os
import struct
from crypttea import LITTLE_ENDIAN
from crypttea import XTEA
@@ -47,6 +48,9 @@
fin - open file descriptor in read only and binary mode
return - string
"""
+ # LLL:
+ if not os.environ.get("MOUL_ALLOW_CRYPT"):
+ raise RuntimeError("The usage of this function has been restricted")
fin.seek(0)
header = fin.read(12)
if header != HEADER:
@@ -81,6 +85,9 @@
fout - out file descriptor in write and binary mode
return - None
"""
+ # LLL:
+ if not os.environ.get("MOUL_ALLOW_CRYPT"):
+ raise RuntimeError("The usage of this function has been restricted")
# XXX: dos format
instr = instr.replace("\n", "\r\n")
fout.seek(0)
Modified: pymoul/trunk/src/moul/file/directory.py
===================================================================
--- pymoul/trunk/src/moul/file/directory.py 2007-03-21 12:33:30 UTC (rev 274)
+++ pymoul/trunk/src/moul/file/directory.py 2007-03-21 12:39:25 UTC (rev 275)
@@ -29,8 +29,8 @@
from moul.file.kiimage import KIImageFixer
from moul.file.localization import LocDirParser
from moul.file.plasmalog import PlasmalogZipper
-from moul.file.wdysini import AudioIni
-from moul.file.wdysini import GraphicsIni
+# LLL: from moul.file.wdysini import AudioIni
+# LLL: from moul.file.wdysini import GraphicsIni
LOG = getLogger('moul.file.directory')
@@ -176,8 +176,8 @@
'logzipper' : (PlasmalogZipper, ('log', 'zipped')),
'kiimages' : (KIImageFixer, ('kiimages', 'fixed')),
'avatars' : (KIImageFixer, ('avatars', 'fixed')),
- 'graphicsini' : (GraphicsIni, ('ini',)),
- 'audioini' : (AudioIni, ('ini',)),
+ # LLL: 'graphicsini' : (GraphicsIni, ('ini',)),
+ # LLL: 'audioini' : (AudioIni, ('ini',)),
'chatmover' : (ChatlogMover, ('log', 'chatlogs')),
'chatview' : (ChatlogDirectoryView, ('chatlogs',)),
'zipped' : (DirectoryCount, ('zipped',)),
Modified: pymoul/trunk/src/moul/file/plasmalog.py
===================================================================
--- pymoul/trunk/src/moul/file/plasmalog.py 2007-03-21 12:33:30 UTC (rev 274)
+++ pymoul/trunk/src/moul/file/plasmalog.py 2007-03-21 12:39:25 UTC (rev 275)
@@ -28,7 +28,6 @@
from logging import getLogger
from stat import ST_MTIME
-from moul.crypt.elf import decryptElf
from moul.file.utils import fileModTime
@@ -41,7 +40,7 @@
"""Zip plasma logs
"""
_save_patterns = ['*.elf', '*.txt', '*.log', '*.zip', '*.jpg']
-
+
def __init__(self, srcdir, destdir):
self._srcdir = srcdir
self._destdir = destdir
Modified: pymoul/trunk/src/moul/file/tests/test_directory.py
===================================================================
--- pymoul/trunk/src/moul/file/tests/test_directory.py 2007-03-21 12:33:30 UTC (rev 274)
+++ pymoul/trunk/src/moul/file/tests/test_directory.py 2007-03-21 12:39:25 UTC (rev 275)
@@ -66,15 +66,15 @@
self.urudir = self.klass(tmpdir)
self.failIf(self.urudir.exists())
- self.failIf(self.urudir.factory('audioini').exists())
- self.failIf(self.urudir.factory('graphicsini').exists())
+ # LLL: self.failIf(self.urudir.factory('audioini').exists())
+ # LLL: self.failIf(self.urudir.factory('graphicsini').exists())
os.mkdir(tmpdir) # XXX
self.urudir.createTree()
self.failUnless(self.urudir.exists())
self.urudir.initializeFactories()
- self.failIf(self.urudir.audioini.exists())
- self.failIf(self.urudir.graphicsini.exists())
+ # LLL: self.failIf(self.urudir.audioini.exists())
+ # LLL: self.failIf(self.urudir.graphicsini.exists())
def test_create(self):
# setup a new, empty testing direcotry
@@ -86,13 +86,13 @@
self.failUnless(self.urudir.exists())
self.urudir.initializeFactories()
- self.failIf(self.urudir.audioini.exists())
- self.urudir.audioini.create()
- self.failUnless(self.urudir.audioini.exists())
+ # LLL: self.failIf(self.urudir.audioini.exists())
+ # LLL: self.urudir.audioini.create()
+ # LLL: self.failUnless(self.urudir.audioini.exists())
- self.failIf(self.urudir.graphicsini.exists())
- self.urudir.graphicsini.create()
- self.failUnless(self.urudir.graphicsini.exists())
+ # LLL: self.failIf(self.urudir.graphicsini.exists())
+ # LLL: self.urudir.graphicsini.create()
+ # LLL: self.failUnless(self.urudir.graphicsini.exists())
class UruGameDirTest(AbstractTest):
klass = UruGameDataDirectory
Modified: pymoul/trunk/src/moul/qt/mainwindow.py
===================================================================
--- pymoul/trunk/src/moul/qt/mainwindow.py 2007-03-21 12:33:30 UTC (rev 274)
+++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-03-21 12:39:25 UTC (rev 275)
@@ -47,7 +47,7 @@
from moul.qt.ui.mainwindow import Ui_MainWindow
from moul.qt.utils import QThreadlet
from moul.qt.utils import QYieldingThreadlet
-from moul.qt.wdysini import IniFileContainer
+# LLL: from moul.qt.wdysini import IniFileContainer
LOG = getLogger('moul.qt')
@@ -86,7 +86,7 @@
# init handlers
self.qcDniTimeNumber = DniTimeNumberContainer(self)
self.qcLocalization = LocalizationContainer(self)
- self.qcIniFile = IniFileContainer(self)
+ # LLL: self.qcIniFile = IniFileContainer(self)
self._ping_init()
#self._systray_init()
self._about_init()
Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py
===================================================================
--- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-03-21 12:33:30 UTC (rev 274)
+++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-03-21 12:39:25 UTC (rev 275)
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file './src/moul/qt/ui/mainwindow.ui'
#
-# Created: Mon Mar 19 14:34:52 2007
+# Created: Wed Mar 21 13:00:59 2007
# by: PyQt4 UI code generator 4.1.1
#
# WARNING! All changes made in this file will be lost!
@@ -146,6 +146,7 @@
self.tab_settings.setObjectName("tab_settings")
self.tab_sub_settings = QtGui.QTabWidget(self.tab_settings)
+ self.tab_sub_settings.setEnabled(False)
self.tab_sub_settings.setGeometry(QtCore.QRect(0,0,491,411))
self.tab_sub_settings.setObjectName("tab_sub_settings")
@@ -197,7 +198,7 @@
self.hboxlayout2.addWidget(self.groupBox_screenres)
self.groupBox_gra_checkboxes = QtGui.QGroupBox(self.horizontalLayout_4)
- self.groupBox_gra_checkboxes.setEnabled(True)
+ self.groupBox_gra_checkboxes.setEnabled(False)
self.groupBox_gra_checkboxes.setObjectName("groupBox_gra_checkboxes")
self.verticalLayout_28 = QtGui.QWidget(self.groupBox_gra_checkboxes)
@@ -229,7 +230,7 @@
self.hboxlayout2.addWidget(self.groupBox_gra_checkboxes)
self.groupBox_gra_quality = QtGui.QGroupBox(self.tab_graphics)
- self.groupBox_gra_quality.setEnabled(True)
+ self.groupBox_gra_quality.setEnabled(False)
self.groupBox_gra_quality.setGeometry(QtCore.QRect(10,90,451,281))
self.groupBox_gra_quality.setObjectName("groupBox_gra_quality")
@@ -462,7 +463,7 @@
self.tab_audio.setObjectName("tab_audio")
self.groupBox_aud_hardware = QtGui.QGroupBox(self.tab_audio)
- self.groupBox_aud_hardware.setEnabled(True)
+ self.groupBox_aud_hardware.setEnabled(False)
self.groupBox_aud_hardware.setGeometry(QtCore.QRect(10,250,451,111))
self.groupBox_aud_hardware.setObjectName("groupBox_aud_hardware")
@@ -525,7 +526,7 @@
self.cb_aud_eax.setObjectName("cb_aud_eax")
self.groupBox_voicechat = QtGui.QGroupBox(self.tab_audio)
- self.groupBox_voicechat.setEnabled(True)
+ self.groupBox_voicechat.setEnabled(False)
self.groupBox_voicechat.setGeometry(QtCore.QRect(10,190,451,51))
self.groupBox_voicechat.setObjectName("groupBox_voicechat")
@@ -534,7 +535,7 @@
self.cb_aud_voicechat.setObjectName("cb_aud_voicechat")
self.groupBox_aud_level = QtGui.QGroupBox(self.tab_audio)
- self.groupBox_aud_level.setEnabled(True)
+ self.groupBox_aud_level.setEnabled(False)
self.groupBox_aud_level.setGeometry(QtCore.QRect(10,0,451,181))
self.groupBox_aud_level.setObjectName("groupBox_aud_level")
Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui
===================================================================
--- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-03-21 12:33:30 UTC (rev 274)
+++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-03-21 12:39:25 UTC (rev 275)
@@ -349,6 +349,9 @@
<string>Settings</string>
</attribute>
<widget class="QTabWidget" name="tab_sub_settings" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
<property name="geometry" >
<rect>
<x>0</x>
@@ -451,7 +454,7 @@
<item>
<widget class="QGroupBox" name="groupBox_gra_checkboxes" >
<property name="enabled" >
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property name="title" >
<string>Other</string>
@@ -511,7 +514,7 @@
</widget>
<widget class="QGroupBox" name="groupBox_gra_quality" >
<property name="enabled" >
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property name="geometry" >
<rect>
@@ -981,7 +984,7 @@
</attribute>
<widget class="QGroupBox" name="groupBox_aud_hardware" >
<property name="enabled" >
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property name="geometry" >
<rect>
@@ -1128,7 +1131,7 @@
</widget>
<widget class="QGroupBox" name="groupBox_voicechat" >
<property name="enabled" >
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property name="geometry" >
<rect>
@@ -1157,7 +1160,7 @@
</widget>
<widget class="QGroupBox" name="groupBox_aud_level" >
<property name="enabled" >
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property name="geometry" >
<rect>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|