Show and support kick reasons

This commit is contained in:
Kiooeht 2011-06-13 13:37:07 -07:00
parent 4b77eefec2
commit 98d84e7e85
6 changed files with 30 additions and 15 deletions

View file

@ -38,10 +38,11 @@ CHANGELOG
* Memo OP options: Secret, Invite-only, Mute - Kiooeht [evacipatedBox] * Memo OP options: Secret, Invite-only, Mute - Kiooeht [evacipatedBox]
* Notify user if channel blocks message - Kiooeht [evacipatedBox] * Notify user if channel blocks message - Kiooeht [evacipatedBox]
* Bug reporter - Kiooeht [evacipatedBox] * Bug reporter - Kiooeht [evacipatedBox]
* Python quirks (users can create own quirk functions) - Kiooeht [evacipatedBox] * Python quirks (users can create own quirk functions) - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance])
* Incorporate support for the new randomEncounter - Kiooeht [evacipatedBox] * Incorporate support for the new randomEncounter - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance])
* Only GETMOOD for people online (less spam!) - Kiooeht [evacipatedBox] * Only GETMOOD for people online (less spam!) - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance])
* Quirk tester in quirk window - Kiooeht [evacipatedBox] * Quirk tester in quirk window - Kiooeht [evacipatedBox] (Idea: [alGore])
* Show and support giving kick reasons - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance])
* Bug fixes * Bug fixes
* Logviewer updates - Kiooeht [evacipatedBox] * Logviewer updates - Kiooeht [evacipatedBox]
* Memo scrollbar thing - Kiooeht [evacipatedBox] * Memo scrollbar thing - Kiooeht [evacipatedBox]

View file

@ -11,6 +11,7 @@ Features
* Turn @ and # links on/off? * Turn @ and # links on/off?
* "someone has friended you" notifier * "someone has friended you" notifier
* Reorder quirk window into a multi-page wizard * Reorder quirk window into a multi-page wizard
* MSPA update notifier option
Bugs Bugs
---- ----

View file

@ -239,11 +239,15 @@ class PesterProfile(object):
initials = pcf+self.initials() initials = pcf+self.initials()
return "<c=%s><c=%s>%s</c> %s %s %s.</c>" % \ return "<c=%s><c=%s>%s</c> %s %s %s.</c>" % \
(syscolor.name(), self.colorhtml(), initials, timetext, verb, channel[1:].upper().replace("_", " ")) (syscolor.name(), self.colorhtml(), initials, timetext, verb, channel[1:].upper().replace("_", " "))
def memobanmsg(self, opchum, opgrammar, syscolor, timeGrammar): def memobanmsg(self, opchum, opgrammar, syscolor, timeGrammar, reason):
initials = timeGrammar.pcf+self.initials()+timeGrammar.number initials = timeGrammar.pcf+self.initials()+timeGrammar.number
opinit = opgrammar.pcf+opchum.initials()+opgrammar.number opinit = opgrammar.pcf+opchum.initials()+opgrammar.number
if opchum.handle == reason:
return "<c=%s>%s</c> banned <c=%s>%s</c> from responding to memo." % \ return "<c=%s>%s</c> banned <c=%s>%s</c> from responding to memo." % \
(opchum.colorhtml(), opinit, self.colorhtml(), initials) (opchum.colorhtml(), opinit, self.colorhtml(), initials)
else:
return "<c=%s>%s</c> banned <c=%s>%s</c> from responding to memo: <c=black>[%s]</c>." % \
(opchum.colorhtml(), opinit, self.colorhtml(), initials, unicode(reason))
def memojoinmsg(self, syscolor, td, timeGrammar, verb): def memojoinmsg(self, syscolor, td, timeGrammar, verb):
(temporal, pcf, when) = (timeGrammar.temporal, timeGrammar.pcf, timeGrammar.when) (temporal, pcf, when) = (timeGrammar.temporal, timeGrammar.pcf, timeGrammar.when)
timetext = timeDifference(td) timetext = timeDifference(td)

14
irc.py
View file

@ -228,10 +228,15 @@ class PesterIRC(QtCore.QThread):
self.setConnectionBroken() self.setConnectionBroken()
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString) @QtCore.pyqtSlot(QtCore.QString, QtCore.QString)
def kickUser(self, handle, channel): def kickUser(self, handle, channel):
l = handle.split(":")
c = unicode(channel) c = unicode(channel)
h = unicode(handle) h = unicode(l[0])
if len(l) > 1:
reason = unicode(l[1])
else:
reason = ""
try: try:
helpers.kick(self.cli, h, c) helpers.kick(self.cli, h, c, reason)
except socket.error: except socket.error:
self.setConnectionBroken() self.setConnectionBroken()
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString) @QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString)
@ -359,8 +364,9 @@ class PesterHandler(DefaultCommandHandler):
handle = nick[0:nick.find("!")] handle = nick[0:nick.find("!")]
self.parent.userPresentUpdate.emit(handle, "", "quit") self.parent.userPresentUpdate.emit(handle, "", "quit")
self.parent.moodUpdated.emit(handle, Mood("offline")) self.parent.moodUpdated.emit(handle, Mood("offline"))
def kick(self, opnick, channel, handle, op): def kick(self, opnick, channel, handle, reason):
self.parent.userPresentUpdate.emit(handle, channel, "kick:%s" % (op)) op = opnick[0:opnick.find("!")]
self.parent.userPresentUpdate.emit(handle, channel, "kick:%s:%s" % (op, reason))
# ok i shouldnt be overloading that but am lazy # ok i shouldnt be overloading that but am lazy
def part(self, nick, channel, reason="nanchos"): def part(self, nick, channel, reason="nanchos"):
handle = nick[0:nick.find("!")] handle = nick[0:nick.find("!")]

View file

@ -743,6 +743,7 @@ class PesterMemo(PesterConvo):
l = update.split(":") l = update.split(":")
update = l[0] update = l[0]
op = l[1] op = l[1]
reason = l[2]
if update == "nick": if update == "nick":
l = h.split(":") l = h.split(":")
oldnick = l[0] oldnick = l[0]
@ -807,7 +808,7 @@ class PesterMemo(PesterConvo):
opgrammar = self.time.getGrammar() opgrammar = self.time.getGrammar()
else: else:
opgrammar = TimeGrammar("CURRENT", "C", "RIGHT NOW") opgrammar = TimeGrammar("CURRENT", "C", "RIGHT NOW")
msg = chum.memobanmsg(opchum, opgrammar, systemColor, grammar) msg = chum.memobanmsg(opchum, opgrammar, systemColor, grammar, reason)
self.textArea.append(convertTags(msg)) self.textArea.append(convertTags(msg))
self.mainwindow.chatlog.log(self.channel, msg) self.mainwindow.chatlog.log(self.channel, msg)
ttracker.removeTime(ttracker.getTime()) ttracker.removeTime(ttracker.getTime())
@ -981,7 +982,9 @@ class PesterMemo(PesterConvo):
if not self.userlist.currentItem(): if not self.userlist.currentItem():
return return
currentHandle = unicode(self.userlist.currentItem().text()) currentHandle = unicode(self.userlist.currentItem().text())
self.mainwindow.kickUser.emit(currentHandle, self.channel) (reason, ok) = QtGui.QInputDialog.getText(self, "Ban User", "Enter the reason you are banning this user (optional):")
if ok:
self.mainwindow.kickUser.emit("%s:%s" % (currentHandle, reason), self.channel)
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def opSelectedUser(self): def opSelectedUser(self):
if not self.userlist.currentItem(): if not self.userlist.currentItem():

View file

@ -38,8 +38,8 @@ def names(cli, *channels):
def channel_list(cli): def channel_list(cli):
cli.send("LIST") cli.send("LIST")
def kick(cli, handle, channel): def kick(cli, handle, channel, reason=""):
cli.send("KICK %s %s" % (channel, handle)) cli.send("KICK %s %s %s" % (channel, handle, reason))
def mode(cli, channel, mode, options=None): def mode(cli, channel, mode, options=None):
cmd = "MODE %s %s" % (channel, mode) cmd = "MODE %s %s" % (channel, mode)