Ejemplo n.º 1
0
 def announce(self, broadcast):
     '''
     Notifies all crucial channels about the status of the client.
     '''
     logger.debug("BROADCAST:" + broadcast)
     for channel in self.crucialChannels:
         self.sendMsg(channel, broadcast)
Ejemplo n.º 2
0
 def announce(self, broadcast):
     '''
     Notifies all crucial channels about the status of the client.
     '''
     logger.debug("BROADCAST:" + broadcast)
     for channel in self.crucialChannels:
         self.sendMsg(channel, broadcast)
Ejemplo n.º 3
0
 def openUrl(self, url):
     logger.debug("Clicked on URL: " + url.toString())
     if url.scheme() == "faflive":
         replay(url)
     elif url.scheme() == "fafgame":
         self.lobby.client.joinGameFromURL(url)
     else :
         QtGui.QDesktopServices.openUrl(url)
Ejemplo n.º 4
0
 def openUrl(self, url):
     logger.debug("Clicked on URL: " + url.toString())
     if url.scheme() == "faflive":
         replay(url)
     elif url.scheme() == "fafgame":
         self.lobby.client.joinGameFromURL(url)
     else:
         QtGui.QDesktopServices.openUrl(url)
Ejemplo n.º 5
0
    def __init__(self, client, *args, **kwargs):
        logger.debug("Lobby instantiating.")
        BaseClass.__init__(self, *args, **kwargs)
        SimpleIRCClient.__init__(self)

        self.setupUi(self)


        # CAVEAT: These will fail if loaded before theming is loaded
        import json
        self.OPERATOR_COLORS = json.loads(util.readfile("chat/formatters/operator_colors.json"))

        self.client = client
        self.channels = {}

        #avatar downloader
        self.nam = QNetworkAccessManager()
        self.nam.finished.connect(self.finishDownloadAvatar)

        #nickserv stuff
        self.identified = False

        #IRC parameters
        self.ircServer = IRC_SERVER
        self.ircPort = IRC_PORT
        self.crucialChannels = ["#aeolus"]
        self.optionalChannels = []

        #We can't send command until the welcom message is received
        self.welcomed = False

        # Load colors and styles from theme
        self.specialUserColors = json.loads(util.readfile("chat/formatters/special_colors.json"))
        self.a_style = util.readfile("chat/formatters/a_style.qss")

        #load UI perform some tweaks
        self.tabBar().setTabButton(0, 1, None)

        #add self to client's window
        self.client.chatTab.layout().addWidget(self)
        self.tabCloseRequested.connect(self.closeChannel)

        #add signal handler for game exit
        self.client.gameExit.connect(self.processGameExit)
        self.replayInfo = fa.exe.instance.info


        #Hook with client's connection and autojoin mechanisms
        self.client.connected.connect(self.connect)
        self.client.publicBroadcast.connect(self.announce)
        self.client.autoJoin.connect(self.autoJoin)
        self.client.channelsUpdated.connect(self.addChannels)
        self.channelsAvailable = []
        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.poll)

        # disconnection checks
        self.canDisconnect = False
Ejemplo n.º 6
0
    def __init__(self, client, *args, **kwargs):
        logger.debug("Lobby instantiating.")
        BaseClass.__init__(self, *args, **kwargs)
        SimpleIRCClient.__init__(self)

        self.setupUi(self)

        # CAVEAT: These will fail if loaded before theming is loaded
        import json
        self.OPERATOR_COLORS = json.loads(
            util.readfile("chat/formatters/operator_colors.json"))

        self.client = client
        self.channels = {}

        #avatar downloader
        self.nam = QNetworkAccessManager()
        self.nam.finished.connect(self.finishDownloadAvatar)

        #nickserv stuff
        self.identified = False

        #IRC parameters
        self.ircServer = IRC_SERVER
        self.ircPort = IRC_PORT
        self.crucialChannels = ["#aeolus"]
        self.optionalChannels = []

        #We can't send command until the welcom message is received
        self.welcomed = False

        # Load colors and styles from theme
        self.specialUserColors = json.loads(
            util.readfile("chat/formatters/special_colors.json"))
        self.a_style = util.readfile("chat/formatters/a_style.qss")

        #load UI perform some tweaks
        self.tabBar().setTabButton(0, 1, None)

        #add self to client's window
        self.client.chatTab.layout().addWidget(self)
        self.tabCloseRequested.connect(self.closeChannel)

        #add signal handler for game exit
        self.client.gameExit.connect(self.processGameExit)
        self.replayInfo = fa.exe.instance.info

        #Hook with client's connection and autojoin mechanisms
        self.client.connected.connect(self.connect)
        self.client.publicBroadcast.connect(self.announce)
        self.client.autoJoin.connect(self.autoJoin)
        self.client.channelsUpdated.connect(self.addChannels)
        self.channelsAvailable = []
        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.poll)

        # disconnection checks
        self.canDisconnect = False
Ejemplo n.º 7
0
    def connect(self):
        #Do the actual connecting, join all important channels
        try:
            self.irc_connect(self.ircServer, self.ircPort, self.client.login, ssl=True)
            self.timer.start()

        except:
            logger.debug("Unable to connect to IRC server.")
            self.serverLogArea.appendPlainText("Unable to connect to the chat server, but you should still be able to host and join games.")
            logger.error("IRC Exception", exc_info=sys.exc_info())
Ejemplo n.º 8
0
    def on_namreply(self, c, e):
        self.serverLogArea.appendPlainText("[%s: %s->%s]" % (e.eventtype(), e.source(), e.target()) + "\n".join(e.arguments()))
        channel = e.arguments()[1]
        listing = e.arguments()[2].split()

        for user in listing:
            self.channels[channel].addChatter(user)


            # if self.client.GalacticWar.channel and channel == self.client.GalacticWar.channel.name :
            #     self.client.GalacticWar.channel.addChatter(user)

            QtGui.QApplication.processEvents()      #Added by thygrrr to improve application responsiveness on large IRC packets

        logger.debug("Added " + str(len(listing)) + " Chatters")
Ejemplo n.º 9
0
    def connect(self):
        #Do the actual connecting, join all important channels
        try:
            self.irc_connect(self.ircServer,
                             self.ircPort,
                             self.client.login,
                             ssl=True)
            self.timer.start()

        except:
            logger.debug("Unable to connect to IRC server.")
            self.serverLogArea.appendPlainText(
                "Unable to connect to the chat server, but you should still be able to host and join games."
            )
            logger.error("IRC Exception", exc_info=sys.exc_info())
Ejemplo n.º 10
0
    def on_namreply(self, c, e):
        self.serverLogArea.appendPlainText(
            "[%s: %s->%s]" % (e.eventtype(), e.source(), e.target()) +
            "\n".join(e.arguments()))
        channel = e.arguments()[1]
        listing = e.arguments()[2].split()

        for user in listing:
            self.channels[channel].addChatter(user)

            # if self.client.GalacticWar.channel and channel == self.client.GalacticWar.channel.name :
            #     self.client.GalacticWar.channel.addChatter(user)

            QtGui.QApplication.processEvents(
            )  #Added by thygrrr to improve application responsiveness on large IRC packets

        logger.debug("Added " + str(len(listing)) + " Chatters")