Exemplo n.º 1
0
    except Exception, e:
        log(logging.ERROR, "IRC plugin error: " + str(e))


client_connect.connect(login, weak=False)


def logout(sender, **kwargs):
    client_number = kwargs['client_number']
    try:
        bot.connection.action(
            CHANNEL,
            get_instance_name() + get_client_name(client_number) +
            ' has disconnected')
    except Exception, e:
        log(logging.ERROR, "IRC plugin error: " + str(e))


client_disconnect.connect(logout, weak=False)

# Run bot


def monitor_irc():
    bot.start()


thread = threading.Thread(target=monitor_irc)
thread.setDaemon(True)
thread.start()
Exemplo n.º 2
0
text_message.connect(on_text_message, weak=False)

# Handle login-logout

def login(sender, **kwargs):
    client_number = kwargs['client_number']
    try:
        bot.connection.action(CHANNEL, get_instance_name() + get_client_name(client_number) + ' has connected')
    except Exception, e:
        log(logging.ERROR, "IRC plugin error: " + str(e));

client_connect.connect(login, weak=False)

def logout(sender, **kwargs):
    client_number = kwargs['client_number']
    try:
        bot.connection.action(CHANNEL, get_instance_name() + get_client_name(client_number) + ' has disconnected')
    except Exception, e:
        log(logging.ERROR, "IRC plugin error: " + str(e));
client_disconnect.connect(logout, weak=False)

# Run bot

def monitor_irc():
    bot.start()
thread = threading.Thread(target=monitor_irc)
thread.setDaemon(True)
thread.start()

# Copyright 2010 Alon Zakai ('kripken'). All rights reserved.
# This file is part of Syntensity/the Intensity Engine, an open source project. See COPYING.txt for licensing.

from intensity.signals import client_connect, client_disconnect
from intensity.base import quit


class Data:
    counter = 0

def add(sender, **kwargs):
    Data.counter += 1

client_connect.connect(add, weak=False)

def subtract(sender, **kwargs):
    Data.counter -= 1
    if Data.counter <= 0:
        quit()
        
client_disconnect.connect(subtract, weak=False)

Exemplo n.º 4
0
# Copyright 2010 Alon Zakai ('kripken'). All rights reserved.
# This file is part of Syntensity/the Intensity Engine, an open source project. See COPYING.txt for licensing.

from intensity.signals import client_connect, client_disconnect
from intensity.base import quit


class Data:
    counter = 0


def add(sender, **kwargs):
    Data.counter += 1


client_connect.connect(add, weak=False)


def subtract(sender, **kwargs):
    Data.counter -= 1
    if Data.counter <= 0:
        quit()


client_disconnect.connect(subtract, weak=False)