diff options
author | Treeki <treeki@gmail.com> | 2014-01-25 01:34:11 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2014-01-25 01:34:11 +0100 |
commit | bdbdb57fc3ae81c0dbb46c4e6ffdd6c0205a81c0 (patch) | |
tree | 452d25a6fc233199272c634c42a4f72c46af2488 /python_client.py | |
parent | f83687cc5e99d66153c296e7632b88de2594b79d (diff) | |
download | bounce4-bdbdb57fc3ae81c0dbb46c4e6ffdd6c0205a81c0.tar.gz bounce4-bdbdb57fc3ae81c0dbb46c4e6ffdd6c0205a81c0.zip |
add channel topic tracking
Diffstat (limited to '')
-rw-r--r-- | python_client.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/python_client.py b/python_client.py index 11c4a50..4e7f1a3 100644 --- a/python_client.py +++ b/python_client.py @@ -61,7 +61,7 @@ def reader(): pos = 0 bufsize = len(readbuf) - print('[bufsize: %d]' % bufsize) + #print('[bufsize: %d]' % bufsize) while True: if (pos + 8) > bufsize: break @@ -107,7 +107,7 @@ def reader(): pos += size - print('[processed %d bytes]' % pos) + #print('[processed %d bytes]' % pos) readbuf = readbuf[pos:] def writePacket(type, data, allowUnauthed=False): @@ -179,11 +179,14 @@ class ChannelTab(WindowTab): def __init__(self, parent=None): WindowTab.__init__(self, parent) + self.topicLabel = QtWidgets.QLabel(self) + self.topicLabel.setWordWrap(True) self.userList = QtWidgets.QListWidget(self) self.users = {} def makeLayout(self): sublayout = QtWidgets.QVBoxLayout() + sublayout.addWidget(self.topicLabel) sublayout.addWidget(self.output) sublayout.addWidget(self.input) @@ -217,6 +220,8 @@ class ChannelTab(WindowTab): self.topic = pdata[pos:pos+topiclen].decode('utf-8', 'replace') pos += topiclen + self.topicLabel.setText(self.topic) + return pos def addUsers(self, pdata): @@ -284,6 +289,11 @@ class ChannelTab(WindowTab): uo.prefix = prefix uo.syncItemText() + def changeTopic(self, pdata): + tlen = u32.unpack_from(pdata, 4)[0] + self.topic = pdata[8:8+tlen].decode('utf-8', 'replace') + self.topicLabel.setText(self.topic) + class MainWindow(QtWidgets.QMainWindow): def __init__(self, parent=None): @@ -370,6 +380,10 @@ class MainWindow(QtWidgets.QMainWindow): # Change user modes in channel wndID = u32.unpack_from(pdata, 0)[0] self.tabLookup[wndID].changeUserMode(pdata) + elif ptype == 0x124: + # Change topic in channel + wndID = u32.unpack_from(pdata, 0)[0] + self.tabLookup[wndID].changeTopic(pdata) return True else: |