def _check_module_change(submodule):
    modtup = _loaded_module_objects[submodule]
    oldtime = modtup[1]
    curtime = _get_mtime(modtup[0].__file__)
    if curtime > oldtime:
        dlog("The %s module has changed, refreshing..." % submodule)
        refresh(submodule)
Example #2
0
 def signedOn(self):
     # Join channels
     self.join(self.mainchannel)
     self.join(self.logchannel)
     self.msg('ChanServ', "op %s" % self.logchannel)
     # Mark service as signed on
     self.factory.signed_on = True
     dlog("Succesfully logged on as %s" % self.nickname)
def refresh( submodule ):
    if submodule in _loaded_module_objects:
        module, mtime = _loaded_module_objects[submodule]
        dlog("Attempting reload '%s'..." % submodule)
        try:
            module = reload(module)
        except Exception, e:
            dtrace("There was an error reloading %s :" % module.__file__)
            return False
        finally:
def get( module, submodule ):
    if submodule in _loaded_module_objects:
            return _loaded_module_objects[ submodule ][0].exported_class
    full_path = '.'.join( ['urb', module, submodule, 'exported_class'] )
    try:
        cls, mod = _get_class(full_path)
        dlog("Dynamically loaded %s from %s" % (cls, mod.__file__))
        _loaded_module_objects[ submodule ] = mod, _get_mtime(mod.__file__)
        return cls
    except Exception, e:
        dtrace("Exception dynamically importing %s.%s" % (module, submodule))
        return None
Example #5
0
 def dccDoChat(self, user, channel, address, port, data):
     user = user.split('!', 1)[0]
     dlog(address)
     u = User.get(nickname=user)
     if u:
         self.bind(user, address)
     else:
         self.msg(user, "You must be registered to login.")
         self.msg(user, "To register type the following:")
         self.msg(user, "/msg %s register [email] [password]" % self.nickname)
         self.msg(user, "")
         self.msg(user, "  email: if you want to be able to recover your password")
         self.msg(user, "         make sure this is valid.")
         self.msg(user, "")
         self.msg(user, "  password: required, but only used for logging in over")
         self.msg(user, "            telnet. On IRC, being identified to nickserv")
         self.msg(user, "            is good enough.")
Example #6
0
 def left(self, channel):
     dlog('Parted %s' % channel)
     if channel in self.channels:
         self.channels.remove(channel)
Example #7
0
 def joined(self, channel):
     dlog('Joined %s' % channel)
     self.channels.add(channel)
Example #8
0
 def connectionMade(self):
     dlog("Successfully connected to %s" % self.network)
     IRCClient.connectionMade(self)
Example #9
0
 def clientConnectionFailed(self, connector, reason):
     dlog("IRC Client failed to connect : %s" % reason)
     self.client = None
     connector.port = self.next_port()
     protocol.ReconnectingClientFactory.clientConnectionFailed(self, connector, reason)
Example #10
0
 def clientConnectionLost(self, unused_connector, unused_reason):
     dlog("DCC Chat connection lost to %s" % (unused_reason))
     self.unbind(self.client.remote_nick)
     self.client = None
Example #11
0
 def clientConnectionFailed(self, unused_connector, unused_reason):
     dlog("DCC Chat connection failed to %s" % (unused_reason))
     self.client = None
Example #12
0
 def lineReceived(self, line):
     dlog("%s said via DCC: %s" % (self.remote_nick, line))
     parts = line.split()
     command, args = parts[0], parts[1:]
     #try:
     self.app.do_command(self.remote_nick, command, args)
Example #13
0
 def connectionLost(self, reason=None):
     self.factory.unbind(self.remote_nick)
     dlog("Lost DCC connection with %s" % self.remote_nick)
Example #14
0
 def connectionMade(self):
     dlog("Established DCC Chat with %s" % self.remote_addr)
     if self.remote_nick == None:
         self.sendExternalIPError()
     else:
         self.factory.bind(self.remote_nick, self)
        _check_module_change(submodule)
        
if __debug__:
    LoopingCall(_check_for_changes).start(0.5)
        
def refresh( submodule ):
    if submodule in _loaded_module_objects:
        module, mtime = _loaded_module_objects[submodule]
        dlog("Attempting reload '%s'..." % submodule)
        try:
            module = reload(module)
        except Exception, e:
            dtrace("There was an error reloading %s :" % module.__file__)
            return False
        finally:
            dlog("Successfully refreshed %s." % submodule)
            _loaded_module_objects[submodule] = (module, _get_mtime(module.__file__))
            return True
    else:
        return False

def load_all(modulename):
    submodules = get_all(modulename)
    dynamics = {}
    for sub in submodules:
        dynamics[sub] = get(modulename, sub)
    return dynamics

def get_all( modulename ):
    module = _get_module('urb.%s' % modulename)
    module_list = []