Receive notices + auto-off quirks for bots
This commit is contained in:
parent
2f0d750480
commit
f77215d5f9
3 changed files with 51 additions and 7 deletions
|
@ -18,6 +18,8 @@ CHANGELOG
|
||||||
* Animated smilies - Kiooeht [evacipatedBox]
|
* Animated smilies - Kiooeht [evacipatedBox]
|
||||||
* Delete profiles - Kiooeht [evacipatedBox]
|
* Delete profiles - Kiooeht [evacipatedBox]
|
||||||
* Customize minimize and close button actions - Kiooeht [evacipatedBox]
|
* Customize minimize and close button actions - Kiooeht [evacipatedBox]
|
||||||
|
* Receive notices from services you're talking to - Kiooeht [evacipatedBox]
|
||||||
|
* Automatically turn off quirks when talking to bots - Kiooeht [evacipatedBox]
|
||||||
* Bug fixes
|
* Bug fixes
|
||||||
* Logviewer updates - Kiooeht [evacipatedBox]
|
* Logviewer updates - Kiooeht [evacipatedBox]
|
||||||
* Memo scrollbar thing - Kiooeht [evacipatedBox]
|
* Memo scrollbar thing - Kiooeht [evacipatedBox]
|
||||||
|
|
13
irc.py
13
irc.py
|
@ -217,6 +217,7 @@ class PesterIRC(QtCore.QThread):
|
||||||
colorUpdated = QtCore.pyqtSignal(QtCore.QString, QtGui.QColor)
|
colorUpdated = QtCore.pyqtSignal(QtCore.QString, QtGui.QColor)
|
||||||
messageReceived = QtCore.pyqtSignal(QtCore.QString, QtCore.QString)
|
messageReceived = QtCore.pyqtSignal(QtCore.QString, QtCore.QString)
|
||||||
memoReceived = QtCore.pyqtSignal(QtCore.QString, QtCore.QString, QtCore.QString)
|
memoReceived = QtCore.pyqtSignal(QtCore.QString, QtCore.QString, QtCore.QString)
|
||||||
|
noticeReceived = QtCore.pyqtSignal(QtCore.QString, QtCore.QString)
|
||||||
timeCommand = QtCore.pyqtSignal(QtCore.QString, QtCore.QString, QtCore.QString)
|
timeCommand = QtCore.pyqtSignal(QtCore.QString, QtCore.QString, QtCore.QString)
|
||||||
namesReceived = QtCore.pyqtSignal(QtCore.QString, PesterList)
|
namesReceived = QtCore.pyqtSignal(QtCore.QString, PesterList)
|
||||||
channelListReceived = QtCore.pyqtSignal(PesterList)
|
channelListReceived = QtCore.pyqtSignal(PesterList)
|
||||||
|
@ -227,6 +228,18 @@ class PesterIRC(QtCore.QThread):
|
||||||
QtCore.QString)
|
QtCore.QString)
|
||||||
|
|
||||||
class PesterHandler(DefaultCommandHandler):
|
class PesterHandler(DefaultCommandHandler):
|
||||||
|
def notice(self, nick, chan, msg):
|
||||||
|
try:
|
||||||
|
msg = msg.decode('utf-8')
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
msg = msg.decode('iso-8859-1', 'ignore')
|
||||||
|
handle = nick[0:nick.find("!")]
|
||||||
|
logging.info("---> recv \"NOTICE %s :%s\"" % (handle, msg))
|
||||||
|
if handle == "ChanServ":
|
||||||
|
if chan == self.parent.mainwindow.profile().handle and msg[0:2] == "[#":
|
||||||
|
self.parent.memoReceived.emit(msg[1:msg.index("]")], handle, msg)
|
||||||
|
else:
|
||||||
|
self.parent.noticeReceived.emit(handle, msg)
|
||||||
def privmsg(self, nick, chan, msg):
|
def privmsg(self, nick, chan, msg):
|
||||||
try:
|
try:
|
||||||
msg = msg.decode('utf-8')
|
msg = msg.decode('utf-8')
|
||||||
|
|
|
@ -879,6 +879,8 @@ class chumArea(RightClickTree):
|
||||||
self.topLevelItem(0).sortChildren(0, QtCore.Qt.AscendingOrder)
|
self.topLevelItem(0).sortChildren(0, QtCore.Qt.AscendingOrder)
|
||||||
def takeItem(self, chumLabel):
|
def takeItem(self, chumLabel):
|
||||||
r = None
|
r = None
|
||||||
|
if not hasattr(chumLabel, 'chum'):
|
||||||
|
return r
|
||||||
for i in range(self.topLevelItemCount()):
|
for i in range(self.topLevelItemCount()):
|
||||||
for j in range(self.topLevelItem(i).childCount()):
|
for j in range(self.topLevelItem(i).childCount()):
|
||||||
if self.topLevelItem(i).child(j).text(0) == chumLabel.chum.handle:
|
if self.topLevelItem(i).child(j).text(0) == chumLabel.chum.handle:
|
||||||
|
@ -1411,19 +1413,23 @@ class PesterWindow(MovingWindow):
|
||||||
profilemenu.addAction(changecoloraction)
|
profilemenu.addAction(changecoloraction)
|
||||||
profilemenu.addAction(switch)
|
profilemenu.addAction(switch)
|
||||||
|
|
||||||
self.aboutAction = QtGui.QAction(self.theme["main/menus/help/about"], self)
|
|
||||||
self.connect(self.aboutAction, QtCore.SIGNAL('triggered()'),
|
|
||||||
self, QtCore.SLOT('aboutPesterchum()'))
|
|
||||||
self.botAction = QtGui.QAction("CALSPRITE", self)
|
|
||||||
self.connect(self.botAction, QtCore.SIGNAL('triggered()'),
|
|
||||||
self, QtCore.SLOT('loadCalsprite()'))
|
|
||||||
self.helpAction = QtGui.QAction("HELP", self)
|
self.helpAction = QtGui.QAction("HELP", self)
|
||||||
self.connect(self.helpAction, QtCore.SIGNAL('triggered()'),
|
self.connect(self.helpAction, QtCore.SIGNAL('triggered()'),
|
||||||
self, QtCore.SLOT('launchHelp()'))
|
self, QtCore.SLOT('launchHelp()'))
|
||||||
|
self.botAction = QtGui.QAction("CALSPRITE", self)
|
||||||
|
self.connect(self.botAction, QtCore.SIGNAL('triggered()'),
|
||||||
|
self, QtCore.SLOT('loadCalsprite()'))
|
||||||
|
self.nickServAction = QtGui.QAction("NICKSERV", self)
|
||||||
|
self.connect(self.nickServAction, QtCore.SIGNAL('triggered()'),
|
||||||
|
self, QtCore.SLOT('loadNickServ()'))
|
||||||
|
self.aboutAction = QtGui.QAction(self.theme["main/menus/help/about"], self)
|
||||||
|
self.connect(self.aboutAction, QtCore.SIGNAL('triggered()'),
|
||||||
|
self, QtCore.SLOT('aboutPesterchum()'))
|
||||||
helpmenu = self.menu.addMenu(self.theme["main/menus/help/_name"])
|
helpmenu = self.menu.addMenu(self.theme["main/menus/help/_name"])
|
||||||
self.helpmenu = helpmenu
|
self.helpmenu = helpmenu
|
||||||
self.helpmenu.addAction(self.helpAction)
|
self.helpmenu.addAction(self.helpAction)
|
||||||
self.helpmenu.addAction(self.botAction)
|
self.helpmenu.addAction(self.botAction)
|
||||||
|
self.helpmenu.addAction(self.nickServAction)
|
||||||
self.helpmenu.addAction(self.aboutAction)
|
self.helpmenu.addAction(self.aboutAction)
|
||||||
|
|
||||||
self.closeButton = WMButton(PesterIcon(self.theme["main/close/image"]), self)
|
self.closeButton = WMButton(PesterIcon(self.theme["main/close/image"]), self)
|
||||||
|
@ -1608,6 +1614,18 @@ class PesterWindow(MovingWindow):
|
||||||
self.connect(convoWindow, QtCore.SIGNAL('windowClosed(QString)'),
|
self.connect(convoWindow, QtCore.SIGNAL('windowClosed(QString)'),
|
||||||
self, QtCore.SLOT('closeConvo(QString)'))
|
self, QtCore.SLOT('closeConvo(QString)'))
|
||||||
self.convos[chum.handle] = convoWindow
|
self.convos[chum.handle] = convoWindow
|
||||||
|
if str(chum.handle).upper() == "NICKSERV" or \
|
||||||
|
str(chum.handle).upper() == "CHANSERV" or \
|
||||||
|
str(chum.handle).upper() == "MEMOSERV" or \
|
||||||
|
str(chum.handle).upper() == "OPERSERV" or \
|
||||||
|
str(chum.handle).upper() == "HELPSERV":
|
||||||
|
convoWindow.toggleQuirks(True)
|
||||||
|
convoWindow.quirksOff.setChecked(True)
|
||||||
|
else:
|
||||||
|
if str(chum.handle).upper() == "CALSPRITE" or \
|
||||||
|
str(chum.handle).upper() == "RANDOMENCOUNTER":
|
||||||
|
convoWindow.toggleQuirks(True)
|
||||||
|
convoWindow.quirksOff.setChecked(True)
|
||||||
self.newConvoStarted.emit(QtCore.QString(chum.handle), initiated)
|
self.newConvoStarted.emit(QtCore.QString(chum.handle), initiated)
|
||||||
convoWindow.show()
|
convoWindow.show()
|
||||||
|
|
||||||
|
@ -1907,6 +1925,12 @@ class PesterWindow(MovingWindow):
|
||||||
def deliverMemo(self, chan, handle, msg):
|
def deliverMemo(self, chan, handle, msg):
|
||||||
(c, h, m) = (unicode(chan), unicode(handle), unicode(msg))
|
(c, h, m) = (unicode(chan), unicode(handle), unicode(msg))
|
||||||
self.newMemoMsg(c,h,m)
|
self.newMemoMsg(c,h,m)
|
||||||
|
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString)
|
||||||
|
def deliverNotice(self, handle, msg):
|
||||||
|
h = unicode(handle)
|
||||||
|
m = unicode(msg)
|
||||||
|
if self.convos.has_key(h):
|
||||||
|
self.newMessage(h, m)
|
||||||
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString)
|
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString)
|
||||||
def timeCommand(self, chan, handle, command):
|
def timeCommand(self, chan, handle, command):
|
||||||
(c, h, cmd) = (unicode(chan), unicode(handle), unicode(command))
|
(c, h, cmd) = (unicode(chan), unicode(handle), unicode(command))
|
||||||
|
@ -2510,6 +2534,9 @@ class PesterWindow(MovingWindow):
|
||||||
def loadCalsprite(self):
|
def loadCalsprite(self):
|
||||||
self.newConversation("calSprite")
|
self.newConversation("calSprite")
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
|
def loadNickServ(self):
|
||||||
|
self.newConversation("nickServ")
|
||||||
|
@QtCore.pyqtSlot()
|
||||||
def launchHelp(self):
|
def launchHelp(self):
|
||||||
QtGui.QDesktopServices.openUrl(QtCore.QUrl("http://nova.xzibition.com/~illuminatedwax/help.html", QtCore.QUrl.TolerantMode))
|
QtGui.QDesktopServices.openUrl(QtCore.QUrl("http://nova.xzibition.com/~illuminatedwax/help.html", QtCore.QUrl.TolerantMode))
|
||||||
|
|
||||||
|
@ -2680,6 +2707,8 @@ class MainProgram(QtCore.QObject):
|
||||||
'deliverMessage(QString, QString)'),
|
'deliverMessage(QString, QString)'),
|
||||||
('memoReceived(QString, QString, QString)',
|
('memoReceived(QString, QString, QString)',
|
||||||
'deliverMemo(QString, QString, QString)'),
|
'deliverMemo(QString, QString, QString)'),
|
||||||
|
('noticeReceived(QString, QString)',
|
||||||
|
'deliverNotice(QString, QString)'),
|
||||||
('nickCollision(QString, QString)',
|
('nickCollision(QString, QString)',
|
||||||
'nickCollision(QString, QString)'),
|
'nickCollision(QString, QString)'),
|
||||||
('myHandleChanged(QString)',
|
('myHandleChanged(QString)',
|
||||||
|
|
Loading…
Reference in a new issue