From: octo Date: Thu, 7 Apr 2005 07:32:16 +0000 (+0000) Subject: Moved the rest to trunk/ X-Git-Tag: Release-0.8.0~30 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=6761942ff0fa8b17ca367bd2b2bfee11fdf80c6b;p=onis.git Moved the rest to trunk/ --- diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..b794520 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,240 @@ + onis - CHANGELOG +================== +http://verplant.org/onis/ + + 0.7.2 - Spanish translation + ============================= + - Javier Garcia Alarcon (Sorry, my term didn't like all the fancy spanish + characters :/) has contributed a spanish translation for onis. Thank you + very much :) + + + + 0.7.1 - Improved aging and new translation + ============================================ + - ``Aging'' now only occurs once a day, so you can generate hourly-stats + without losing data.. + - Christoffer Jonsson has sent in a swedish translation. Thank you very + much :) + - Fixes in the CSS files allow the MSIE to render the generated files + correctly. You have to resize the images to 50 by 50 pixels though.. If + you don't like that you'll have to edit the CSS files yourself.. + + + + 0.7.0 - Aging data and themes + =============================== + - A parser for EnergyMech logfiles has been contributed/added. Thanks to + Korbinian Rosenegger :) Unfortunately it doesn't quite work, yet.. + - When including images in the stats the images will now be displayed in + the Userdetails-stats, too. + - There is a new ``public_page'' option: When set to ``true'' (the + default setting) the page will eventually show up on onis' homepage. + - There is now support for simple themes. Basically, they are ordered + configs.. Also, the themes have been improved a bit.. + - Words, Nicks and Ident `age' now. This means, that a lot less diskspace + will be used to store persistent data, because useless old data will be + removed.. + - The nicks-Plugin is now RFC2812 compliant. + + + + 0.6.1 - Bugfixes + ================== + - A display bug with the ``Conversations'' plugin has been fixed. + - POD documentation for some modules has been improved/added. + - Bjørn Danielsen has contributed a norwegian translation. + Thanks a lot :) + - Handling of unidentified nicks has been improved. People who don't use + the users-configuration and run onis on small logs (daily logs or so) + may see a huge improvment here.. + + + + 0.6.0 - Detailed nick statistics + ================================== + - The new ``Userdetails''-plugin provides detailed per-user-statistics + for people that are into that kind of things (ie. me ;). + - The width of the bars of the ``Conversation''-plugin is calculated more + appropriately now. + - Typos in lang/german.lang have been fixed. + - Persistency files won't work with any other version than they were + created with. + + + + 0.5.1 - Some more cosmetics + ============================= + - Dircproxy parser has been fixed. The format seems to have changed. + - Error- and warning-messages have been changed to provide more + information about what's wrong and how it can be fixed. + + + + 0.5.0 - Stable, at last + ========================= + - The Conversations- and the Nicks-plugin both now ignore nicks that + didn't write at least 100 lines. This value will be configurable in a + later release. + - The persistency data is ignored now, if the user configuration changes. + This has caused some irritation in the past so I thought it would be + good to implement.. + - Output fixes.. (Thanks Bob :) + - A new theme, named ``liner'' after it's creator, has been added. + Thanks a lot :) + + + + 0.4.9 - Bugfixes and conversations + ==================================== + - Workaround for MSIE issues have been implemented. Isn't it weird that + such a widespread browser can;t even center a table the right way?! + - A bug html-tag generation code has been fixed. Now all there's left to + do is to use them ;) + - The ``Conversations'' plugin has been added. It displays the persons + with the most conversations. + - The user config has been integrated a lot better into the nick-tracing + code. + - A bug in the persistency code has been fixed. Thanks to Bob Ball for + reporting it :) + + + + 0.4.8 - Look ma, that's me on the internet ;) + =============================================== + - Option to add an image to each nick has been added. + - Option to ignore hosts/nicks has been added. + - The newest time is now saved per-file, so the order of the input files + doesn't matter anymore. + - Files are no longer identified by their name, their inode numbers are + used instead. This has not been tested unter M$ Windows! + - New default config is to sort the users by words, not lines. + - Fixed bug with the coloring-code (Thanks to Bob Ball for pointing this + out :) + + + + 0.4.7 - Colors and users + ========================== + - Added forgotten ident prefix `='. + - Recognition of mIRC-color-codes has been added. (Thanks to Bob Ball for + coding this :) + - A user-configuration has been added which aloows to set specific + information (like link, realname and image) for an user. + + + + 0.4.6 - Yet another nasty bug fixed + ===================================== + - A bug in the persistency code has been fixed: If the first line of a + logfile had the same timestamp as the last line parsed in the previous + run, the entire logfile would not be parsed. + - An alternate config file can be set with the ``--config'' command line + argument. + + + + 0.4.5 - Purge option and fixes + ================================ + - Option to automatically purge (truncate or delete) parsed logfiles has + been added. + - Input files will be sorted by mtime from now on. This addresses an + issue with weird sorted input.. + - The dancer-parser has had a problem with the month of december (which + has been taken care of ;) + - A potential deivision by zero in Html.pm has been fixed. + + + + 0.4.4 - Bugfix release + ======================== + - Forgotten config options have been added again. + - Fixes in the translation system. + + + + 0.4.3 - Multilingualism + ========================= + - A bug in the generated HTML code has been fixed. + - Support for translations and a german translation has been added. + - A parser for dancer-logs has been added (again). + + + + 0.4.2 - Bugfix release + ======================== + - An issue with perl 5.8.0 has been resolved: Time::Local tried to load + ``Config'' and got onis' module with the same name. + - A bug in the Eggdrop parser has been fixed: leave-events were not + parsed correctly. + - A parser for xchat has been added. + + + + 0.4.1 - Added missing features and more + ========================================= + - Internal restructure due to planned features. + - The main table can now be sorted by lines, words or characters written. + - Written lines, words and characters can be displayed at will. You can + even chose between number only, bar only and both. + - The overall-distribution of time spent chatting can be displayed. + - A plugin named ``Interesting Numbers'' has been added. It brings back + the information displayed by the ``Action'', ``Kicks'' and + ``Soliloquies'' plugins. + - URLs are now cut after 50 characters. + - The daily activity stats now use characters (instead of lines) for + greater precision. + + + + 0.4.0 - Complete rewrite (testing) + ==================================== + - Complete rewrite of huge parts of the program. + - Improvments for nick-tracing. + - Fixes for URL-Matching. + - Better config-parsing. + - Persistent data using ``Storable''. + - New, lighter output theme. + - Tons of other stuff I forgot to write down. + + + + 0.3.3 - Major Feature Enhancements + ==================================== + - Bug fixed: eggdrop and dircproxy logs wouldn't work with the kicks + plugin. Thanks to Daniel Peters. + - New plugin: nicks determines the nicks which were mentioned the most. + - New plugin: channel tries to determine the channel's name. This only + works with eggdrop, ircii, mirc and perlbot logs. + - New plugin: topics lists the last topics set in the channel. + - There are more configuration options for certain plugins. + - onis uses Getopt::Long for some settings such as channel name or output + file. Getopt::Long is part of the standard perl distribution. + - Quotes taken out of the logfiles are now escaped and URLs are linked. + There can be only one URL per line so far. + - Bug fixed: You can now include images from other webservers in the + config file. + - Bug fixed: The words plugin now ignores nicks. + + + + 0.3.0 - Major Feature Enhancements + ==================================== + - Merged Fester's "extensions" into the main branch as "plugins". These 9 + (!) new plugins give a lot of useless information about the channel + usage. + - Added parsing modules for dancer- and dircproxy-logfiles. Thanks to + Korbinian Rosenegger for writing the initial code. + - Modularized the entire structure of onis. + - The new comment-character is ';'. I though it would look better. + - Updated the perlbot parser so it is compatible with perlbot 1.4.2 + + + + 0.2.0 - advanced and tested pre0.1.9 + ====================================== + - user-ranking scaleable (check the config-file) + - improvment of the user-tracing. slows down when handling unknown nicks, + so make sure to use the plugin if running perlbot! + - source better documented + - changed syntax!! diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..bf50f20 --- /dev/null +++ b/COPYING @@ -0,0 +1,482 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 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. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, 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 library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, 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 companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, 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 library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete 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 distribute a copy of this License along with the +Library. + + 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 Library or any portion +of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +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 Library, 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 Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you 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. + + If distribution of 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 satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. 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. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library 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. + + 9. 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 Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +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. + + 11. 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 Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library 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 Library. + +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. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library 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. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library 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 Library +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 Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +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 + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. 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 LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. 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 library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; 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. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/FAQ b/FAQ new file mode 100644 index 0000000..2c27d48 --- /dev/null +++ b/FAQ @@ -0,0 +1,34 @@ + onis 0.7.1 - FAQ - 2004-10-30 +=============================== +http://verplant.org/onis/ + + +First off: Read the ``README'' file.. I didn't write it because I think +writing useless README-stuff is a fun activity. + + + 1. ``Some nicks simply don't appear in the statistics.'' +========================================================== +onis needs to know a nicks hostname and ident before it can collect data +for it. The most common way to get the ident/hostname pair is by joining +the channel. + + 2. ``onis tells me there is no data when I try to parse my logs!'' +==================================================================== +If you use eggdrop-logs: + Read the ``README'' file. Now! And make sure you don't miss + section `3.2'! +If you _don't_ use eggdrop-logs: + Did you set the ``logtype'' option correctly? It's in the ``config'' + file somewhere. If you have set this option correctly and keep getting + this error even with larger (> 1000 lines) logs, please send an email. + + 3. ``onis can't find "warnings.pm" or something..'' +===================================================== +For some reason especially FreeBSD users seem to use an outdated version +of perl (< 5.6.0). This old version does not provide the ``warnings'' +pragma, which onis uses. Your best bet is to upgrade your perl +distribution to at least 5.6.0. + +-- +octo (at verplant.org) diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..b29f122 --- /dev/null +++ b/MANIFEST @@ -0,0 +1,64 @@ +CHANGELOG +config +COPYING +lang/english.lang +lang/german.lang +lang/norwegian.lang +lang/spanish.lang +lang/swedish.lang +lib/Onis/Config.pm +lib/Onis/Data/Core.pm +lib/Onis/Data/Persistent.pm +lib/Onis/Html.pm +lib/Onis/Language.pm +lib/Onis/Parser/Dancer.pm +lib/Onis/Parser/Dircproxy.pm +lib/Onis/Parser/Eggdrop.pm +lib/Onis/Parser/Irssi.pm +lib/Onis/Parser/Mirc.pm +lib/Onis/Parser/Persistent.pm +lib/Onis/Parser/Xchat.pm +lib/Onis/Plugins/Bignumbers.pm +lib/Onis/Plugins/Conversations.pm +lib/Onis/Plugins/Core.pm +lib/Onis/Plugins/Interestingnumbers.pm +lib/Onis/Plugins/Nicks.pm +lib/Onis/Plugins/Topics.pm +lib/Onis/Plugins/Urls.pm +lib/Onis/Plugins/Userdetails.pm +lib/Onis/Plugins/Words.pm +lib/Onis/Users.pm +onis +README +reports/dark-theme/h-blue.png +reports/dark-theme/h-green.png +reports/dark-theme/h-red.png +reports/dark-theme/h-yellow.png +reports/dark-theme/style.css +reports/dark-theme/unknown.png +reports/dark-theme/v-blue.png +reports/dark-theme/v-green.png +reports/dark-theme/v-red.png +reports/dark-theme/v-yellow.png +reports/light-theme/blue.png +reports/light-theme/green.png +reports/light-theme/red.png +reports/light-theme/stripes.png +reports/light-theme/style.css +reports/light-theme/unknown.png +reports/light-theme/yellow.png +reports/liner-theme/h-blue.png +reports/liner-theme/h-gold.png +reports/liner-theme/h-green.png +reports/liner-theme/h-purple.png +reports/liner-theme/style.css +reports/liner-theme/unknown.png +reports/liner-theme/v-blue.png +reports/liner-theme/v-gold.png +reports/liner-theme/v-green.png +reports/liner-theme/v-purple.png +THANKS +themes/dark.theme +themes/light.theme +themes/liner.theme +users.conf diff --git a/README b/README new file mode 100644 index 0000000..71e43af --- /dev/null +++ b/README @@ -0,0 +1,188 @@ + onis 0.7.2 - README - 2005-01-21 +================================== +http://verplant.org/onis/ + + + Table of Contents +------------------- + 1. Brief description + 2. Setting it up + 3. Using it + 4. Language Files + 5. User configuration + + + 1. Brief description +====================== +``onis'' is a small perl-script that generates html-files out of your +irc-logs that contain some statistic information about what's going on on +that channel. For a sample look at the onis-homepage. + + + 2. Setting it up +================== +Just follow the example in 'config'. Please make sure to edit it! + + + 3. Using it +============= +Once set up right you can run onis with a command along these lines: + +octo@leeloo:~/onis-0.5.1 $ ./onis --output reports/channel.html my-logs/* + + 3.1 Timestamps +---------------- +Timestamps in the logfiles are an absolute requirement. If your logfiles +don't have timestamps you can't use onis with them. So enable them now ;) + + 3.2 Persistency +----------------- +Persistency is there for one reason: speed. It's simply faster to load +already-parsed data into memory than to re-parse it again. However, since +you start with nothing the first run will take as long as ever. + +Also, since this feature isn't easy for the program there are some issues +which might be confusing for the user. First, the program has to `know' if +the saved data is good and fresh and useable. It does so by comparing the +current configuration and the configuration saved with the old data. So if +you add or remove a plugin, change the ``min_word_length'' setting or edit +the user configuration your old-data will not be re-used and overwritten. + +The second issue effects only the ``Eggdrop'' parser: For persistency to +work the program has to determine the ABSOLUTE time of each line (i.e. the +date and time to at least the accuracy of one minute). The eggdrop version +I use (1.6.15) saves such a date/time entry at the end of each logfile. +That means that as long as the end of the file isn't written (i.e. the +whole day it covers) onis is unable to determine the date of that file. So +running onis every 15 minutes changes the random quotes picked but that's +it. It will not add the latest file unless the date is written which +happends at midnight. + + 3.3 Purge Logs +---------------- +Please be very carefull with this option. This is a new, unstable and +hardly tested feature! There may be bugs and they may delete your logfiles +(if you use this feature, that is). Don't yell at me if you accidentially +get rid of two years worth of logs.. It is possible to use ``purge_logs'' +without activating ``use_persistency''. That's your own damn fault. +You have been warned. + +There are two modes of operation: +- ``truncate'' deletes the content of a parsed logfile. The logfile itself + survives, so that clients that don't create new logs + automatically don't fall on their face. +- ``delete'' deletes the file itself. That might come in handy when a + client creates a new logfile every day. + +For both modes it is essential that onis can open the logfiles in +write-mode. It _could_ delete files without the write-bit set, but it +won't for obvious reasons. + + 3.4 Data aging +---------------- +This is a experimental feature introduced in 0.7.0: Since there is a lot +of absolutely useless data in the persistency files, the data gathered now +ages over the time. This may result in weird effects and I am not quite +sure it works as expected, so I'll have an eye on it and hopefully improve +it as needed ;) Anyways, here's what I do: + Idents have a line-counter. This counter is decremented one tenth per +run and afterwards rounded down. This means, that you have to write at +very least one line every day. If an ident writes 120 lines, it will be +deleted after 30 runs (one month, when run dayly) unless he/she writes +some lines in the meantime.. Obviously this might be a problem for persons +who run onis hourly.. + The nicks and words age a little differently: For everyitem there is an +``age'' and a ``ttl'' (time to life) setting. With every occurence the age +is reset to zero and ttl increased. At the end of each session ``ttl'' is +decreased by ``age'' and afterwards ``age'' is increased by one. If +``ttl'' becomes smaller than one the record is deleted. + In the future I will propably switch to keeping a timestamp and +calculating days, rather than counting runs, but I wanted to try this +approach first.. + + + 4. Language Files +=================== +onis 0.4.3 has a first experimental support for translations. I don't +speak any languages other than english and german so I'm hoping for +volunteers to send in more translations. The language-files are very very +simple, so my mom _could_ create them ;) I'll use a simple example: + +-- BEGIN: fooish.lang -- +# Language file for Fooish +"foobar": "translation"; # Should be fixed! +"Something": "Translation one", "Translation two"; +-- END: fooish.lang -- + +One can observe the following rules: +- Everything outside of double-quotes is ignored. Colons and semi-colons + should be added anyways. +- Everything after an ``hash'' (`#') (up to the end of the line) is a + comment and will be ignored. (Except when inside quotes, of course) +- The first string in a line is the original, all strings after that are + translations. (If there is more than one translation for a given phrase + a random one will be choosen at runtime) +- If no translation can bve found the original string will be used. +- The string provided here will be fed to a printf-call. DO NOT CHANGE any + of those `%s', `%u', `%.1f' etc. thingies, since they will be replaced + by whatever makes sense. + +If you have any problems with this, please let me know. + + + 5. User configuration +======================= +Starting with version 0.4.7 onis offers the ability to configure (or +hardcode) a user configuration. The user configuration is able to: +- map one or more hostmasks to a user, +- specify a realname for a user, +- add a link to the user's homepage and +- add an image to the user. +- ignore users + +The configuration file (default: ``users.conf'') has the following syntax: + +-- BEGIN: users.conf -- +# User configuration for #channel +this_username +{ + name: Realname; + host: *!real*@*.provider.com; + link: http://homepage.url/; + image: http://homepage.url/my_pic.png; +} +-- END: users.conf -- + +As you can see each record starts with a username followed by curly +brackets which contain the settings for this username. The settings are in +the form ``key: value;'' and valid keys (as of now) are ``name'', +``host'', ``link'' and ``image''. Each setting can come in any order and +as often as needed. If more than one `name', `link' or `image' is set one +will be chosen randomly at runtime. +- ``name'' Sets the realname for this nick. This name is set as ``title'' + for the call containing the username, which some browsers display as + tooltip. +- ``host'' sets the hostmask for this username. You can use `*' and `?' + which are interpreted as bash-like wildcards, i.e. `*' is a string of + any length (including empty) and `?' is any character (which must be + present). Oh, and the user-flags (like `~', `+', etc) are removed before + matching against this string, so you should not specify them here. +- ``link'' sets the users homepage. A link to this homepage will be + included in the statistics page. +- ``image'' specifies the URL of an image which will be displayed in later + versions. The URL is inserted as-is without ANY checking. This means + that it you enter a relative-URL it must be relative to the + output-file's location. + +There is one special user, ``ignore''. Every nick that matches the +enclosed ``host'' settings will be ignored. + +Everything after a hash-sign `#' up to the end of the line is considered a +comment and is removed before processing the config. But I think you've +guessed that ;) + +Keep in mind that changing the user configuration renders your persistency +file useless and it (the persistency file) will be deleted the next time +you run onis! (Read section 3.2!) +-- +octo (at verplant.org) diff --git a/THANKS b/THANKS new file mode 100644 index 0000000..9f61b25 --- /dev/null +++ b/THANKS @@ -0,0 +1,27 @@ +Korbinian Rosenegger + For the initial ``Dancer'', ``Dircproxy'' and ``Energymech'' parsers + +Tyler McHenry + For coding the first few extensions + +Daniel Peters + For pointing out bugs :) + +Jesper Hansen + For his continuous feedback, bugreports and feature requests ;) + +Bob Ball + For his feedback, feature requests and code contibutions (support for + mIRC color codes) :) + +``Liner'' (real name unknown ;) + For his theme :) + +Bjørn Danielsen + For the norwegian translation + +Christoffer Jonsson + For the swedish translation + +Javier Garc¡a + For the spanish translation diff --git a/TODO b/TODO new file mode 100644 index 0000000..8578a41 --- /dev/null +++ b/TODO @@ -0,0 +1,29 @@ +Minor bugfix: +[23:23] <@[charly]> nur doof wenn's 'nen nick namens "ich" gibt, mit dem reden dann alle am meisten ;) +[23:24] <@octo> [charly]: Hm, und der hat auch 100 Zeilen geschrieben? +[23:24] <@[charly]> mom +[23:29] <@[charly]> w?rd sagen 3 zeilen + +- have config option to set min-lines for plugins + +- the config reader could generate a warning if you +have a newline before a semicolon on a non-whitespace line? + +- remove the +elements from the bar where there is 0 activity - for example, the bar on the +number of lines... + +- Finally, the other thing I think would be useful would be to exagerate the +bottom bar on the main table; its too small to see when the user is on at the +moment... so perhaps take a maximum (looks like the max is 100px?) and +minimum width (perhaps 50px?) for the bottom bar and then have the bars for +everyone inbetween scaled into this range? + +- Another thing that would be useful is a config option for some HTML that is +put at the top of each stats page; so you can have links to other pages and +other things + +Next few steps: +- Maybe use locales for m/\w/ and the like +- Have dumps written in XML (maybe write the pisg guy?) +- Write Apache-Style config parser diff --git a/config b/config new file mode 100644 index 0000000..dec78a8 --- /dev/null +++ b/config @@ -0,0 +1,152 @@ +# onis 0.7.2 - config - 2005-01-21 +#================================== +# http://verplant.org/onis/ + +# This options tells onis what type of logfiles to expect. Valid values +# are ``Dircproxy'', ``Eggdrop'', ``Irssi'', ``mIRC'' and ``xchat''. +logtype: "Eggdrop"; + +# Thif option is available for scripts to set the input source once and +# for all. Since wildcards are not interpreted this is of little use for +# the averange user. +#input: "/path/to/my/file"; + +# Sets the output file. This has to be a file, not a directory. This is +# also mostly interesting for scripts. +#output: "/var/www/html/ircstats/cannel.html"; + +# Set this option to ``true'' to have onis overwrite files without +# promting. Default is to ask. +overwrite: "false"; + +# Sets the users-config file to use. By default reads ``users.conf''. +#users_config: "users.conf"; + +# Purge logs that have been parsed. Two modes of operation can be +# selected: ``truncate'' deletes the content of file but lets the file +# life on. This might be usefull for clients that don't create new logs +# automatically.. The other mode, ``delete'', well, deletes parsed files. +# This might come in handy when a client creates a new logfile for every +# day. +#purge_logs: "truncate"; + +# Set this to your (nick)name to see it appear on the stats page. Uses +# your username if you don't set anything here. +#user: "mynick"; + +# Explicitly set the channel's name here. For most logfiles this is not +# neccessary, but it is for some. ``Dircproxy'' to be specific. +#channel: "#ourchannel"; + +# Load these plugins. These are all available plugins as of now, but this +# is a development release. The missing one(s) will be back.. +plugin: "Conversations"; +plugin: "BigNumbers"; +plugin: "Words"; +plugin: "Nicks"; +plugin: "Urls"; +plugin: "Topics"; +plugin: "InterestingNumbers"; +plugin: "Userdetails"; + +# In order to recognize users who use dialin-accounts or have for some +# other reason changing hostnames it is neccessary to unsharp the host. +# This options says how much to unsharp it. Valid values are ``none'', +# ``Light'', ``Medium'' and ``Hard''. Most people will go best with +# ``Medium''.. +unsharp: "Medium"; + +# Sets the minimum length for a word. ``5'' is a good value to start +# with.. +min_word_length: 5; + +# Sort the main table by this field. Valid values are ``Lines'', ``Words'' +# and ``Chars''. Defaults to ``Lines''. +sort_by: "Words"; + +# Display the following fields in the given format. Valid formats are +# ``None'', ``Number'', ``Bar'' and ``Both''. +display_lines: "None"; +display_words: "Both"; +display_chars: "None"; + +# Sets wether or not user-images are displayed. Defaults to not display +# the images, since by default none are defined.. +#display_images: "false"; + +# Sets the default image which is displayed for users which don't have an +# image set. If not set no image will be displayed for those users. If a +# theme sets a default image and you want to un-set is, use "". +#default_image: "light-theme/unknown.png"; + +# If set to true a bar indicating the time when a user is most active is +# being printed in the main table. +display_times: "false"; + +# This options control which quotes are picked and how far back they can +# reach. A line is put into the quote-cache if it is a least ``quote_min'' +# and at most ``quote_max'' characters long. No more than +# ``quote_cache_size'' quotes are stored in the cache to have recent +# quotes if possible. +quote_min: 30; +quote_max: 80; +quote_cache_size: 10; + +# With the following option you can control how high and wide the bars +# are. Values are in pixels. Height applies to vertical, width to +# horizontal bars. +bar_height: 130; +bar_width: 100; + +# ``longlines'' defines how many nicks are in the big main table, +# ``shortlines'' sets the number of _lines_ in the smaller table below. +# Keep in mind that there are six nicks per line in the smaller table.. +longlines: 50; +shortlines: 10; + +# The ``plugin_max'' option is used by various plugins to determine how +# many records (lines, rows, etc) should be printed. +plugin_max: 10; + +# Matching the nicks contained in a line very slow. So we use a trick +# which is not as accurate but a lot faster. If you want to use the slow +# but better solution instead, set this option to ``good''. Otherwise +# leave at ``fast''. +nick_match_type: "fast"; + +# The ``last used words'' plugin will ignore words shorter than this +# value. This is not the same as ``min_word_length''! +ignore_words: 5; + +# This many lines from the same person without interuption will be counted +# as one soliloquy. +soliloquies_count: 5; + +# onis can create a ``persistency'' or ``history'' file. If such exists +# the already parsed part of a logfile can be skipped and unchanged +# logfiles are skipped entirely. However, for this to work you have to +# have ``Storable'' installed. If you have ``Storable'' installed but do +# not wish onis to write and/or use such a file you can disable it here. +#use_persistency: "true"; + +# Sets the file which onis will dump it's state into. +persistency_file: "persistency.data"; + +# If set to ``print'' prints out all color-codes. If set to ``ignore'' +# color-codes will not be printed. Default is to ignore colors.. +#color_codes: "print"; + +# Sets the document encoding. This must match your webserver's settings or +# you'll experience some very weird characters.. +# Defaults to ``iso-8859-1''. +#encoding: "iso-8859-1"; + +# Style settings. If no theme is given this might result in a lot of very +# weird errors, so better set one ;) +# Valid themes as of onis 0.7.0: light, liner, dark +theme: "themes/light.theme"; + +# Read translations from this file. +# One of: +# english.lang german.lang norwegian.lang spanish.lang swedish.lang +language_file: "lang/english.lang"; diff --git a/onis b/onis new file mode 100755 index 0000000..650d8a5 --- /dev/null +++ b/onis @@ -0,0 +1,333 @@ +#!/usr/bin/perl +########################################################################## +# onis 0.7.2 2005-01-21 # +#---=============--------------------------------------------------------# +# Language: Perl # +# Purpose: Generating statistics # +# Input: IRC-Logfiles # +# Output: One HTML file # +# Version: 0.7.2 (unstable) # +# License: GPL # +# Homepage: http://verplant.org/onis/ # +# Authors: Florian octo Forster # +# Contributions are listed in THANKS # +########################################################################## + +BEGIN +{ + if ($0 =~ m#^(.*)[/\\]#) { chdir ($1); } + + unshift (@INC, 'lib'); + + # 0x0010 Language (make not-translated lines red/yellow) + # 0x0020 Parser (dropped lines) + # 0x0040 Parser (time information) + # 0x0100 Data::Core (host unsharp) + # 0x0200 Data::Persistent + # 0x0400 Data::Core (dump incoming data to stderr) + # 0x0800 Data::Core (initializing) + # 0x1000 Onis::Users + $::DEBUG = 0x0000; +} + +use strict; +use warnings; + +use Onis::Config qw/get_config parse_argv read_config/; +use File::Basename qw/dirname/; +use Fcntl qw/:flock/; + +use vars qw/$VERSION/; + +$VERSION = '0.7.2'; + +our $FILEINFO; +our $PURGE_LOGS = 0; + +print STDERR $/, __FILE__, ': $Id: onis,v 1.18 2005/01/21 18:59:59 octo Exp $' if ($::DEBUG); + +parse_argv (@ARGV); +read_config (get_config ('config') ? get_config ('config') : 'config'); +read_config (scalar get_config ('theme')) if (get_config ('theme')); + +my $output = get_config ('output'); +if (!$output) +{ + $output = "reports/onis.html"; +} + +foreach ('Core', get_config ('plugin')) +{ + my $module = ucfirst (lc ($_)); + require "Onis/Plugins/$module.pm"; +} + +if (!get_config ('input')) +{ + print STDERR < [logfile logfile ..] + +Options: + --config Specify alternate config file + --output Defines the file to write the HTML to. + --overwrite Overwrites files without prompting. + --channel Defines the channel's name. + --logtype Defines the logfile's type. + See 'config' for a complete list. + --user Define's the generator's name. + +For a full list of all options please read the ``config'' file. +EOF + exit (1); +} + +if (-e $output) +{ + my $overwrite = 0; + if (get_config ('overwrite')) + { + my $tmp = lc (get_config ('overwrite')); + if ($tmp eq 'true' or $tmp eq 'yes' or $tmp eq 'on') + { + $overwrite = 1; + } + } + + if (!$overwrite) + { + print STDERR <; + exit (1) if ($answer =~ m/n/i); + } +} + +my $logtype = 'Eggdrop'; +if (get_config ('logtype')) +{ + $logtype = ucfirst (lc (get_config ('logtype'))); +} + +require "Onis/Parser/$logtype.pm"; +require Onis::Parser::Persistent; +require Onis::Data::Persistent; +import Onis::Parser qw/parse last_date/; +import Onis::Parser::Persistent qw#newfile#; +import Onis::Data::Persistent qw#init#; + +$FILEINFO = init ('$FILEINFO', 'hash'); + +if (get_config ('purge_logs')) +{ + my $temp = lc (get_config ('purge_logs')); + if (($temp eq 'truncate') or ($temp eq 'shorten')) + { + $PURGE_LOGS = 1; + } + elsif (($temp eq 'delete') or ($temp eq 'remove') + or ($temp eq 'del')) + { + $PURGE_LOGS = 2; + } +} + +for (get_config ('input')) +{ + my $file = $_; + my $logfile; + my $status = 4; + my $position = 0; + my $mtime; + my $size; + my $inode; + + ($inode, $size, $mtime) = (stat ($file))[1,7,9]; + + print STDERR $/, $/, __FILE__, " --- New File ``$file'' ---" if ($::DEBUG & 0x200); + + if (!defined ($mtime)) + { + print STDERR $/, __FILE__, ": Unable to stat file ``$file''"; + next; + } + else + { + print STDERR $/, __FILE__, ": ``$file'': " if ($::DEBUG & 0x200); + if (defined ($FILEINFO->{$inode}{'mtime'})) + { + if ($FILEINFO->{$inode}{'mtime'} == $mtime) + { + print STDERR "File did not change. Skipping." if ($::DEBUG & 0x200); + next; + } + elsif ($FILEINFO->{$inode}{'mtime'} < $mtime) + { + print STDERR "File changed. Reading it again." if ($::DEBUG & 0x200); + } + else + { + print STDERR "File ``$file'' is older than expected. There might be a problem!"; + } + } + else + { + print STDERR "File appears to be new. Reading it." if ($::DEBUG & 0x200); + } + $FILEINFO->{$inode}{'mtime'} = $mtime; + } + + # truncate + if ($PURGE_LOGS == 1) + { + unless (open ($logfile, '+< ' . $file)) + { + print STDERR $/, __FILE__, ": Unable to open file ``$file'': $!"; + next; + } + } + else + { + unless (open ($logfile, '< ' . $file)) + { + print STDERR $/, __FILE__, ": Unable to open file ``$file'': $!"; + next; + } + } + + if ($PURGE_LOGS) + { + unless (flock ($logfile, LOCK_EX)) + { + print STDERR $/, __FILE__, ": Unable to get an exclusive lock for file ``$file'': $!"; + close ($logfile); + next; + } + } + else + { + unless (flock ($logfile, LOCK_SH)) + { + print STDERR $/, __FILE__, ": Unable to get a shared lock for file ``$file'': $!"; + close ($logfile); + next; + } + } + + newfile ($FILEINFO->{$inode}); + while (<$logfile>) + { + s/\n|\r//g; + $status = parse ($_); + + # 0 == rewind file + # 1 == line parsed + # 2 == unable to parse + # 3 == line old + # 4 == don't have date + + if ($status == 0) + { + print STDERR $/, __FILE__, ": Rewinding file ``$file''" if ($::DEBUG & 0x200); + seek ($logfile, 0, 0); + $position = 0; + } + elsif (($status == 1) or ($status == 2) + or ($status == 3)) + { + $position = tell ($logfile); + } + elsif ($status == 4) + { + # void + } + else + { + print STDERR $/, __FILE__, ": Parser returned unknown status code: ``$status''"; + } + } + + if ($PURGE_LOGS and (($status == 1) + or ($status == 2) + or ($status == 3))) + { + if (($PURGE_LOGS > 1) + #and (($position + 1) >= $size) + ) + { + # delete file + print STDERR $/, __FILE__, ": Deleting empty file ``$file''" if ($::DEBUG & 0x200); + close ($logfile); + + if (-w $file) + { + unless (unlink ($file)) + { + print STDERR $/, __FILE__, ": Unable to delete empty file ``$file'': $!"; + } + delete ($FILEINFO->{$inode}); + } + else + { + print STDERR $/, __FILE__, ": Won't delete ``$file''. Set it to writeable first!"; + } + } + else + { + seek ($logfile, 0, 0); + if (truncate ($logfile, 0)) + { + print $logfile &last_date (); + print STDERR $/, __FILE__, ": Truncated ``$file''" if ($::DEBUG & 0x200); + } + else + { + print STDERR $/, __FILE__, ": Couldn't truncate file ``$file'': $!"; + } + + close ($logfile); + } + } + else + { + close ($logfile); + } +} + +require Onis::Data::Core; +require Onis::Html; +import Onis::Data::Core qw#print_output#; +import Onis::Html qw#open_file close_file#; + +if (open_file ($output)) +{ + print_output (); + close_file (); +} +else +{ + # Fail and make noise! ;) + print STDERR <