Advanced Mode: View channel modes

This commit is contained in:
Kiooeht 2011-05-20 11:45:41 -07:00
parent d676323d31
commit 0981de9513
4 changed files with 45 additions and 7 deletions

View file

@ -31,6 +31,7 @@ CHANGELOG
* Set server and port from command line - Kiooeht [evacipatedBox] * Set server and port from command line - Kiooeht [evacipatedBox]
* Invite-only memos, invite chums to memos - Kiooeht [evacipatedBox] * Invite-only memos, invite chums to memos - Kiooeht [evacipatedBox]
* Check Pyqt4 and pygame are installed and correct versions - Kiooeht [evacipatedBox] * Check Pyqt4 and pygame are installed and correct versions - Kiooeht [evacipatedBox]
* Advanced Mode: View memo (channel) modes - Kiooeht [evacipatedBox]
* Bug fixes * Bug fixes
* Logviewer updates - Kiooeht [evacipatedBox] * Logviewer updates - Kiooeht [evacipatedBox]
* Memo scrollbar thing - Kiooeht [evacipatedBox] * Memo scrollbar thing - Kiooeht [evacipatedBox]

4
irc.py
View file

@ -186,6 +186,7 @@ class PesterIRC(QtCore.QThread):
c = unicode(channel) c = unicode(channel)
try: try:
helpers.join(self.cli, c) helpers.join(self.cli, c)
helpers.mode(self.cli, c, "", None)
except socket.error: except socket.error:
self.setConnectionBroken() self.setConnectionBroken()
@QtCore.pyqtSlot(QtCore.QString) @QtCore.pyqtSlot(QtCore.QString)
@ -242,6 +243,7 @@ class PesterIRC(QtCore.QThread):
nickCollision = QtCore.pyqtSignal(QtCore.QString, QtCore.QString) nickCollision = QtCore.pyqtSignal(QtCore.QString, QtCore.QString)
myHandleChanged = QtCore.pyqtSignal(QtCore.QString) myHandleChanged = QtCore.pyqtSignal(QtCore.QString)
chanInviteOnly = QtCore.pyqtSignal(QtCore.QString) chanInviteOnly = QtCore.pyqtSignal(QtCore.QString)
modesUpdated = QtCore.pyqtSignal(QtCore.QString, QtCore.QString)
connected = QtCore.pyqtSignal() connected = QtCore.pyqtSignal()
userPresentUpdate = QtCore.pyqtSignal(QtCore.QString, QtCore.QString, userPresentUpdate = QtCore.pyqtSignal(QtCore.QString, QtCore.QString,
QtCore.QString) QtCore.QString)
@ -402,6 +404,8 @@ class PesterHandler(DefaultCommandHandler):
self.parent.inviteReceived.emit(handle, channel) self.parent.inviteReceived.emit(handle, channel)
def inviteonlychan(self, server, handle, channel, msg): def inviteonlychan(self, server, handle, channel, msg):
self.parent.chanInviteOnly.emit(channel) self.parent.chanInviteOnly.emit(channel)
def channelmodeis(self, server, handle, channel, modes):
self.parent.modesUpdated.emit(channel, modes)
def getMood(self, *chums): def getMood(self, *chums):
chumglub = "GETMOOD " chumglub = "GETMOOD "

View file

@ -580,6 +580,25 @@ class PesterMemo(PesterConvo):
for u in users: for u in users:
self.userlist.addItem(u) 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): def timeUpdate(self, handle, cmd):
window = self.mainwindow window = self.mainwindow
chum = PesterProfile(handle) chum = PesterProfile(handle)
@ -658,6 +677,11 @@ class PesterMemo(PesterConvo):
self.userlist.clear() self.userlist.clear()
for n in self.mainwindow.namesdb[self.channel]: for n in self.mainwindow.namesdb[self.channel]:
self.addUser(n) 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) @QtCore.pyqtSlot(QtCore.QString)
def closeInviteOnly(self, channel): def closeInviteOnly(self, channel):
@ -679,6 +703,8 @@ class PesterMemo(PesterConvo):
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString) @QtCore.pyqtSlot(QtCore.QString, QtCore.QString, QtCore.QString)
def userPresentChange(self, handle, channel, update): def userPresentChange(self, handle, channel, update):
if channel != self.channel:
return
h = unicode(handle) h = unicode(handle)
c = unicode(channel) c = unicode(channel)
update = unicode(update) update = unicode(update)
@ -691,7 +717,7 @@ class PesterMemo(PesterConvo):
oldnick = l[0] oldnick = l[0]
newnick = l[1] newnick = l[1]
h = oldnick h = oldnick
if update[0:2] in ["+o", "-o", "+v", "-v"]: if update[0:1] in ["+", "-"]:
l = update.split(":") l = update.split(":")
update = l[0] update = l[0]
op = l[1] op = l[1]
@ -896,6 +922,8 @@ class PesterMemo(PesterConvo):
icon = QtGui.QIcon() icon = QtGui.QIcon()
c.setIcon(icon) c.setIcon(icon)
self.sortUsers() self.sortUsers()
elif h == "" and update[0] in ["+","-"]:
self.updateChanModes(update)
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def addChumSlot(self): def addChumSlot(self):

View file

@ -1735,6 +1735,8 @@ class PesterWindow(MovingWindow):
self, QtCore.SLOT('closeMemo(QString)')) self, QtCore.SLOT('closeMemo(QString)'))
self.connect(self, QtCore.SIGNAL('namesUpdated()'), self.connect(self, QtCore.SIGNAL('namesUpdated()'),
memoWindow, QtCore.SLOT('namesUpdated()')) memoWindow, QtCore.SLOT('namesUpdated()'))
self.connect(self, QtCore.SIGNAL('modesUpdated(QString, QString)'),
memoWindow, QtCore.SLOT('modesUpdated(QString, QString)'))
self.connect(self, self.connect(self,
QtCore.SIGNAL('userPresentSignal(QString, QString, QString)'), QtCore.SIGNAL('userPresentSignal(QString, QString, QString)'),
memoWindow, QtCore.SLOT('userPresentChange(QString, QString, QString)')) memoWindow, QtCore.SLOT('userPresentChange(QString, QString, QString)'))
@ -2709,6 +2711,7 @@ class PesterWindow(MovingWindow):
requestChannelList = QtCore.pyqtSignal() requestChannelList = QtCore.pyqtSignal()
requestNames = QtCore.pyqtSignal(QtCore.QString) requestNames = QtCore.pyqtSignal(QtCore.QString)
namesUpdated = QtCore.pyqtSignal() namesUpdated = QtCore.pyqtSignal()
modesUpdated = QtCore.pyqtSignal(QtCore.QString, QtCore.QString)
userPresentSignal = QtCore.pyqtSignal(QtCore.QString,QtCore.QString,QtCore.QString) userPresentSignal = QtCore.pyqtSignal(QtCore.QString,QtCore.QString,QtCore.QString)
mycolorUpdated = QtCore.pyqtSignal() mycolorUpdated = QtCore.pyqtSignal()
trayIconSignal = QtCore.pyqtSignal(int) trayIconSignal = QtCore.pyqtSignal(int)
@ -2862,7 +2865,9 @@ class MainProgram(QtCore.QObject):
('timeCommand(QString, QString, QString)', ('timeCommand(QString, QString, QString)',
'timeCommand(QString, QString, QString)'), 'timeCommand(QString, QString, QString)'),
('chanInviteOnly(QString)', ('chanInviteOnly(QString)',
'chanInviteOnly(QString)') 'chanInviteOnly(QString)'),
('modesUpdated(QString, QString)',
'modesUpdated(QString, QString)')
] ]
def connectWidgets(self, irc, widget): def connectWidgets(self, irc, widget):
self.connect(irc, QtCore.SIGNAL('finished()'), self.connect(irc, QtCore.SIGNAL('finished()'),