def user_joined(self, user, stanza): frm = user.nick #.decode("utf-8") if len(self.pool) == 0: self.pool = set("cbdgmry") # reset self.nicks[frm] = self.pool.pop() print colorize(self.nicks[frm], frm), colorize('k', "has joined the room")
def message_received(self, user, stanza): body=stanza.get_body() if user is None or body is None: return frm = user.nick#.decode("utf-8") code = self.nicks[frm] if frm in self.nicks else 'U' try: print colorize(code,frm+':'),body except: print frm+':',body sys.stdout.write("\x1b]2;%s says...\x07"%frm)
def message_received(self, user, stanza): body = stanza.get_body() if user is None or body is None: return frm = user.nick #.decode("utf-8") code = self.nicks[frm] if frm in self.nicks else 'U' try: print colorize(code, frm + ':'), body except: print frm + ':', body sys.stdout.write("\x1b]2;%s says...\x07" % frm)
def message(self, stanza): body = stanza.get_body() frm = stanza.get_from().as_utf8().split('@')[0] if stanza.get_type() == "headline": return True print colorize('g', frm + ':'), body response = self.autorespond(body) return Message(to_jid=stanza.get_from(), from_jid=stanza.get_to(), stanza_type=stanza.get_type(), subject=stanza.get_subject(), body=response)
def message(self,stanza): body=stanza.get_body() frm = stanza.get_from().as_utf8().split('@')[0] if stanza.get_type()=="headline": return True print colorize('g',frm+':'),body response = evalmsg(body) return Message(to_jid=stanza.get_from(), from_jid=stanza.get_to(), stanza_type=stanza.get_type(), subject=stanza.get_subject(), body=response)
def message(self,stanza): body=stanza.get_body() frm = stanza.get_from().as_utf8().split('@')[0] print stanza.get_type() if stanza.get_type()=="headline": return True print colorize('g',frm+':'),body sleep(random()) response = self.autorespond(body,1.0) return Message(to_jid=stanza.get_from(), from_jid=stanza.get_to(), stanza_type=stanza.get_type(), subject=stanza.get_subject(), body=response)
def message(self, stanza): body = stanza.get_body() frm = stanza.get_from().as_utf8().split("@")[0] if stanza.get_type() == "headline": return True print colorize("g", frm + ":"), body response = self.autorespond(body) return Message( to_jid=stanza.get_from(), from_jid=stanza.get_to(), stanza_type=stanza.get_type(), subject=stanza.get_subject(), body=response, )
def message(self,stanza): body=stanza.get_body() frm = stanza.get_from().as_utf8().split('@')[0] if stanza.get_type()=="headline": return True print colorize('g',frm+':'),body return True
def nick_changed(self, user, old_nick, stanza): frm = user.nick#.decode("utf-8") self.nicks[frm] = self.nicks[old_nick] del self.nicks[old_nick] print colorize(self.nicks[frm],old_nick),colorize('k',"is now known as"),colorize(self.nicks[frm],frm)
def user_left(self, user, stanza): frm = user.nick#.decode("utf-8") print colorize(self.nicks[frm],frm),colorize('k',"has left the room") self.pool.add(self.nicks[frm]) del self.nicks[frm]
def user_joined(self, user, stanza): frm = user.nick#.decode("utf-8") if len(self.pool) == 0: self.pool = set("cbdgmry") # reset self.nicks[frm] = self.pool.pop() print colorize(self.nicks[frm],frm),colorize('k',"has joined the room")
def message(self, stanza): body = stanza.get_body() frm = stanza.get_from().as_utf8().split('@')[0] if stanza.get_type() == "headline": return True print colorize('g', frm + ':'), body return True
def nick_changed(self, user, old_nick, stanza): frm = user.nick #.decode("utf-8") self.nicks[frm] = self.nicks[old_nick] del self.nicks[old_nick] print colorize(self.nicks[frm], old_nick), colorize( 'k', "is now known as"), colorize(self.nicks[frm], frm)
def user_left(self, user, stanza): frm = user.nick #.decode("utf-8") print colorize(self.nicks[frm], frm), colorize('k', "has left the room") self.pool.add(self.nicks[frm]) del self.nicks[frm]