summaryrefslogtreecommitdiff
path: root/IrcHandler.py
diff options
context:
space:
mode:
authorJoe Robinson <joe@lc8n.com>2017-04-14 19:07:16 +0200
committerJoe Robinson <joe@lc8n.com>2017-04-14 19:07:16 +0200
commita75725425aaa29ad26d7f1225ec7e4e6c55a640d (patch)
tree27f3f2ca1b8c44bef27b30a278f6f83c37996abe /IrcHandler.py
Initial commit, basic connection and message handling, some broken old code
Diffstat (limited to 'IrcHandler.py')
-rw-r--r--IrcHandler.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/IrcHandler.py b/IrcHandler.py
new file mode 100644
index 0000000..1427f3e
--- /dev/null
+++ b/IrcHandler.py
@@ -0,0 +1,52 @@
+from PyQt5.QtCore import QUrl, QThread, pyqtSignal, QObject, pyqtSlot, Qt
+from PyQt5.QtWidgets import QApplication
+from PyQt5.QtQuick import QQuickView, QQuickItem, QQuickWindow
+from PyQt5.QtQml import QQmlApplicationEngine
+from PyQt5.QtGui import QGuiApplication, QKeyEvent
+
+import IrcConnection
+
+class IrcHandler(QObject):
+ sig = pyqtSignal(str,str)
+
+ def __init__(self):
+ super(self.__class__, self).__init__()
+ self.channels = list()
+ self.nick = ""
+ self.server = "irc.blatech.net"
+ self.irc = IrcConnection.ircConnectThread()
+
+ def get_channels():
+ return self.channels
+
+ def set_channels(channels):
+ self.channels = channels
+
+ def add_channel(channel):
+ self.channels.append(channel)
+
+ def get_server():
+ return self.server
+
+ def set_server(server):
+ self.server = server
+
+ def get_nick():
+ return self.nick
+
+ def set_nick(nick):
+ self.nick = nick
+
+ def handle_input(self, view):
+ text = view.get_input()
+ print(text)
+ self.sig.emit("#wtest", text)
+ view.reset_input()
+ view.update_chat(text)
+
+ def connect_to_irc(self, view):
+ self.irc.sig.connect(view.update_chat)
+ # self.irc.nick_sig.connect(self.add_nick)
+ # self.irc.join_sig.connect(self.join_channel)
+ self.irc.start()
+ self.sig.connect(self.irc.send_msg)