mudpy.git
10 years agoTighten exceptions for new sockets and reads
Jeremy Stanley [Thu, 27 Mar 2014 10:51:17 +0000 (10:51 +0000)]
Tighten exceptions for new sockets and reads

* lib/mudpy/misc.py(User.enqueue_input,check_for_connection): When
reading from a socket or polling for a new connection, be specific about
the exceptions which are benign so that we will still error out when
more detrimental exceptions are raised.

10 years agoFix log spamming on premature socket disconnect
Jeremy Stanley [Wed, 19 Mar 2014 19:05:57 +0000 (19:05 +0000)]
Fix log spamming on premature socket disconnect

* lib/mudpy/misc.py(User.flush): When sending on a user's socket raises
BrokenPipeError, their connection has probably dropped. Go ahead and set
their state to disconnecting so the socket will be cleaned up earily.
This also stops spamming the log on every failed write to a broken
socket before it eventually times out in the TCP/IP stack as well.

10 years agoStop trying to rename the daemon process
Jeremy Stanley [Mon, 10 Mar 2014 13:45:46 +0000 (13:45 +0000)]
Stop trying to rename the daemon process

* lib/mudpy/misc.py(daemonize): Remove the hacky process table entry
rewriting routines. They weren't cross-platform and never really worked
well. Also, these days admins are more used to daemons in interpreted
languages and know how to spot them in a process list with relative
ease.

10 years agoWrap long lines without using backslashes
Jeremy Stanley [Thu, 6 Mar 2014 02:32:27 +0000 (02:32 +0000)]
Wrap long lines without using backslashes

Try to align more closely with Python style guidelines on wrapping long
lines.

10 years agoClean up docstrings
Jeremy Stanley [Sun, 23 Feb 2014 14:36:51 +0000 (14:36 +0000)]
Clean up docstrings

10 years agoFix reload to use a copy of datafile keys
Jeremy Stanley [Mon, 10 Feb 2014 01:57:26 +0000 (01:57 +0000)]
Fix reload to use a copy of datafile keys

* lib/mudpy/misc.py: Python 2.x was more tolerant of this and it now
breaks under 3.4 release candidates, but correcting it to iterate over a
copy is arguably more correct anyway.

10 years agoRemove unused event code
Jeremy Stanley [Tue, 4 Feb 2014 19:15:00 +0000 (19:15 +0000)]
Remove unused event code

* lib/mudpy/misc.py: Event elements weren't fully implemented, so rip
out the dead code in preparation for a different implementation.

10 years agoCorrect copyright date for changelog
Jeremy Stanley [Tue, 28 Jan 2014 16:35:02 +0000 (16:35 +0000)]
Correct copyright date for changelog

10 years agoDrop support for Python 2.x
Jeremy Stanley [Mon, 20 Jan 2014 15:23:11 +0000 (15:23 +0000)]
Drop support for Python 2.x

Remove all derecated conditionals and fallbacks which provided
workarounds for supporting Python 2.x versions.

10 years agoClean up imports
Jeremy Stanley [Sat, 7 Dec 2013 23:19:08 +0000 (23:19 +0000)]
Clean up imports

Group all imports at the tops of files and alphabetize, for ease of
maintainabiity.

10 years agoFix an incorrect TODO comment line
Jeremy Stanley [Fri, 22 Nov 2013 10:27:38 +0000 (10:27 +0000)]
Fix an incorrect TODO comment line

10 years agoRecast to unicode when normalizing on Python 2.x
Jeremy Stanley [Wed, 16 Oct 2013 01:26:22 +0000 (01:26 +0000)]
Recast to unicode when normalizing on Python 2.x

* lib/mudpy/misc.py: Explicitly recast text to unicode type when passing
to unicodedata.normalize on Python 2.x.

10 years agoByte type comparisons on the output queue
Jeremy Stanley [Tue, 17 Sep 2013 08:13:03 +0000 (08:13 +0000)]
Byte type comparisons on the output queue

* lib/mudpy/misc.py: When comparing against data already in the output
queue, use byte type for compatibility with Py3K.

10 years agoImport a correct configparser for the interpreter
Jeremy Stanley [Wed, 7 Aug 2013 06:45:32 +0000 (06:45 +0000)]
Import a correct configparser for the interpreter

* lib/mudpy/data.py: Now import configparser and fall back to
ConfigParser if it's not found, for Py3K compatibility.

10 years agoCorrect byte types and encoding in test script
Jeremy Stanley [Sun, 21 Jul 2013 20:03:58 +0000 (20:03 +0000)]
Correct byte types and encoding in test script

* bin/test: It is sufficient to encode lookahead and written values on
the Telnet socket into UTF-8, and works correctly with Py3K now.

10 years agoUse chr instead of unichr
Jeremy Stanley [Sun, 9 Jun 2013 15:32:36 +0000 (15:32 +0000)]
Use chr instead of unichr

* lib/mudpy/misc.py: Missed in the earlier unicode to str patches, use
the chr function instead of unichr for Py3K compatibility.

10 years agoUse bytes in process table manipulation
Jeremy Stanley [Wed, 15 May 2013 10:35:51 +0000 (10:35 +0000)]
Use bytes in process table manipulation

* lib/mudpy/misc.py: When manipulating the process table, do so using
bytes type for Py3K compatibility.

10 years agoUse byte type for passwords hash encoding
Jeremy Stanley [Tue, 23 Apr 2013 17:39:49 +0000 (17:39 +0000)]
Use byte type for passwords hash encoding

* lib/mudpy/password.py: Raw hash values are manipulated as bytes for
Py3K compatibility.

11 years agoHandle byte type on sockets
Jeremy Stanley [Tue, 19 Mar 2013 03:10:40 +0000 (03:10 +0000)]
Handle byte type on sockets

* bin/test
* lib/mudpy/misc.py
* lib/mudpy/telnet.py: For Py3K compatibility, socket I/O uses byte type
instead of str.

11 years agoUse new 0o notation for octal constants
Jeremy Stanley [Mon, 25 Feb 2013 01:09:54 +0000 (01:09 +0000)]
Use new 0o notation for octal constants

* lib/mudpy/data.py: For Py3K compatibility, only refer to literal octal
constants using the 0o prefix.

11 years agoThe reload function is in the imp module
Jeremy Stanley [Wed, 30 Jan 2013 00:28:34 +0000 (00:28 +0000)]
The reload function is in the imp module

* bin/mudpy
* lib/mudpy/__init__.py: For Py3K compatibility, only invoke the reload
function from the imp module rather than the global built-in namespace.

11 years agoUse int type instead of long
Jeremy Stanley [Wed, 12 Dec 2012 20:58:27 +0000 (20:58 +0000)]
Use int type instead of long

* lib/mudpy/misc.py: Use int type instead of long, since Py3K will no
longer have a different representation for the latter.

11 years agoCorrect copyright years for change log
Jeremy Stanley [Wed, 7 Nov 2012 06:55:32 +0000 (06:55 +0000)]
Correct copyright years for change log

11 years agoRecast filters when comparing
Jeremy Stanley [Wed, 17 Oct 2012 22:03:31 +0000 (22:03 +0000)]
Recast filters when comparing

* lib/mudpy/misc.py: For Py3K compatibility, filters will need to be
recast to comparable data types when used in comparisons.

11 years agoWork around lack of dict_keys index in catch-all
Jeremy Stanley [Tue, 25 Sep 2012 16:32:32 +0000 (16:32 +0000)]
Work around lack of dict_keys index in catch-all

* lib/mudpy/misc.py: In Python 3000, dict.keys() returns a dict_keys
type which is not indexed, so work around it by converting to a list
anywhere we attempt to sort keys or access a key by ordered index.

11 years agoWork around lack of dict_keys index in data loader
Jeremy Stanley [Wed, 1 Aug 2012 11:28:59 +0000 (11:28 +0000)]
Work around lack of dict_keys index in data loader

* lib/mudpy/data.py: In Python 3000, dict.keys() returns a dict_keys
type which is not indexed, so work around it by converting to a list
anywhere we attempt to access a key by ordered index.

11 years agoUse range instead of xrange
Jeremy Stanley [Fri, 13 Jul 2012 13:20:09 +0000 (13:20 +0000)]
Use range instead of xrange

* lib/mudpy/password.py: Python 3000 is deprecating xrange in favor of
an iterator-based range which will be effectively as efficient, so stop
using xrange in preparation for the transition.

11 years agoUse absolute imports in telnet service module
Jeremy Stanley [Sat, 9 Jun 2012 12:50:00 +0000 (12:50 +0000)]
Use absolute imports in telnet service module

* lib/mudpy/telnet.py: Absolute imports are more readable and easier to
debug, so use them.

11 years agoUse absolute imports in catch-all module
Jeremy Stanley [Wed, 23 May 2012 21:07:52 +0000 (21:07 +0000)]
Use absolute imports in catch-all module

* lib/mudpy/misc.py: Absolute imports are more readable and easier to
debug, so use them.

11 years agoUse absolute imports in data handler module
Jeremy Stanley [Tue, 24 Apr 2012 20:26:31 +0000 (20:26 +0000)]
Use absolute imports in data handler module

* lib/mudpy/data.py: Absolute imports are more readable and easier to
debug, so use them.

12 years agoUse absolute imports in package init module
Jeremy Stanley [Tue, 6 Mar 2012 07:02:59 +0000 (07:02 +0000)]
Use absolute imports in package init module

* lib/mudpy/__init__.py: Absolute imports are more readable and easier
to debug, so use them.

12 years agoUse strings not unicode in telnet service module
Jeremy Stanley [Fri, 24 Feb 2012 08:59:36 +0000 (08:59 +0000)]
Use strings not unicode in telnet service module

* lib/mudpy/telnet.py: Python 3000 treats strings as unicode by default,
so we should too.

12 years agoUse strings not unicode in password module
Jeremy Stanley [Wed, 25 Jan 2012 00:20:04 +0000 (00:20 +0000)]
Use strings not unicode in password module

* lib/mudpy/password.py: Python 3000 treats strings as unicode by default,
so we should too.

12 years agoUse strings not unicode in catch-all module
Jeremy Stanley [Fri, 9 Dec 2011 14:37:10 +0000 (14:37 +0000)]
Use strings not unicode in catch-all module

* lib/mudpy/misc.py: Python 3000 treats strings as unicode by default,
so we should too.

12 years agoUse strings not unicode in data handler module
Jeremy Stanley [Sat, 5 Nov 2011 21:17:09 +0000 (21:17 +0000)]
Use strings not unicode in data handler module

* lib/mudpy/data.py: Python 3000 treats strings as unicode by default,
so we should too.

12 years agoUse strings not unicode in package init module
Jeremy Stanley [Sat, 1 Oct 2011 16:57:14 +0000 (16:57 +0000)]
Use strings not unicode in package init module

* lib/mudpy/__init__.py: Python 3000 treats strings as unicode by
default, so we should too.

12 years agoUse strings not unicode in functional test script
Jeremy Stanley [Mon, 19 Sep 2011 17:44:00 +0000 (17:44 +0000)]
Use strings not unicode in functional test script

* bin/test: Python 3000 treats strings as unicode by default, so we
should too.

12 years agoUse strings not unicode in daemon executable
Jeremy Stanley [Mon, 15 Aug 2011 11:01:17 +0000 (11:01 +0000)]
Use strings not unicode in daemon executable

* bin/mudpy: Python 3000 treats strings as unicode by default, so we
should too.

12 years agoUse strings not unicode in changelog generator
Jeremy Stanley [Tue, 19 Jul 2011 09:26:07 +0000 (09:26 +0000)]
Use strings not unicode in changelog generator

* bin/git2gch: Python 3000 treats strings as unicode by default, so we
should too.

12 years agoAdditional style cleanup
Jeremy Stanley [Mon, 6 Jun 2011 04:26:17 +0000 (04:26 +0000)]
Additional style cleanup

* lib/mudpy/__init__.py
* lib/mudpy/data.py
* lib/mudpy/misc.py
* lib/mudpy/telnet.py: Limit lines to <80 characters and adjust
hanging/visual indents for clarity and consistency.

12 years agoPEP 8 conformance for package init library
Jeremy Stanley [Fri, 27 May 2011 19:31:39 +0000 (19:31 +0000)]
PEP 8 conformance for package init library

* lib/mudpy/__init__.py: Conform to the PEP 8 style guide.

13 years agoPEP 8 conformance for monolithic library
Jeremy Stanley [Sun, 10 Apr 2011 11:28:58 +0000 (11:28 +0000)]
PEP 8 conformance for monolithic library

* lib/mudpy/misc.py: Conform to the PEP 8 style guide.

13 years agoPEP 8 conformance for password management library
Jeremy Stanley [Fri, 4 Mar 2011 14:41:23 +0000 (14:41 +0000)]
PEP 8 conformance for password management library

* lib/mudpy/password.py: Conform to the PEP 8 style guide.

13 years agoPEP 8 conformance for telnet server library
Jeremy Stanley [Fri, 18 Feb 2011 18:53:14 +0000 (18:53 +0000)]
PEP 8 conformance for telnet server library

* lib/mudpy/telnet.py: Conform to the PEP 8 style guide.

13 years agoPEP 8 conformance for data handling library
Jeremy Stanley [Tue, 11 Jan 2011 10:49:21 +0000 (10:49 +0000)]
PEP 8 conformance for data handling library

* lib/mudpy/data.py: Conform to the PEP 8 style guide.

13 years agoPEP 8 conformance for daemon executable script
Jeremy Stanley [Mon, 6 Dec 2010 12:11:37 +0000 (12:11 +0000)]
PEP 8 conformance for daemon executable script

* bin/mudpy: Conform to the PEP 8 style guide.

13 years agoPEP 8 conformance for ChangeLog writer script
Jeremy Stanley [Thu, 11 Nov 2010 21:34:57 +0000 (21:34 +0000)]
PEP 8 conformance for ChangeLog writer script

* bin/git2gch: Conform to the PEP 8 style guide.

13 years agoPEP 8 conformance for test script
Jeremy Stanley [Wed, 27 Oct 2010 15:18:45 +0000 (15:18 +0000)]
PEP 8 conformance for test script

* bin/test: Conform to the PEP 8 style guide.

13 years agoBack end data storage separation.
Jeremy Stanley [Mon, 13 Sep 2010 19:05:19 +0000 (19:05 +0000)]
Back end data storage separation.

* lib/mudpy/__init__.py (modules): Added the new data module to the
list.

* lib/mudpy/data.py: Implemented a new module to contain back end
data storage and retrieval functions, preparing to merge work on the
new data handling routines.

* lib/mudpy/misc.py (DataFile, find_file, makedict, makelist): Moved
to lib/mudpy/data.py.
(Element.__init__, Element.getdict, Element.getlist, Universe.load)
(replace_macros): Updated references to relocated classes and
functions.

13 years agoInline literals are more readable in source form.
Jeremy Stanley [Tue, 6 Jul 2010 20:23:08 +0000 (20:23 +0000)]
Inline literals are more readable in source form.

* doc/coder.txt: Adjusted sections referencing literal backslashes
to use inline literal syntax rather than double-backslash syntax,
for improved clarity.

13 years agoASCII Scrub
Jeremy Stanley [Wed, 23 Jun 2010 00:28:38 +0000 (00:28 +0000)]
ASCII Scrub

* doc/coder.txt: Found and replaced a non-ASCII UTF-8 apostrophe.

13 years agoCorrecting docstring format.
Jeremy Stanley [Fri, 18 Jun 2010 00:44:54 +0000 (00:44 +0000)]
Correcting docstring format.

* lib/mudpy/password.py (create): Corrected docstring format so that
epydoc -v will run clean of errors again.

13 years agoCorrecting minor docstring typos.
Jeremy Stanley [Fri, 18 Jun 2010 00:23:26 +0000 (00:23 +0000)]
Correcting minor docstring typos.

* lib/mudpy/password.py (create): Corrected two minor typographical
errors in the function's docstring.

13 years agoSecure, extensible, forward-compatable passwords.
Jeremy Stanley [Thu, 17 Jun 2010 23:49:58 +0000 (23:49 +0000)]
Secure, extensible, forward-compatable passwords.

* lib/mudpy/__init__.py (modules): Added the new password module to
the list.

* lib/mudpy/misc.py (handler_checking_password)
(handler_entering_new_password, handler_verifying_new_password):
Replaced existing md5 usage with calls to the new password
functions.

* lib/mudpy/password.py: Implemented a new module to handle creating
and verifying account password hashes. The functions and format are
forward-compatable to new hashing algorithms, and can be scaled to
allow tuning for CPU utilization/brute-force mitigation trade-offs.
The new functions are not directly backward-compatable with the old
format, but a utility function (upgrade_legacy_hash) is included to
upgrade those hexdigests if needed.

13 years agoReformatted README for 72 columns.
Jeremy Stanley [Mon, 31 May 2010 14:15:35 +0000 (14:15 +0000)]
Reformatted README for 72 columns.

* README: Switched from 79 columns to 72 columns in accordance with
the style guide in the doc/coder.txt coder guide.

13 years agoChange README for new on-line documentation link.
Jeremy Stanley [Mon, 31 May 2010 14:12:28 +0000 (14:12 +0000)]
Change README for new on-line documentation link.

* README: Updated the URL for the on-line documentation reference
and reworded the last sentence for clarity.

13 years agoNew coder guide document.
Jeremy Stanley [Mon, 31 May 2010 02:59:38 +0000 (02:59 +0000)]
New coder guide document.

* doc/coder.txt: New document focused on topics of interest to
anyone wishing to modify the mudpy engine or get involved with the
project's development process.

13 years agoScript to generate ChangeLog file from commit log.
Jeremy Stanley [Sat, 29 May 2010 14:46:52 +0000 (14:46 +0000)]
Script to generate ChangeLog file from commit log.

* bin/git2gch: New executable script for generating GNU-format
ChangeLog files from the Git commit log.

13 years agoRegression testing script.
Jeremy Stanley [Fri, 7 May 2010 00:59:56 +0000 (00:59 +0000)]
Regression testing script.

* bin/test: New executable script for regression testing against all
future commits to the mudpy core engine, modules and sample data.

13 years agoCosmetic adjustment to disconnect message.
Jeremy Stanley [Tue, 4 May 2010 03:39:43 +0000 (03:39 +0000)]
Cosmetic adjustment to disconnect message.

* share/menu.mpy (menu:disconnecting): Appended a newline to
separate the disconnect message from any lines which the client
might add thereafter, and switched from description to prompt.

13 years agoProper RFC 1143 Telnet option negotiation queue.
Jeremy Stanley [Tue, 4 May 2010 03:01:14 +0000 (03:01 +0000)]
Proper RFC 1143 Telnet option negotiation queue.

* lib/mudpy/__init__.py: Added telnet to the modules list.

* lib/mudpy/misc.py (Element.send, User.__init__)
(User.adjust_echoing, User.enqueue_input, User.flush)
(User.replace_old_connections, User.send, check_for_connection)
(get_echo_sequence, handle_user_input): Minor adjustments to
accomodate new code in telnet.py.
(User.negotiate_telnet_options, telnet_proto): Moved to telnet.py
and reworked option negotiation stack to eliminate a possible loop,
bringing the code fully in compliance with the "Q" method described
in IETF RFC 1143.

* lib/mudpy/telnet.py: New file for constants and functions related
to support of the Telnet protocol.

14 years agoClarification in README file.
Jeremy Stanley [Fri, 26 Mar 2010 18:30:33 +0000 (18:30 +0000)]
Clarification in README file.

* README: Adjusted indentention for the copyright metadata block and
added references to additional available documentation.

14 years agoNew top-level README file.
Jeremy Stanley [Sun, 31 Jan 2010 00:58:49 +0000 (00:58 +0000)]
New top-level README file.

* README: New file containing basic information on the project along
with pointers to additional documentation.

14 years agoReformat license.
Jeremy Stanley [Sat, 30 Jan 2010 23:36:11 +0000 (23:36 +0000)]
Reformat license.

* doc/LICENSE: Added a brief summary and reformatted for aesthetics.

14 years agoAnnual copyright update.
Jeremy Stanley [Sat, 30 Jan 2010 17:25:08 +0000 (17:25 +0000)]
Annual copyright update.

* (all): Updated copyright notices for 2010.

14 years agoImported from archive.
Jeremy Stanley [Fri, 25 Dec 2009 20:15:24 +0000 (20:15 +0000)]
Imported from archive.

* LICENSE: Moved to doc subdirectory, indicating it's a
documentation file.

* archetype, command, menu: Moved to share subdirectory, indicating
it's generally read-only data. Also appended .mpy extention to file
names, to indicate they're mudpy data.

* banner.txt, login.txt, mudpy.conf: Moved to etc subdirectory,
indicating they're generally hand-edited configuration data.

* lib/mudpy/__init__.py: Created a new Python module package, to
begin the process of splitting up the old monolithic module.

* mudpy: Moved to bin subdirectory, indicating it's directly
executable.

* mudpy.conf (__control__, internal:storage), mudpy.py
(DataFile.load, find_file, replace_macros): New functionality allows
arbitrary location of data files from relative or absolute paths out
of a prioritized series of potential directory trees.

* mudpy.conf (internal:network): Changed host to the IPv6 localhost
address of ::1 instead of the old IPv4 127.0.0.1 equivalent.

* mudpy.py: Renamed to misc.py and added to the new lib/mudpy Python
module package.
(Universe.initialize_server_socket): If local IPv6 support is
present default to listening on ::, otherwise fall back to 0.0.0.0
like before.
(command_say): Instead of denying parameters which look like
replacement macros, they are simply escaped before being processed.
Messages enclosed in quotation marks no longer get language fix-ups
applied. Fixed a bug where a type exception could be triggered if an
actor provided parameters to the say command which evaluated to an
empty string; reported by Mark Kolloros, a.k.a. Colourful.

* sample/index: Renamed to __init__.mpy in an effort to emulate
Python module package structure for groups of mudpy data files.

* sample/location, sample/prop: Appended .mpy extention to file
names, to indicate they're mudpy data.

14 years agoImported from archive.
Jeremy Stanley [Tue, 6 Oct 2009 21:11:08 +0000 (21:11 +0000)]
Imported from archive.

* mudpy: Changed shebang line to invoke the interpreter through
/usr/bin/env instead of directly.

* mudpy, mudpy.py (daemonize): Rename the process to the same as the
script's file name, and add some additional descriptive comments.

14 years agoImported from archive.
Jeremy Stanley [Fri, 2 Oct 2009 23:58:09 +0000 (23:58 +0000)]
Imported from archive.

* (all): Updated copyright notices for 2009.

* mudpy, mudpy.py: Changed all Python module references to be
explicit rather than importing their contents into the local
namespace, and moved all the import statements into the objects
requiring them. Made all code Unicode clean, UTF-8 encoded, and
marked relevant byte-oriented code in preparation for later Python
2to3 migration. Wrapped all code at 79 columns and changed to
three-space/non-tab indents with K&R-style bracketing. Moved more
code from the mudpy executable into mudpy.py instead.

* mudpy.py (User.flush): Added some verbose logging when an
exception is raised sending to a socket.
(User.negotiate_telnet_options): Reworked the Telnet stack into an
RFC 1143 option negotiation queue. Implemented support for binary
mode input and output RFC 856 and made the UTF-8 decoding and
encoding/substitution dependent on it. Implemented support for
negotiate about windows size RFC 1073 and changed the word-wrapping
routines to use the client's terminal width if available.
(glyph_columns, wrap_ansi_text): Improved word-wrapping to support
East Asian Width characters, which occupy two columns instead of
just one.

* example, sample: Replaced Example data with more generic sample
data.

15 years agoImported from archive.
Jeremy Stanley [Tue, 10 Jun 2008 22:42:56 +0000 (22:42 +0000)]
Imported from archive.

* (all): Updated copyright notices for 2008, and added references to
the included LICENSE file. Added similar copyright notices to all
data/document files.

* LICENSE: Switched the project from modified 2-clause BSD license
to the simpler and equivalent ISC license.

* banner.txt, login.txt, menu (menu:entering_account_name)
(menu:main_utility): Implemented text file inclusion using a file
replacement macro, and relocated the ASCII/ANSI art from the
login/lobby menu descriptions into separate login.txt and banner.txt
files.

* command (command:show): Renamed parameter to option in the help.

* menu (menu:delete_avatar): Corrected a misleading typo in the
desription.

* mudpy.conf (internal:time), mudpy.py (User.__init__)
(User.check_idle, User.pulse, handle_user_input): Added idle and
linkdead dict facets, indicating how long users can idle in various
states before they're warned and ultimately disconnected.

* mudpy.py (replace_macros): Performance enhancement, moving
unnecessary declarations outside the processing loop.
(wrap_ansi_text): Refactored the word-wrapping routines to solve a
bug where lines explicitly terminated at the wrap column got wrapped
early.

17 years agoImported from archive.
Jeremy Stanley [Sat, 15 Jul 2006 18:11:46 +0000 (18:11 +0000)]
Imported from archive.

* mudpy.py (User.replace_old_connections): Bug fix to make sure
old_user.account actually exists during socket replacement, and is
not merely a dangling reference.

17 years agoImported from archive.
Jeremy Stanley [Mon, 10 Jul 2006 03:30:46 +0000 (03:30 +0000)]
Imported from archive.

* LICENSE, mudpy, mudpy.py: Altered the copyright statements to
correctly mention all years instead of only the most recent.

* command (command:chat, command:say), mydpy.py (User.send)
(command_chat, first_word, handler_active): Added a chat command
which toggles the avatar in and out of a mode where all further
lines of input are passed as parameters to the say command.

* command (command:quit): Minor clarifications to several command
help texts.

* command (command:say), mudpy.conf (internal:language), mudpy.py
(command_say): Moved the capitalize_words list facet to a more
flexible typos dict, and condensed punctuation_* facets into an
actions dict facet.

* mudpy.py (User.deactivate_avatar): Fixed a bug where avatars
without a location could trigger an exception.
(command_help): Added a see_also list facet for menu elements, which
allow help output to suggest other related commands.
(create_pidfile, remove_pidfile): Minor adjustments to assure file
path canonicalization.
(get_loglines): Aesthetic tweaks to the show log output.
(on_pulse): Create internal:counters if it doesn't exist, to avoid
throwing an exception.

18 years agoImported from archive.
Jeremy Stanley [Wed, 15 Mar 2006 19:37:25 +0000 (19:37 +0000)]
Imported from archive.

* command (command:move): Minor cosmetic fix for the move command
help text.

* mudpy.py (User.replace_old_connections): Fixed a crash in
connection replacement detection where stale sockets without an
associated account would trigger an exception.

18 years agoImported from archive.
Jeremy Stanley [Sun, 5 Feb 2006 04:40:52 +0000 (04:40 +0000)]
Imported from archive.

* mudpy.py (User.send): Reduced the word-wrap column count from 80
to 79, to deal with some clients which will themselves wrap at,
rather than after, the last column.

18 years agoImported from archive.
Jeremy Stanley [Tue, 31 Jan 2006 04:44:42 +0000 (04:44 +0000)]
Imported from archive.

* mudpy.py (check_time): Removed unused function.

18 years agoImported from archive.
Jeremy Stanley [Mon, 30 Jan 2006 02:44:48 +0000 (02:44 +0000)]
Imported from archive.

* command (command:reload), mudpy.py (DataFile.load, DataFile.save):
More work on data file reloading

* mudpy, mudpy.py (Universe.new): Moved more code out of the mudpy
executable into the mudpy.py Python module.
(Universe.__init__, command_halt, command_reload): Renamed the
reload_modules and terminate_world bools to reload_flag and
terminate_flag respectively.

* mudpy.conf (internal:limits), mudpy.py (DataFile.save):
Implemented a data file rotation/backup scheme, configurable through
the default_backup_count int facet.

* mudpy.conf (internal:network): Example recommended config binds
only to 127.0.0.1 initially, for added security.

* mudpy.py (daemonize): More work on daemonization.

18 years agoImported from archive.
Jeremy Stanley [Tue, 24 Jan 2006 06:31:39 +0000 (06:31 +0000)]
Imported from archive.

* LICENSE, mudpy, mudpy.py: Updated copyright notices for 2006.

* mudpy, mudpy.conf (internal:process), mudpy.py (create_pidfile)
(daemonize, remove_pidfile): Implemented optional
fork-and-disassociate daemon capability.

* mudpy.conf (internal:network), mudpy.py
(Universe.initialize_server_socket): Now, if the host facet is
unset, it defaults to 0.0.0.0 (listen on all available IP
interfaces).

* mudpy.py (Element.clean_contents, Element.reload)
(Element.update_location, Universe.load, reload_data): Additional
Element methods to clean up data file reloading.
(sighook): Added a signal handler to interpret hangup as if an admin
had executed the reload command, and term as if the halt command had
been issued.

18 years agoImported from archive.
Jeremy Stanley [Sat, 26 Nov 2005 22:55:44 +0000 (22:55 +0000)]
Imported from archive.

* command (command:show), mudpy.py (command_show): Improved
parameter descriptions in the help text for the administrative show
command, and added a file parameter to allow listing of elements
included within a known data file.

* command (command:show), mudpy.py (command_show, get_loglines):
Modified the administrative show log command to take parameters for
filtering and start/stop entry ranges.

* mudpy.py (DataFile.load, Universe.load, command_reload)
(reload_data): The administrative reload command now re-reads data
from read-only data files and updates the corresponding elements.
(command_show): Refactored if/then spaghetti logic to be easier to
follow.

18 years agoImported from archive.
Jeremy Stanley [Thu, 24 Nov 2005 00:06:25 +0000 (00:06 +0000)]
Imported from archive.

* mudpy.py (Element.can_run, User.can_run): Moved this method from
the User class to the Element class, allowing for future
flexibility.
(Element.new_event, Universe.get_time): Began adding framework for
event elements and queues.
(command_create, command_delete, command_destroy, command_error)
(command_halt, command_help, command_look, command_move)
(command_quit, command_reload, command_say, command_set)
(command_show): Adjusted commands and messaging to be relative to an
actor element instead of a user object.

18 years agoImported from archive.
Jeremy Stanley [Fri, 18 Nov 2005 21:03:52 +0000 (21:03 +0000)]
Imported from archive.

* archetype, mudpy.conf (__control), mudpy.py (User.new_avatar),
template: Retermed template as archetype.

* mudpy.py: Added more code commentary, and refactored some sections
of the source to improve readability.
(DataFile.is_writeable, DataFile.save): Abstracted out the writeable
check from the save method into a separate method.
(DataFile.save): Adjusted to only write when elements within that
file have been modified.
(Element.delete): Removed obsolete method, recently implemented more
cleanly as remove_facet.

18 years agoImported from archive.
Jeremy Stanley [Fri, 30 Sep 2005 19:44:23 +0000 (19:44 +0000)]
Imported from archive.

* command (command:show), mudpy.py (command_show): Added a log
parameter to the admin command show, allowing administrative users
to review recent log entries.

* mudpy.conf (internal:logging), mudpy.py (log): Added an in-memory
ring buffer for logging, configurable via the max_log_lines facet.

* mudpy.py (excepthook): Attempt to log any Python interpreter
exceptions.
(log): Implemented a log priority mechanism to allow filtering logs
by importance. Log entries above an administrative account's
loglevel int facet in will be echoed to their owner's socket if
connected.

18 years agoImported from archive.
Jeremy Stanley [Wed, 28 Sep 2005 23:14:53 +0000 (23:14 +0000)]
Imported from archive.

* command (command:look), mudpy.py (command_look): New command
allowing avatars to view the description and contents of their
location.

* mudpy.conf (internal:directions), mudpy.py
(Element.move_direction, Element.portals): Made direction vectors
for actor movement configurable.

* mudpy.conf (internal:logging), mudpy.py (log): Made logging
configurable to write to a particular file, toggle printing to
stdout, and added the ability to specify a syslog tag.

* mudpy.py (Element.go_home, Element.move_direction): Added a
feedback message to notify the user when their avatar moves between
locations, and inform other users when actors depart from or arrive
at their location.
(User.send): Avoid unnecessarily duplicating prompts following
unsolicited/notification messages.

18 years agoImported from archive.
Jeremy Stanley [Thu, 22 Sep 2005 23:34:49 +0000 (23:34 +0000)]
Imported from archive.

* command, menu, mudpy.conf, template, mudpy.py (DataFile.__init__)
(DataFile.save): Changed the control meta-element to __control__ so
as to avoid namespace collisions later.

* command (menu:active), mudpy.py (User.send): Removed the prompt
facet to enable more dynamic prompt generation.

* command (command:move), mudpy.py (Element.go_home, Element.go_to)
(Element.move_direction, command_move): Implemented a move command
and associated backend functions/methods allowing avatars to move
between interconnected locations.

* command (command:show), mudpy.py (command_show): Added a result
parameter to the admin show command, allowing administrative users
to eval arbitrary Python statements.

* menu (menu:activate_avatar), mudpy.py
(User.activate_avatar_by_index): New convenience function to
simplify this menu's action.

* mudpy.conf (internal:limits), mudpy.py (User.authenticate): Added
a default_admins list facet, for use in identifying user names which
should automatically be granted administrative privileges--dangerous
and therefore commented out of the config by default.

* mudpy.py (DataFile.save): When writing new files, any necessary
parent directories in the specified path will be created
automatically. Since the ConfigParser module doesn't make an effort
to sort its contents, replacement code has been added to do this.
(Element.ancestry, Element.append, Element.has_facet)
(Element.remove_facet): Implemented sieve-style recursive facet
inheritence for elements using an inherit meta-facet.
(User.send): Refactored how newlines are added/removed/replaced in
the output queue, to avoid chaining an ugly number of them. Added a
flush flag, allowing urgent output to be pushed through immediately.

18 years agoImported from archive.
Jeremy Stanley [Sun, 18 Sep 2005 23:42:03 +0000 (23:42 +0000)]
Imported from archive.

* mudpy.py (User.negotiate_telnet_options): Added support for RFC
1184 linemode and RFC 858 go ahead suppression. Automated end of
record/go ahead prompt terminator selection via Telnet option
negotiation. Added support for Telnet suboption negotiation. Fixed a
double-IAC escape matching error.
(User.send): Refactored away some spaghetti logic for better
readability.
(log): Added syslog support.

18 years agoImported from archive.
Jeremy Stanley [Tue, 13 Sep 2005 02:41:30 +0000 (02:41 +0000)]
Imported from archive.

* mudpy.py (User.enqueue_input, User.negotiate_telnet_options):
Implemented a real Telnet option negotiation stack, paving the way
for more robust client integration.
(get_echo_sequence): Refactored echo handling in password prompts to
rely on Telnet option negotiation.
(get_menu): Added an RFC 885 end of record prompt terminator for
improved MUD client support.

18 years agoImported from archive.
Jeremy Stanley [Sun, 11 Sep 2005 20:45:34 +0000 (20:45 +0000)]
Imported from archive.

* command (command:create, command:delete, command:destroy)
(command:set), mudpy.py (command_create, command_delete)
(command_destroy, command_set): Added the admin commands create,
delete, destroy and set, as a foundation for future on-line
creation/World-building systems.

* example: Included sample data from the Example project.

* mudpy.py (Element.delete): Renamed to destroy and added a new
delete method used for removing individual facets, making them
consistent with the new admin commands.
(User.delete): Renamed to destroy for consistency with the Element
class' method names.
(User.can_run): New method acting as a rudimentary access control
system for commands flagged with an administrative bool facet in
command elements.
(command_help): Modified to filter out commands the user is
disallowed from running, and now highlights administrative command
names when they're available.
(handler_active): Standardized on command_name instead of command.

18 years agoImported from archive.
Jeremy Stanley [Mon, 5 Sep 2005 03:43:11 +0000 (03:43 +0000)]
Imported from archive.

* menu (menu:activate_avatar): Add a default of the first avatar in
the list.
(menu:choose_name): Change the generate more names choice from m to
g and make it the default.
(menu:delete_avatar): Make abort the default choice and correct a
misleading copy/paste error in the prompt.

* menu (menu:delete_account), mudpy.py (User.delete): New menu and
supporting method to allow deletion of an existing account.

* mudpy.py (Element.get, Element.getboolean, Element.getdict)
(Element.getfloat, Element.getint, Element.getlist): Reworked
default parameter handling to fall back to the None type and then
replace it with the appropriate type of empty variable if not
overridden, solving obscure bugs arising from mutable sequence
reuse.
(get_choice_action, get_choice_branch, generic_menu_handler):
Consolidated default choice fallback into generic_menu_handler.

* testdata: Removed pending something better.

18 years agoImported from archive.
Jeremy Stanley [Fri, 2 Sep 2005 02:51:15 +0000 (02:51 +0000)]
Imported from archive.

* menu (menu:activate_avatar): New menu to delete an existing
avatar.

* menu (menu:delete_avatar), mudpy.py (User.delete_avatar): New menu
and supporting method to select an existing avatar.

18 years agoImported from archive.
Jeremy Stanley [Wed, 31 Aug 2005 03:28:44 +0000 (03:28 +0000)]
Imported from archive.

* command (control), menu (control): Locked these files to be
read-only, for added security.

* mudpy.conf (categories, control, include): Moved categories and
include elements to be control meta-element list facets called
default_files and include_files respectively, allowing them to be
utilized in multiple files within the data tree.
(control): Added a list facet called private_files which works like
default_files but creates them mode 0600, and moved the accounts
file to this list to prevent leaking MD5 password hashes for
accounts.
(internal:general): Renamed to internal:limits and added a
max_avatars int facet providing the means to cap the number an
account is allowed to have.

* mudpy.py (Element.get, Element.getdict, Element.getfloat)
(Element.getint, Element.getlist): Reworked to provide a means to
override the default values through a function parameter, similar to
getboolean.
(Element.set): Strip trailing L off long ints.
(handler_checking_new_account_name): Abstracted this entire function
out into the checking_new_account_name menu configuration.

18 years agoImported from archive.
Jeremy Stanley [Tue, 30 Aug 2005 00:03:05 +0000 (00:03 +0000)]
Imported from archive.

* all files: Lower-cased any MUDpy references to mudpy throughout
the code.

* muff: Collapsed the Python module package directory into a single
mudpy.py module for now, to simplify on-the-fly source code
reloading functionality (this will be re-split in a more effective
fashion later).

* testdata: New example data file with generic contents.

18 years agoImported from archive.
Jeremy Stanley [Sun, 28 Aug 2005 18:36:46 +0000 (18:36 +0000)]
Imported from archive.

* data/commands: Renamed to command and moved into the top-level
directory.

* data/universe, lib/index: Removed this sample data.

* lib/menus: Collapsed the contents of the directory into a menu
file within the top-level directory.

* lib/muff: Moved into the top-level directory.

* lib/muff, mudpy.py: Assorted minor code readability fixes and
additional comments. Replaced several more vague try/except
constructs with more specific if/then/else checks.

* lib/muff/muffcmds.py (command_time, command_show): Changed the
admin command time to be a parameter to the admin command show
instead.
(handler_checking_new_account_name, handler_entering_new_password)
(handler_verifying_new_password): Adjusted the fix for stray empty
accounts to create them upon entry but delete them again if no
password is successfully added, avoiding a potential race and
exception where two sockets start to create a user with the same
name.
(handler_entering_account_name): Disallow non-alphanumeric
characters in account names.

* lib/muff/muffconf.py: Replaced with object methods in class
definitions within muffuniv.py.

* mud.py: Renamed to mudpy matching, the executable to the project
name.

18 years agoImported from archive.
Jeremy Stanley [Thu, 25 Aug 2005 21:23:07 +0000 (21:23 +0000)]
Imported from archive.

* data/universe/rooms: Added a few example locations.

* lib/commands: Collapsed this directory into a single file.

* lib/muff/muffcmds.py, lib/muff/muffmisc.py, lib/muff/muffvars.py:
Replaced some risky try/except constructs with if/then/else
clauses.

* lib/muff/muffcmds.py (command_show): Added files and universe
parameter options.

* lib/muff/muffmisc.py (getlong, repr_long, setlong): Folded into
getint and friends.

* lib/muff/muffvars.py (save): Finished migrating into the
muffuniv.Universe.save method.
(variable_data): Moved to muffuniv.Universe.internals dict.

18 years agoImported from archive.
Jeremy Stanley [Thu, 25 Aug 2005 02:25:34 +0000 (02:25 +0000)]
Imported from archive.

* lib/menus/active: Merged into lib/menus/miscellaneous and removed.

* lib/menus/miscellaneous (choose_gender, choose_name)
(main_utility): Added menus to enter/exit the game, select gender
and pick a randomly-generated avatar name from a list.

* lib/muff/muffcmds.py: Changed user state names to employ
underscores instead of spaces.
(command_show): New admin command to ease debugging of data
relationships.
(generic_menu_handler): New function abstract out common routines
from typical menu state handlers.
(handle_user_input): For aesthetics, user input is now followed by a
blank line of output if we expect the client isn't echoing.

* lib/muff/muffmain.py (main): The main loop is now followed by a
muffiniv.universe.save during shutdown, in case any changes have
occurred since the last save.

* lib/muff/muffmenu.py
(get_menu): Refactored to be more modular, and broke out a lot of
its pieces into additional functions.
(get_choice_action, get_choice_branch, get_default_action)
(get_default_branch, get_default_menu_choice)
(get_formatted_default_menu_choice, get_formatted_menu_choices)
(get_menu_actions, get_menu_branches, get_menu_choices)
(get_menu_description, get_menu_prompt): New functions abstracted
out of the previously spaghetti-like get_menu function.
(get_echo_message, get_echo_sequence, menu_echo_on): New functions
to take care of enabling and disabling echo for password prompts.

* lib/muff/muffmisc.py (replace_macros): Implemented gender-specific
pronoun replacement macros, to make English-language messages less
awkward.

* lib/muff/muffuniv.py: New module implementing DataFile, Element
and Universe classes, for a more object-oriented approach.

* muff: Renamed to mud.py.

* muff.conf: Renamed to mudpy.conf.

18 years agoImported from archive.
Jeremy Stanley [Fri, 5 Aug 2005 15:54:48 +0000 (15:54 +0000)]
Imported from archive.

* lib/menus/login (disconnecting duplicates), lib/menus/miscellaneous
(disconnecting), lib/muff/muffcmds.py (handler_checking_password):
Messages are now colored in ANSI red.

* lib/muff/muffcmds.py (command_halt): Added a reason message
parameter which gets logged and broadcast to all connected users.
(command_reload): Now gets logged when run.
(command_say): Disallowed replacement macro sequences and refactored
the correction routines, abstracting the punctuation and typo maps
out into configuration.
(command_time): New admin command to report current world time in
elapsed increments.
(handle_user_input): Switched to a generic caller based dynamically
based on the user state names.
(handler_disconnecting, handler_disconnecting_duplicates): Added
code to handle disconnecting an existing socket for a user who
successfully authenticates on a new socket.
(handler_entering_account_name): Now adds a log entry when a user
logs into an account.
(handler_fallthrough): Removed.

* lib/muff/muffconf.py: Refactored the initial config file finding
routines to be more robust.
(get, getfloat, getint, set): New convenience
functions for calling the corresponding Data class methods.

* lib/muff/muffmain.py (main): Ammended the loop to continue, giving
the next pulse an opportunity to more courteously disconnect active
user sockets.

* lib/muff/muffmain.py (main), lib/muff/muffmisc.py (on_pulse):
Relocated more loop content.

* lib/muff/muffmisc.py (broadcast): For aesthetics, an additional
blank line is now prepended to output.
(getlong, repr_long, setlong): Additional functions implemented to
deal with Python's long integer representation format.
(reload_data): New function allowing the admin reload command to
refreshe already instantiated objects by migrating their contents to
new ones and deleting the originals.

* lib/muff/muffuser.py (User.save): The account file is now
unconditionally set to 0600 permissions for additional protection of
the MD5 password hashes.

18 years agoImported from archive.
Jeremy Stanley [Sat, 30 Jul 2005 17:04:00 +0000 (17:04 +0000)]
Imported from archive.

* lib/muff/muffcmds.py (command_quit): Replaced with a disconnecting
state.
(handle_user_input): Reorganized the user state handlers.
(handler_entering_account_name): Fixed a race condition where empty
accounts would be created even if the user never got around to
entering a password before disconnecting.

* lib/muff/muffmisc.py (log): New function to abstract logging of
arbitrary information, for later flexibility.
(random_name, weighted_choice): Added a random name generator
function for later use.

18 years agoImported from archive.
Jeremy Stanley [Thu, 21 Jul 2005 20:19:02 +0000 (20:19 +0000)]
Imported from archive.

* bin/muff, lib/muff: Replaced the embedded license copies with
pointers to the LICENSE file. Added lots of in-line code commentary
and docstrings. Refactored some blocks of code for improved
readability.

* bin/muff, etc/mudpy.conf: Moved to the top-level directory.

* doc/license: Renamed to LICENSE and moved it to the top-level
directory.

* lib/muff/muffcmds.py (command_null): Removed.
(command_say): Additional output cleanup.

* lib/muff/muffmain.py (main): More robust handling for variable
files.

* lib/muff/muffmisc.py (wrap_ansi_text): Minor word-wrapping fix.
(User.__init__): Added tracking of last login address.

18 years agoImported from archive.
Jeremy Stanley [Mon, 18 Jul 2005 22:24:29 +0000 (22:24 +0000)]
Imported from archive.

* Initial commit of working project files.

18 years agoImported from archive.
Jeremy Stanley [Sat, 16 Jul 2005 22:22:13 +0000 (22:22 +0000)]
Imported from archive.

* New project.