Advanced Mode: View channel modes
This commit is contained in:
parent
d676323d31
commit
0981de9513
4 changed files with 45 additions and 7 deletions
|
@ -31,6 +31,7 @@ CHANGELOG
|
|||
* Set server and port from command line - Kiooeht [evacipatedBox]
|
||||
* Invite-only memos, invite chums to memos - Kiooeht [evacipatedBox]
|
||||
* Check Pyqt4 and pygame are installed and correct versions - Kiooeht [evacipatedBox]
|
||||
* Advanced Mode: View memo (channel) modes - Kiooeht [evacipatedBox]
|
||||
* Bug fixes
|
||||
* Logviewer updates - Kiooeht [evacipatedBox]
|
||||
* Memo scrollbar thing - Kiooeht [evacipatedBox]
|
||||
|
|
14
irc.py
14
irc.py
|
@ -186,6 +186,7 @@ class PesterIRC(QtCore.QThread):
|
|||
c = unicode(channel)
|
||||
try:
|
||||
helpers.join(self.cli, c)
|
||||
helpers.mode(self.cli, c, "", None)
|
||||
except socket.error:
|
||||
self.setConnectionBroken()
|
||||
@QtCore.pyqtSlot(QtCore.QString)
|
||||
|
@ -242,6 +243,7 @@ class PesterIRC(QtCore.QThread):
|
|||
nickCollision = QtCore.pyqtSignal(QtCore.QString, QtCore.QString)
|
||||
myHandleChanged = QtCore.pyqtSignal(QtCore.QString)
|
||||
chanInviteOnly = QtCore.pyqtSignal(QtCore.QString)
|
||||
modesUpdated = QtCore.pyqtSignal(QtCore.QString, QtCore.QString)
|
||||
connected = QtCore.pyqtSignal()
|
||||
userPresentUpdate = QtCore.pyqtSignal(QtCore.QString, QtCore.QString,
|
||||
QtCore.QString)
|
||||
|
@ -347,11 +349,11 @@ class PesterHandler(DefaultCommandHandler):
|
|||
if mode[0] == "+":
|
||||
modes.extend(mode[1:])
|
||||
elif mode[0] == "-":
|
||||
for i in mode[1:]:
|
||||
try:
|
||||
modes.remove(i)
|
||||
except ValueError:
|
||||
pass
|
||||
for i in mode[1:]:
|
||||
try:
|
||||
modes.remove(i)
|
||||
except ValueError:
|
||||
pass
|
||||
modes.sort()
|
||||
self.parent.mainwindow.modes = "+" + "".join(modes)
|
||||
self.parent.userPresentUpdate.emit(handle, channel, mode+":%s" % (op))
|
||||
|
@ -402,6 +404,8 @@ class PesterHandler(DefaultCommandHandler):
|
|||
self.parent.inviteReceived.emit(handle, channel)
|
||||
def inviteonlychan(self, server, handle, channel, msg):
|
||||
self.parent.chanInviteOnly.emit(channel)
|
||||
def channelmodeis(self, server, handle, channel, modes):
|
||||
self.parent.modesUpdated.emit(channel, modes)
|
||||
|
||||
def getMood(self, *chums):
|
||||
chumglub = "GETMOOD "
|
||||
|
|
30
memos.py
30
memos.py
|
@ -580,6 +580,25 @@ class PesterMemo(PesterConvo):
|
|||
for u in users:
|
||||
self.userlist.addItem(u)
|
||||
|
||||
def updateChanModes(self, modes):
|
||||
if not hasattr(self, 'modes'): self.modes = ""
|
||||
chanmodes = list(str(self.modes))
|
||||
if chanmodes and chanmodes[0] == "+": chanmodes = chanmodes[1:]
|
||||
modes = str(modes)
|
||||
if modes[0] == "+":
|
||||
chanmodes.extend(modes[1:])
|
||||
elif modes[0] == "-":
|
||||
for i in modes[1:]:
|
||||
try:
|
||||
chanmodes.remove(i)
|
||||
except ValueError:
|
||||
pass
|
||||
chanmodes.sort()
|
||||
self.modes = "+" + "".join(chanmodes)
|
||||
if self.mainwindow.advanced:
|
||||
t = Template(self.mainwindow.theme["memos/label/text"])
|
||||
self.channelLabel.setText(t.safe_substitute(channel=self.channel) + "(%s)" % (self.modes))
|
||||
|
||||
def timeUpdate(self, handle, cmd):
|
||||
window = self.mainwindow
|
||||
chum = PesterProfile(handle)
|
||||
|
@ -658,6 +677,11 @@ class PesterMemo(PesterConvo):
|
|||
self.userlist.clear()
|
||||
for n in self.mainwindow.namesdb[self.channel]:
|
||||
self.addUser(n)
|
||||
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString)
|
||||
def modesUpdated(self, channel, modes):
|
||||
c = unicode(channel)
|
||||
if c == self.channel:
|
||||
self.updateChanModes(modes)
|
||||
|
||||
@QtCore.pyqtSlot(QtCore.QString)
|
||||
def closeInviteOnly(self, channel):
|
||||
|
@ -679,6 +703,8 @@ class PesterMemo(PesterConvo):
|
|||
|
||||
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString)
|
||||
def userPresentChange(self, handle, channel, update):
|
||||
if channel != self.channel:
|
||||
return
|
||||
h = unicode(handle)
|
||||
c = unicode(channel)
|
||||
update = unicode(update)
|
||||
|
@ -691,7 +717,7 @@ class PesterMemo(PesterConvo):
|
|||
oldnick = l[0]
|
||||
newnick = l[1]
|
||||
h = oldnick
|
||||
if update[0:2] in ["+o", "-o", "+v", "-v"]:
|
||||
if update[0:1] in ["+", "-"]:
|
||||
l = update.split(":")
|
||||
update = l[0]
|
||||
op = l[1]
|
||||
|
@ -896,6 +922,8 @@ class PesterMemo(PesterConvo):
|
|||
icon = QtGui.QIcon()
|
||||
c.setIcon(icon)
|
||||
self.sortUsers()
|
||||
elif h == "" and update[0] in ["+","-"]:
|
||||
self.updateChanModes(update)
|
||||
|
||||
@QtCore.pyqtSlot()
|
||||
def addChumSlot(self):
|
||||
|
|
|
@ -1735,6 +1735,8 @@ class PesterWindow(MovingWindow):
|
|||
self, QtCore.SLOT('closeMemo(QString)'))
|
||||
self.connect(self, QtCore.SIGNAL('namesUpdated()'),
|
||||
memoWindow, QtCore.SLOT('namesUpdated()'))
|
||||
self.connect(self, QtCore.SIGNAL('modesUpdated(QString, QString)'),
|
||||
memoWindow, QtCore.SLOT('modesUpdated(QString, QString)'))
|
||||
self.connect(self,
|
||||
QtCore.SIGNAL('userPresentSignal(QString, QString, QString)'),
|
||||
memoWindow, QtCore.SLOT('userPresentChange(QString, QString, QString)'))
|
||||
|
@ -2709,6 +2711,7 @@ class PesterWindow(MovingWindow):
|
|||
requestChannelList = QtCore.pyqtSignal()
|
||||
requestNames = QtCore.pyqtSignal(QtCore.QString)
|
||||
namesUpdated = QtCore.pyqtSignal()
|
||||
modesUpdated = QtCore.pyqtSignal(QtCore.QString, QtCore.QString)
|
||||
userPresentSignal = QtCore.pyqtSignal(QtCore.QString,QtCore.QString,QtCore.QString)
|
||||
mycolorUpdated = QtCore.pyqtSignal()
|
||||
trayIconSignal = QtCore.pyqtSignal(int)
|
||||
|
@ -2862,7 +2865,9 @@ class MainProgram(QtCore.QObject):
|
|||
('timeCommand(QString, QString, QString)',
|
||||
'timeCommand(QString, QString, QString)'),
|
||||
('chanInviteOnly(QString)',
|
||||
'chanInviteOnly(QString)')
|
||||
'chanInviteOnly(QString)'),
|
||||
('modesUpdated(QString, QString)',
|
||||
'modesUpdated(QString, QString)')
|
||||
]
|
||||
def connectWidgets(self, irc, widget):
|
||||
self.connect(irc, QtCore.SIGNAL('finished()'),
|
||||
|
|
Loading…
Reference in a new issue