6/9
This commit is contained in:
parent
19597ff06b
commit
fef7db8161
5 changed files with 66 additions and 23 deletions
5
irc.py
5
irc.py
|
@ -340,6 +340,8 @@ class PesterHandler(DefaultCommandHandler):
|
||||||
msg = msg.decode('utf-8')
|
msg = msg.decode('utf-8')
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
msg = msg.decode('iso-8859-1', 'ignore')
|
msg = msg.decode('iso-8859-1', 'ignore')
|
||||||
|
nick = nick.decode('utf-8')
|
||||||
|
chan = chan.decode('utf-8')
|
||||||
handle = nick[0:nick.find("!")]
|
handle = nick[0:nick.find("!")]
|
||||||
logging.info("---> recv \"NOTICE %s :%s\"" % (handle, msg))
|
logging.info("---> recv \"NOTICE %s :%s\"" % (handle, msg))
|
||||||
if handle == "ChanServ" and chan == self.parent.mainwindow.profile().handle and msg[0:2] == "[#":
|
if handle == "ChanServ" and chan == self.parent.mainwindow.profile().handle and msg[0:2] == "[#":
|
||||||
|
@ -458,8 +460,9 @@ class PesterHandler(DefaultCommandHandler):
|
||||||
self.parent.mainwindow.randhandler.setRunning(True)
|
self.parent.mainwindow.randhandler.setRunning(True)
|
||||||
self.parent.moodUpdated.emit(handle, Mood("chummy"))
|
self.parent.moodUpdated.emit(handle, Mood("chummy"))
|
||||||
def mode(self, op, channel, mode, *handles):
|
def mode(self, op, channel, mode, *handles):
|
||||||
|
channel = channel.decode('utf-8')
|
||||||
if len(handles) <= 0: handles = [""]
|
if len(handles) <= 0: handles = [""]
|
||||||
opnick = op[0:op.find("!")]
|
opnick = op.decode('utf-8')[0:op.decode('utf-8').find("!")]
|
||||||
if op == channel or channel == self.parent.mainwindow.profile().handle:
|
if op == channel or channel == self.parent.mainwindow.profile().handle:
|
||||||
modes = list(self.parent.mainwindow.modes)
|
modes = list(self.parent.mainwindow.modes)
|
||||||
if modes and modes[0] == "+": modes = modes[1:]
|
if modes and modes[0] == "+": modes = modes[1:]
|
||||||
|
|
3
menus.py
3
menus.py
|
@ -1737,8 +1737,7 @@ class LoadingScreen(QtWidgets.QDialog):
|
||||||
# Set a timer so that we don't immediately disconnect anyway.
|
# Set a timer so that we don't immediately disconnect anyway.
|
||||||
self.cancel.setEnabled(False)
|
self.cancel.setEnabled(False)
|
||||||
# A few seconds should be enough.
|
# A few seconds should be enough.
|
||||||
self.timer = QtCore.QTimer.singleShot(2000, self,
|
self.timer = QtCore.QTimer.singleShot(2000, self.enableQuit)
|
||||||
QtCore.SLOT('enableQuit()'))
|
|
||||||
|
|
||||||
def showReconnect(self):
|
def showReconnect(self):
|
||||||
self.ok.show()
|
self.ok.show()
|
||||||
|
|
|
@ -66,12 +66,12 @@ class CommandHandler(object):
|
||||||
["command", "sub", "func"].
|
["command", "sub", "func"].
|
||||||
"""
|
"""
|
||||||
if isinstance(in_command_parts, (str, bytes)):
|
if isinstance(in_command_parts, (str, bytes)):
|
||||||
in_command_parts = in_command_parts.split(bytes('.', 'ascii'))
|
in_command_parts = in_command_parts.split('.')
|
||||||
command_parts = in_command_parts[:]
|
command_parts = in_command_parts[:]
|
||||||
|
|
||||||
p = self
|
p = self
|
||||||
while command_parts:
|
while command_parts:
|
||||||
cmd = command_parts.pop(0).decode('ascii')
|
cmd = command_parts.pop(0)
|
||||||
if cmd.startswith('_'):
|
if cmd.startswith('_'):
|
||||||
raise ProtectedCommandError(in_command_parts)
|
raise ProtectedCommandError(in_command_parts)
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,9 @@ def parse_raw_irc_command(element):
|
||||||
|
|
||||||
<crlf> ::= CR LF
|
<crlf> ::= CR LF
|
||||||
"""
|
"""
|
||||||
parts = element.strip().split(bytes(" ", "ascii"))
|
element = element.decode("utf-8")
|
||||||
if parts[0].startswith(bytes(':', 'ascii')):
|
parts = element.strip().split(" ")
|
||||||
|
if parts[0].startswith(':'):
|
||||||
prefix = parts[0][1:]
|
prefix = parts[0][1:]
|
||||||
command = parts[1]
|
command = parts[1]
|
||||||
args = parts[2:]
|
args = parts[2:]
|
||||||
|
@ -63,12 +64,12 @@ def parse_raw_irc_command(element):
|
||||||
logging.warn('unknown numeric event %s' % command)
|
logging.warn('unknown numeric event %s' % command)
|
||||||
command = command.lower()
|
command = command.lower()
|
||||||
|
|
||||||
if args[0].startswith(bytes(':', 'ascii')):
|
if args[0].startswith(':'):
|
||||||
args = [bytes(" ", "ascii").join(args)[1:]]
|
args = [" ".join(args)[1:]]
|
||||||
else:
|
else:
|
||||||
for idx, arg in enumerate(args):
|
for idx, arg in enumerate(args):
|
||||||
if arg.startswith(bytes(':', 'ascii')):
|
if arg.startswith(':'):
|
||||||
args = args[:idx] + [bytes(" ", 'ascii').join(args[idx:])[1:]]
|
args = args[:idx] + [" ".join(args[idx:])[1:]]
|
||||||
break
|
break
|
||||||
|
|
||||||
return (prefix, command, args)
|
return (prefix, command, args)
|
||||||
|
|
|
@ -1286,7 +1286,7 @@ class PesterWindow(MovingWindow):
|
||||||
|
|
||||||
# Fuck you some more OSX leopard! >:(
|
# Fuck you some more OSX leopard! >:(
|
||||||
if not ostools.isOSXLeopard():
|
if not ostools.isOSXLeopard():
|
||||||
QtCore.QTimer.singleShot(1000, self, QtCore.SLOT('mspacheck()'))
|
QtCore.QTimer.singleShot(1000, self.mspacheck)
|
||||||
|
|
||||||
self.pcUpdate['QString', 'QString'].connect(self.updateMsg)
|
self.pcUpdate['QString', 'QString'].connect(self.updateMsg)
|
||||||
|
|
||||||
|
@ -3051,7 +3051,7 @@ class MainProgram(QtCore.QObject):
|
||||||
|
|
||||||
self.trayicon.setContextMenu(self.traymenu)
|
self.trayicon.setContextMenu(self.traymenu)
|
||||||
self.trayicon.show()
|
self.trayicon.show()
|
||||||
self.trayicon.activated[QSystemTrayIcon.ActivationReason].connect(self.widget.systemTrayActivated)
|
self.trayicon.activated[QtWidgets.QSystemTrayIcon.ActivationReason].connect(self.widget.systemTrayActivated)
|
||||||
self.widget.trayIconSignal[int].connect(self.trayicon.changeTrayIcon)
|
self.widget.trayIconSignal[int].connect(self.trayicon.changeTrayIcon)
|
||||||
self.widget.closeToTraySignal.connect(self.trayiconShow)
|
self.widget.closeToTraySignal.connect(self.trayiconShow)
|
||||||
self.widget.closeSignal.connect(self.trayicon.mainWindowClosed)
|
self.widget.closeSignal.connect(self.trayicon.mainWindowClosed)
|
||||||
|
@ -3064,7 +3064,7 @@ class MainProgram(QtCore.QObject):
|
||||||
self.irc = PesterIRC(self.widget.config, self.widget, self.server)
|
self.irc = PesterIRC(self.widget.config, self.widget, self.server)
|
||||||
self.connectWidgets(self.irc, self.widget)
|
self.connectWidgets(self.irc, self.widget)
|
||||||
|
|
||||||
self.widget.gainAttention[QWidget].connect(self.alertWindow)
|
self.widget.gainAttention[QtWidgets.QWidget].connect(self.alertWindow)
|
||||||
|
|
||||||
|
|
||||||
# This doesn't know as far as I'm aware, so it's commented out for now.
|
# This doesn't know as far as I'm aware, so it's commented out for now.
|
||||||
|
@ -3195,18 +3195,58 @@ Click this message to never see this again.")
|
||||||
('quirkDisable(QString, QString, QString)',
|
('quirkDisable(QString, QString, QString)',
|
||||||
'quirkDisable(QString, QString, QString)')
|
'quirkDisable(QString, QString, QString)')
|
||||||
]
|
]
|
||||||
|
def ircQtConnections(self, irc, widget):
|
||||||
|
# IRC --> Main window
|
||||||
|
return ((widget.sendMessage, irc.sendMessage),
|
||||||
|
(widget.sendNotice, irc.sendNotice),
|
||||||
|
(widget.newConvoStarted, irc.startConvo),
|
||||||
|
(widget.convoClosed, irc.endConvo),
|
||||||
|
(widget.profileChanged, irc.updateProfile),
|
||||||
|
(widget.moodRequest, irc.getMood),
|
||||||
|
(widget.moodsRequest, irc.getMoods),
|
||||||
|
(widget.moodUpdated, irc.updateMood),
|
||||||
|
(widget.mycolorUpdated, irc.updateColor),
|
||||||
|
(widget.blockedChum, irc.blockedChum),
|
||||||
|
(widget.unblockedChum, irc.unblockedChum),
|
||||||
|
(widget.requestNames, irc.requestNames),
|
||||||
|
(widget.requestChannelList, irc.requestChannelList),
|
||||||
|
(widget.joinChannel, irc.joinChannel),
|
||||||
|
(widget.leftChannel, irc.leftChannel),
|
||||||
|
(widget.kickUser, irc.kickUser),
|
||||||
|
(widget.setChannelMode, irc.setChannelMode),
|
||||||
|
(widget.channelNames, irc.channelNames),
|
||||||
|
(widget.inviteChum, irc.inviteChum),
|
||||||
|
(widget.pingServer, irc.pingServer),
|
||||||
|
(widget.setAway, irc.setAway),
|
||||||
|
(widget.killSomeQuirks, irc.killSomeQuirks),
|
||||||
|
(widget.reconnectIRC, irc.reconnectIRC),
|
||||||
|
# Main window --> IRC
|
||||||
|
(irc.connected, widget.connected),
|
||||||
|
(irc.moodUpdated, widget.updateMoodSlot),
|
||||||
|
(irc.messageReceived, widget.deliverMessage),
|
||||||
|
(irc.memoReceived, widget.deliverMemo),
|
||||||
|
(irc.noticeReceived, widget.deliverNotice),
|
||||||
|
(irc.inviteReceived, widget.deliverInvite),
|
||||||
|
(irc.nickCollision, widget.nickCollision),
|
||||||
|
(irc.myHandleChanged, widget.myHandleChanged),
|
||||||
|
(irc.namesReceived, widget.updateNames),
|
||||||
|
(irc.userPresentUpdate, widget.userPresentUpdate),
|
||||||
|
(irc.channelListReceived, widget.updateChannelList),
|
||||||
|
(irc.timeCommand, widget.timeCommand),
|
||||||
|
(irc.chanInviteOnly, widget.chanInviteOnly),
|
||||||
|
(irc.modesUpdated, widget.modesUpdated),
|
||||||
|
(irc.cannotSendToChan, widget.cannotSendToChan),
|
||||||
|
(irc.tooManyPeeps, widget.tooManyPeeps),
|
||||||
|
(irc.quirkDisable, widget.quirkDisable))
|
||||||
def connectWidgets(self, irc, widget):
|
def connectWidgets(self, irc, widget):
|
||||||
irc.finished.connect(self.restartIRC)
|
irc.finished.connect(self.restartIRC)
|
||||||
irc.connected.connect(self.connected)
|
irc.connected.connect(self.connected)
|
||||||
for c in self.widget2irc:
|
for sig, slot in self.ircQtConnections(irc, widget):
|
||||||
widget.c[0].connect(irc.c[1])
|
sig.connect(slot)
|
||||||
for c in self.irc2widget:
|
|
||||||
irc.c[0].connect(widget.c[1])
|
|
||||||
def disconnectWidgets(self, irc, widget):
|
def disconnectWidgets(self, irc, widget):
|
||||||
for c in self.widget2irc:
|
for sig, slot in self.ircQtConnections(irc, widget):
|
||||||
widget.c[0].disconnect(irc.c[1])
|
sig.disconnect(slot)
|
||||||
for c in self.irc2widget:
|
|
||||||
irc.c[0].disconnect(widget.c[1])
|
|
||||||
irc.connected.disconnect(self.connected)
|
irc.connected.disconnect(self.connected)
|
||||||
self.irc.finished.disconnect(self.restartIRC)
|
self.irc.finished.disconnect(self.restartIRC)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue