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]
* Notify user if channel blocks message - Kiooeht [evacipatedBox]
* Bug reporter - Kiooeht [evacipatedBox]
* Python quirks (users can create own quirk functions) - Kiooeht [evacipatedBox]
* Incorporate support for the new randomEncounter - Kiooeht [evacipatedBox]
* Only GETMOOD for people online (less spam!) - Kiooeht [evacipatedBox]
* Quirk tester in quirk window - Kiooeht [evacipatedBox]
* Python quirks (users can create own quirk functions) - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance])
* Incorporate support for the new randomEncounter - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance])
* Only GETMOOD for people online (less spam!) - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance])
* Quirk tester in quirk window - Kiooeht [evacipatedBox] (Idea: [alGore])
* Show and support giving kick reasons - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance])
* Bug fixes
* Logviewer updates - Kiooeht [evacipatedBox]
* Memo scrollbar thing - Kiooeht [evacipatedBox]

View file

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

View file

@ -239,11 +239,15 @@ class PesterProfile(object):
initials = pcf+self.initials()
return "<c=%s><c=%s>%s</c> %s %s %s.</c>" % \
(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
opinit = opgrammar.pcf+opchum.initials()+opgrammar.number
return "<c=%s>%s</c> banned <c=%s>%s</c> from responding to memo." % \
(opchum.colorhtml(), opinit, self.colorhtml(), initials)
if opchum.handle == reason:
return "<c=%s>%s</c> banned <c=%s>%s</c> from responding to memo." % \
(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):
(temporal, pcf, when) = (timeGrammar.temporal, timeGrammar.pcf, timeGrammar.when)
timetext = timeDifference(td)

14
irc.py
View file

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

View file

@ -743,6 +743,7 @@ class PesterMemo(PesterConvo):
l = update.split(":")
update = l[0]
op = l[1]
reason = l[2]
if update == "nick":
l = h.split(":")
oldnick = l[0]
@ -807,7 +808,7 @@ class PesterMemo(PesterConvo):
opgrammar = self.time.getGrammar()
else:
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.mainwindow.chatlog.log(self.channel, msg)
ttracker.removeTime(ttracker.getTime())
@ -981,7 +982,9 @@ class PesterMemo(PesterConvo):
if not self.userlist.currentItem():
return
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()
def opSelectedUser(self):
if not self.userlist.currentItem():

View file

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