From 3cbfc193b42d821d4b8087133df903e60d8856e8 Mon Sep 17 00:00:00 2001 From: Stephen Dranger Date: Sat, 19 Feb 2011 17:06:54 -0600 Subject: [PATCH] derp --- TODO | 2 +- convo.pyc | Bin 25659 -> 25659 bytes dataobjs.pyc | Bin 14331 -> 14331 bytes generic.pyc | Bin 4285 -> 4285 bytes irc.py | 48 +++++--- irc.pyc | Bin 14392 -> 14658 bytes memos.pyc | Bin 32143 -> 32143 bytes menus.pyc | Bin 25786 -> 25786 bytes mispeller.pyc | Bin 2929 -> 2929 bytes oyoyo/__init__.pyc | Bin 333 -> 333 bytes oyoyo/client.py | 7 +- oyoyo/client.pyc | Bin 10425 -> 10504 bytes oyoyo/cmdhandler.pyc | Bin 8312 -> 8312 bytes oyoyo/helpers.pyc | Bin 5020 -> 5020 bytes oyoyo/ircevents.pyc | Bin 5693 -> 5693 bytes oyoyo/parse.pyc | Bin 2869 -> 2869 bytes parsetools.pyc | Bin 11107 -> 11107 bytes pesterchum.py | 285 +++++++++++++++---------------------------- 18 files changed, 137 insertions(+), 205 deletions(-) diff --git a/TODO b/TODO index 72a7929..d0913ce 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ Bugs: -* heartbeat -- ping IRC occasionally so we pick up on send errors +* idle doesnt seem to work? * X and _ buttons move around all crazy like Features: diff --git a/convo.pyc b/convo.pyc index 9c49df271a3fd6d702fae738826a456002c996e8..c5603c49dda375b5b3afbed6af96986a7f63b14d 100644 GIT binary patch delta 18 acmdmef^qi=M)r%Jc)5x>;x@9IqyPX++6NN= delta 18 acmdmef^qi=M)r%Jc)5PE#cyOcNdW**eFvBT diff --git a/dataobjs.pyc b/dataobjs.pyc index c5afea25e7d62106d70338547217dc59678ce37d..842d57821da34d7eb54fad173b060f089e36fa8d 100644 GIT binary patch delta 16 YcmeyJ|2v=k;wN4%xy?}<*}s?r07&Eq!~g&Q delta 16 XcmeyJ|2v=k;wN4%mD|e|QN5uz| diff --git a/generic.pyc b/generic.pyc index c06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XKAzfd_XlM&eA0i+^9q@b!|1?j52r9@|AfAb z;#Kg*K)QCE3^>9eT2VK_&Vi7J`Ogp=_jeZG0RDovFC4jSP+ms|DZF0$Eft0^v(X?c z6pD+t_@EAC=O%Fq|8e;!|J&0An+D@M)5NI}JVfva!4m}3)oM2ZHJswtOEcYmJ}=Vh jEWxV;bTIWgK@WU3I3hm+Ih6PF6+BAP4e<2JHyP5}T*(FaTb delta 18 acmdmWl5y8bM)r%Jc)5PE#cyQaoB{w*c?cH( diff --git a/mispeller.pyc b/mispeller.pyc index e86c8b3dd79ff462dbd3ca1a8a32f482c27b0711..86893fb72f224de1880d2469a0286b2e61c049f7 100644 GIT binary patch delta 16 Xcmew;_EC)e;wN4%rOi{;9ZJF5m6 diff --git a/oyoyo/__init__.pyc b/oyoyo/__init__.pyc index f10874552d2edcbedfec17785e7dae545156da02..952ac0c304bb8836959127c76e5bd569e86f958c 100644 GIT binary patch delta 16 XcmX@hbe4(z;wN4%rOi~4$zH1P#{ diff --git a/oyoyo/client.py b/oyoyo/client.py index 7ab7368..f9db258 100644 --- a/oyoyo/client.py +++ b/oyoyo/client.py @@ -82,6 +82,7 @@ class IRCClient: ... """ self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + print "initalizing socket %d" % (self.socket.fileno()) self.nick = None self.real_name = None self.host = None @@ -200,16 +201,16 @@ class IRCClient: if self.socket: logging.info('closing socket') self.socket.close() - print se raise se else: if self.socket: logging.info('closing socket') self.socket.close() def close(self): + # with extreme prejudice if self.socket: - logging.info('closing socket') - self.socket.close() + logging.info('shutdown socket') + self.socket.shutdown(socket.SHUT_RDWR) class IRCApp: """ This class manages several IRCClient instances without the use of threads. diff --git a/oyoyo/client.pyc b/oyoyo/client.pyc index 0b9cca57704704fedd2c946d483fde04b9891216..6a2701c5b06480a9138cea97b5d1de2ed11a3f62 100644 GIT binary patch delta 1179 zcmYjQ&rcIU6rL&lK}!oQP}%~eP+PhIL4Ih2cz|dXLPC`R#E1fAyU1$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8vG) zVo2J=sv&7cz=*YkG3Ng;7&GOhV@}jOUz$P6_+~7v(G4qGEh?Mp4Te)G9$yJdS0Si0 zJTdZl;#QJC#0g}SpyHkPg{fAhH}gJqqqy5xPsVZeD1DGW4?d?$5k9FJGKH0r@hAn< z((FQ#xjPu=*Ak4YnT%!3CD^|Gfs=X62fHZPZz8a#UB6a8Z~Cr1<;b$tPByU?unv#` zpfu4;AW@C&*6WTfMP41qTHBYyjQTG5jwe^Z_=ir`dj9 zRG+fDNKq-*8`}i)R)|aX6TM5vKc^n&M!OB3iX?d>w>jBxB6J3Dk5Vxc#@u$*kjHv(^WYX@po467e@&6-i4b31@?5!sY_A5Zw~V> zLD_uBTmA+eMNp6W+3E4`!PKhR$hy6-90NdtPDsyyS}Yxp&P87g!w#{cUo9&YuIp?V ztoD;$#dgLk_LRf|Pq^O2iX3yU*aAh1Zn&XGwYrq_GT6klTakL%^rraIoe?MC8CC{& zxcSqLGb02s3&n)$u#*$6nlCkFMu_SkhH9&hZ;K)Is?@_z>hA8L`(J8%_k)C11$~(H z{&6BD+9)5Z!Xg$he0eEiq5*Iapu4NLKqoj3+bIAti}7$|hlsyX3q5^&t@_Zjx&R?z jQzkv9Ql*C`@gLV0XO(H4Z8?KjEQ!Ed6o)9wET8`kt)u0u diff --git a/oyoyo/cmdhandler.pyc b/oyoyo/cmdhandler.pyc index 57d62ba916276ac9e806ac26c5c24258294e0348..1e5a2485eb525c54eb1cf862da552a89c74683f5 100644 GIT binary patch delta 16 Xcmez2@WX-q;wN4%rOi{EpSGzSH^ delta 16 XcmbQEK1ZGX;wN4%wc5yy>{EpSGw%h& diff --git a/oyoyo/ircevents.pyc b/oyoyo/ircevents.pyc index 51fd3418d38d855a302b6ac575a6eb79b92bb159..f8955a6ac229221d549b48a72f9889bf374405eb 100644 GIT binary patch delta 16 Xcmdn1vsZ`x;wN4%rOi}FyBH=YHw diff --git a/oyoyo/parse.pyc b/oyoyo/parse.pyc index 79ddf4499bc6cbeb126190cde91c5329c1da6c32..d6fd479d2fd1d08ed05f3ebe4e48ead333615738 100644 GIT binary patch delta 16 XcmdlgwpEP%;wN4%rOi@nH^LCOZK diff --git a/pesterchum.py b/pesterchum.py index 7d20616..e917a0b 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -820,9 +820,6 @@ class PesterWindow(MovingWindow): if not self.config.defaultprofile(): self.changeProfile() - self.loadingscreen = LoadingScreen(self) - self.connect(self.loadingscreen, QtCore.SIGNAL('rejected()'), - self, QtCore.SLOT('close()')) def profile(self): return self.userprofile.chat @@ -1618,6 +1615,9 @@ class PesterWindow(MovingWindow): @QtCore.pyqtSlot(QtCore.QString, QtCore.QString) def nickCollision(self, handle, tmphandle): self.mychumhandle.setText(tmphandle) + self.userprofile = userProfile(PesterProfile("pesterClient%d" % (random.randint(100,999)), QtGui.QColor("black"), Mood(0))) + self.changeTheme(self.userprofile.getTheme()) + if not hasattr(self, 'chooseprofile'): self.chooseprofile = None if not self.chooseprofile: @@ -1660,44 +1660,6 @@ class PesterWindow(MovingWindow): closeSignal = QtCore.pyqtSignal() reconnectIRC = QtCore.pyqtSignal() -class IRCThread(QtCore.QThread): - def __init__(self, ircobj): - QtCore.QThread.__init__(self) - self.irc = ircobj - def run(self): - irc = self.irc - irc.IRCConnect() - timer = QtCore.QTimer(self) - self.connect(timer, QtCore.SIGNAL('timeout()'), - self, QtCore.SLOT('updateIRC()')) - timer.start() - self.exec_() - @QtCore.pyqtSlot() - def updateIRC(self): - irc = self.irc - if irc.brokenConnection: - irc.brokenConnection = False - self.restartIRC.emit() - irc.closeConnection() - irc.IRCConnect() - try: - res = irc.updateIRC() - except socket.timeout, se: - if not irc.registeredIRC: - irc.closeConnection() - self.failedIRC.emit("Connection timed out") - except socket.error, se: - if irc.registeredIRC: - irc.setConnectionBroken() - else: - irc.closeConnection() - self.failedIRC.emit(str(se)) - except StopIteration: - pass - - restartIRC = QtCore.pyqtSignal() - failedIRC = QtCore.pyqtSignal(QtCore.QString) - class PesterTray(QtGui.QSystemTrayIcon): def __init__(self, icon, mainwindow, parent): QtGui.QSystemTrayIcon.__init__(self, icon, parent) @@ -1764,164 +1726,113 @@ class MainProgram(QtCore.QObject): QtCore.SLOT('mainWindowClosed()')) self.irc = PesterIRC(self.widget.config, self.widget) - self.connectWidgets(self.irc, self.widget) - self.ircapp = IRCThread(self.irc) - self.connect(self.ircapp, QtCore.SIGNAL('restartIRC()'), + self.connect(self.irc, QtCore.SIGNAL('finished()'), self, QtCore.SLOT('restartIRC()')) - self.connect(self.ircapp, QtCore.SIGNAL('failedIRC(QString)'), - self, QtCore.SLOT('failedIRC(QString)')) + self.connectWidgets(self.irc, self.widget) + widget2irc = [('sendMessage(QString, QString)', + 'sendMessage(QString, QString)'), + ('newConvoStarted(QString, bool)', + 'startConvo(QString, bool)'), + ('convoClosed(QString)', + 'endConvo(QString)'), + ('profileChanged()', + 'updateProfile()'), + ('moodRequest(PyQt_PyObject)', + 'getMood(PyQt_PyObject)'), + ('moodsRequest(PyQt_PyObject)', + 'getMoods(PyQt_PyObject)'), + ('moodUpdated()', 'updateMood()'), + ('mycolorUpdated()','updateColor()'), + ('blockedChum(QString)', 'blockedChum(QString)'), + ('unblockedChum(QString)', 'unblockedChum(QString)'), + ('requestNames(QString)','requestNames(QString)'), + ('requestChannelList()', 'requestChannelList()'), + ('joinChannel(QString)', 'joinChannel(QString)'), + ('leftChannel(QString)', 'leftChannel(QString)'), + ('kickUser(QString, QString)', + 'kickUser(QString, QString)'), + ('setChannelMode(QString, QString, QString)', + 'setChannelMode(QString, QString, QString)'), + ('reconnectIRC()', 'reconnectIRC()') + ] +# IRC --> Main window + irc2widget = [('connected()', 'connected()'), + ('moodUpdated(QString, PyQt_PyObject)', + 'updateMoodSlot(QString, PyQt_PyObject)'), + ('colorUpdated(QString, QColor)', + 'updateColorSlot(QString, QColor)'), + ('messageReceived(QString, QString)', + 'deliverMessage(QString, QString)'), + ('memoReceived(QString, QString, QString)', + 'deliverMemo(QString, QString, QString)'), + ('nickCollision(QString, QString)', + 'nickCollision(QString, QString)'), + ('namesReceived(QString, PyQt_PyObject)', + 'updateNames(QString, PyQt_PyObject)'), + ('userPresentUpdate(QString, QString, QString)', + 'userPresentUpdate(QString, QString, QString)'), + ('channelListReceived(PyQt_PyObject)', + 'updateChannelList(PyQt_PyObject)'), + ('timeCommand(QString, QString, QString)', + 'timeCommand(QString, QString, QString)') + ] def connectWidgets(self, irc, widget): - irc.connect(widget, QtCore.SIGNAL('sendMessage(QString, QString)'), - irc, QtCore.SLOT('sendMessage(QString, QString)')) - irc.connect(widget, - QtCore.SIGNAL('newConvoStarted(QString, bool)'), - irc, QtCore.SLOT('startConvo(QString, bool)')) - irc.connect(widget, - QtCore.SIGNAL('convoClosed(QString)'), - irc, QtCore.SLOT('endConvo(QString)')) - irc.connect(widget, - QtCore.SIGNAL('profileChanged()'), - irc, - QtCore.SLOT('updateProfile()')) - irc.connect(widget, - QtCore.SIGNAL('moodRequest(PyQt_PyObject)'), - irc, - QtCore.SLOT('getMood(PyQt_PyObject)')) - irc.connect(widget, - QtCore.SIGNAL('moodsRequest(PyQt_PyObject)'), - irc, - QtCore.SLOT('getMoods(PyQt_PyObject)')) - irc.connect(widget, - QtCore.SIGNAL('moodUpdated()'), - irc, - QtCore.SLOT('updateMood()')) - irc.connect(widget, - QtCore.SIGNAL('mycolorUpdated()'), - irc, - QtCore.SLOT('updateColor()')) - irc.connect(widget, - QtCore.SIGNAL('blockedChum(QString)'), - irc, - QtCore.SLOT('blockedChum(QString)')) - irc.connect(widget, - QtCore.SIGNAL('unblockedChum(QString)'), - irc, - QtCore.SLOT('unblockedChum(QString)')) - irc.connect(widget, - QtCore.SIGNAL('requestNames(QString)'), - irc, - QtCore.SLOT('requestNames(QString)')) - irc.connect(widget, - QtCore.SIGNAL('requestChannelList()'), - irc, - QtCore.SLOT('requestChannelList()')) - irc.connect(widget, - QtCore.SIGNAL('joinChannel(QString)'), - irc, - QtCore.SLOT('joinChannel(QString)')) - irc.connect(widget, - QtCore.SIGNAL('leftChannel(QString)'), - irc, - QtCore.SLOT('leftChannel(QString)')) - irc.connect(widget, - QtCore.SIGNAL('kickUser(QString, QString)'), - irc, - QtCore.SLOT('kickUser(QString, QString)')) - irc.connect(widget, - QtCore.SIGNAL('setChannelMode(QString, QString, QString)'), - irc, - QtCore.SLOT('setChannelMode(QString, QString, QString)')) - irc.connect(widget, - QtCore.SIGNAL('reconnectIRC()'), - irc, - QtCore.SLOT('reconnectIRC()')) + for c in self.widget2irc: + self.connect(widget, QtCore.SIGNAL(c[0]), + irc, QtCore.SLOT(c[1])) + for c in self.irc2widget: + self.connect(irc, QtCore.SIGNAL(c[0]), + widget, QtCore.SLOT(c[1])) + def disconnectWidgets(self, irc, widget): + for c in self.widget2irc: + self.disconnect(widget, QtCore.SIGNAL(c[0]), + irc, QtCore.SLOT(c[1])) + for c in self.irc2widget: + self.disconnect(irc, QtCore.SIGNAL(c[0]), + widget, QtCore.SLOT(c[1])) - # IRC --> Main window - irc.connect(irc, QtCore.SIGNAL('connected()'), - widget, QtCore.SLOT('connected()')) - irc.connect(irc, - QtCore.SIGNAL('moodUpdated(QString, PyQt_PyObject)'), - widget, - QtCore.SLOT('updateMoodSlot(QString, PyQt_PyObject)')) - irc.connect(irc, - QtCore.SIGNAL('colorUpdated(QString, QColor)'), - widget, - QtCore.SLOT('updateColorSlot(QString, QColor)')) - irc.connect(irc, - QtCore.SIGNAL('messageReceived(QString, QString)'), - widget, - QtCore.SLOT('deliverMessage(QString, QString)')) - irc.connect(irc, - QtCore.SIGNAL('memoReceived(QString, QString, QString)'), - widget, - QtCore.SLOT('deliverMemo(QString, QString, QString)')) - irc.connect(irc, - QtCore.SIGNAL('nickCollision(QString, QString)'), - widget, - QtCore.SLOT('nickCollision(QString, QString)')) - irc.connect(irc, - QtCore.SIGNAL('namesReceived(QString, PyQt_PyObject)'), - widget, - QtCore.SLOT('updateNames(QString, PyQt_PyObject)')) - irc.connect(irc, - QtCore.SIGNAL('userPresentUpdate(QString, QString, QString)'), - widget, - QtCore.SLOT('userPresentUpdate(QString, QString, QString)')) - irc.connect(irc, - QtCore.SIGNAL('channelListReceived(PyQt_PyObject)'), - widget, - QtCore.SLOT('updateChannelList(PyQt_PyObject)')) - irc.connect(irc, - QtCore.SIGNAL('timeCommand(QString, QString, QString)'), - widget, - QtCore.SLOT('timeCommand(QString, QString, QString)')) + def showLoading(self, widget, msg="CONN3CT1NG"): + self.widget.show() + self.widget.activateWindow() + widget.loadingscreen = LoadingScreen(widget) + widget.loadingscreen.loadinglabel.setText(msg) + self.connect(widget.loadingscreen, QtCore.SIGNAL('rejected()'), + widget, QtCore.SLOT('close()')) + self.connect(self.widget.loadingscreen, QtCore.SIGNAL('tryAgain()'), + self, QtCore.SLOT('tryAgain()')) + status = widget.loadingscreen.exec_() + if status == QtGui.QDialog.Rejected: + sys.exit(0) @QtCore.pyqtSlot() def tryAgain(self): - self.ircapp.quit() - print "Quit?" - + if self.loadingscreen: + self.loadingscreen.accept() + self.restartIRC() @QtCore.pyqtSlot() def restartIRC(self): - # tell ppl that we're restarting - self.widget.show() - self.widget.activateWindow() - self.widget.loadingscreen = LoadingScreen(self.widget) - self.connect(self.widget.loadingscreen, QtCore.SIGNAL('rejected()'), - self.widget, QtCore.SLOT('close()')) - self.connect(self.widget.loadingscreen, QtCore.SIGNAL('tryAgain()'), - self, QtCore.SLOT('tryAgain()')) - status = self.widget.loadingscreen.exec_() - if status == QtGui.QDialog.Rejected: - sys.exit(0) - @QtCore.pyqtSlot(QtCore.QString) - def failedIRC(self, reason): - self.widget.show() - self.widget.activateWindow() - if not self.widget.loadingscreen: - self.widget.loadingscreen = LoadingScreen(self.widget) - self.widget.loadingscreen.loadinglabel.setText("F41L3D: %s" % (reason)) - self.connect(self.widget.loadingscreen, QtCore.SIGNAL('rejected()'), - self.widget, QtCore.SLOT('close()')) - self.connect(self.widget.loadingscreen, QtCore.SIGNAL('tryAgain()'), - self, QtCore.SLOT('tryAgain()')) - status = self.widget.loadingscreen.exec_() - if status == QtGui.QDialog.Rejected: - sys.exit(0) + if self.irc: + self.disconnectWidgets(self.irc, self.widget) + self.disconnect(self.irc, QtCore.SIGNAL('finished()'), + self, QtCore.SLOT('restartIRC()')) + stop = self.irc.stopIRC + del self.irc else: - self.widget.loadingscreen.loadinglabel.setText("F41L3D: %s" % (reason)) + stop = None + if not stop: + self.irc = PesterIRC(self.widget.config, self.widget) + self.connect(self.irc, QtCore.SIGNAL('finished()'), + self, QtCore.SLOT('restartIRC()')) + self.connectWidgets(self.irc, self.widget) + self.irc.start() + self.showLoading(self.widget) + else: + self.showLoading(self.widget, "F41L3D: %s" % stop) def run(self): - self.ircapp.start() - self.widget.loadingscreen = LoadingScreen(self.widget) - self.connect(self.widget.loadingscreen, QtCore.SIGNAL('rejected()'), - self.widget, QtCore.SLOT('close()')) - self.connect(self.widget.loadingscreen, QtCore.SIGNAL('tryAgain()'), - self, QtCore.SLOT('tryAgain()')) - status = self.widget.loadingscreen.exec_() - if status == QtGui.QDialog.Rejected: - sys.exit(0) + self.irc.start() + self.showLoading(self.widget) sys.exit(self.app.exec_()) pesterchum = MainProgram()