Skip to content

Commit

Permalink
Use 6667 and no tls by default, make it configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheeo committed Mar 30, 2016
1 parent add45e0 commit 8e201b7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
0.11.58
=======

- Show a warning if the required C++ 2010 runtime is missing
- Default IRC to port 6667 without the use of TLS (Standard IRC behavior)


0.11.57
=======

Expand Down
23 changes: 11 additions & 12 deletions src/chat/_chatwidget.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import logging

from client import Player

logger = logging.getLogger(__name__)


Expand All @@ -11,7 +9,6 @@

from config import Settings
import util
import fa

import sys
import chat
Expand All @@ -20,14 +17,17 @@
from chat.irclib import SimpleIRCClient
import notifications as ns

IRC_PORT = 8167
IRC_SERVER = "irc.faforever.com"
PONG_INTERVAL = 100000 # milliseconds between pongs
PONG_INTERVAL = 60000 # milliseconds between pongs

FormClass, BaseClass = util.loadUiType("chat/chat.ui")

class ChatWidget(FormClass, BaseClass, SimpleIRCClient):

use_chat = Settings.persisted_property('chat/enabled', type=bool, default_value=True)
irc_port = Settings.persisted_property('chat/port', type=int, default_value=6667)
irc_host = Settings.persisted_property('chat/host', type=str, default_value='irc.faforever.com')
irc_tls = Settings.persisted_property('chat/tls', type=bool, default_value=False)

'''
This is the chat lobby module for the FAF client.
It manages a list of channels and dispatches IRC events (lobby inherits from irclib's client class)
Expand Down Expand Up @@ -58,8 +58,6 @@ def __init__(self, client, *args, **kwargs):
self.identified = False

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

Expand Down Expand Up @@ -99,15 +97,16 @@ def disconnect(self):
@QtCore.pyqtSlot(object)
def connect(self, player):
try:
self.irc_connect(self.ircServer,
self.ircPort,
logger.info("Connecting to IRC at: {}:{}. TLS: {}".format(self.irc_host, self.irc_port, self.irc_tls))
self.irc_connect(self.irc_host,
self.irc_port,
player.login,
ssl=True,
ssl=self.irc_tls,
ircname=player.login,
username=player.id)
self._notifier = QSocketNotifier(self.ircobj.connections[0]._get_socket().fileno(), QSocketNotifier.Read, self)
self._notifier.activated.connect(self.once)
self._timer.start(60 * 1000) # 60 s
self._timer.start(PONG_INTERVAL)

except:
logger.debug("Unable to connect to IRC server.")
Expand Down

0 comments on commit 8e201b7

Please sign in to comment.