Exemple #1
0
def topicStuff(server,i,otherStuff):
    #:irc.archerseven.com 332 Nyx28 #Nyx :The Nyx channel
    #:[email protected] TOPIC #ogame :This is the ogame channel, talk about ogame battles and look for ogame help here....
    #:irc.archerseven.com 333 Nyx28 #ogame dom96 1252250064
    if len(i.split(" ")) > 1: 
        msgCode=i.split(" ")[1]
    else:
        return

    datParsed = ResponseParser.parseServerRegex(i)[0]
    
    if msgCode == "332":
        for ch in server.channels:
            if ch.cName == datParsed.channel:
                ch.cTopic = datParsed.msg

        for event in IRC.eventFunctions:
            if event.eventName == "onTopicChange" and event.cServer == server:
                gobject.idle_add(event.aFunc,datParsed,server,otherStuff)
    elif msgCode == "333":
        for event in IRC.eventFunctions:
            if event.eventName == "onTopicChange" and event.cServer == server:
                gobject.idle_add(event.aFunc,datParsed,server,otherStuff)

    elif "TOPIC" in i:
        m = ResponseParser.parseMsg(i,False)

        if m.typeMsg == "TOPIC":
            for ch in server.channels:
                if ch.cName == m.channel:
                    ch.cTopic = m.msg
            for event in IRC.eventFunctions:
                if event.eventName == "onTopicChange" and event.cServer == server:
                    gobject.idle_add(event.aFunc,m,server,otherStuff)
Exemple #2
0
def servResp(server, i, otherStuff):
    #Split into new lines \n
    splitNewLines = i.split("\n")
    for m in splitNewLines:
        splitI = i.split(" ")
    try:
        if (splitI[1] in numericCode()):
            datParsed = ResponseParser.parseServerRegex(i)
            #Some stuff that has to be done, e.g.433(Nickname already in use), 432(Nickname reserved for someone...? Like ChanServ)
            if splitI[1] == "433" or splitI[1] == "432":
                #If the MOTD has been received that means the user connected
                if server.cMotd == None:
                    #Loop through the nicks to check which nick was
                    #used, which will give you the next one to use.
                    for i in range(0,len(server.nicks)):
                        if server.nicks[i] == server.cNick:
                            if len(server.nicks) != i + 1:
                                server.cNick = server.nicks[i+1]
                            else:
                                #If there is no more alternative nicks
                                #left make a random one.
                                import random
                                server.cNick = "r" + str(hash(str(random.randint(0,200)))).replace("-","")

                            #Send a raw command, NICK <NewNick>
                            pDebug("\033[1;34mNICK " + server.cNick + "\\r\\n\033[1;m")
                            server.cSocket.send("NICK " + server.cNick + "\r\n")
                            break


            for event in IRC.eventFunctions:
                if event.eventName == "onServerMsg" and event.cServer == server:
                    gobject.idle_add(event.aFunc,datParsed,server,otherStuff)
    except:
        pDebug("\033[1;40m\033[1;33mIndex out of range-servResp\033[1;m\033[1;m")
Exemple #3
0
def channelModeStuff(server,i,otherStuff):
    #:irc.archerseven.com 324 Nyx22 #ogame +nt
    #:irc.archerseven.com 329 Nyx22 #ogame 1253286530
    if len(i.split(" ")) > 1:
        msgCode=i.split(" ")[1]
    else:
        return 
        
    datParsed = ResponseParser.parseServerRegex(i)[0]
    
    if msgCode=="324":
        for ch in server.channels:
            if ch.cName == datParsed.channel:
                ch.cMode = datParsed.msg

        for event in IRC.eventFunctions:
            if event.eventName == "onChannelModeChange" and event.cServer == server:
                gobject.idle_add(event.aFunc,datParsed,server,otherStuff)
    if msgCode=="329":
        for event in IRC.eventFunctions:
            if event.eventName == "onChannelModeChange" and event.cServer == server:
                gobject.idle_add(event.aFunc,datParsed,server,otherStuff)