def _listen(self):
        callHook("newClient", self)
        while True:
            line = self.file.readline()
            if line == "":
                self._callHook("disconnect", None)
                return
            data = Struct()
            data.line = line
            data.con = self
            data.passthough = True
            self._callHook("in_raw", data)
            if not data.passthough:  # a module requested to not pass the command
                continue

            data = Struct()
            t = line.split(" :")
            data.argline = t[0]
            data.args = data.argline.split()
            if len(t) > 1:
                data.data = line[len(data.argline) + 2 :]
            else:
                data.data = None
            data.passthough = True
            self._callHook("in_DATA_" + data.args[0].upper(), data)
            if data.passthough and not self.user is None:
                self.user.sendToServer(args=data.args, data=data.data)
 def sendLine(self, line):
     data = Struct()
     data.con = self
     data.passthough = True
     data.line = line
     self._callHook("out_raw", data)
     if data.passthough:
         sendLineToSocket(self.con, line + "\r\n")
 def sendLine(self, line):
     data = Struct()
     data.con = self
     data.passthough = True
     data.line = line
     self._callHook("out_raw", data)
     if data.passthough:
         sendLineToSocket(self.con, line + "\r\n")
    def _listen(self):
        callHook("newServer", self)
        while True:
            line = self.file.readline().replace("\n", "").replace("\r", "")
            if not self._loggedin:
                self._login()
                self._loggedin = True
            if line == "":
                self._callHook("disconnect", None)
                return
            data = Struct()
            data.line = line
            data.con = self
            data.passthough = True
            self._callHook("in_raw", data)
            if not data.passthough: # a module requested to not pass the command
                continue
            data = Struct()
            t = line.split(":")
            data.prefix = t[0]

            t = line[len(data.prefix) + 1:].split(" :")
            data.argline = t[0]
            data.args = data.argline.split()
            if len(t) > 1:
                data.data = line[len(data.argline) + 2:]
            else:
                data.data = None
            data.passthough = True
            self._callHook("in_DATA_" + data.args[1].upper(), data)
            if data.passthough:
                self.user.broadcastToClients(args = data.args, data = data.data, prefix = data.prefix)
    def _listen(self):
        callHook("newClient", self)
        while True:
            line = self.file.readline()
            if line == "":
                self._callHook("disconnect", None)
                return
            data = Struct()
            data.line = line
            data.con = self
            data.passthough = True
            self._callHook("in_raw", data)
            if not data.passthough:  # a module requested to not pass the command
                continue

            data = Struct()
            t = line.split(" :")
            data.argline = t[0]
            data.args = data.argline.split()
            if len(t) > 1:
                data.data = line[len(data.argline) + 2:]
            else:
                data.data = None
            data.passthough = True
            self._callHook("in_DATA_" + data.args[0].upper(), data)
            if data.passthough and not self.user is None:
                self.user.sendToServer(args=data.args, data=data.data)
Esempio n. 6
0
    def _listen(self):
        callHook("newServer", self)
        while True:
            line = self.file.readline().replace("\n", "").replace("\r", "")
            if not self._loggedin:
                self._login()
                self._loggedin = True
            if line == "":
                self._callHook("disconnect", None)
                return
            data = Struct()
            data.line = line
            data.con = self
            data.passthough = True
            self._callHook("in_raw", data)
            if not data.passthough:  # a module requested to not pass the command
                continue
            data = Struct()
            t = line.split(":")
            data.prefix = t[0]

            t = line[len(data.prefix) + 1:].split(" :")
            data.argline = t[0]
            data.args = data.argline.split()
            if len(t) > 1:
                data.data = line[len(data.argline) + 2:]
            else:
                data.data = None
            data.passthough = True
            self._callHook("in_DATA_" + data.args[1].upper(), data)
            if data.passthough:
                self.user.broadcastToClients(args=data.args,
                                             data=data.data,
                                             prefix=data.prefix)