def endofmotd(self, server, me, msg): """Used instead of a connect callback since it invokes too early.""" self.client.send("MODE %s +B" % me) helpers.nick(self.client, "marzipan") helpers.join(self.client, "#playground") if self.client.logchan: helpers.join(self.client, self.client.logchan)
def updateProfile(self): me = self.mainwindow.profile() handle = me.handle try: helpers.nick(self.cli, handle) except socket.error: self.setConnectionBroken() self.updateMood()
def updateProfile(self): me = self.mainwindow.profile() handle = me.handle try: helpers.nick(self.cli, handle) except socket.error: self.setConnectionBroken() self.mainwindow.closeConversations(True) self.updateMood()
def connect(self): """ initiates the connection to the server set in self.host:self.port and returns a generator object. >>> cli = IRCClient(my_handler, host="irc.freenode.net", port=6667) >>> g = cli.connect() >>> while 1: ... g.next() """ try: logging.info('connecting to %s:%s' % (self.host, self.port)) self.socket.connect(("%s" % self.host, self.port)) if self.blocking: # this also overrides default timeout self.socket.setblocking(1) else: self.socket.setblocking(0) helpers.nick(self, self.nick) helpers.user(self, self.nick, self.real_name) if self.connect_cb: self.connect_cb(self) buffer = bytes() while not self._end: try: buffer += self.socket.recv(1024) except socket.error as e: try: # a little dance of compatibility to get the errno errno = e.errno except AttributeError: errno = e[0] if not self.blocking and errno == 11: pass else: raise e else: data = buffer.split(bytes("\n", "ascii")) buffer = data.pop() for el in data: prefix, command, args = parse_raw_irc_command(el) try: self.command_handler.run(command, prefix, *args) except CommandError: # error will of already been loggingged by the handler pass yield True finally: if self.socket: logging.info('closing socket') self.socket.close()
def updateProfile(self): me = self.mainwindow.profile() handle = me.handle try: helpers.nick(self.cli, handle) except socket.error: self.setConnectionBroken() self.mainwindow.closeConversations(True) self.mainwindow.doAutoIdentify() self.mainwindow.autoJoinDone = False self.mainwindow.doAutoJoins() self.updateMood()
def connect(self): """ initiates the connection to the server set in self.host:self.port """ logging.info('connecting to %s:%s' % (self.host, self.port)) self.socket.connect(("%s" % self.host, self.port)) if not self.blocking: self.socket.setblocking(0) if self.timeout: self.socket.settimeout(self.timeout) helpers.nick(self, self.nick) helpers.user(self, self.nick, self.real_name) if self.connect_cb: self.connect_cb(self)
def connect(self): """ initiates the connection to the server set in self.host:self.port and returns a generator object. >>> cli = IRCClient(my_handler, host="irc.freenode.net", port=6667) >>> g = cli.connect() >>> while 1: ... g.next() """ try: log.info("connecting to %s:%s" % (self.host, self.port)) self.socket.connect(("%s" % self.host, self.port)) if not self.blocking: self.socket.setblocking(0) helpers.nick(self, self.nick) helpers.user(self, self.nick, self.real_name) if self.connect_cb: self.connect_cb(self) buffer = "" while not self._end: try: buffer += self.socket.recv(1024) except socket.error, e: if not self.blocking and e[0] == 11: pass else: raise e else: data = buffer.split("\n") buffer = data.pop() for el in data: prefix, command, args = parse_raw_irc_command(el) try: self.command_handler.run(command, prefix, *args) except CommandError: # error will of already been logged by the handler pass yield True finally: if self.socket: log.info("closing socket") self.socket.close()
def nicknameinuse(self, server, cmd, nick, msg): newnick = "pesterClient%d" % (random.randint(100,999)) helpers.nick(self.client, newnick) self.parent.nickCollision.emit(nick, newnick)
def nicknameinuse(self, server, something, nick, msg): helpers.nick(self.client, nick + str(random.randint(0, 10000)))
def nicknameinuse(self, server, wtf, nick, reason): helpers.nick(self.client, nick+'_')
def nicknameinuse(self, nick, *message): print("Nickname in use", nick, message) helpers.nick(self.client, self.client.handler.generate_nick())