diff -Naur curphoo-0.3.12/.cvsignore curphoo-0.3.12.4.1/.cvsignore --- curphoo-0.3.12/.cvsignore 2004-01-21 16:23:06.000000000 -0500 +++ curphoo-0.3.12.4.1/.cvsignore 1969-12-31 19:00:00.000000000 -0500 @@ -1,6 +0,0 @@ -*.pyc -*.pyo -*.trace -semantic.cache -curphoo -beta-0.3.8.1 diff -Naur curphoo-0.3.12/AUTHORS curphoo-0.3.12.4.1/AUTHORS --- curphoo-0.3.12/AUTHORS 2004-01-23 11:51:39.000000000 -0500 +++ curphoo-0.3.12.4.1/AUTHORS 2005-03-31 23:23:31.000000000 -0500 @@ -1,6 +1,5 @@ Alex Mercader Matt Dunford -John Kim Louis C. Juarez Pirate Roberts Devdas Bhagat diff -Naur curphoo-0.3.12/COPYING curphoo-0.3.12.4.1/COPYING --- curphoo-0.3.12/COPYING 2003-09-25 13:31:45.000000000 -0400 +++ curphoo-0.3.12.4.1/COPYING 1969-12-31 19:00:00.000000000 -0500 @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff -Naur curphoo-0.3.12/README curphoo-0.3.12.4.1/README --- curphoo-0.3.12/README 2003-09-25 13:31:45.000000000 -0400 +++ curphoo-0.3.12.4.1/README 2005-03-31 23:23:31.000000000 -0500 @@ -20,6 +20,7 @@ otherwise and for believing in the author (heh.) and for putting up with all my (heh.)'s which is entirely daryn_lightblade's fault. +Enjoy! INSTALLATION o Get Yourself a Python2.1 or a Python2.2 interpreter @@ -32,32 +33,28 @@ USAGE In chat hit the TAB key for help, hit Enter for the user list. +Enjoy! PRIVATE MESSAGES For those that find typing /tell something something something a tad tedious I've added # support. This looks at your last /tell command string and puts that string on the input box excluding the actual message. +Enjoy! REAL YAHOO! BUDDY Support In chat type /yb nameofchatter to add that chatter to your Yahoo Buddy list. You will be notified when this chatters goes online/offline. To get a list of which of your yahoo buddies are online type /yb - - -IGNORES -If you have an old ~/.curphoo/ignorex you would like to convert to -plain text copy pickle2txt.py from the curphoo src directory to ~/.curphoo -and run that script from ~/.curphoo. ie: - -cp curphoo-0.3.3/pickle2txt.py ~/.curphoo -cd ~/.curphoo -python2.x pickle2txt.py -rm ignorex - -COLORS -If you want to modify the colour scheme run curphoo then quit and -edit ~/.curphoo. The changes will take effect next time you run curphoo +Enjoy! BUGS There are lots of bugs here. If you have time send bug reports to me at this address: alex.mercader@iinet.net.au +Enjoy! + +AUTHOR +Alex Mercader + +Remember folks the emphasis is on +Enjoy! + diff -Naur curphoo-0.3.12/Session.py curphoo-0.3.12.4.1/Session.py --- curphoo-0.3.12/Session.py 2004-01-23 11:51:40.000000000 -0500 +++ curphoo-0.3.12.4.1/Session.py 2005-03-31 23:23:31.000000000 -0500 @@ -68,22 +68,16 @@ CPDIR = os.path.join(os.environ['HOME'], '.curphoo') CPRC = os.path.join(CPDIR, 'curphoorc') CPBUDDIES = os.path.join(CPDIR, 'buds') -CPBUDDIESTXT = os.path.join(CPDIR, 'buddies') # --------------------- added 22-Feb-2003 BoW4IamTheBOFH ---------------------------- CPDATE = strftime('curphoo-%F-%T.log',localtime()) # --------------------- end edit----------------------------------------------------- -CPIGNORESTXT = os.path.join(CPDIR, 'ignore') +CPIGNORES = os.path.join(CPDIR, 'ignorex') # --------------------- added 22-Feb-2003 BoW4IamTheBOFH ---------------------------- CPLOG = os.path.join(CPDIR,CPDATE) # --------------------- end edit----------------------------------------------------- CPMYCMDS = os.path.join(CPDIR, 'commands') CPMYREGEX = os.path.join(CPDIR, 'regex') -CPHIGHSTR = os.path.join(CPDIR, 'highlightstr') -CPHIGHUSER = os.path.join(CPDIR, 'highlightuser') -CPCOLOR = os.path.join(CPDIR, 'color') -CPIGNOREMSG = os.path.join(CPDIR, 'ignoremsg') -CPEXCLUDE = os.path.join(CPDIR, 'exclude') class Session: @@ -92,6 +86,7 @@ self.user = '' self.password = '' self.alias = [] + self.cookie = '' self.afk = 0 self.pms_are_ok = 0 self.pm_recipient = 'no-one' @@ -99,160 +94,35 @@ self.server = 'cs6.chat.yahoo.com' self.room = 'Linux, FreeBSD, Solaris:1' self.url = 'http://www.curphoo.org/' - self.profileurl = 'http://profiles.yahoo.com/' self.lastChatter = '' - self.rc = {} self.users = [] self.high = [] self.highstr = [] self.buddies = [] self.ybuddies = [] - self.ignores = {} - self.ignoremsg = '' - self.mutes = {} # temporary ignore - self.excludes = [] # list of users excluded from ignore + self.ignores = [] self.mycmd = {} self.myregex = [] self.babellist = [] - self.babellang_from = 'English' - self.babellang_to = 'French' - self.cmd = ['JOIN ', 'QUIT ', 'TELL ', 'IGNORE ', 'BUDDY ', 'USERS ', 'AWAY ', 'GOTO ', 'VER', 'UPTIME', 'OPENURL ', 'UINFO ', 'COLOR ', 'MUTE ', 'LOAD ', 'SAVE ', 'OPENPROFILE ', 'EXCLUDE', 'SET ', 'REGEX'] - self.colormap = {'BLACK':0, 'RED':1, 'GREEN':2, 'YELLOW':3, 'BLUE':4, 'MAGENTA':5, 'CYAN':6, 'WHITE':7} - self.colorrevmap = ('BLACK', 'RED', 'GREEN', 'YELLOW', 'BLUE', 'MAGENTA', 'CYAN', 'WHITE') - self.defcolor = { -'autoignorenotice':'RED', -'awayoffnotice':'WHITE', -'awayonnotice':'WHITE', -'buddylist':'WHITE', -'buddyoffnotice':'BLUE', -'buddyonnotice':'BLUE', -'colorlist':'WHITE', -'commenttext':'WHITE', -'commentuser':'RED', -'defaultnotice':'BLUE', -'emotebullet':'RED', -'emotetext':'WHITE', -'errortext':'RED', -'excludelist':'GREEN', -'excludeoffnotice':'GREEN', -'excludeonnotice':'GREEN', -'help':'WHITE', -'highcommenttext':'WHITE', -'highcommentuser':'RED', -'highoffnotice':'RED', -'highonnotice':'BLUE', -'hslist':'WHITE', -'hulist':'WHITE', -'ignorelist':'RED', -'ignoreoffnotice':'BLUE', -'ignoreonnotice':'RED', -'joinnotice':'BLUE', -'logendnotice':'RED', -'loginnotice':'BLUE', -'logoutnotice':'BLUE', -'logstartnotice':'BLUE', -'mailnotice':'MAGENTA', -'muteoffnotice':'BLUE', -'muteonnotice':'RED', -'mycommenttext':'WHITE', -'mycommentuser':'BLUE', -'myemotebullet':'RED', -'myemotetext':'WHITE', -'newbuddynotice':'RED', -'openurl':'WHITE', -'pmnotice':'YELLOW', -'pmoffnotice':'RED', -'pmonnotice':'BLUE', -'rclist':'WHITE', -'shellcommand':'WHITE', -'statusbar':'BLUE', -'userenternotice':'BLUE', -'userexitnotice':'BLUE', -'userinfo':'WHITE', -'userlist':'WHITE' -} - - self.defrc = { -'username':'', -'password':'', -'room':'Linux, FreeBSD, Solaris:1', -'auto-lowercase':'Y', -'ignore-spambot':'Y', -'ignore-spambot-preignore':'Y', -'ignore-spambot-length':60, -'ignore-spambot-seconds':60, -'ignore-spambot-count':3, -'ignore-spambot-string':'http://', -'scroll-autoignorenotice':'N', -'scroll-awayoffnotice':'N', -'scroll-awayonnotice':'N', -'scroll-excludeoffnotice':'N', -'scroll-excludeonnotice':'N', -'scroll-highoffnotice':'N', -'scroll-highonnotice':'N', -'scroll-ignoreoffnotice':'N', -'scroll-ignoreonnotice':'N', -'scroll-logendnotice':'N', -'scroll-logstartnotice':'N', -'scroll-muteoffnotice':'N', -'scroll-muteonnotice':'N', -'scroll-newbuddynotice':'N', -'scroll-pmnotice':'N', -'scroll-pmoffnotice':'N', -'scroll-pmonnotice':'N', -'scroll-userenternotice':'N', -'scroll-userexitnotice':'N', -'style-comment':'<%s> ', -'style-mycomment':'<%s> ', -'pm-from-all':0 -} + self.babellang_from = 'English' + self.babellang_to = 'French' + self.cmd = ['JOIN ', 'QUIT ', 'TELL ', 'IGNORE ', 'BUDDY ', 'USERS ', 'AWAY ', 'GOTO ', 'VER', 'UPTIME', 'OPENURL '] self.pids = [] self.log = None self.time0 = time.time() - self.userinfo = {} # stores startime, lastcomment, commentcount - self.logoutusers = [] # stores last few users that have logged out - self.colorraw = {} # stores color profile in raw format - self.color = {} # stores color profile in usable form - - # create ~/.curphoo/ if it doesn't exist - if not os.access(CPDIR, os.F_OK): - os.mkdir(CPDIR, 0700) - self.init_rc() - else: - # if ~/.curphoo/curphoorc doesn't exist - if not os.access(CPRC, os.F_OK): - self.init_rc() - else: - self.load_rc() - + self.load_rc() # init members with curphoorc self.load_opts() # init members with command line switches + if not self.user: self.user= raw_input('Username: ') + if not self.password: + self.setcookie() # app exits here if this fails + rep = raw_input("Save profile to curphoorc? [Y/n]: ")[:1].lower() + if rep in ('', 'y'): + self.save_rc() self.load_buds() - self.load_buddies() # load your buddies list - self.load_ignores() # load list of ignored users - # NOTE: load_exclude() needs to be called after load_ignores because this will remove users from ignores - self.load_exclude() # load list of users excluded from auto ignore (for safety) - self.load_mycmd() # load custom commands - self.load_myregex() # load ignoring regex - self.load_highlightstring() # load list of highlighted strings - self.load_highlightuser() # load list of highlighted users - self.load_color() # load color profiles - self.load_ignoremsg() # load ignore notify message + self.load_ignores() + self.load_mycmd() + self.load_myregex() - def clean(self): - self.save_rc() - self.save_buddies() - self.save_ignores() - self.save_exclude() - self.save_myregex() - self.save_highlightstring() - self.save_highlightuser() - self.save_color() - if self.log: - try: - self.log.close() - except IOError: - pass - def load_myregex(self): if os.access(CPMYREGEX, os.R_OK): f = open(CPMYREGEX, 'r') @@ -266,18 +136,7 @@ self.myregex.append(r) f.close() - def save_myregex(self): - try: - self.myregex.sort(); - f = open(CPMYREGEX, 'w') - for s in self.myregex: - f.write(s + "\n") - f.close() - except: - pass - def load_mycmd(self): - self.mycmd = {} if os.access(CPMYCMDS, os.R_OK): f = open(CPMYCMDS, 'r') k = '' @@ -315,181 +174,89 @@ #end while f.close() - def load_buds(self): - try: - f = open(CPBUDDIES, 'r') - self.buddies = pickle.load(f) - f.close() - except IOError, pickle.PickleError: - pass + def clean(self): + self.save_buds() + self.save_ignores() + if self.log: + try: + self.log.close() + except IOError: + pass - def load_buddies(self): - try: - f = open(CPBUDDIESTXT, 'r') - while 1: - s = f.readline() - if s: - s = s.strip() - self.buddies.append(s); - else: - break - f.close() - except: - pass + def load_buds(self): + try: + f = open(CPBUDDIES, 'r') + self.buddies = pickle.load(f) + f.close() + except IOError, pickle.PickleError: + pass def save_buds(self): - try: - f = open(CPBUDDIES, 'w') - pickle.dump(self.buddies, f) - f.close() - except: - pass - - def save_buddies(self): - try: - self.buddies.sort(); - f = open(CPBUDDIESTXT, 'w') - for s in self.buddies: - f.write(s + "\n") - f.close() - except: - pass + try: + f = open(CPBUDDIES, 'w') + pickle.dump(self.buddies, f) + f.close() + except: + pass def load_ignores(self): - try: - f = open(CPIGNORESTXT, 'r') - while 1: - s = f.readline() - if s: - s = s.strip() - self.ignores[s] = 1; - else: - break - f.close() - except: - pass + try: + f = open(CPIGNORES, 'r') + self.ignores = pickle.load(f) + f.close() + except IOError, pickle.PickleError: + pass def save_ignores(self): + try: + f = open(CPIGNORES, 'w') + pickle.dump(self.ignores, f) + f.close() + except: + pass + + def save_rc(self): + if os.access(CPDIR, os.F_OK): + if os.access(CPDIR, os.W_OK): + if os.access(CPRC, os.F_OK): + if os.access(CPRC, os.W_OK): + self.write_rc() + else: + self.write_rc() + else: + os.mkdir(CPDIR, 0700) + self.write_rc() + + def write_rc(self): + f = open(CPRC, 'w') try: - sorted_ignores = self.ignores.keys() - sorted_ignores.sort() - f = open(CPIGNORESTXT, 'w') - for s in sorted_ignores: - f.write(s + "\n") + f.write('username=%s\nalias=%s\nroom=%s\ncookie=%s\npassword=%s\n' % (self.user, ','.join(self.alias), self.room, self.cookie, self.password)) + finally: f.close() - except: - pass - - def init_rc(self): - self.user = raw_input('Yahoo! Username: ') - self.rc['username'] = self.user - self.password = getpass.getpass(" Password: ") - rep = raw_input("Save profile to ~/curphoo/curphoorc? [Y/n]: ")[:1].lower() - if rep in ('', 'y'): - self.rc['password'] = self.password - for k in self.defrc.keys(): - if not self.rc.has_key(k) or self.rc[k] == '': - self.rc[k] = self.defrc[k] - self.save_rc() def load_rc(self): - # read ~/.curphoo/curphoorc file if os.access(CPRC, os.R_OK|os.W_OK): f = open(CPRC, 'r') try: - s = f.readline() - while s: - scopy = s.lstrip()[:-1] - if scopy == '': - s = f.readline() - continue - if scopy[0] == '#' or scopy.find('=') == -1: - s = f.readline() - continue - k = scopy.split('=',1)[0] - k = k.lstrip().strip() - v = scopy.split('=',1)[1] - self.rc[k] = v - s = f.readline() + line = f.readline().strip() + while line: + if line.startswith('username='): + self.user = line.split('=',1).pop().strip() + elif line.startswith('room='): + self.room = line.split('=',1).pop().strip() + elif line.startswith('cookie='): + self.cookie = line.split('=',1).pop().strip() + elif line.startswith('password='): + self.password = line.split('=',1).pop().strip() + line = f.readline().strip() finally: f.close() - self.user = self.rc['username'] - self.room = self.rc['room'] - # correct rc setting names 0.3.5 to 0.3.6 - if (self.rc.has_key('comment-style')): - self.rc['style-comment'] = self.rc['comment-style'][:] - del self.rc['comment-style'] - if (self.rc.has_key('mycomment-style')): - self.rc['style-mycomment'] = self.rc['mycomment-style'][:] - del self.rc['mycomment-style'] - if (self.rc.has_key('cookie')): - del self.rc['cookie'] - # map new default rc - for k in self.defrc.keys(): - if not self.rc.has_key(k) or self.rc[k] == '': - self.rc[k] = self.defrc[k] - # if a password isn't saved in curphoorc file - if not self.rc.has_key('password') or self.rc['password'].lstrip().strip() == '': - self.password = getpass.getpass("Yahoo! Username: %s\n Password: " % self.rc['username']) - rep = raw_input("Save profile to ~/curphoo/curphoorc? [Y/n]: ")[:1].lower() - if rep in ('', 'y'): - self.rc['password'] = self.password - else: - self.password = self.rc['password'] - - def create_path(self): - os.mkdir(CPDIR, 0700) - - def creat_rc(self): - if not os.access(CPDIR, os.F_OK): - self.create_path() - - f = open(CPRC, 'w') - for k in self.rc.keys(): - f.write("%s=%s\n" % (k, self.rc[k])) - f.close() - - def save_rc(self): - # read ~/.curphoo/curphoorc - lines = [] - if os.access(CPRC, os.F_OK): - f = open(CPRC, 'r') - s = f.readline() - while s: - s = s.strip() - lines.append(s) - s = f.readline() - f.close() - - rckeys = self.rc.keys() - - f = open(CPRC, 'w') - for s in lines: - scopy = s - sdcopy = scopy.lstrip().strip() - if scopy == '': - f.write("\n") - continue - if scopy[0] == '#' or scopy.find('=') == -1: - f.write("%s\n" % s) - continue - k = scopy.split('=',1)[0].lstrip().strip() - v = scopy.split('=',1)[1] - if self.rc.has_key(k): - f.write("%s=%s\n" % (k, self.rc[k])) - del rckeys[rckeys.index(k)] - rckeys.sort() - for k in rckeys: - f.write("%s=%s\n" % (k, self.rc[k])) - f.close() - - - + def load_opts(self): options = clopt.do() if options[0]: self.user = options[0] if options[1]: self.room = options[1] -# if options[2] in ('5', '6', '7', '8'): +# if options[2] in ('5', '6', '7', '8'): if options[2] in ('1', '2'): self.server = "cs%s.msg.dcn.yahoo.com" % options[2] if options[3]: @@ -506,148 +273,26 @@ self.user=self.user.strip() self.password = "" - def load_highlightstring(self): - try: - f = open(CPHIGHSTR, 'r') - while 1: - s = f.readline() - if s: - s = s.strip() - self.highstr.append(s) - else: - break - f.close() - except: - pass - - def save_highlightstring(self): - try: - self.highstr.sort(); - f = open(CPHIGHSTR, 'w') - for s in self.highstr: - f.write(s + "\n") - f.close() - except: - pass - - def load_highlightuser(self): - try: - f = open(CPHIGHUSER, 'r') - while 1: - s = f.readline() - if s: - s = s.strip() - self.high.append(s) - else: - break - f.close() - except: - pass - - def save_highlightuser(self): - try: - self.high.sort(); - f = open(CPHIGHUSER, 'w') - for s in self.high: - f.write(s + "\n") - f.close() - except: - pass - - def load_color(self): - self.color = {} - self.colorraw = {} - # if ~/.curphoo/color file doesn't exist - if not os.access(CPCOLOR, os.F_OK): - for profile in self.defcolor.keys(): - self.colorraw[profile] = self.defcolor[profile] - self.color[profile] = self.colormap[self.colorraw[profile].upper()] - self.save_color() - return - - try: - f = open(CPCOLOR, 'r') - while 1: - s = f.readline() - if s: - s = s.strip() - colorname = s.split('=', 2)[0].strip().lstrip() - colorstr = s.split('=', 2)[1].strip().lstrip() - self.colorraw[colorname] = colorstr - self.color[colorname] = self.colormap[colorstr.upper()] - else: - break - f.close() - - # color migration patch for 0.3.2 to >=0.3.3 - if (self.color.has_key('urlopen')): - self.color['openurl'] = self.color['urlopen'] - del self.color['urlopen'] - # color migration patch for 0.3.5 to >=0.3.6 - if (self.color.has_key('lognotice')): - del self.color['lognotice'] - - # merge in new color profile - for profile in self.defcolor.keys(): - if not self.color.has_key(profile): - self.colorraw[profile] = self.defcolor[profile] - self.color[profile] = self.colormap[self.defcolor[profile].upper()] - except: - pass - - def save_color(self): - try: - profiles = self.color.keys() - profiles.sort(); - f = open(CPCOLOR, 'w') - for s in profiles: - f.write("%s=%s\n" % (s, self.colorrevmap[self.color[s]])) - f.close() - except: - pass - - # this function needs to parameters: color profile name and color in string - def set_color(self, colorname, colorvalue): - self.colorraw[colorname] = colorvalue.upper() - self.color[colorname] = self.colormap[colorvalue.upper()] - - def load_ignoremsg(self): - try: - f = open(CPIGNOREMSG, 'r') - msglist = f.readlines() - self.ignoremsg = ''.join(msglist) - f.close() - except: - self.ignoremsg = '*** %s will be ignored' - - def load_exclude(self): - # load list of users excluded from auto ignore - try: - f = open(CPEXCLUDE, 'r') - while 1: - s = f.readline() - if s: - s = s.strip() - self.excludes.append(s) - else: - break - f.close() - except: - pass - - def save_exclude(self): - # save list of users excluded from auto ignore - try: - self.excludes.sort(); - f = open(CPEXCLUDE, 'w') - for s in self.high: - f.write(s + "\n") - f.close() - except: - pass + def setcookie(self): + prompt = "Y! login: %s\nPassword: " % self.user + self.password = getpass.getpass(prompt) + + def setcookieOld(self): + prompt = "Y! login: %s\nPassword: " % self.user + password = getpass.getpass(prompt) + print "fetching cookie, please wait..." + q=urllib.quote + s=socket.socket(socket.AF_INET,socket.SOCK_STREAM) + s.connect(('login.yahoo.com',80)) + s.send('GET /config/login?login=%s&passwd=%s HTTP/1.0\r\nAccept: */*%s'%(q(self.user),q(password),'\r\n'*3)) + d,c='',s.recv(1024) + while c:d,c='%s%s'%(d,c),s.recv(1024) + s.close() + y,t,i='','',12 + for e in d.split('\n'): + if e[i:i+2]=='Y=':y=e.split(';')[0][i:] + elif e[i:i+2]=='T=':t=e.split(';')[0][i:] + y and t or sys.exit('ERROR: Invalid login') + self.alias=[self.user] + self.cookie='%s; %s' % (y, t) - def cache_logout_user(self, user): - if user not in self.logoutusers: - if len(self.logoutusers) >= 5: - self.logoutusers = self.logoutusers[1:] - self.logoutusers.append(user) diff -Naur curphoo-0.3.12/Yahoo.py curphoo-0.3.12.4.1/Yahoo.py --- curphoo-0.3.12/Yahoo.py 2004-01-23 11:51:40.000000000 -0500 +++ curphoo-0.3.12.4.1/Yahoo.py 2005-03-31 23:23:31.000000000 -0500 @@ -51,14 +51,13 @@ class Client: - def __init__(self, sess): + def __init__(self): self.__socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.__rbuf = '' self.__wbuf = '' self.__wbufq = [] self.ok = 0 self.locket = threading.Lock() - self.sess = sess def connect(self, server): try: @@ -143,7 +142,7 @@ self.locket.acquire() self.__rbuf = self.__rbuf[plen:] self.locket.release() - return m9dec.do(packet, self.sess) + return m9dec.do(packet) def write_message(self, **keywords): self.locket.acquire() diff -Naur curphoo-0.3.12/clopt.py curphoo-0.3.12.4.1/clopt.py --- curphoo-0.3.12/clopt.py 2003-09-25 13:31:45.000000000 -0400 +++ curphoo-0.3.12.4.1/clopt.py 2005-03-31 23:23:31.000000000 -0500 @@ -37,7 +37,7 @@ def usage(): print """ -Curphoo 0.3.7 +Curphoo 0.3.12.4.1 Usage: curphoo [-u] [-r] [-l] diff -Naur curphoo-0.3.12/cmdhelp.py curphoo-0.3.12.4.1/cmdhelp.py --- curphoo-0.3.12/cmdhelp.py 2004-01-23 11:51:40.000000000 -0500 +++ curphoo-0.3.12.4.1/cmdhelp.py 2005-03-31 23:23:31.000000000 -0500 @@ -26,14 +26,14 @@ # Revision 1.1 2003/09/25 17:31:45 mkennedy # intial import # -# +# # Revision 1.7 2002/9/22 dreadpiraterobertsjr # added /help regex # # Revision 1.6 2002/08/28 01:22:05 bluelein # added help for mountainpenguin's patch # added /help pm -# added /help color +# added /help color # added /help mute # added /help load # added /help openprofile @@ -63,177 +63,141 @@ ## join = """/join or /j - - Allows one to join public chat room throughout the yahoo messenger service. +This is how you switch from room to room. syntax: /join -example: /join programming:1 -example: /j california:1""" - -ignore = """/i or /ignore or /iv or /ignore* or /i* or /iv* - - Silent (/i) or vocal (/iv) ignores create an "ignore" file storing unwanted trash, bots and just plain lamer usernames you dont EVER want to see again. Ignored usernames are stored within a plain file stored in: ~/.curphoo/ignore --- You can add an already existing "ignore" file to ~/.curphoo/ if you have one from a prior version of curphoo or other *nix chat client. An example of an ignore file you can place within the ~/.curphoo/ directory can be found here: +example: /join programming:1""" - * http://edge-op.org/grouch/ignore +ignore = """/ignore or /i +This is how you ignore users. syntax: /ignore - Where is a Yahoo! I.D. you want to banish to the iggy file + Where user is a chatter's nick or a regular expression. -example: /i james_kelly example: /ignore james_kelly - The above examples silently places james_kelly on youre ignore list - -example: /iv james_kelly - Using this option would tell the room you have just placed james_kelly on iggy! You can edit the output of this verbal ignore by creating a "ignoremsg" file within ~/.curphoo/ -- The "ignoremsg" file can contain words or ascii art... + puts the chatter called james_kelly on your ignore list example: /ignore james_kelly.* - Ignores all instances of james_kelly**** -- ex. james_kelly01 - james_kelly100000 + ignores james_kelly, james_kelly1962, james_kelly2000 -example: /ignore* hax0r1 b4dCumPany YoWmAaaAmA etc etc etc -example: /i* hax0r1 b4dCumPany YoWmAaaAmA etc etc etc -example: /iv* hax0r1 b4dCumPany YoWmAaaAmA etc etc etc - The above examples allow you to ignore multiple users at once. +To list all users on ignore type /ignore""" -Remember that running the above options a second time on a lamers username will unignore that user and remove it from youre "ignore list. +ignorem = """/ignore* or /i* +Ignore multiple users in one go with this command. -To list all users on youre "ignore" list that are currently in the chatroom use /i or /iv / or /ignore by itself.""" +syntax: /ignore* [user2] [user3] ... -buddy = """/buddy or /b +example: /ignore* james_kelly newcastlewestend + puts james_kelly and newcastlewestend on your ignore list.""" - Gives friends and other Yahoo! members pm privileges. +buddy = """/buddy or /b +Gives users pm privileges. syntax: /buddy - is the Yahoo! ID of the buddy you want to be able to PM you whenever youre signed onto Yahoo! + Where user is the name of the chatter you want to accept pms from. example: /buddy the_cpu_fan - Doing this would accept all private messages from the one and only... the_cpu_fan --- the creator of curphoo. Hail the_cpu_fan when you see him online. + accepts all private messages from the_cpu_fan -example: /buddy - This will list all the buddies on youre buddy list located inside ~/.curphoo/ directory""" +To list all users on your buddy list type /buddy""" ybuddy = """/ybuddy or /yb - - This is a NEW feature added by the_cpu_fan which allows one to be notified when one of youre buddies logs on or off the Yahoo! service. This option is different than /buddy as this option is global instead of local. This feature adds a buddy to youre actual Yahoo! Messenger buddy list instead of the file located inside ~/.curphoo/... +Adds users to your Yahoo! buddy list. +You will be notified when these users go online/offline. syntax: /ybuddy - is the Yahoo! ID of the person you want to add to youre official Yahoo! Messenger buddy list... remember this list follows you whenever you log onto the Yahoo! Messenger Service. - -example: /yb the_cpu_fan -example: /ybuddy lam0idz - Will add these Yahoo! ID's onto youre messenger buddy list and will tell you when either the_cpu_fan or lam0idz log on / off of the service - -example: /yb -example: /ybuddy - Using these commands by themselves lists the buddies that are online @ the moment and are NOT using the invisible option. If youre buddy is NOT online then they will NOT show up when you use this option.""" + Where user is the name of the chatter you want to accept pms from. -clear = """/clear or /cls +example: /ybuddy the_cpu_fan - This option clears the screen and leaves you with a clean slate so to speak. Useful when you need to get rid of something you dotn want to read on screen. +To list all users on your yahoo buddy list type /ybuddy""" -syntax: /clear +clear = """/clear or /cls +Clears the screen. -example: /clear -example: /cls""" +syntax: /clear""" think = """/think or /t +Gives others the impression that you actually think. - . o 0 ( This cute option makes it look like what you type is within a bubble usually used in comic's to depict thinking ) +syntax: /think -syntax: /think {type something you are thinking} - -example: /think i R_eally Hate stuck up 22 year OLd gnoMES_ from the UK - If I were to use this option within chat... it would look like this: - - * . o 0 ( i R_eally Hate stuck up 22 year OLd gnoMES_ from the UK. )""" +example: /think I hate my boss + would look like this in chat: + * Your_Nick . o O ( I hate my boss )""" quit = """/quit or /q +Quit the chat session and log out of Yahoo. - Allows one to escape the clutches of the Yahoo! chat service by quitting the elite and never duplicated curphoo chat client... - -syntax: /quit {message} - Where {message} is optional and can be anything you want to let everyone know before the elite curphoo chat client actually logs youre username out. +syntax: /quit [message] + Where message is optional and can be any arbitrary string which you + want sent to chat before actually logging out. -example: /quit im out now so PEAAAAAACE!""" +example: /quit catch you all later.""" emote = """: or /me - - Yes... once again life has been made exciting by the new protocol change our wonderful leader the_cpu_fan implemented for the new curphoo chat client. Emotes provide a little excitement to the daily drag of Yahoo! life... a Yahoo! life without emotes is no life at all! +Any command that starts with ':' or /me is interpreted as an emote. +Emotes look like this: +* Your_Nick blah blah blah syntax: /me -example: /me is a *pimp* - If Yahoo! ID "indigo_corr" used the emote option above it would look like this in the chatroom: - - * indigo_corr is a *pimp* - -example: :is *dying* - If Yahoo! ID "duralinux" used the emote option and message above it would look like this in the chatroom: - - * duralinux is *dying*""" +example: :loves curphoo. heh + would look like this in chat: + * YourNick loves curphoo. heh + +example: /me is *dying* + would look like this in chat: + * YourNick is *dying*""" tell = """/tell or /msg or /m +Send private messages. - What would Yahoo! life be without the ability to send private messages to harrass and enamor other users of the Yahoo! messenger service? This nifty features adds another level of communication with people outside of the current chatroom that youre in as well as private communication with a Yahoo! member inside the current chatroom youre stationed in. - -syntax: /tell {message} +syntax: /tell Where - -- the name of the chatter you want to PM. - {message} -- whatever you want to say to the chatter in private. - -example: /tell mountain_penquin the features U contributed 2 curphoo rock dude! -example: /msg cpu_melt_down hia kan yew proveye lennox halp plz?!? -example: /m edge-op wanna get together and listen to the new Britney Spears album and bop our heads later dude? - -Once you have PM'ed a user ONCE ... you can use "#" to message the same user again... lets say for instance that I want to have a conversation in private with the_cpu_fan... i would first do this: + user -- the name of the chatter you want to pm + message -- whatever you want to say to the chatter - * /tell the_cpu_fan sup dude! - ->From that point forward if I wanted to PM or respond to his PM's I would simply just type: - - * # hahaha yeah you dont frikkin say? - -Note from the_cpu_fan: For those that find typing /tell something something something a tad tedious I've added # support. This looks at youre last /tell command string and puts that string on the input box excluding the actual message. +example: /tell kq_56 hello! See /help buddy""" shellexec = """! - - Any command that starts with '!' is interpreted as a shell command and the output of the command is then printed AND sent into the chatroom for the world to see youre command chops. +Any command that starts with '!' is interpreted as a shell command +whose output will be sent to chat. syntax: ! -example: !df -Th +example: !uptime -example: !uptime""" +example: !df -h""" localexec = """!! - - Any command starting with '!!' is interpreted as a shell command whose output will be printed inside the chatroom BUT WILL NOT be sent to the chat room. Consider it a private shell exec where only YOU can see it. You should use this option first if you are unsure of the outcome of youre shell command... as you will probably be iggied for being a lamer if youre command produces undesirable effects of spamming the room with giberish. +Any command that starts with '!!' is interpreted as a shell command +whose output will be printed on the chat window but will not be sent to chat. syntax: !! -example: !!ls -alF""" +example: !!uptime""" hilite_user = """/hilite-user or /hu +Highlights a user's post. - Highlights chatroom posts of the user you specify when you use this feature. - -syntax: /hu - Where is the name of the chatter whose chatroom posts you want highlighted. +syntax: /hilite-user + Where user is the name of the chatter whose post you want highlighted example: /hilite-user the_cpu_fan - highlights the_cpu_fan's chatroom posts. + highlights the_cpu_fan's post -example: /hu imparcival - highlights IMParcival's posts. +example: /hu Imparcival + highlights IMParcival's post To list all users on highlight type: /hu To remove a user from the highlight list type: /hu """ hilite_string = """/hilite-string or /hs - - Highlights any post where a regular expression matches. +Highlights any post where a regular expression matches. syntax: /hilite-string @@ -246,20 +210,17 @@ List all users""" uptime = """/uptime or /up - - Long gone are the days when our uptime was only a matter of minutes... let the world know just how elite and kick ass youre new curphoo chat client is by showing everyone that yes... stable chat clients do exist! +Shows all how superb your chat client is. syntax: /up[time]""" ver = """/v or /ver or /version - - Shows all where you got your copy of curphoo from. +Shows all where you got your copy of curphoo from. syntax: /v""" away = """/away or /a - - Tells everyone you're away. +Tells everyone you're away. syntax: /away [excuse] @@ -268,22 +229,20 @@ example: /away off to lunch""" back = """/back - - Tell everyone you've returned. +Tell everyone you've returned. syntax: /back""" goto = """/goto - - Follow a user, wherever he may go. +Follow a user, wherever he may go. syntax: /goto example: /goto the_cpu_fan""" -openurl = """/openurl - Loads a url in a new web browser window. The url can be +openurl = """/openurl +Loads a url in a new web browser window. The url can be given as an argument to the /openurl or if no arguments are given the url used is the most recent url seen in the chat window. @@ -292,232 +251,12 @@ example: /openurl http://slashdot.org -example: /openurl http://bluelein.com - -example: /openurl - The above example will open the last URL a user has posted inside the chatroom """ - -pm = """/pm - - This feature toggles between: - - * Accepting all private messages -- you will receive PM's from anyone and everyone that feels like bugging you. Use this feature when you DONT want to add someone to youre /buddy list... - - * Accepting private messages from friends -- only people you will receive PM's from will be people you have used the '/buddy ' command with... this means that only you're closest buddies can PM you... understand you will NOT receive PM's from ANYONE that is NOT '/buddy '... you will not receive pm's from people that you have '/yb '... - -syntax: /pm - -example: /pm - -See /help buddy or /help ybuddy for more information""" - -uinfo = """/uinfo - - User info will show you the chatter's time, last commend and comment count. Please note this feature will ONLY return information from chatters that are within the same chatroom you are currently a part of. - -syntax: /uinfo - where is a Yahoo! ID within the same chatroom youre in that you would like to query. - -example: /uinfo mountainpenguin - using /uinfo on the user mountainpenguin produced this result: -*** User Info : [mountainpenguin] -chat time: 00:03.24 -last comment: javatype: yea.. but 1.1 is out now. -comment count: 6""" - -color = """/color - - mountainpenguin added a customizable color profile. The color settings are stored at ~/.curphoo/color and available colors are: - - *black - *red - *green - *yellow - *blue - *megenta - *cyan - *white - -syntax: /color - will show all color profiles available for editing - -example: /color set PROFILENAME COLOR - where PROFILENAME is name of types of messages found using /color - where COLOR is one of the eight colors available -Once done with you're custom color setup you must save by using either: - * /quit - * /color save - -example: /color load - will read from ~/.curphoo/color - this is useful if ~/.curphoo/color is modified with a text editor... you just save youre changes and then use the above command and you dont have to exit and re-enter. - -example: /color save - will save changes made within chat screen to ~/.curphoo/color""" - -mute = """/mute +example: /openurl""" - will ignore user temporarily... this option will reset after a set amount of seconds or will reset after you /quit... this option differs from /ignore as it is NOT a permanent IGNORE. This option is handy for reg's that just get out of hand for a little bit and you need to gag them for a little bit... -syntax: /mute - where is a Yahoo! ID - -example: /mute li1_bastard - This will put the user li1_bastard on ignore until I exit the room... I will then be able to see his type when I re-enter the room... - -Using /mute again will un-mute user""" - -load = """/load - - loads the following files contained in ~/.curphoo/ - * color - * command - * ignore - * ignoremsg - -This useful option added by mountainpenguin ends the days of having to exit and re-enter each time you made a change to any of the above files. - -syntax: /load [file] - where [file] is either color, command, ignore, ignoremsg contained within ~/.curphoo/ - -example: /load color - will load changes made to ~/.curphoo/color -- for more information please see /help color - -example: /load command - will load changes made to ~/.curphoo/commands -- for more information please see /help command - -example: /load ignore - will load changes made to ~/.curphoo/ignore -- for more information on the 'ignore' file see /help ignore - -example: /ignoremsg - will load changes made to ~/.curphoo/ignoremsg -- loads a custom ignore message to be used with vocal iggy -- for more information on the 'ignoremsg' file please see /help ignoremsg""" - -openprofile = """/openprofile - - will open user's profile page in the form of: - - * http://profiles.yahoo.com/***** - -syntax: /openurl - where is the Yahoo! ID you want to profile. - -example: /openprofile lam0idz - using the above example would take you directly to my profile by opening up the browser in youre path and go to URL: http://profiles.yahoo.com/lam0idz """ - -regex = """/regex - - will add the regex to the regex ignore list - -syntax: /regex - where is the regex filter. -example: /regex \w{1,}@hotmail\.com """ - -command = """ ~/.curphoo/commands - - The 'command' file is where you add custom emotes, shell commands and blocks of text you find youreself repeating over and over. You can use the /load command to instantly load the changes you have made to this file... the following is an example of how to build a custom 'command' file: - - * cd ~/.curphoo - * vi commands - -You can of course use youre favorite text editor to create this file. One can create three different types of commands inside this file and they are: - - * regular comment type commands - * sh type commands - * emote type commands - -syntax: / {{username}} - where is the name given to any of the above three types found within the ~/.curphoo/commands file. - where {{username}} is optional if you have added a '%s' into any of the above three command types. Using '%s' will direct the output towards the username you specify. - -Here is a condensed version of my 'commands file': - ------ everything below this line belongs in ~/.curphoo/commands ----- -# Start of lam0idz commands file - -# prepending any of the following three command types with a '/' -# regular comment type commands -:xp -Wintendo XP(loit) - Microslut 1976-2002 - MS-DOS, 3.1 95 98SE ME NT - XPensive, -Non-Functional & Insecure - 666+ remote holes in the default install, in nearly -27 years! -# sh type commands -!tune -xmmsshow -!kill -killall -9 xmms -!mo -mozilla -# emote type commands -::winz -uname -a Lindows Wintendo 2.4.20-dev #666 Fri May 31 01:25:31 PDT 2002 i68 -6 PentiumIV - lam0idz -::plz -disinfects %s from the "plz" virus --- you better get cured dammit or I shall ha -ve to IgGgGGgGY U! [-( hmph! [-( - -# End of lam0idz 'commands file ------ everything ABOVE this line belongs in ~/.curphoo/commands ----- - -example: /mo - this shell type command will produce nothing in the room, but will call up mozilla instead of me having to type out !!mozilla in the room OR having to use the mouse to call it up. Using commands like these save you keystrokes... this command alone saves me seven keystrokes! - -example: /kill - this shell type command kills the crash loving xmms by saving me a few keystrokes... see how this can be kind of handy now? I just have to type '/kill' instead of '!killall -9 xmms' within the chatroom. - -example: /plz li1_bastard - this emote type command will produce the following output into the chatroom: - -* lam0idz disinfects li1_bastard from the "plz" virus --- you better get cured - dammit or I shall have to IgGgGGgGY U! [-( hmph! [-( - -Using '%s' within any of the following command types: - - * regular command type - * emote command type - -will produce the "username" effect... by this I mean you can direct the emote to another user instead of using an emote as a way to describe actions you do onto yourself... you can describe actions you are doing towards another user... - -Play with the file and youre Yahoo! experience will be a bit more productive and fun!""" - -ignoremsg = """ ~/.curphoo/ignoremsg - - The 'ignoremsg' file is where you enter a message to be sent out whenever you use the following commands on a user: - - * /iv - * /igv - * /ignorev - -You can edit this file to youre liking using '%s' within the file to direct the ignore message to the intended recipient of the permanent and vocal ignore you are about to give them. - -Since I have gotten used to ignoring with the /iv option I have made a smaller ignoremsg file so as not to annoy the regulars. My ignoremsg file consists of the following: - ------ below this line belongs in ~/.curphoo/ignoremsg ----- - -*** ATTENTION %s: It's time for you to go away *** - ------ above this line belongs in ~/.curphoo/ignoremsg ----- - -Lets say you are creating this file as you read this in another xterm... before you would have to /quit curphoo then re-enter for the file to take effect, but mountainpenguin has been working his little flippers off in the cold poles to bring us a nifty new feature which allows us to load the new ignoremsg file without having to exit! After saving the file please run the following command within the chatroom: - - * load command - -This means you can change the file and then load it over and over again while testing it within the chatroom to find the perfect message you want to give that pesky person you want to ignore vocally... of course you can find more information about this command by looking here: /help load - -example: /iv YouReMommA - this will produce the following message onto the user r_holmes_uk and will grab the vocal ignore message from the file ~/.curphoo/ignoremsg - -* *** annoyingtroll will be ignored - -For more information on: - - * /load - * /iv - -features please consult the following: /help load OR /help ignore""" - -babelfish = """Babelfish Language Translation engine. -curphoo is now capable of on-the-fly language tranlsation via altavista babelfish. -Currently available options are: +babelfish = """Babelfish Language Translation engine. +curphoo is now capable of on-the-fly language tranlsation via altavista babelfish. +Currently available options are: /french (/fr) /german (/ge) @@ -528,10 +267,10 @@ example: /french text goes here Output to room: le texte va ici -/tr or /translate: -these are used to translate everything one particular user says. -by default it converts from french to english. -eg: +/tr or /translate: +these are used to translate everything one particular user says. +by default it converts from french to english. +eg: /tr sl4ckw4re_syst3m *** sl4ckw4re_syst3m now added to list of users to translate @@ -545,14 +284,7 @@ """ -help = """Curphoo Commands Help File -- (c) 2002 Alex Mercader -/pm -- toggles PM privileges -/color -- color customizable items -/mute -- current chat session mute -/load -- please see / help load -/openprofile -- opens 's Yahoo! profile -/openurl -- opens URL or last chat URL -/uinfo -- chatroom activity of +help = """Curphoo commands /join -- join a room /quit [message] -- quit chat session /ignore -- ignore a user @@ -560,6 +292,7 @@ /buddy -- give a user pm privileges /ybuddy -- add a user to your Yahoo buddy list /tell [!] -- send user a private message +/pm -- temporarily turn ALL pms on /msg [!] -- send user a private message /hs -- highlight any post where regex matches /hu -- highlight user's posts @@ -570,81 +303,57 @@ /away [excuse] -- tell everyone you're away /back -- tell everyone you're back /goto -- follow a user into another room -/regex -- ignore lines with regex ! -- show all you've got sh fu !! -- show yourself your sh fu : -- emotes -# -- ease PM usage -- see /help tell -ignoremsg -- customizable ignore ascii message -commands -- customizable reg., emote & sh commands -credits -- props to the_cpu_fan and contributors babelfish -- language translation on the fly + type /help for more.""" + helpd = { - '/away': away, - '/uinfo': uinfo, - 'uinfo': uinfo, - '/#': tell, - '#': tell, - '/color': color, - 'color': color, - '/mute': mute, - 'mute': mute, - '/load': load, - 'load': load, - '/openprofile': openprofile, - 'openprofile': openprofile, - 'ignoremsg': ignoremsg, - '/ignoremsg': ignoremsg, - 'commands': command, - 'command': command, - '/commands': command, - '/command': command, - 'away': away, - '/back': back, - 'back': back, - '/goto': goto, - 'goto': goto, - '/clear': clear, - 'clear': clear, - '/think': think, - 'think': think, - '/join': join, - 'join': join, - '/quit': quit, - 'quit': quit, - '/ignore': ignore, - 'ignore': ignore, - '/buddy': buddy, - 'buddy': buddy, - '/ybuddy': ybuddy, - 'ybuddy': ybuddy, - '/tell': tell, - 'tell': tell, - '/msg': tell, - 'msg': tell, - '/openurl': openurl, - 'openurl': openurl, - '/': slash, - '/users': slash, - 'users': slash, - '/hs': hilite_string, - 'hs': hilite_string, - '/hu': hilite_user, - 'hu': hilite_user, - '/ver': ver, - 'ver': ver, - '/uptime': uptime, - 'uptime': uptime, - 'babelfish': babelfish, - '!': shellexec, - '!!': localexec, - '/me': emote, - 'me': emote, - ':': emote, - '/pm': pm, - 'pm': pm, - '/regex': regex, - 'regex' : regex + '/away': away, + 'away': away, + '/back': back, + 'back': back, + '/goto': goto, + 'goto': goto, + '/clear': clear, + 'clear': clear, + '/think': think, + 'think': think, + '/join': join, + 'join': join, + '/quit': quit, + 'quit': quit, + '/ignore': ignore, + 'ignore': ignore, + '/ignore*': ignorem, + 'ignore*': ignorem, + '/buddy': buddy, + 'buddy': buddy, + '/ybuddy': ybuddy, + 'ybuddy': ybuddy, + '/tell': tell, + 'tell': tell, + '/msg': tell, + 'msg': tell, + '/openurl': openurl, + 'openurl': openurl, + '/': slash, + '/users': slash, + 'users': slash, + '/hs': hilite_string, + 'hs': hilite_string, + '/hu': hilite_user, + 'hu': hilite_user, + '/ver': ver, + 'ver': ver, + '/uptime': uptime, + 'uptime': uptime, + '!': shellexec, + '!!': localexec, + '/me': emote, + 'me': emote, + ':': emote } diff -Naur curphoo-0.3.12/cmdparser.py curphoo-0.3.12.4.1/cmdparser.py --- curphoo-0.3.12/cmdparser.py 2004-07-01 03:26:50.000000000 -0400 +++ curphoo-0.3.12.4.1/cmdparser.py 2005-03-31 23:23:31.000000000 -0500 @@ -22,23 +22,29 @@ import re -import curses -import time -import string -import urllib -import webbrowser - import output import shexec +import webbrowser +import curses import Session +import time import cmdhelp import babelizer +import string +IGNORE_MSG = r"""(C) guardian_sentry + \\_!_____________ + <#|=====|________| *click* *click* *click* + / C|=====|---' + / |-|-|~ + / /---' + / / +|_____| ( Kiss my iggy gun %s!!!! )""" AWAY_MSG = "JuGgLiNg" # I will be kicking ass if adhoc releases cause our users confusion (matt) -PLUG_MSG = "is using Curphoo 0.3.12 http://savannah.nongnu.org/projects/curphoo/" +PLUG_MSG = "is using Curphoo 0.3.12.4.1 http://savannah.nongnu.org/projects/curphoo/" def btk(cli, sess, statusbar): if sess.afk: @@ -58,20 +64,17 @@ if re.match(r'^[^/:!\\ ].*$', cmd, re.I): # this should match the majority of comments. cli.write_message(type='comment', user=sess.user, room=sess.room, text=cmd, sessionID=sess.sessionID) - # chatwin.addstr("cmd:%s" % cmd) - # if chatwin.getyx()[1]: chatwin.addstr('\n') - output.mycomment(chatwin, sess, cmd) + output.mycomment(chatwin, sess.user, cmd) # QUIT elif re.match('^/q(uit)? *$', cmd, re.I): - if sess.sessionID: - cli.write_message(type='logout', user=sess.user, sessionID=sess.sessionID) + cli.write_message(type='logout', user=sess.user, sessionID=sess.sessionID) # GOT SOMETHING TO SAY BEFORE YOU QUIT? elif re.match('^/q(uit)? +?[^ ].*$', cmd, re.I): quit_msg = cmd.split(' ', 1).pop().strip() cli.write_message(type='comment', user=sess.user, room=sess.room, text=quit_msg, sessionID=sess.sessionID) - output.mycomment(chatwin, sess, quit_msg) + output.mycomment(chatwin, sess.user, quit_msg) cli.write_message(type='logout', user=sess.user, sessionID=sess.sessionID) # EMOTES @@ -80,16 +83,16 @@ smiley = myemote.split() if smiley and ':%s'%smiley[0] in [":)", ":-)", ":(", ":-(", ":D", ":-D", ":-/", ":-\\", ":x", ":-x", ":X", ":-X", ":p", ":-p", ":P", ":-P", ":O", ":-O", ":>", ":->", ":((", ":-((", ":))", ":-))", ":|", ":-|", ":B", ":-B", ":-&", ":-$", ":o)", ":0)", ":O)", ":@)", ":(|)"]: cli.write_message(type='comment', user=sess.user, room=sess.room, text=':%s'%myemote, sessionID=sess.sessionID) - output.mycomment(chatwin, sess, ':%s'%myemote) + output.mycomment(chatwin, sess.user, ':%s'%myemote) else: cli.write_message(type='emote', user=sess.user, room=sess.room, text=myemote, sessionID=sess.sessionID) - output.myemote(chatwin, sess, myemote) + output.myemote(chatwin, sess.user, myemote) elif re.match('^/me *?[^ ].*$', cmd, re.I): msg = cmd.split(' ',1).pop().strip() cli.write_message(type='emote', user=sess.user, room=sess.room, text=msg, sessionID=sess.sessionID) - output.myemote(chatwin, sess, msg) + output.myemote(chatwin, sess.user, msg) # CLEAR CHAT WINDOW elif re.match('^/cl(ear|s) *$', cmd, re.I): @@ -98,7 +101,7 @@ # WELL.. WELL.. LOOK WHO's HERE elif re.match('(^/u(sers)? *$|^/$)', cmd, re.I): - output.list_currentusers(chatwin, sess, sess.users, sess.color['userlist'], 'Users') + output.list_users(chatwin, sess.users, 'Users') # JOIN ROOMS elif re.match('^/j(oin)? +?[^ ].*$', cmd, re.I): @@ -110,7 +113,7 @@ thought = cmd.split(' ', 1).pop().strip() cli.write_message(type='emote', user=sess.user, room=sess.room, text=". o O ( %s )"%thought, sessionID=sess.sessionID) #cli.write_message(type='thought', user=sess.user, room=sess.room, text=". o O ( %s )"%thought, sessionID=sess.sessionID) - output.myemote(chatwin, sess, '. o O ( %s )'%thought) + output.myemote(chatwin, sess.user, '. o O ( %s )'%thought) #cli.write_message(type='thought', text=thought) # STOP BITCHING ABOUT THE NON-FUNCTIONAL BACKSPACE DAMN IT! @@ -118,13 +121,13 @@ cli.write_message(type='emote', text=". o O ( wtf is ^H: Gee... I don't know what ^H means... )", user=sess.user, room=sess.room, sessionID=sess.sessionID) - output.myemote(chatwin, sess, ". o O ( wtf is ^H: Gee... I don't know what ^H means... )") + output.myemote(chatwin, sess.user, ". o O ( wtf is ^H: Gee... I don't know what ^H means... )") # *DYING* elif re.match('^/d(ying)? +[^ ].*$', cmd, re.I): dead_stuff = cmd.split(' ', 1).pop().strip() cli.write_message(type='comment', user=sess.user, room=sess.room, text='%s is *dying*' % dead_stuff, sessionID=sess.sessionID) - output.mycomment(chatwin, sess, "%s is *dying*"%dead_stuff) + output.mycomment(chatwin, sess.user, "%s is *dying*"%dead_stuff) elif re.match('^/up(time)? *$', cmd, re.I): u = time.time() - sess.time0 @@ -142,23 +145,7 @@ #msg = "%s because i'm kick ass and i need my chat client to be kick ass with me (heh.)" % (msg) msg = "%s because I kick ass!" % (msg) cli.write_message(type='comment', user=sess.user, room=sess.room, text=msg, sessionID=sess.sessionID) - output.mycomment(chatwin, sess, msg) - - # LIST ALL REGEXES ON IGNORE - elif re.match('^/r(e|egex)? *$', cmd, re.I): - output.list_regex(chatwin, sess, sess.myregex, sess.color['ignorelist'], 'List of regex ignores.') - - # APPEND A REGEX TO THE LIST - elif re.match('^/r(e|egex)? +[^ ].*', cmd, re.I): - regex = cmd.split(' ',1).pop().strip() - if regex in sess.myregex: - #output.ignore_notice(chatwin, "RegEx "+regex, sess.color['ignoreoffnotice'], 0) - output.ignore_notice(chatwin, sess, "RegEx "+regex, 0) - sess.myregex.remove(regex) - else: - #output.ignore_notice(chatwin, "RegEx "+regex, sess.color['ignoreonnotice']) - output.ignore_notice(chatwin, sess, "RegEx "+regex, 1) - sess.myregex.append(regex) + output.mycomment(chatwin, sess.user, msg) #sl4ckw4re_syst3m strikes again # APPEND A BABEL TO THE LIST @@ -182,51 +169,13 @@ sess.babellang_to = regex; - # GIVE USER INFO - elif re.match('^/ui(nfo)? +[^ ].*$', cmd, re.I): - user = cmd.split(' ',1).pop().strip() - if user: - output.user_info(chatwin, sess, user) - else: - output.user_info(chatwin. sess. sess.user) - - # COLOR INFO - elif re.match('^/col(o|ou)r(s)? *$', cmd, re.I): - output.list_color(chatwin, sess) - - # COLOR COMMANDS - elif re.match('^/col(o|ou)r(s)? +[^ ].*$', cmd, re.I): - tokens = re.split('\s+', cmd)[1:] - command = tokens[0] - params = tokens[1:] - if re.match('(re)?load', command, re.I) and len(params) == 0: - sess.load_color() - output.notify(chatwin, sess, 'color profile loaded') - output.status(statusbar, sess) - elif command.lower() == 'save' and len(params) == 0: - sess.save_color() - output.notify(chatwin, sess, 'color profile saved') - elif command.lower() == 'set': - if params[0] in sess.color.keys(): - if params[1].upper() in sess.colorrevmap: - sess.set_color(params[0], params[1]) - output.notify(chatwin, sess, 'color profile %s set to %s' % (params[0], params[1].upper())) - if params[0] == 'statusbar': - output.status(statusbar, sess) - else: - output.error(chatwin, sess, 'unknown color \'%s\'' % params[1]) - else: - output.error(chatwin, sess, 'unknown color profile name \'%s\'' % params[0]) - # GIVE A BUDDY PM PRIVILEGES elif re.match('^/b(uddy)? +?[^ ].*$', cmd, re.I): user = cmd.split(' ', 1).pop().strip().lower() if user in sess.buddies: - sess.buddies.remove(user) - output.pm_notice(chatwin, sess, user, 0) + sess.buddies.remove(user); output.pm_notice(chatwin, user, 0) else: - sess.buddies.append(user) - output.pm_notice(chatwin, sess, user) + sess.buddies.append(user); output.pm_notice(chatwin, user) output.status(statusbar, sess) elif re.match('^/yb(uddy)? +?[^ ].*$', cmd, re.I): @@ -234,64 +183,54 @@ if user not in (sess.ybuddies): cli.write_message(type='addbuddy', user=sess.user, friend=user, sessionID=sess.sessionID) sess.ybuddies.append(user) - output.buddy_notice(chatwin, sess, user) + output.buddy_notice(chatwin, user) # LIST ALL CHATTERS WITH PM PRIVILEGES elif re.match('^/b(uddy)? *$', cmd, re.I): - output.list_buddies(chatwin, sess, sess.buddies, sess.color['buddylist'], 'List of buddies') + output.list_users(chatwin, sess.buddies, 'List of buddies') elif re.match('^/yb(uddy)? *$', cmd, re.I): - output.list_buddies(chatwin, sess, sess.ybuddies, sess.color['buddylist'], 'List of ybuddies') + output.list_users(chatwin, sess.ybuddies, 'List of ybuddies') elif re.match('^/pm *$', cmd, re.I): if sess.pms_are_ok: sess.pms_are_ok = 0 - output.pm_status(chatwin, sess, 'Accepting private messages from friends') + output.generic(chatwin, 'Accepting private messages from friends') else: sess.pms_are_ok = 1 - output.pm_status(chatwin, sess, 'Accepting all private messages', 0) + output.generic(chatwin, 'Accepting all private messages') # HIGLIGHT A CHATTER's COMMENTS ONLY COS YOU LOVE HIM/HER SO MUCH elif re.match('^/h(ilite-user|u) +?[^ ].*$', cmd, re.I): user = cmd.split(' ', 1).pop().strip().lower() if user in sess.high: - sess.high.remove(user); - output.hi_notice(chatwin, sess, user, 0) + sess.high.remove(user); output.hi_notice(chatwin, user, 0) else: - sess.high.append(user); - output.hi_notice(chatwin, sess, user) + sess.high.append(user); output.hi_notice(chatwin, user) # CHECK OUT WHO WE HAVE HIGHLIGHTED elif re.search('^/h(ilight-user|u) *$', cmd, re.I): - output.list_highlightusers(chatwin, sess, sess.high, sess.color['hulist'], 'List of users to highlight') + output.list_users(chatwin, sess.high, 'List of users to highlight') # HIGHLIGHT COMMENTS CONTAINING A PARTICULAR STRING elif re.match('^/h(ilite-string|s) +?[^ ].*$', cmd, re.I): string = cmd.split().pop().strip().lower() - if string in sess.highstr: - # remove string from highlighted string list - sess.highstr.remove(string) - output.histr_notice(chatwin, sess, string, 0) + if string in sess.highstr: + sess.highstr.remove(string); output.histr_notice(chatwin, string, 0) else: - # add string to highlighted string list - sess.highstr.append(string) - output.histr_notice(chatwin, sess, string) + sess.highstr.append(string); output.histr_notice(chatwin, string) # HMM.. I WONDER WHAT STRINGS WE HIGHLIGHT elif re.search('^/h(ilight-string|s) *$', cmd, re.I): - output.list_highliststring(chatwin, sess.highstr, sess.color['hslist'], 'List of strings to highlight') + output.list_users(chatwin, sess.highstr, 'List of strings to highlight') # QUIETLY IGNORE ANNOYING CHATTERS - elif re.match('^/i(g|gnore)? +[^ ].*', cmd, re.I): + elif re.match('^/i(gnore)? +[^ ].*', cmd, re.I): user = cmd.split(' ',1).pop().strip() - if sess.ignores.has_key(user): - # unignore user - del sess.ignores[user] - output.ignore_notice(chatwin, sess, user, 0) + if user in sess.ignores: + sess.ignores.remove(user); output.ignore_notice(chatwin, user, 0) else: - # ignore user - sess.ignores[user] = 1 - output.ignore_notice(chatwin, sess, user) + sess.ignores.append(user); output.ignore_notice(chatwin, user) output.status(statusbar, sess) # IGNORE SEVERAL ANNOYING CHATTERS IN ONE COMMAND @@ -299,93 +238,42 @@ users = cmd.split(' ',1).pop().strip() users = [e.lower() for e in users.split()] for e in users: - if sess.ignores.has_key(e): - # unignore user - output.ignore_notice(chatwin, sess, e[:-1], 0) + if e in sess.ignores: + sess.ignores.remove(e) + output.ignore_notice(chatwin, e[:-1], 0) else: - # ignore user - sess.ignores[e] = 1 - output.ignore_notice(chatwin, sess, e[:-1]) + sess.ignores.append(e) + output.ignore_notice(chatwin, e[:-1]) output.status(statusbar, sess) # NOTIFY THE ROOM THAT YOU'RE IGNORING SOMEONE - elif re.match('^/i(g|gnore)?v +[^ ].*', cmd, re.I): + elif re.match('^/i(gnore)?v +[^ ].*', cmd, re.I): user = cmd.split(' ',1).pop().strip() - if sess.ignores.has_key(user): - # unignore user - del sess.ignores[user] - output.ignore_notice(chatwin, sess, user, 0) - else: - # ignore user - sess.ignores[user] = 1 - iggy_comment = sess.ignoremsg % user + if user in sess.ignores: + sess.ignores.remove(user) + output.ignore_notice(chatwin, user, 0) + else: + sess.ignores.append(user) + iggy_comment = IGNORE_MSG % user cli.write_message(type='comment', user=sess.user, room=sess.room, text=iggy_comment, sessionID=sess.sessionID) - output.mycomment(chatwin, sess, text=iggy_comment) + output.mycomment(chatwin, sess.user, text=iggy_comment) output.status(statusbar, sess) # LIST ALL USERS ON IGNORE - elif re.match('^/i(g|gnore)? *$', cmd, re.I): - ignores = [] # ignored users in current room - for user in sess.users: - if sess.ignores.has_key(user): - ignores.append(user) - output.list_ignoredusers(chatwin, sess, ignores, sess.color['ignorelist'], 'List of users on ignore') - - # MUTE USER - temporarily ignore a user for the duration of current session - elif re.match('^/mute +[^ ].*', cmd, re.I): - user = cmd.split(' ',1).pop().strip() - if sess.mutes.has_key(user): - del sess.mutes[user] - output.mute_notice(chatwin, sess, user, 0) - else: - sess.mutes[user] = 1 - output.mute_notice(chatwin, sess, user) - output.status(statusbar, sess) - - # SHOW EXCLUDE LIST - elif re.match('^/(ex|exclude) +', cmd, re.I): - output.list_excludeusers(chatwin, sess, excludes, sess.color['excludelist'], 'List of users on excluded from auto-ignore') - - # HANDLE EXCLUDE COMMAND - elif re.match('^/(ex|exclude) +[^ ].*', cmd, re.I): - user = cmd.split(' ',1).pop().strip() - if user in sess.excludes: - del sess.exclude[user] - output.exclude_notice(chatwin, sess, user, 0) - else: - sess.exclude[user] = 1 - output.exclude_notice(chatwin, sess, user) - output.status(statusbar, sess) - - # SHOW SETTINGS - elif re.match('^/se(t)?$', cmd, re.I): - output.list_rc(chatwin, sess) - - # HANDLE SET COMMAND - # set command allows modification of values in ~/.curphoo/curphoorc file - elif re.match('^/se(t)? +[^ ].*', cmd, re.I): - tokens = re.split('\s+', cmd)[1:] - key = tokens[0] - if len(tokens) == 1: - output.error(chatwin, sess, 'parameter value not specified') - else: - value = tokens[1] - if sess.rc.has_key(key): - sess.rc[key] = value; - else: - output.error(chatwin, sess, 'unknown parameter name: \'%s\'' % key) + elif re.match('^/i(gnore)? *$', cmd, re.I): + output.list_users(chatwin, sess.ignores, 'List of users on ignore') # PROMOTE CURPHOO elif re.match('/v(er|ersion)? *$', cmd, re.I): cli.write_message(type='emote', user=sess.user, room=sess.room, text=PLUG_MSG, sessionID=sess.sessionID) - output.myemote(chatwin, sess, PLUG_MSG) + output.myemote(chatwin, sess.user, PLUG_MSG) # SH FU w/out SENDING TO CHAT elif re.match(r'^[!][!] *?[^ ].*$', cmd, re.I): shc = cmd[2:].strip() bufsize = 512 - len(shc) - 4 res = shexec.do(shc, bufsize, sess.pids) - output.shellcommand(chatwin, sess, '%s:\n%s' % (shc, res)) + output.shcmd(chatwin, sess.user, '%s:\n%s' % (shc, res)) # IMPRESS YOUR FRIENDS W/ SOME SH FU #elif re.match(r'^[!][^!]+?[^ ].*$', cmd, re.I): @@ -395,13 +283,13 @@ bufsize = 512 - len(shc) - 4 res = '%s:\n%s' % (shc, shexec.do(shc, bufsize, sess.pids)) cli.write_message(type='comment', user=sess.user, room=sess.room, text=res, sessionID=sess.sessionID) - output.mycomment(chatwin, sess, res) + output.mycomment(chatwin, sess.user, res) # THE WHOLE WORLD's JUST GOTTA KNOW YOUR BACK elif re.match('^/back *$', cmd, re.I): cli.write_message(type='back', sessionID=sess.sessionID) cli.write_message(type='emote', user=sess.user, room=sess.room, text="is back", sessionID=sess.sessionID) - output.myemote(chatwin, sess, "is back") + output.myemote(chatwin, sess.user, "is back") sess.afk = 0 output.status(statusbar, sess) @@ -411,7 +299,7 @@ away_msg = cmd.split(' ', 1).pop().strip() cli.write_message(type='away', text=away_msg, sessionID=sess.sessionID) cli.write_message(type='emote', user=sess.user, room=sess.room, text="is away (%s)"%away_msg, sessionID=sess.sessionID) - output.myemote(chatwin, sess, "is away (%s)"%away_msg) + output.myemote(chatwin, sess.user, "is away (%s)"%away_msg) sess.afk = 1 output.status(statusbar, sess) @@ -419,12 +307,12 @@ if sess.afk: cli.write_message(type='back', sessionID=sess.sessionID) cli.write_message(type='emote', user=sess.user, room=sess.room, text="is back", sessionID=sess.sessionID) - output.myemote(chatwin, sess, "is back") + output.myemote(chatwin, sess.user, "is back") sess.afk = 0 else: cli.write_message(type='away', text=AWAY_MSG, sessionID=sess.sessionID) cli.write_message(type='emote', user=sess.user, room=sess.room, text="is away (%s)"%AWAY_MSG, sessionID=sess.sessionID) - output.myemote(chatwin, sess, "is away (%s)"%AWAY_MSG) + output.myemote(chatwin, sess.user, "is away (%s)"%AWAY_MSG) sess.afk = 1 output.status(statusbar, sess) @@ -439,92 +327,39 @@ if shc: res = shexec.do(shc, 512 - len(shc) - 2, sess.pids) cli.write_message(type='pm', user=sess.user, text='%s:\n%s' % (shc, res), otheruser=u, sessionID=sess.sessionID) - output.pm_user(chatwin, sess, u, '%s:\n%s' % (shc, res)) + output.pm_user(chatwin, sess.user, u, '%s:\n%s' % (shc, res)) else: cli.write_message(type='pm', user=sess.user, text='!', otheruser=u, sessionID=sess.sessionID) - output.pm_user(chatwin, sess, u, '!') + output.pm_user(chatwin, sess.user, u, '!') else: cli.write_message(type='pm', user=sess.user, text=m, otheruser=u, sessionID=sess.sessionID) - output.pm_user(chatwin, sess, u, m) + output.pm_user(chatwin, sess.user, u, m) # FOLLOW A USER elif re.match('^/goto +?[^ ].*$', cmd, re.I): u = cmd.split(' ',1).pop().strip() cli.write_message(type='goto', user=sess.user, otheruser=u, sessionID=sess.sessionID) - # open urls from chat in a web browser + # open urls from chat in a webbrowser elif re.match(r'^/openurl *$', cmd, re.I): if sess.url: try: webbrowser.open(sess.url, new=1, autoraise=0) - output.blah(chatwin, sess, 'opening %s' % sess.url) + output.blah(chatwin, 'opening %s' % sess.url) except: - output.blah(chatwin, sess, 'failed to open browser') + output.blah(chatwin, 'failed to open browser') output.status(statusbar, sess) - # open url from the input box in a web browser + # open url from the input box in a webbrowser elif re.match(r'^/openurl *?[^ ].*$', cmd, re.I): url = cmd.split(' ',1).pop().strip() try: - output.blah(chatwin, sess, 'opening %s' % url) - webbrowser.open(url, new=1, autoraise=0) - except: - output.blah(chatwin, sess, 'failed to open browser') - output.status(statusbar, sess) - - # open user's profile page in a web browser - elif re.match(r'^/openprofile *?[^ ].*$', cmd, re.I): - user = cmd.split(' ',1).pop().strip() - url = sess.profileurl + urllib.quote(user) - try: - output.blah(chatwin, sess, 'opening %s' % url) + output.blah(chatwin, 'opening %s' % url) webbrowser.open(url, new=1, autoraise=0) except: - output.blah(chatwin, sess, 'failed to open browser') + output.blah(chatwin, 'failed to open browser') output.status(statusbar, sess) - elif re.match(r'^/load +?[^ ].*$', cmd, re.I): - param = cmd.split(' ',1).pop().strip() - if param.lower() == 'color': - sess.load_color(); - output.notify(chatwin, sess, 'color profile loaded') - if param.lower() == 'command' or param.lower() == 'commands': - sess.load_mycmd(); - output.notify(chatwin, sess, 'command list loaded') - if param.lower() == 'exclude' or param.lower() == 'excludes': - sess.load_exclude(); - output.notify(chatwin, sess, 'exclude list loaded') - if param.lower() == 'ignore': - sess.load_ignores(); - output.notify(chatwin, sess, 'ignore list loaded') - if param.lower() == 'ignoremsg': - sess.load_ignoremsg(); - output.notify(chatwin, sess, 'ignore message loaded') - if param.lower() == 'rc': - sess.load_rc(); - output.notify(chatwin, sess, 'curphoorc file loaded') - if param.lower() == 'regex': - sess.load_myregex(); - output.notify(chatwin, sess, 'regex ignore file loaded') - - elif re.match(r'^/save +?[^ ].*$', cmd, re.I): - param = cmd.split(' ',1).pop().strip() - if param.lower() == 'color': - sess.save_color(); - output.notify(chatwin, sess, 'color profile saved') - if param.lower() == 'exclude' or param.lower() == 'excludes': - sess.save_exclude(); - output.notify(chatwin, sess, 'exclude list saved') - if param.lower() == 'ignore' or param.lower() == 'ignores': - sess.save_ignores(); - output.notify(chatwin, sess, 'ignore list saved') - if param.lower() == 'rc': - sess.save_rc(); - output.notify(chatwin, sess, 'runtime configuration saved') - if param.lower() == 'regex': - sess.save_myregex(); - output.notify(chatwin, sess, 'regex ignore file saved') - # *sl4ckw4re_syst3m slack@hackermail.com w0z h3r3* automagicl337sp33k elif re.match(r'^/h(a)?x(or)? +[^ ].*$', cmd, re.I): e1337 = cmd.split(' ', 1).pop().strip() @@ -545,7 +380,7 @@ e1337 = e1337.replace("f", "F") e1337 = e1337.replace("c", "(") cli.write_message(type='comment', user=sess.user, room=sess.room, text=e1337, sessionID=sess.sessionID) - output.mycomment(chatwin, sess, e1337) + output.mycomment(chatwin, sess.user, e1337) # *sl4ckw4re_syst3m slack@hackermail.com w0z h3r3* english->french translation via babelfish @@ -560,7 +395,7 @@ return bufsize = 0x549 - len(shc) - 4 cli.write_message(type='comment', user=sess.user, room=sess.room, text=shc, sessionID=sess.sessionID) - output.mycomment(chatwin, sess, shc) + output.mycomment(chatwin, sess.user, shc) # *sl4ckw4re_syst3m slack@hackermail.com w0z h3r3* english->german translation via babelfish elif re.match(r'^/ge(rman)? .*$', cmd, re.I): @@ -574,7 +409,7 @@ return bufsize = 0x549 - len(shc) - 4 cli.write_message(type='comment', user=sess.user, room=sess.room, text=shc, sessionID=sess.sessionID) - output.mycomment(chatwin, sess, shc) + output.mycomment(chatwin, sess.user, shc) # *sl4ckw4re_syst3m slack@hackermail.com w0z h3r3* english->spanish translation via babelfish elif re.match(r'^/sp(anish)? .*$', cmd, re.I): @@ -588,7 +423,7 @@ return bufsize = 0x549 - len(shc) - 4 cli.write_message(type='comment', user=sess.user, room=sess.room, text=shc, sessionID=sess.sessionID) - output.mycomment(chatwin, sess, shc) + output.mycomment(chatwin, sess.user, shc) # *sl4ckw4re_syst3m slack@hackermail.com w0z h3r3* english->italian translation via babelfish elif re.match(r'^/it(alian)? .*$', cmd, re.I): @@ -602,7 +437,7 @@ return bufsize = 0x549 - len(shc) - 4 cli.write_message(type='comment', user=sess.user, room=sess.room, text=shc, sessionID=sess.sessionID) - output.mycomment(chatwin, sess, shc) + output.mycomment(chatwin, sess.user, shc) # *sl4ckw4re_syst3m slack@hackermail.com w0z h3r3* english->portugese translation via babelfish elif re.match(r'^/po(rtugese)? .*$', cmd, re.I): @@ -616,50 +451,37 @@ return bufsize = 0x549 - len(shc) - 4 cli.write_message(type='comment', user=sess.user, room=sess.room, text=shc, sessionID=sess.sessionID) - output.mycomment(chatwin, sess, shc) - + output.mycomment(chatwin, sess.user, shc) #elif re.match(r'/help +?(/?join|/?quit|/?ignore\*?|/?buddy|/?ybuddy|/|/?tell|/?hs|/?hu|/?uptime|/?ver|[!]|[!][!]|:)$', cmd, re.I): # Thanks Matt Dunford for your work on cmdhelp.py :)) elif re.match(r'^/help +?[/A-Za-z*!|]+', cmd, re.I): help_str = cmd.split(' ',1).pop().strip().lower() - #output.help(chatwin, sess.color['help'], cmdhelp.helpd[help_str]) + #output.help(chatwin, cmdhelp.helpd[help_str]) if cmdhelp.helpd.has_key(help_str): - output.help(chatwin, sess, cmdhelp.helpd[help_str]) + output.help(chatwin, cmdhelp.helpd[help_str]) else: - output.help(chatwin, sess, 'No help for '+help_str) + output.blah(chatwin, 'No help for '+help_str) + + + #elif re.match('/help *$', cmd, re.I): + #output.help(chatwin, cmdhelp.help) elif re.match('^/help *$', cmd, re.I): - output.help(chatwin, sess, cmdhelp.help) + output.help(chatwin, cmdhelp.help) elif cmd[0] == '/' and cmd[1:].strip() and cmd.strip().split(' ',1).pop(0)[1:].lower() in sess.mycmd.keys(): pair = cmd.strip().split(' ',1) k = pair.pop(0).strip()[1:].lower() k = k.lower() - if sess.mycmd[k][0] == 'comment': - if pair: - v = pair.pop(0) - s = sess.mycmd[k][1].replace('%s', v) - else: - s = sess.mycmd[k][1] - cli.write_message(type='comment', user=sess.user, room=sess.room, text=s, sessionID=sess.sessionID) - output.mycomment(chatwin, sess, s) - elif sess.mycmd[k][0] == 'emote': - if pair: - v = pair.pop(0) - s = sess.mycmd[k][1].replace('%s', v) - else: - s = sess.mycmd[k][1] - cli.write_message(type='emote', user=sess.user, room=sess.room, text=s, sessionID=sess.sessionID) - output.myemote(chatwin, sess, s) - elif sess.mycmd[k][0] == 'filter': + if sess.mycmd[k][0] == 'filter': if pair: v = pair.pop(0) shc = sess.mycmd[k][1].replace('%s', v) bufsize = 510 res = shexec.do(shc, bufsize, sess.pids) cli.write_message(type='comment', user=sess.user, room=sess.room, text=res, sessionID=sess.sessionID) - output.mycomment(chatwin, sess, res) + output.mycomment(chatwin, sess.user, res) elif sess.mycmd[k][0] == 'exec o': if pair: v = pair.pop(0) @@ -671,17 +493,33 @@ bufsize = 512 - len(k) - 4 res = '%s:\n%s' % (k, shexec.do(shc, bufsize, sess.pids)) cli.write_message(type='comment', user=sess.user, room=sess.room, text=res, sessionID=sess.sessionID) - output.mycomment(chatwin, sess, res) + output.mycomment(chatwin, sess.user, res) + elif sess.mycmd[k][0] == 'comment': + if pair: + v = pair.pop(0) + s = sess.mycmd[k][1].replace('%s', v) + else: + s = sess.mycmd[k][1] + cli.write_message(type='comment', user=sess.user, room=sess.room, text=s, sessionID=sess.sessionID) + output.mycomment(chatwin, sess.user, s) + elif sess.mycmd[k][0] == 'emote': + if pair: + v = pair.pop(0) + s = sess.mycmd[k][1].replace('%s', v) + else: + s = sess.mycmd[k][1] + cli.write_message(type='emote', user=sess.user, room=sess.room, text=s, sessionID=sess.sessionID) + output.myemote(chatwin, sess.user, s) elif re.match(r'^\\.*?[^ ].*$', cmd): cli.write_message(type='comment', user=sess.user, room=sess.room, text=cmd[1:].strip(), sessionID=sess.sessionID) - output.mycomment(chatwin, sess, cmd[1:].strip()) + output.mycomment(chatwin, sess.user, cmd[1:].strip()) elif re.match(r'^/.*$', cmd): - output.error(chatwin, sess, "Unknown Command") + pass elif re.match(r'^ *?[^ ].*$', cmd): cli.write_message(type='comment', user=sess.user, room=sess.room, text=cmd.strip(), sessionID=sess.sessionID) - output.mycomment(chatwin, sess, cmd.strip()) + output.mycomment(chatwin, sess.user, cmd.strip()) + - diff -Naur curphoo-0.3.12/color curphoo-0.3.12.4.1/color --- curphoo-0.3.12/color 2003-09-25 13:31:45.000000000 -0400 +++ curphoo-0.3.12.4.1/color 1969-12-31 19:00:00.000000000 -0500 @@ -1,44 +0,0 @@ -awayoffnotice=WHITE -awayonnotice=WHITE -buddylist=WHITE -buddyoffnotice=GREEN -buddyonnotice=GREEN -colorlist=WHITE -commenttext=WHITE -commentuser=RED -defaultnotice=GREEN -emotebullet=RED -emotetext=WHITE -errortext=RED -help=WHITE -highcommenttext=WHITE -highcommentuser=RED -highoffnotice=RED -highonnotice=GREEN -hslist=WHITE -hulist=WHITE -ignorelist=RED -ignoreoffnotice=GREEN -ignoreonnotice=RED -joinnotice=GREEN -logendnotice=RED -loginnotice=GREEN -lognotice=RED -logoutnotice=GREEN -logstartnotice=GREEN -mailnotice=CYAN -mycommenttext=WHITE -mycommentuser=BLUE -myemotebullet=RED -myemotetext=WHITE -newbuddynotice=RED -openurl=WHITE -pmnotice=YELLOW -pmoffnotice=RED -pmonnotice=GREEN -shellcommand=WHITE -statusbar=BLUE -userenternotice=GREEN -userexitnotice=GREEN -userinfo=WHITE -userlist=WHITE diff -Naur curphoo-0.3.12/cpformat.py curphoo-0.3.12.4.1/cpformat.py --- curphoo-0.3.12/cpformat.py 2003-09-25 13:31:45.000000000 -0400 +++ curphoo-0.3.12.4.1/cpformat.py 2005-03-31 23:23:31.000000000 -0500 @@ -79,7 +79,7 @@ b.pop() return '\n'.join(b) -def do(text, sess = None): +def do(text): text = ESC_SEQ.sub('', text) text = text.replace('\x0d\x0a', ' ') text = text.replace('\x0d', '') @@ -90,8 +90,7 @@ text = SND_TAG.sub('', text) text = squeeze_lines(text) text = MULTI_NL.sub('\n', text) - if (sess != None and sess.rc['auto-lowercase'].upper() == 'Y'): - text = no_all_caps(text) + text = no_all_caps(text) text = no_nonprint(text) text = text.strip() return text diff -Naur curphoo-0.3.12/decodep.py curphoo-0.3.12.4.1/decodep.py --- curphoo-0.3.12/decodep.py 1969-12-31 19:00:00.000000000 -0500 +++ curphoo-0.3.12.4.1/decodep.py 2005-03-31 23:23:31.000000000 -0500 @@ -0,0 +1,118 @@ +# decodep.py +# Copyright (C) 2002 Alex Mercader +# +# This file is part of Curphoo. +# +# Curphoo is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Curphoo is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Curphoo; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# $Id: decodep.py,v 1.1 2002/05/01 08:39:22 hacker Exp $ +# +# $Log: decodep.py,v $ +# Revision 1.1 2002/05/01 08:39:22 hacker +# Initial revision +# +# +## + +import struct +from yahoodef import * +import cpformat +import string + +TFROM = '%s%s' % ( + ''.join([chr(x) for x in range(0x00, 0x20)]), + ''.join([chr(x) for x in range(0x7f, 0xff)]) ) +TTO = '#'*len(TFROM) +TTABLE = string.maketrans(TFROM, TTO) +tr = lambda s: s.translate(TTABLE) + +def do(packet): + packet_type = struct.unpack('!l', packet[8:12])[0] + error = struct.unpack('!h', packet[12:14])[0] + data = packet[HEADERLEN:] + val = data.split(DELIM) + if error: + if packet_type != LOGOUT: + return {'type': 'crap'} + elif packet_type == COMMENT: + return { + 'type': 'comment', + 'user': tr(val[1]), + 'text': cpformat.do(val[2]) + } + elif packet_type == EMOTE: + return { + 'type': 'emote', + 'user': tr(val[1]), + 'text': cpformat.do(val[2]) + } + elif packet_type == PM: + return { + 'type': 'pm', + 'user': tr(val[0]), + 'text': cpformat.do(val[2]) + } + elif packet_type == AWAY: + x = {} + x['type'] = 'away' + x['user'] = tr(val[0]) + try: + x['text'] = AWAYMESG.get(val[2], 'is away (%s)' % val[3]) + except IndexError: + x['text'] = 'is away' + return x + elif packet_type == ENTER: + # join type packets have urls in val[2] + if val[2] != ' ': + return { + 'type': 'join', + 'room': val[0], + 'topic': val[1], + 'users': [tr(e) for e in re.split(NICKDELIM, val[4]) if e] + } + else: + return { + 'type': 'enter', + 'room': val[0], + 'user': tr(re.split(NICKDELIM, val[4]).pop(0)) + } + elif packet_type == EXIT: + return { + 'type': 'exit', + 'room': val[0], + 'user': tr(val[1]) + } + elif packet_type == THOUGHT: + # This packet type might be deprecated. + return { + 'type': 'thought', + 'user': tr(val[1]), + 'text': cpformat.do(val[2]) + } + elif packet_type == LOGIN: + return { + 'type': 'login', + 'text': 'Login successful' + } + elif packet_type == LOGOUT: + return { + 'type': 'logout', + 'text': 'Logout successful' + } + else: + return { + 'type': 'unknown', + 'text': "unknown packet type %x" % packet_type + } diff -Naur curphoo-0.3.12/driver.py curphoo-0.3.12.4.1/driver.py --- curphoo-0.3.12/driver.py 2004-04-27 22:38:00.000000000 -0400 +++ curphoo-0.3.12.4.1/driver.py 2005-03-31 23:23:31.000000000 -0500 @@ -21,17 +21,16 @@ import sys import curses -import re -import signal -import time -import threading - import Yahoo import Entry import Session import output import cmdparser +import re +import signal +import time import cursex +import threading import YahooMD5 def go(stdscr, sess_arg): @@ -45,7 +44,7 @@ sess = sess_arg sess.time = time.strftime('%H:%M') - y = Yahoo.Client(sess) + y = Yahoo.Client() sess.server = 'cs1.msg.dcn.yahoo.com' y.connect(sess.server) y.write_message(type='challenge', user=sess.user) @@ -61,7 +60,7 @@ cursex.use_my_colours() chatwin = create_chat_window() - statusbar = create_status_bar(sess) + statusbar = create_status_bar() entry = Entry.Entry() sr_thread = threading.Thread(target=y.chat) try: @@ -83,13 +82,13 @@ break msgp = msg msg = y.read_message() - s = entry.edit(sess.users, sess.ybuddies, sess.logoutusers, sess.cmd, sess.mycmd.keys(), [sess.pm_recipient]) + s = entry.edit(sess.users, sess.ybuddies, sess.cmd, sess.mycmd.keys(), [sess.pm_recipient]) pminrow = get_scroll(pminrow) if pminrow == 9999: sr_thread.join(1.0) break if s: - if re.match('^/(e|exit|bye) *$', s, re.I): + if re.match('^/(exit|bye) *$', s, re.I): still_on = 0 y.disconnect() sr_thread.join(1.0) @@ -102,7 +101,6 @@ y.disconnect() def win_size(signum, frame): - # some code should be here pass def send_ping(a): @@ -111,12 +109,12 @@ if time_now != sess.time: sess.time = time_now output.status(statusbar, sess) -# ---------------CUT HERE--------------------- # +# ---------------CUT HERE--------------------- # #Commented until deepcopy works. See output.py -# if re.match('00:00',sess.time,re.I): -# output.logrotate(sess.log) -# ---------------CUT HERE--------------------- # - +# if re.match('00:00',sess.time,re.I): +# output.logrotate(sess.log) +# ---------------CUT HERE--------------------- # + # send ping every 10 mins if b - a > 600: y.write_message(type='ping', user=sess.user, sessionID=sess.sessionID) @@ -132,12 +130,12 @@ win.move((curses.LINES-2)*19, 0) return win -def create_status_bar(sess): - win = curses.newwin(1, curses.COLS, curses.LINES-2, 0) +def create_status_bar(): + win = curses.newwin(1, curses.COLS, curses.LINES-2,0) win.idlok(0) win.clearok(1) win.scrollok(0) - win.bkgdset(ord(' '), curses.color_pair(sess.color['statusbar']) | curses.A_REVERSE) + win.bkgdset(ord(' '), curses.color_pair(4)|curses.A_REVERSE) win.erase() win.noutrefresh() return win @@ -179,11 +177,6 @@ elif msg['type'] == 'online': sess.login_ok = 1 y.write_message(type='join', user=sess.user, room=sess.room, sessionID=sess.sessionID) - sess.userinfo[sess.user] = {} - sess.userinfo[sess.user]['starttime'] = sess.time0 - sess.userinfo[sess.user]['commentcount'] = 0 - sess.userinfo[sess.user]['lastcomment'] = '' - sess.userinfo[sess.user]['repeatcount'] = 0 elif msg['type'] == 'challenge': sess.md5 = msg['md5'] sess.sessionID = msg['sessionID'] @@ -191,37 +184,24 @@ sess.md5key2 = YahooMD5.getstr2(sess.user, sess.password, sess.md5) y.write_message(type='login', user=sess.user, key1=sess.md5key1, key2=sess.md5key2) elif msg['type'] == 'enter': - add_user(sess, msg['user']) + c = msg['user'] + if c not in sess.users: + sess.users.append(msg['user']) output.status(statusbar, sess) elif msg['type'] == 'join': - now = time.time() - # reset users list - sess.users = [] - for user in msg['users']: - add_user(sess, user, now) + sess.users = msg['users'] sess.room = msg['room'] output.status(statusbar, sess) elif msg['type'] == 'exit': - user = msg['user'] - if user in sess.users: - sess.users.remove(user) - # purge session userinfo - if sess.userinfo.has_key(user): - del sess.userinfo[user] - - sess.cache_logout_user(user) + c = msg['user'] + if c in sess.users: + sess.users.remove(msg['user']) output.status(statusbar, sess) elif msg['type'] == 'pm': if not sess.pms_are_ok: if not (msg['user'].lower() in sess.buddies or msg['user'].lower() in sess.ybuddies): msg['type'] = 'crap' if msg.has_key('text'): - # append the the curphoo user list based on the user having - # posted something (works around unreliable Yahoo! server-side - # room lists) - if msg.has_key('user'): - add_user(sess, msg['user']) - if not msg['text']: msg['type'] = 'crap' else: @@ -232,68 +212,20 @@ break except: pass - if msg.has_key('user'): - user = msg['user'] - if sess.ignores.has_key(user) or sess.mutes.has_key(user): - msg['type'] = 'crap' + u = msg['user'] + for e in sess.ignores: + try: + if re.match(r'%s' % e, u, re.I): + msg['type'] = 'crap' + break + except: + pass else: if msg.has_key('text') and msg['text']: - if not sess.userinfo.has_key(user): - sess.userinfo[user] = {} - sess.userinfo[user]['starttime'] = time.time() - sess.userinfo[user]['commentcount'] = 0 - sess.userinfo[user]['lastcomment'] = '' - sess.userinfo[user]['repeatcount'] = 0 - - if sess.userinfo[user].has_key('commentcount'): - sess.userinfo[user]['commentcount'] = sess.userinfo[user]['commentcount'] + 1 - else: - sess.userinfo[user]['commentcount'] = 1 - if sess.userinfo[user]['lastcomment'].strip() == msg['text'].strip(): - sess.userinfo[user]['repeatcount'] = sess.userinfo[user]['repeatcount'] + 1 - sess.userinfo[user]['lastcomment'] = msg['text'] x = re.search(r'(http://|ftp://|www)[^ ]+ ?', msg['text']) if x: sess.url = x.group() - - # a quick hack to prevent 'crap' from seaping into output - if msg['type'] != 'crap': - # autoignore(sess, msg) - output.message(chatwin, msg, sess.user, sess) - output.log(msg, sess.log) - -def add_user(sess, user, timestamp = None): - "Add user to session users list. Use current time unless time is specified explicitly" - if not timestamp: - timestamp = time.time() - if user not in sess.users: - sess.users.append(user) - sess.userinfo[user] = {} - sess.userinfo[user]['starttime'] = timestamp - sess.userinfo[user]['commentcount'] = 0 - sess.userinfo[user]['lastcomment'] = '' - sess.userinfo[user]['repeatcount'] = 0 - -def autoignore(sess, msg): - # filter crap - if msg['type'] == 'crap': - return None - # filter non pertinent message - if not (msg.has_key('user') and msg.has_key('text')): - return None - user = msg['user'] - text = msg['text'] - # code to ignore spambots - if sess.rc['ignore-spambot'] == 'Y': - autoignore_spambot(sess, msg, user, text) - -def autoignore_spambot(sess, msg, user, text): - if user in sess.excludes: - return - if int(sess.rc['ignore-spambot-length']) <= len(text) and int(sess.rc['ignore-spambot-seconds']) >= time.time() - sess.userinfo[user]['starttime'] and int(sess.rc['ignore-spambot-count']) >= sess.userinfo[user]['commentcount']: - if re.search(sess.rc['ignore-spambot-string'], text, re.I): - sess.ignores[user] = 1; - output.autoignore_notice(chatwin, sess, user, 'spambot') - if sess.rc['ignore-spambot-preignore'] == 'Y': - msg['type'] = 'crap' - return + + output.message(chatwin, msg, sess.user, sess) + output.log(msg, sess.log) + diff -Naur curphoo-0.3.12/gpl.txt curphoo-0.3.12.4.1/gpl.txt --- curphoo-0.3.12/gpl.txt 1969-12-31 19:00:00.000000000 -0500 +++ curphoo-0.3.12.4.1/gpl.txt 2005-03-31 23:23:31.000000000 -0500 @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff -Naur curphoo-0.3.12/ignoremsg.donkey curphoo-0.3.12.4.1/ignoremsg.donkey --- curphoo-0.3.12/ignoremsg.donkey 2003-09-25 13:31:45.000000000 -0400 +++ curphoo-0.3.12.4.1/ignoremsg.donkey 1969-12-31 19:00:00.000000000 -0500 @@ -1,20 +0,0 @@ -. -. /\ /\ -. ( \\ // ) -. \ \\ // / -. \_\\||||//_/ -. \/ _ _ \ -. \/|(O)(O)| -. \/ | | -. ___________________\/ \ / -. // // |____| -. // || / \ -. //| \| \ 0 0 / -. // \ ) V / \____/ -. // \ / ( / -. "" \ /_________| |_/ -. / /\ / | || -. / / / / \ || -. | | | | | || -. |_| |_| |_|| -. \_\ \_\ \_\\ (Feel Free To Kiss My Ass %s!!!!) diff -Naur curphoo-0.3.12/ignoremsg.iggygun curphoo-0.3.12.4.1/ignoremsg.iggygun --- curphoo-0.3.12/ignoremsg.iggygun 2003-09-25 13:31:45.000000000 -0400 +++ curphoo-0.3.12.4.1/ignoremsg.iggygun 1969-12-31 19:00:00.000000000 -0500 @@ -1,8 +0,0 @@ -(C) guardian_sentry - \\_!_____________ - <#|=====|________| *click* *click* *click* - / C|=====|---' - / |-|-|~ - / /---' - / / -|_____| ( Kiss my iggy gun %s!!!! ) diff -Naur curphoo-0.3.12/m9dec.py curphoo-0.3.12.4.1/m9dec.py --- curphoo-0.3.12/m9dec.py 2003-09-25 13:31:45.000000000 -0400 +++ curphoo-0.3.12.4.1/m9dec.py 2005-03-31 23:23:31.000000000 -0500 @@ -50,7 +50,7 @@ d[k] = m.pop(0) return d -def do(packet, sess = None): +def do(packet): packet_type = struct.unpack('!h', packet[10:12])[0] sessionID = struct.unpack('!l', packet[16:20])[0] #flag = struct.unpack('!l', packet[12:16])[0] @@ -120,18 +120,18 @@ if datadict['124'] == "1": return { "type": "comment", "user": datadict['109'], - "text": cpformat.do(datadict['117'], sess) + "text": cpformat.do(datadict['117']) } else: return { 'type': 'emote', "user": datadict['109'], - "text": cpformat.do(datadict['117'], sess) + "text": cpformat.do(datadict['117']) } elif packet_type == 0x06: return { "type": "pm", "user": datadict.has_key('4') and datadict['4'] or datadict.has_key('1') and datadict['1'] or "Parse Error (PM)", - "text": datadict.has_key('14') and cpformat.do(datadict['14'], sess) or "Parse Error (PM)" + "text": datadict.has_key('14') and cpformat.do(datadict['14']) or "Parse Error (PM)" } elif packet_type == 0x0b: return { diff -Naur curphoo-0.3.12/output.py curphoo-0.3.12.4.1/output.py --- curphoo-0.3.12/output.py 2004-01-23 11:51:40.000000000 -0500 +++ curphoo-0.3.12.4.1/output.py 2005-03-31 23:23:31.000000000 -0500 @@ -110,397 +110,120 @@ elif a > b: res = 1 return res -def list_highliststring(win, l, color, header=''): - win.addstr('%s (%s):' % (header, len(l)), curses.color_pair(color)) - take_nl(win) +def list_babelusers(win, ul, header=''): + list_user(win, ul, header) + +def list_users(win, l, header=''): + win.addstr('*** ', curses.color_pair(1)) + win.addstr('%s (%s): ' % (header, len(l))) l.sort(cmpfunc) - sl = [] + c = [] for e in l: - sl.append('[%s]' % e) - win.addstr(wordwrap(win, ' '.join(sl), 0), curses.color_pair(color)) + c.append('[%s]' % e) + take_nl(win) + win.addstr(wordwrap(win, ' '.join(c), 0)) take_nl(win) -def list_highlightusers(win, sess, ul, color, header=''): - show_list(win, sess, ul, color, header) - -def list_babelusers(win, sess, ul, color, header=''): - show_list(win, sess, ul, color, header) - -def list_buddies(win, sess, ul, color, header=''): - show_list(win, sess, ul, color, header) - -def list_ignoredusers(win, sess, ul, color, header=''): - show_list(win, sess, ul, color, header) - -def list_regex(win, sess, ul, color, header=''): - show_list(win, sess, ul, color, header) - -def list_excludeusers(win, sess, ul, color, header=''): - show_list(win, sess, ul, color, header) - -def show_list(win, sess, ul, color, header=''): - win.addstr('%s (%s):' % (header, len(ul)), curses.color_pair(color)|curses.A_BOLD) - take_nl(win) - ul.sort(cmpfunc) - cols = (curses.COLS - 1) / 20 - rows = len(ul) / cols - if len(ul) % cols > 0: - rows = rows + 1 - currentrow = 0 - while currentrow < rows: - currentcol = 0 - while currentcol < cols: - ulindex = (rows * currentcol) + currentrow - if ulindex > len(ul) - 1: - break - if len(ul[ulindex]) > 18: - u = ul[ulindex][0:16] + '..' - else: - u = ul[ulindex] - win.addstr('%-18s' % u, curses.color_pair(color)) - if currentcol + 1 < cols: - win.addstr(' ') - currentcol = currentcol + 1 - take_nl(win) - currentrow = currentrow + 1 - -def list_currentusers(win, sess, ulall, color, header=''): - ul = [] # for storing user list minus ignored users - for u in ulall: - if not u in sess.ignores.keys(): - ul.append(u) - win.addstr('%s (%s):' % (header, len(ul)), curses.color_pair(color)|curses.A_BOLD) - take_nl(win) - ul.sort(cmpfunc) - cols = (curses.COLS - 1) / 20 - rows = len(ul) / cols - if len(ul) % cols > 0: - rows = rows + 1 - currentrow = 0 - while currentrow < rows: - currentcol = 0 - while currentcol < cols: - ulindex = (rows * currentcol) + currentrow - if ulindex > len(ul) - 1: - break - if len(ul[ulindex]) > 18: - u = ul[ulindex][0:16] + '..' - else: - u = ul[ulindex] - if u in sess.high: - win.addstr('