def msg_buffer(self): while self.connected: import time time.sleep(1) for i in self.channels: if len(i.cMsgBuffer) != 0: for msgBuff in i.cMsgBuffer: currentTime=time.time() #TODO: Check the channel selected, and display only the number of messages to send on that channel if currentTime >= msgBuff.sendTimestamp: i.cMsgBuffer.remove(msgBuff) pDebug("msg_buffer, " + i.cName) IRCHelper.cmdSendMsg(self,msgBuff.dest,msgBuff.msg) pDebug("Entries in buffer left:"+str(len(i.cMsgBuffer))) #Call all the onByteSendChange events for event in eventFunctions: if event.eventName == "onByteSendChange" and event.cServer == self: gobject.idle_add(event.aFunc,self,len(i.cMsgBuffer)) break
def privmsgResp(server,i,otherStuff):#the private msg(Normal message) #!--PRIVMSG STUFF START--!# if "PRIVMSG" in i: m = ResponseParser.parseMsg(i,False) if m is not False: #Make sure it's PRIVMSG if m.typeMsg == "PRIVMSG": #pDebug(m.msg) #!--CTCP VERSION--!# if m.msg.startswith("VERSION"): import platform IRCHelper.sendNotice(server,m.nick,"VERSION Nyx 0.1 151309 Copyleft 2009 Mad Dog software - http://sourceforge.net/projects/nyxirc/ - running on " + platform.linux_distribution()[0] + "") #!--CTCP VERSION END--!# #!--CTCP TIME--!# if m.msg.startswith("TIME"): IRCHelper.sendNotice(server,m.nick,"TIME " + strftime("%b %d %H:%M:%S %Z", localtime()) + "") #TIME Aug 02 12:56:09 BST #!--CTCP TIME END--!# #!--CTCP PING--!# if m.msg.startswith("PING"): IRCHelper.sendNotice(server,m.nick,m.msg) #PING 123456789 #!--CTCP PING END--!# #If someone sent YOU a PRIVMSG(i.e to you, not a channel), then make a new 'channel' for that user. if m.channel == server.cNick and m.msg.startswith("") == False: addNewUser=True #:[email protected] PRIVMSG dom96 :pie for ch in server.channels: if ch.cName.lower() == m.nick.lower(): addNewUser=False if addNewUser==True: nChannel = IRC.channel() nChannel.cName = m.nick nChannel.cTextBuffer = gtk.TextBuffer() nChannel.cType = "chanusr" nChannel.cTopic = m.host nChannel.UserListStore = None try: nChannel.cTreeIter = server.listTreeStore.append(server.cTreeIter, \ [m.nick, None, otherStuff.settings.normalTColor, "user"]) except: import traceback; traceback.print_exc() nChannel.cMsgBuffer = [] #This fixes the weird problem with the queue being in the wrong channel. #Add the user who PM'ed you to the Channel list server.channels.append(nChannel) #Call all the onPrivMsg events for event in IRC.eventFunctions: if event.eventName == "onPrivMsg" and event.cServer == server: gobject.idle_add(event.aFunc,m,server,otherStuff)
def onMOTDMsg(m,cServer): IRCHelper.join(cServer,"#botplay")