summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar Jeix <devnull@localhost> 2010-08-12 15:41:06 +0200
committerGravatar Jeix <devnull@localhost> 2010-08-12 15:41:06 +0200
commit8a0f08287538ec0865652efde47bf71d5d7ac5b7 (patch)
tree5b9c3a93329ad43a10707fe4334387a7ef063ea3 /module
parentShare.cx free user support and fixes for IRC Hook (diff)
downloadpyload-8a0f08287538ec0865652efde47bf71d5d7ac5b7.tar.xz
IRCHook extended for multiple owners and dynamic configuration
Diffstat (limited to 'module')
-rw-r--r--module/plugins/hooks/IRCInterface.py24
1 files changed, 9 insertions, 15 deletions
diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py
index 6639e7d2e..e484f4426 100644
--- a/module/plugins/hooks/IRCInterface.py
+++ b/module/plugins/hooks/IRCInterface.py
@@ -55,12 +55,6 @@ class IRCInterface(Thread, Hook):
self.abort = False
- self.host = self.getConfig("host") + ":" + str(self.getConfig("port"))
- self.owner = self.getConfig("owner")
- self.nick = self.getConfig("nick")
-
- self.targets = [self.getConfig("owner")]
-
self.links_added = 0
self.start()
@@ -83,13 +77,13 @@ class IRCInterface(Thread, Hook):
def run(self):
# connect to IRC etc.
self.sock = socket.socket()
- temp = self.host.split(":", 1)
- self.sock.connect((temp[0], int(temp[1])))
- self.sock.send("NICK %s\r\n" % self.nick)
- self.sock.send("USER %s %s bla :%s\r\n" % (self.nick, self.host, self.nick))
- for t in self.targets:
- if t.startswith("#"):
- self.sock.send("JOIN %s\r\n" % t)
+ self.sock.connect((self.getConf("host"), self.getConf("port")))
+ nick = self.getConf("nick")
+ self.sock.send("NICK %s\r\n" % nick)
+ self.sock.send("USER %s %s bla :%s\r\n" % (nick, self.getConf("host"), nick))
+ for t in self.getConf("owner").split():
+ if t.strip().startswith("#"):
+ self.sock.send("JOIN %s\r\n" % t.strip())
self.log.info("pyLoadIRC: Connected to %s!" % self.host)
self.log.info("pyLoadIRC: Switching to listening mode!")
try:
@@ -181,8 +175,8 @@ class IRCInterface(Thread, Hook):
def response(self, msg):
- for t in self.targets:
- self.sock.send("PRIVMSG %s :%s\r\n" % (t, msg))
+ for t in self.getConf("owner").split():
+ self.sock.send("PRIVMSG %s :%s\r\n" % (t.strip(), msg))
#### Events