Re: exported.writes inside a hook threadlock?

will guaraldi <[email protected]>
Newsgroups gmane.comp.games.mud.client.lyntin
Message-ID <[email protected]>
On Mon, 12 Apr 2004 [email protected] wrote:
>
> Well, can you provide an example of this hardcoded as a module :
>
>   1. Mud sends "Tom kicks you"
>   2. Lyntin sends back "kick Tom"
>
> If you read my first question again it seems the primary problem
> I have is the infinite loop and to_user_hook misunderstanding.
>
> Am I simply using the wrong hook?


Yes, you're using the wrong hook--I've said that in previous emails.

Here's the distilled stuff from action.py that answer your questions:

%<-------------------------------------------------
from lyntin import event, exported

class ActionManagerSimplified:
  instance = None

  def __init__(self):
    pass

  def mudfilter(self, args):
    """
    mud_filter_hook function to check for actions when data
    comes from the mud.
    """
    ses = args["session"]
    text = args["dataadj"]

    if text.find("kicks me") != -1:
      texttemp = text.split(" ")
      exported.lyntin_command("kick " + texttemp[0], internal=1, session=ses)

    return text


def load():
  ActionManagerSimplified.instance = ActionManagerSimplified()
  exported.hook_register("mud_filter_hook", ActionManagerSimplified.instance.mudfilter, 75)

def unload():
  exported.hook_unregister("mud_filter_hook", ActionManagerSimplified.mudfilter)
  ActionManagerSimplified.instance = None
%<-------------------------------------------------


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.