diff --git a/CREDITS b/CREDITS index a59cece..3275cb3 100644 --- a/CREDITS +++ b/CREDITS @@ -1,5 +1,5 @@ #!/bin/cat -# $Id: CREDITS,v 1.154 2011/01/18 01:52:25 gilles Exp gilles $ +# $Id: CREDITS,v 1.155 2011/01/23 23:39:54 gilles Exp gilles $ If you want to make a donation to the author, Gilles LAMIRAL, use any of the following ways: @@ -30,6 +30,14 @@ I thank very much all of these people. I thank also very much all people who bought imapsync from the homepage but I don't cite them here. +Timothy Jay Chambers +Contributed by giving the book +27.32 "Mathematics and Plausible Reasoning: Volume II Patterns of Plausible Inference" + +D.R. Crane +Contributed by giving the book +40.90 "Working Effectively with Legacy Code" + Daniel Melnechuk Contributed by giving the book 10.02 "The Design of Everyday Things" @@ -973,6 +981,9 @@ Eric Yung Total amount of book prices : c \ +27.32+\ +40.90+\ +\ 10.02+\ \ 17.95+\ @@ -1091,4 +1102,4 @@ c \ 31.20+\ 40.00 = -2710.81 +2779.03 diff --git a/ChangeLog b/ChangeLog index 925f1dc..3021928 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,17 +1,45 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.398 +head: 1.404 branch: locks: strict - gilles: 1.398 + gilles: 1.404 access list: symbolic names: keyword substitution: kv -total revisions: 398; selected revisions: 398 +total revisions: 404; selected revisions: 404 description: ---------------------------- -revision 1.398 locked by: gilles; +revision 1.404 locked by: gilles; +date: 2011/02/21 03:35:39; author: gilles; state: Exp; lines: +7 -7 +typo +---------------------------- +revision 1.403 +date: 2011/02/21 00:52:16; author: gilles; state: Exp; lines: +47 -7 +Added uid guessing with APPEND to improve --usecache for Exchange or Zarafa imap servers. +---------------------------- +revision 1.402 +date: 2011/01/25 05:17:05; author: gilles; state: Exp; lines: +47 -174 +Removed all the $imapX->IsUnconnected() since reconnect can be done. +Overrided append_file() for 2.2.9, copy from 3.25 +---------------------------- +revision 1.401 +date: 2011/01/25 02:22:37; author: gilles; state: Exp; lines: +195 -151 +Added --useuid to speed up or deal with problems using headers. +Added --notakebody to avoid getting first 2Ko body when got "no header" +Replaced --debug_cache by --debugcache +---------------------------- +revision 1.400 +date: 2011/01/22 04:46:04; author: gilles; state: Exp; lines: +94 -22 +Fixed cache (chose only the greatest uid with dupplicate 11_21+11_201 or 11_21+101_21) +Fixed cache, dealing with filenames containing \ characters. +---------------------------- +revision 1.399 +date: 2011/01/21 00:04:09; author: gilles; state: Exp; lines: +29 -21 +Added --debug_cache option to alow cache dfebugging only. +---------------------------- +revision 1.398 date: 2011/01/18 03:03:24; author: gilles; state: Exp; lines: +7 -6 Fix. Removed too much about buffersize. ---------------------------- diff --git a/FAQ b/FAQ index 32a8f69..8914cc1 100644 --- a/FAQ +++ b/FAQ @@ -1,5 +1,5 @@ #!/bin/cat -# $Id: FAQ,v 1.82 2011/01/15 06:32:12 gilles Exp gilles $ +# $Id: FAQ,v 1.83 2011/01/28 05:14:12 gilles Exp gilles $ +------------------+ | FAQ for imapsync | @@ -447,6 +447,24 @@ R. try to transfer the mails without SSL connection. SSL code outside (Written by Stefan Schmidt) +====================================================================== +Q. What are --subscribe and --subscribed for, and how can they be used? + +R. In the IMAP protocol each user can subscribe to one or more folders. + Then he can configure its email software to just see his subscribed + folders list. That's an IMAP feature. + + Knowing that, the imapsync help says: + + imapsync --help + ... + --subscribed : transfers subscribed folders. + --subscribe : subscribe to the folders transferred on the + host2 that are subscribed on host1. + --subscribe_all : subscribe to the folders transferred on the + host2 even if they are not subscribed on host1. + + ====================================================================== Q. I want to exclude a folder hierarchy like "public" diff --git a/Mail-IMAPClient-3.25/COPYRIGHT b/Mail-IMAPClient-3.25/COPYRIGHT deleted file mode 100644 index ebc36eb..0000000 --- a/Mail-IMAPClient-3.25/COPYRIGHT +++ /dev/null @@ -1,401 +0,0 @@ -COPYRIGHT - - Copyright 1999, 2000, 2001, 2002 , 2003 The Kernen Group, Inc. - All rights reserved. - -This program is free software; you can redistribute it and/or modify it -under the terms of either: - - -a) the "Artistic License" which comes with this Kit, or - -b) the GNU General Public License as published by the Free Software -Foundation; either version 1, 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 either the GNU -General Public License or the Artistic License for more details. All your -base are belong to us. - -============= - - The "Artistic License" - - Preamble - -The intent of this document is to state the conditions under which a -Package may be copied, such that the Copyright Holder maintains some -semblance of artistic control over the development of the package, -while giving the users of the package the right to use and distribute -the Package in a more-or-less customary fashion, plus the right to make -reasonable modifications. - -Definitions: - - "Package" refers to the collection of files distributed by the - Copyright Holder, and derivatives of that collection of files - created through textual modification. - - "Standard Version" refers to such a Package if it has not been - modified, or has been modified in accordance with the wishes - of the Copyright Holder as specified below. - - "Copyright Holder" is whoever is named in the copyright or - copyrights for the package. - - "You" is you, if you're thinking about copying or distributing - this Package. - - "Reasonable copying fee" is whatever you can justify on the - basis of media cost, duplication charges, time of people involved, - and so on. (You will not be required to justify it to the - Copyright Holder, but only to the computing community at large - as a market that must bear the fee.) - - "Freely Available" means that no fee is charged for the item - itself, though there may be fees involved in handling the item. - It also means that recipients of the item may redistribute it - under the same conditions they received it. - -1. You may make and give away verbatim copies of the source form of the -Standard Version of this Package without restriction, provided that you -duplicate all of the original copyright notices and associated disclaimers. - -2. You may apply bug fixes, portability fixes and other modifications -derived from the Public Domain or from the Copyright Holder. A Package -modified in such a way shall still be considered the Standard Version. - -3. You may otherwise modify your copy of this Package in any way, provided -that you insert a prominent notice in each changed file stating how and -when you changed that file, and provided that you do at least ONE of the -following: - - a) place your modifications in the Public Domain or otherwise make them - Freely Available, such as by posting said modifications to Usenet or - an equivalent medium, or placing the modifications on a major archive - site such as uunet.uu.net, or by allowing the Copyright Holder to include - your modifications in the Standard Version of the Package. - - b) use the modified Package only within your corporation or organization. - - c) rename any non-standard executables so the names do not conflict - with standard executables, which must also be provided, and provide - a separate manual page for each non-standard executable that clearly - documents how it differs from the Standard Version. - - d) make other distribution arrangements with the Copyright Holder. - -4. You may distribute the programs of this Package in object code or -executable form, provided that you do at least ONE of the following: - - a) distribute a Standard Version of the executables and library files, - together with instructions (in the manual page or equivalent) on where - to get the Standard Version. - - b) accompany the distribution with the machine-readable source of - the Package with your modifications. - - c) give non-standard executables non-standard names, and clearly - document the differences in manual pages (or equivalent), together - with instructions on where to get the Standard Version. - - d) make other distribution arrangements with the Copyright Holder. - -5. You may charge a reasonable copying fee for any distribution of this -Package. You may charge any fee you choose for support of this -Package. You may not charge a fee for this Package itself. However, -you may distribute this Package in aggregate with other (possibly -commercial) programs as part of a larger (possibly commercial) software -distribution provided that you do not advertise this Package as a -product of your own. You may embed this Package's interpreter within -an executable of yours (by linking); this shall be construed as a mere -form of aggregation, provided that the complete Standard Version of the -interpreter is so embedded. - -6. The scripts and library files supplied as input to or produced as -output from the programs of this Package do not automatically fall -under the copyright of this Package, but belong to whoever generated -them, and may be sold commercially, and may be aggregated with this -Package. If such scripts or library files are aggregated with this -Package via the so-called "undump" or "unexec" methods of producing a -binary executable image, then distribution of such an image shall -neither be construed as a distribution of this Package nor shall it -fall under the restrictions of Paragraphs 3 and 4, provided that you do -not represent such an executable image as a Standard Version of this -Package. - -7. C subroutines (or comparably compiled subroutines in other -languages) supplied by you and linked into this Package in order to -emulate subroutines and variables of the language defined by this -Package shall not be considered part of this Package, but are the -equivalent of input as in Paragraph 6, provided these subroutines do -not change the language in any way that would cause it to fail the -regression tests for the language. - -8. Aggregation of this Package with a commercial distribution is always -permitted provided that the use of this Package is embedded; that is, -when no overt attempt is made to make this Package's interfaces visible -to the end user of the commercial distribution. Such use shall not be -construed as a distribution of this Package. - -9. The name of the Copyright Holder may not be used to endorse or promote -products derived from this software without specific prior written permission. - -10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - - The End - -============= - - GNU GENERAL PUBLIC LICENSE - Version 1, February 1989 - - Copyright (C) 1989 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 license agreements of most software companies try to keep users -at the mercy of those companies. By contrast, our 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. The -General Public License applies to the Free Software Foundation's -software and to any other program whose authors commit to using it. -You can use it for your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Specifically, the General Public License is designed to make -sure that you have the freedom to give away or sell copies of free -software, 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 a 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 tell them 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. - - 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 Agreement 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 work containing the -Program or a portion of it, either verbatim or with modifications. Each -licensee is addressed as "you". - - 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 -General Public License and to the absence of any warranty; and give any -other recipients of the Program a copy of this General Public License -along with the Program. You may charge a fee for the physical act of -transferring a copy. - - 2. You may modify your copy or copies of the Program or any portion of -it, and copy and distribute such modifications under the terms of Paragraph -1 above, provided that you also do the following: - - a) cause the modified files to carry prominent notices stating that - you changed the files and the date of any change; and - - b) cause the whole of any work that you distribute or publish, that - in whole or in part contains the Program or any part thereof, either - with or without modifications, to be licensed at no charge to all - third parties under the terms of this General Public License (except - that you may choose to grant warranty protection to some or all - third parties, at your option). - - c) If the modified program normally reads commands interactively when - run, you must cause it, when started running for such interactive use - in the simplest and most usual 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 General - Public License. - - d) 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. - -Mere aggregation of another independent work with the Program (or its -derivative) on a volume of a storage or distribution medium does not bring -the other work under the scope of these terms. - - 3. You may copy and distribute the Program (or a portion or derivative of -it, under Paragraph 2) in object code or executable form under the terms of -Paragraphs 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 - Paragraphs 1 and 2 above; or, - - b) accompany it with a written offer, valid for at least three - years, to give any third party free (except for a nominal charge - for the cost of distribution) a complete machine-readable copy of the - corresponding source code, to be distributed under the terms of - Paragraphs 1 and 2 above; or, - - c) accompany it with the information you received as to where the - corresponding source code may be obtained. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form alone.) - -Source code for a work means the preferred form of the work for making -modifications to it. For an executable file, complete source code means -all the source code for all modules it contains; but, as a special -exception, it need not include source code for modules which are standard -libraries that accompany the operating system on which the executable -file runs, or for standard header files or definitions files that -accompany that operating system. - - 4. You may not copy, modify, sublicense, distribute or transfer the -Program except as expressly provided under this General Public License. -Any attempt otherwise to copy, modify, sublicense, distribute or transfer -the Program is void, and will automatically terminate your rights to use -the Program under this License. However, parties who have received -copies, or rights to use copies, from you under this General Public -License will not have their licenses terminated so long as such parties -remain in full compliance. - - 5. By copying, distributing or modifying 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. - - 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. - - 7. 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 the 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 -the license, you may choose any version ever published by the Free Software -Foundation. - - 8. 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 - - 9. 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. - - 10. 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 - - Appendix: 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 humanity, 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) 19yy - - 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 1, 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) 19xx 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 a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - program `Gnomovision' (a program to direct compilers to make passes - at assemblers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/Mail-IMAPClient-3.25/INSTALL b/Mail-IMAPClient-3.25/INSTALL deleted file mode 100644 index 1b74934..0000000 --- a/Mail-IMAPClient-3.25/INSTALL +++ /dev/null @@ -1,82 +0,0 @@ -Mail::IMAPClient Installation - -The Mail::IMAPClient is written entirely in Perl, so it should install -on any reasonably recent version of Perl. See the README file for a perl -one-liner that you can run to verify that your perl has what it takes -to run Mail::IMAPClient. - -The installation is standard: - - 0) cd to installation directory - 1) perl Makefile.PL (and reply to the prompts) - 2) make (optional) - 3) make test (optional) - 4) make install - -The 'make install' and 'make test' will both do step 2 ('make') if you -haven't done it already. Currently the test script is lame (although -not as lame as in the last release!) but I hope to incorporate more -thorough testing in a future version. You should at least try it and -let me know if your tests fail. - -Version 1.0 changed the installation script so that it reuses the -parameter file for the tests if it finds one. Installation can be run in -the background if the test.txt file exists. Touching it is good enough -to prevent prompts; having a correctly formatted version (as shown in -test_template.txt) is even better, as it will allow you to do a thorough -'make test'. Invalid data in test.txt (either from precreating it or from -responding inaccurately to prompts) will cause 'make test' to report 'not -ok' results but won't break anything important (like the IMAPClient.pm -file, or your car). - -If you have tests that fail it may be more illuminating to run the -tests by hand. IE: perl -I./blib/lib t/basic.t from the installation -dir will pinpoint the failing test. Better yet, supply an argument to -basic/t (any 'true' argument will do; I use '1') to turn on debugging, -which will be placed in your installation directory in 'imap1.debug' -and 'imap2.debug'. E-mail me the results. - -If you don't have a test.txt file in your installation directory then you -will have to answer at least one prompt. If you do have a test.txt file, -and you run 'make clean', then you won't have a test.txt file anymore, -so take precautions. - -If you do have a test.txt file and you don't run 'make clean' then -a text file will be sitting around containing logon credentials, so, -again, take precautions. (It's just a test account anyway, right?) - -If, when replying to the "perl Makefile.PL" prompts, you supply server, -id, and password credentials for an id that has a ridiculously huge number -of folders and subfolders then the 'make test' may run approximately -forever. Next time try an id with less stuff. - -For examples on using Mail::IMAPClient, check out the examples -subdirectory. If you have better examples, then why haven't you e-mailed -them to me? Also, I totally recommend that you have a copy of RFC2060 -handy when using this module, since the documentation for this module is -meant to compliment, not replace, RFC2060. In fact, I am so convinced that -you'll need the RFC that I've included a copy of it in the distribution, -under the "docs/" subdirectory. It's a smashing good read so have at -it. Other IMAP related rfcs are there as well. - -One of the examples in the examples/ subdirectory is called -cleanTest.pl. If you find your 'make test' has had trouble and left some -folders named "IMAPClient_*" in your test account, you can run this -example to clean up the account. But probably only after you've fixed -any problems encountered with 'make test'! - -This module uses Damian Conway's excellent Parse::RecDescent module -for some advanced features. If you don't have that module installed -then you can still install Mail::IMAPClient but you won't have the -full functionality. If you have Parse::RecDescent installed and then -upgrade it, you may find that some features in Mail::IMAPClient suddenly -start throwing compile-time errors. Just 'make clean' and then 'make', -'make test', and 'make install'. This happens because grammers compiled -under older releases of Parse::RecDescent are sometimes incompatible -with newer Parse::RecDescent runtime engines. This would never be a -problem if Mail::IMAPClient recompiled grammers at run time, but for -performance reasons it precompiles them at install time. TANSTAAFL. - -Now go and write IMAP clients. - -Dave Kernen diff --git a/Mail-IMAPClient-3.25/README b/Mail-IMAPClient-3.25/README deleted file mode 100644 index 45de3fb..0000000 --- a/Mail-IMAPClient-3.25/README +++ /dev/null @@ -1,111 +0,0 @@ - Mail::IMAPClient - -Copyright 1999-2003 The Kernen Group, Inc. -Copyright 2007 Mark Overmeer -All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of either: - - a) the "Artistic License" which comes with this Kit, or - - b) the GNU General Public License as published by the Free Software - Foundation; either version 1, 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 either -the GNU General Public License or the Artistic License for more details. - -DESCRIPTION - -This module provides perl routines that simplify a sockets connection -to and an IMAP conversation with an IMAP server. - -COMPATIBILITY - -[This paragraph has not been updated for many years] -This module was developed on Solaris 2.5.1 and 2.6 against Netscape IMAP -servers versions 3.6 and 4.1. However, since it is written in perl and -designed for flexibility, it should run on any OS with a TCP/IP stack and -a version of perl that includes the Socket and IO::Socket modules. It also -should be able to talk to any IMAP server, even those that have, um, -proprietary features (assuming that the programmer knows what those features -are). - -To date, I know that the test suite runs successfully with the following IMAP -servers: - --Netscape Messenging Server v4.x --Netscape Messenging Server v3.x --UW-IMAP (I think it was 4.5) --Cyrus IMAP4 v1.5.19 --Mirapoint Message Server Appliances (OS versions 1.6.1, 1.7.1, and 2.0.2) - -Version 2.0.3 has been tested with the mdaemon server with mixed -results. It seems that mdaemon does not comply strictly with RFC2060 and -so you may have problems using this module with mdaemon, especially with -folder names with embedded spaces or embedded double quotes. You may be -able to get some simple tasks to work but you won't be able to run the -test suite successfully. Use with caution. - -If your server requires the use of the AUTHENTICATE IMAP client command -(say, for strong authentication) then you can still use this module, -provided you can come up with the appropriate responses to any challenges -offered by your server. Mark Bush's Authen::NTLM module can assist with -this if you specifically are interested in NTLM authentication. - -REPORING BUGS - -See http://rt.cpan.org/Public/Dist/Display.html?Name=Mail-IMAPClient - -INSTALLATION - -Generally, gunzipping and untarring the source file, running 'perl -Makefile.PL' and 'make install' are all it takes to install this -module. And if that's too much work you can always use the CPAN module! - -OVERVIEW OF FUNCTIONALITY - -Mail::IMAPClient.pm provides methods to simplify the connection to and -the conversation between a perl script and an IMAP server. Virtually -all IMAP Client commands (as defined in rfc2060) are supported, either -through IMAPClient object methods or the 'default method', which is an -AUTOLOAD hack that assumes a default syntax for IMAP Client commands of: - - tagvalue COMMAND [Arg1 [Arg2 [... Arg3]]]" - -By remarkable coincidence, AUTOLOAD's default syntax mimics the -general syntax of IMAP Client commands. This means that if a script -tries to use any undefined method then that method will be interpreted -as an unimplemented IMAP command, and the default syntax will be used -to create the command string. I did this as a short cut to writing a -bunch of methods that were practically the same. There are inheritance -implications because of this approach but as far as I can tell this is -not a serious limitation. However, if you decide to write modules that -inherit from this class that require AUTOLOAD logic of their own then you -will have to take the Mail::IMAPClient's AUTOLOAD strategy into account. - -Where methods are defined, they usually exist to add functionality, -perhaps by massaging output or by supplying default arguments. An example -is the search method, which accepts the same arguments as the SEARCH -IMAP Client command (as documented in RFC2060) but which massages the -results so that the return value is an array of message sequence numbers -matching the search criteria, rather than a line of text listing the -sequence numbers. - -Some methods exists solely to add functionality, such as the folders -method, which invokes the list method but then massages the results to -produce an array containing all folder names. The message_count and -delete_messsage methods are similarly examples of methods that add -function to "raw" IMAP Client commands. - -Further information is provided in the module's documentation, which you are -encouraged to read and enjoy. - -Good Luck! - -Dave Kernen -The Kernen Group, Inc. -DJKERNEN@cpan.org - diff --git a/Mail-IMAPClient-3.25/TODO b/Mail-IMAPClient-3.25/TODO deleted file mode 100644 index 47ff39a..0000000 --- a/Mail-IMAPClient-3.25/TODO +++ /dev/null @@ -1,68 +0,0 @@ - -=== README - -Starting with release 2.99_01, I (Mark Overmeer) try to revive the -module. The original author David Kernen cannot be reached and didn't -release any fixes in four years. That is far too long. - -The code and installation procedure has been cleaned-up radically, - - and some minimal improvements in the code are made to -fix things people reported. - -=== wishlist: - -- A start was made in cleanup of the code in Mail/IMAPClient.pm - The file Mail/IMAPClient-cleanup shows the progress (30%) - But I lack the time (a weeks work at least) to complete this - task. There is a lot of code replication to be stripped. - If anyone buys me time, I will complete that task. - -=== wishlist from the original author: - -The following is a list of some items that I hope to include in a future -release: - -- Support for threaded perl programs (still pending as of version 2.2.0.). - -- Support for imaps (Imap via SSL). I don't have any way to test this - right now but if you get this to work or know someone who has I'd be - really interested in hearing from you. - -- Support for more authentication mechanisms. Currently plain - authentication and cram-md5 authentication are supported. I have - DIGEST-MD5 working at the AUTH qop, but haven't incorporated it into - a released version because I'm still trying to get at least the - integrity qop working, and maybe even privacy, but considering how - much trouble I'm having with just the integrity level I wouldn't - hold my breath if I were you ;-). - -- Currently a number of IMAP Client commands are implemented using the - 'default method', which is an AUTOLOAD hack. I'd like to reduce that - if possible to a bare minimum. (Some are still pending as of version 2.2.7.) - -- I'd like to see this module certified for more OS's and more IMAP servers. - This is (hopefully) just a matter of testing; the code should already - be compatible with the IMAP servers that are out there and with any OS - that allows the IO::Socket module to work. ** A number of platforms - have been added to the list of tested platforms since this was first - written. Please contact DJKernen@cpan.org if you have any to add. - -- Support for newer/older/other versions of IMAP. Currently only RFC2060 is - explicitly supported, although thanks to the 'default method' - (implemented via an AUTOLOAD hack) virtually any IMAP command is - supported, even proprietary commands, X- extensions, and so forth. But - not necessarily other authentication mechanisms... :-( (NOTE: the - AUTHENTICATE method partially addresses this issue.) - -- Support for piping output from (some?) imap commands directly to a - thingy of some sort (perhaps a coderef, a filehandle, or both). - -- Your thingy here!!! Send me your request, and I'll do it in the order of - ($popularity/$difficulty ). - -- Support for perl version 6. This will probably involve a rewrite that - will make portions of the Mail::IMAPClient module look more like the - Mail::IMAPClient::BodyStructure module. (Perl 6 will have built-in - support for semantics that look remarkably like Damian Conway's - Parse::RecDescent module, which will solve a lot of problems for me.) diff --git a/Mail-IMAPClient-3.25/lib/Mail/IMAPClient/BodyStructure/Parse.pm b/Mail-IMAPClient-3.25/lib/Mail/IMAPClient/BodyStructure/Parse.pm deleted file mode 100644 index c710d9b..0000000 --- a/Mail-IMAPClient-3.25/lib/Mail/IMAPClient/BodyStructure/Parse.pm +++ /dev/null @@ -1,16425 +0,0 @@ -package Mail::IMAPClient::BodyStructure::Parse; -use Parse::RecDescent; - -{ my $ERRORS; - - -package Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse; -use strict; -use vars qw($skip $AUTOLOAD ); -$skip = '\s*'; - - my $mibs = "Mail::IMAPClient::BodyStructure"; - my $subpartCount = 0; - my $partCount = 0; - - sub take_optional_items($$@) - { my ($r, $items) = (shift, shift); - foreach (@_) - { my $opt = $_ .'(?)'; - exists $items->{$opt} or next; - $r->{$_} = UNIVERSAL::isa($items->{$opt}, 'ARRAY') - ? $items->{$opt}[0] : $items->{$opt}; - } - } - - sub merge_hash($$) - { my $to = shift; - my $from = shift or return; - while( my($k,$v) = each %$from) { $to->{$k} = $v } - } -; - - -{ -local $SIG{__WARN__} = sub {0}; -# PRETEND TO BE IN Parse::RecDescent NAMESPACE -*Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::AUTOLOAD = sub -{ - no strict 'refs'; - $AUTOLOAD =~ s/^Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse/Parse::RecDescent/; - goto &{$AUTOLOAD}; -} -} - -push @Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::ISA, 'Parse::RecDescent'; -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyparms -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"bodyparms"}; - - Parse::RecDescent::_trace(q{Trying rule: [bodyparms]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyparms}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyparms}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{bodyparms}); - %item = (__RULE__ => q{bodyparms}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{bodyparms}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodyparms}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodyparms}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodyparms}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [KVPAIRS]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyparms}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{bodyparms}); - %item = (__RULE__ => q{bodyparms}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [KVPAIRS]}, - Parse::RecDescent::_tracefirst($text), - q{bodyparms}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::KVPAIRS($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodyparms}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [KVPAIRS]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodyparms}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{KVPAIRS}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [KVPAIRS]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodyparms}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyparms}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{bodyparms}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{bodyparms}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{bodyparms}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::date -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"date"}; - - Parse::RecDescent::_trace(q{Trying rule: [date]}, - Parse::RecDescent::_tracefirst($_[1]), - q{date}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{date}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{date}); - %item = (__RULE__ => q{date}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{date}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{date}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{date}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{date}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{date}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{date}); - %item = (__RULE__ => q{date}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{date}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{date}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{date}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{date}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{date}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{date}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{date}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{date}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodysubtype -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"bodysubtype"}; - - Parse::RecDescent::_trace(q{Trying rule: [bodysubtype]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [PLAIN]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{bodysubtype}); - %item = (__RULE__ => q{bodysubtype}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [PLAIN]}, - Parse::RecDescent::_tracefirst($text), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::PLAIN($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [PLAIN]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{PLAIN}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [PLAIN]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [HTML]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{bodysubtype}); - %item = (__RULE__ => q{bodysubtype}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [HTML]}, - Parse::RecDescent::_tracefirst($text), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::HTML($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [HTML]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{HTML}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [HTML]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{bodysubtype}); - %item = (__RULE__ => q{bodysubtype}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[3]; - $text = $_[1]; - my $_savetext; - @item = (q{bodysubtype}); - %item = (__RULE__ => q{bodysubtype}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{bodysubtype}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{bodysubtype}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{bodysubtype}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::hostname -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"hostname"}; - - Parse::RecDescent::_trace(q{Trying rule: [hostname]}, - Parse::RecDescent::_tracefirst($_[1]), - q{hostname}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{hostname}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{hostname}); - %item = (__RULE__ => q{hostname}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{hostname}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{hostname}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{hostname}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{hostname}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{hostname}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{hostname}); - %item = (__RULE__ => q{hostname}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{hostname}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{hostname}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{hostname}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{hostname}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{hostname}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{hostname}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{hostname}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{hostname}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::basicfields -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"basicfields"}; - - Parse::RecDescent::_trace(q{Trying rule: [basicfields]}, - Parse::RecDescent::_tracefirst($_[1]), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [bodysubtype bodyparms bodyid bodydesc bodyenc bodysize]}, - Parse::RecDescent::_tracefirst($_[1]), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{basicfields}); - %item = (__RULE__ => q{basicfields}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [bodysubtype]}, - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodysubtype($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [bodysubtype]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodysubtype}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyparms]}, - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodyparms})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyparms, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyparms]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodyparms(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyid]}, - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodyid})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyid, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyid]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodyid(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodydesc]}, - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodydesc})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodydesc, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodydesc]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodydesc(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyenc]}, - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodyenc})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyenc, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyenc]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodyenc(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodysize]}, - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodysize})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodysize, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodysize]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodysize(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = { bodysubtype => $item{bodysubtype} }; - take_optional_items($return, \%item, - qw/bodyparms bodyid bodydesc bodyenc bodysize/); - 1; - }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [bodysubtype bodyparms bodyid bodydesc bodyenc bodysize]<<}, - Parse::RecDescent::_tracefirst($text), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{basicfields}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{basicfields}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{basicfields}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::personalname -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"personalname"}; - - Parse::RecDescent::_trace(q{Trying rule: [personalname]}, - Parse::RecDescent::_tracefirst($_[1]), - q{personalname}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{personalname}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{personalname}); - %item = (__RULE__ => q{personalname}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{personalname}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{personalname}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{personalname}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{personalname}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{personalname}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{personalname}); - %item = (__RULE__ => q{personalname}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{personalname}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{personalname}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{personalname}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{personalname}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{personalname}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{personalname}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{personalname}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{personalname}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::key -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"key"}; - - Parse::RecDescent::_trace(q{Trying rule: [key]}, - Parse::RecDescent::_tracefirst($_[1]), - q{key}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{key}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{key}); - %item = (__RULE__ => q{key}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{key}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{key}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{key}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{key}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{key}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{key}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{key}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{key}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::cc -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"cc"}; - - Parse::RecDescent::_trace(q{Trying rule: [cc]}, - Parse::RecDescent::_tracefirst($_[1]), - q{cc}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [ADDRESSES]}, - Parse::RecDescent::_tracefirst($_[1]), - q{cc}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{cc}); - %item = (__RULE__ => q{cc}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [ADDRESSES]}, - Parse::RecDescent::_tracefirst($text), - q{cc}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::ADDRESSES($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{cc}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [ADDRESSES]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{cc}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{ADDRESSES}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [ADDRESSES]<<}, - Parse::RecDescent::_tracefirst($text), - q{cc}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{cc}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{cc}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{cc}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{cc}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyMD5 -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"bodyMD5"}; - - Parse::RecDescent::_trace(q{Trying rule: [bodyMD5]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyMD5}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyMD5}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{bodyMD5}); - %item = (__RULE__ => q{bodyMD5}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{bodyMD5}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodyMD5}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodyMD5}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodyMD5}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyMD5}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{bodyMD5}); - %item = (__RULE__ => q{bodyMD5}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{bodyMD5}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodyMD5}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodyMD5}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodyMD5}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyMD5}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{bodyMD5}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{bodyMD5}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{bodyMD5}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::envelope -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"envelope"}; - - Parse::RecDescent::_trace(q{Trying rule: [envelope]}, - Parse::RecDescent::_tracefirst($_[1]), - q{envelope}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/.*?\\(.*?ENVELOPE/ envelopestruct /.*\\)/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{envelope}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{envelope}); - %item = (__RULE__ => q{envelope}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/.*?\\(.*?ENVELOPE/]}, Parse::RecDescent::_tracefirst($text), - q{envelope}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:.*?\(.*?ENVELOPE)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [envelopestruct]}, - Parse::RecDescent::_tracefirst($text), - q{envelope}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{envelopestruct})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::envelopestruct($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{envelope}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [envelopestruct]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{envelope}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{envelopestruct}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/.*\\)/]}, Parse::RecDescent::_tracefirst($text), - q{envelope}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/.*\\)/})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:.*\))//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{envelope}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = $item{envelopestruct} }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/.*?\\(.*?ENVELOPE/ envelopestruct /.*\\)/]<<}, - Parse::RecDescent::_tracefirst($text), - q{envelope}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{envelope}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{envelope}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{envelope}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{envelope}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::MESSAGE -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"MESSAGE"}; - - Parse::RecDescent::_trace(q{Trying rule: [MESSAGE]}, - Parse::RecDescent::_tracefirst($_[1]), - q{MESSAGE}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/^"MESSAGE"|^MESSAGE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{MESSAGE}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{MESSAGE}); - %item = (__RULE__ => q{MESSAGE}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/^"MESSAGE"|^MESSAGE/i]}, Parse::RecDescent::_tracefirst($text), - q{MESSAGE}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:^"MESSAGE"|^MESSAGE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{MESSAGE}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = "MESSAGE"}; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/^"MESSAGE"|^MESSAGE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{MESSAGE}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{MESSAGE}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{MESSAGE}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{MESSAGE}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{MESSAGE}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::DOUBLE_QUOTED_STRING -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"DOUBLE_QUOTED_STRING"}; - - Parse::RecDescent::_trace(q{Trying rule: [DOUBLE_QUOTED_STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{DOUBLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: ['"' /(?:\\\\"|[^"])*/ '"']}, - Parse::RecDescent::_tracefirst($_[1]), - q{DOUBLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{DOUBLE_QUOTED_STRING}); - %item = (__RULE__ => q{DOUBLE_QUOTED_STRING}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: ['"']}, - Parse::RecDescent::_tracefirst($text), - q{DOUBLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\"//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: [/(?:\\\\"|[^"])*/]}, Parse::RecDescent::_tracefirst($text), - q{DOUBLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/(?:\\\\"|[^"])*/})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:(?:\\"|[^"])*)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: ['"']}, - Parse::RecDescent::_tracefirst($text), - q{DOUBLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'"'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\"//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{DOUBLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = $item{__PATTERN1__} }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: ['"' /(?:\\\\"|[^"])*/ '"']<<}, - Parse::RecDescent::_tracefirst($text), - q{DOUBLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{DOUBLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{DOUBLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{DOUBLE_QUOTED_STRING}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{DOUBLE_QUOTED_STRING}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::subject -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"subject"}; - - Parse::RecDescent::_trace(q{Trying rule: [subject]}, - Parse::RecDescent::_tracefirst($_[1]), - q{subject}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{subject}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{subject}); - %item = (__RULE__ => q{subject}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{subject}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{subject}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{subject}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{subject}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{subject}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{subject}); - %item = (__RULE__ => q{subject}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{subject}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{subject}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{subject}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{subject}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{subject}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{subject}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{subject}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{subject}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::value -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"value"}; - - Parse::RecDescent::_trace(q{Trying rule: [value]}, - Parse::RecDescent::_tracefirst($_[1]), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{value}); - %item = (__RULE__ => q{value}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NUMBER]}, - Parse::RecDescent::_tracefirst($_[1]), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{value}); - %item = (__RULE__ => q{value}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NUMBER]}, - Parse::RecDescent::_tracefirst($text), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NUMBER($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NUMBER]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NUMBER}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NUMBER]<<}, - Parse::RecDescent::_tracefirst($text), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{value}); - %item = (__RULE__ => q{value}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [KVPAIRS]}, - Parse::RecDescent::_tracefirst($_[1]), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[3]; - $text = $_[1]; - my $_savetext; - @item = (q{value}); - %item = (__RULE__ => q{value}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [KVPAIRS]}, - Parse::RecDescent::_tracefirst($text), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::KVPAIRS($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [KVPAIRS]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{KVPAIRS}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [KVPAIRS]<<}, - Parse::RecDescent::_tracefirst($text), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{value}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{value}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{value}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{value}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::inreplyto -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"inreplyto"}; - - Parse::RecDescent::_trace(q{Trying rule: [inreplyto]}, - Parse::RecDescent::_tracefirst($_[1]), - q{inreplyto}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{inreplyto}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{inreplyto}); - %item = (__RULE__ => q{inreplyto}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{inreplyto}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{inreplyto}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{inreplyto}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{inreplyto}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{inreplyto}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{inreplyto}); - %item = (__RULE__ => q{inreplyto}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{inreplyto}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{inreplyto}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{inreplyto}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{inreplyto}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{inreplyto}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{inreplyto}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{inreplyto}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{inreplyto}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::messageid -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"messageid"}; - - Parse::RecDescent::_trace(q{Trying rule: [messageid]}, - Parse::RecDescent::_tracefirst($_[1]), - q{messageid}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{messageid}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{messageid}); - %item = (__RULE__ => q{messageid}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{messageid}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{messageid}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{messageid}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{messageid}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{messageid}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{messageid}); - %item = (__RULE__ => q{messageid}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{messageid}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{messageid}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{messageid}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{messageid}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{messageid}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{messageid}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{messageid}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{messageid}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::sender -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"sender"}; - - Parse::RecDescent::_trace(q{Trying rule: [sender]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sender}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [ADDRESSES]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sender}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{sender}); - %item = (__RULE__ => q{sender}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [ADDRESSES]}, - Parse::RecDescent::_tracefirst($text), - q{sender}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::ADDRESSES($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sender}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [ADDRESSES]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{sender}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{ADDRESSES}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [ADDRESSES]<<}, - Parse::RecDescent::_tracefirst($text), - q{sender}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{sender}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{sender}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{sender}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{sender}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::multipart -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"multipart"}; - - Parse::RecDescent::_trace(q{Trying rule: [multipart]}, - Parse::RecDescent::_tracefirst($_[1]), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [subpart bodysubtype bodyparms bodydisp bodylang bodyloc bodyextra ]}, - Parse::RecDescent::_tracefirst($_[1]), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{multipart}); - %item = (__RULE__ => q{multipart}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [subpart]}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::subpart, 1, 100000000, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [subpart]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{subpart(s)}} = $_tok; - push @item, $_tok; - - - - - - Parse::RecDescent::_trace(q{Trying directive: []}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $_tok = do { $commit = 1 }; - if (defined($_tok)) - { - Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - } - else - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - } - - last unless defined $_tok; - push @item, $item{__DIRECTIVE1__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying subrule: [bodysubtype]}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{bodysubtype})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodysubtype($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [bodysubtype]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodysubtype}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyparms]}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodyparms})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyparms, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyparms]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodyparms(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodydisp]}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodydisp})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodydisp, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodydisp]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodydisp(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodylang]}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodylang})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodylang, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodylang]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodylang(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyloc]}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodyloc})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyloc, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyloc]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodyloc(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyextra]}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodyextra})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyextra, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyextra]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodyextra(?)}} = $_tok; - push @item, $_tok; - - - - - - Parse::RecDescent::_trace(q{Trying directive: []}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $_tok = do { push @{$thisparser->{deferred}}, sub { $subpartCount = 0 }; }; - if (defined($_tok)) - { - Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - } - else - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - } - - last unless defined $_tok; - push @item, $item{__DIRECTIVE2__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = - { bodysubtype => $item{bodysubtype} - , bodytype => 'MULTIPART' - , bodystructure => $item{'subpart(s)'} - }; - take_optional_items($return, \%item - , qw/bodyparms bodydisp bodylang bodyloc bodyextra/); - 1; - }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [subpart bodysubtype bodyparms bodydisp bodylang bodyloc bodyextra ]<<}, - Parse::RecDescent::_tracefirst($text), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{multipart}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{multipart}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{multipart}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyenc -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"bodyenc"}; - - Parse::RecDescent::_trace(q{Trying rule: [bodyenc]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{bodyenc}); - %item = (__RULE__ => q{bodyenc}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{bodyenc}); - %item = (__RULE__ => q{bodyenc}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [KVPAIRS]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{bodyenc}); - %item = (__RULE__ => q{bodyenc}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [KVPAIRS]}, - Parse::RecDescent::_tracefirst($text), - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::KVPAIRS($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [KVPAIRS]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{KVPAIRS}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [KVPAIRS]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{bodyenc}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{bodyenc}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{bodyenc}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodydesc -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"bodydesc"}; - - Parse::RecDescent::_trace(q{Trying rule: [bodydesc]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodydesc}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/[()]/ NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodydesc}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{bodydesc}); - %item = (__RULE__ => q{bodydesc}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/[()]/]}, Parse::RecDescent::_tracefirst($text), - q{bodydesc}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - $_savetext = $text; - - if ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:[()])//) - { - $text = $_savetext; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - $text = $_savetext; - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{bodydesc}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{NIL})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodydesc}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodydesc}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/[()]/ NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodydesc}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodydesc}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{bodydesc}); - %item = (__RULE__ => q{bodydesc}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{bodydesc}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodydesc}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodydesc}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodydesc}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodydesc}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{bodydesc}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{bodydesc}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{bodydesc}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::start -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"start"}; - - Parse::RecDescent::_trace(q{Trying rule: [start]}, - Parse::RecDescent::_tracefirst($_[1]), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/.*?\\(.*?BODYSTRUCTURE \\(/i part /\\).*\\)\\r?\\n?/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{start}); - %item = (__RULE__ => q{start}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/.*?\\(.*?BODYSTRUCTURE \\(/i]}, Parse::RecDescent::_tracefirst($text), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:.*?\(.*?BODYSTRUCTURE \()//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [part]}, - Parse::RecDescent::_tracefirst($text), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{part})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::part, 1, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [part]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{part(1)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying terminal: [/\\).*\\)\\r?\\n?/]}, Parse::RecDescent::_tracefirst($text), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/\\).*\\)\\r?\\n?/})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:\).*\)\r?\n?)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = $item{'part(1)'}[0] }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/.*?\\(.*?BODYSTRUCTURE \\(/i part /\\).*\\)\\r?\\n?/]<<}, - Parse::RecDescent::_tracefirst($text), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{start}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{start}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{start}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::RFC822 -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"RFC822"}; - - Parse::RecDescent::_trace(q{Trying rule: [RFC822]}, - Parse::RecDescent::_tracefirst($_[1]), - q{RFC822}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/^"RFC822"|^RFC822/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{RFC822}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{RFC822}); - %item = (__RULE__ => q{RFC822}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/^"RFC822"|^RFC822/i]}, Parse::RecDescent::_tracefirst($text), - q{RFC822}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:^"RFC822"|^RFC822)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{RFC822}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = "RFC822" }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/^"RFC822"|^RFC822/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{RFC822}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{RFC822}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{RFC822}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{RFC822}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{RFC822}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::textmessage -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"textmessage"}; - - Parse::RecDescent::_trace(q{Trying rule: [textmessage]}, - Parse::RecDescent::_tracefirst($_[1]), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [TEXT basicfields textlines bodyMD5 bodydisp bodylang bodyextra]}, - Parse::RecDescent::_tracefirst($_[1]), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{textmessage}); - %item = (__RULE__ => q{textmessage}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [TEXT]}, - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::TEXT($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [TEXT]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{TEXT}} = $_tok; - push @item, $_tok; - - } - - - - Parse::RecDescent::_trace(q{Trying directive: []}, - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - $_tok = do { $commit = 1 }; - if (defined($_tok)) - { - Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - } - else - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - } - - last unless defined $_tok; - push @item, $item{__DIRECTIVE1__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying subrule: [basicfields]}, - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{basicfields})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::basicfields($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [basicfields]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{basicfields}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying repeated subrule: [textlines]}, - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{textlines})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::textlines, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [textlines]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{textlines(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyMD5]}, - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodyMD5})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyMD5, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyMD5]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodyMD5(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodydisp]}, - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodydisp})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodydisp, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodydisp]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodydisp(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodylang]}, - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodylang})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodylang, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodylang]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodylang(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyextra]}, - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodyextra})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyextra, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyextra]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodyextra(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { - $return = $item{basicfields} || {}; - $return->{bodytype} = 'TEXT'; - take_optional_items($return, \%item - , qw/textlines bodyMD5 bodydisp bodylang bodyextra/); - 1; - }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [TEXT basicfields textlines bodyMD5 bodydisp bodylang bodyextra]<<}, - Parse::RecDescent::_tracefirst($text), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{textmessage}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{textmessage}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{textmessage}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyid -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"bodyid"}; - - Parse::RecDescent::_trace(q{Trying rule: [bodyid]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyid}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/[()]/ NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyid}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{bodyid}); - %item = (__RULE__ => q{bodyid}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/[()]/]}, Parse::RecDescent::_tracefirst($text), - q{bodyid}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - $_savetext = $text; - - if ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:[()])//) - { - $text = $_savetext; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - $text = $_savetext; - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{bodyid}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{NIL})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodyid}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodyid}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/[()]/ NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodyid}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyid}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{bodyid}); - %item = (__RULE__ => q{bodyid}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{bodyid}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodyid}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodyid}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodyid}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyid}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{bodyid}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{bodyid}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{bodyid}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyextra -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"bodyextra"}; - - Parse::RecDescent::_trace(q{Trying rule: [bodyextra]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{bodyextra}); - %item = (__RULE__ => q{bodyextra}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{bodyextra}); - %item = (__RULE__ => q{bodyextra}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRINGS]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{bodyextra}); - %item = (__RULE__ => q{bodyextra}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRINGS]}, - Parse::RecDescent::_tracefirst($text), - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRINGS($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRINGS]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRINGS}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRINGS]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{bodyextra}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{bodyextra}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{bodyextra}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::othertypemessage -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"othertypemessage"}; - - Parse::RecDescent::_trace(q{Trying rule: [othertypemessage]}, - Parse::RecDescent::_tracefirst($_[1]), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [bodytype basicfields bodyMD5 bodydisp bodylang bodyextra]}, - Parse::RecDescent::_tracefirst($_[1]), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{othertypemessage}); - %item = (__RULE__ => q{othertypemessage}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [bodytype]}, - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodytype($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [bodytype]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodytype}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [basicfields]}, - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{basicfields})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::basicfields($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [basicfields]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{basicfields}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyMD5]}, - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodyMD5})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyMD5, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyMD5]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodyMD5(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodydisp]}, - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodydisp})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodydisp, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodydisp]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodydisp(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodylang]}, - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodylang})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodylang, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodylang]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodylang(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyextra]}, - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodyextra})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyextra, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyextra]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodyextra(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = { bodytype => $item{bodytype} }; - take_optional_items($return, \%item - , qw/bodyMD5 bodydisp bodylang bodyextra/ ); - merge_hash($return, $item{basicfields}); - 1; - }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [bodytype basicfields bodyMD5 bodydisp bodylang bodyextra]<<}, - Parse::RecDescent::_tracefirst($text), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{othertypemessage}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{othertypemessage}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{othertypemessage}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::kvpair -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"kvpair"}; - - Parse::RecDescent::_trace(q{Trying rule: [kvpair]}, - Parse::RecDescent::_tracefirst($_[1]), - q{kvpair}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [')' key value]}, - Parse::RecDescent::_tracefirst($_[1]), - q{kvpair}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{kvpair}); - %item = (__RULE__ => q{kvpair}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{kvpair}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - $_savetext = $text; - - if ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - $text = $_savetext; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$_tok; - $text = $_savetext; - - Parse::RecDescent::_trace(q{Trying subrule: [key]}, - Parse::RecDescent::_tracefirst($text), - q{kvpair}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{key})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::key($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{kvpair}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [key]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{kvpair}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{key}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [value]}, - Parse::RecDescent::_tracefirst($text), - q{kvpair}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{value})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::value($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{kvpair}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [value]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{kvpair}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{value}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{kvpair}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = { $item{key} => $item{value} } }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [')' key value]<<}, - Parse::RecDescent::_tracefirst($text), - q{kvpair}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{kvpair}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{kvpair}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{kvpair}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{kvpair}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodysize -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"bodysize"}; - - Parse::RecDescent::_trace(q{Trying rule: [bodysize]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodysize}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/[()]/ NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodysize}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{bodysize}); - %item = (__RULE__ => q{bodysize}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/[()]/]}, Parse::RecDescent::_tracefirst($text), - q{bodysize}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - $_savetext = $text; - - if ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:[()])//) - { - $text = $_savetext; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - $text = $_savetext; - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{bodysize}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{NIL})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodysize}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodysize}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/[()]/ NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodysize}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NUMBER]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodysize}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{bodysize}); - %item = (__RULE__ => q{bodysize}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NUMBER]}, - Parse::RecDescent::_tracefirst($text), - q{bodysize}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NUMBER($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodysize}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NUMBER]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodysize}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NUMBER}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NUMBER]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodysize}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodysize}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{bodysize}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{bodysize}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{bodysize}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"STRING"}; - - Parse::RecDescent::_trace(q{Trying rule: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [DOUBLE_QUOTED_STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{STRING}); - %item = (__RULE__ => q{STRING}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [DOUBLE_QUOTED_STRING]}, - Parse::RecDescent::_tracefirst($text), - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::DOUBLE_QUOTED_STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [DOUBLE_QUOTED_STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{DOUBLE_QUOTED_STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [DOUBLE_QUOTED_STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [SINGLE_QUOTED_STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{STRING}); - %item = (__RULE__ => q{STRING}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [SINGLE_QUOTED_STRING]}, - Parse::RecDescent::_tracefirst($text), - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::SINGLE_QUOTED_STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [SINGLE_QUOTED_STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{SINGLE_QUOTED_STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [SINGLE_QUOTED_STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [BARESTRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{STRING}); - %item = (__RULE__ => q{STRING}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [BARESTRING]}, - Parse::RecDescent::_tracefirst($text), - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::BARESTRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [BARESTRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{BARESTRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [BARESTRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{STRING}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{STRING}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{STRING}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodytype -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"bodytype"}; - - Parse::RecDescent::_trace(q{Trying rule: [bodytype]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodytype}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodytype}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{bodytype}); - %item = (__RULE__ => q{bodytype}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{bodytype}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodytype}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodytype}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodytype}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodytype}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{bodytype}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{bodytype}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{bodytype}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::TEXT -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"TEXT"}; - - Parse::RecDescent::_trace(q{Trying rule: [TEXT]}, - Parse::RecDescent::_tracefirst($_[1]), - q{TEXT}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/^"TEXT"|^TEXT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{TEXT}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{TEXT}); - %item = (__RULE__ => q{TEXT}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/^"TEXT"|^TEXT/i]}, Parse::RecDescent::_tracefirst($text), - q{TEXT}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:^"TEXT"|^TEXT)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{TEXT}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = "TEXT" }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/^"TEXT"|^TEXT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{TEXT}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{TEXT}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{TEXT}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{TEXT}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{TEXT}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::to -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"to"}; - - Parse::RecDescent::_trace(q{Trying rule: [to]}, - Parse::RecDescent::_tracefirst($_[1]), - q{to}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [ADDRESSES]}, - Parse::RecDescent::_tracefirst($_[1]), - q{to}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{to}); - %item = (__RULE__ => q{to}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [ADDRESSES]}, - Parse::RecDescent::_tracefirst($text), - q{to}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::ADDRESSES($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{to}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [ADDRESSES]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{to}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{ADDRESSES}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [ADDRESSES]<<}, - Parse::RecDescent::_tracefirst($text), - q{to}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{to}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{to}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{to}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{to}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"NIL"}; - - Parse::RecDescent::_trace(q{Trying rule: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{NIL}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/^NIL/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{NIL}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{NIL}); - %item = (__RULE__ => q{NIL}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/^NIL/i]}, Parse::RecDescent::_tracefirst($text), - q{NIL}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:^NIL)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{NIL}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = "NIL" }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/^NIL/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{NIL}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{NIL}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{NIL}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{NIL}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{NIL}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::KVPAIRS -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"KVPAIRS"}; - - Parse::RecDescent::_trace(q{Trying rule: [KVPAIRS]}, - Parse::RecDescent::_tracefirst($_[1]), - q{KVPAIRS}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: ['(' kvpair ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{KVPAIRS}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{KVPAIRS}); - %item = (__RULE__ => q{KVPAIRS}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{KVPAIRS}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "("; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [kvpair]}, - Parse::RecDescent::_tracefirst($text), - q{KVPAIRS}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{kvpair})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::kvpair, 1, 100000000, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{KVPAIRS}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [kvpair]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{KVPAIRS}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{kvpair(s)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{KVPAIRS}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{KVPAIRS}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = { map { (%$_) } @{$item{'kvpair(s)'}} } }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: ['(' kvpair ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{KVPAIRS}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{KVPAIRS}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{KVPAIRS}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{KVPAIRS}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{KVPAIRS}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::from -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"from"}; - - Parse::RecDescent::_trace(q{Trying rule: [from]}, - Parse::RecDescent::_tracefirst($_[1]), - q{from}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [ADDRESSES]}, - Parse::RecDescent::_tracefirst($_[1]), - q{from}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{from}); - %item = (__RULE__ => q{from}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [ADDRESSES]}, - Parse::RecDescent::_tracefirst($text), - q{from}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::ADDRESSES($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{from}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [ADDRESSES]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{from}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{ADDRESSES}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [ADDRESSES]<<}, - Parse::RecDescent::_tracefirst($text), - q{from}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{from}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{from}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{from}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{from}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodystructure -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"bodystructure"}; - - Parse::RecDescent::_trace(q{Trying rule: [bodystructure]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodystructure}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: ['(' part ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodystructure}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{bodystructure}); - %item = (__RULE__ => q{bodystructure}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{bodystructure}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "("; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [part]}, - Parse::RecDescent::_tracefirst($text), - q{bodystructure}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{part})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::part, 1, 100000000, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodystructure}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [part]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{bodystructure}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{part(s)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{bodystructure}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{bodystructure}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = $item{'part(s)'} }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: ['(' part ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{bodystructure}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodystructure}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{bodystructure}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{bodystructure}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{bodystructure}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::PLAIN -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"PLAIN"}; - - Parse::RecDescent::_trace(q{Trying rule: [PLAIN]}, - Parse::RecDescent::_tracefirst($_[1]), - q{PLAIN}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/^"PLAIN"|^PLAIN/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{PLAIN}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{PLAIN}); - %item = (__RULE__ => q{PLAIN}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/^"PLAIN"|^PLAIN/i]}, Parse::RecDescent::_tracefirst($text), - q{PLAIN}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:^"PLAIN"|^PLAIN)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{PLAIN}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = "PLAIN" }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/^"PLAIN"|^PLAIN/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{PLAIN}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{PLAIN}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{PLAIN}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{PLAIN}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{PLAIN}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NUMBER -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"NUMBER"}; - - Parse::RecDescent::_trace(q{Trying rule: [NUMBER]}, - Parse::RecDescent::_tracefirst($_[1]), - q{NUMBER}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/^(\\d+)/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{NUMBER}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{NUMBER}); - %item = (__RULE__ => q{NUMBER}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/^(\\d+)/]}, Parse::RecDescent::_tracefirst($text), - q{NUMBER}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:^(\d+))//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{NUMBER}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = $item[1] }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/^(\\d+)/]<<}, - Parse::RecDescent::_tracefirst($text), - q{NUMBER}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{NUMBER}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{NUMBER}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{NUMBER}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{NUMBER}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRINGS -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"STRINGS"}; - - Parse::RecDescent::_trace(q{Trying rule: [STRINGS]}, - Parse::RecDescent::_tracefirst($_[1]), - q{STRINGS}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: ['(' STRING ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{STRINGS}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{STRINGS}); - %item = (__RULE__ => q{STRINGS}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{STRINGS}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "("; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{STRINGS}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{STRING})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING, 1, 100000000, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{STRINGS}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [STRING]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{STRINGS}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING(s)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{STRINGS}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{STRINGS}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = $item{'STRING(s)'} }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: ['(' STRING ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{STRINGS}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{STRINGS}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{STRINGS}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{STRINGS}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{STRINGS}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::HTML -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"HTML"}; - - Parse::RecDescent::_trace(q{Trying rule: [HTML]}, - Parse::RecDescent::_tracefirst($_[1]), - q{HTML}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/"HTML"|HTML/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{HTML}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{HTML}); - %item = (__RULE__ => q{HTML}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/"HTML"|HTML/i]}, Parse::RecDescent::_tracefirst($text), - q{HTML}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:"HTML"|HTML)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{HTML}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = "HTML" }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/"HTML"|HTML/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{HTML}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{HTML}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{HTML}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{HTML}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{HTML}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodydisp -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"bodydisp"}; - - Parse::RecDescent::_trace(q{Trying rule: [bodydisp]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodydisp}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodydisp}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{bodydisp}); - %item = (__RULE__ => q{bodydisp}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{bodydisp}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodydisp}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodydisp}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodydisp}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [KVPAIRS]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodydisp}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{bodydisp}); - %item = (__RULE__ => q{bodydisp}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [KVPAIRS]}, - Parse::RecDescent::_tracefirst($text), - q{bodydisp}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::KVPAIRS($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodydisp}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [KVPAIRS]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodydisp}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{KVPAIRS}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [KVPAIRS]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodydisp}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodydisp}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{bodydisp}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{bodydisp}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{bodydisp}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::part -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"part"}; - - Parse::RecDescent::_trace(q{Trying rule: [part]}, - Parse::RecDescent::_tracefirst($_[1]), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [multipart]}, - Parse::RecDescent::_tracefirst($_[1]), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{part}); - %item = (__RULE__ => q{part}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [multipart]}, - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::multipart($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [multipart]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{multipart}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = bless $item{multipart}, $mibs }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [multipart]<<}, - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [textmessage]}, - Parse::RecDescent::_tracefirst($_[1]), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{part}); - %item = (__RULE__ => q{part}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [textmessage]}, - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::textmessage($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [textmessage]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{textmessage}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = bless $item{textmessage}, $mibs }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [textmessage]<<}, - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [nestedmessage]}, - Parse::RecDescent::_tracefirst($_[1]), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{part}); - %item = (__RULE__ => q{part}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [nestedmessage]}, - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::nestedmessage($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [nestedmessage]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{nestedmessage}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = bless $item{nestedmessage}, $mibs }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [nestedmessage]<<}, - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [othertypemessage]}, - Parse::RecDescent::_tracefirst($_[1]), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[3]; - $text = $_[1]; - my $_savetext; - @item = (q{part}); - %item = (__RULE__ => q{part}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [othertypemessage]}, - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::othertypemessage($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [othertypemessage]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{othertypemessage}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = bless $item{othertypemessage}, $mibs }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [othertypemessage]<<}, - Parse::RecDescent::_tracefirst($text), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{part}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{part}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{part}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{part}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::nestedmessage -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"nestedmessage"}; - - Parse::RecDescent::_trace(q{Trying rule: [nestedmessage]}, - Parse::RecDescent::_tracefirst($_[1]), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [rfc822message bodyparms bodyid bodydesc bodyenc bodysize envelopestruct bodystructure textlines bodyMD5 bodydisp bodylang bodyextra]}, - Parse::RecDescent::_tracefirst($_[1]), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{nestedmessage}); - %item = (__RULE__ => q{nestedmessage}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [rfc822message]}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::rfc822message($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [rfc822message]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{rfc822message}} = $_tok; - push @item, $_tok; - - } - - - - Parse::RecDescent::_trace(q{Trying directive: []}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $_tok = do { $commit = 1 }; - if (defined($_tok)) - { - Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - } - else - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - } - - last unless defined $_tok; - push @item, $item{__DIRECTIVE1__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying subrule: [bodyparms]}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{bodyparms})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyparms($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [bodyparms]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodyparms}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [bodyid]}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{bodyid})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyid($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [bodyid]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodyid}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [bodydesc]}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{bodydesc})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodydesc($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [bodydesc]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodydesc}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [bodyenc]}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{bodyenc})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyenc($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [bodyenc]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodyenc}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [bodysize]}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{bodysize})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodysize($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [bodysize]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodysize}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying repeated subrule: [envelopestruct]}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{envelopestruct})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::envelopestruct, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [envelopestruct]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{envelopestruct(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodystructure]}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodystructure})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodystructure, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodystructure]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodystructure(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [textlines]}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{textlines})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::textlines, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [textlines]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{textlines(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyMD5]}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodyMD5})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyMD5, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyMD5]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodyMD5(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodydisp]}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodydisp})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodydisp, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodydisp]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodydisp(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodylang]}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodylang})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodylang, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodylang]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodylang(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyextra]}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{bodyextra})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyextra, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyextra]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bodyextra(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { - $return = {}; - $return->{$_} = $item{$_} - for qw/bodyparms bodyid bodydesc bodyenc bodysize/; -# envelopestruct bodystructure textlines/; - - take_optional_items($return, \%item - , qw/envelopestruct bodystructure textlines/ - , qw/bodyMD5 bodydisp bodylang bodyextra/); - - merge_hash($return, $item{bodystructure}[0]); - merge_hash($return, $item{basicfields}); - $return->{bodytype} = "MESSAGE" ; - $return->{bodysubtype} = "RFC822" ; - 1; - }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [rfc822message bodyparms bodyid bodydesc bodyenc bodysize envelopestruct bodystructure textlines bodyMD5 bodydisp bodylang bodyextra]<<}, - Parse::RecDescent::_tracefirst($text), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{nestedmessage}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{nestedmessage}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{nestedmessage}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::SINGLE_QUOTED_STRING -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"SINGLE_QUOTED_STRING"}; - - Parse::RecDescent::_trace(q{Trying rule: [SINGLE_QUOTED_STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{SINGLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [''' /(?:\\\\'|[^'])*/ ''']}, - Parse::RecDescent::_tracefirst($_[1]), - q{SINGLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{SINGLE_QUOTED_STRING}); - %item = (__RULE__ => q{SINGLE_QUOTED_STRING}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [''']}, - Parse::RecDescent::_tracefirst($text), - q{SINGLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "'"; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying terminal: [/(?:\\\\'|[^'])*/]}, Parse::RecDescent::_tracefirst($text), - q{SINGLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/(?:\\\\'|[^'])*/})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:(?:\\'|[^'])*)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: [''']}, - Parse::RecDescent::_tracefirst($text), - q{SINGLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'''})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "'"; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{SINGLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = $item{__PATTERN1__} }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [''' /(?:\\\\'|[^'])*/ ''']<<}, - Parse::RecDescent::_tracefirst($text), - q{SINGLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{SINGLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{SINGLE_QUOTED_STRING}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{SINGLE_QUOTED_STRING}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{SINGLE_QUOTED_STRING}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::ADDRESSES -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"ADDRESSES"}; - - Parse::RecDescent::_trace(q{Trying rule: [ADDRESSES]}, - Parse::RecDescent::_tracefirst($_[1]), - q{ADDRESSES}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{ADDRESSES}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{ADDRESSES}); - %item = (__RULE__ => q{ADDRESSES}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{ADDRESSES}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{ADDRESSES}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{ADDRESSES}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{ADDRESSES}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: ['(' addressstruct ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{ADDRESSES}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{ADDRESSES}); - %item = (__RULE__ => q{ADDRESSES}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{ADDRESSES}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "("; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [addressstruct]}, - Parse::RecDescent::_tracefirst($text), - q{ADDRESSES}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{addressstruct})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::addressstruct, 1, 100000000, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{ADDRESSES}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [addressstruct]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{ADDRESSES}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{addressstruct(s)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{ADDRESSES}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{ADDRESSES}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = $item{'addressstruct(s)'} }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: ['(' addressstruct ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{ADDRESSES}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{ADDRESSES}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{ADDRESSES}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{ADDRESSES}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{ADDRESSES}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bcc -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"bcc"}; - - Parse::RecDescent::_trace(q{Trying rule: [bcc]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bcc}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [ADDRESSES]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bcc}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{bcc}); - %item = (__RULE__ => q{bcc}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [ADDRESSES]}, - Parse::RecDescent::_tracefirst($text), - q{bcc}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::ADDRESSES($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bcc}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [ADDRESSES]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bcc}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{ADDRESSES}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [ADDRESSES]<<}, - Parse::RecDescent::_tracefirst($text), - q{bcc}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{bcc}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{bcc}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{bcc}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{bcc}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::rfc822message -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"rfc822message"}; - - Parse::RecDescent::_trace(q{Trying rule: [rfc822message]}, - Parse::RecDescent::_tracefirst($_[1]), - q{rfc822message}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [MESSAGE RFC822]}, - Parse::RecDescent::_tracefirst($_[1]), - q{rfc822message}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{rfc822message}); - %item = (__RULE__ => q{rfc822message}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [MESSAGE]}, - Parse::RecDescent::_tracefirst($text), - q{rfc822message}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::MESSAGE($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{rfc822message}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [MESSAGE]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{rfc822message}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{MESSAGE}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [RFC822]}, - Parse::RecDescent::_tracefirst($text), - q{rfc822message}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{RFC822})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::RFC822($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{rfc822message}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [RFC822]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{rfc822message}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{RFC822}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{rfc822message}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = "MESSAGE RFC822" }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [MESSAGE RFC822]<<}, - Parse::RecDescent::_tracefirst($text), - q{rfc822message}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{rfc822message}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{rfc822message}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{rfc822message}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{rfc822message}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::addressstruct -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"addressstruct"}; - - Parse::RecDescent::_trace(q{Trying rule: [addressstruct]}, - Parse::RecDescent::_tracefirst($_[1]), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: ['(' personalname sourceroute mailboxname hostname ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{addressstruct}); - %item = (__RULE__ => q{addressstruct}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "("; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying subrule: [personalname]}, - Parse::RecDescent::_tracefirst($text), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{personalname})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::personalname($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [personalname]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{personalname}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [sourceroute]}, - Parse::RecDescent::_tracefirst($text), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{sourceroute})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::sourceroute($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [sourceroute]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{sourceroute}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [mailboxname]}, - Parse::RecDescent::_tracefirst($text), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{mailboxname})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::mailboxname($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [mailboxname]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{mailboxname}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [hostname]}, - Parse::RecDescent::_tracefirst($text), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{hostname})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::hostname($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [hostname]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{hostname}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { bless { personalname => $item{personalname} - , sourceroute => $item{sourceroute} - , mailboxname => $item{mailboxname} - , hostname => $item{hostname} - }, 'Mail::IMAPClient::BodyStructure::Address'; - }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: ['(' personalname sourceroute mailboxname hostname ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{addressstruct}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{addressstruct}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{addressstruct}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::sourceroute -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"sourceroute"}; - - Parse::RecDescent::_trace(q{Trying rule: [sourceroute]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sourceroute}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sourceroute}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{sourceroute}); - %item = (__RULE__ => q{sourceroute}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{sourceroute}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sourceroute}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{sourceroute}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{sourceroute}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sourceroute}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{sourceroute}); - %item = (__RULE__ => q{sourceroute}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{sourceroute}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sourceroute}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{sourceroute}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{sourceroute}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{sourceroute}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{sourceroute}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{sourceroute}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{sourceroute}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::subpart -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"subpart"}; - - Parse::RecDescent::_trace(q{Trying rule: [subpart]}, - Parse::RecDescent::_tracefirst($_[1]), - q{subpart}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: ['(' part ')' ]}, - Parse::RecDescent::_tracefirst($_[1]), - q{subpart}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{subpart}); - %item = (__RULE__ => q{subpart}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{subpart}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "("; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying subrule: [part]}, - Parse::RecDescent::_tracefirst($text), - q{subpart}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{part})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::part($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{subpart}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [part]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{subpart}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{part}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{subpart}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{subpart}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do {$return = $item{part}}; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - - Parse::RecDescent::_trace(q{Trying directive: []}, - Parse::RecDescent::_tracefirst($text), - q{subpart}, - $tracelevel) - if defined $::RD_TRACE; - $_tok = do { push @{$thisparser->{deferred}}, sub { ++$subpartCount; }; }; - if (defined($_tok)) - { - Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - } - else - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - } - - last unless defined $_tok; - push @item, $item{__DIRECTIVE1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: ['(' part ')' ]<<}, - Parse::RecDescent::_tracefirst($text), - q{subpart}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{subpart}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{subpart}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{subpart}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{subpart}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::textlines -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"textlines"}; - - Parse::RecDescent::_trace(q{Trying rule: [textlines]}, - Parse::RecDescent::_tracefirst($_[1]), - q{textlines}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{textlines}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{textlines}); - %item = (__RULE__ => q{textlines}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{textlines}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{textlines}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{textlines}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{textlines}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NUMBER]}, - Parse::RecDescent::_tracefirst($_[1]), - q{textlines}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{textlines}); - %item = (__RULE__ => q{textlines}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NUMBER]}, - Parse::RecDescent::_tracefirst($text), - q{textlines}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NUMBER($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{textlines}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NUMBER]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{textlines}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NUMBER}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NUMBER]<<}, - Parse::RecDescent::_tracefirst($text), - q{textlines}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{textlines}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{textlines}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{textlines}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{textlines}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::BARESTRING -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"BARESTRING"}; - - Parse::RecDescent::_trace(q{Trying rule: [BARESTRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{BARESTRING}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/^[)('"]/ /^(?!\\(|\\))(?:\\\\ |\\S)+/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{BARESTRING}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{BARESTRING}); - %item = (__RULE__ => q{BARESTRING}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/^[)('"]/]}, Parse::RecDescent::_tracefirst($text), - q{BARESTRING}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - $_savetext = $text; - - if ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:^[)('"])//) - { - $text = $_savetext; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - $text = $_savetext; - - Parse::RecDescent::_trace(q{Trying terminal: [/^(?!\\(|\\))(?:\\\\ |\\S)+/]}, Parse::RecDescent::_tracefirst($text), - q{BARESTRING}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/^(?!\\(|\\))(?:\\\\ |\\S)+/})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:^(?!\(|\))(?:\\ |\S)+)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{BARESTRING}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = $item{__PATTERN1__} }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/^[)('"]/ /^(?!\\(|\\))(?:\\\\ |\\S)+/]<<}, - Parse::RecDescent::_tracefirst($text), - q{BARESTRING}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{BARESTRING}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{BARESTRING}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{BARESTRING}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{BARESTRING}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyloc -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"bodyloc"}; - - Parse::RecDescent::_trace(q{Trying rule: [bodyloc]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyloc}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyloc}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{bodyloc}); - %item = (__RULE__ => q{bodyloc}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{bodyloc}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodyloc}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodyloc}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodyloc}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyloc}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{bodyloc}); - %item = (__RULE__ => q{bodyloc}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{bodyloc}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodyloc}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodyloc}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodyloc}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodyloc}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{bodyloc}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{bodyloc}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{bodyloc}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodylang -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"bodylang"}; - - Parse::RecDescent::_trace(q{Trying rule: [bodylang]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{bodylang}); - %item = (__RULE__ => q{bodylang}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{bodylang}); - %item = (__RULE__ => q{bodylang}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRINGS]}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{bodylang}); - %item = (__RULE__ => q{bodylang}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRINGS]}, - Parse::RecDescent::_tracefirst($text), - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRINGS($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRINGS]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRINGS}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRINGS]<<}, - Parse::RecDescent::_tracefirst($text), - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{bodylang}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{bodylang}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{bodylang}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::envelopestruct -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"envelopestruct"}; - - Parse::RecDescent::_trace(q{Trying rule: [envelopestruct]}, - Parse::RecDescent::_tracefirst($_[1]), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: ['(' date subject from sender replyto to cc bcc inreplyto messageid ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{envelopestruct}); - %item = (__RULE__ => q{envelopestruct}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "("; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying subrule: [date]}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{date})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::date($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [date]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{date}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [subject]}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{subject})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::subject($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [subject]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{subject}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [from]}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{from})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::from($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [from]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{from}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [sender]}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{sender})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::sender($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [sender]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{sender}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [replyto]}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{replyto})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::replyto($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [replyto]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{replyto}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [to]}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{to})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::to($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [to]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{to}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [cc]}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{cc})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::cc($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [cc]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{cc}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [bcc]}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{bcc})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bcc($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [bcc]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{bcc}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [inreplyto]}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{inreplyto})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::inreplyto($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [inreplyto]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{inreplyto}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [messageid]}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{messageid})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::messageid($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [messageid]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{messageid}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = bless {}, "Mail::IMAPClient::BodyStructure::Envelope"; - $return->{$_} = $item{$_} - for qw/date subject from sender replyto to cc/ - , qw/bcc inreplyto messageid/; - 1; - }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: ['(' date subject from sender replyto to cc bcc inreplyto messageid ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{envelopestruct}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{envelopestruct}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{envelopestruct}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::replyto -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"replyto"}; - - Parse::RecDescent::_trace(q{Trying rule: [replyto]}, - Parse::RecDescent::_tracefirst($_[1]), - q{replyto}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [ADDRESSES]}, - Parse::RecDescent::_tracefirst($_[1]), - q{replyto}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{replyto}); - %item = (__RULE__ => q{replyto}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [ADDRESSES]}, - Parse::RecDescent::_tracefirst($text), - q{replyto}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::ADDRESSES($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{replyto}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [ADDRESSES]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{replyto}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{ADDRESSES}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [ADDRESSES]<<}, - Parse::RecDescent::_tracefirst($text), - q{replyto}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{replyto}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{replyto}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{replyto}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{replyto}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::mailboxname -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"mailboxname"}; - - Parse::RecDescent::_trace(q{Trying rule: [mailboxname]}, - Parse::RecDescent::_tracefirst($_[1]), - q{mailboxname}, - $tracelevel) - if defined $::RD_TRACE; - - my $def_at = @{$thisparser->{deferred}}; - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NIL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{mailboxname}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{mailboxname}); - %item = (__RULE__ => q{mailboxname}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, - Parse::RecDescent::_tracefirst($text), - q{mailboxname}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{mailboxname}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{mailboxname}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NIL}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, - Parse::RecDescent::_tracefirst($text), - q{mailboxname}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [STRING]}, - Parse::RecDescent::_tracefirst($_[1]), - q{mailboxname}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{mailboxname}); - %item = (__RULE__ => q{mailboxname}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, - Parse::RecDescent::_tracefirst($text), - q{mailboxname}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{mailboxname}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{mailboxname}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{STRING}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, - Parse::RecDescent::_tracefirst($text), - q{mailboxname}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - splice - @{$thisparser->{deferred}}, $def_at unless $_matched; - - unless ( $_matched || defined($return) || defined($score) ) - { - splice @{$thisparser->{deferred}}, $def_at; - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{mailboxname}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{mailboxname}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{mailboxname}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{mailboxname}, - $tracelevel) - } - $_[1] = $text; - return $return; -} -} -package Mail::IMAPClient::BodyStructure::Parse; sub new { my $self = bless( { - '_AUTOTREE' => undef, - 'localvars' => '', - 'startcode' => '', - '_check' => { - 'thisoffset' => '', - 'itempos' => '', - 'prevoffset' => '', - 'prevline' => '', - 'prevcolumn' => '', - 'thiscolumn' => '' - }, - 'namespace' => 'Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse', - 'deferrable' => 1, - '_AUTOACTION' => undef, - 'rules' => { - 'bodyparms' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'KVPAIRS' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 65 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'KVPAIRS', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 65 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 65 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'bodyparms', - 'vars' => '', - 'line' => 65 - }, 'Parse::RecDescent::Rule' ), - 'date' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'STRING' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 92 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 92 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 92 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'date', - 'vars' => '', - 'line' => 92 - }, 'Parse::RecDescent::Rule' ), - 'bodysubtype' => bless( { - 'impcount' => 0, - 'calls' => [ - 'PLAIN', - 'HTML', - 'NIL', - 'STRING' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'PLAIN', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 53 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'HTML', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 53 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 53 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 53 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 53 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '3', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 53 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 53 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'bodysubtype', - 'vars' => '', - 'line' => 53 - }, 'Parse::RecDescent::Rule' ), - 'hostname' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'STRING' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 79 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 79 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 79 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'hostname', - 'vars' => '', - 'line' => 79 - }, 'Parse::RecDescent::Rule' ), - 'basicfields' => bless( { - 'impcount' => 0, - 'calls' => [ - 'bodysubtype', - 'bodyparms', - 'bodyid', - 'bodydesc', - 'bodyenc', - 'bodysize' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'bodysubtype', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 113 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'bodyparms', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 113 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodyid', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 113 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodydesc', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 114 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodyenc', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 114 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodysize', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 114 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 115, - 'code' => '{ $return = { bodysubtype => $item{bodysubtype} }; - take_optional_items($return, \\%item, - qw/bodyparms bodyid bodydesc bodyenc bodysize/); - 1; - }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'basicfields', - 'vars' => '', - 'line' => 113 - }, 'Parse::RecDescent::Rule' ), - 'personalname' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'STRING' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 76 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 76 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 76 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'personalname', - 'vars' => '', - 'line' => 76 - }, 'Parse::RecDescent::Rule' ), - 'key' => bless( { - 'impcount' => 0, - 'calls' => [ - 'STRING' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 55 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'key', - 'vars' => '', - 'line' => 55 - }, 'Parse::RecDescent::Rule' ), - 'cc' => bless( { - 'impcount' => 0, - 'calls' => [ - 'ADDRESSES' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'ADDRESSES', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 97 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'cc', - 'vars' => '', - 'line' => 97 - }, 'Parse::RecDescent::Rule' ), - 'bodyMD5' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'STRING' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 71 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 71 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 71 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'bodyMD5', - 'vars' => '', - 'line' => 71 - }, 'Parse::RecDescent::Rule' ), - 'envelope' => bless( { - 'impcount' => 0, - 'calls' => [ - 'envelopestruct' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '.*?\\(.*?ENVELOPE', - 'hashname' => '__PATTERN1__', - 'description' => '/.*?\\\\(.*?ENVELOPE/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 187, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'envelopestruct', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 187 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => '.*\\)', - 'hashname' => '__PATTERN2__', - 'description' => '/.*\\\\)/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 187, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 188, - 'code' => '{ $return = $item{envelopestruct} }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'envelope', - 'vars' => '', - 'line' => 187 - }, 'Parse::RecDescent::Rule' ), - 'MESSAGE' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '^"MESSAGE"|^MESSAGE', - 'hashname' => '__PATTERN1__', - 'description' => '/^"MESSAGE"|^MESSAGE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 32, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 32, - 'code' => '{ $return = "MESSAGE"}' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'MESSAGE', - 'vars' => '', - 'line' => 32 - }, 'Parse::RecDescent::Rule' ), - 'DOUBLE_QUOTED_STRING' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '"', - 'hashname' => '__STRING1__', - 'description' => '\'"\'', - 'lookahead' => 0, - 'line' => 40 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'pattern' => '(?:\\\\"|[^"])*', - 'hashname' => '__PATTERN1__', - 'description' => '/(?:\\\\\\\\"|[^"])*/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 40, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '"', - 'hashname' => '__STRING2__', - 'description' => '\'"\'', - 'lookahead' => 0, - 'line' => 40 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 40, - 'code' => '{ $return = $item{__PATTERN1__} }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'DOUBLE_QUOTED_STRING', - 'vars' => '', - 'line' => 40 - }, 'Parse::RecDescent::Rule' ), - 'subject' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'STRING' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 89 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 89 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 89 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'subject', - 'vars' => '', - 'line' => 89 - }, 'Parse::RecDescent::Rule' ), - 'value' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'NUMBER', - 'STRING', - 'KVPAIRS' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 56 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NUMBER', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 56 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 56 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 56 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 56 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '3', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'KVPAIRS', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 56 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 56 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'value', - 'vars' => '', - 'line' => 56 - }, 'Parse::RecDescent::Rule' ), - 'inreplyto' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'STRING' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 90 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 90 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 90 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'inreplyto', - 'vars' => '', - 'line' => 90 - }, 'Parse::RecDescent::Rule' ), - 'messageid' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'STRING' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 91 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 91 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 91 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'messageid', - 'vars' => '', - 'line' => 91 - }, 'Parse::RecDescent::Rule' ), - 'sender' => bless( { - 'impcount' => 0, - 'calls' => [ - 'ADDRESSES' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'ADDRESSES', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 101 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'sender', - 'vars' => '', - 'line' => 101 - }, 'Parse::RecDescent::Rule' ), - 'multipart' => bless( { - 'impcount' => 0, - 'calls' => [ - 'subpart', - 'bodysubtype', - 'bodyparms', - 'bodydisp', - 'bodylang', - 'bodyloc', - 'bodyextra' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 2, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'subpart', - 'expected' => undef, - 'min' => 1, - 'argcode' => undef, - 'max' => 100000000, - 'matchrule' => 0, - 'repspec' => 's', - 'lookahead' => 0, - 'line' => 161 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'hashname' => '__DIRECTIVE1__', - 'name' => '', - 'lookahead' => 0, - 'line' => 161, - 'code' => '$commit = 1' - }, 'Parse::RecDescent::Directive' ), - bless( { - 'subrule' => 'bodysubtype', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 161 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'bodyparms', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 162 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodydisp', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 162 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodylang', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 162 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodyloc', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 162 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodyextra', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 162 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'hashname' => '__DIRECTIVE2__', - 'name' => '', - 'lookahead' => 0, - 'line' => 163, - 'code' => 'push @{$thisparser->{deferred}}, sub { $subpartCount = 0 };' - }, 'Parse::RecDescent::Directive' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 164, - 'code' => '{ $return = - { bodysubtype => $item{bodysubtype} - , bodytype => \'MULTIPART\' - , bodystructure => $item{\'subpart(s)\'} - }; - take_optional_items($return, \\%item - , qw/bodyparms bodydisp bodylang bodyloc bodyextra/); - 1; - }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'multipart', - 'vars' => '', - 'line' => 161 - }, 'Parse::RecDescent::Rule' ), - 'bodyenc' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'STRING', - 'KVPAIRS' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 70 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 70 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 70 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'KVPAIRS', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 70 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 70 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'bodyenc', - 'vars' => '', - 'line' => 70 - }, 'Parse::RecDescent::Rule' ), - 'bodydesc' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'STRING' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '[()]', - 'hashname' => '__PATTERN1__', - 'description' => '/[()]/', - 'lookahead' => -1, - 'rdelim' => '/', - 'line' => 68, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 68 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 68 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 68 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'bodydesc', - 'vars' => '', - 'line' => 68 - }, 'Parse::RecDescent::Rule' ), - 'start' => bless( { - 'impcount' => 0, - 'calls' => [ - 'part' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '.*?\\(.*?BODYSTRUCTURE \\(', - 'hashname' => '__PATTERN1__', - 'description' => '/.*?\\\\(.*?BODYSTRUCTURE \\\\(/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 184, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'part', - 'expected' => undef, - 'min' => 1, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '1', - 'lookahead' => 0, - 'line' => 184 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'pattern' => '\\).*\\)\\r?\\n?', - 'hashname' => '__PATTERN2__', - 'description' => '/\\\\).*\\\\)\\\\r?\\\\n?/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 184, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 185, - 'code' => '{ $return = $item{\'part(1)\'}[0] }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'start', - 'vars' => '', - 'line' => 184 - }, 'Parse::RecDescent::Rule' ), - 'RFC822' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '^"RFC822"|^RFC822', - 'hashname' => '__PATTERN1__', - 'description' => '/^"RFC822"|^RFC822/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 33, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 33, - 'code' => '{ $return = "RFC822" }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'RFC822', - 'vars' => '', - 'line' => 33 - }, 'Parse::RecDescent::Rule' ), - 'textmessage' => bless( { - 'impcount' => 0, - 'calls' => [ - 'TEXT', - 'basicfields', - 'textlines', - 'bodyMD5', - 'bodydisp', - 'bodylang', - 'bodyextra' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 1, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'TEXT', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 121 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__DIRECTIVE1__', - 'name' => '', - 'lookahead' => 0, - 'line' => 121, - 'code' => '$commit = 1' - }, 'Parse::RecDescent::Directive' ), - bless( { - 'subrule' => 'basicfields', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 121 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'textlines', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 121 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodyMD5', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 121 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodydisp', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 122 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodylang', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 122 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodyextra', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 122 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 123, - 'code' => '{ - $return = $item{basicfields} || {}; - $return->{bodytype} = \'TEXT\'; - take_optional_items($return, \\%item - , qw/textlines bodyMD5 bodydisp bodylang bodyextra/); - 1; - }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'textmessage', - 'vars' => '', - 'line' => 121 - }, 'Parse::RecDescent::Rule' ), - 'bodyid' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'STRING' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '[()]', - 'hashname' => '__PATTERN1__', - 'description' => '/[()]/', - 'lookahead' => -1, - 'rdelim' => '/', - 'line' => 67, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 67 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 67 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 67 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'bodyid', - 'vars' => '', - 'line' => 67 - }, 'Parse::RecDescent::Rule' ), - 'bodyextra' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'STRING', - 'STRINGS' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 73 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 73 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 73 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRINGS', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 73 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 73 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'bodyextra', - 'vars' => '', - 'line' => 73 - }, 'Parse::RecDescent::Rule' ), - 'othertypemessage' => bless( { - 'impcount' => 0, - 'calls' => [ - 'bodytype', - 'basicfields', - 'bodyMD5', - 'bodydisp', - 'bodylang', - 'bodyextra' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'bodytype', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 131 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'basicfields', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 131 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'bodyMD5', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 131 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodydisp', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 131 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodylang', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 132 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodyextra', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 132 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 133, - 'code' => '{ $return = { bodytype => $item{bodytype} }; - take_optional_items($return, \\%item - , qw/bodyMD5 bodydisp bodylang bodyextra/ ); - merge_hash($return, $item{basicfields}); - 1; - }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'othertypemessage', - 'vars' => '', - 'line' => 131 - }, 'Parse::RecDescent::Rule' ), - 'kvpair' => bless( { - 'impcount' => 0, - 'calls' => [ - 'key', - 'value' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => ')', - 'hashname' => '__STRING1__', - 'description' => '\')\'', - 'lookahead' => -1, - 'line' => 58 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'subrule' => 'key', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 58 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'value', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 58 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 59, - 'code' => '{ $return = { $item{key} => $item{value} } }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'kvpair', - 'vars' => '', - 'line' => 58 - }, 'Parse::RecDescent::Rule' ), - 'bodysize' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'NUMBER' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '[()]', - 'hashname' => '__PATTERN1__', - 'description' => '/[()]/', - 'lookahead' => -1, - 'rdelim' => '/', - 'line' => 69, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 69 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NUMBER', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 69 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 69 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'bodysize', - 'vars' => '', - 'line' => 69 - }, 'Parse::RecDescent::Rule' ), - 'STRING' => bless( { - 'impcount' => 0, - 'calls' => [ - 'DOUBLE_QUOTED_STRING', - 'SINGLE_QUOTED_STRING', - 'BARESTRING' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'DOUBLE_QUOTED_STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 45 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'SINGLE_QUOTED_STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 45 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 45 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'BARESTRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 45 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 45 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'STRING', - 'vars' => '', - 'line' => 45 - }, 'Parse::RecDescent::Rule' ), - 'bodytype' => bless( { - 'impcount' => 0, - 'calls' => [ - 'STRING' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 64 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'bodytype', - 'vars' => '', - 'line' => 64 - }, 'Parse::RecDescent::Rule' ), - 'TEXT' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '^"TEXT"|^TEXT', - 'hashname' => '__PATTERN1__', - 'description' => '/^"TEXT"|^TEXT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 29, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 29, - 'code' => '{ $return = "TEXT" }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'TEXT', - 'vars' => '', - 'line' => 27 - }, 'Parse::RecDescent::Rule' ), - 'to' => bless( { - 'impcount' => 0, - 'calls' => [ - 'ADDRESSES' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'ADDRESSES', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 102 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'to', - 'vars' => '', - 'line' => 102 - }, 'Parse::RecDescent::Rule' ), - 'NIL' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '^NIL', - 'hashname' => '__PATTERN1__', - 'description' => '/^NIL/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 34, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 34, - 'code' => '{ $return = "NIL" }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'NIL', - 'vars' => '', - 'line' => 34 - }, 'Parse::RecDescent::Rule' ), - 'KVPAIRS' => bless( { - 'impcount' => 0, - 'calls' => [ - 'kvpair' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 61 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'subrule' => 'kvpair', - 'expected' => undef, - 'min' => 1, - 'argcode' => undef, - 'max' => 100000000, - 'matchrule' => 0, - 'repspec' => 's', - 'lookahead' => 0, - 'line' => 61 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 61 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 62, - 'code' => '{ $return = { map { (%$_) } @{$item{\'kvpair(s)\'}} } }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'KVPAIRS', - 'vars' => '', - 'line' => 61 - }, 'Parse::RecDescent::Rule' ), - 'from' => bless( { - 'impcount' => 0, - 'calls' => [ - 'ADDRESSES' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'ADDRESSES', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 99 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'from', - 'vars' => '', - 'line' => 99 - }, 'Parse::RecDescent::Rule' ), - 'bodystructure' => bless( { - 'impcount' => 0, - 'calls' => [ - 'part' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 181 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'subrule' => 'part', - 'expected' => undef, - 'min' => 1, - 'argcode' => undef, - 'max' => 100000000, - 'matchrule' => 0, - 'repspec' => 's', - 'lookahead' => 0, - 'line' => 181 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 181 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 182, - 'code' => '{ $return = $item{\'part(s)\'} }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'bodystructure', - 'vars' => '', - 'line' => 181 - }, 'Parse::RecDescent::Rule' ), - 'PLAIN' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '^"PLAIN"|^PLAIN', - 'hashname' => '__PATTERN1__', - 'description' => '/^"PLAIN"|^PLAIN/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 30, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 30, - 'code' => '{ $return = "PLAIN" }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'PLAIN', - 'vars' => '', - 'line' => 30 - }, 'Parse::RecDescent::Rule' ), - 'NUMBER' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '^(\\d+)', - 'hashname' => '__PATTERN1__', - 'description' => '/^(\\\\d+)/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 35, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 35, - 'code' => '{ $return = $item[1] }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'NUMBER', - 'vars' => '', - 'line' => 35 - }, 'Parse::RecDescent::Rule' ), - 'STRINGS' => bless( { - 'impcount' => 0, - 'calls' => [ - 'STRING' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 47 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'subrule' => 'STRING', - 'expected' => undef, - 'min' => 1, - 'argcode' => undef, - 'max' => 100000000, - 'matchrule' => 0, - 'repspec' => 's', - 'lookahead' => 0, - 'line' => 47 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 47 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 47, - 'code' => '{ $return = $item{\'STRING(s)\'} }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'STRINGS', - 'vars' => '', - 'line' => 47 - }, 'Parse::RecDescent::Rule' ), - 'HTML' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '"HTML"|HTML', - 'hashname' => '__PATTERN1__', - 'description' => '/"HTML"|HTML/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 31, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 31, - 'code' => '{ $return = "HTML" }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'HTML', - 'vars' => '', - 'line' => 31 - }, 'Parse::RecDescent::Rule' ), - 'bodydisp' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'KVPAIRS' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 66 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'KVPAIRS', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 66 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 66 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'bodydisp', - 'vars' => '', - 'line' => 66 - }, 'Parse::RecDescent::Rule' ), - 'part' => bless( { - 'impcount' => 0, - 'calls' => [ - 'multipart', - 'textmessage', - 'nestedmessage', - 'othertypemessage' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'multipart', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 176 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 176, - 'code' => '{ $return = bless $item{multipart}, $mibs }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'textmessage', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 177 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 177, - 'code' => '{ $return = bless $item{textmessage}, $mibs }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => 177 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'nestedmessage', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 178 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 178, - 'code' => '{ $return = bless $item{nestedmessage}, $mibs }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => 178 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '3', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'othertypemessage', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 179 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 179, - 'code' => '{ $return = bless $item{othertypemessage}, $mibs }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => 179 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'part', - 'vars' => '', - 'line' => 176 - }, 'Parse::RecDescent::Rule' ), - 'nestedmessage' => bless( { - 'impcount' => 0, - 'calls' => [ - 'rfc822message', - 'bodyparms', - 'bodyid', - 'bodydesc', - 'bodyenc', - 'bodysize', - 'envelopestruct', - 'bodystructure', - 'textlines', - 'bodyMD5', - 'bodydisp', - 'bodylang', - 'bodyextra' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 1, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'rfc822message', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 140 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__DIRECTIVE1__', - 'name' => '', - 'lookahead' => 0, - 'line' => 140, - 'code' => '$commit = 1' - }, 'Parse::RecDescent::Directive' ), - bless( { - 'subrule' => 'bodyparms', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 140 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'bodyid', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 140 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'bodydesc', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 140 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'bodyenc', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 140 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'bodysize', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 141 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'envelopestruct', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 142 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodystructure', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 142 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'textlines', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 142 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodyMD5', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 143 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodydisp', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 143 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodylang', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 143 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'bodyextra', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 143 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 144, - 'code' => '{ - $return = {}; - $return->{$_} = $item{$_} - for qw/bodyparms bodyid bodydesc bodyenc bodysize/; -# envelopestruct bodystructure textlines/; - - take_optional_items($return, \\%item - , qw/envelopestruct bodystructure textlines/ - , qw/bodyMD5 bodydisp bodylang bodyextra/); - - merge_hash($return, $item{bodystructure}[0]); - merge_hash($return, $item{basicfields}); - $return->{bodytype} = "MESSAGE" ; - $return->{bodysubtype} = "RFC822" ; - 1; - }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'nestedmessage', - 'vars' => '', - 'line' => 140 - }, 'Parse::RecDescent::Rule' ), - 'SINGLE_QUOTED_STRING' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '\'', - 'hashname' => '__STRING1__', - 'description' => '\'\'\'', - 'lookahead' => 0, - 'line' => 39 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'pattern' => '(?:\\\\\'|[^\'])*', - 'hashname' => '__PATTERN1__', - 'description' => '/(?:\\\\\\\\\'|[^\'])*/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 39, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '\'', - 'hashname' => '__STRING2__', - 'description' => '\'\'\'', - 'lookahead' => 0, - 'line' => 39 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 39, - 'code' => '{ $return = $item{__PATTERN1__} }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'SINGLE_QUOTED_STRING', - 'vars' => '', - 'line' => 37 - }, 'Parse::RecDescent::Rule' ), - 'ADDRESSES' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'addressstruct' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 94 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 95 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'subrule' => 'addressstruct', - 'expected' => undef, - 'min' => 1, - 'argcode' => undef, - 'max' => 100000000, - 'matchrule' => 0, - 'repspec' => 's', - 'lookahead' => 0, - 'line' => 95 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 95 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 95, - 'code' => '{ $return = $item{\'addressstruct(s)\'} }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => 95 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'ADDRESSES', - 'vars' => '', - 'line' => 94 - }, 'Parse::RecDescent::Rule' ), - 'bcc' => bless( { - 'impcount' => 0, - 'calls' => [ - 'ADDRESSES' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'ADDRESSES', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 98 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'bcc', - 'vars' => '', - 'line' => 98 - }, 'Parse::RecDescent::Rule' ), - 'rfc822message' => bless( { - 'impcount' => 0, - 'calls' => [ - 'MESSAGE', - 'RFC822' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'MESSAGE', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 51 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'RFC822', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 51 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 51, - 'code' => '{ $return = "MESSAGE RFC822" }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'rfc822message', - 'vars' => '', - 'line' => 51 - }, 'Parse::RecDescent::Rule' ), - 'addressstruct' => bless( { - 'impcount' => 0, - 'calls' => [ - 'personalname', - 'sourceroute', - 'mailboxname', - 'hostname' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 81 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'subrule' => 'personalname', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 81 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'sourceroute', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 81 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'mailboxname', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 81 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'hostname', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 81 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 81 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 82, - 'code' => '{ bless { personalname => $item{personalname} - , sourceroute => $item{sourceroute} - , mailboxname => $item{mailboxname} - , hostname => $item{hostname} - }, \'Mail::IMAPClient::BodyStructure::Address\'; - }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'addressstruct', - 'vars' => '', - 'line' => 81 - }, 'Parse::RecDescent::Rule' ), - 'sourceroute' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'STRING' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 77 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 77 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 77 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'sourceroute', - 'vars' => '', - 'line' => 77 - }, 'Parse::RecDescent::Rule' ), - 'subpart' => bless( { - 'impcount' => 0, - 'calls' => [ - 'part' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 1, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 174 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'subrule' => 'part', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 174 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 174 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 174, - 'code' => '{$return = $item{part}}' - }, 'Parse::RecDescent::Action' ), - bless( { - 'hashname' => '__DIRECTIVE1__', - 'name' => '', - 'lookahead' => 0, - 'line' => 174, - 'code' => 'push @{$thisparser->{deferred}}, sub { ++$subpartCount; };' - }, 'Parse::RecDescent::Directive' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'subpart', - 'vars' => '', - 'line' => 174 - }, 'Parse::RecDescent::Rule' ), - 'textlines' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'NUMBER' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 49 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NUMBER', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 49 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 49 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'textlines', - 'vars' => '', - 'line' => 49 - }, 'Parse::RecDescent::Rule' ), - 'BARESTRING' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '^[)(\'"]', - 'hashname' => '__PATTERN1__', - 'description' => '/^[)(\'"]/', - 'lookahead' => -1, - 'rdelim' => '/', - 'line' => 42, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '^(?!\\(|\\))(?:\\\\ |\\S)+', - 'hashname' => '__PATTERN2__', - 'description' => '/^(?!\\\\(|\\\\))(?:\\\\\\\\ |\\\\S)+/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 42, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 43, - 'code' => '{ $return = $item{__PATTERN1__} }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'BARESTRING', - 'vars' => '', - 'line' => 42 - }, 'Parse::RecDescent::Rule' ), - 'bodyloc' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'STRING' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 74 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 74 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 74 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'bodyloc', - 'vars' => '', - 'line' => 74 - }, 'Parse::RecDescent::Rule' ), - 'bodylang' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'STRING', - 'STRINGS' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 72 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 72 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 72 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRINGS', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 72 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 72 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'bodylang', - 'vars' => '', - 'line' => 72 - }, 'Parse::RecDescent::Rule' ), - 'envelopestruct' => bless( { - 'impcount' => 0, - 'calls' => [ - 'date', - 'subject', - 'from', - 'sender', - 'replyto', - 'to', - 'cc', - 'bcc', - 'inreplyto', - 'messageid' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 104 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'subrule' => 'date', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 104 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'subject', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 104 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'from', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 104 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'sender', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 104 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'replyto', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 104 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'to', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 104 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'cc', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 104 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'bcc', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 105 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'inreplyto', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 105 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'messageid', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 105 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 105 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 106, - 'code' => '{ $return = bless {}, "Mail::IMAPClient::BodyStructure::Envelope"; - $return->{$_} = $item{$_} - for qw/date subject from sender replyto to cc/ - , qw/bcc inreplyto messageid/; - 1; - }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'envelopestruct', - 'vars' => '', - 'line' => 104 - }, 'Parse::RecDescent::Rule' ), - 'replyto' => bless( { - 'impcount' => 0, - 'calls' => [ - 'ADDRESSES' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'ADDRESSES', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 100 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'replyto', - 'vars' => '', - 'line' => 100 - }, 'Parse::RecDescent::Rule' ), - 'mailboxname' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NIL', - 'STRING' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NIL', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 78 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'STRING', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 78 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 78 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'mailboxname', - 'vars' => '', - 'line' => 78 - }, 'Parse::RecDescent::Rule' ) - } - }, 'Parse::RecDescent' ); -} \ No newline at end of file diff --git a/Mail-IMAPClient-3.25/lib/Mail/IMAPClient/Thread.pm b/Mail-IMAPClient-3.25/lib/Mail/IMAPClient/Thread.pm deleted file mode 100644 index 67fa663..0000000 --- a/Mail-IMAPClient-3.25/lib/Mail/IMAPClient/Thread.pm +++ /dev/null @@ -1,1014 +0,0 @@ -package Mail::IMAPClient::Thread; -use Parse::RecDescent; - -{ my $ERRORS; - - -package Parse::RecDescent::Mail::IMAPClient::Thread; -use strict; -use vars qw($skip $AUTOLOAD ); -$skip = '\s*'; - - -{ -local $SIG{__WARN__} = sub {0}; -# PRETEND TO BE IN Parse::RecDescent NAMESPACE -*Parse::RecDescent::Mail::IMAPClient::Thread::AUTOLOAD = sub -{ - no strict 'refs'; - $AUTOLOAD =~ s/^Parse::RecDescent::Mail::IMAPClient::Thread/Parse::RecDescent/; - goto &{$AUTOLOAD}; -} -} - -push @Parse::RecDescent::Mail::IMAPClient::Thread::ISA, 'Parse::RecDescent'; -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::Thread::thread -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"thread"}; - - Parse::RecDescent::_trace(q{Trying rule: [thread]}, - Parse::RecDescent::_tracefirst($_[1]), - q{thread}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: ['(' threadmember ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{thread}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{thread}); - %item = (__RULE__ => q{thread}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{thread}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "("; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [threadmember]}, - Parse::RecDescent::_tracefirst($text), - q{thread}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{threadmember})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::Thread::threadmember, 1, 100000000, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{thread}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [threadmember]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{thread}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{threadmember(s)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{thread}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and - substr($text,0,length($_tok)) eq $_tok and - do { substr($text,0,length($_tok)) = ""; 1; } - ) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$_tok; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{thread}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { - $return = $item{'threadmember(s)'}||undef; - }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: ['(' threadmember ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{thread}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{thread}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{thread}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{thread}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{thread}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::Thread::NUMBER -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"NUMBER"}; - - Parse::RecDescent::_trace(q{Trying rule: [NUMBER]}, - Parse::RecDescent::_tracefirst($_[1]), - q{NUMBER}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/\\d+/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{NUMBER}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{NUMBER}); - %item = (__RULE__ => q{NUMBER}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/\\d+/]}, Parse::RecDescent::_tracefirst($text), - q{NUMBER}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:\d+)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/\\d+/]<<}, - Parse::RecDescent::_tracefirst($text), - q{NUMBER}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{NUMBER}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{NUMBER}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{NUMBER}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{NUMBER}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::Thread::start -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"start"}; - - Parse::RecDescent::_trace(q{Trying rule: [start]}, - Parse::RecDescent::_tracefirst($_[1]), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/^\\* THREAD /i thread]}, - Parse::RecDescent::_tracefirst($_[1]), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{start}); - %item = (__RULE__ => q{start}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/^\\* THREAD /i]}, Parse::RecDescent::_tracefirst($text), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:^\* THREAD )//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [thread]}, - Parse::RecDescent::_tracefirst($text), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{thread})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::Thread::thread, 0, 100000000, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [thread]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{thread(s?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { - $return=$item{'thread(s?)'}||undef; -}; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/^\\* THREAD /i thread]<<}, - Parse::RecDescent::_tracefirst($text), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{start}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{start}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{start}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{start}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::Mail::IMAPClient::Thread::threadmember -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"threadmember"}; - - Parse::RecDescent::_trace(q{Trying rule: [threadmember]}, - Parse::RecDescent::_tracefirst($_[1]), - q{threadmember}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NUMBER]}, - Parse::RecDescent::_tracefirst($_[1]), - q{threadmember}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{threadmember}); - %item = (__RULE__ => q{threadmember}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NUMBER]}, - Parse::RecDescent::_tracefirst($text), - q{threadmember}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::Thread::NUMBER($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{threadmember}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NUMBER]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{threadmember}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NUMBER}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{threadmember}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = $item{NUMBER} ; }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [NUMBER]<<}, - Parse::RecDescent::_tracefirst($text), - q{threadmember}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [thread]}, - Parse::RecDescent::_tracefirst($_[1]), - q{threadmember}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{threadmember}); - %item = (__RULE__ => q{threadmember}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [thread]}, - Parse::RecDescent::_tracefirst($text), - q{threadmember}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::Thread::thread($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{threadmember}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [thread]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{threadmember}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{thread}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{threadmember}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = $item{thread} ; }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [thread]<<}, - Parse::RecDescent::_tracefirst($text), - q{threadmember}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{threadmember}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{threadmember}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{threadmember}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{threadmember}, - $tracelevel) - } - $_[1] = $text; - return $return; -} -} -package Mail::IMAPClient::Thread; sub new { my $self = bless( { - '_AUTOTREE' => undef, - 'localvars' => '', - 'startcode' => '', - '_check' => { - 'thisoffset' => '', - 'itempos' => '', - 'prevoffset' => '', - 'prevline' => '', - 'prevcolumn' => '', - 'thiscolumn' => '' - }, - 'namespace' => 'Parse::RecDescent::Mail::IMAPClient::Thread', - '_AUTOACTION' => undef, - 'rules' => { - 'thread' => bless( { - 'impcount' => 0, - 'calls' => [ - 'threadmember' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 180 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'subrule' => 'threadmember', - 'expected' => undef, - 'min' => 1, - 'argcode' => undef, - 'max' => 100000000, - 'matchrule' => 0, - 'repspec' => 's', - 'lookahead' => 0, - 'line' => 180 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 180 - }, 'Parse::RecDescent::InterpLit' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 181, - 'code' => '{ - $return = $item{\'threadmember(s)\'}||undef; - }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'thread', - 'vars' => '', - 'line' => 180 - }, 'Parse::RecDescent::Rule' ), - 'NUMBER' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '\\d+', - 'hashname' => '__PATTERN1__', - 'description' => '/\\\\d+/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 173, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'NUMBER', - 'vars' => '', - 'line' => 171 - }, 'Parse::RecDescent::Rule' ), - 'start' => bless( { - 'impcount' => 0, - 'calls' => [ - 'thread' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '^\\* THREAD ', - 'hashname' => '__PATTERN1__', - 'description' => '/^\\\\* THREAD /i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 186, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'thread', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 100000000, - 'matchrule' => 0, - 'repspec' => 's?', - 'lookahead' => 0, - 'line' => 186 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 186, - 'code' => '{ - $return=$item{\'thread(s?)\'}||undef; -}' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'start', - 'vars' => '', - 'line' => 185 - }, 'Parse::RecDescent::Rule' ), - 'threadmember' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NUMBER', - 'thread' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'NUMBER', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 177 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 177, - 'code' => '{ $return = $item{NUMBER} ; }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'thread', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 178 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 178, - 'code' => '{ $return = $item{thread} ; }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => 177 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'threadmember', - 'vars' => '', - 'line' => 175 - }, 'Parse::RecDescent::Rule' ) - } - }, 'Parse::RecDescent' ); -} \ No newline at end of file diff --git a/Mail-IMAPClient-3.25/prepare_dist b/Mail-IMAPClient-3.25/prepare_dist deleted file mode 100755 index 7c48a65..0000000 --- a/Mail-IMAPClient-3.25/prepare_dist +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/perl - -use warnings; -use strict; - -use Parse::RecDescent 1.94; -use File::Copy qw/move/; - -sub read_file { - my $file = shift; - local( $/, *FH ); - open( FH, $file ) or return undef; - return ; -} - -build_parser 'lib/Mail/IMAPClient/BodyStructure/Parse.grammar' - , 'Mail::IMAPClient::BodyStructure::Parse'; - -build_parser 'lib/Mail/IMAPClient/Thread.grammar' - , 'Mail::IMAPClient::Thread'; - -sub build_parser { - my ($grammarfn, $package) = @_; - - print "* building $package\n"; - - my $grammar = read_file $grammarfn - or die "cannot read grammar from $grammarfn: $!\n"; - - Parse::RecDescent->Precompile($grammar, $package); - - # clumpsy output by Parse::RecDescent - my $outfn = $package . '.pm'; - $outfn =~ s/.*\:\://; - - my $realfn = $grammarfn; - $realfn =~ s/\.\w+$/.pm/; - - move $outfn, $realfn - or die "cannot move $outfn to $realfn: $!\n"; -} diff --git a/Mail-IMAPClient-3.25/sample.perldb b/Mail-IMAPClient-3.25/sample.perldb deleted file mode 100644 index 0c299ec..0000000 --- a/Mail-IMAPClient-3.25/sample.perldb +++ /dev/null @@ -1 +0,0 @@ -&parse_options("NonStop=1 LineInfo=mail_imapclient_db.out"); diff --git a/Mail-IMAPClient-3.25/Changes b/Mail-IMAPClient-3.27/Changes similarity index 96% rename from Mail-IMAPClient-3.25/Changes rename to Mail-IMAPClient-3.27/Changes index 3f57350..267d807 100644 --- a/Mail-IMAPClient-3.25/Changes +++ b/Mail-IMAPClient-3.27/Changes @@ -5,6 +5,74 @@ Changes from 2.99_01 to 3.16 made by Mark Overmeer Changes from 0.09 to 2.99_01 made by David Kernen - Potential compatibility issues from 3.17+ highlighted with '*' +version 3.27: Sun Feb 13 14:37:27 EST 2011 + - rt.cpan.org#65694: migrate fails + [Erik Colson] + - rt.cpan.org#65470: uninitialized warning in message_to_file + [Gilles Lamiral, Mark Hedges] + - rt.cpan.org#61835: (DOC) in LIST context undef may be returned + [Stefan Völkel] + + warn/highlight behavior in docs Errors section + - updated documentation + + migrate() documentation fixed + + moved Custom Authentication Mechanisms toward end + + recommended use of scalar context due to historical API behavior + +version 3.26: Mon Jan 31 22:15:04 EST 2011 + - *require Perl 5.8.1 as constant use is invalid on 5.6 + - rt.cpan.org#63524: fetch_hash() parse errors + [Brian Kroth] + + fixed handling of LITERAL values in response + + fixed handling of field names with a dash (e.g. X-SAVEDATE) + + fetch_hash now uses Escaped_results() method + - *fixed Escaped_results() to properly join LITERAL data with + the data that comes before and after it + - *rt.cpan.org#60945: append_file() does not interpret $date as expected + [Jason Long] + $date should now be 1 (to use the file mtime) or a valid RFC3501 date + - *rt.cpan.org#61292: memory consumption with message_string()/append() + rt.cpan.org#61806: Major problem with one function in IMAPClient + [Gilles Lamiral, Casey Duquette] + + use @_ / $_[] in critical places to avoid pass by + value memory overhead + + use in memory files in a few critical places as that code + path in Mail::IMAPClient is significantly more efficient + with internal memory usage + + *new (undocumented/do-not-use-without-good-reason) + attribute Maxappendstringlength used by append() and + append_string() holds the size (in bytes, default 1 MiB) + that triggers when message SCALAR(s) passed to these + methods will be treated as an in memory file. This + attribute will likely be removed in a future version. + + *append() and append_string() now call append_file() and + use an im memory file when length($message) is greater + than Maxappendstringlength; other minor code cleanup + + *message_string() now calls message_to_file() and uses an + in memory file + + refactor message_to_file() to use internal _imap_uid_command() + + update _read_line() to be more efficient w/CPU in critical + section by pulling isa() checks out of main loop also + conserve memory by not storing an extra copy of LITERAL + data if the data was put into a filehandle from the caller + + Memory/working set (KB) comparison (Perl 5.10 cygwin Win7): + - test: message_string on 6.1M msg and then append 6.1M msg + version | start | after message_string | after append + --------+-------+----------------------+------------- + 2.2.9 | 7624 | 74404 | 131896 + 3.25 | 7716 | 74408 | 156532 + 3.26 | 7684 | 33372 | 42608 + - minor arg cleanup of noop() and tag_and_run() + - rt.cpan.org#63444: relax get_envelope(), allow empty reply-to + [Nikolay Kravchenko] + - rt.cpan.org#61068: append_string can invalidate a good $date + - rt.cpan.org#60045: Logout error if delay between BYE and tagged OK + [Armin Wolfermann] + no longer set an error when this happens + - rt.cpan.org#61062: migrate() errors + [Johan Ekenberg] + + rewrote migrate() to be functional and simple + - Update README and cleanup several old or out of date files + version 3.25: Fri May 28 00:07:40 EDT 2010 - fix body_string parsing bug and added tests in t/body_string.t [Heiko Schlittermann] diff --git a/Mail-IMAPClient-3.25/MANIFEST b/Mail-IMAPClient-3.27/MANIFEST similarity index 96% rename from Mail-IMAPClient-3.25/MANIFEST rename to Mail-IMAPClient-3.27/MANIFEST index 073372d..7443b83 100644 --- a/Mail-IMAPClient-3.25/MANIFEST +++ b/Mail-IMAPClient-3.27/MANIFEST @@ -1,10 +1,7 @@ -COPYRIGHT Changes -INSTALL MANIFEST Makefile.PL README -TODO examples/build_dist.pl examples/build_ldif.pl examples/cleanTest.pl @@ -30,7 +27,6 @@ lib/Mail/IMAPClient/Thread.grammar lib/Mail/IMAPClient/Thread.pm lib/Mail/IMAPClient/Thread.pod prepare_dist -sample.perldb t/basic.t t/body_string.t t/bodystructure.t diff --git a/Mail-IMAPClient-3.25/META.yml b/Mail-IMAPClient-3.27/META.yml similarity index 93% rename from Mail-IMAPClient-3.25/META.yml rename to Mail-IMAPClient-3.27/META.yml index 05bd247..39692f1 100644 --- a/Mail-IMAPClient-3.25/META.yml +++ b/Mail-IMAPClient-3.27/META.yml @@ -1,6 +1,6 @@ --- #YAML:1.0 name: Mail-IMAPClient -version: 3.25 +version: 3.27 abstract: IMAP4 client library author: - Phil Pearl (Lobbes) @@ -22,6 +22,7 @@ requires: List::Util: 0 MIME::Base64: 0 Parse::RecDescent: 1.94 + perl: 5.008 Test::More: 0 no_index: directory: diff --git a/Mail-IMAPClient-3.25/Makefile.PL b/Mail-IMAPClient-3.27/Makefile.PL similarity index 93% rename from Mail-IMAPClient-3.25/Makefile.PL rename to Mail-IMAPClient-3.27/Makefile.PL index 51ae415..82ce861 100644 --- a/Mail-IMAPClient-3.25/Makefile.PL +++ b/Mail-IMAPClient-3.27/Makefile.PL @@ -2,6 +2,8 @@ use ExtUtils::MakeMaker; use warnings; use strict; +use 5.008_001; + my @missing; my %optional = ( "Authen::NTLM" => { for => "Authmechanism 'NTLM'" }, @@ -35,11 +37,12 @@ MSG } WriteMakefile( - NAME => 'Mail::IMAPClient', - , - ABSTRACT => 'IMAP4 client library', - VERSION_FROM => 'lib/Mail/IMAPClient.pm', - PREREQ_PM => { + NAME => 'Mail::IMAPClient', + AUTHOR => 'Phil Pearl (Lobbes) ', + ABSTRACT => 'IMAP4 client library', + VERSION_FROM => 'lib/Mail/IMAPClient.pm', + MIN_PERL_VERSION => '5.008', + PREREQ_PM => { 'Carp' => 0, 'Errno' => 0, 'Fcntl' => 0, @@ -54,10 +57,6 @@ WriteMakefile( 'File::Temp' => 0, }, clean => { FILES => 'test.txt' }, - $] >= 5.005 - ? ## keywords supported since 5.005 - ( AUTHOR => 'Phil Pearl (Lobbes) ' ) - : () ); set_test_data(); diff --git a/Mail-IMAPClient-3.27/README b/Mail-IMAPClient-3.27/README new file mode 100644 index 0000000..26a65fb --- /dev/null +++ b/Mail-IMAPClient-3.27/README @@ -0,0 +1,76 @@ +Mail::IMAPClient +================ +Mail::IMAPClient is a Perl module that provides an interface for +communicating with an IMAP server as an IMAP client. + +DEPENDENCIES +============ +The following are the minimum requirements for using Mail::IMAPClient: + +- Perl 5.8 + http://www.perl.org/ +- Perl modules from CPAN: + http://search.cpan.org/ + Required: + List::Util + MIME::Base64 + Parse::RecDescent + Optional: + Authen::NTLM + Authen::SASL + Digest::HMAC_MD5 + Digest::MD5 + IO::Socket::SSL +- RFC 3501 (IMAP4REV1) compatible IMAP server + http://www.faqs.org/rfcs/rfc3501.html +- Mail::IMAPClient (this package) + +INSTALLATION +============ +1. Download Mail::IMAPClient module + http://search.cpan.org/dist/Mail-IMAPClient/ + +2. Read this README + +3. This module has a number of dependencies on other Perl modules + available from CPAN. If any modules are missing, appropriate + warnings will be generated in the following step. + +4. Prepare to build this module and install any prerequisite modules: + + perl Makefile.PL + +5. Build, test and install this module: + + make + make test + (sudo) make install + +6. Read the documentation to become familiar with this module. + +Project Links +============= +- Bugs/tickets: + http://rt.cpan.org/Public/Dist/Display.html?Name=Mail-IMAPClient +- Source code repository (git): + http://sourceforge.net/p/mail-imapclient/git/ +- CPAN releases: + http://search.cpan.org/dist/Mail-IMAPClient/ +- Project website + http://mail-imapclient.sf.net/ + +COPYRIGHT AND LICENSE +===================== +Copyright (C) 1999-2003 The Kernen Group, Inc. +Copyright (C) 2007-2009 Mark Overmeer +Copyright (C) 2010-2011 Phil Pearl (Lobbes) +All rights reserved. + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself, either Perl version 5.8.0 or, +at your option, any later version of Perl 5 you may have available. + +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 either the +GNU General Public License or the Artistic License for more details. diff --git a/Mail-IMAPClient-3.25/examples/build_dist.pl b/Mail-IMAPClient-3.27/examples/build_dist.pl similarity index 96% rename from Mail-IMAPClient-3.25/examples/build_dist.pl rename to Mail-IMAPClient-3.27/examples/build_dist.pl index d51dc5f..7848194 100755 --- a/Mail-IMAPClient-3.25/examples/build_dist.pl +++ b/Mail-IMAPClient-3.27/examples/build_dist.pl @@ -1,5 +1,5 @@ #!/usr/local/bin/perl -#$Id: //depot/main/ZimbraPS/Mail-IMAPClient/examples/build_dist.pl#1 $ +#$Id$ use Mail::IMAPClient; @@ -132,7 +132,7 @@ All rights reserved. =cut -# $Id: //depot/main/ZimbraPS/Mail-IMAPClient/examples/build_dist.pl#1 $ +# $Id$ # $Log: build_dist.pl,v $ # Revision 19991216.7 2003/06/12 21:38:29 dkernen # diff --git a/Mail-IMAPClient-3.25/examples/build_ldif.pl b/Mail-IMAPClient-3.27/examples/build_ldif.pl similarity index 97% rename from Mail-IMAPClient-3.25/examples/build_ldif.pl rename to Mail-IMAPClient-3.27/examples/build_ldif.pl index aea17ec..72e8d8d 100755 --- a/Mail-IMAPClient-3.25/examples/build_ldif.pl +++ b/Mail-IMAPClient-3.27/examples/build_ldif.pl @@ -1,5 +1,5 @@ #!/usr/local/bin/perl -#$Id: //depot/main/ZimbraPS/Mail-IMAPClient/examples/build_ldif.pl#1 $ +#$Id$ use Mail::IMAPClient; use MIME::Lite; use Data::Dumper; @@ -180,7 +180,7 @@ All rights reserved. =cut -# $Id: //depot/main/ZimbraPS/Mail-IMAPClient/examples/build_ldif.pl#1 $ +# $Id$ # $Log: build_ldif.pl,v $ # Revision 19991216.11 2003/06/12 21:38:30 dkernen # diff --git a/Mail-IMAPClient-3.25/examples/cleanTest.pl b/Mail-IMAPClient-3.27/examples/cleanTest.pl similarity index 100% rename from Mail-IMAPClient-3.25/examples/cleanTest.pl rename to Mail-IMAPClient-3.27/examples/cleanTest.pl diff --git a/Mail-IMAPClient-3.25/examples/copy_folder.pl b/Mail-IMAPClient-3.27/examples/copy_folder.pl similarity index 98% rename from Mail-IMAPClient-3.25/examples/copy_folder.pl rename to Mail-IMAPClient-3.27/examples/copy_folder.pl index bfa9d2a..93193b2 100755 --- a/Mail-IMAPClient-3.25/examples/copy_folder.pl +++ b/Mail-IMAPClient-3.27/examples/copy_folder.pl @@ -1,5 +1,5 @@ #!/usr/local/bin/perl -#$Id: //depot/main/ZimbraPS/Mail-IMAPClient/examples/copy_folder.pl#1 $ +#$Id$ ++$|; use Getopt::Std; use Mail::IMAPClient; diff --git a/Mail-IMAPClient-3.25/examples/cyrus_expire.pl b/Mail-IMAPClient-3.27/examples/cyrus_expire.pl similarity index 100% rename from Mail-IMAPClient-3.25/examples/cyrus_expire.pl rename to Mail-IMAPClient-3.27/examples/cyrus_expire.pl diff --git a/Mail-IMAPClient-3.25/examples/cyrus_expunge.pl b/Mail-IMAPClient-3.27/examples/cyrus_expunge.pl similarity index 96% rename from Mail-IMAPClient-3.25/examples/cyrus_expunge.pl rename to Mail-IMAPClient-3.27/examples/cyrus_expunge.pl index 0016258..2921832 100755 --- a/Mail-IMAPClient-3.25/examples/cyrus_expunge.pl +++ b/Mail-IMAPClient-3.27/examples/cyrus_expunge.pl @@ -1,5 +1,5 @@ #!/usr/local/bin/perl -#$Id: //depot/main/ZimbraPS/Mail-IMAPClient/examples/cyrus_expunge.pl#1 $ +#$Id$ use Mail::IMAPClient; use IO::File; diff --git a/Mail-IMAPClient-3.25/examples/find_dup_msgs.pl b/Mail-IMAPClient-3.27/examples/find_dup_msgs.pl similarity index 98% rename from Mail-IMAPClient-3.25/examples/find_dup_msgs.pl rename to Mail-IMAPClient-3.27/examples/find_dup_msgs.pl index 1e4d8ea..21b41b8 100755 --- a/Mail-IMAPClient-3.25/examples/find_dup_msgs.pl +++ b/Mail-IMAPClient-3.27/examples/find_dup_msgs.pl @@ -1,5 +1,5 @@ #!/usr/local/bin/perl -# $Id: //depot/main/ZimbraPS/Mail-IMAPClient/examples/find_dup_msgs.pl#1 $ +# $Id$ use Mail::IMAPClient; use Mozilla::LDAP::Conn; diff --git a/Mail-IMAPClient-3.25/examples/idle.pl b/Mail-IMAPClient-3.27/examples/idle.pl similarity index 100% rename from Mail-IMAPClient-3.25/examples/idle.pl rename to Mail-IMAPClient-3.27/examples/idle.pl diff --git a/Mail-IMAPClient-3.25/examples/imap_to_mbox.pl b/Mail-IMAPClient-3.27/examples/imap_to_mbox.pl similarity index 98% rename from Mail-IMAPClient-3.25/examples/imap_to_mbox.pl rename to Mail-IMAPClient-3.27/examples/imap_to_mbox.pl index a617698..61acfe7 100755 --- a/Mail-IMAPClient-3.25/examples/imap_to_mbox.pl +++ b/Mail-IMAPClient-3.27/examples/imap_to_mbox.pl @@ -6,7 +6,7 @@ # DESC: Reads a users IMAP folders, and converts them to mbox # Good for an interim switch-over from say, Exchange to Cyrus IMAP. -# $Header: //depot/main/ZimbraPS/Mail-IMAPClient/examples/imap_to_mbox.pl#1 $ +# $Header$ # History: # -------- diff --git a/Mail-IMAPClient-3.25/examples/imtestExample.pl b/Mail-IMAPClient-3.27/examples/imtestExample.pl similarity index 100% rename from Mail-IMAPClient-3.25/examples/imtestExample.pl rename to Mail-IMAPClient-3.27/examples/imtestExample.pl diff --git a/Mail-IMAPClient-3.25/examples/migrate_mail2.pl b/Mail-IMAPClient-3.27/examples/migrate_mail2.pl similarity index 99% rename from Mail-IMAPClient-3.25/examples/migrate_mail2.pl rename to Mail-IMAPClient-3.27/examples/migrate_mail2.pl index d656ae5..df3b673 100755 --- a/Mail-IMAPClient-3.25/examples/migrate_mail2.pl +++ b/Mail-IMAPClient-3.27/examples/migrate_mail2.pl @@ -1,5 +1,5 @@ #!/usr/local/bin/perl -#$Id: //depot/main/ZimbraPS/Mail-IMAPClient/examples/migrate_mail2.pl#1 $ +#$Id$ # # An example of how to migrate from a Netscape server # (which uses a slash as a separator and which does diff --git a/Mail-IMAPClient-3.25/examples/migrate_mbox.pl b/Mail-IMAPClient-3.27/examples/migrate_mbox.pl similarity index 97% rename from Mail-IMAPClient-3.25/examples/migrate_mbox.pl rename to Mail-IMAPClient-3.27/examples/migrate_mbox.pl index 59b71bf..1b5129a 100755 --- a/Mail-IMAPClient-3.25/examples/migrate_mbox.pl +++ b/Mail-IMAPClient-3.27/examples/migrate_mbox.pl @@ -4,7 +4,7 @@ # Note that the migrate method is considered experimental and should # be used with caution. # -#$Id: //depot/main/ZimbraPS/Mail-IMAPClient/examples/migrate_mbox.pl#1 $ +#$Id$ # use Mail::IMAPClient; diff --git a/Mail-IMAPClient-3.25/examples/populate_mailbox.pl b/Mail-IMAPClient-3.27/examples/populate_mailbox.pl similarity index 98% rename from Mail-IMAPClient-3.25/examples/populate_mailbox.pl rename to Mail-IMAPClient-3.27/examples/populate_mailbox.pl index b612de2..0622c9f 100755 --- a/Mail-IMAPClient-3.25/examples/populate_mailbox.pl +++ b/Mail-IMAPClient-3.27/examples/populate_mailbox.pl @@ -1,5 +1,5 @@ #!/usr/local/bin/perl -#$Id: //depot/main/ZimbraPS/Mail-IMAPClient/examples/populate_mailbox.pl#1 $ # +#$Id$ # use Time::Local ; use FileHandle ; use File::Copy ; @@ -256,7 +256,7 @@ All rights reserved. =cut -# $Id: //depot/main/ZimbraPS/Mail-IMAPClient/examples/populate_mailbox.pl#1 $ +# $Id$ # $Log: populate_mailbox.pl,v $ # Revision 19991216.8 2003/06/12 21:38:34 dkernen # diff --git a/Mail-IMAPClient-3.25/examples/sharedFolder.pl b/Mail-IMAPClient-3.27/examples/sharedFolder.pl similarity index 96% rename from Mail-IMAPClient-3.25/examples/sharedFolder.pl rename to Mail-IMAPClient-3.27/examples/sharedFolder.pl index 96666cc..dca8e38 100755 --- a/Mail-IMAPClient-3.25/examples/sharedFolder.pl +++ b/Mail-IMAPClient-3.27/examples/sharedFolder.pl @@ -1,5 +1,5 @@ #!/usr/local/bin/perl -#$Id: //depot/main/ZimbraPS/Mail-IMAPClient/examples/sharedFolder.pl#1 $ +#$Id$ use Mail::IMAPClient; use Getopt::Std; diff --git a/Mail-IMAPClient-3.25/lib/Mail/IMAPClient.pm b/Mail-IMAPClient-3.27/lib/Mail/IMAPClient.pm similarity index 83% rename from Mail-IMAPClient-3.25/lib/Mail/IMAPClient.pm rename to Mail-IMAPClient-3.27/lib/Mail/IMAPClient.pm index 122fa82..b465dbe 100644 --- a/Mail-IMAPClient-3.25/lib/Mail/IMAPClient.pm +++ b/Mail-IMAPClient-3.27/lib/Mail/IMAPClient.pm @@ -1,17 +1,18 @@ # _{name} methods are undocumented and meant to be private. +require 5.008_001; + use strict; use warnings; package Mail::IMAPClient; -our $VERSION = '3.25'; +our $VERSION = '3.27'; use Mail::IMAPClient::MessageSet; use IO::Socket qw(:crlf SOL_SOCKET SO_KEEPALIVE); use IO::Select (); -use IO::File (); use Carp qw(carp); #local $SIG{__WARN__} = \&Carp::cluck; #DEBUG use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK); @@ -84,10 +85,10 @@ BEGIN { foreach my $datum ( qw(Authcallback Authmechanism Authuser Buffer Count Debug Debug_fh Domain Folder Ignoresizeerrors Keepalive - Maxcommandlength Maxtemperrors Password Peek Port - Prewritemethod Proxy Ranges Readmethod Reconnectretry - Server Showcredentials State Supportedflags Timeout Uid - User Ssl Starttls) + Maxappendstringlength Maxcommandlength Maxtemperrors + Password Peek Port Prewritemethod Proxy Ranges Readmethod + Reconnectretry Server Showcredentials Ssl Starttls State + Supportedflags Timeout Uid User) ) { no strict 'refs'; @@ -252,19 +253,20 @@ sub _remove_doubles(@) { sub new { my $class = shift; my $self = { - LastError => "", - Uid => 1, - Count => 0, - Fast_io => 1, - Clear => 5, - Keepalive => 0, - Maxcommandlength => 1000, - Maxtemperrors => undef, - State => Unconnected, - Authmechanism => 'LOGIN', - Port => 143, - Timeout => 600, - History => {}, + LastError => "", + Uid => 1, + Count => 0, + Fast_io => 1, + Clear => 2, + Keepalive => 0, + Maxappendstringlength => 1024**2, + Maxcommandlength => 1000, + Maxtemperrors => undef, + State => Unconnected, + Authmechanism => 'LOGIN', + Port => 143, + Timeout => 600, + History => {}, }; while (@_) { my $k = ucfirst lc shift; @@ -457,7 +459,7 @@ sub login { } sub noop { - my ( $self, $user ) = @_; + my ($self) = @_; $self->_imap_command("NOOP") ? $self->Results : undef; } @@ -728,10 +730,8 @@ sub message_string { my $peek = $self->Peek ? '.PEEK' : ''; my $cmd = $self->imap4rev1 ? "BODY$peek\[]" : "RFC822$peek"; - $self->fetch( $msg, $cmd ) - or return undef; - - my $string = $self->_transaction_literals; + my $string; + $self->message_to_file( \$string, $msg ); unless ( $self->Ignoresizeerrors ) { # Check size with expected size my $expected_size = $self->size($msg); @@ -773,47 +773,41 @@ sub bodypart_string { $self->_transaction_literals; } +# message_to_file( $self, $file, @msgs ) sub message_to_file { - my $self = shift; - my $fh = shift; - my $msgs = join ',', @_; + my ( $self, $file, @msgs ) = @_; - my $handle; - if ( ref $fh ) { $handle = $fh } + # $file can be a name or a scalar reference (for in memory file) + # avoid IO::File bug handling scalar refs in perl <= 5.8.8? + # - buggy: $fh = IO::File->new( $file, 'r' ) + my $fh; + if ( ref $file and ref $file ne "SCALAR" ) { + $fh = $file; + } else { - $handle = IO::File->new(">>$fh"); - unless ( defined($handle) ) { - $self->LastError("Unable to open $fh: $!"); + $$file = "" if ( ref $file eq "SCALAR" and !defined $$file ); + open( $fh, ">>", $file ); + unless ( defined($fh) ) { + $self->LastError("Unable to open file '$file': $!"); return undef; } - binmode $handle; # For those of you who need something like this... } - my $clear = $self->Clear; - $self->Clear($clear) - if $self->Count >= $clear && $clear > 0; + binmode($fh); - return undef unless defined $self->imap4rev1; - my $peek = $self->Peek ? '.PEEK' : ''; - my $cmd = $self->imap4rev1 ? "BODY$peek\[]" : "RFC822$peek"; - - my $uid = $self->Uid ? "UID " : ""; - my $trans = $self->Count( $self->Count + 1 ); - my $string = "$trans ${uid}FETCH $msgs $cmd"; - - $self->_record( $trans, [ 0, "INPUT", $string ] ); - - my $feedback = $self->_send_line($string); - unless ($feedback) { - $self->LastError( "Error sending '$string': " . $self->LastError ); + unless (@msgs) { + $self->LastError("message_to_file: NO messages specified!"); return undef; } - # look for " (OK|BAD|NO)" - my $code = $self->_get_response( { outref => $handle }, $trans ) - or return undef; + my $peek = $self->Peek ? '.PEEK' : ''; + $peek = sprintf( $self->imap4rev1 ? "BODY%s\[]" : "RFC822%s", $peek ); - return $code eq 'OK' ? $self : undef; + my @args = ( join( ",", @msgs ), $peek ); + + return $self->_imap_uid_command( { outref => $fh }, "FETCH" => @args ) + ? $self + : undef; } sub message_uid { @@ -826,305 +820,77 @@ sub message_uid { return undef; } -#???? this code is very clumsy, and currently probably broken. -# Why not use a pipe??? -# Is a quadratic slowdown not much simpler and better??? -# Shouldn't the slowdowns extend over multiple messages? -# --> create clean read and write methods - +# cleaned up and simplified but see TODO in code... sub migrate { my ( $self, $peer, $msgs, $folder ) = @_; - my $toSock = $peer->Socket, my $fromSock = $self->Socket; - my $bufferSize = $self->Buffer || 4096; - - local $SIG{PIPE} = 'IGNORE'; # avoid SIGPIPE on syswrite, handle as error unless ( $peer and $peer->IsConnected ) { - $self->LastError( "Invalid or unconnected peer " + $self->LastError( ( $peer ? "Invalid" : "Unconnected" ) + . " target " . ref($self) - . " object used as target for migrate. $@" ); + . " object in migrate()" + . ( $peer ? ( ": " . $peer->LastError ) : "" ) ); return undef; } - unless ($folder) { - unless ( $folder = $self->Folder ) { - $self->LastError("No folder selected on source mailbox."); - return undef; - } - - unless ( $peer->exists($folder) || $peer->create($folder) ) { - $self->LastError( "Unable to create folder '$folder' on target " - . "mailbox: " - . $peer->LastError ); - return undef; - } + # sanity check to see if $self is same object as $peer + if ( $self eq $peer ) { + $self->LastError("dest must not be the same object as self"); + return undef; } - defined $msgs or $msgs = "ALL"; - $msgs = $self->search("ALL") - if uc $msgs eq 'ALL'; - return undef unless defined $msgs; + $folder = $self->Folder unless ( defined $folder ); + unless ($folder) { + $self->LastError("No folder selected on source mailbox."); + return undef; + } - my $range = $self->Range($msgs); - my $clear = $self->Clear; + unless ( $peer->exists($folder) or $peer->create($folder) ) { + $self->LastError( "Create folder '$folder' on target host failed: " + . $peer->LastError ); + return undef; + } + + if ( !defined $msgs or uc($msgs) eq "ALL" ) { + $msgs = $self->search("ALL") or return undef; + } + + # message size and (internal) date + my @headers = qw(RFC822.SIZE INTERNALDATE FLAGS); + my $range = $self->Range($msgs); + + $self->_debug("Messages to migrate from '$folder': $range"); - $self->_debug("Migrating the following msgs from $folder: $range"); - MSG: foreach my $mid ( $range->unfold ) { - $self->_debug("Migrating message $mid in folder $folder"); - my $leftSoFar = my $size = $self->size($mid); - return undef unless defined $size; + # fetch size internaldate and flags of original message + # - TODO: add flags here... + my $minfo = $self->fetch_hash( $mid, @headers ) + or return undef; - # fetch internaldate and flags of original message: - my $intDate = $self->internaldate($mid); - return undef unless defined $intDate; + my ( $size, $date ) = @{ $minfo->{$mid} }{@headers}; + return undef unless ( defined $size and defined $date ); + + $self->_debug("Copy message $mid (sz=$size,dt=$date) from '$folder'"); my @flags = grep !/\\Recent/i, $self->flags($mid); my $flags = join ' ', $peer->supported_flags(@flags); - # set up transaction numbers for from and to connections: - my $trans = $self->Count( $self->Count + 1 ); - my $ptrans = $peer->Count( $peer->Count + 1 ); + # TODO: - use File::Temp tempfile if $msg > bufferSize? + # read message to $msg + my $msg; + $self->message_to_file( \$msg, $mid ) + or return undef; - # If msg size is less than buffersize then do whole msg in one - # transaction: - if ( $size <= $bufferSize ) { - my $new_mid = - $peer->append_string( $folder, $self->message_string($mid), - $flags, $intDate ); + my $newid = $peer->append_file( $folder, \$msg, undef, $flags, $date ); - unless ( defined $new_mid ) { - $self->LastError( "Unable to append to $folder " - . "on target mailbox. " - . $peer->LastError ); - return undef; - } - - $self->_debug( "Copied message $mid in folder $folder to " - . $peer->User . '@' - . $peer->Server - . ". New message UID is $new_mid" ) - if $self->Debug; - - $peer->_debug( "Copied message $mid in folder $folder from " - . $self->User . '@' - . $self->Server - . ". New message UID is $new_mid" ) - if $peer->Debug; - - next MSG; - } - - # otherwise break it up into digestible pieces: - return undef unless defined $self->imap4rev1; - my ( $cmd, $extract_size ); - if ( $self->imap4rev1 ) { - $cmd = $self->Peek ? 'BODY.PEEK[]' : 'BODY[]'; - $extract_size = sub { $_[0] =~ /\(.*BODY\[\]<\d+> \{(\d+)\}/i; $1 }; - } - else { - $cmd = $self->Peek ? 'RFC822.PEEK' : 'RFC822'; - $extract_size = sub { $_[0] =~ /\(RFC822\[\]<\d+> \{(\d+)\}/i; $1 }; - } - - # Now let's warn the peer that there's a message coming: - my $pstring = - "$ptrans APPEND " - . $self->Massage($folder) - . ( length $flags ? " ($flags)" : '' ) - . qq( "$intDate" {$size}); - - $self->_debug("About to issue APPEND command to peer for msg $mid"); - - $peer->_record( $ptrans, [ 0, "INPUT", $pstring ] ); - unless ( $peer->_send_line($pstring) ) { - $self->LastError( "Error sending '$pstring': " . $self->LastError ); + unless ( defined $newid ) { + $self->LastError( + "Append to '$folder' on target failed: " . $peer->LastError ); return undef; } - # Get the "+ Go ahead" response: - my $code; - until ( defined $code ) { - my $readSoFar = 0; - my $fromBuffer = ''; - $readSoFar += sysread( $toSock, $fromBuffer, 1, $readSoFar ) || 0 - until $fromBuffer =~ /$CRLF/o; - - $code = - $fromBuffer =~ /^\+/ ? 'OK' - : $fromBuffer =~ /^\d+\s+(BAD|NO|OK)\b/ ? $1 - : undef; - - $peer->_debug("$folder: received $fromBuffer from server"); - - if ( $fromBuffer =~ /^(\*\s+BYE.*?)$CR?$LF/oi ) { - $self->State(Unconnected); - $self->LastError($1); - return undef; - } - - # ... and log it in the history buffers - $self->_record( - $trans, - [ - 0, - "OUTPUT", -"Mail::IMAPClient migrating message $mid to $peer->User\@$peer->Server" - ] - ); - $peer->_record( $ptrans, [ 0, "OUTPUT", $fromBuffer ] ); - } - - if ( $code ne 'OK' ) { - $self->_debug("Error writing to target host: $@"); - next MIGMSG; - } - - # Here is where we start sticking in UID if that parameter - # is turned on: - my $string = ( $self->Uid ? "UID " : "" ) . "FETCH $mid $cmd"; - - # Clean up history buffer if necessary: - $self->Clear($clear) - if $self->Count >= $clear && $clear > 0; - - # position will tell us how far from beginning of msg the - # next IMAP FETCH should start (1st time start at offset zero): - my $position = 0; - my $chunkCount = 0; - my $readSoFar = 0; - while ( $leftSoFar > 0 ) { - my $take = min $leftSoFar, $bufferSize; - my $newstring = "$trans $string<$position.$take>"; - - $self->_record( $trans, [ 0, "INPUT", $newstring ] ); - $self->_debug("Issuing migration command: $newstring"); - - unless ( $self->_send_line($newstring) ) { - $self->LastError( "Error sending '$newstring' to source IMAP: " - . $self->LastError ); - return undef; - } - - my $chunk; - my $fromBuffer = ""; - until ( $chunk = $extract_size->($fromBuffer) ) { - $fromBuffer = ''; - sysread( $fromSock, $fromBuffer, 1, length $fromBuffer ) - until $fromBuffer =~ /$CRLF$/o; - - $self->_record( $trans, [ 0, "OUTPUT", $fromBuffer ] ); - - if ( $fromBuffer =~ /^$trans\s+(?:NO|BAD)/ ) { - $self->LastError($fromBuffer); - next MIGMSG; - } - elsif ( $fromBuffer =~ /^$trans\s+OK/ ) { - $self->LastError( "Unexpected good return code " - . "from source host: $fromBuffer" ); - next MIGMSG; - } - } - - $fromBuffer = ""; - while ( $readSoFar < $chunk ) { - $readSoFar += - sysread( $fromSock, $fromBuffer, $chunk - $readSoFar, - $readSoFar ) - || 0; - } - - my $wroteSoFar = 0; - my $temperrs = 0; - my $waittime = .02; - my $maxwrite = 0; - my $maxagain = $self->Maxtemperrors; - undef $maxagain if $maxagain and lc($maxagain) eq 'unlimited'; - my @previous_writes; - - while ( $wroteSoFar < $chunk ) { - while ( $wroteSoFar < $readSoFar ) { - my $ret = - syswrite( $toSock, $fromBuffer, $chunk - $wroteSoFar, - $wroteSoFar ); - - if ( defined $ret ) { - $wroteSoFar += $ret; - $maxwrite = max $maxwrite, $ret; - $temperrs = 0; - } - - if ( $! == EPIPE or $! == ECONNRESET ) { - $self->State(Unconnected); - $self->LastError("Write failed '$!'"); - return undef; - } - - if ( $! == EAGAIN || $ret == 0 ) { - if ( defined $maxagain && $temperrs++ > $maxagain ) { - $self->LastError("Persistent error '$!'"); - return undef; - } - - $waittime = $self->_optimal_sleep( $maxwrite, $waittime, - \@previous_writes ); - next; - } - - $self->State(Unconnected) - if ( $! == EPIPE or $! == ECONNRESET ); - $self->LastError("Write failed '$!'"); - return; # no luck - } - - $peer->_debug( - "Chunk $chunkCount: wrote $wroteSoFar (of $chunk)"); - } - } - - $position += $readSoFar; - $leftSoFar -= $readSoFar; - my $fromBuffer = ""; - - # Finish up reading the server fetch response from the source system: - # look for " (OK|BAD|NO)" - $self->_debug("Reading from source: expecting 'OK' response"); - $code = $self->_get_response($trans) or return undef; - return undef unless $code eq 'OK'; - - # Now let's send a CRLF to the peer to signal end of APPEND cmd: - unless ( $peer->_send_bytes( \$CRLF ) ) { - $self->LastError( "Error appending CRLF: " . $self->LastError ); - return undef; - } - - # Finally, let's get the new message's UID from the peer: - # look for " (OK|BAD|NO)" - $peer->_debug("Reading from target: expect new uid in response"); - $code = $peer->_get_response($ptrans) or return undef; - - my $new_mid = "unknown"; - if ( $code eq 'OK' ) { - my $data = join '', $self->Results; - - # look for something like return size or self if no size found: - # OK [APPENDUID ] APPEND completed - my $ret = $data =~ m#\s+(\d+)\]# ? $1 : undef; - $new_mid = $ret; - } - - if ( $self->Debug ) { - $self->_debug( "Copied message $mid in folder $folder to " - . $peer->User . '@' - . $peer->Server - . ". New Message UID is $new_mid" ); - - $peer->_debug( "Copied message $mid in folder $folder from " - . $self->User . '@' - . $self->Server - . ". New Message UID is $new_mid" ); - } + $self->_debug("Copied UID $mid in '$folder' to target UID $newid"); } return $self; @@ -1195,7 +961,7 @@ sub body_string { until ( $popped && $popped =~ /^\)$CRLF$/o ) || !grep /^\)$CRLF$/o, @$ref; - if ( $head =~ /BODY\[TEXT\]\s*$/i ) { # Next line is a literal + if ( $head =~ /BODY\[TEXT\]\s*$/i ) { # Next line is a literal $string .= shift @$ref while @$ref; $self->_debug("String is now $string") if $self->Debug; @@ -1273,9 +1039,10 @@ sub done { return $self->Results; } +# tag_and_run( $self, $string, $good ) sub tag_and_run { - my ( $self, $string, $good ) = @_; - $self->_imap_command( $string, $good ) or return undef; + my $self = shift; + $self->_imap_command(@_) or return undef; return $self->Results; } @@ -1365,12 +1132,15 @@ sub _imap_command { # addcrlf => 0|1 - suppress adding CRLF to $string # addtag => 0|1 - suppress adding $tag to $string # tag => $tag - use this $tag instead of incrementing $self->Count +# outref => ... - see _get_response() sub _imap_command_do { my $self = shift; my $opt = ref( $_[0] ) eq "HASH" ? shift : {}; my $string = shift or return undef; my $good = shift; + my @gropt = ( $opt->{outref} ? { outref => $opt->{outref} } : () ); + $opt->{addcrlf} = 1 unless exists $opt->{addcrlf}; $opt->{addtag} = 1 unless exists $opt->{addtag}; @@ -1403,7 +1173,7 @@ sub _imap_command_do { } # look for " (OK|BAD|NO|$good)" (or "+..." if $good is '+') - my $code = $self->_get_response( $tag, $good ) or return undef; + my $code = $self->_get_response( @gropt, $tag, $good ) or return undef; if ( $code eq 'OK' ) { return $self; @@ -1428,7 +1198,9 @@ sub _get_response { # tag can be a ref (compiled regex) or we quote it or default to \S+ my $qtag = ref($tag) ? $tag : defined($tag) ? quotemeta($tag) : qr/\S+/; my $qgood = ref($good) ? $good : defined($good) ? quotemeta($good) : undef; - my @readopt = defined( $opt->{outref} ) ? ( $opt->{outref} ) : (); + + my $outref = $opt->{outref}; + my @readopt = defined($outref) ? ($outref) : (); my ( $count, $out, $code, $byemsg ) = ( $self->Count, [], undef, undef ); until ( defined($code) ) { @@ -1467,10 +1239,15 @@ sub _get_response { $code =~ s/$CR?$LF?$//o; $code = uc($code) unless ( $good and $code eq $good ); - # on successful LOGOUT $code is OK (not BYE!) see RFC 3501 sect 7.1.5 + # RFC 3501 7.1.5: $code on successful LOGOUT is OK not BYE + # sometimes we may fail to wait long enough to read a tagged + # OK so don't be strict about setting an error on LOGOUT! if ( $code eq 'BYE' ) { $self->State(Unconnected); - $self->LastError($byemsg) if $byemsg; + if ($byemsg) { + $self->LastError($byemsg) + unless ( $good and $code eq $good ); + } } } elsif ( !$self->LastError ) { @@ -1482,10 +1259,13 @@ sub _get_response { } sub _imap_uid_command { - my ( $self, $cmd ) = ( shift, shift ); + my $self = shift; + my @opt = ref( $_[0] ) eq "HASH" ? (shift) : (); + my $cmd = shift; + my $args = @_ ? join( " ", '', @_ ) : ''; my $uid = $self->Uid ? 'UID ' : ''; - $self->_imap_command("$uid$cmd$args"); + $self->_imap_command( @opt, "$uid$cmd$args" ); } sub run { @@ -1519,7 +1299,7 @@ sub _record { # _send_line handles literal data and supports the Prewritemethod sub _send_line { - my ( $self, $string, $suppress ) = ( shift, shift, shift ); + my ( $self, $string, $suppress ) = @_; $string =~ s/$CR?$LF?$/$CRLF/o unless $suppress; @@ -1595,22 +1375,21 @@ sub _send_bytes($) { } # _read_line: read one line from the socket - -# It is also re-implemented in: message_to_file # -# $output = $self->_read_line($literal_callback, $output_callback) -# Both input arguments are optional, but if supplied must either +# $output = $self->_read_line($literal_callback) +# literal_callback is optional, but if supplied it must be either # be a filehandle, coderef, or undef. # -# Returned argument is a reference to an array of arrays, ie: +# Returns a reference to an array of arrays, i.e.: # $output = [ -# [ $index, 'OUTPUT'|'LITERAL', $output_line ] , -# [ $index, 'OUTPUT'|'LITERAL', $output_line ] , -# ... # etc, -# ]; +# [ $index, 'OUTPUT|LITERAL', $output_line ], +# [ $index, 'OUTPUT|LITERAL', $output_line ], +# ... +# \]; +# BUG?: make memory more efficient sub _read_line { - my ( $self, $literal_callback, $output_callback ) = @_; + my ( $self, $literal_callback ) = @_; my $socket = $self->Socket; unless ( $self->IsConnected && $socket ) { @@ -1622,7 +1401,23 @@ sub _read_line { my $oBuffer = []; my $index = $self->_next_index; my $timeout = $self->Timeout; - my $readlen = $self->{Buffer} || 4096; + my $readlen = $self->Buffer || 4096; + my $transno = $self->Transaction; + + my $literal_cbtype = ""; + if ($literal_callback) { + if ( UNIVERSAL::isa( $literal_callback, "GLOB" ) ) { + $literal_cbtype = "GLOB"; + } + elsif ( UNIVERSAL::isa( $literal_callback, "CODE" ) ) { + $literal_cbtype = "CODE"; + } + else { + $self->LastError( "'$literal_callback' is an " + . "invalid callback; must be a filehandle or CODE" ); + return undef; + } + } my $temperrs = 0; my $maxagain = $self->Maxtemperrors; @@ -1636,7 +1431,6 @@ sub _read_line { && !length $iBuffer # and the input buffer has been MT'ed: ) { - my $transno = $self->Transaction; if ($timeout) { my $rc = $self->_read_more( $socket, $timeout ); @@ -1717,11 +1511,12 @@ sub _read_line { $litstring = $iBuffer; $iBuffer = ''; + my $litreadb = length($litstring); my $temperrs = 0; my $maxagain = $self->Maxtemperrors; undef $maxagain if $maxagain and lc($maxagain) eq 'unlimited'; - while ( $expected_size > length $litstring ) { + while ( $expected_size > $litreadb ) { if ($timeout) { my $rc = $self->_read_more( $socket, $timeout ); return undef unless ( $rc > 0 ); @@ -1730,11 +1525,11 @@ sub _read_line { CORE::select( undef, undef, undef, 0.025 ); } - my $ret = $self->_sysread( - $socket, \$litstring, - $expected_size - length $litstring, - length $litstring - ); + # $litstring is emptied when $literal_cbtype is GLOB + my $ret = + $self->_sysread( $socket, \$litstring, + $expected_size - $litreadb, + length($litstring) ); if ($timeout) { if ( defined $ret ) { @@ -1760,15 +1555,23 @@ sub _read_line { } # EOF: note IO::Socket::SSL does not support eof() - if ( defined $ret && $ret == 0 ) { + if ( defined $ret and $ret == 0 ) { $emsg = "socket closed while reading data from server"; $self->State(Unconnected); } + elsif ( defined $ret and $ret > 0 ) { + $litreadb += $ret; + + # conserve memory when using literal_callback GLOB + if ( $literal_cbtype eq "GLOB" ) { + print $literal_callback $litstring; + $litstring = "" unless ($emsg); + } + } $self->_debug( "Received ret=" - . ( defined($ret) ? "$ret " : " " ) - . length($litstring) - . " of $expected_size" ); + . ( defined($ret) ? $ret : "" ) + . " $litreadb of $expected_size" ); # save errors and return if ($emsg) { @@ -1790,29 +1593,27 @@ sub _read_line { } } - if ( !$literal_callback ) { ; } - elsif ( UNIVERSAL::isa( $literal_callback, 'GLOB' ) ) { - print $literal_callback $litstring; - $litstring = ""; - } - elsif ( UNIVERSAL::isa( $literal_callback, 'CODE' ) ) { - $literal_callback->($litstring) - if defined $litstring; - } - else { - $self->LastError( "'$literal_callback' is an " - . "invalid callback; must be a filehandle or CODE" ); + if ( defined $litstring ) { + if ( $literal_cbtype eq "GLOB" ) { + print $literal_callback $litstring; + } + elsif ( $literal_cbtype eq "CODE" ) { + $literal_callback->($litstring); + } } - push @$oBuffer, [ $index++, 'LITERAL', $litstring ]; + push @$oBuffer, [ $index++, 'LITERAL', $litstring ] + if ( $literal_cbtype ne "GLOB" ); } } - $self->_debug( "Read: " . join "", map { "\t" . $_->[DATA] } @$oBuffer ); + $self->_debug( "Read: " . join "", map { "\t" . $_->[DATA] } @$oBuffer ) + if ( $self->Debug ); + @$oBuffer ? $oBuffer : undef; } -sub _sysread($$$$) { +sub _sysread { my ( $self, $fh, $buf, $len, $off ) = @_; my $rm = $self->Readmethod; $rm ? $rm->(@_) : sysread( $fh, $$buf, $len, $off ); @@ -1892,7 +1693,6 @@ sub Results(;$) { return wantarray ? @a : \@a; } -# Don't know what it does, but used a few times. sub _transaction_literals() { my $self = shift; join '', map { $_->[DATA] } @@ -1902,15 +1702,27 @@ sub _transaction_literals() { sub Escaped_results { my ( $self, $trans ) = @_; my @a; - foreach my $line ( grep defined, $self->Results($trans) ) { + my $prevwasliteral = 0; + foreach my $line ( grep defined, $self->_transaction($trans) ) { + my $data = $line->[DATA]; + + # literal is appended to previous data if ( $self->_is_literal($line) ) { - $line->[DATA] =~ s/([\\\(\)"$CRLF])/\\$1/og; - push @a, qq("$line->[DATA]"); + $data =~ s/([\\\(\)"$CRLF])/\\$1/og; + $a[-1] .= qq( "$data"); + $prevwasliteral = 1; + } + else { + if ($prevwasliteral) { + $a[-1] .= $data; + } + else { + push( @a, $data ); + } + $prevwasliteral = 0; } - else { push @a, $line->[DATA] } } - shift @a; # remove cmd return wantarray ? @a : \@a; } @@ -1922,7 +1734,7 @@ sub Unescape { sub logout { my $self = shift; - my $rc = $self->_imap_command("LOGOUT"); + my $rc = $self->_imap_command( "LOGOUT", "BYE" ); $self->_disconnect; return $rc; } @@ -2085,9 +1897,12 @@ sub get_envelope { $bs; } -# fetch( [$seq_set|ALL], @msg_data_items ) +# fetch( [{option},] [$seq_set|ALL], @msg_data_items ) +# options: +# escaped => 0|1 # return Results or Escaped_results sub fetch { my $self = shift; + my $opt = ref( $_[0] ) eq "HASH" ? shift : {}; my $what = shift || "ALL"; my $take = $what; @@ -2106,7 +1921,7 @@ sub fetch { my $seq = $seq_set->[$x]; $self->_imap_uid_command( FETCH => $seq, @fetch_att, @_ ) or return undef; - my $res = $self->Results; + my $res = $opt->{escaped} ? $self->Escaped_results : $self->Results; # only keep last command and last response (* OK ...) $cmd = shift(@$res); @@ -2157,6 +1972,7 @@ sub _split_sequence { } # fetch_hash( [$seq_set|ALL], @msg_data_items, [\%msg_by_ids] ) +# - TODO: make more efficient use of memory on large fetch results sub fetch_hash { my $self = shift; my $uids = ref $_[-1] ? pop @_ : {}; @@ -2185,15 +2001,16 @@ s/([\( ])FULL([\) ])/${1}FLAGS INTERNALDATE RFC822\.SIZE ENVELOPE BODY$2/i; } my %words = map { uc($_) => 1 } @words; - my $output = $self->fetch( $msgs, "($what)" ) or return undef; + my $output = $self->fetch( { escaped => 1 }, $msgs, "($what)" ) + or return undef; while ( my $l = shift @$output ) { next if $l !~ m/^\*\s(\d+)\sFETCH\s\(/g; my ( $mid, $entry ) = ( $1, {} ); my ( $key, $value ); ATTR: - while ( $l !~ m/\G\s*\)\s*$/gc ) { - if ( $l =~ m/\G\s*([\w\d\.]+(?:\[[^\]]*\])?)\s*/gc ) { + while ( $l and $l !~ m/\G\s*\)\s*$/gc ) { + if ( $l =~ m/\G\s*([^\s\[]+(?:\[[^\]]*\])?)\s*/gc ) { $key = uc($1); } elsif ( !defined $key ) { @@ -2202,7 +2019,6 @@ s/([\( ])FULL([\) ])/${1}FLAGS INTERNALDATE RFC822\.SIZE ENVELOPE BODY$2/i; $self->LastError("Invalid item name in FETCH response: $l"); return undef; } - if ( $l =~ m/\G\s*$/gc ) { $value = shift @$output; $entry->{$key} = $value; @@ -2235,7 +2051,7 @@ s/([\( ])FULL([\) ])/${1}FLAGS INTERNALDATE RFC822\.SIZE ENVELOPE BODY$2/i; $value .= $stuff; } } - m/\G\s*/gc; + $l =~ m/\G\s*/gc; } else { $self->LastError("Invalid item value in FETCH response: $l"); @@ -2887,43 +2703,69 @@ sub selectable { defined $info ? not( grep /NoSelect/i, @$info ) : undef; } +# append( $self, $folder, $text [, $optmsg] ) +# - conserve memory and use $_[0] to avoid copying $text (it may be huge!) +# - BUG?: should deprecate this method in favor of append_string sub append { my $self = shift; my $folder = shift; - my $text = @_ > 1 ? join( $CRLF, @_ ) : shift; - $self->append_string( $folder, $text ); + # $message_string is whatever is left in @_ + $self->append_string( $folder, ( @_ > 1 ? join( $CRLF, @_ ) : $_[0] ) ); } +sub _clean_flags { + my ( $self, $flags ) = @_; + $flags =~ s/^\s+//; + $flags =~ s/\s+$//; + $flags = "($flags)" if $flags !~ /^\(.*\)$/; + return $flags; +} + +# RFC 3501: date-day-fixed = (SP DIGIT) / 2DIGIT +sub _clean_date { + my ( $self, $date ) = @_; + $date =~ s/^\s+// if $date !~ /^\s\d/; + $date =~ s/\s+$//; + $date = qq("$date") if $date !~ /^"/; + return $date; +} + +sub _append_command { + my ( $self, $folder, $flags, $date, $length ) = @_; + return join( " ", + "APPEND $folder", + ( $flags ? $flags : () ), + ( $date ? $date : () ), + "{" . $length . "}", + ); +} + +# append_string( $self, $folder, $text, $flags, $date ) +# - conserve memory and use $_[2] to avoid copying $text (it may be huge!) sub append_string($$$;$$) { - my $self = shift; - my $folder = $self->Massage(shift); - my ( $text, $flags, $date ) = @_; - defined $text or $text = ''; + my ( $self, $folder, $flags, $date ) = @_[ 0, 1, 3, 4 ]; - if ( defined $flags ) { - $flags =~ s/^\s+//g; - $flags =~ s/\s+$//g; - $flags = "($flags)" if $flags !~ /^\(.*\)$/; + #my $text = $_[2]; # conserve memory and use $_[2] instead! + my $maxl = $self->Maxappendstringlength; + + # on "large" strings use append_file to conserve memory + if ( $_[2] and $maxl and length( $_[2] ) > $maxl ) { + $self->_debug("append_string: using in memory file"); + return $self->append_file( $folder, \( $_[2] ), undef, $flags, $date ); } - if ( defined $date ) { - $date =~ s/^\s+//g; - $date =~ s/\s+$//g; - $date = qq("$date") if $date !~ /^"/; - } + my $text = defined( $_[2] ) ? $_[2] : ''; + $folder = $self->Massage($folder); + $flags = $self->_clean_flags($flags) if ( defined $flags ); + $date = $self->_clean_date($date) if ( defined $date ); $text =~ s/\r?\n/$CRLF/og; - my $command = - "APPEND $folder " - . ( $flags ? "$flags " : "" ) - . ( $date ? "$date " : "" ) . "{" - . length($text) - . "}$CRLF"; + my $cmd = $self->_append_command( $folder, $flags, $date, length($text) ); + $cmd .= $CRLF . $text . $CRLF; - $command .= $text . $CRLF; - $self->_imap_command( { addcrlf => 0 }, $command ) or return undef; + $self->_imap_command( { addcrlf => 0 }, $cmd ) or return undef; my $data = join '', $self->Results; @@ -2934,12 +2776,10 @@ sub append_string($$$;$$) { return $ret; } +# BUG?: not much/any savings on cygwin perl 5.10 when using in memory file +# BUG?: we do not retry if sending data fails after getting the OK to send sub append_file { - my ( $self, $folder, $file, $control, $flags, $use_filetime ) = @_; - my $mfolder = $self->Massage($folder); - - $flags ||= ''; - my $fflags = $flags =~ m/^\(.*\)$/ ? $flags : "($flags)"; + my ( $self, $folder, $file, $control, $flags, $date ) = @_; my @err; push( @err, "folder not specified" ) @@ -2949,14 +2789,18 @@ sub append_file { if ( !defined($file) ) { push( @err, "file not specified" ); } - elsif ( ref($file) ) { + elsif ( ref($file) and ref($file) ne "SCALAR" ) { $fh = $file; # let the caller pass in their own file handle directly } - elsif ( !-f $file ) { + elsif ( !ref($file) and !-f $file ) { push( @err, "file '$file' not found" ); } else { - $fh = IO::File->new( $file, 'r' ) + + # $file can be a name or a scalar reference (for in memory file) + # avoid IO::File bug handling scalar refs in perl <= 5.8.8? + # - buggy: $fh = IO::File->new( $file, 'r' ) + open( $fh, "<", $file ) or push( @err, "Unable to open file '$file': $!" ); } @@ -2967,10 +2811,13 @@ sub append_file { binmode($fh); - my $date; - if ( $fh and $use_filetime ) { - my $f = $self->Rfc2060_datetime( ( stat($fh) )[9] ); - $date = qq("$f"); + $folder = $self->Massage($folder) if ( defined $folder ); + $flags = $self->_clean_flags($flags) if ( defined $flags ); + + # allow the date to be specified or even use mtime on file + if ($date) { + $date = $self->Rfc3501_datetime( ( stat($fh) )[9] ) if ( $date eq "1" ); + $date = $self->_clean_date($date); } # BUG? seems wasteful to do this always, provide a "fast path" option? @@ -2984,19 +2831,13 @@ sub append_file { seek( $fh, 0, 0 ); } - my $string = "APPEND $mfolder"; - $string .= " $fflags" if ( $fflags ne "" ); - $string .= " $date" if ( defined($date) ); - $string .= " {$length}"; - - my $rc = $self->_imap_command( $string, '+' ); + my $cmd = $self->_append_command( $folder, $flags, $date, $length ); + my $rc = $self->_imap_command( $cmd, '+' ); unless ($rc) { - $self->LastError( "Error sending '$string': " . $self->LastError ); + $self->LastError( "Error sending '$cmd': " . $self->LastError ); return undef; } - my $count = $self->Count; - # Now send the message itself my ( $buffer, $buflen ) = ( "", 0 ); until ( !$buflen and eof($fh) ) { @@ -3023,14 +2864,6 @@ sub append_file { # reduce buffer to desired size $buffer = substr( $buffer, 0, APPEND_BUFFER_SIZE ); - $self->_record( - $count, - [ - $self->_next_index($count), "INPUT", - '{' . length($buffer) . " bytes from $file}" - ] - ); - my $bytes_written = $self->_send_bytes( \$buffer ); unless ($bytes_written) { $self->LastError( "Error appending message: " . $self->LastError ); @@ -3050,7 +2883,7 @@ sub append_file { # Now for the crucial test: Did the append work or not? # look for " (OK|BAD|NO)" - my $code = $self->_get_response($count) or return undef; + my $code = $self->_get_response( $self->Count ) or return undef; if ( $code eq 'OK' ) { my $data = join '', $self->Results; diff --git a/Mail-IMAPClient-3.25/lib/Mail/IMAPClient.pod b/Mail-IMAPClient-3.27/lib/Mail/IMAPClient.pod similarity index 95% rename from Mail-IMAPClient-3.25/lib/Mail/IMAPClient.pod rename to Mail-IMAPClient-3.27/lib/Mail/IMAPClient.pod index 1e6feef..f03cc89 100644 --- a/Mail-IMAPClient-3.25/lib/Mail/IMAPClient.pod +++ b/Mail-IMAPClient-3.27/lib/Mail/IMAPClient.pod @@ -103,153 +103,6 @@ L. =back -=head2 Custom Authentication Mechanisms - -There are also a number of methods and parameters that you can use to -build your own authentication mechanism. All of the methods and -parameters discussed in this section are described in more detail -elsewhere in this document. This section provides a starting point -for building your own authentication mechanism. - -First of all, if you just want to do plain text authentication and -your server is okay with that idea then you don't even need to read -this section. - -Second of all, the intent of this section is to help you implement the -authentication mechanism of your choice, but you will have to -understand how that mechanism works. There are I of -authentication mechanisms, if your preferred mechanism is not -currently supported but you manage to get it working please consider -donating them to this module. Patches and suggestions are always -welcome. - -Support for add-on authentication mechanisms in Mail::IMAPClient is -pretty straight forward. You create a callback to be used to provide -the response to the server's challenge. The L parameter -contains a reference to the callback, which can be an anonymous -subroutine or a named subroutine. Then, you identify your -authentication mechanism, either via the L parameter or -as an argument to L. - -You may also need to provide a subroutine to encrypt (or whatever) -data before it is sent to the server. The L parameter -must contain a reference to this subroutine. And, you will need to -decrypt data from the server; a reference to the subroutine that does -this must be stored in the L parameter. - -This framework is based on the assumptions that a) the mechanism you -are using requires a challenge-response exchange, and b) the mechanism -does not fundamentally alter the exchange between client and server -but merely wraps the exchange in a layer of encryption. It also -assumes that the line-oriented nature of the IMAP conversation is -preserved; authentication mechanisms that break up messages into -blocks of a predetermined size may still be possible but will -certainly be more difficult to implement. - -Alternatively, if you have access to B, a utility included in -the Cyrus IMAP distribution, you can use that utility to broker your -communications with the IMAP server. This is quite easy to implement. -An example, F, can be found in the -C subdirectory of the source distribution. - -The following list summarizes the methods and parameters that you may -find useful in implementing advanced authentication: - -=over 4 - -=item The authenticate method - -The L method uses the L parameter to -determine how to authenticate with the server see the method -documentation for details. - -=item Socket and RawSocket - -The L and L methods provide access to the socket -connection. The socket is typically automatically created by the -L method, but if you are implementing an advanced -authentication technique you may choose to set up your own socket -connection and then set this parameter manually, bypassing the -B method completely. This is also useful if you want to use -L alternatives like L and need full -control. - -L simply gets/sets the socket without attempting any -interaction on it. In this case, you have to be sure to handle all -the preliminary operations and manually set the Mail::IMAPClient -object in sync with its actual status with respect to this socket (see -below for additional parameters regarding this, especially the -L parameter). - -Unlike L, L attempts to carry on preliminary -connection phases if the conditions apply. If both parameters are -present, this takes the precedence over L. If -L is set, then the L method will be called by -L. - -B As of version 2.99_04 of this module, semantics for -L have changed to make it more "DWIM". L was -introduced as a replacement for the L parameter in older -version. - -=item State, Server, User, Password, Proxy and Domain Parameters - -If you need to make your own connection to the server and perform your -authentication manually, then you can set these parameters to keep -your Mail::IMAPClient object in sync with its actual status. Of -these, only the L parameter is always necessary. The others -need to be set only if you think your program will need them later. - -=item Authmechanism - -Set this to the value that AUTHENTICATE should send to the server as -the authentication mechanism. If you are brokering your own -authentication then this parameter may be less useful. It exists -primarily so that you can set it when you call L to instantiate -your object. The L method will call L, which will -call L. If L sees that you have set an -B then it will call B, using your -B and B parameters as arguments. - -=item Authcallback - -The L, if set, holds a pointer to a subroutine -(CODEREF). The L method will use this as the callback -argument to the B method if the B and -B parameters are both set. If you set B -but not B then the default callback for your mechanism -will be used. All supported authentication mechanisms have a default -callback; in every other case not supplying the callback results in an -error. - -Most advanced authentication mechanisms require a challenge-response -exchange. After the L method sends " AUTHENTICATE -\015\012" to the IMAP server, the server replies with a -challenge. The L method then invokes the code whose -reference is stored in the B parameter as follows: - - $Authcallback->($challenge, $imap) - -where C<$Authcallback> is the code reference stored in the -B parameter, C<$challenge> is the challenge received -from the IMAP server, and C<$imap> is a pointer to the -Mail::IMAPClient object. The return value from the B -routine should be the response to the challenge, and that return value -will be sent by the L method to the server. - -=item Prewritemethod/Readmethod - -The B can hold a subroutine that will do whatever -encryption is necessary and then return the result to the caller so it -in turn can be sent to the server. - -The B can hold a subroutine to be used to replace -B usually performed by Mail::IMAPClient. - -See L and L for details. - -=back - =head2 Errors If you attempt an operation that results in an error, then you can @@ -276,6 +129,11 @@ L. Any of these methods could fail and cause the L method call to return C and leaving the variable C<$@> is set to an error message. +WARNING: (due to historical API behavior) on errors, many methods may +return undef regardless of LIST/SCALAR context. Therefore, it may be +wise to use most methods in a scalar context. Regardless, check +L for details on errors. + =head2 Transactions RFC3501 requires that each line in an IMAP conversation be prefixed @@ -549,46 +407,134 @@ error-prone and stalled the progress of this module. Example: - my $uid = $imap->append( $folder, $msg_text ) + my $uid_or_true = $imap->append( $folder, $msgtext ) or die "Could not append: ", $imap->LastError; -The B method adds a message to the specified folder. It takes -two arguments, the name of the folder to append the message to, and -the text of the message (including headers). Additional arguments are -added to the message text, separated with . +WARNING: This method may be deprecated in the future, consider using +L instead of this method. -On success, the B method returns the UID of the new message -(if the server has the UIDPLUS capability) or a true value otherwise. -On error, C is returned and L will be set. +The B method adds a message to the specified folder. See +L for details as it is effectively an alias for that +method. + +DEPRECATED BEHAVIOR: Additional arguments are added to the message +text, separated with . + +=head2 append_string + +Example: + + # brackets indicate optional arguments (not array refs): + my $uidort = $imap->append_string( $folder, $msgtext [,$flags [,$date ] ] ) + or die "Could not append_string: ", $imap->LastError; + +Arguments: + +=over 4 + +=item $folder + +the name of the folder to append the message to + +=item $msgtext + +the message text (including headers) of the message + +=item $flags + +An optional list of flags to set. The list must be specified as +a space-separated list of flags, including any backslashes that may be +necessary and optionally enclosed by parenthesis. + +=item $date + +An optional RFC3501 date argument to set as the internal date. It +should be in the format described for I fields in RFC3501, +i.e. "dd-Mon-yyyy hh:mm:ss +0000". + +If you want to specify a date/time but you don't want any flags then +specify I as the third ($flags) argument. + +=back + +Returns: + +=over 4 + +=item error: undef + +On error, undef can be returned regardless of LIST/SCALAR context. +Check L for details. + +=item success: UID or $imap + +With UIDPLUS the UID of the new message is returned otherwise a true +value (currently $self) is returned. + +=back To protect against "bare newlines", B will insert a carriage return before any newline that is "bare". -Note that B does not allow you to specify the internal date or -initial flags of an appended message. If you need this capability -then use L, below. - =head2 append_file Example: my $new_msg_uid = $imap->append_file( $folder, - $filename, - [ undef, flags, date ] # optional + $file, + [ undef, $flags, $date ] # optional ) or die "Could not append_file: ", $imap->LastError; -The B method adds a message to the specified folder. It -takes two arguments, the name of the folder to append the message to, -and the file name of an RFC822-formatted message. - +The B method adds a message to the specified folder. Note: The brackets in the example indicate optional arguments; they do not mean that the argument should be an array reference. -On success, the B method returns the UID of the new -message (if the server has the UIDPLUS capability) or a true value -otherwise. On error, C is returned and L will be -set. +Arguments: + +=over 4 + +=item $folder + +the name of the folder to append the message to + +=item $file + +a filename, filehandle or SCALAR reference which holds an +RFC822-formatted message + +=item undef + +a deprecated argument used as a place holder for backwards +compatibility + +=item $flags + +The optional argument is handled the same as append_string. + +=item $date + +The optional argument is handled the same as append_string (RFC3501 +date), with the exception that if $date is "1" (one) then the +modification time (mtime) of the file will be used. + +=back + +Returns: + +=over 4 + +=item error: undef + +On error, undef can be returned regardless of LIST/SCALAR context. +Check L for details. + +=item success: UID or $imap + +With UIDPLUS the UID of the new message is returned otherwise a true +value (currently $self) is returned. + +=back To protect against "bare newlines", B will insert a carriage return before any newline that is "bare". @@ -600,41 +546,6 @@ Version note: In 2.x an optional third argument to use for C was allowed, however this argument is ignored/not supported as of 3.x. -=head2 append_string - -Example: - - # brackets indicate optional arguments (not array refs): - my $uid = $imap->append_string( $folder, $text [ ,$flags [ ,$date ] ] ) - or die "Could not append_string: $@\n"; - -The B method adds a message to the specified folder. -It requires two arguments, the name of the folder to append the -message to, and the text of the message (including headers). The -message text must be included in a single string (unlike L, -above). - -You can optionally specify a third and fourth argument to -B. The third argument, if supplied, is the list of -flags to set for the appended message. The list must be specified as -a space-separated list of flags, including any backslashes that may be -necessary. The enclosing parentheses that are required by RFC3501 are -optional for B. The fourth argument, if specified, is -the date to set as the internal date. It should be in the format -described for I fields in RFC3501, i.e. "dd-Mon-yyyy -hh:mm:ss +0000". - -If you want to specify a date/time but you don't want any flags then -specify I as the third argument. - -On success, the B method returns the UID of the new -message (if the server has the UIDPLUS capability) or a true value -otherwise. On error, C is returned and L will be -set. - -To protect against "bare newlines", B will insert a -carriage return before any newline that is "bare". - =head2 authenticate Example: @@ -1154,7 +1065,7 @@ function in later releases. This method is new with version 2.2.3 and is thus still experimental. If you decide to try this method and run into problems, please see the -section on L. +section on L. =head2 flags @@ -1734,10 +1645,10 @@ C<$imap-EL("ALL")>. Example: - $imap->migrate($imap_2, "ALL", $targetFolder ) - or die "Could not migrate: $@\n"; + $imap_src->migrate( $imap_dest, "ALL", $targetFolder ) + or die "Could not migrate: ", $imap_src->LastError; -The B method copies the indicated messages B the +The B method copies the indicated message(s) B the currently selected folder B another Mail::IMAPClient object's session. It requires these arguments: @@ -1759,40 +1670,22 @@ C("ALL")>. =item 3. -the folder name of a folder on the target mailbox to receive the -message(s). If this argument is not supplied or if I is -supplied then a folder with the same name as the currently selected -folder on the calling object will be created if necessary and used. -If you specify something other then I for this argument, even -if it's '$imap1-EFolder' or the name of the currently selected -folder, then that folder will only be used if it exists on the target -object's mailbox; if it does not exist then B will fail. +the name of the destination folder on the target mailbox to receive +the message(s). If this argument is not supplied or is I then +the currently selected folder on the calling object will be used. The +destination folder will be automatically created if necessary. =back -The target Mail::IMAPClient object should not be the same as the -source. The source object is the calling object, i.e. the one whose -B method will be used. It cannot be the same object as the -one specified as the target, even if you are for some reason migrating -between folders on the same account (which would be silly anyway, -since L can do that much more efficiently). If you try to use -the same Mail::IMAPClient object for both the caller and the receiver -then they'll both get all screwed up and it will be your fault because -I just warned you and you didn't listen. +The target ($imap_dest) Mail::IMAPClient object must not be the same +object as the source ($imap_src). -B will download messages from the source in chunks to -minimize memory usage. The size of the chunks can be controlled by -changing the source Mail::IMAPClient object's the L -parameter. The higher the L value, the faster the migration, -but the more memory your program will require. TANSTAAFL. (See the -L parameter and eponymous accessor method, described above -under the L section.) +This method does not attempt to minimize memory usage. In the future +it could be enhanced to (optionaly) write message data to a temporary +file to avoid storing the entire message in memory. -The B method uses Black Magic to hardwire the I/O between the -two Mail::IMAPClient objects in order to minimize resource -consumption. If you have older scripts that used L -and L to move large messages between IMAP mailboxes then -you may want to try this method as a possible replacement. +To work around potential network timeouts on large messages, consider +setting L to 1 on both $imap_src and $imap_dest. See also C. @@ -3678,24 +3571,167 @@ I IMAP client command.) The B method returns the tag value (or transaction number) of the last IMAP client command. +=head1 Custom Authentication Mechanisms + +If you just want to use plain text authentication or any of the +supported L then there is no +need to read this section. + +There are a number of methods and parameters that you can use to build +your own authentication mechanism. All of the methods and parameters +discussed in this section are described in more detail elsewhere in +this document. This section provides a starting point for building +your own authentication mechanism. + +There are I authentication mechanisms out there, if your +preferred mechanism is not currently supported but you manage to get +it working please consider donating them to this module. Patches and +suggestions are always welcome. + +Support for add-on authentication mechanisms in Mail::IMAPClient is +pretty straight forward. You create a callback to be used to provide +the response to the server's challenge. The L parameter +contains a reference to the callback, which can be an anonymous +subroutine or a named subroutine. Then, you identify your +authentication mechanism, either via the L parameter or +as an argument to L. + +You may also need to provide a subroutine to encrypt (or whatever) +data before it is sent to the server. The L parameter +must contain a reference to this subroutine. And, you will need to +decrypt data from the server; a reference to the subroutine that does +this must be stored in the L parameter. + +This framework is based on the assumptions that a) the mechanism you +are using requires a challenge-response exchange, and b) the mechanism +does not fundamentally alter the exchange between client and server +but merely wraps the exchange in a layer of encryption. It also +assumes that the line-oriented nature of the IMAP conversation is +preserved; authentication mechanisms that break up messages into +blocks of a predetermined size may still be possible but will +certainly be more difficult to implement. + +Alternatively, if you have access to B, a utility included in +the Cyrus IMAP distribution, you can use that utility to broker your +communications with the IMAP server. This is quite easy to implement. +An example, F, can be found in the +C subdirectory of the source distribution. + +The following list summarizes the methods and parameters that you may +find useful in implementing advanced authentication: + +=over 4 + +=item The authenticate method + +The L method uses the L parameter to +determine how to authenticate with the server see the method +documentation for details. + +=item Socket and RawSocket + +The L and L methods provide access to the socket +connection. The socket is typically automatically created by the +L method, but if you are implementing an advanced +authentication technique you may choose to set up your own socket +connection and then set this parameter manually, bypassing the +B method completely. This is also useful if you want to use +L alternatives like L and need full +control. + +L simply gets/sets the socket without attempting any +interaction on it. In this case, you have to be sure to handle all +the preliminary operations and manually set the Mail::IMAPClient +object in sync with its actual status with respect to this socket (see +below for additional parameters regarding this, especially the +L parameter). + +Unlike L, L attempts to carry on preliminary +connection phases if the conditions apply. If both parameters are +present, this takes the precedence over L. If +L is set, then the L method will be called by +L. + +B As of version 2.99_04 of this module, semantics for +L have changed to make it more "DWIM". L was +introduced as a replacement for the L parameter in older +version. + +=item State, Server, User, Password, Proxy and Domain Parameters + +If you need to make your own connection to the server and perform your +authentication manually, then you can set these parameters to keep +your Mail::IMAPClient object in sync with its actual status. Of +these, only the L parameter is always necessary. The others +need to be set only if you think your program will need them later. + +=item Authmechanism + +Set this to the value that AUTHENTICATE should send to the server as +the authentication mechanism. If you are brokering your own +authentication then this parameter may be less useful. It exists +primarily so that you can set it when you call L to instantiate +your object. The L method will call L, which will +call L. If L sees that you have set an +B then it will call B, using your +B and B parameters as arguments. + +=item Authcallback + +The L, if set, holds a pointer to a subroutine +(CODEREF). The L method will use this as the callback +argument to the B method if the B and +B parameters are both set. If you set B +but not B then the default callback for your mechanism +will be used. All supported authentication mechanisms have a default +callback; in every other case not supplying the callback results in an +error. + +Most advanced authentication mechanisms require a challenge-response +exchange. After the L method sends " AUTHENTICATE +\015\012" to the IMAP server, the server replies with a +challenge. The L method then invokes the code whose +reference is stored in the B parameter as follows: + + $Authcallback->($challenge, $imap) + +where C<$Authcallback> is the code reference stored in the +B parameter, C<$challenge> is the challenge received +from the IMAP server, and C<$imap> is a pointer to the +Mail::IMAPClient object. The return value from the B +routine should be the response to the challenge, and that return value +will be sent by the L method to the server. + +=item Prewritemethod/Readmethod + +The B can hold a subroutine that will do whatever +encryption is necessary and then return the result to the caller so it +in turn can be sent to the server. + +The B can hold a subroutine to be used to replace +B usually performed by Mail::IMAPClient. + +See L and L for details. + +=back + =head1 REPORTING BUGS -Please send bug reports to C +Please send bug reports to C or +http://rt.cpan.org/Public/Dist/Display.html?Name=Mail-IMAPClient -=head1 COPYRIGHT +=head1 COPYRIGHT AND LICENSE - Copyright 1999, 2000, 2001, 2002 The Kernen Group, Inc. + Copyright (C) 1999-2003 The Kernen Group, Inc. + Copyright (C) 2007-2009 Mark Overmeer + Copyright (C) 2010-2011 Phil Pearl (Lobbes) All rights reserved. - Copyright 2007, 2008, 2009 Mark Overmeer - - Copyright 2010 Phil Pearl (Lobbes) - -This program is free software; you can redistribute under the same -terms as Perl itself. +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself, either Perl version 5.8.0 or, +at your option, any later version of Perl 5 you may have available. 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 either the -GNU General Public License or the Artistic License for more -details. All your base are belong to us. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the +GNU General Public License or the Artistic License for more details. diff --git a/Mail-IMAPClient-3.25/lib/Mail/IMAPClient/BodyStructure.pm b/Mail-IMAPClient-3.27/lib/Mail/IMAPClient/BodyStructure.pm similarity index 100% rename from Mail-IMAPClient-3.25/lib/Mail/IMAPClient/BodyStructure.pm rename to Mail-IMAPClient-3.27/lib/Mail/IMAPClient/BodyStructure.pm diff --git a/Mail-IMAPClient-3.25/lib/Mail/IMAPClient/BodyStructure/Parse.grammar b/Mail-IMAPClient-3.27/lib/Mail/IMAPClient/BodyStructure/Parse.grammar similarity index 98% rename from Mail-IMAPClient-3.25/lib/Mail/IMAPClient/BodyStructure/Parse.grammar rename to Mail-IMAPClient-3.27/lib/Mail/IMAPClient/BodyStructure/Parse.grammar index 853d092..227ca2c 100644 --- a/Mail-IMAPClient-3.25/lib/Mail/IMAPClient/BodyStructure/Parse.grammar +++ b/Mail-IMAPClient-3.27/lib/Mail/IMAPClient/BodyStructure/Parse.grammar @@ -32,6 +32,7 @@ HTML: /"HTML"|HTML/i { $return = "HTML" } MESSAGE: /^"MESSAGE"|^MESSAGE/i { $return = "MESSAGE"} RFC822: /^"RFC822"|^RFC822/i { $return = "RFC822" } NIL: /^NIL/i { $return = "NIL" } +RFCNONCOMPLY: /^\(\)/i { $return = "NIL" } NUMBER: /^(\d+)/ { $return = $item[1] } # Strings: @@ -91,7 +92,7 @@ inreplyto: NIL | STRING messageid: NIL | STRING date: NIL | STRING -ADDRESSES: NIL +ADDRESSES: NIL | RFCNONCOMPLY | "(" addressstruct(s) ")" { $return = $item{'addressstruct(s)'} } cc: ADDRESSES diff --git a/Mail-IMAPClient-3.27/lib/Mail/IMAPClient/BodyStructure/Parse.pm b/Mail-IMAPClient-3.27/lib/Mail/IMAPClient/BodyStructure/Parse.pm new file mode 100644 index 0000000..7d6fded --- /dev/null +++ b/Mail-IMAPClient-3.27/lib/Mail/IMAPClient/BodyStructure/Parse.pm @@ -0,0 +1,16801 @@ +package Mail::IMAPClient::BodyStructure::Parse; +use Parse::RecDescent; + +{ my $ERRORS; + + +package Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse; +use strict; +use vars qw($skip $AUTOLOAD ); +@Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::ISA = (); +$skip = '\s*'; + + my $mibs = "Mail::IMAPClient::BodyStructure"; + my $subpartCount = 0; + my $partCount = 0; + + sub take_optional_items($$@) + { my ($r, $items) = (shift, shift); + foreach (@_) + { my $opt = $_ .'(?)'; + exists $items->{$opt} or next; + $r->{$_} = UNIVERSAL::isa($items->{$opt}, 'ARRAY') + ? $items->{$opt}[0] : $items->{$opt}; + } + } + + sub merge_hash($$) + { my $to = shift; + my $from = shift or return; + while( my($k,$v) = each %$from) { $to->{$k} = $v } + } +; + + +{ +local $SIG{__WARN__} = sub {0}; +# PRETEND TO BE IN Parse::RecDescent NAMESPACE +*Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::AUTOLOAD = sub +{ + no strict 'refs'; + $AUTOLOAD =~ s/^Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse/Parse::RecDescent/; + goto &{$AUTOLOAD}; +} +} + +push @Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::ISA, 'Parse::RecDescent'; +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyparms +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"bodyparms"}; + + Parse::RecDescent::_trace(q{Trying rule: [bodyparms]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyparms}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or KVPAIRS}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyparms}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{bodyparms}); + %item = (__RULE__ => q{bodyparms}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{bodyparms}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodyparms}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodyparms}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodyparms}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [KVPAIRS]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyparms}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{bodyparms}); + %item = (__RULE__ => q{bodyparms}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [KVPAIRS]}, + Parse::RecDescent::_tracefirst($text), + q{bodyparms}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::KVPAIRS($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodyparms}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [KVPAIRS]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodyparms}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{KVPAIRS}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [KVPAIRS]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodyparms}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyparms}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{bodyparms}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{bodyparms}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{bodyparms}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::date +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"date"}; + + Parse::RecDescent::_trace(q{Trying rule: [date]}, + Parse::RecDescent::_tracefirst($_[1]), + q{date}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or STRING}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{date}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{date}); + %item = (__RULE__ => q{date}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{date}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{date}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{date}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{date}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{date}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{date}); + %item = (__RULE__ => q{date}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{date}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{date}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{date}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{date}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{date}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{date}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{date}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{date}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodysubtype +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"bodysubtype"}; + + Parse::RecDescent::_trace(q{Trying rule: [bodysubtype]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{PLAIN, or HTML, or NIL, or STRING}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [PLAIN]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{bodysubtype}); + %item = (__RULE__ => q{bodysubtype}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [PLAIN]}, + Parse::RecDescent::_tracefirst($text), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::PLAIN($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [PLAIN]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{PLAIN}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [PLAIN]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [HTML]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{bodysubtype}); + %item = (__RULE__ => q{bodysubtype}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [HTML]}, + Parse::RecDescent::_tracefirst($text), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::HTML($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [HTML]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{HTML}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [HTML]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{bodysubtype}); + %item = (__RULE__ => q{bodysubtype}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[3]; + $text = $_[1]; + my $_savetext; + @item = (q{bodysubtype}); + %item = (__RULE__ => q{bodysubtype}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{bodysubtype}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{bodysubtype}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{bodysubtype}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::hostname +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"hostname"}; + + Parse::RecDescent::_trace(q{Trying rule: [hostname]}, + Parse::RecDescent::_tracefirst($_[1]), + q{hostname}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or STRING}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{hostname}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{hostname}); + %item = (__RULE__ => q{hostname}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{hostname}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{hostname}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{hostname}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{hostname}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{hostname}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{hostname}); + %item = (__RULE__ => q{hostname}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{hostname}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{hostname}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{hostname}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{hostname}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{hostname}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{hostname}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{hostname}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{hostname}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::basicfields +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"basicfields"}; + + Parse::RecDescent::_trace(q{Trying rule: [basicfields]}, + Parse::RecDescent::_tracefirst($_[1]), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{bodysubtype}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [bodysubtype bodyparms bodyid bodydesc bodyenc bodysize]}, + Parse::RecDescent::_tracefirst($_[1]), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{basicfields}); + %item = (__RULE__ => q{basicfields}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [bodysubtype]}, + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodysubtype($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [bodysubtype]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodysubtype}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyparms]}, + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodyparms})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyparms, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyparms]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodyparms(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyid]}, + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodyid})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyid, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyid]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodyid(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodydesc]}, + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodydesc})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodydesc, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodydesc]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodydesc(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyenc]}, + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodyenc})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyenc, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyenc]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodyenc(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodysize]}, + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodysize})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodysize, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodysize]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodysize(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = { bodysubtype => $item{bodysubtype} }; + take_optional_items($return, \%item, + qw/bodyparms bodyid bodydesc bodyenc bodysize/); + 1; + }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [bodysubtype bodyparms bodyid bodydesc bodyenc bodysize]<<}, + Parse::RecDescent::_tracefirst($text), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{basicfields}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{basicfields}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{basicfields}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::personalname +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"personalname"}; + + Parse::RecDescent::_trace(q{Trying rule: [personalname]}, + Parse::RecDescent::_tracefirst($_[1]), + q{personalname}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or STRING}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{personalname}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{personalname}); + %item = (__RULE__ => q{personalname}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{personalname}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{personalname}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{personalname}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{personalname}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{personalname}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{personalname}); + %item = (__RULE__ => q{personalname}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{personalname}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{personalname}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{personalname}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{personalname}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{personalname}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{personalname}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{personalname}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{personalname}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::key +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"key"}; + + Parse::RecDescent::_trace(q{Trying rule: [key]}, + Parse::RecDescent::_tracefirst($_[1]), + q{key}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{STRING}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{key}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{key}); + %item = (__RULE__ => q{key}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{key}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{key}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{key}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{key}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{key}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{key}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{key}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{key}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::cc +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"cc"}; + + Parse::RecDescent::_trace(q{Trying rule: [cc]}, + Parse::RecDescent::_tracefirst($_[1]), + q{cc}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{ADDRESSES}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [ADDRESSES]}, + Parse::RecDescent::_tracefirst($_[1]), + q{cc}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{cc}); + %item = (__RULE__ => q{cc}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [ADDRESSES]}, + Parse::RecDescent::_tracefirst($text), + q{cc}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::ADDRESSES($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{cc}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [ADDRESSES]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{cc}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{ADDRESSES}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [ADDRESSES]<<}, + Parse::RecDescent::_tracefirst($text), + q{cc}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{cc}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{cc}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{cc}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{cc}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyMD5 +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"bodyMD5"}; + + Parse::RecDescent::_trace(q{Trying rule: [bodyMD5]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyMD5}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or STRING}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyMD5}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{bodyMD5}); + %item = (__RULE__ => q{bodyMD5}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{bodyMD5}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodyMD5}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodyMD5}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodyMD5}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyMD5}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{bodyMD5}); + %item = (__RULE__ => q{bodyMD5}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{bodyMD5}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodyMD5}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodyMD5}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodyMD5}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyMD5}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{bodyMD5}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{bodyMD5}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{bodyMD5}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::envelope +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"envelope"}; + + Parse::RecDescent::_trace(q{Trying rule: [envelope]}, + Parse::RecDescent::_tracefirst($_[1]), + q{envelope}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{/.*?\\(.*?ENVELOPE/}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [/.*?\\(.*?ENVELOPE/ envelopestruct /.*\\)/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{envelope}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{envelope}); + %item = (__RULE__ => q{envelope}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [/.*?\\(.*?ENVELOPE/]}, Parse::RecDescent::_tracefirst($text), + q{envelope}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:.*?\(.*?ENVELOPE)/) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying subrule: [envelopestruct]}, + Parse::RecDescent::_tracefirst($text), + q{envelope}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{envelopestruct})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::envelopestruct($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{envelope}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [envelopestruct]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{envelope}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{envelopestruct}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying terminal: [/.*\\)/]}, Parse::RecDescent::_tracefirst($text), + q{envelope}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/.*\\)/})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:.*\))/) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{envelope}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = $item{envelopestruct} }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [/.*?\\(.*?ENVELOPE/ envelopestruct /.*\\)/]<<}, + Parse::RecDescent::_tracefirst($text), + q{envelope}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{envelope}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{envelope}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{envelope}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{envelope}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::MESSAGE +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"MESSAGE"}; + + Parse::RecDescent::_trace(q{Trying rule: [MESSAGE]}, + Parse::RecDescent::_tracefirst($_[1]), + q{MESSAGE}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{/^"MESSAGE"|^MESSAGE/i}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [/^"MESSAGE"|^MESSAGE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{MESSAGE}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{MESSAGE}); + %item = (__RULE__ => q{MESSAGE}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [/^"MESSAGE"|^MESSAGE/i]}, Parse::RecDescent::_tracefirst($text), + q{MESSAGE}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:^"MESSAGE"|^MESSAGE)/i) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{MESSAGE}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = "MESSAGE"}; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [/^"MESSAGE"|^MESSAGE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{MESSAGE}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{MESSAGE}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{MESSAGE}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{MESSAGE}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{MESSAGE}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::DOUBLE_QUOTED_STRING +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"DOUBLE_QUOTED_STRING"}; + + Parse::RecDescent::_trace(q{Trying rule: [DOUBLE_QUOTED_STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{DOUBLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{'"'}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: ['"' /(?:\\\\"|[^"])*/ '"']}, + Parse::RecDescent::_tracefirst($_[1]), + q{DOUBLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{DOUBLE_QUOTED_STRING}); + %item = (__RULE__ => q{DOUBLE_QUOTED_STRING}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: ['"']}, + Parse::RecDescent::_tracefirst($text), + q{DOUBLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A\"/) + { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying terminal: [/(?:\\\\"|[^"])*/]}, Parse::RecDescent::_tracefirst($text), + q{DOUBLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/(?:\\\\"|[^"])*/})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:(?:\\"|[^"])*)/) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying terminal: ['"']}, + Parse::RecDescent::_tracefirst($text), + q{DOUBLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'"'})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A\"/) + { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{DOUBLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = $item{__PATTERN1__} }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: ['"' /(?:\\\\"|[^"])*/ '"']<<}, + Parse::RecDescent::_tracefirst($text), + q{DOUBLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{DOUBLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{DOUBLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{DOUBLE_QUOTED_STRING}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{DOUBLE_QUOTED_STRING}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::subject +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"subject"}; + + Parse::RecDescent::_trace(q{Trying rule: [subject]}, + Parse::RecDescent::_tracefirst($_[1]), + q{subject}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or STRING}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{subject}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{subject}); + %item = (__RULE__ => q{subject}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{subject}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{subject}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{subject}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{subject}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{subject}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{subject}); + %item = (__RULE__ => q{subject}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{subject}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{subject}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{subject}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{subject}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{subject}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{subject}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{subject}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{subject}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::value +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"value"}; + + Parse::RecDescent::_trace(q{Trying rule: [value]}, + Parse::RecDescent::_tracefirst($_[1]), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or NUMBER, or STRING, or KVPAIRS}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{value}); + %item = (__RULE__ => q{value}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NUMBER]}, + Parse::RecDescent::_tracefirst($_[1]), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{value}); + %item = (__RULE__ => q{value}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NUMBER]}, + Parse::RecDescent::_tracefirst($text), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NUMBER($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NUMBER]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NUMBER}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NUMBER]<<}, + Parse::RecDescent::_tracefirst($text), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{value}); + %item = (__RULE__ => q{value}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [KVPAIRS]}, + Parse::RecDescent::_tracefirst($_[1]), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[3]; + $text = $_[1]; + my $_savetext; + @item = (q{value}); + %item = (__RULE__ => q{value}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [KVPAIRS]}, + Parse::RecDescent::_tracefirst($text), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::KVPAIRS($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [KVPAIRS]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{KVPAIRS}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [KVPAIRS]<<}, + Parse::RecDescent::_tracefirst($text), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{value}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{value}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{value}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{value}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::inreplyto +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"inreplyto"}; + + Parse::RecDescent::_trace(q{Trying rule: [inreplyto]}, + Parse::RecDescent::_tracefirst($_[1]), + q{inreplyto}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or STRING}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{inreplyto}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{inreplyto}); + %item = (__RULE__ => q{inreplyto}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{inreplyto}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{inreplyto}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{inreplyto}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{inreplyto}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{inreplyto}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{inreplyto}); + %item = (__RULE__ => q{inreplyto}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{inreplyto}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{inreplyto}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{inreplyto}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{inreplyto}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{inreplyto}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{inreplyto}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{inreplyto}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{inreplyto}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::messageid +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"messageid"}; + + Parse::RecDescent::_trace(q{Trying rule: [messageid]}, + Parse::RecDescent::_tracefirst($_[1]), + q{messageid}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or STRING}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{messageid}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{messageid}); + %item = (__RULE__ => q{messageid}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{messageid}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{messageid}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{messageid}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{messageid}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{messageid}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{messageid}); + %item = (__RULE__ => q{messageid}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{messageid}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{messageid}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{messageid}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{messageid}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{messageid}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{messageid}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{messageid}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{messageid}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::sender +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"sender"}; + + Parse::RecDescent::_trace(q{Trying rule: [sender]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sender}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{ADDRESSES}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [ADDRESSES]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sender}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{sender}); + %item = (__RULE__ => q{sender}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [ADDRESSES]}, + Parse::RecDescent::_tracefirst($text), + q{sender}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::ADDRESSES($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sender}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [ADDRESSES]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{sender}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{ADDRESSES}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [ADDRESSES]<<}, + Parse::RecDescent::_tracefirst($text), + q{sender}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{sender}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{sender}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{sender}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{sender}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::multipart +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"multipart"}; + + Parse::RecDescent::_trace(q{Trying rule: [multipart]}, + Parse::RecDescent::_tracefirst($_[1]), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{subpart}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [subpart bodysubtype bodyparms bodydisp bodylang bodyloc bodyextra ]}, + Parse::RecDescent::_tracefirst($_[1]), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{multipart}); + %item = (__RULE__ => q{multipart}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [subpart]}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::subpart, 1, 100000000, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [subpart]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{subpart(s)}} = $_tok; + push @item, $_tok; + + + + + + Parse::RecDescent::_trace(q{Trying directive: []}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $_tok = do { $commit = 1 }; + if (defined($_tok)) + { + Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + } + else + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + } + + last unless defined $_tok; + push @item, $item{__DIRECTIVE1__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying subrule: [bodysubtype]}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{bodysubtype})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodysubtype($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [bodysubtype]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodysubtype}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyparms]}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodyparms})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyparms, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyparms]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodyparms(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodydisp]}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodydisp})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodydisp, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodydisp]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodydisp(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodylang]}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodylang})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodylang, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodylang]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodylang(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyloc]}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodyloc})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyloc, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyloc]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodyloc(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyextra]}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodyextra})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyextra, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyextra]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodyextra(?)}} = $_tok; + push @item, $_tok; + + + + + + Parse::RecDescent::_trace(q{Trying directive: []}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $_tok = do { push @{$thisparser->{deferred}}, sub { $subpartCount = 0 }; }; + if (defined($_tok)) + { + Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + } + else + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + } + + last unless defined $_tok; + push @item, $item{__DIRECTIVE2__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = + { bodysubtype => $item{bodysubtype} + , bodytype => 'MULTIPART' + , bodystructure => $item{'subpart(s)'} + }; + take_optional_items($return, \%item + , qw/bodyparms bodydisp bodylang bodyloc bodyextra/); + 1; + }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [subpart bodysubtype bodyparms bodydisp bodylang bodyloc bodyextra ]<<}, + Parse::RecDescent::_tracefirst($text), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{multipart}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{multipart}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{multipart}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyenc +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"bodyenc"}; + + Parse::RecDescent::_trace(q{Trying rule: [bodyenc]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or STRING, or KVPAIRS}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{bodyenc}); + %item = (__RULE__ => q{bodyenc}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{bodyenc}); + %item = (__RULE__ => q{bodyenc}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [KVPAIRS]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{bodyenc}); + %item = (__RULE__ => q{bodyenc}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [KVPAIRS]}, + Parse::RecDescent::_tracefirst($text), + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::KVPAIRS($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [KVPAIRS]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{KVPAIRS}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [KVPAIRS]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{bodyenc}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{bodyenc}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{bodyenc}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodydesc +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"bodydesc"}; + + Parse::RecDescent::_trace(q{Trying rule: [bodydesc]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodydesc}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{/[()]/, or STRING}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [/[()]/ NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodydesc}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{bodydesc}); + %item = (__RULE__ => q{bodydesc}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [/[()]/]}, Parse::RecDescent::_tracefirst($text), + q{bodydesc}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + $_savetext = $text; + + if ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:[()])/) + { + $text = $_savetext; + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + $text = $_savetext; + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{bodydesc}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{NIL})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodydesc}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodydesc}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [/[()]/ NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodydesc}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodydesc}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{bodydesc}); + %item = (__RULE__ => q{bodydesc}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{bodydesc}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodydesc}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodydesc}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodydesc}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodydesc}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{bodydesc}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{bodydesc}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{bodydesc}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::start +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"start"}; + + Parse::RecDescent::_trace(q{Trying rule: [start]}, + Parse::RecDescent::_tracefirst($_[1]), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{/.*?\\(.*?BODYSTRUCTURE \\(/i}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [/.*?\\(.*?BODYSTRUCTURE \\(/i part /\\).*\\)\\r?\\n?/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{start}); + %item = (__RULE__ => q{start}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [/.*?\\(.*?BODYSTRUCTURE \\(/i]}, Parse::RecDescent::_tracefirst($text), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:.*?\(.*?BODYSTRUCTURE \()/i) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [part]}, + Parse::RecDescent::_tracefirst($text), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{part})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::part, 1, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [part]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{part(1)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying terminal: [/\\).*\\)\\r?\\n?/]}, Parse::RecDescent::_tracefirst($text), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/\\).*\\)\\r?\\n?/})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:\).*\)\r?\n?)/) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = $item{'part(1)'}[0] }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [/.*?\\(.*?BODYSTRUCTURE \\(/i part /\\).*\\)\\r?\\n?/]<<}, + Parse::RecDescent::_tracefirst($text), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{start}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{start}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{start}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::RFC822 +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"RFC822"}; + + Parse::RecDescent::_trace(q{Trying rule: [RFC822]}, + Parse::RecDescent::_tracefirst($_[1]), + q{RFC822}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{/^"RFC822"|^RFC822/i}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [/^"RFC822"|^RFC822/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{RFC822}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{RFC822}); + %item = (__RULE__ => q{RFC822}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [/^"RFC822"|^RFC822/i]}, Parse::RecDescent::_tracefirst($text), + q{RFC822}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:^"RFC822"|^RFC822)/i) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{RFC822}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = "RFC822" }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [/^"RFC822"|^RFC822/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{RFC822}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{RFC822}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{RFC822}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{RFC822}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{RFC822}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::RFCNONCOMPLY +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"RFCNONCOMPLY"}; + + Parse::RecDescent::_trace(q{Trying rule: [RFCNONCOMPLY]}, + Parse::RecDescent::_tracefirst($_[1]), + q{RFCNONCOMPLY}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{/^\\(\\)/i}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [/^\\(\\)/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{RFCNONCOMPLY}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{RFCNONCOMPLY}); + %item = (__RULE__ => q{RFCNONCOMPLY}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [/^\\(\\)/i]}, Parse::RecDescent::_tracefirst($text), + q{RFCNONCOMPLY}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:^\(\))/i) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{RFCNONCOMPLY}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = "NIL" }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [/^\\(\\)/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{RFCNONCOMPLY}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{RFCNONCOMPLY}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{RFCNONCOMPLY}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{RFCNONCOMPLY}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{RFCNONCOMPLY}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::textmessage +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"textmessage"}; + + Parse::RecDescent::_trace(q{Trying rule: [textmessage]}, + Parse::RecDescent::_tracefirst($_[1]), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{TEXT}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [TEXT basicfields textlines bodyMD5 bodydisp bodylang bodyextra]}, + Parse::RecDescent::_tracefirst($_[1]), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{textmessage}); + %item = (__RULE__ => q{textmessage}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [TEXT]}, + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::TEXT($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [TEXT]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{TEXT}} = $_tok; + push @item, $_tok; + + } + + + + Parse::RecDescent::_trace(q{Trying directive: []}, + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + $_tok = do { $commit = 1 }; + if (defined($_tok)) + { + Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + } + else + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + } + + last unless defined $_tok; + push @item, $item{__DIRECTIVE1__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying subrule: [basicfields]}, + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{basicfields})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::basicfields($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [basicfields]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{basicfields}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying repeated subrule: [textlines]}, + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{textlines})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::textlines, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [textlines]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{textlines(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyMD5]}, + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodyMD5})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyMD5, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyMD5]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodyMD5(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodydisp]}, + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodydisp})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodydisp, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodydisp]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodydisp(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodylang]}, + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodylang})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodylang, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodylang]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodylang(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyextra]}, + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodyextra})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyextra, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyextra]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodyextra(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { + $return = $item{basicfields} || {}; + $return->{bodytype} = 'TEXT'; + take_optional_items($return, \%item + , qw/textlines bodyMD5 bodydisp bodylang bodyextra/); + 1; + }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [TEXT basicfields textlines bodyMD5 bodydisp bodylang bodyextra]<<}, + Parse::RecDescent::_tracefirst($text), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{textmessage}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{textmessage}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{textmessage}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyid +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"bodyid"}; + + Parse::RecDescent::_trace(q{Trying rule: [bodyid]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyid}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{/[()]/, or STRING}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [/[()]/ NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyid}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{bodyid}); + %item = (__RULE__ => q{bodyid}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [/[()]/]}, Parse::RecDescent::_tracefirst($text), + q{bodyid}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + $_savetext = $text; + + if ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:[()])/) + { + $text = $_savetext; + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + $text = $_savetext; + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{bodyid}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{NIL})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodyid}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodyid}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [/[()]/ NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodyid}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyid}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{bodyid}); + %item = (__RULE__ => q{bodyid}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{bodyid}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodyid}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodyid}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodyid}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyid}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{bodyid}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{bodyid}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{bodyid}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyextra +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"bodyextra"}; + + Parse::RecDescent::_trace(q{Trying rule: [bodyextra]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or STRING, or STRINGS}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{bodyextra}); + %item = (__RULE__ => q{bodyextra}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{bodyextra}); + %item = (__RULE__ => q{bodyextra}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRINGS]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{bodyextra}); + %item = (__RULE__ => q{bodyextra}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRINGS]}, + Parse::RecDescent::_tracefirst($text), + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRINGS($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRINGS]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRINGS}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRINGS]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{bodyextra}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{bodyextra}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{bodyextra}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::othertypemessage +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"othertypemessage"}; + + Parse::RecDescent::_trace(q{Trying rule: [othertypemessage]}, + Parse::RecDescent::_tracefirst($_[1]), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{bodytype}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [bodytype basicfields bodyMD5 bodydisp bodylang bodyextra]}, + Parse::RecDescent::_tracefirst($_[1]), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{othertypemessage}); + %item = (__RULE__ => q{othertypemessage}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [bodytype]}, + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodytype($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [bodytype]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodytype}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [basicfields]}, + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{basicfields})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::basicfields($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [basicfields]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{basicfields}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyMD5]}, + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodyMD5})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyMD5, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyMD5]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodyMD5(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodydisp]}, + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodydisp})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodydisp, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodydisp]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodydisp(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodylang]}, + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodylang})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodylang, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodylang]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodylang(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyextra]}, + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodyextra})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyextra, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyextra]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodyextra(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = { bodytype => $item{bodytype} }; + take_optional_items($return, \%item + , qw/bodyMD5 bodydisp bodylang bodyextra/ ); + merge_hash($return, $item{basicfields}); + 1; + }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [bodytype basicfields bodyMD5 bodydisp bodylang bodyextra]<<}, + Parse::RecDescent::_tracefirst($text), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{othertypemessage}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{othertypemessage}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{othertypemessage}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::kvpair +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"kvpair"}; + + Parse::RecDescent::_trace(q{Trying rule: [kvpair]}, + Parse::RecDescent::_tracefirst($_[1]), + q{kvpair}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{')'}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [')' key value]}, + Parse::RecDescent::_tracefirst($_[1]), + q{kvpair}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{kvpair}); + %item = (__RULE__ => q{kvpair}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{kvpair}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + $_savetext = $text; + + if ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + $text = $_savetext; + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__}=$_tok; + $text = $_savetext; + + Parse::RecDescent::_trace(q{Trying subrule: [key]}, + Parse::RecDescent::_tracefirst($text), + q{kvpair}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{key})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::key($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{kvpair}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [key]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{kvpair}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{key}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [value]}, + Parse::RecDescent::_tracefirst($text), + q{kvpair}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{value})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::value($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{kvpair}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [value]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{kvpair}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{value}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{kvpair}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = { $item{key} => $item{value} } }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [')' key value]<<}, + Parse::RecDescent::_tracefirst($text), + q{kvpair}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{kvpair}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{kvpair}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{kvpair}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{kvpair}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodysize +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"bodysize"}; + + Parse::RecDescent::_trace(q{Trying rule: [bodysize]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodysize}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{/[()]/, or NUMBER}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [/[()]/ NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodysize}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{bodysize}); + %item = (__RULE__ => q{bodysize}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [/[()]/]}, Parse::RecDescent::_tracefirst($text), + q{bodysize}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + $_savetext = $text; + + if ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:[()])/) + { + $text = $_savetext; + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + $text = $_savetext; + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{bodysize}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{NIL})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodysize}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodysize}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [/[()]/ NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodysize}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NUMBER]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodysize}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{bodysize}); + %item = (__RULE__ => q{bodysize}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NUMBER]}, + Parse::RecDescent::_tracefirst($text), + q{bodysize}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NUMBER($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodysize}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NUMBER]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodysize}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NUMBER}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NUMBER]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodysize}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodysize}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{bodysize}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{bodysize}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{bodysize}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"STRING"}; + + Parse::RecDescent::_trace(q{Trying rule: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{DOUBLE_QUOTED_STRING, or SINGLE_QUOTED_STRING, or BARESTRING}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [DOUBLE_QUOTED_STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{STRING}); + %item = (__RULE__ => q{STRING}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [DOUBLE_QUOTED_STRING]}, + Parse::RecDescent::_tracefirst($text), + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::DOUBLE_QUOTED_STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [DOUBLE_QUOTED_STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{DOUBLE_QUOTED_STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [DOUBLE_QUOTED_STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [SINGLE_QUOTED_STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{STRING}); + %item = (__RULE__ => q{STRING}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [SINGLE_QUOTED_STRING]}, + Parse::RecDescent::_tracefirst($text), + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::SINGLE_QUOTED_STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [SINGLE_QUOTED_STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{SINGLE_QUOTED_STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [SINGLE_QUOTED_STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [BARESTRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{STRING}); + %item = (__RULE__ => q{STRING}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [BARESTRING]}, + Parse::RecDescent::_tracefirst($text), + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::BARESTRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [BARESTRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{BARESTRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [BARESTRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{STRING}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{STRING}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{STRING}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodytype +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"bodytype"}; + + Parse::RecDescent::_trace(q{Trying rule: [bodytype]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodytype}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{STRING}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodytype}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{bodytype}); + %item = (__RULE__ => q{bodytype}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{bodytype}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodytype}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodytype}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodytype}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodytype}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{bodytype}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{bodytype}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{bodytype}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::TEXT +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"TEXT"}; + + Parse::RecDescent::_trace(q{Trying rule: [TEXT]}, + Parse::RecDescent::_tracefirst($_[1]), + q{TEXT}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{/^"TEXT"|^TEXT/i}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [/^"TEXT"|^TEXT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{TEXT}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{TEXT}); + %item = (__RULE__ => q{TEXT}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [/^"TEXT"|^TEXT/i]}, Parse::RecDescent::_tracefirst($text), + q{TEXT}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:^"TEXT"|^TEXT)/i) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{TEXT}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = "TEXT" }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [/^"TEXT"|^TEXT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{TEXT}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{TEXT}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{TEXT}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{TEXT}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{TEXT}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::to +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"to"}; + + Parse::RecDescent::_trace(q{Trying rule: [to]}, + Parse::RecDescent::_tracefirst($_[1]), + q{to}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{ADDRESSES}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [ADDRESSES]}, + Parse::RecDescent::_tracefirst($_[1]), + q{to}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{to}); + %item = (__RULE__ => q{to}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [ADDRESSES]}, + Parse::RecDescent::_tracefirst($text), + q{to}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::ADDRESSES($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{to}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [ADDRESSES]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{to}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{ADDRESSES}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [ADDRESSES]<<}, + Parse::RecDescent::_tracefirst($text), + q{to}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{to}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{to}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{to}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{to}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"NIL"}; + + Parse::RecDescent::_trace(q{Trying rule: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{NIL}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{/^NIL/i}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [/^NIL/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{NIL}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{NIL}); + %item = (__RULE__ => q{NIL}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [/^NIL/i]}, Parse::RecDescent::_tracefirst($text), + q{NIL}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:^NIL)/i) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{NIL}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = "NIL" }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [/^NIL/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{NIL}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{NIL}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{NIL}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{NIL}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{NIL}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::KVPAIRS +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"KVPAIRS"}; + + Parse::RecDescent::_trace(q{Trying rule: [KVPAIRS]}, + Parse::RecDescent::_tracefirst($_[1]), + q{KVPAIRS}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{'('}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: ['(' kvpair ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{KVPAIRS}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{KVPAIRS}); + %item = (__RULE__ => q{KVPAIRS}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{KVPAIRS}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "("; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [kvpair]}, + Parse::RecDescent::_tracefirst($text), + q{KVPAIRS}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{kvpair})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::kvpair, 1, 100000000, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{KVPAIRS}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [kvpair]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{KVPAIRS}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{kvpair(s)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{KVPAIRS}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{KVPAIRS}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = { map { (%$_) } @{$item{'kvpair(s)'}} } }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: ['(' kvpair ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{KVPAIRS}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{KVPAIRS}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{KVPAIRS}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{KVPAIRS}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{KVPAIRS}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::from +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"from"}; + + Parse::RecDescent::_trace(q{Trying rule: [from]}, + Parse::RecDescent::_tracefirst($_[1]), + q{from}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{ADDRESSES}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [ADDRESSES]}, + Parse::RecDescent::_tracefirst($_[1]), + q{from}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{from}); + %item = (__RULE__ => q{from}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [ADDRESSES]}, + Parse::RecDescent::_tracefirst($text), + q{from}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::ADDRESSES($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{from}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [ADDRESSES]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{from}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{ADDRESSES}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [ADDRESSES]<<}, + Parse::RecDescent::_tracefirst($text), + q{from}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{from}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{from}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{from}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{from}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodystructure +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"bodystructure"}; + + Parse::RecDescent::_trace(q{Trying rule: [bodystructure]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodystructure}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{'('}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: ['(' part ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodystructure}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{bodystructure}); + %item = (__RULE__ => q{bodystructure}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{bodystructure}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "("; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [part]}, + Parse::RecDescent::_tracefirst($text), + q{bodystructure}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{part})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::part, 1, 100000000, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodystructure}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [part]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{bodystructure}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{part(s)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{bodystructure}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{bodystructure}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = $item{'part(s)'} }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: ['(' part ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{bodystructure}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodystructure}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{bodystructure}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{bodystructure}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{bodystructure}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::PLAIN +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"PLAIN"}; + + Parse::RecDescent::_trace(q{Trying rule: [PLAIN]}, + Parse::RecDescent::_tracefirst($_[1]), + q{PLAIN}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{/^"PLAIN"|^PLAIN/i}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [/^"PLAIN"|^PLAIN/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{PLAIN}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{PLAIN}); + %item = (__RULE__ => q{PLAIN}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [/^"PLAIN"|^PLAIN/i]}, Parse::RecDescent::_tracefirst($text), + q{PLAIN}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:^"PLAIN"|^PLAIN)/i) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{PLAIN}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = "PLAIN" }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [/^"PLAIN"|^PLAIN/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{PLAIN}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{PLAIN}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{PLAIN}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{PLAIN}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{PLAIN}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NUMBER +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"NUMBER"}; + + Parse::RecDescent::_trace(q{Trying rule: [NUMBER]}, + Parse::RecDescent::_tracefirst($_[1]), + q{NUMBER}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{/^(\\d+)/}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [/^(\\d+)/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{NUMBER}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{NUMBER}); + %item = (__RULE__ => q{NUMBER}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [/^(\\d+)/]}, Parse::RecDescent::_tracefirst($text), + q{NUMBER}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:^(\d+))/) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{NUMBER}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = $item[1] }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [/^(\\d+)/]<<}, + Parse::RecDescent::_tracefirst($text), + q{NUMBER}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{NUMBER}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{NUMBER}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{NUMBER}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{NUMBER}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRINGS +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"STRINGS"}; + + Parse::RecDescent::_trace(q{Trying rule: [STRINGS]}, + Parse::RecDescent::_tracefirst($_[1]), + q{STRINGS}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{'('}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: ['(' STRING ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{STRINGS}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{STRINGS}); + %item = (__RULE__ => q{STRINGS}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{STRINGS}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "("; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{STRINGS}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{STRING})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING, 1, 100000000, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{STRINGS}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [STRING]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{STRINGS}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING(s)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{STRINGS}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{STRINGS}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = $item{'STRING(s)'} }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: ['(' STRING ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{STRINGS}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{STRINGS}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{STRINGS}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{STRINGS}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{STRINGS}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::HTML +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"HTML"}; + + Parse::RecDescent::_trace(q{Trying rule: [HTML]}, + Parse::RecDescent::_tracefirst($_[1]), + q{HTML}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{/"HTML"|HTML/i}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [/"HTML"|HTML/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{HTML}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{HTML}); + %item = (__RULE__ => q{HTML}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [/"HTML"|HTML/i]}, Parse::RecDescent::_tracefirst($text), + q{HTML}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:"HTML"|HTML)/i) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{HTML}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = "HTML" }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [/"HTML"|HTML/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{HTML}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{HTML}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{HTML}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{HTML}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{HTML}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodydisp +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"bodydisp"}; + + Parse::RecDescent::_trace(q{Trying rule: [bodydisp]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodydisp}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or KVPAIRS}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodydisp}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{bodydisp}); + %item = (__RULE__ => q{bodydisp}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{bodydisp}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodydisp}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodydisp}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodydisp}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [KVPAIRS]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodydisp}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{bodydisp}); + %item = (__RULE__ => q{bodydisp}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [KVPAIRS]}, + Parse::RecDescent::_tracefirst($text), + q{bodydisp}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::KVPAIRS($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodydisp}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [KVPAIRS]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodydisp}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{KVPAIRS}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [KVPAIRS]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodydisp}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodydisp}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{bodydisp}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{bodydisp}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{bodydisp}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::part +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"part"}; + + Parse::RecDescent::_trace(q{Trying rule: [part]}, + Parse::RecDescent::_tracefirst($_[1]), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{multipart, or textmessage, or nestedmessage, or othertypemessage}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [multipart]}, + Parse::RecDescent::_tracefirst($_[1]), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{part}); + %item = (__RULE__ => q{part}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [multipart]}, + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::multipart($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [multipart]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{multipart}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = bless $item{multipart}, $mibs }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [multipart]<<}, + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [textmessage]}, + Parse::RecDescent::_tracefirst($_[1]), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{part}); + %item = (__RULE__ => q{part}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [textmessage]}, + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::textmessage($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [textmessage]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{textmessage}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = bless $item{textmessage}, $mibs }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [textmessage]<<}, + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [nestedmessage]}, + Parse::RecDescent::_tracefirst($_[1]), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{part}); + %item = (__RULE__ => q{part}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [nestedmessage]}, + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::nestedmessage($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [nestedmessage]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{nestedmessage}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = bless $item{nestedmessage}, $mibs }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [nestedmessage]<<}, + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [othertypemessage]}, + Parse::RecDescent::_tracefirst($_[1]), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[3]; + $text = $_[1]; + my $_savetext; + @item = (q{part}); + %item = (__RULE__ => q{part}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [othertypemessage]}, + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::othertypemessage($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [othertypemessage]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{othertypemessage}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = bless $item{othertypemessage}, $mibs }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [othertypemessage]<<}, + Parse::RecDescent::_tracefirst($text), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{part}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{part}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{part}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{part}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::nestedmessage +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"nestedmessage"}; + + Parse::RecDescent::_trace(q{Trying rule: [nestedmessage]}, + Parse::RecDescent::_tracefirst($_[1]), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{rfc822message}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [rfc822message bodyparms bodyid bodydesc bodyenc bodysize envelopestruct bodystructure textlines bodyMD5 bodydisp bodylang bodyextra]}, + Parse::RecDescent::_tracefirst($_[1]), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{nestedmessage}); + %item = (__RULE__ => q{nestedmessage}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [rfc822message]}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::rfc822message($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [rfc822message]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{rfc822message}} = $_tok; + push @item, $_tok; + + } + + + + Parse::RecDescent::_trace(q{Trying directive: []}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $_tok = do { $commit = 1 }; + if (defined($_tok)) + { + Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + } + else + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + } + + last unless defined $_tok; + push @item, $item{__DIRECTIVE1__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying subrule: [bodyparms]}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{bodyparms})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyparms($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [bodyparms]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodyparms}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [bodyid]}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{bodyid})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyid($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [bodyid]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodyid}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [bodydesc]}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{bodydesc})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodydesc($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [bodydesc]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodydesc}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [bodyenc]}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{bodyenc})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyenc($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [bodyenc]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodyenc}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [bodysize]}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{bodysize})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodysize($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [bodysize]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodysize}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying repeated subrule: [envelopestruct]}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{envelopestruct})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::envelopestruct, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [envelopestruct]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{envelopestruct(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodystructure]}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodystructure})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodystructure, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodystructure]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodystructure(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [textlines]}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{textlines})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::textlines, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [textlines]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{textlines(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyMD5]}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodyMD5})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyMD5, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyMD5]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodyMD5(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodydisp]}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodydisp})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodydisp, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodydisp]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodydisp(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodylang]}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodylang})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodylang, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodylang]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodylang(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [bodyextra]}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{bodyextra})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyextra, 0, 1, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [bodyextra]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bodyextra(?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { + $return = {}; + $return->{$_} = $item{$_} + for qw/bodyparms bodyid bodydesc bodyenc bodysize/; +# envelopestruct bodystructure textlines/; + + take_optional_items($return, \%item + , qw/envelopestruct bodystructure textlines/ + , qw/bodyMD5 bodydisp bodylang bodyextra/); + + merge_hash($return, $item{bodystructure}[0]); + merge_hash($return, $item{basicfields}); + $return->{bodytype} = "MESSAGE" ; + $return->{bodysubtype} = "RFC822" ; + 1; + }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [rfc822message bodyparms bodyid bodydesc bodyenc bodysize envelopestruct bodystructure textlines bodyMD5 bodydisp bodylang bodyextra]<<}, + Parse::RecDescent::_tracefirst($text), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{nestedmessage}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{nestedmessage}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{nestedmessage}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::SINGLE_QUOTED_STRING +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"SINGLE_QUOTED_STRING"}; + + Parse::RecDescent::_trace(q{Trying rule: [SINGLE_QUOTED_STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{SINGLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{'''}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [''' /(?:\\\\'|[^'])*/ ''']}, + Parse::RecDescent::_tracefirst($_[1]), + q{SINGLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{SINGLE_QUOTED_STRING}); + %item = (__RULE__ => q{SINGLE_QUOTED_STRING}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [''']}, + Parse::RecDescent::_tracefirst($text), + q{SINGLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "'"; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying terminal: [/(?:\\\\'|[^'])*/]}, Parse::RecDescent::_tracefirst($text), + q{SINGLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/(?:\\\\'|[^'])*/})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:(?:\\'|[^'])*)/) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying terminal: [''']}, + Parse::RecDescent::_tracefirst($text), + q{SINGLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'''})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "'"; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{SINGLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = $item{__PATTERN1__} }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [''' /(?:\\\\'|[^'])*/ ''']<<}, + Parse::RecDescent::_tracefirst($text), + q{SINGLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{SINGLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{SINGLE_QUOTED_STRING}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{SINGLE_QUOTED_STRING}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{SINGLE_QUOTED_STRING}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::ADDRESSES +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"ADDRESSES"}; + + Parse::RecDescent::_trace(q{Trying rule: [ADDRESSES]}, + Parse::RecDescent::_tracefirst($_[1]), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or RFCNONCOMPLY, or '('}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{ADDRESSES}); + %item = (__RULE__ => q{ADDRESSES}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [RFCNONCOMPLY]}, + Parse::RecDescent::_tracefirst($_[1]), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{ADDRESSES}); + %item = (__RULE__ => q{ADDRESSES}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [RFCNONCOMPLY]}, + Parse::RecDescent::_tracefirst($text), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::RFCNONCOMPLY($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [RFCNONCOMPLY]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{RFCNONCOMPLY}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [RFCNONCOMPLY]<<}, + Parse::RecDescent::_tracefirst($text), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: ['(' addressstruct ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{ADDRESSES}); + %item = (__RULE__ => q{ADDRESSES}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "("; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [addressstruct]}, + Parse::RecDescent::_tracefirst($text), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{addressstruct})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::addressstruct, 1, 100000000, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [addressstruct]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{addressstruct(s)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = $item{'addressstruct(s)'} }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: ['(' addressstruct ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{ADDRESSES}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{ADDRESSES}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{ADDRESSES}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bcc +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"bcc"}; + + Parse::RecDescent::_trace(q{Trying rule: [bcc]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bcc}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{ADDRESSES}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [ADDRESSES]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bcc}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{bcc}); + %item = (__RULE__ => q{bcc}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [ADDRESSES]}, + Parse::RecDescent::_tracefirst($text), + q{bcc}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::ADDRESSES($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bcc}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [ADDRESSES]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bcc}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{ADDRESSES}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [ADDRESSES]<<}, + Parse::RecDescent::_tracefirst($text), + q{bcc}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{bcc}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{bcc}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{bcc}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{bcc}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::rfc822message +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"rfc822message"}; + + Parse::RecDescent::_trace(q{Trying rule: [rfc822message]}, + Parse::RecDescent::_tracefirst($_[1]), + q{rfc822message}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{MESSAGE}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [MESSAGE RFC822]}, + Parse::RecDescent::_tracefirst($_[1]), + q{rfc822message}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{rfc822message}); + %item = (__RULE__ => q{rfc822message}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [MESSAGE]}, + Parse::RecDescent::_tracefirst($text), + q{rfc822message}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::MESSAGE($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{rfc822message}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [MESSAGE]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{rfc822message}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{MESSAGE}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [RFC822]}, + Parse::RecDescent::_tracefirst($text), + q{rfc822message}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{RFC822})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::RFC822($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{rfc822message}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [RFC822]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{rfc822message}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{RFC822}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{rfc822message}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = "MESSAGE RFC822" }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [MESSAGE RFC822]<<}, + Parse::RecDescent::_tracefirst($text), + q{rfc822message}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{rfc822message}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{rfc822message}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{rfc822message}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{rfc822message}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::addressstruct +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"addressstruct"}; + + Parse::RecDescent::_trace(q{Trying rule: [addressstruct]}, + Parse::RecDescent::_tracefirst($_[1]), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{'('}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: ['(' personalname sourceroute mailboxname hostname ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{addressstruct}); + %item = (__RULE__ => q{addressstruct}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "("; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying subrule: [personalname]}, + Parse::RecDescent::_tracefirst($text), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{personalname})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::personalname($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [personalname]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{personalname}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [sourceroute]}, + Parse::RecDescent::_tracefirst($text), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{sourceroute})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::sourceroute($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [sourceroute]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{sourceroute}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [mailboxname]}, + Parse::RecDescent::_tracefirst($text), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{mailboxname})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::mailboxname($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [mailboxname]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{mailboxname}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [hostname]}, + Parse::RecDescent::_tracefirst($text), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{hostname})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::hostname($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [hostname]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{hostname}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { bless { personalname => $item{personalname} + , sourceroute => $item{sourceroute} + , mailboxname => $item{mailboxname} + , hostname => $item{hostname} + }, 'Mail::IMAPClient::BodyStructure::Address'; + }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: ['(' personalname sourceroute mailboxname hostname ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{addressstruct}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{addressstruct}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{addressstruct}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::sourceroute +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"sourceroute"}; + + Parse::RecDescent::_trace(q{Trying rule: [sourceroute]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sourceroute}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or STRING}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sourceroute}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{sourceroute}); + %item = (__RULE__ => q{sourceroute}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{sourceroute}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sourceroute}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{sourceroute}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{sourceroute}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sourceroute}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{sourceroute}); + %item = (__RULE__ => q{sourceroute}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{sourceroute}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sourceroute}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{sourceroute}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{sourceroute}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{sourceroute}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{sourceroute}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{sourceroute}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{sourceroute}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::subpart +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"subpart"}; + + Parse::RecDescent::_trace(q{Trying rule: [subpart]}, + Parse::RecDescent::_tracefirst($_[1]), + q{subpart}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{'('}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: ['(' part ')' ]}, + Parse::RecDescent::_tracefirst($_[1]), + q{subpart}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{subpart}); + %item = (__RULE__ => q{subpart}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{subpart}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "("; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying subrule: [part]}, + Parse::RecDescent::_tracefirst($text), + q{subpart}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{part})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::part($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{subpart}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [part]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{subpart}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{part}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{subpart}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{subpart}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do {$return = $item{part}}; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + + Parse::RecDescent::_trace(q{Trying directive: []}, + Parse::RecDescent::_tracefirst($text), + q{subpart}, + $tracelevel) + if defined $::RD_TRACE; + $_tok = do { push @{$thisparser->{deferred}}, sub { ++$subpartCount; }; }; + if (defined($_tok)) + { + Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + } + else + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + } + + last unless defined $_tok; + push @item, $item{__DIRECTIVE1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: ['(' part ')' ]<<}, + Parse::RecDescent::_tracefirst($text), + q{subpart}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{subpart}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{subpart}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{subpart}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{subpart}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::textlines +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"textlines"}; + + Parse::RecDescent::_trace(q{Trying rule: [textlines]}, + Parse::RecDescent::_tracefirst($_[1]), + q{textlines}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or NUMBER}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{textlines}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{textlines}); + %item = (__RULE__ => q{textlines}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{textlines}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{textlines}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{textlines}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{textlines}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NUMBER]}, + Parse::RecDescent::_tracefirst($_[1]), + q{textlines}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{textlines}); + %item = (__RULE__ => q{textlines}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NUMBER]}, + Parse::RecDescent::_tracefirst($text), + q{textlines}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NUMBER($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{textlines}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NUMBER]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{textlines}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NUMBER}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NUMBER]<<}, + Parse::RecDescent::_tracefirst($text), + q{textlines}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{textlines}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{textlines}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{textlines}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{textlines}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::BARESTRING +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"BARESTRING"}; + + Parse::RecDescent::_trace(q{Trying rule: [BARESTRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{BARESTRING}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{/^[)('"]/}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [/^[)('"]/ /^(?!\\(|\\))(?:\\\\ |\\S)+/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{BARESTRING}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{BARESTRING}); + %item = (__RULE__ => q{BARESTRING}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [/^[)('"]/]}, Parse::RecDescent::_tracefirst($text), + q{BARESTRING}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + $_savetext = $text; + + if ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:^[)('"])/) + { + $text = $_savetext; + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + $text = $_savetext; + + Parse::RecDescent::_trace(q{Trying terminal: [/^(?!\\(|\\))(?:\\\\ |\\S)+/]}, Parse::RecDescent::_tracefirst($text), + q{BARESTRING}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/^(?!\\(|\\))(?:\\\\ |\\S)+/})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:^(?!\(|\))(?:\\ |\S)+)/) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{BARESTRING}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = $item{__PATTERN1__} }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [/^[)('"]/ /^(?!\\(|\\))(?:\\\\ |\\S)+/]<<}, + Parse::RecDescent::_tracefirst($text), + q{BARESTRING}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{BARESTRING}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{BARESTRING}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{BARESTRING}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{BARESTRING}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodyloc +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"bodyloc"}; + + Parse::RecDescent::_trace(q{Trying rule: [bodyloc]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyloc}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or STRING}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyloc}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{bodyloc}); + %item = (__RULE__ => q{bodyloc}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{bodyloc}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodyloc}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodyloc}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodyloc}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyloc}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{bodyloc}); + %item = (__RULE__ => q{bodyloc}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{bodyloc}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodyloc}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodyloc}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodyloc}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodyloc}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{bodyloc}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{bodyloc}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{bodyloc}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bodylang +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"bodylang"}; + + Parse::RecDescent::_trace(q{Trying rule: [bodylang]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or STRING, or STRINGS}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{bodylang}); + %item = (__RULE__ => q{bodylang}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{bodylang}); + %item = (__RULE__ => q{bodylang}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRINGS]}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{bodylang}); + %item = (__RULE__ => q{bodylang}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRINGS]}, + Parse::RecDescent::_tracefirst($text), + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRINGS($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRINGS]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRINGS}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRINGS]<<}, + Parse::RecDescent::_tracefirst($text), + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{bodylang}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{bodylang}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{bodylang}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::envelopestruct +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"envelopestruct"}; + + Parse::RecDescent::_trace(q{Trying rule: [envelopestruct]}, + Parse::RecDescent::_tracefirst($_[1]), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{'('}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: ['(' date subject from sender replyto to cc bcc inreplyto messageid ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{envelopestruct}); + %item = (__RULE__ => q{envelopestruct}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "("; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying subrule: [date]}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{date})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::date($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [date]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{date}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [subject]}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{subject})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::subject($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [subject]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{subject}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [from]}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{from})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::from($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [from]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{from}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [sender]}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{sender})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::sender($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [sender]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{sender}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [replyto]}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{replyto})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::replyto($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [replyto]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{replyto}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [to]}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{to})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::to($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [to]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{to}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [cc]}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{cc})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::cc($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [cc]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{cc}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [bcc]}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{bcc})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::bcc($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [bcc]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{bcc}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [inreplyto]}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{inreplyto})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::inreplyto($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [inreplyto]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{inreplyto}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying subrule: [messageid]}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{messageid})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::messageid($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [messageid]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{messageid}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = bless {}, "Mail::IMAPClient::BodyStructure::Envelope"; + $return->{$_} = $item{$_} + for qw/date subject from sender replyto to cc/ + , qw/bcc inreplyto messageid/; + 1; + }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: ['(' date subject from sender replyto to cc bcc inreplyto messageid ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{envelopestruct}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{envelopestruct}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{envelopestruct}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::replyto +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"replyto"}; + + Parse::RecDescent::_trace(q{Trying rule: [replyto]}, + Parse::RecDescent::_tracefirst($_[1]), + q{replyto}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{ADDRESSES}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [ADDRESSES]}, + Parse::RecDescent::_tracefirst($_[1]), + q{replyto}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{replyto}); + %item = (__RULE__ => q{replyto}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [ADDRESSES]}, + Parse::RecDescent::_tracefirst($text), + q{replyto}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::ADDRESSES($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{replyto}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [ADDRESSES]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{replyto}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{ADDRESSES}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [ADDRESSES]<<}, + Parse::RecDescent::_tracefirst($text), + q{replyto}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{replyto}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{replyto}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{replyto}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{replyto}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::mailboxname +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"mailboxname"}; + + Parse::RecDescent::_trace(q{Trying rule: [mailboxname]}, + Parse::RecDescent::_tracefirst($_[1]), + q{mailboxname}, + $tracelevel) + if defined $::RD_TRACE; + + my $def_at = @{$thisparser->{deferred}}; + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NIL, or STRING}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NIL]}, + Parse::RecDescent::_tracefirst($_[1]), + q{mailboxname}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{mailboxname}); + %item = (__RULE__ => q{mailboxname}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NIL]}, + Parse::RecDescent::_tracefirst($text), + q{mailboxname}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::NIL($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{mailboxname}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NIL]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{mailboxname}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NIL}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [NIL]<<}, + Parse::RecDescent::_tracefirst($text), + q{mailboxname}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [STRING]}, + Parse::RecDescent::_tracefirst($_[1]), + q{mailboxname}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{mailboxname}); + %item = (__RULE__ => q{mailboxname}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [STRING]}, + Parse::RecDescent::_tracefirst($text), + q{mailboxname}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse::STRING($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{mailboxname}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [STRING]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{mailboxname}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{STRING}} = $_tok; + push @item, $_tok; + + } + + + Parse::RecDescent::_trace(q{>>Matched production: [STRING]<<}, + Parse::RecDescent::_tracefirst($text), + q{mailboxname}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + splice + @{$thisparser->{deferred}}, $def_at unless $_matched; + + unless ( $_matched || defined($score) ) + { + splice @{$thisparser->{deferred}}, $def_at; + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{mailboxname}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{mailboxname}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{mailboxname}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{mailboxname}, + $tracelevel) + } + $_[1] = $text; + return $return; +} +} +package Mail::IMAPClient::BodyStructure::Parse; sub new { my $self = bless( { + '_precompiled' => 1, + 'localvars' => '', + 'startcode' => '', + 'namespace' => 'Parse::RecDescent::Mail::IMAPClient::BodyStructure::Parse', + 'deferrable' => 1, + 'rules' => { + 'bodyparms' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'KVPAIRS' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 66 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'KVPAIRS', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 66 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 66 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'bodyparms', + 'vars' => '', + 'line' => 66 + }, 'Parse::RecDescent::Rule' ), + 'date' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'STRING' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 93 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 93 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 93 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'date', + 'vars' => '', + 'line' => 93 + }, 'Parse::RecDescent::Rule' ), + 'bodysubtype' => bless( { + 'impcount' => 0, + 'calls' => [ + 'PLAIN', + 'HTML', + 'NIL', + 'STRING' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'PLAIN', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 54 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'HTML', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 54 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 54 + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 54 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 54 + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '3', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 54 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 54 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'bodysubtype', + 'vars' => '', + 'line' => 54 + }, 'Parse::RecDescent::Rule' ), + 'hostname' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'STRING' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 80 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 80 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 80 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'hostname', + 'vars' => '', + 'line' => 80 + }, 'Parse::RecDescent::Rule' ), + 'basicfields' => bless( { + 'impcount' => 0, + 'calls' => [ + 'bodysubtype', + 'bodyparms', + 'bodyid', + 'bodydesc', + 'bodyenc', + 'bodysize' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'subrule' => 'bodysubtype', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 114 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'bodyparms', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 114 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodyid', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 114 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodydesc', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 115 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodyenc', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 115 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodysize', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 115 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 116, + 'code' => '{ $return = { bodysubtype => $item{bodysubtype} }; + take_optional_items($return, \\%item, + qw/bodyparms bodyid bodydesc bodyenc bodysize/); + 1; + }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'basicfields', + 'vars' => '', + 'line' => 114 + }, 'Parse::RecDescent::Rule' ), + 'personalname' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'STRING' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 77 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 77 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 77 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'personalname', + 'vars' => '', + 'line' => 77 + }, 'Parse::RecDescent::Rule' ), + 'key' => bless( { + 'impcount' => 0, + 'calls' => [ + 'STRING' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 56 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'key', + 'vars' => '', + 'line' => 56 + }, 'Parse::RecDescent::Rule' ), + 'cc' => bless( { + 'impcount' => 0, + 'calls' => [ + 'ADDRESSES' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'ADDRESSES', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 98 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'cc', + 'vars' => '', + 'line' => 98 + }, 'Parse::RecDescent::Rule' ), + 'bodyMD5' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'STRING' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 72 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 72 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 72 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'bodyMD5', + 'vars' => '', + 'line' => 72 + }, 'Parse::RecDescent::Rule' ), + 'envelope' => bless( { + 'impcount' => 0, + 'calls' => [ + 'envelopestruct' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '.*?\\(.*?ENVELOPE', + 'hashname' => '__PATTERN1__', + 'description' => '/.*?\\\\(.*?ENVELOPE/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 188, + 'mod' => '', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'subrule' => 'envelopestruct', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 188 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'pattern' => '.*\\)', + 'hashname' => '__PATTERN2__', + 'description' => '/.*\\\\)/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 188, + 'mod' => '', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 189, + 'code' => '{ $return = $item{envelopestruct} }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'envelope', + 'vars' => '', + 'line' => 188 + }, 'Parse::RecDescent::Rule' ), + 'MESSAGE' => bless( { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '^"MESSAGE"|^MESSAGE', + 'hashname' => '__PATTERN1__', + 'description' => '/^"MESSAGE"|^MESSAGE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 32, + 'mod' => 'i', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 32, + 'code' => '{ $return = "MESSAGE"}' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'MESSAGE', + 'vars' => '', + 'line' => 32 + }, 'Parse::RecDescent::Rule' ), + 'DOUBLE_QUOTED_STRING' => bless( { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '"', + 'hashname' => '__STRING1__', + 'description' => '\'"\'', + 'lookahead' => 0, + 'line' => 41 + }, 'Parse::RecDescent::Literal' ), + bless( { + 'pattern' => '(?:\\\\"|[^"])*', + 'hashname' => '__PATTERN1__', + 'description' => '/(?:\\\\\\\\"|[^"])*/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 41, + 'mod' => '', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'pattern' => '"', + 'hashname' => '__STRING2__', + 'description' => '\'"\'', + 'lookahead' => 0, + 'line' => 41 + }, 'Parse::RecDescent::Literal' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 41, + 'code' => '{ $return = $item{__PATTERN1__} }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'DOUBLE_QUOTED_STRING', + 'vars' => '', + 'line' => 41 + }, 'Parse::RecDescent::Rule' ), + 'subject' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'STRING' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 90 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 90 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 90 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'subject', + 'vars' => '', + 'line' => 90 + }, 'Parse::RecDescent::Rule' ), + 'value' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'NUMBER', + 'STRING', + 'KVPAIRS' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 57 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NUMBER', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 57 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 57 + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 57 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 57 + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '3', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'KVPAIRS', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 57 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 57 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'value', + 'vars' => '', + 'line' => 57 + }, 'Parse::RecDescent::Rule' ), + 'inreplyto' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'STRING' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 91 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 91 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 91 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'inreplyto', + 'vars' => '', + 'line' => 91 + }, 'Parse::RecDescent::Rule' ), + 'messageid' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'STRING' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 92 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 92 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 92 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'messageid', + 'vars' => '', + 'line' => 92 + }, 'Parse::RecDescent::Rule' ), + 'sender' => bless( { + 'impcount' => 0, + 'calls' => [ + 'ADDRESSES' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'ADDRESSES', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 102 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'sender', + 'vars' => '', + 'line' => 102 + }, 'Parse::RecDescent::Rule' ), + 'multipart' => bless( { + 'impcount' => 0, + 'calls' => [ + 'subpart', + 'bodysubtype', + 'bodyparms', + 'bodydisp', + 'bodylang', + 'bodyloc', + 'bodyextra' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 2, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'subrule' => 'subpart', + 'expected' => undef, + 'min' => 1, + 'argcode' => undef, + 'max' => 100000000, + 'matchrule' => 0, + 'repspec' => 's', + 'lookahead' => 0, + 'line' => 162 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'hashname' => '__DIRECTIVE1__', + 'name' => '', + 'lookahead' => 0, + 'line' => 162, + 'code' => '$commit = 1' + }, 'Parse::RecDescent::Directive' ), + bless( { + 'subrule' => 'bodysubtype', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 162 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'bodyparms', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 163 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodydisp', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 163 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodylang', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 163 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodyloc', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 163 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodyextra', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 163 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'hashname' => '__DIRECTIVE2__', + 'name' => '', + 'lookahead' => 0, + 'line' => 164, + 'code' => 'push @{$thisparser->{deferred}}, sub { $subpartCount = 0 };' + }, 'Parse::RecDescent::Directive' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 165, + 'code' => '{ $return = + { bodysubtype => $item{bodysubtype} + , bodytype => \'MULTIPART\' + , bodystructure => $item{\'subpart(s)\'} + }; + take_optional_items($return, \\%item + , qw/bodyparms bodydisp bodylang bodyloc bodyextra/); + 1; + }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'multipart', + 'vars' => '', + 'line' => 162 + }, 'Parse::RecDescent::Rule' ), + 'bodyenc' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'STRING', + 'KVPAIRS' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 71 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 71 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 71 + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'KVPAIRS', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 71 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 71 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'bodyenc', + 'vars' => '', + 'line' => 71 + }, 'Parse::RecDescent::Rule' ), + 'bodydesc' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'STRING' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( { + 'pattern' => '[()]', + 'hashname' => '__PATTERN1__', + 'description' => '/[()]/', + 'lookahead' => -1, + 'rdelim' => '/', + 'line' => 69, + 'mod' => '', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 69 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 69 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 69 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'bodydesc', + 'vars' => '', + 'line' => 69 + }, 'Parse::RecDescent::Rule' ), + 'start' => bless( { + 'impcount' => 0, + 'calls' => [ + 'part' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '.*?\\(.*?BODYSTRUCTURE \\(', + 'hashname' => '__PATTERN1__', + 'description' => '/.*?\\\\(.*?BODYSTRUCTURE \\\\(/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 185, + 'mod' => 'i', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'subrule' => 'part', + 'expected' => undef, + 'min' => 1, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '1', + 'lookahead' => 0, + 'line' => 185 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'pattern' => '\\).*\\)\\r?\\n?', + 'hashname' => '__PATTERN2__', + 'description' => '/\\\\).*\\\\)\\\\r?\\\\n?/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 185, + 'mod' => '', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 186, + 'code' => '{ $return = $item{\'part(1)\'}[0] }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'start', + 'vars' => '', + 'line' => 185 + }, 'Parse::RecDescent::Rule' ), + 'RFC822' => bless( { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '^"RFC822"|^RFC822', + 'hashname' => '__PATTERN1__', + 'description' => '/^"RFC822"|^RFC822/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 33, + 'mod' => 'i', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 33, + 'code' => '{ $return = "RFC822" }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'RFC822', + 'vars' => '', + 'line' => 33 + }, 'Parse::RecDescent::Rule' ), + 'RFCNONCOMPLY' => bless( { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '^\\(\\)', + 'hashname' => '__PATTERN1__', + 'description' => '/^\\\\(\\\\)/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 35, + 'mod' => 'i', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 35, + 'code' => '{ $return = "NIL" }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'RFCNONCOMPLY', + 'vars' => '', + 'line' => 35 + }, 'Parse::RecDescent::Rule' ), + 'textmessage' => bless( { + 'impcount' => 0, + 'calls' => [ + 'TEXT', + 'basicfields', + 'textlines', + 'bodyMD5', + 'bodydisp', + 'bodylang', + 'bodyextra' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 1, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'subrule' => 'TEXT', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 122 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'hashname' => '__DIRECTIVE1__', + 'name' => '', + 'lookahead' => 0, + 'line' => 122, + 'code' => '$commit = 1' + }, 'Parse::RecDescent::Directive' ), + bless( { + 'subrule' => 'basicfields', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 122 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'textlines', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 122 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodyMD5', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 122 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodydisp', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 123 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodylang', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 123 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodyextra', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 123 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 124, + 'code' => '{ + $return = $item{basicfields} || {}; + $return->{bodytype} = \'TEXT\'; + take_optional_items($return, \\%item + , qw/textlines bodyMD5 bodydisp bodylang bodyextra/); + 1; + }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'textmessage', + 'vars' => '', + 'line' => 122 + }, 'Parse::RecDescent::Rule' ), + 'bodyid' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'STRING' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( { + 'pattern' => '[()]', + 'hashname' => '__PATTERN1__', + 'description' => '/[()]/', + 'lookahead' => -1, + 'rdelim' => '/', + 'line' => 68, + 'mod' => '', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 68 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 68 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 68 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'bodyid', + 'vars' => '', + 'line' => 68 + }, 'Parse::RecDescent::Rule' ), + 'bodyextra' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'STRING', + 'STRINGS' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 74 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 74 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 74 + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRINGS', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 74 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 74 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'bodyextra', + 'vars' => '', + 'line' => 74 + }, 'Parse::RecDescent::Rule' ), + 'othertypemessage' => bless( { + 'impcount' => 0, + 'calls' => [ + 'bodytype', + 'basicfields', + 'bodyMD5', + 'bodydisp', + 'bodylang', + 'bodyextra' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'subrule' => 'bodytype', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 132 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'basicfields', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 132 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'bodyMD5', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 132 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodydisp', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 132 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodylang', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 133 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodyextra', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 133 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 134, + 'code' => '{ $return = { bodytype => $item{bodytype} }; + take_optional_items($return, \\%item + , qw/bodyMD5 bodydisp bodylang bodyextra/ ); + merge_hash($return, $item{basicfields}); + 1; + }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'othertypemessage', + 'vars' => '', + 'line' => 132 + }, 'Parse::RecDescent::Rule' ), + 'kvpair' => bless( { + 'impcount' => 0, + 'calls' => [ + 'key', + 'value' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => ')', + 'hashname' => '__STRING1__', + 'description' => '\')\'', + 'lookahead' => -1, + 'line' => 59 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'subrule' => 'key', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 59 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'value', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 59 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 60, + 'code' => '{ $return = { $item{key} => $item{value} } }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'kvpair', + 'vars' => '', + 'line' => 59 + }, 'Parse::RecDescent::Rule' ), + 'bodysize' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'NUMBER' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( { + 'pattern' => '[()]', + 'hashname' => '__PATTERN1__', + 'description' => '/[()]/', + 'lookahead' => -1, + 'rdelim' => '/', + 'line' => 70, + 'mod' => '', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 70 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NUMBER', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 70 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 70 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'bodysize', + 'vars' => '', + 'line' => 70 + }, 'Parse::RecDescent::Rule' ), + 'STRING' => bless( { + 'impcount' => 0, + 'calls' => [ + 'DOUBLE_QUOTED_STRING', + 'SINGLE_QUOTED_STRING', + 'BARESTRING' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'DOUBLE_QUOTED_STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 46 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'SINGLE_QUOTED_STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 46 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 46 + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'BARESTRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 46 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 46 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'STRING', + 'vars' => '', + 'line' => 46 + }, 'Parse::RecDescent::Rule' ), + 'bodytype' => bless( { + 'impcount' => 0, + 'calls' => [ + 'STRING' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 65 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'bodytype', + 'vars' => '', + 'line' => 65 + }, 'Parse::RecDescent::Rule' ), + 'TEXT' => bless( { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '^"TEXT"|^TEXT', + 'hashname' => '__PATTERN1__', + 'description' => '/^"TEXT"|^TEXT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 29, + 'mod' => 'i', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 29, + 'code' => '{ $return = "TEXT" }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'TEXT', + 'vars' => '', + 'line' => 27 + }, 'Parse::RecDescent::Rule' ), + 'to' => bless( { + 'impcount' => 0, + 'calls' => [ + 'ADDRESSES' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'ADDRESSES', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 103 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'to', + 'vars' => '', + 'line' => 103 + }, 'Parse::RecDescent::Rule' ), + 'NIL' => bless( { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '^NIL', + 'hashname' => '__PATTERN1__', + 'description' => '/^NIL/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 34, + 'mod' => 'i', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 34, + 'code' => '{ $return = "NIL" }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'NIL', + 'vars' => '', + 'line' => 34 + }, 'Parse::RecDescent::Rule' ), + 'KVPAIRS' => bless( { + 'impcount' => 0, + 'calls' => [ + 'kvpair' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 62 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'subrule' => 'kvpair', + 'expected' => undef, + 'min' => 1, + 'argcode' => undef, + 'max' => 100000000, + 'matchrule' => 0, + 'repspec' => 's', + 'lookahead' => 0, + 'line' => 62 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 62 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 63, + 'code' => '{ $return = { map { (%$_) } @{$item{\'kvpair(s)\'}} } }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'KVPAIRS', + 'vars' => '', + 'line' => 62 + }, 'Parse::RecDescent::Rule' ), + 'from' => bless( { + 'impcount' => 0, + 'calls' => [ + 'ADDRESSES' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'ADDRESSES', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 100 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'from', + 'vars' => '', + 'line' => 100 + }, 'Parse::RecDescent::Rule' ), + 'bodystructure' => bless( { + 'impcount' => 0, + 'calls' => [ + 'part' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 182 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'subrule' => 'part', + 'expected' => undef, + 'min' => 1, + 'argcode' => undef, + 'max' => 100000000, + 'matchrule' => 0, + 'repspec' => 's', + 'lookahead' => 0, + 'line' => 182 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 182 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 183, + 'code' => '{ $return = $item{\'part(s)\'} }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'bodystructure', + 'vars' => '', + 'line' => 182 + }, 'Parse::RecDescent::Rule' ), + 'PLAIN' => bless( { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '^"PLAIN"|^PLAIN', + 'hashname' => '__PATTERN1__', + 'description' => '/^"PLAIN"|^PLAIN/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 30, + 'mod' => 'i', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 30, + 'code' => '{ $return = "PLAIN" }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'PLAIN', + 'vars' => '', + 'line' => 30 + }, 'Parse::RecDescent::Rule' ), + 'NUMBER' => bless( { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '^(\\d+)', + 'hashname' => '__PATTERN1__', + 'description' => '/^(\\\\d+)/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 36, + 'mod' => '', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 36, + 'code' => '{ $return = $item[1] }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'NUMBER', + 'vars' => '', + 'line' => 36 + }, 'Parse::RecDescent::Rule' ), + 'STRINGS' => bless( { + 'impcount' => 0, + 'calls' => [ + 'STRING' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 48 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'subrule' => 'STRING', + 'expected' => undef, + 'min' => 1, + 'argcode' => undef, + 'max' => 100000000, + 'matchrule' => 0, + 'repspec' => 's', + 'lookahead' => 0, + 'line' => 48 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 48 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 48, + 'code' => '{ $return = $item{\'STRING(s)\'} }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'STRINGS', + 'vars' => '', + 'line' => 48 + }, 'Parse::RecDescent::Rule' ), + 'HTML' => bless( { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '"HTML"|HTML', + 'hashname' => '__PATTERN1__', + 'description' => '/"HTML"|HTML/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 31, + 'mod' => 'i', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 31, + 'code' => '{ $return = "HTML" }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'HTML', + 'vars' => '', + 'line' => 31 + }, 'Parse::RecDescent::Rule' ), + 'bodydisp' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'KVPAIRS' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 67 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'KVPAIRS', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 67 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 67 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'bodydisp', + 'vars' => '', + 'line' => 67 + }, 'Parse::RecDescent::Rule' ), + 'part' => bless( { + 'impcount' => 0, + 'calls' => [ + 'multipart', + 'textmessage', + 'nestedmessage', + 'othertypemessage' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'subrule' => 'multipart', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 177 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 177, + 'code' => '{ $return = bless $item{multipart}, $mibs }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'subrule' => 'textmessage', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 178 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 178, + 'code' => '{ $return = bless $item{textmessage}, $mibs }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => 178 + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'subrule' => 'nestedmessage', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 179 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 179, + 'code' => '{ $return = bless $item{nestedmessage}, $mibs }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => 179 + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '3', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'subrule' => 'othertypemessage', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 180 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 180, + 'code' => '{ $return = bless $item{othertypemessage}, $mibs }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => 180 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'part', + 'vars' => '', + 'line' => 177 + }, 'Parse::RecDescent::Rule' ), + 'nestedmessage' => bless( { + 'impcount' => 0, + 'calls' => [ + 'rfc822message', + 'bodyparms', + 'bodyid', + 'bodydesc', + 'bodyenc', + 'bodysize', + 'envelopestruct', + 'bodystructure', + 'textlines', + 'bodyMD5', + 'bodydisp', + 'bodylang', + 'bodyextra' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 1, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'subrule' => 'rfc822message', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 141 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'hashname' => '__DIRECTIVE1__', + 'name' => '', + 'lookahead' => 0, + 'line' => 141, + 'code' => '$commit = 1' + }, 'Parse::RecDescent::Directive' ), + bless( { + 'subrule' => 'bodyparms', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 141 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'bodyid', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 141 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'bodydesc', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 141 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'bodyenc', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 141 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'bodysize', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 142 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'envelopestruct', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 143 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodystructure', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 143 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'textlines', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 143 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodyMD5', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 144 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodydisp', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 144 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodylang', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 144 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'subrule' => 'bodyextra', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 144 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 145, + 'code' => '{ + $return = {}; + $return->{$_} = $item{$_} + for qw/bodyparms bodyid bodydesc bodyenc bodysize/; +# envelopestruct bodystructure textlines/; + + take_optional_items($return, \\%item + , qw/envelopestruct bodystructure textlines/ + , qw/bodyMD5 bodydisp bodylang bodyextra/); + + merge_hash($return, $item{bodystructure}[0]); + merge_hash($return, $item{basicfields}); + $return->{bodytype} = "MESSAGE" ; + $return->{bodysubtype} = "RFC822" ; + 1; + }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'nestedmessage', + 'vars' => '', + 'line' => 141 + }, 'Parse::RecDescent::Rule' ), + 'SINGLE_QUOTED_STRING' => bless( { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '\'', + 'hashname' => '__STRING1__', + 'description' => '\'\'\'', + 'lookahead' => 0, + 'line' => 40 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'pattern' => '(?:\\\\\'|[^\'])*', + 'hashname' => '__PATTERN1__', + 'description' => '/(?:\\\\\\\\\'|[^\'])*/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 40, + 'mod' => '', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'pattern' => '\'', + 'hashname' => '__STRING2__', + 'description' => '\'\'\'', + 'lookahead' => 0, + 'line' => 40 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 40, + 'code' => '{ $return = $item{__PATTERN1__} }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'SINGLE_QUOTED_STRING', + 'vars' => '', + 'line' => 38 + }, 'Parse::RecDescent::Rule' ), + 'ADDRESSES' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'RFCNONCOMPLY', + 'addressstruct' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 95 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'RFCNONCOMPLY', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 95 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 95 + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '2', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 96 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'subrule' => 'addressstruct', + 'expected' => undef, + 'min' => 1, + 'argcode' => undef, + 'max' => 100000000, + 'matchrule' => 0, + 'repspec' => 's', + 'lookahead' => 0, + 'line' => 96 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 96 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 96, + 'code' => '{ $return = $item{\'addressstruct(s)\'} }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => 96 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'ADDRESSES', + 'vars' => '', + 'line' => 95 + }, 'Parse::RecDescent::Rule' ), + 'bcc' => bless( { + 'impcount' => 0, + 'calls' => [ + 'ADDRESSES' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'ADDRESSES', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 99 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'bcc', + 'vars' => '', + 'line' => 99 + }, 'Parse::RecDescent::Rule' ), + 'rfc822message' => bless( { + 'impcount' => 0, + 'calls' => [ + 'MESSAGE', + 'RFC822' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'subrule' => 'MESSAGE', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 52 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'RFC822', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 52 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 52, + 'code' => '{ $return = "MESSAGE RFC822" }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'rfc822message', + 'vars' => '', + 'line' => 52 + }, 'Parse::RecDescent::Rule' ), + 'addressstruct' => bless( { + 'impcount' => 0, + 'calls' => [ + 'personalname', + 'sourceroute', + 'mailboxname', + 'hostname' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 82 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'subrule' => 'personalname', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 82 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'sourceroute', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 82 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'mailboxname', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 82 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'hostname', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 82 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 82 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 83, + 'code' => '{ bless { personalname => $item{personalname} + , sourceroute => $item{sourceroute} + , mailboxname => $item{mailboxname} + , hostname => $item{hostname} + }, \'Mail::IMAPClient::BodyStructure::Address\'; + }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'addressstruct', + 'vars' => '', + 'line' => 82 + }, 'Parse::RecDescent::Rule' ), + 'sourceroute' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'STRING' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 78 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 78 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 78 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'sourceroute', + 'vars' => '', + 'line' => 78 + }, 'Parse::RecDescent::Rule' ), + 'subpart' => bless( { + 'impcount' => 0, + 'calls' => [ + 'part' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 1, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 175 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'subrule' => 'part', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 175 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 175 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 175, + 'code' => '{$return = $item{part}}' + }, 'Parse::RecDescent::Action' ), + bless( { + 'hashname' => '__DIRECTIVE1__', + 'name' => '', + 'lookahead' => 0, + 'line' => 175, + 'code' => 'push @{$thisparser->{deferred}}, sub { ++$subpartCount; };' + }, 'Parse::RecDescent::Directive' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'subpart', + 'vars' => '', + 'line' => 175 + }, 'Parse::RecDescent::Rule' ), + 'textlines' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'NUMBER' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 50 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NUMBER', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 50 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 50 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'textlines', + 'vars' => '', + 'line' => 50 + }, 'Parse::RecDescent::Rule' ), + 'BARESTRING' => bless( { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '^[)(\'"]', + 'hashname' => '__PATTERN1__', + 'description' => '/^[)(\'"]/', + 'lookahead' => -1, + 'rdelim' => '/', + 'line' => 43, + 'mod' => '', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'pattern' => '^(?!\\(|\\))(?:\\\\ |\\S)+', + 'hashname' => '__PATTERN2__', + 'description' => '/^(?!\\\\(|\\\\))(?:\\\\\\\\ |\\\\S)+/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 43, + 'mod' => '', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 44, + 'code' => '{ $return = $item{__PATTERN1__} }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'BARESTRING', + 'vars' => '', + 'line' => 43 + }, 'Parse::RecDescent::Rule' ), + 'bodyloc' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'STRING' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 75 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 75 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 75 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'bodyloc', + 'vars' => '', + 'line' => 75 + }, 'Parse::RecDescent::Rule' ), + 'bodylang' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'STRING', + 'STRINGS' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 73 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 73 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 73 + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRINGS', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 73 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 73 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'bodylang', + 'vars' => '', + 'line' => 73 + }, 'Parse::RecDescent::Rule' ), + 'envelopestruct' => bless( { + 'impcount' => 0, + 'calls' => [ + 'date', + 'subject', + 'from', + 'sender', + 'replyto', + 'to', + 'cc', + 'bcc', + 'inreplyto', + 'messageid' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 105 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'subrule' => 'date', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 105 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'subject', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 105 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'from', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 105 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'sender', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 105 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'replyto', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 105 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'to', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 105 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'cc', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 105 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'bcc', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 106 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'inreplyto', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 106 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'subrule' => 'messageid', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 106 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 106 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 107, + 'code' => '{ $return = bless {}, "Mail::IMAPClient::BodyStructure::Envelope"; + $return->{$_} = $item{$_} + for qw/date subject from sender replyto to cc/ + , qw/bcc inreplyto messageid/; + 1; + }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'envelopestruct', + 'vars' => '', + 'line' => 105 + }, 'Parse::RecDescent::Rule' ), + 'replyto' => bless( { + 'impcount' => 0, + 'calls' => [ + 'ADDRESSES' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'ADDRESSES', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 101 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'replyto', + 'vars' => '', + 'line' => 101 + }, 'Parse::RecDescent::Rule' ), + 'mailboxname' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NIL', + 'STRING' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'NIL', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 79 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( { + 'subrule' => 'STRING', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 79 + }, 'Parse::RecDescent::Subrule' ) + ], + 'line' => 79 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'mailboxname', + 'vars' => '', + 'line' => 79 + }, 'Parse::RecDescent::Rule' ) + }, + '_AUTOTREE' => undef, + '_check' => { + 'thisoffset' => '', + 'itempos' => '', + 'prevoffset' => '', + 'prevline' => '', + 'prevcolumn' => '', + 'thiscolumn' => '' + }, + '_AUTOACTION' => undef + }, 'Parse::RecDescent' ); +} \ No newline at end of file diff --git a/Mail-IMAPClient-3.25/lib/Mail/IMAPClient/BodyStructure/Parse.pod b/Mail-IMAPClient-3.27/lib/Mail/IMAPClient/BodyStructure/Parse.pod similarity index 100% rename from Mail-IMAPClient-3.25/lib/Mail/IMAPClient/BodyStructure/Parse.pod rename to Mail-IMAPClient-3.27/lib/Mail/IMAPClient/BodyStructure/Parse.pod diff --git a/Mail-IMAPClient-3.25/lib/Mail/IMAPClient/MessageSet.pm b/Mail-IMAPClient-3.27/lib/Mail/IMAPClient/MessageSet.pm similarity index 100% rename from Mail-IMAPClient-3.25/lib/Mail/IMAPClient/MessageSet.pm rename to Mail-IMAPClient-3.27/lib/Mail/IMAPClient/MessageSet.pm diff --git a/Mail-IMAPClient-3.25/lib/Mail/IMAPClient/Thread.grammar b/Mail-IMAPClient-3.27/lib/Mail/IMAPClient/Thread.grammar similarity index 100% rename from Mail-IMAPClient-3.25/lib/Mail/IMAPClient/Thread.grammar rename to Mail-IMAPClient-3.27/lib/Mail/IMAPClient/Thread.grammar diff --git a/Mail-IMAPClient-3.27/lib/Mail/IMAPClient/Thread.pm b/Mail-IMAPClient-3.27/lib/Mail/IMAPClient/Thread.pm new file mode 100644 index 0000000..03b6cdf --- /dev/null +++ b/Mail-IMAPClient-3.27/lib/Mail/IMAPClient/Thread.pm @@ -0,0 +1,1024 @@ +package Mail::IMAPClient::Thread; +use Parse::RecDescent; + +{ my $ERRORS; + + +package Parse::RecDescent::Mail::IMAPClient::Thread; +use strict; +use vars qw($skip $AUTOLOAD ); +@Parse::RecDescent::Mail::IMAPClient::Thread::ISA = (); +$skip = '\s*'; + + +{ +local $SIG{__WARN__} = sub {0}; +# PRETEND TO BE IN Parse::RecDescent NAMESPACE +*Parse::RecDescent::Mail::IMAPClient::Thread::AUTOLOAD = sub +{ + no strict 'refs'; + $AUTOLOAD =~ s/^Parse::RecDescent::Mail::IMAPClient::Thread/Parse::RecDescent/; + goto &{$AUTOLOAD}; +} +} + +push @Parse::RecDescent::Mail::IMAPClient::Thread::ISA, 'Parse::RecDescent'; +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::Thread::thread +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"thread"}; + + Parse::RecDescent::_trace(q{Trying rule: [thread]}, + Parse::RecDescent::_tracefirst($_[1]), + q{thread}, + $tracelevel) + if defined $::RD_TRACE; + + + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{'('}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: ['(' threadmember ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{thread}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{thread}); + %item = (__RULE__ => q{thread}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{thread}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "("; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [threadmember]}, + Parse::RecDescent::_tracefirst($text), + q{thread}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{threadmember})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::Thread::threadmember, 1, 100000000, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{thread}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [threadmember]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{thread}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{threadmember(s)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{thread}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and + substr($text,0,length($_tok)) eq $_tok and + do { substr($text,0,length($_tok)) = ""; 1; } + ) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__}=$_tok; + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{thread}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { + $return = $item{'threadmember(s)'}||undef; + }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: ['(' threadmember ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{thread}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + + unless ( $_matched || defined($score) ) + { + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{thread}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{thread}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{thread}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{thread}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::Thread::NUMBER +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"NUMBER"}; + + Parse::RecDescent::_trace(q{Trying rule: [NUMBER]}, + Parse::RecDescent::_tracefirst($_[1]), + q{NUMBER}, + $tracelevel) + if defined $::RD_TRACE; + + + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{/\\d+/}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [/\\d+/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{NUMBER}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{NUMBER}); + %item = (__RULE__ => q{NUMBER}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [/\\d+/]}, Parse::RecDescent::_tracefirst($text), + q{NUMBER}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:\d+)/) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + + + + Parse::RecDescent::_trace(q{>>Matched production: [/\\d+/]<<}, + Parse::RecDescent::_tracefirst($text), + q{NUMBER}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + + unless ( $_matched || defined($score) ) + { + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{NUMBER}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{NUMBER}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{NUMBER}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{NUMBER}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::Thread::start +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"start"}; + + Parse::RecDescent::_trace(q{Trying rule: [start]}, + Parse::RecDescent::_tracefirst($_[1]), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + + + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{/^\\* THREAD /i}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [/^\\* THREAD /i thread]}, + Parse::RecDescent::_tracefirst($_[1]), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{start}); + %item = (__RULE__ => q{start}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying terminal: [/^\\* THREAD /i]}, Parse::RecDescent::_tracefirst($text), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:^\* THREAD )/i) + { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + $current_match = substr($text, $-[0], $+[0] - $-[0]); + substr($text,0,length($current_match),q{}); + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} + . $current_match . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__}=$current_match; + + + Parse::RecDescent::_trace(q{Trying repeated subrule: [thread]}, + Parse::RecDescent::_tracefirst($text), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->is(q{thread})->at($text); + + unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::Thread::thread, 0, 100000000, $_noactions,$expectation,sub { \@arg }))) + { + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched repeated subrule: [thread]<< (} + . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{thread(s?)}} = $_tok; + push @item, $_tok; + + + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { + $return=$item{'thread(s?)'}||undef; +}; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [/^\\* THREAD /i thread]<<}, + Parse::RecDescent::_tracefirst($text), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + + unless ( $_matched || defined($score) ) + { + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{start}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{start}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{start}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{start}, + $tracelevel) + } + $_[1] = $text; + return $return; +} + +# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) +sub Parse::RecDescent::Mail::IMAPClient::Thread::threadmember +{ + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel||0)+1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"threadmember"}; + + Parse::RecDescent::_trace(q{Trying rule: [threadmember]}, + Parse::RecDescent::_tracefirst($_[1]), + q{threadmember}, + $tracelevel) + if defined $::RD_TRACE; + + + my $err_at = @{$thisparser->{errors}}; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched=0; + my $commit=0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{$_[4]} } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep=""; + my $current_match; + my $expectation = new Parse::RecDescent::Expectation(q{NUMBER, or thread}); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [NUMBER]}, + Parse::RecDescent::_tracefirst($_[1]), + q{threadmember}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{threadmember}); + %item = (__RULE__ => q{threadmember}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [NUMBER]}, + Parse::RecDescent::_tracefirst($text), + q{threadmember}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::Thread::NUMBER($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{threadmember}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [NUMBER]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{threadmember}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{NUMBER}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{threadmember}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = $item{NUMBER} ; }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [NUMBER]<<}, + Parse::RecDescent::_tracefirst($text), + q{threadmember}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + + while (!$_matched && !$commit) + { + + Parse::RecDescent::_trace(q{Trying production: [thread]}, + Parse::RecDescent::_tracefirst($_[1]), + q{threadmember}, + $tracelevel) + if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{threadmember}); + %item = (__RULE__ => q{threadmember}); + my $repcount = 0; + + + Parse::RecDescent::_trace(q{Trying subrule: [thread]}, + Parse::RecDescent::_tracefirst($text), + q{threadmember}, + $tracelevel) + if defined $::RD_TRACE; + if (1) { no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::Thread::thread($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) + { + + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($text), + q{threadmember}, + $tracelevel) + if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace(q{>>Matched subrule: [thread]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{threadmember}, + $tracelevel) + if defined $::RD_TRACE; + $item{q{thread}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{threadmember}, + $tracelevel) + if defined $::RD_TRACE; + + + $_tok = ($_noactions) ? 0 : do { $return = $item{thread} ; }; + unless (defined $_tok) + { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} + . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__}=$_tok; + + + + Parse::RecDescent::_trace(q{>>Matched production: [thread]<<}, + Parse::RecDescent::_tracefirst($text), + q{threadmember}, + $tracelevel) + if defined $::RD_TRACE; + $_matched = 1; + last; + } + + + unless ( $_matched || defined($score) ) + { + + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{threadmember}, + $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) + { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", + q{threadmember}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{$thisparser->{errors}}, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) + { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . + $return . q{])}, "", + q{threadmember}, + $tracelevel); + Parse::RecDescent::_trace(q{(consumed: [} . + Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{threadmember}, + $tracelevel) + } + $_[1] = $text; + return $return; +} +} +package Mail::IMAPClient::Thread; sub new { my $self = bless( { + '_precompiled' => 1, + 'localvars' => '', + 'startcode' => '', + 'namespace' => 'Parse::RecDescent::Mail::IMAPClient::Thread', + 'rules' => { + 'thread' => bless( { + 'impcount' => 0, + 'calls' => [ + 'threadmember' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 10 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'subrule' => 'threadmember', + 'expected' => undef, + 'min' => 1, + 'argcode' => undef, + 'max' => 100000000, + 'matchrule' => 0, + 'repspec' => 's', + 'lookahead' => 0, + 'line' => 10 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 10 + }, 'Parse::RecDescent::InterpLit' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 11, + 'code' => '{ + $return = $item{\'threadmember(s)\'}||undef; + }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'thread', + 'vars' => '', + 'line' => 10 + }, 'Parse::RecDescent::Rule' ), + 'NUMBER' => bless( { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( { + 'pattern' => '\\d+', + 'hashname' => '__PATTERN1__', + 'description' => '/\\\\d+/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 3, + 'mod' => '', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'NUMBER', + 'vars' => '', + 'line' => 1 + }, 'Parse::RecDescent::Rule' ), + 'start' => bless( { + 'impcount' => 0, + 'calls' => [ + 'thread' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 1, + 'items' => [ + bless( { + 'pattern' => '^\\* THREAD ', + 'hashname' => '__PATTERN1__', + 'description' => '/^\\\\* THREAD /i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 16, + 'mod' => 'i', + 'ldelim' => '/' + }, 'Parse::RecDescent::Token' ), + bless( { + 'subrule' => 'thread', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 100000000, + 'matchrule' => 0, + 'repspec' => 's?', + 'lookahead' => 0, + 'line' => 16 + }, 'Parse::RecDescent::Repetition' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 16, + 'code' => '{ + $return=$item{\'thread(s?)\'}||undef; +}' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'start', + 'vars' => '', + 'line' => 15 + }, 'Parse::RecDescent::Rule' ), + 'threadmember' => bless( { + 'impcount' => 0, + 'calls' => [ + 'NUMBER', + 'thread' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'subrule' => 'NUMBER', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 7 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 7, + 'code' => '{ $return = $item{NUMBER} ; }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => undef + }, 'Parse::RecDescent::Production' ), + bless( { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( { + 'subrule' => 'thread', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 8 + }, 'Parse::RecDescent::Subrule' ), + bless( { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 8, + 'code' => '{ $return = $item{thread} ; }' + }, 'Parse::RecDescent::Action' ) + ], + 'line' => 7 + }, 'Parse::RecDescent::Production' ) + ], + 'name' => 'threadmember', + 'vars' => '', + 'line' => 5 + }, 'Parse::RecDescent::Rule' ) + }, + '_AUTOTREE' => undef, + '_check' => { + 'thisoffset' => '', + 'itempos' => '', + 'prevoffset' => '', + 'prevline' => '', + 'prevcolumn' => '', + 'thiscolumn' => '' + }, + '_AUTOACTION' => undef + }, 'Parse::RecDescent' ); +} \ No newline at end of file diff --git a/Mail-IMAPClient-3.25/lib/Mail/IMAPClient/Thread.pod b/Mail-IMAPClient-3.27/lib/Mail/IMAPClient/Thread.pod similarity index 100% rename from Mail-IMAPClient-3.25/lib/Mail/IMAPClient/Thread.pod rename to Mail-IMAPClient-3.27/lib/Mail/IMAPClient/Thread.pod diff --git a/Mail-IMAPClient-3.27/prepare_dist b/Mail-IMAPClient-3.27/prepare_dist new file mode 100755 index 0000000..1312151 --- /dev/null +++ b/Mail-IMAPClient-3.27/prepare_dist @@ -0,0 +1,43 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use File::Copy qw/move/; +use Parse::RecDescent 1.94; + +sub read_file { + my $file = shift; + local ( $/, *FH ); + open( FH, $file ) or return undef; + return ; +} + +build_parser( + 'lib/Mail/IMAPClient/BodyStructure/Parse.grammar', + 'Mail::IMAPClient::BodyStructure::Parse' +); + +build_parser( 'lib/Mail/IMAPClient/Thread.grammar', + 'Mail::IMAPClient::Thread' ); + +sub build_parser { + my ( $grammarfn, $package ) = @_; + + print("* building $package\n"); + + my $grammar = read_file($grammarfn) + or die("cannot read grammar from $grammarfn: $!\n"); + + Parse::RecDescent->Precompile( $grammar, $package ); + + # clumpsy output by Parse::RecDescent + my $outfn = $package . '.pm'; + $outfn =~ s/.*\:\://; + + my $realfn = $grammarfn; + $realfn =~ s/\.\w+$/.pm/; + + move( $outfn, $realfn ) + or die("cannot move $outfn to $realfn: $!\n"); +} diff --git a/Mail-IMAPClient-3.25/t/basic.t b/Mail-IMAPClient-3.27/t/basic.t similarity index 88% rename from Mail-IMAPClient-3.25/t/basic.t rename to Mail-IMAPClient-3.27/t/basic.t index e4ba40c..d35cd08 100644 --- a/Mail-IMAPClient-3.25/t/basic.t +++ b/Mail-IMAPClient-3.27/t/basic.t @@ -2,6 +2,7 @@ use strict; use warnings; +use IO::File qw(); use Test::More; use File::Temp qw(tempfile); @@ -32,7 +33,7 @@ BEGIN { @missing ? plan skip_all => "missing value for: @missing" - : plan tests => 77; + : plan tests => 85; } BEGIN { use_ok('Mail::IMAPClient') or exit; } @@ -134,15 +135,37 @@ my $append_file_size; $append_file_size = $size; } -# test append (string) -{ - ok( $imap->create($target), "create target" ); +ok( $imap->create($target), "create target" ); +ok( $imap->select($target), "select $target" ); +# Test append / append_string if we also have UID capability +SKIP: { + skip "UIDPLUS not supported", 3 unless $imap->has_capability("UIDPLUS"); + + my $ouid = $imap->Uid(); + $imap->Uid(1); + + # test with date that has a leading space + my $d = " 1-Jan-2011 01:02:03 -0500"; + my $uid = $imap->append_string( $target, $testmsg, undef, $d ); + ok( defined $uid, "append test message to $target with date (uid=$uid)" ); + ok( $imap->delete_message($uid), "delete_message $uid" ); + ok( $imap->uidexpunge($uid), "uidexpunge $uid" ); + + # multiple args joined internally in append() + $uid = $imap->append( $target, $testmsg, "Some extra text too" ); + ok( defined $uid, "append test message to $target with date (uid=$uid)" ); + ok( $imap->delete_message($uid), "delete_message $uid" ); + ok( $imap->uidexpunge($uid), "uidexpunge $uid" ); + + $imap->Uid($ouid); +} + +# test append +{ my $uid = $imap->append( $target, $testmsg ); ok( defined $uid, "append test message to $target" ); - ok( $imap->select($target), "select $target" ); - my $msg = ( $uidplus and $uid ) ? $uid : ( $imap->messages )[0]; my $size = $imap->size($msg); @@ -151,9 +174,13 @@ my $append_file_size; my $string = $imap->message_string($msg); ok( defined $string, "returned string" ); - cmp_ok( length($string), '==', $size, "string matches server size" ); + cmp_ok( length($string), '==', $size, "string == server size" ); { + my $var; + ok( $imap->message_to_file( \$var, $msg ), "to SCALAR ref" ); + cmp_ok( length($var), '==', $size, "correct size" ); + my ( $fh, $fn ) = tempfile UNLINK => 1; ok( $imap->message_to_file( $fn, $msg ), "to file $fn" ); @@ -162,7 +189,7 @@ my $append_file_size; cmp_ok( $size, '==', $append_file_size, "size matches string/file" ); - # save message/folder for use below... + # save first message/folder for use below... #OFF ok( $imap->delete($target), "delete folder $target" ); } @@ -399,6 +426,6 @@ sub ok_relaxed_logout { my $imap = shift; local ($@); my $rc = $imap->logout; - my $err = $imap->LastError || "OK"; - ok( ( $rc or $err =~ /^\* BYE/ ), "logout: $err" ); + my $err = $imap->LastError || ""; + ok( ( $rc or $err =~ /^\* BYE/ ), "logout" . ( $err ? ": $err" : "" ) ); } diff --git a/Mail-IMAPClient-3.25/t/body_string.t b/Mail-IMAPClient-3.27/t/body_string.t similarity index 100% rename from Mail-IMAPClient-3.25/t/body_string.t rename to Mail-IMAPClient-3.27/t/body_string.t diff --git a/Mail-IMAPClient-3.25/t/bodystructure.t b/Mail-IMAPClient-3.27/t/bodystructure.t similarity index 95% rename from Mail-IMAPClient-3.25/t/bodystructure.t rename to Mail-IMAPClient-3.27/t/bodystructure.t index 1995da4..8bcf3e6 100644 --- a/Mail-IMAPClient-3.25/t/bodystructure.t +++ b/Mail-IMAPClient-3.27/t/bodystructure.t @@ -2,7 +2,7 @@ use strict; use warnings; -use Test::More tests => 20; +use Test::More tests => 27; BEGIN { use_ok('Mail::IMAPClient::BodyStructure') or exit; } @@ -98,3 +98,20 @@ $bsobj = Mail::IMAPClient::BodyStructure->new($bs9); ok( defined $bsobj, 'parsed ninth' ); is_deeply( [ $bsobj->parts ], \@exp, 'bs9 parts' ) or diag( join(" ", $bsobj->parts ) ); + +# envelope +# date, subject, from, sender, reply-to, to, cc, bcc, in-reply-to, message-id +{ + my $resp = q{* 2 FETCH (UID 42895 ENVELOPE ("Mon, 29 Nov 2010 18:28:23 +0200" "subj" (("Phil Pearl" NIL "phil+from" "dom.loc")) (("Phil Pearl" NIL "phil+sender" "dom.loc")) () ((NIL NIL "phil+to" "dom.loc")) NIL NIL NIL ""))}; + my $env = Mail::IMAPClient::BodyStructure::Envelope->new($resp); + is( $env->subject, "subj", "subject" ); + is( $env->inreplyto, "NIL", "inreplyto" ); + is( $env->messageid, "", "messageid" ); + is( $env->bcc, "NIL", "bcc" ); + is( $env->cc, "NIL", "cc" ); + is( $env->replyto, "NIL", "replyto" ); + + # personalname mailboxname hostname sourcename + my $to = $env->to_addresses; + is_deeply( $to, [ '' ], "to_addresses" ); +} diff --git a/Mail-IMAPClient-3.25/t/fetch_hash.t b/Mail-IMAPClient-3.27/t/fetch_hash.t similarity index 87% rename from Mail-IMAPClient-3.25/t/fetch_hash.t rename to Mail-IMAPClient-3.27/t/fetch_hash.t index 179ebf5..5ce15a0 100644 --- a/Mail-IMAPClient-3.25/t/fetch_hash.t +++ b/Mail-IMAPClient-3.27/t/fetch_hash.t @@ -9,7 +9,7 @@ use strict; use warnings; -use Test::More tests => 18; +use Test::More tests => 19; BEGIN { use_ok('Mail::IMAPClient') or exit; } @@ -110,6 +110,19 @@ my @tests = ( [ [1], qw(BODY.PEEK[]) ], { "1" => { "BODY.PEEK[]" => q{foo}, }, }, ], + [ + "escaped subject", + [ q{* 1 FETCH (UID 1 X-SAVEDATE "28-Jan-2011 16:52:31 -0500" FLAGS (\Seen) ENVELOPE ("Fri, 28 Jan 2011 00:03:30 -0500" "foo \\"bar\\" baz\'s" (("Phil Pearl" NIL "phil" "dom.loc")) (("Phil Pearl" NIL "phil" "dom.loc")) (("Phil Pearl" NIL "phil" "dom.loc")) ((NIL NIL "phil" "dom.loc")) NIL NIL NIL "")) } ], + [ [1], qw(UID X-SAVEDATE FLAGS ENVELOPE) ], + { + "1" => { + 'X-SAVEDATE' => '28-Jan-2011 16:52:31 -0500', + 'UID' => '1', + 'FLAGS' => '\\Seen', + 'ENVELOPE' => q{"Fri, 28 Jan 2011 00:03:30 -0500" "foo \\"bar\\" baz\'s" (("Phil Pearl" NIL "phil" "dom.loc")) (("Phil Pearl" NIL "phil" "dom.loc")) (("Phil Pearl" NIL "phil" "dom.loc")) ((NIL NIL "phil" "dom.loc")) NIL NIL NIL ""} + }, + }, + ], [ "real life example", [ @@ -212,6 +225,10 @@ sub fetch { my ( $self, @args ) = @_; return $self->{_next_fetch_response} || []; } +sub Escaped_results { + my ( $self, @args ) = @_; + return $self->{_next_fetch_response} || []; +} package main; diff --git a/Mail-IMAPClient-3.25/t/messageset.t b/Mail-IMAPClient-3.27/t/messageset.t similarity index 100% rename from Mail-IMAPClient-3.25/t/messageset.t rename to Mail-IMAPClient-3.27/t/messageset.t diff --git a/Mail-IMAPClient-3.25/t/pod.t b/Mail-IMAPClient-3.27/t/pod.t similarity index 100% rename from Mail-IMAPClient-3.25/t/pod.t rename to Mail-IMAPClient-3.27/t/pod.t diff --git a/Mail-IMAPClient-3.25/t/simple.t b/Mail-IMAPClient-3.27/t/simple.t similarity index 100% rename from Mail-IMAPClient-3.25/t/simple.t rename to Mail-IMAPClient-3.27/t/simple.t diff --git a/Mail-IMAPClient-3.25/t/thread.t b/Mail-IMAPClient-3.27/t/thread.t similarity index 100% rename from Mail-IMAPClient-3.25/t/thread.t rename to Mail-IMAPClient-3.27/t/thread.t diff --git a/Mail-IMAPClient-3.25/test_template.txt b/Mail-IMAPClient-3.27/test_template.txt similarity index 100% rename from Mail-IMAPClient-3.25/test_template.txt rename to Mail-IMAPClient-3.27/test_template.txt diff --git a/Makefile b/Makefile index db0809e..494c6c5 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -# $Id: Makefile,v 1.57 2011/01/12 00:59:12 gilles Exp gilles $ +# $Id: Makefile,v 1.60 2011/02/21 02:20:38 gilles Exp gilles $ .PHONY: help usage all @@ -13,6 +13,7 @@ usage: @echo "make test3xx # run tests with (last) Mail-IMAPClient-3.xy" @echo "make test229 # run tests with Mail-IMAPClient-2.2.9" @echo "make tests_win32 # run tests on win32" + @echo "make tests_win32_dev # run test2.bat on win32" @echo "make all " @echo "make upload_index" @echo "make imapsync.exe" @@ -62,18 +63,16 @@ imapsync.1: imapsync pod2man imapsync > imapsync.1 install: testp imapsync.1 + mkdir -p $(DESTDIR)/usr/bin install imapsync $(DESTDIR)/usr/bin/imapsync - install imapsync.1 $(DESTDIR)/usr/share/man/man1/imapsync.1 chmod 755 $(DESTDIR)/usr/bin/imapsync + mkdir -p $(DESTDIR)/usr/share/man/man1 + install imapsync.1 $(DESTDIR)/usr/share/man/man1/imapsync.1 + chmod 644 $(DESTDIR)/usr/share/man/man1/imapsync.1 +.PHONY: cidone ci -deb: - echo making debball $(DEB_FILE) - mkdir -p ../prepa_deb - cd ../prepa_deb && tar xzvf ../prepa_dist/$(DIST_FILE) &&\ - cd ../prepa_dist/$(DIST_NAME) - -.PHONY: cidone +ci: cidone cidone: rcsdiff RCS/* @@ -91,7 +90,7 @@ test_quick_229: imapsync tests.sh CMD_PERL='perl -I./Mail-IMAPClient-2.2.9' /usr/bin/time sh tests.sh locallocal 1>/dev/null test_quick_3xx: imapsync tests.sh - CMD_PERL='perl -I./Mail-IMAPClient-3.25/lib' /usr/bin/time sh tests.sh locallocal 1>/dev/null + CMD_PERL='perl -I./Mail-IMAPClient-3.27/lib' /usr/bin/time sh tests.sh locallocal 1>/dev/null testv: nice -40 sh -x tests.sh @@ -109,7 +108,7 @@ test229: .test_229 touch .test_229 .test_3xx: imapsync tests.sh - CMD_PERL='perl -I./Mail-IMAPClient-3.25/lib' /usr/bin/time sh tests.sh 1>/dev/null + CMD_PERL='perl -I./Mail-IMAPClient-3.27/lib' /usr/bin/time sh tests.sh 1>/dev/null touch .test_3xx testf: clean_test test @@ -122,8 +121,8 @@ upload_index: index.shtml ../../public_html/www.linux-france.org/html/prj/imapsync/ sh $(HOME)/memo/lfo-rsync -.dosify_bat: build_exe.bat test_exe.bat test.bat - unix2dos build_exe.bat test.bat test_exe.bat +.dosify_bat: build_exe.bat test_exe.bat test.bat test2.bat + unix2dos build_exe.bat test.bat test_exe.bat test2.bat touch .dosify_bat dosify_bat: .dosify_bat @@ -139,6 +138,10 @@ tests_win32: dosify_bat # ssh Admin@c 'tasklist /FI "PID eq 0"' # ssh Admin@c 'tasklist /NH /FO CSV' +tests_win32_dev: dosify_bat + scp imapsync test2.bat Admin@c:'C:/msys/1.0/home/Admin/imapsync/' + ssh Admin@c 'C:/msys/1.0/home/Admin/imapsync/test2.bat' + test_imapsync_exe: dosify_bat scp test_exe.bat Admin@c:'C:/msys/1.0/home/Admin/imapsync/' time ssh Admin@c 'C:/msys/1.0/home/Admin/imapsync/test_exe.bat' @@ -161,14 +164,14 @@ imapsync.exe: imapsync build_exe.bat test_exe.bat .dosify_bat imapsync_elf_x86.bin: imapsync rcsdiff imapsync { test 'vadrouille' = "`hostname`" && \ - pp -o imapsync_elf_x86.bin -I Mail-IMAPClient-3.25/lib \ + pp -o imapsync_elf_x86.bin -I Mail-IMAPClient-3.27/lib \ -M Mail::IMAPClient -M IO::Socket -M IO::Socket::SSL \ -M Digest::MD5 -M Digest::HMAC_MD5 -M Term::ReadKey \ -M Authen::NTLM \ imapsync ; \ } || : { test 'petite' = "`hostname`" && \ - pp -o imapsync_elf_x86.bin -I Mail-IMAPClient-3.25/lib \ + pp -o imapsync_elf_x86.bin -I Mail-IMAPClient-3.27/lib \ -M Mail::IMAPClient -M IO::Socket -M IO::Socket::SSL \ -M Digest::MD5 -M Digest::HMAC_MD5 -M Term::ReadKey \ -M Authen::NTLM \ @@ -177,7 +180,7 @@ imapsync_elf_x86.bin: imapsync imapsync ; \ } || : { test 'ks200821.kimsufi.com' = "`hostname`" && \ - pp -o imapsync_elf_x86.bin -I Mail-IMAPClient-3.25/lib \ + pp -o imapsync_elf_x86.bin -I Mail-IMAPClient-3.27/lib \ -M Mail::IMAPClient -M IO::Socket -M IO::Socket::SSL \ -M Digest::MD5 -M Digest::HMAC_MD5 -M Term::ReadKey \ -M Authen::NTLM \ @@ -204,12 +207,17 @@ tarball: cidone all imapsync_elf_x86.bin imapsync.exe cd ../prepa_dist && md5sum -c $(DIST_FILE).md5.txt ls -l ../prepa_dist/$(DIST_FILE) +ks: + rsync -av . imapsync@ks.lamiral.info:public_html/imapsync + { cd /g/var/paypal_reply/ &&\ + rsync -av url_exe url_release url_source imapsync@ks.lamiral.info:/g/var/paypal_reply/ \ + ; } upload_lfo: #rm -rf /home/gilles/public_html/www.linux-france.org/html/prj/imapsync/ #rm -rf /home/gilles/public_html/www.linux-france.org/ftp/prj/imapsync/ rsync -avH ./ChangeLog ./COPYING ./CREDITS ./FAQ \ - ./index.shtml ./INSTALL \ + ./index.shtml ./INSTALL ./TIME \ ./logo_imapsync.png ./logo_imapsync_s.png \ ./paypal.shtml ./README ./style.css ./TODO ./VERSION ./VERSION_EXE \ /home/gilles/public_html/www.linux-france.org/html/prj/imapsync/ diff --git a/README b/README index 7274c33..1242f65 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ NAME Synchronise mailboxes between two imap servers. Good at IMAP migration. More than 36 different IMAP server softwares supported with success. - $Revision: 1.398 $ + $Revision: 1.404 $ SYNOPSIS To synchronise imap account "foo" on "imap.truc.org" to imap account @@ -371,7 +371,7 @@ IMAP SERVERS HUGE MIGRATION Pay special attention to options --subscribed --subscribe --delete --delete2 --delete2folders --expunge --expunge1 --expunge2 --uidexpunge2 - --maxage --minage --maxsize --useheader --fast + --maxage --minage --maxsize --useheader --fast --useuid --usecache If you have many mailboxes to migrate think about a little shell program. Write a file called file.csv (for example) containing users and @@ -417,5 +417,5 @@ SIMILAR SOFTWARES Feedback (good or bad) will often be welcome. - $Id: imapsync,v 1.398 2011/01/18 03:03:24 gilles Exp gilles $ + $Id: imapsync,v 1.404 2011/02/21 03:35:39 gilles Exp gilles $ diff --git a/TIME b/TIME index baa7434..72c75d7 100644 --- a/TIME +++ b/TIME @@ -1,3 +1,7 @@ +200 Added --useuid. +110 Started to allow copy by uid. Added --notakebody + 60 Fixed cache, dealing with filenames containing \ characters. +210 Fixed cache (chose only the greatest uid with dupplicate 11_21+11_201 or 11_21+101_21) 180 Added --authmd51 and --authmd52. --delete2foldersbutnot. Release 1.398 public. Payment in EUR. 60 Added info about biggest messages. --debugimap* implies --debug 130 Added delete2foldersnot option. diff --git a/VERSION b/VERSION index f9cb03d..c0d870c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.398 +1.404 diff --git a/VERSION_EXE b/VERSION_EXE index f8ace8d..4449725 100644 --- a/VERSION_EXE +++ b/VERSION_EXE @@ -1 +1 @@ -1.398 +1.404 diff --git a/i3 b/i3 index 48179da..d60b776 100755 --- a/i3 +++ b/i3 @@ -1,4 +1,4 @@ #!/bin/sh -perl -IMail-IMAPClient-3.25/lib ./imapsync "$@" +perl -IMail-IMAPClient-3.27/lib ./imapsync "$@" diff --git a/imapsync b/imapsync index e79b598..00682b8 100755 --- a/imapsync +++ b/imapsync @@ -20,7 +20,7 @@ tool. Synchronise mailboxes between two imap servers. Good at IMAP migration. More than 36 different IMAP server softwares supported with success. -$Revision: 1.398 $ +$Revision: 1.404 $ =head1 SYNOPSIS @@ -436,6 +436,8 @@ Pay special attention to options --maxsize --useheader --fast +--useuid +--usecache If you have many mailboxes to migrate think about a little shell program. Write a file called file.csv (for example) @@ -489,7 +491,7 @@ Entries for imapsync: Feedback (good or bad) will often be welcome. -$Id: imapsync,v 1.398 2011/01/18 03:03:24 gilles Exp gilles $ +$Id: imapsync,v 1.404 2011/02/21 03:35:39 gilles Exp gilles $ =cut @@ -514,7 +516,7 @@ use File::Spec; use File::Path qw(mkpath rmtree); use IO::Socket qw(:crlf SOL_SOCKET SO_KEEPALIVE); use Errno qw(EAGAIN EPIPE ECONNRESET); -use File::Glob ':glob' ; +use File::Glob qw( :glob ) ; use IO::File; use Test::More 'no_plan'; @@ -589,14 +591,15 @@ my( $max_msg_size_in_bytes, $modules_version, $delete2folders, $delete2foldersonly, $delete2foldersbutnot, - $usecache, + $usecache, $debugcache, + $takebody, %h1_msgs_copy_by_uid, $useuid, $h2_uidguess, ); # main program # global variables initialisation -$rcs = '$Id: imapsync,v 1.398 2011/01/18 03:03:24 gilles Exp gilles $ '; +$rcs = '$Id: imapsync,v 1.404 2011/02/21 03:35:39 gilles Exp gilles $ '; $total_bytes_transferred = 0; $total_bytes_skipped = 0; @@ -623,9 +626,13 @@ get_options(); $modules_version = defined($modules_version) ? $modules_version : 1; +# $SIG{ INT } = \&catch_continue ; + $releasecheck = defined($releasecheck) ? $releasecheck : 1; my $warn_release = ($releasecheck) ? check_last_release() : ''; +$SIG{ INT } = \&catch_exit ; + # default values $tmpdir ||= File::Spec->tmpdir(); @@ -634,6 +641,18 @@ $pidfile ||= $tmpdir . '/imapsync.pid'; # allow Mail::IMAPClient 3.0.xx by default $allow3xx = defined($allow3xx) ? $allow3xx : 1; +$takebody = defined($takebody) ? $takebody : 1; + +if ( $fast ) { + $useuid = 1 ; + $foldersizes = 0 ; +} + +# Activate --usecache if --useuid is set and no --nousecache +$usecache = 1 if ( $useuid and ( ! defined( $usecache ) ) ) ; + + + print banner_imapsync(@argv_copy); print "Temp directory is $tmpdir\n"; @@ -644,7 +663,7 @@ write_pidfile($pidfile) if ($pidfile); $modules_version and print "Modules version list:\n", modules_VERSION(), "\n"; check_lib_version() or - die "imapsync needs perl lib Mail::IMAPClient release 2.2.9, or 3.0.25 or superior \n"; + die "imapsync needs perl lib Mail::IMAPClient release 2.2.9, or 3.25 or superior \n"; exit_clean(0) if ($justbanner); @@ -946,9 +965,6 @@ print "++++ Looping on each folder\n"; FOLDER: foreach my $h1_fold (@h1_folders_wanted) { - last FOLDER if $imap1->IsUnconnected(); - last FOLDER if $imap2->IsUnconnected(); - my $h2_fold = imap2_folder_name($h1_fold); printf("%-35s -> %-35s\n", "[$h1_fold]", "[$h2_fold]"); @@ -982,9 +998,6 @@ FOLDER: foreach my $h1_fold (@h1_folders_wanted) { next FOLDER if ($justfolders); - last FOLDER if $imap1->IsUnconnected(); - last FOLDER if $imap2->IsUnconnected(); - my @h1_msgs = select_msgs($imap1); $debug and print "LIST Host1: ", scalar(@h1_msgs), " messages [@h1_msgs]\n"; @@ -1018,7 +1031,7 @@ FOLDER: foreach my $h1_fold (@h1_folders_wanted) { @h1_msgs_all{ @h1_msgs } = (); @h2_msgs_all{ @h2_msgs } = (); - my @h1_msgs_in_cache = keys %$cache_1_2_ref ; + my @h1_msgs_in_cache = sort { $a <=> $b } keys %$cache_1_2_ref ; my @h2_msgs_in_cache = keys %$cache_2_1_ref ; my ( %h1_msgs_no_cache, %h2_msgs_no_cache ) ; @@ -1030,14 +1043,18 @@ FOLDER: foreach my $h1_fold (@h1_folders_wanted) { my @h1_msgs_no_cache = keys %h1_msgs_no_cache ; my @h2_msgs_no_cache = keys %h2_msgs_no_cache ; + + if ( $useuid ) { + @h1_msgs_copy_by_uid{ @h1_msgs_no_cache } = ( ) ; + @h1_msgs_no_cache = ( ) ; + @h2_msgs_no_cache = ( ) ; + } + $debug and print "Host1 folder [$h1_fold] parsing headers\n"; - last FOLDER if $imap1->IsUnconnected(); - last FOLDER if $imap2->IsUnconnected(); my ($h1_heads_ref, $h1_fir_ref) = ({}, {}); $h1_heads_ref = $imap1->parse_headers([@h1_msgs_no_cache], @useheader) if (@h1_msgs_no_cache); $debug and print "Time headers: ", timenext(), " s\n"; - last FOLDER if $imap1->IsUnconnected(); @$h1_fir_ref{@h1_msgs} = (undef); $h1_fir_ref = $imap1->fetch_hash_2("FLAGS", "INTERNALDATE", "RFC822.SIZE", $h1_fir_ref) @@ -1050,8 +1067,6 @@ FOLDER: foreach my $h1_fold (@h1_folders_wanted) { $nb_errors++; next FOLDER; } - last FOLDER if $imap1->IsUnconnected(); - my @h1_msgs_duplicate; foreach my $m (@h1_msgs_no_cache) { @@ -1079,13 +1094,11 @@ FOLDER: foreach my $h1_fold (@h1_folders_wanted) { my ($h2_heads_ref, $h2_fir_ref) = ( {}, {} ); $h2_heads_ref = $imap2->parse_headers([@h2_msgs_no_cache], @useheader) if (@h2_msgs_no_cache); $debug and print "Time headers: ", timenext(), " s\n"; - last FOLDER if $imap2->IsUnconnected(); @$h2_fir_ref{@h2_msgs} = ( ); # fetch_hash_2 can select by uid with last arg as ref $h2_fir_ref = $imap2->fetch_hash_2("FLAGS", "INTERNALDATE", "RFC822.SIZE", $h2_fir_ref) if (@h2_msgs); $debug and print "Time fir: ", timenext(), " s\n"; - last FOLDER if $imap2->IsUnconnected(); my @h2_msgs_duplicate; foreach my $m (@h2_msgs_no_cache) { @@ -1151,6 +1164,8 @@ FOLDER: foreach my $h1_fold (@h1_folders_wanted) { } } + my $h2_uidnext = $imap2->uidnext( $h2_fold ) ; + $h2_uidguess = $h2_uidnext ; MESS: foreach my $m_id (@h1_hash_keys_sorted_by_uid) { my $h1_size = $h1_hash{$m_id}{'s'}; my $h1_msg = $h1_hash{$m_id}{'m'}; @@ -1171,128 +1186,23 @@ FOLDER: foreach my $h1_fold (@h1_folders_wanted) { unless (exists($h2_hash{$m_id})) { # copy - $debug and print "msg $h1_fold/$h1_msg copying to $h2_fold\n"; - last FOLDER if $imap1->IsUnconnected(); - last FOLDER if $imap2->IsUnconnected(); - my $string; - #print "Message_string Beg\n", memory_consumption(); - $string = $imap1->message_string($h1_msg); - #print "Message_string End\n", memory_consumption(); - unless (defined($string)) { - warn - "- msg $h1_fold/$h1_msg could not fetch [$m_id $h1_size]: ", - $imap1->LastError, "\n"; - $nb_errors++; - $total_bytes_error += $h1_size; - next MESS; - } - - #my $message_file = "tmp_imapsync_$$"; - #$imap1->select($h1_fold); - #unlink($message_file); - #$imap1->message_to_file($message_file, $h1_msg) or do { - # warn "Could not put message #$h1_msg to file $message_file", - # $imap1->LastError; - # $nb_errors++; - # $total_bytes_error += $h1_size; - # next MESS; - #}; - #$string = file_to_string($message_file); - #print "AAA1[$string]ZZZ\n"; - #unlink($message_file); - if (@regexmess) { - $string = regexmess($string); - - #string_to_file($string, $message_file); - } - - - $debug and print - "=" x80, "\n", - "F message content begin next line\n", - $string, - "F message content ended on previous line\n", "=" x 80, "\n"; - my $h1_date = ""; - if ($syncinternaldates) { - $h1_date = $h1_idate; - $debug and print "internal date from host1: [$h1_date]\n"; - $h1_date = good_date($h1_date); - $debug and print "internal date from host1: [$h1_date] (fixed)\n"; - } - - if ($idatefromheader) { - - $h1_date = $imap1->get_header($h1_msg,"Date"); - $debug and print "header date from host1: [$h1_date]\n"; - $h1_date = good_date($h1_date); - $debug and print "header date from host1: [$h1_date] (fixed)\n"; - } - - my $h1_flags = $h1_hash{$m_id}{'F'} || ""; - # RFC 2060: This flag can not be altered by any client - $h1_flags =~ s@\\Recent\s?@@gi; - $h1_flags = flags_regex($h1_flags) if @regexflag; - - $h1_flags = flags_filter($h1_flags, $permanentflags2) if ($permanentflags2); - - my $new_id; - $debug and print "msg $h1_fold/$h1_msg date [$h1_date] flags [$h1_flags] size [$h1_size]\n"; - last FOLDER if $imap1->IsUnconnected(); - last FOLDER if $imap2->IsUnconnected(); - $h1_date = undef if ($h1_date eq ""); - - unless ($dry) { - $max_msg_size_in_bytes = max($h1_size, $max_msg_size_in_bytes); - $new_id = $imap2->append_string($h2_fold, $string, $h1_flags, $h1_date); - unless($new_id){ - no warnings 'uninitialized'; - warn "- msg $h1_fold/$h1_msg couldn't append (Subject:[". - $imap1->subject($h1_msg)."]) to folder $h2_fold: ", - $imap2->LastError, "\n"; - $nb_errors++; - $total_bytes_error += $h1_size; - next MESS; - } - else{ - # good - # $new_id is an id if the IMAP server has the - # UIDPLUS capability else just a ref - print "msg $h1_fold/$h1_msg copied to $h2_fold/$new_id\n"; - $total_bytes_transferred += $h1_size; - $nb_msg_transferred += 1; - touch( "$cache_dir/${h1_msg}_$new_id" ) if ( $usecache and $new_id =~ m{\d+} ); - if($delete) { - print "msg $h1_fold/$h1_msg deleted on host1\n"; - unless($dry) { - $imap1->delete_message($h1_msg); - $h1_nb_msg_deleted += 1; - $imap1->expunge() if ($expunge); - } - } - } - } - else{ - $nb_msg_skipped_dry_mode += 1; - } - #unlink($message_file); + copy_message( $h1_msg, $h1_fold, $h2_fold, $h1_fir_ref, $permanentflags2, $cache_dir ) ; next MESS; } else{ - my $h2_msg = $h2_hash{$m_id}{'m'}; - $debug and print "msg $h1_fold/$h1_msg equals $h2_fold/$h2_msg\n"; - $total_bytes_skipped += $h1_size; - $nb_msg_skipped += 1; - touch( "$cache_dir/${h1_msg}_$h2_msg" ) if ( $usecache ); + # already on host2 + my $h2_msg = $h2_hash{$m_id}{'m'} ; + $debug and print "msg $h1_fold/$h1_msg equals $h2_fold/$h2_msg\n" ; + $total_bytes_skipped += $h1_size ; + $nb_msg_skipped += 1 ; + $debugcache and print "touch $cache_dir/${h1_msg}_$h2_msg\n" if ( $usecache ) ; + touch( "$cache_dir/${h1_msg}_$h2_msg" ) if ( $usecache ) ; } - $fast and next MESS; - #$debug and print "MESSAGE $m_id\n"; my $h2_msg = $h2_hash{$m_id}{'m'}; sync_flags( $h1_msg, $h2_msg, $h2_fold, $permanentflags2, $h1_fir_ref, $h2_fir_ref ) ; - - last FOLDER if $imap2->IsUnconnected(); # Good my $h2_size = $h2_hash{$m_id}{'s'}; @@ -1311,13 +1221,20 @@ FOLDER: foreach my $h1_fold (@h1_folders_wanted) { # END MESS: loop MESS_IN_CACHE: foreach my $h1_msg ( @h1_msgs_in_cache ) { my $h2_msg = $cache_1_2_ref->{ $h1_msg } ; - #$debug and print "cache messages update $h1_msg->$h2_msg\n"; + $debugcache and print "cache messages update $h1_msg->$h2_msg\n"; sync_flags( $h1_msg, $h2_msg, $h2_fold, $permanentflags2, $h1_fir_ref, $h2_fir_ref ) ; my $h1_size = $h1_fir_ref->{ $h1_msg }->{ 'RFC822.SIZE' } ; $total_bytes_skipped += $h1_size; $nb_msg_skipped += 1; } + MESS_BY_UID: foreach my $h1_msg ( sort { $a <=> $b } keys %h1_msgs_copy_by_uid ) { + # copy_message + #print "Copy by uid $h1_fold/$h1_msg\n" ; + copy_message( $h1_msg, $h1_fold, $h2_fold, $h1_fir_ref, $permanentflags2, $cache_dir ) ; + + } + if ($expunge1){ print "Expunging host1 folder $h1_fold\n"; unless($dry) { $imap1->expunge() }; @@ -1365,23 +1282,13 @@ sub sync_flags { print "++++ End looping on each folder\n"; #print memory_consumption(); -my $memory_consumption = memory_consumption(); -my $memory_ratio = ($max_msg_size_in_bytes) ? - sprintf('%.1f', $memory_consumption / $max_msg_size_in_bytes) : "NA"; - $imap1->logout(); $imap2->logout(); -my $host1_reconnect_count = $imap1->Reconnect_counter() || 0; -my $host2_reconnect_count = $imap2->Reconnect_counter() || 0; - - -$timeend = time(); -$timediff = $timeend - $timestart; stats(); -exit_clean(1) if($nb_errors); +exit_clean(1) if( $nb_errors ); exit_clean(0); # END of main program @@ -1490,6 +1397,17 @@ sub ask_for_password { return $password; } +sub catch_exit { + my $signame = shift ; + print "\nGot a SIG$signame!\n" ; + stats( ) ; + exit_clean( ) ; +} + +sub catch_continue { + my $signame = shift ; + print "\nGot a SIG$signame!\n" ; +} sub myconnect { my $self = shift; @@ -1714,8 +1632,8 @@ sub banner_imapsync { my @argv_copy = @_; my $banner_imapsync = join("", '$RCSfile: imapsync,v $ ', - '$Revision: 1.398 $ ', - '$Date: 2011/01/18 03:03:24 $ ', + '$Revision: 1.404 $ ', + '$Date: 2011/02/21 03:35:39 $ ', "\n",localhost_info(), "\n", "Command line used:\n", "$0 ", command_line_nopassword(@argv_copy), "\n", @@ -1751,7 +1669,7 @@ sub write_pidfile { sub exit_clean { my $status = shift; - + $status = defined( $status ) ? $status : 1 ; unlink($pidfile); exit($status); } @@ -2377,9 +2295,142 @@ sub select_msgs { return(@msgs); } + +sub lastuid { + my $imap = shift ; + my $folder = shift ; + my $lastuid_guess = shift ; + my $lastuid ; + + # rfc3501: The only reliable way to identify recent messages is to + # look at message flags to see which have the \Recent flag + # set, or to do a SEARCH RECENT. + # SEARCH RECENT doesn't work this way on courrier. + + my @recent_messages ; + # SEARCH RECENT for each transfer can be expensive with a big folder + # Call commented for now + #@recent_messages = $imap->recent( ) ; + #print "Recent: @recent_messages\n"; + + my $max_recent ; + $max_recent = max( @recent_messages ) ; + + if ( defined( $max_recent ) and ($lastuid_guess <= $max_recent ) ) { + $lastuid = $max_recent ; + }else{ + $lastuid = $lastuid_guess + } + return( $lastuid ) ; +} + +sub copy_message { + # copy + + my ( $h1_msg, $h1_fold, $h2_fold, $h1_fir_ref, $permanentflags2, $cache_dir ) = @_ ; + $debug and print "msg $h1_fold/$h1_msg copying to $h2_fold\n"; + + my $h1_size = $h1_fir_ref->{$h1_msg}->{"RFC822.SIZE"}; + my $h1_flags = $h1_fir_ref->{$h1_msg}->{"FLAGS"}; + my $h1_idate = $h1_fir_ref->{$h1_msg}->{"INTERNALDATE"}; + + my $string; + $string = $imap1->message_string($h1_msg); + unless (defined($string)) { + warn + "- msg $h1_fold/$h1_msg could not be fetched: ", + $imap1->LastError, "\n"; + $nb_errors++; + $total_bytes_error += $h1_size; + return( ) ; + } + + if (@regexmess) { + $string = regexmess($string); + } + + $debug and print + "=" x80, "\n", + "F message content begin next line\n", + $string, + "F message content ended on previous line\n", "=" x 80, "\n"; + my $h1_date = ""; + if ($syncinternaldates) { + $h1_date = $h1_idate; + $debug and print "internal date from host1: [$h1_date]\n"; + $h1_date = good_date($h1_date); + $debug and print "internal date from host1: [$h1_date] (fixed)\n"; + } + + if ($idatefromheader) { + + $h1_date = $imap1->get_header($h1_msg,"Date"); + $debug and print "header date from host1: [$h1_date]\n"; + $h1_date = good_date($h1_date); + $debug and print "header date from host1: [$h1_date] (fixed)\n"; + } + + # RFC 2060: This flag can not be altered by any client + $h1_flags =~ s@\\Recent\s?@@gi; + $h1_flags = flags_regex($h1_flags) if @regexflag; + + $h1_flags = flags_filter($h1_flags, $permanentflags2) if ($permanentflags2); + + my $new_id; + $debug and print "msg $h1_fold/$h1_msg date [$h1_date] flags [$h1_flags] size [$h1_size]\n"; + $h1_date = undef if ($h1_date eq ""); + + unless ($dry) { + $max_msg_size_in_bytes = max($h1_size, $max_msg_size_in_bytes); + $new_id = $imap2->append_string($h2_fold, $string, $h1_flags, $h1_date); + unless($new_id){ + no warnings 'uninitialized'; + warn "- msg $h1_fold/$h1_msg couldn't append (Subject:[". + $imap1->subject($h1_msg)."]) to folder $h2_fold: ", + $imap2->LastError, "\n"; + $nb_errors++; + $total_bytes_error += $h1_size; + return( ) ; + } + else{ + # good + # $new_id is an id if the IMAP server has the + # UIDPLUS capability else just a ref + + + + + + + if ( $new_id !~ m{^\d+$} ) { + $new_id = lastuid( $imap2, $h2_fold, $h2_uidguess ) ; + } + printf( "msg %s/%-10s copied to %s/%-10s\n", $h1_fold, $h1_msg, $h2_fold, $new_id ); + $h2_uidguess++; + $total_bytes_transferred += $h1_size; + $nb_msg_transferred += 1; + $debugcache and print "touch $cache_dir/${h1_msg}_$new_id\n" if ( $usecache ) ; + touch( "$cache_dir/${h1_msg}_$new_id" ) if ( $usecache and $new_id =~ m{^\d+$} ); + if ( $delete ) { + print "msg $h1_fold/$h1_msg deleted on host1\n"; + unless($dry) { + $imap1->delete_message($h1_msg); + $h1_nb_msg_deleted += 1; + $imap1->expunge() if ($expunge); + } + } + } + } + else{ + $nb_msg_skipped_dry_mode += 1; + } + return( ); +} + + sub cache_map { my ( $cache_files_ref, $h1_msgs_ref, $h2_msgs_ref ) = @_; - my ( %map1_2, %map2_1 ) ; + my ( %map1_2, %map2_1, %done2 ) ; my $h1_msgs_hash_ref = { } ; my $h2_msgs_hash_ref = { } ; @@ -2388,12 +2439,29 @@ sub cache_map { @$h2_msgs_hash_ref{ @$h2_msgs_ref } = ( ) ; foreach my $file ( sort @$cache_files_ref ) { - #print "C12: $file\n" ; + $debugcache and print "C12: $file\n" ; ( $uid1, $uid2 ) = match_a_cache_file( $file ) ; if ( exists( $h1_msgs_hash_ref->{ $uid1 } ) and exists( $h2_msgs_hash_ref->{ $uid2 } ) ) { - $map1_2{ $uid1 } = $uid2 ; + # keep only the greatest uid2 + # 130_2301 and + # 130_231 => keep only 130 -> 2301 + + # keep only the greatest uid1 + # 1601_260 and + # 161_260 => keep only 1601 -> 260 + my $max_uid2 = max( $uid2, $map1_2{ $uid1 } || -1 ) ; + if ( exists( $done2{ $max_uid2 } ) ) { + if ( $done2{ $max_uid2 } < $uid1 ) { + $map1_2{ $uid1 } = $max_uid2 ; + delete( $map1_2{ $done2{ $max_uid2 } } ) ; + $done2{ $max_uid2 } = $uid1 ; + } + }else{ + $map1_2{ $uid1 } = $max_uid2 ; + $done2{ $max_uid2 } = $uid1 ; + } }; } @@ -2402,7 +2470,7 @@ sub cache_map { } sub tests_cache_map { - + #$debugcache = 1 ; my @cache_files = qw ( 100_200 101_201 @@ -2416,30 +2484,39 @@ sub tests_cache_map { 180_280 181_280 182_280 + 130_231 + 130_2301 + 161_260 + 1601_260 ) ; - my $msgs_1 = [120, 142, 143, 144, 177, 182 ]; - my $msgs_2 = [ 242, 243, 299, 377, 279, 255, 280 ]; + my $msgs_1 = [120, 142, 143, 144, 161, 1601, 177, 182, 130 ]; + my $msgs_2 = [ 242, 243, 260, 299, 377, 279, 255, 280, 231, 2301 ]; my( $c12, $c21 ) ; ok( ( $c12, $c21 ) = cache_map( \@cache_files, $msgs_1, $msgs_2 ), 'cache_map: 02' ); my $a1 = [ sort { $a <=> $b } keys %$c12 ] ; my $a2 = [ sort { $a <=> $b } keys %$c21 ] ; - ok( 0 == compare_lists( [ 142, 143, 177, 182 ], $a1 ), 'cache_map: 03' ); - ok( 0 == compare_lists( [ 242, 243, 279, 280 ], $a2 ), 'cache_map: 04' ); + ok( 0 == compare_lists( [ 130, 142, 143, 177, 182, 1601 ], $a1 ), 'cache_map: 03' ); + ok( 0 == compare_lists( [ 242, 243, 260, 279, 280, 2301 ], $a2 ), 'cache_map: 04' ); + ok( ! $c12->{161}, 'cache_map: ! 161 -> 260' ); + ok( 260 == $c12->{1601}, 'cache_map: 1601 -> 260' ); + ok( 2301 == $c12->{130}, 'cache_map: 130 -> 2301' ); + #print $c12->{1601}, "\n"; } sub get_cache { - + $debugcache and print "Entering get_cache\n"; my ($cache_dir, $h1_msgs_ref, $h2_msgs_ref) = @_; -d $cache_dir or return( undef ); # exit if cache directory doesn't exist - #print "cache_dir: $cache_dir\n"; + $debugcache and print "cache_dir: $cache_dir\n"; + $cache_dir =~ s{\\}{\\\\}g; my @cache_files = bsd_glob( "$cache_dir/*" ) ; - #print "cache_files: [@cache_files]\n"; + #$debugcache and print "cache_files: [@cache_files]\n"; my( $cache_1_2_ref, $cache_2_1_ref ) = cache_map( \@cache_files, $h1_msgs_ref, $h2_msgs_ref ) ; @@ -2453,6 +2530,7 @@ sub get_cache { #print "\n", map { "c12 $_ -> $cache_1_2_ref->{ $_ }\n" } keys %$cache_1_2_ref ; #print "\n", map { "c21 $_ -> $cache_2_1_ref->{ $_ }\n" } keys %$cache_2_1_ref ; + $debugcache and print "Exiting get_cache\n"; return ( $cache_1_2_ref, $cache_2_1_ref ) ; } @@ -2501,6 +2579,41 @@ sub tests_get_cache { ok( -f 'tmp/cache/F1/F2/100_200', 'get_cache: file NOT removed 100_200'); ok( -f 'tmp/cache/F1/F2/101_201', 'get_cache: file NOT removed 101_201'); + + # strange files + #$debugcache = 1 ; + $maxage = undef ; + ok( ( ! -d 'tmp/cache/rr\uee' or rmtree( 'tmp/cache/rr\uee' )), 'get_cache: rmtree tmp/cache/rr\uee' ) ; + ok( mkpath( 'tmp/cache/rr\uee' ), 'get_cache: mkpath tmp/cache/rr\uee' ) ; + + @test_files_cache = ( qw( + tmp/cache/rr\uee/100_200 + tmp/cache/rr\uee/101_201 + tmp/cache/rr\uee/120_220 + tmp/cache/rr\uee/142_242 + tmp/cache/rr\uee/143_243 + tmp/cache/rr\uee/177_277 + tmp/cache/rr\uee/177_377 + tmp/cache/rr\uee/177_777 + tmp/cache/rr\uee/155_255 + ) ) ; + ok( touch(@test_files_cache), 'get_cache: touch strange tmp/cache/...' ) ; + + # on cache: 100_200 101_201 142_242 143_243 177_277 177_377 177_777 155_255 + # on live: + $msgs_1 = [120, 142, 143, 144, 177 ]; + $msgs_2 = [ 242, 243, 299, 377, 777, 255 ]; + + ok( ( $c12, $c21 ) = get_cache('tmp/cache/rr\uee', $msgs_1, $msgs_2), 'get_cache: strange path 02' ); + $a1 = [ sort { $a <=> $b } keys %$c12 ] ; + $a2 = [ sort { $a <=> $b } keys %$c21 ] ; + ok( 0 == compare_lists( [ 142, 143, 177 ], $a1 ), 'get_cache: strange path 03' ); + ok( 0 == compare_lists( [ 242, 243, 777 ], $a2 ), 'get_cache: strange path 04' ); + ok( -f 'tmp/cache/rr\uee/142_242', 'get_cache: strange path file kept 142_242'); + ok( -f 'tmp/cache/rr\uee/142_242', 'get_cache: strange path file kept 143_243'); + ok( ! -f 'tmp/cache/rr\uee/100_200', 'get_cache: strange path file removed 100_200'); + ok( ! -f 'tmp/cache/rr\uee/101_201', 'get_cache: strange path file removed 101_201'); + } @@ -2553,19 +2666,23 @@ sub clean_cache { my $cache_files_ref = shift ; my $cache_1_2_ref = shift ; - #print map { "$_ -> " . $cache_1_2_ref->{ $_ } . "\n" } keys %$cache_1_2_ref ; + $debugcache and print "Entering clean_cache\n"; + + $debugcache and print map { "$_ -> " . $cache_1_2_ref->{ $_ } . "\n" } keys %$cache_1_2_ref ; foreach my $file ( @$cache_files_ref ) { - #print "$file\n" ; + $debugcache and print "$file\n" ; my ( $uid1, $uid2 ) = match_a_cache_file( $file ) ; - #print "$uid1 $uid2 ", $cache_1_2_ref->{ $uid1 }, "\n" ; + $debugcache and print "u1: $uid1 u2: $uid2 c12: ", $cache_1_2_ref->{ $uid1 } || '', "\n" ; if ( ( ! defined( $uid1 ) ) or ( ! defined( $uid2 ) ) or ( ! exists( $cache_1_2_ref->{ $uid1 } ) ) or ( ! ( $uid2 == $cache_1_2_ref->{ $uid1 } ) ) ) { - #print "remove $file\n" ; - unlink( $file ) ; + $debugcache and print "remove $file\n" ; + unlink( $file ) or warn "$!" ; } } + + $debugcache and print "Exiting clean_cache\n"; return( 1 ) ; } @@ -2610,6 +2727,16 @@ sub tests_clean_cache { } +sub tests_touch { + + ok( (-d 'tmp/tests/' or mkpath( 'tmp/tests/' )), 'tests_touch: mkpath tmp/tests/' ) ; + ok( 1 == touch( 'tmp/tests/lala'), 'tests_touch: tmp/tests/lala') ; + ok( 1 == touch( 'tmp/tests/\y'), 'tests_touch: tmp/tests/\y') ; + ok( 0 == touch( '/aaa'), 'tests_touch: not /aaa') ; + ok( 2 == touch( 'tmp/tests/lili', 'tmp/tests/lolo'), 'tests_touch: 2 files') ; + ok( 1 == touch( 'tmp/tests/\y', '/aaa'), 'tests_touch: 2 files, 1 fails' ) ; + +} sub touch { my @files = @_ ; @@ -2732,8 +2859,17 @@ sub regexmess { return($string); } - sub stats { + $timeend = time(); + $timediff = $timeend - $timestart; + + my $memory_consumption = memory_consumption(); + my $memory_ratio = ($max_msg_size_in_bytes) ? + sprintf('%.1f', $memory_consumption / $max_msg_size_in_bytes) : "NA"; + + my $host1_reconnect_count = $imap1->Reconnect_counter() || 0; + my $host2_reconnect_count = $imap2->Reconnect_counter() || 0; + print "++++ Statistics\n"; print "Transfer time : $timediff sec\n"; print "Messages transferred : $nb_msg_transferred "; @@ -2882,7 +3018,9 @@ sub get_options { "pidfile=s" => \$pidfile, "releasecheck!" => \$releasecheck, "modules_version!" => \$modules_version, - "usecache!" => \$usecache, + "usecache!" => \$usecache, + "debugcache!" => \$debugcache, + "useuid!" => \$useuid, ); $debug and print "get options: [$opt_ret]\n"; @@ -2958,12 +3096,22 @@ sub parse_header_msg { $headstr .= "$H"; } } - #return unless ($headstr); - unless ($headstr){ + + if ( ( ! $headstr) and ( $takebody ) ){ print "no header so taking body first 2Ko\n"; $imap->fetch($m_uid, "BODY.PEEK[TEXT]<0.2048>"); $headstr = $imap->_transaction_literals; + + if ( 4048 <= length( $headstr ) ) { + # the imap server might reply the whole message + # this is bad for memory on huge mailboxes + $takebody = 0 ; + $headstr = '' ; + $h1_msgs_copy_by_uid{ $m_uid } = 1 ; + } } + return() if ( ! $headstr ); + my $size = $s_fir->{$m_uid}->{"RFC822.SIZE"}; my $flags = $s_fir->{$m_uid}->{"FLAGS"}; my $idate = $s_fir->{$m_uid}->{"INTERNALDATE"}; @@ -3035,7 +3183,7 @@ sub is_a_release_number { sub check_last_release { my $public_release = not_long('imapsync_version_lfo'); - print "check_last_release: [$public_release]\n" ; + #print "check_last_release: [$public_release]\n" ; return('unknown') if ($public_release eq 'unknown'); return('timeout') if ($public_release eq 'timeout'); return('unknown') if (! is_a_release_number($public_release)); @@ -3050,7 +3198,7 @@ sub check_last_release { } sub imapsync_version { - my $rcs = '$Id: imapsync,v 1.398 2011/01/18 03:03:24 gilles Exp gilles $ '; + my $rcs = '$Id: imapsync,v 1.404 2011/02/21 03:35:39 gilles Exp gilles $ '; $rcs =~ m/,v (\d+\.\d+)/; my $VERSION = ($1) ? $1: "UNKNOWN"; return($VERSION); @@ -3294,6 +3442,8 @@ Several options are mandatory. --nosyncacls : does not synchronise acls. This is the default. --usecache : Use cache to speedup. --nousecache : Do not use cache. +--useuid : Use uid instead of header as a criterium to sync. + --usecache is then implied unless --nousecache --debug : debug mode. --debugimap1 : imap debug mode for host1. imap debug is very verbose. --debugimap2 : imap debug mode for host2. @@ -3305,8 +3455,7 @@ Several options are mandatory. --justlogin : just login to both host1 and host2 with users credentials, then exit. --justfolders : just do things about folders (ignore messages). ---fast : be faster (just does not sync flags of messages - already transfered). +--fast : be faster, equivalent to --useuid --nofoldersizes --reconnectretry1 : reconnect to host1 if connection is lost up to times per imap command (default is 3) --reconnectretry2 : same as --reconnectretry1 but for host2 @@ -3557,11 +3706,11 @@ sub tests_debug { SKIP: { skip "No test in normal run" if ( not $tests_debug ); - tests_convert_sep_to_slash( ) ; - tests_cache_map( ) ; - tests_get_cache( ) ; tests_clean_cache( ) ; tests_match_a_cache_file( ) ; + tests_touch( ) ; + tests_cache_map( ) ; + tests_get_cache( ) ; } } @@ -3589,6 +3738,7 @@ sub tests { tests_get_cache( ) ; tests_clean_cache( ) ; tests_match_a_cache_file( ) ; + tests_touch( ) ; } } @@ -3621,166 +3771,49 @@ use constant NonFolderArg => 1; # Value to pass to Massage to return $string; }; +# Got from 3.25 +*Mail::IMAPClient::append_string = sub { + my $self = shift; + my $folder = $self->Massage(shift); + my ( $text, $flags, $date ) = @_; + defined $text or $text = ''; -*Mail::IMAPClient::append_file = sub { + if ( defined $flags ) { + $flags =~ s/^\s+//g; + $flags =~ s/\s+$//g; + $flags = "($flags)" if $flags !~ /^\(.*\)$/; + } - my $self = shift; - my $folder = $self->Massage(shift); - my $file = shift; - my $control = shift || undef; - my $count = $self->Count($self->Count+1); - my $flags = shift || undef; - my $date = shift || undef; - - if (defined($flags)) { - $flags =~ s/^\s+//g; - $flags =~ s/\s+$//g; - } - - if (defined($date)) { - $date =~ s/^\s+//g; - $date =~ s/\s+$//g; - } - - $flags = "($flags)" if $flags and $flags !~ /^\(.*\)$/ ; - $date = qq/"$date"/ if $date and $date !~ /^"/ ; - + if ( defined $date ) { + $date =~ s/^\s+//g; + $date =~ s/\s+$//g; + $date = qq("$date") if $date !~ /^"/; + } - unless ( -f $file ) { - $self->LastError("File $file not found.\n"); - return undef; - } + $text =~ s/\r?\n/$CRLF/og; - my $fh = IO::File->new($file) ; + my $command = + "APPEND $folder " + . ( $flags ? "$flags " : "" ) + . ( $date ? "$date " : "" ) . "{" + . length($text) + . "}$CRLF"; - unless ($fh) { - $self->LastError("Unable to open $file: $!\n"); - $@ = "Unable to open $file: $!" ; - carp "unable to open $file: $!"; - return undef; - } + $command .= $text . $CRLF; + $self->_imap_command( $command ) or return undef; - my $bare_nl_count = scalar grep { /^\x0a$|[^\x0d]\x0a$/} <$fh>; + my $data = join '', $self->Results; + #print "ZZZ|$data|ZZZ\n"; + # look for something like return size or self if no size found: + # OK [APPENDUID ] APPEND completed + # 18 OK [APPENDUID 1286144680 1539] APPEND Ok. + my $ret = $data =~ m#^\d+ OK \[APPEND.*\s+(\d+)\].*\Z#m ? $1 : $self; - seek($fh,0,0); - - my $clear = $self->Clear; - - $self->Clear($clear) - if $self->Count >= $clear and $clear > 0; - - my $length = ( -s $file ) + $bare_nl_count; - - my $string = "$count APPEND $folder " . - ( $flags ? "$flags " : "" ) . - ( $date ? "$date " : "" ) . - "{" . $length . "}\x0d\x0a" ; - - $self->_record($count,[ $self->_next_index($count), "INPUT", "$string" ] ); - - my $feedback = $self->_send_line("$string"); - - unless ($feedback) { - $self->LastError("Error sending '$string' to IMAP: $!\n"); - $fh->close; - return undef; - } - - my ($code, $output) = ("",""); - - until ( $code ) { - $output = $self->_read_line or $fh->close, return undef; - foreach my $o (@$output) { - $self->_record($count,$o); # $o is already an array ref - ($code) = $o->[DATA] =~ /(^\+|^\d+\sNO|^\d+\sBAD)/i; - if ($o->[DATA] =~ /^\*\s+BYE/) { - carp $o->[DATA]; - $self->State(Unconnected); - $fh->close; - return undef ; - } elsif ( $o->[DATA]=~ /^\d+\s+(NO|BAD)/i ) { - carp $o->[DATA]; - $fh->close; - return undef; - } - } - } - - { # Narrow scope - # Slurp up headers: later we'll make this more efficient I guess - local $/ = "\x0d\x0a\x0d\x0a"; - my $text = <$fh>; - $text =~ s/\x0d?\x0a/\x0d\x0a/g; - $self->_record($count,[ $self->_next_index($count), "INPUT", "{From file $file}" ] ) ; - $feedback = $self->_send_line($text); - - unless ($feedback) { - $self->LastError("Error sending append msg text to IMAP: $!\n"); - $fh->close; - return undef; - } - _debug($self, "control points to $$control\n") if ref($control) and $self->Debug; - $/ = ref($control) ? "\x0a" : $control ? $control : "\x0a"; - while (defined($text = <$fh>)) { - $text =~ s/\x0d?\x0a/\x0d\x0a/g; - $self->_record( $count, - [ $self->_next_index($count), "INPUT", "{from $file}\x0d\x0a" ] - ); - $feedback = $self->_send_line($text,1); - - unless ($feedback) { - $self->LastError("Error sending append msg text to IMAP: $!\n"); - $fh->close; - return undef; - } - } - $feedback = $self->_send_line("\x0d\x0a"); - - unless ($feedback) { - $self->LastError("Error sending append msg text to IMAP: $!\n"); - $fh->close; - return undef; - } - } - - # Now for the crucial test: Did the append work or not? - ($code, $output) = ("",""); - - my $uid = undef; - until ( $code ) { - $output = $self->_read_line or return undef; - foreach my $o (@$output) { - $self->_record($count,$o); # $o is already an array ref - $self->_debug("append_file: Deciding if " . $o->[DATA] . " has the code.\n") - if $self->Debug; - ($code) = $o->[DATA] =~ /^\d+\s(NO|BAD|OK)/i; - # try to grab new msg's uid from o/p - $o->[DATA] =~ m#UID\s+\d+\s+(\d+)\]# and $uid = $1; - if ($o->[DATA] =~ /^\*\s+BYE/) { - carp $o->[DATA]; - $self->State(Unconnected); - $fh->close; - return undef ; - } elsif ( $o->[DATA]=~ /^\d+\s+(NO|BAD)/i ) { - carp $o->[DATA]; - $fh->close; - return undef; - } - } - } - $fh->close; - - if ($code !~ /^OK/i) { - return undef; - } - - - return defined($uid) ? $uid : $self; + return $ret; }; - *Mail::IMAPClient::fetch_hash = sub { # taken from original lib, # just added split code. @@ -4242,8 +4275,11 @@ no warnings 'once'; #print "call @_ done [", $rc || '', "] [$tries/$retry][" . $self->IsUnconnected . "]\n"; } - if ( !defined($rc) and $retry and $self->IsUnconnected - and $self->LastIMAPCommand !~ /LOGOUT/) { + if ( !defined($rc) + and $retry and $self->IsUnconnected + and ( $self->LastIMAPCommand !~ /LOGOUT/ ) + + ) { print "\nWarning: disconnected. "; if ( $self->reconnect ) { print "Reconnect successful on try #$tries\n"; @@ -4674,6 +4710,7 @@ sub Tls { sub Reconnect_counter { my $self = shift; + $self->{Reconnect_counter} = 0 if ( not defined( $self->{Reconnect_counter} ) ) ; if (@_) { $self->{Reconnect_counter} = shift } return $self->{Reconnect_counter}; diff --git a/imapsync.exe b/imapsync.exe index 11c42d1..c6ed57f 100755 Binary files a/imapsync.exe and b/imapsync.exe differ diff --git a/imapsync_1.383 b/imapsync_1.383 deleted file mode 100755 index 88d47da..0000000 --- a/imapsync_1.383 +++ /dev/null @@ -1,4383 +0,0 @@ -#!/usr/bin/perl - -# structure -# pod documentation -# pragmas -# main program -# global variables initialisation -# default values -# folder loop -# subroutines -# IMAPClient 2.2.9 overrides -# IMAPClient 2.2.9 3.xx ads - -=pod - -=head1 NAME - -imapsync - IMAP synchronisation, sync, copy or migration -tool. Synchronise mailboxes between two imap servers. Good -at IMAP migration. More than 36 different IMAP server softwares -supported with success. - -$Revision: 1.383 $ - -=head1 SYNOPSIS - -To synchronise imap account "foo" on "imap.truc.org" - to imap account "bar" on "imap.trac.org" - with foo password "secret1" - and bar password "secret2": - - imapsync \ - --host1 imap.truc.org --user1 foo --password1 secret1 \ - --host2 imap.trac.org --user2 bar --password2 secret2 - -=head1 INSTALL - - imapsync works fine under any Unix OS with perl. - imapsync works fine under Windows (2000, XP) - with Strawberry Perl 5.10 or 5.12 - or as a standalone binary software imapsync.exe - -imapsync is already available directly on the following distributions -(at least): -FreeBSD, Debian, Ubuntu, Gentoo, Fedora, -NetBSD, Darwin, Mandriva and OpenBSD. - - Get imapsync at - http://www.linux-france.org/prj/imapsync/ - - You'll receive a link to a compressed tarball called imapsync-x.xx.tgz - where x.xx is the version number. Untar the tarball where - you want (on Unix): - - tar xzvf imapsync-x.xx.tgz - - Go into the directory imapsync-x.xx and read the INSTALL file. - The INSTALL file is also at - http://www.linux-france.org/prj/imapsync/INSTALL - - The freshmeat record is at http://freshmeat.net/projects/imapsync/ - -=head1 USAGE - - imapsync [options] - -To get a description of each option just run imapsync like this: - - imapsync --help - imapsync - -The option list: - - imapsync [--host1 server1] [--port1 ] - [--user1 ] [--passfile1 ] - [--host2 server2] [--port2 ] - [--user2 ] [--passfile2 ] - [--ssl1] [--ssl2] - [--tls1] [--tls2] - [--authmech1 ] [--authmech2 ] - [--noauthmd5] - [--folder --folder ...] - [--folderrec --folderrec ...] - [--include ] [--exclude ] - [--prefix2 ] [--prefix1 ] - [--regextrans2 --regextrans2 ...] - [--sep1 ] - [--sep2 ] - [--justfolders] [--justfoldersizes] [--justconnect] [--justbanner] - [--syncinternaldates] - [--idatefromheader] - [--buffersize ] - [--syncacls] - [--regexmess ] [--regexmess ] - [--maxsize ] - [--minsize ] - [--maxage ] - [--minage ] - [--skipheader ] - [--useheader ] [--useheader ] - [--skipsize] [--allowsizemismatch] - [--delete] [--delete2] - [--expunge] [--expunge1] [--expunge2] [--uidexpunge2] - [--subscribed] [--subscribe] [--subscribe_all] - [--nofoldersizes] - [--dry] - [--debug] [--debugimap][--debugimap1][--debugimap2] - [--timeout ] [--fast] - [--split1] [--split2] - [--reconnectretry1 ] [--reconnectretry2 ] - [--pidfile ] - [--tmpdir ] - [--version] [--help] - -=cut -# comment - -=pod - -=head1 DESCRIPTION - -The command imapsync is a tool allowing incremental and -recursive imap transfer from one mailbox to another. - -By default all folders are transferred, recursively. - -We sometimes need to transfer mailboxes from one imap server to -another. This is called migration. - -imapsync is a good tool because it reduces the amount -of data transferred by not transferring a given message if it -is already on both sides. Same headers -and the transfer is done only once. All flags are -preserved, unread will stay unread, read will stay read, -deleted will stay deleted. You can stop the transfer at any -time and restart it later, imapsync works well with bad -connections. imapsync is CPU hungry so nice and renice -commands can be a good help. imapsync can be memory hungry too, -especially with large messages. - -You can decide to delete the messages from the source mailbox -after a successful transfer (it is a good feature when migrating). -In that case, use the --delete --expunge1 options. - -You can also just synchronize a mailbox A from another mailbox B -in case you just want to keep a "live" copy of B in A (--delete2 -may help) - -=head1 OPTIONS - -To get a description of each option just invoke: - -imapsync --help - -=head1 HISTORY - -I wrote imapsync because an enterprise (basystemes) paid me to install -a new imap server without losing huge old mailboxes located on a far -away remote imap server accessible by a low bandwidth link. The tool -imapcp (written in python) could not help me because I had to verify -every mailbox was well transferred and delete it after a good -transfer. imapsync started life as a copy_folder.pl patch. -The tool copy_folder.pl comes from the Mail-IMAPClient-2.1.3 perl -module tarball source (in the examples/ directory of the tarball). - -=head1 EXAMPLE - -While working on imapsync parameters please run imapsync in -dry mode (no modification induced) with the --dry -option. Nothing bad can be done this way. - -To synchronize the imap account "buddy" (with password "secret1") -on host "imap.src.fr" to the imap account "max" (with password "secret2") -on host "imap.dest.fr": - - imapsync --host1 imap.src.fr --user1 buddy --password1 secret1 \ - --host2 imap.dest.fr --user2 max --password2 secret2 - -Then you will have max's mailbox updated from buddy's -mailbox. - -=head1 SECURITY - -You can use --passfile1 instead of --password1 to give the -password since it is safer. With --password1 option any user -on your host can see the password by using the 'ps auxwwww' -command. Using a variable (like $PASSWORD1) is also -dangerous because of the 'ps auxwwwwe' command. So, saving -the password in a well protected file (600 or rw-------) is -the best solution. - -imasync is not totally protected against sniffers on the -network since passwords may be transferred in plain text -if CRAM-MD5 is not supported by your imap servers. Use ---ssl1 (or --tls1) and --ssl2 (or --tls2) to enable -encryption on host1 and host2. - -You may authenticate as one user (typically an admin user), -but be authorized as someone else, which means you don't -need to know every user's personal password. Specify ---authuser1 "adminuser" to enable this on host1. In this -case, --authmech1 PLAIN will be used by default since it -is the only way to go for now. So don't use --authmech1 SOMETHING -with --authuser1 "adminuser", it will not work. -Same behavior with the --authuser2 option. - -When working on Sun/iPlanet/Netscape IMAP servers you must use ---proxyauth1 to enable administrative user to masquerade as another user. -Can also be used on destination server with --proxyauth2 - -=head1 EXIT STATUS - -imapsync will exit with a 0 status (return code) if everything went good. -Otherwise, it exits with a non-zero status. - -So if you have an unreliable internet connection, you can use this loop -in a Bourne shell: - - while ! imapsync ...; do - echo imapsync not complete - done - -=head1 LICENSE - -imapsync is free, open source but not always gratis software cover by -the Do What The Fuck You Want To Public License (WTFPL). -See COPYING file included in the distribution or the web site -http://sam.zoy.org/wtfpl/COPYING - -=head1 MAILING-LIST - -The public mailing-list may be the best way to get support. - -To write on the mailing-list, the address is: - - -To subscribe, send any message (even empty) to: - -then just reply to the confirmation message. - -To unsubscribe, send a message to: - - -To contact the person in charge for the list: - - -The list archives may be available at: -http://www.linux-france.org/prj/imapsync_list/ -So consider that the list is public, anyone -can see your post. Use a pseudonym or do not -post to this list if you want to stay private. - -Thank you for your participation. - -=head1 AUTHOR - -Gilles LAMIRAL - -Feedback good or bad is always welcome. - -The newsgroup comp.mail.imap may be a good place to talk about -imapsync. I read it when imapsync is concerned. -A better place is the public imapsync mailing-list -(see below). - -Gilles LAMIRAL earns his living writing, installing, -configuring and teaching free, open and often gratis -softwares. Do not hesitate to pay him for that services. - -=head1 BUG REPORT GUIDELINES - -Help us to help you: follow the following guidelines. - -Report any bugs or feature requests to the public mailing-list -or to the author. - -Before reporting bugs, read the FAQ, the README and the -TODO files. http://www.linux-france.org/prj/imapsync/ - -Upgrade to last imapsync release, maybe the bug -is already fixed. - -Upgrade to last Mail-IMAPClient Perl module. -http://search.cpan.org/dist/Mail-IMAPClient/ -maybe the bug is already fixed. - -Make a good title with word "imapsync" in it (my spam filter won't filter it), -Don't write an email title with just "imapsync" or "problem", -a good title is made of keywords summary, not too long (one visible line). - -Don't write imapsync in uppercase in the email title, we'll -know you run Windows and you haven't read this README yet. - -Help us to help you: in your report, please include: - - - imapsync version. - - - output given with --debug --debugimap near the failure point. - Isolate a message or two in a folder 'BUG' and use - - imapsync ... --folder 'BUG' --debug --debugimap - - - imap server software on both side and their version number. - - - imapsync with all the options you use, the full command line - you use (except the passwords of course). - - - IMAPClient.pm version. - - - operating system running imapsync. - - - operating systems on both sides and the third side in case - you run imapsync on a foreign host from the both. - - - virtual software context (vmware, xen etc.) - -Most of those values can be found as a copy/paste at the begining of the output. - -One time in your life, read the paper -"How To Ask Questions The Smart Way" -http://www.catb.org/~esr/faqs/smart-questions.html -and then forget it. - -=head1 IMAP SERVERS - -Failure stories reported with the following 3 imap servers: - - - MailEnable 1.54 (Proprietary) http://www.mailenable.com/ - - DBMail 0.9, 2.0.7 (GPL). But DBMail 1.2.1 works. - Patient and confident testers are welcome. - - Imail 7.04 (maybe). - -Success stories reported with the following 40 imap servers -(software names are in alphabetic order): - - - 1und1 H mimap1 84498 [host1] - - a1.net imap.a1.net IMAP4 Ready WARSBL614 00029c23 [host1] - - Archiveopteryx 2.03, 2.04, 2.09, 2.10 [host2], 3.0.0 [host2] - (OSL 3.0) http://www.archiveopteryx.org/ - - BincImap 1.2.3 (GPL) (http://www.bincimap.org/) - - CommuniGatePro server (Redhat 8.0) (Solaris), CommuniGate Pro 5.2.17[host2] (CentOS 5.4) - - Courier IMAP 1.5.1, 2.2.0, 2.1.1, 2.2.1, 3.0.8, 3.0.3, 4.1.1 (GPL) - (http://www.courier-mta.org/) - - Critical Path (7.0.020) - - Cyrus IMAP 1.5, 1.6, 2.1, 2.1.15, 2.1.16, 2.1.18 - 2.2.1, 2.2.2-BETA, 2.2.10, 2.2.12, - v2.2.3-Invoca-RPM-2.2.3-8, - 2.3-alpha (OSI Approved), - v2.2.12-Invoca-RPM-2.2.12-3.RHEL4.1, - 2.2.13, - v2.3.1-Invoca-RPM-2.3.1-2.7.fc5, - v2.3.7, - (http://asg.web.cmu.edu/cyrus/) - - David Tobit V8 (proprietary Message system). - - DBMail 1.2.1, 2.0.4, 2.0.9, 2.2rc1 (GPL) (http://www.dbmail.org/). - 2.0.7 seems buggy. - - Deerfield VisNetic MailServer 5.8.6 [host1] - - dkimap4 [host1] - - Domino (Notes) 4.61[host1], 6.5[host1], 5.0.6, 5.0.7, 7.0.2, 6.0.2CF1, - 7.0.1[host1], 8.0.1[host1], 8.5.2[host2] - - Dovecot 0.99.10.4, 0.99.14, 0.99.14-8.fc4, 1.0-0.beta2.7, - 1.0.0 [dest/source] (LGPL) (http://www.dovecot.org/) - - Eudora WorldMail v2 - - GMX IMAP4 StreamProxy. - - Groupwise IMAP (Novell) 6.x and 7.0. Buggy so see the FAQ. - - hMailServer 5.3.3 [host2] - - iPlanet Messaging server 4.15, 5.1, 5.2 - - IMail 7.15 (Ipswitch/Win2003), 8.12 - - MDaemon 7.0.1, 8.0.2, 8.1, 9.5.4 (Windows server 2003 R2 platform) - - Mercury 4.1 (Windows server 2000 platform) - - Microsoft Exchange Server 5.5, 6.0.6249.0[host1], 6.0.6487.0[host1], - 6.5.7638.1 [host2], Exchange 2007 SP1 (with Update Rollup 2), - Exchange2007-EP-SP2, - Exchange 2010 RTM (Release to Manufacturing) [host2] - - Netscape Mail Server 3.6 (Wintel !) - - Netscape Messaging Server 4.15 Patch 7 - - OpenMail IMAP server B.07.00.k0 (Samsung Contact ?) - - OpenWave - - Oracle Beehive [host1] - - Qualcomm Worldmail (NT) - - Rockliffe Mailsite 5.3.11, 4.5.6 - - Samsung Contact IMAP server 8.5.0 - - Scalix v10.1, 10.0.1.3, 11.0.0.431 - - SmarterMail, Smarter Mail 5.0 Enterprise, Smarter Mail 5.5 [host1]. - - SunONE Messaging server 5.2, 6.0 (SUN JES - Java Enterprise System) - - Sun Java(tm) System Messaging Server 6.2-2.05, 6.2-7.05, 6.3 - - Surgemail 3.6f5-5 - - UW-imap servers (imap-2000b) rijkkramer IMAP4rev1 2000.287 - (RedHat uses UW like 2003.338rh), v12.264 Solaris 5.7 (OSI Approved) - (http://www.washington.edu/imap/) - - UW - QMail v2.1 - - Imap part of TCP/IP suite of VMS 7.3.2 - - Zimbra-IMAP 3.0.1 GA 160, 3.1.0 Build 279, 4.0.5, 4.5.2, 4.5.6, 5.5, 6.x - -Please report to the author any success or bad story with -imapsync and do not forget to mention the IMAP server -software names and version on both sides. This will help -future users. To help the author maintaining this section -report the two lines at the begining of the output if they -are useful to know the softwares. Example: - - Host1 software:* OK louloutte Cyrus IMAP4 v1.5.19 server ready - Host2 software:* OK Courier-IMAP ready - -You can use option --justconnect to get those lines. -Example: - - imapsync --host1 imap.troc.org --host2 imap.trac.org --justconnect - - -=head1 HUGE MIGRATION - -Pay special attention to options ---subscribed ---subscribe ---delete ---delete2 ---delete2folders ---expunge ---expunge1 ---expunge2 ---uidexpunge2 ---maxage ---minage ---maxsize ---useheader ---fast - -If you have many mailboxes to migrate think about a little -shell program. Write a file called file.csv (for example) -containing users and passwords. -The separator used in this example is ';' - -The file.csv file contains: - -user0001;password0001;user0002;password0002 -user0011;password0011;user0012;password0012 -... - -And the shell program is just: - - { while IFS=';' read u1 p1 u2 p2; do - imapsync --user1 "$u1" --password1 "$p1" --user2 "$u2" --password2 "$p2" ... - done ; } < file.csv - -Welcome in shell programming ! - -=head1 Hacking - -Feel free to hack imapsync as the WTFPL Licence permits it. - -=head1 Links - -Entries for imapsync: - http://www.imap.org/products/showall.php - - -=head1 SIMILAR SOFTWARES - - imap_tools : http://www.athensfbc.com/imap_tools - offlineimap : http://software.complete.org/offlineimap - mailsync : http://mailsync.sourceforge.net/ - imapxfer : http://www.washington.edu/imap/ - part of the imap-utils from UW. - mailutil : replace imapxfer in - part of the imap-utils from UW. - http://www.gsp.com/cgi-bin/man.cgi?topic=mailutil - imaprepl : http://www.bl0rg.net/software/ - http://freshmeat.net/projects/imap-repl/ - imap_migrate : http://freshmeat.net/projects/imapmigration/ - imapcopy : http://home.arcor.de/armin.diehl/imapcopy/imapcopy.html - migrationtool : http://sourceforge.net/projects/migrationtool/ - imapmigrate : http://sourceforge.net/projects/cyrus-utils/ - wonko_imapsync: http://wonko.com/article/554 - see also tools/wonko_ruby_imapsync - pop2imap : http://www.linux-france.org/prj/pop2imap/ - - -Feedback (good or bad) will often be welcome. - -$Id: imapsync,v 1.383 2010/11/28 04:28:52 gilles Exp $ - -=cut - - -# pragmas - -use warnings; -++$|; -use strict; -use Carp; -use Getopt::Long; -use Mail::IMAPClient; -use Digest::MD5 qw(md5_base64); -#use Term::ReadKey; -#use IO::Socket::SSL; -use MIME::Base64; -use English; -use File::Basename; -use POSIX qw(uname SIGALRM); -use Fcntl; -use File::Spec; -use File::Path qw(mkpath rmtree); -use IO::Socket qw(:crlf SOL_SOCKET SO_KEEPALIVE); -use Errno qw(EAGAIN EPIPE ECONNRESET); - -use Test::More 'no_plan'; - -eval { require 'usr/include/sysexits.ph' }; - -use constant { - Unconnected => 0, - Connected => 1, # connected; not logged in - Authenticated => 2, # logged in; no mailbox selected - Selected => 3, # mailbox selected -}; - - -# global variables - -my( - $rcs, $pidfile, - $debug, $debugimap, $debugimap1, $debugimap2, $nb_errors, - $host1, $host2, $port1, $port2, - $user1, $user2, $domain1, $domain2, - $password1, $password2, $passfile1, $passfile2, - @folder, @include, @exclude, @folderrec, - $prefix1, $prefix2, - @regextrans2, @regexmess, @regexflag, - $sep1, $sep2, - $syncinternaldates, - $idatefromheader, - $usedatemanip, - $syncacls, - $fastio1, $fastio2, - $maxsize, $minsize, $maxage, $minage, - $skipheader, @useheader, - $skipsize, $allowsizemismatch, $foldersizes, $buffersize, - $delete, $delete2, - $expunge, $expunge1, $expunge2, $uidexpunge2, $dry, - $justfoldersizes, - $authmd5, - $subscribed, $subscribe, $subscribe_all, - $version, $help, - $justconnect, $justfolders, $justbanner, - $fast, - $total_bytes_transferred, - $total_bytes_skipped, - $total_bytes_error, - $nb_msg_transferred, - $nb_msg_skipped, - $nb_msg_skipped_dry_mode, - $h1_nb_msg_duplicate, - $h2_nb_msg_duplicate, - $h1_nb_msg_noheader, - $h2_nb_msg_noheader, - $h1_total_bytes_duplicate, - $h2_total_bytes_duplicate, - $h1_nb_msg_deleted, - $h2_nb_msg_deleted, - $timeout, - $timestart, $timeend, $timediff, - $timesize, $timebefore, - $ssl1, $ssl2, - $tls1, $tls2, - $uid1, $uid2, - $authuser1, $authuser2, - $proxyauth1, $proxyauth2, - $authmech1, $authmech2, - $split1, $split2, - $reconnectretry1, $reconnectretry2, - $tests, $test_builder, $tests_debug, - $allow3xx, $justlogin, - $tmpdir, - $releasecheck, - $max_msg_size_in_bytes, - $modules_version, - $delete2folders, -); - -# main program - -# global variables initialisation - -$rcs = '$Id: imapsync,v 1.383 2010/11/28 04:28:52 gilles Exp $ '; - -$total_bytes_transferred = 0; -$total_bytes_skipped = 0; -$total_bytes_error = 0; -$nb_msg_transferred = 0; -$nb_msg_skipped = $nb_msg_skipped_dry_mode = 0; -$h1_nb_msg_deleted = $h2_nb_msg_deleted = 0; -$h1_nb_msg_duplicate = $h2_nb_msg_duplicate = 0; -$h1_nb_msg_noheader = $h2_nb_msg_noheader = 0; -$h1_total_bytes_duplicate = $h2_total_bytes_duplicate = 0; - -$nb_errors = 0; -$max_msg_size_in_bytes = 0; - -unless(defined(&_SYSEXITS_H)) { - # 64 on my linux box. - eval 'sub EX_USAGE () {64;}' unless defined(&EX_USAGE); -} - -# @ARGV will be eat by get_options() -my @argv_copy = @ARGV; - -get_options(); - -$modules_version = defined($modules_version) ? $modules_version : 1; - -$releasecheck = defined($releasecheck) ? $releasecheck : 1; -my $warn_release = ($releasecheck) ? check_last_release() : ''; - -# default values - -$tmpdir ||= File::Spec->tmpdir(); -$pidfile ||= $tmpdir . '/imapsync.pid'; - -# allow Mail::IMAPClient 3.0.xx by default -$allow3xx = defined($allow3xx) ? $allow3xx : 1; - -print banner_imapsync(@argv_copy); - -print "Temp directory is $tmpdir\n"; - -is_valid_directory($tmpdir); -write_pidfile($pidfile) if ($pidfile); - -$modules_version and print "Modules version list:\n", modules_VERSION(), "\n"; - -check_lib_version() or - die "imapsync needs perl lib Mail::IMAPClient release 2.2.9, or 3.0.25 or superior \n"; - -exit_clean(0) if ($justbanner); - -# By default, 1000 at a time, not more. -$split1 ||= 1000; -$split2 ||= 1000; - -$host1 || missing_option("--host1") ; -$port1 ||= (defined $ssl1 and !defined $tls1) ? 993 : 143; - -$host2 || missing_option("--host2") ; -$port2 ||= (defined $ssl2 && !defined $tls2) ? 993 : 143; - -$debugimap1 = $debugimap2 = 1 if ($debugimap); - -# By default, don't take size to compare -$skipsize = (defined $skipsize) ? $skipsize : 1; - -$uid1 = defined($uid1) ? $uid1 : 1; -$uid2 = defined($uid2) ? $uid2 : 1; - -# Allow size mismatch by default -$allowsizemismatch = defined($allowsizemismatch) ? $allowsizemismatch : 1; - -if ($justconnect) { - justconnect(); - exit_clean(0); -} - -$user1 || missing_option("--user1"); -$user2 || missing_option("--user2"); - -$syncinternaldates = defined($syncinternaldates) ? $syncinternaldates : 1; - -if($idatefromheader) { - print "Turned ON idatefromheader, ", - "will set the internal dates on host2 from the 'Date:' header line.\n"; - $syncinternaldates = 0; - -} -if ($syncinternaldates) { - print "Turned ON syncinternaldates, ", - "will set the internal dates (arrival dates) on host2 same as host1.\n"; -}else{ - print "Turned OFF syncinternaldates\n"; -} - - -if(defined($authmd5) and ($authmd5)) { - $authmech1 ||= 'CRAM-MD5'; - $authmech2 ||= 'CRAM-MD5'; -} -else{ - $authmech1 ||= $authuser1 ? 'PLAIN' : 'LOGIN'; - $authmech2 ||= $authuser2 ? 'PLAIN' : 'LOGIN'; -} - -$authmech1 = uc($authmech1); -$authmech2 = uc($authmech2); - -if (defined $proxyauth1 && !$authuser1) { - missing_option("With --proxyauth1, --authuser1"); -} - -if (defined $proxyauth2 && !$authuser2) { - missing_option("With --proxyauth2, --authuser2"); -} - -$authuser1 ||= $user1; -$authuser2 ||= $user2; - -print "Will try to use $authmech1 authentication on host1\n"; -print "Will try to use $authmech2 authentication on host2\n"; - -$syncacls = (defined($syncacls)) ? $syncacls : 0; -$foldersizes = (defined($foldersizes)) ? $foldersizes : 1; - -$fastio1 = (defined($fastio1)) ? $fastio1 : 0; -$fastio2 = (defined($fastio2)) ? $fastio2 : 0; - -$reconnectretry1 = (defined($reconnectretry1)) ? $reconnectretry1 : 3; -$reconnectretry2 = (defined($reconnectretry2)) ? $reconnectretry2 : 3; - -@useheader = ("Message-Id") unless (@useheader); - -print "Host1: imap server [$host1] port [$port1] user [$user1]\n"; -print "Host2: imap server [$host2] port [$port2] user [$user2]\n"; - -$password1 || $passfile1 || do { - $password1 = ask_for_password($authuser1 || $user1, $host1); -}; - -$password1 = (defined($passfile1)) ? firstline ($passfile1) : $password1; - -$password2 || $passfile2 || do { - $password2 = ask_for_password($authuser2 || $user2, $host2); -}; - -$password2 = (defined($passfile2)) ? firstline ($passfile2) : $password2; - -my $imap1 = (); -my $imap2 = (); - -$timestart = time(); -$timebefore = $timestart; - -$debugimap1 and print "Host1 connection\n"; -$imap1 = login_imap($host1, $port1, $user1, $domain1, $password1, - $debugimap1, $timeout, $fastio1, $ssl1, $tls1, - $authmech1, $authuser1, $reconnectretry1, - $proxyauth1, $uid1); - -$debugimap2 and print "Host2 connection\n"; -$imap2 = login_imap($host2, $port2, $user2, $domain2, $password2, - $debugimap2, $timeout, $fastio2, $ssl2, $tls2, - $authmech2, $authuser2, $reconnectretry2, - $proxyauth2, $uid2); - -# history - -$debug and print "Host1 Buffer I/O: ", $imap1->Buffer(), "\n"; -$debug and print "Host2 Buffer I/O: ", $imap2->Buffer(), "\n"; - - - -die_clean() unless $imap1->IsAuthenticated(); -print "Host1: state Authenticated\n"; -die_clean() unless $imap2->IsAuthenticated(); -print "Host2: state Authenticated\n"; - -print "Host1 capability: ", join(" ", $imap1->capability_update()), "\n"; -print "Host2 capability: ", join(" ", $imap2->capability_update()), "\n"; - - -exit_clean(0) if ($justlogin); - -$split1 and $imap1->Split($split1); -$split2 and $imap2->Split($split2); - -# -# Folder stuff -# - -my ( -@h1_folders_all, %h1_folders_all, @h1_folders_wanted, %requested_folder, %subscribed_folder, -@h2_folders_all, %h2_folders_all, @h2_folders_from_1, %h2_folders_from_1, -); - - -# Make a hash of subscribed folders in source server. -map { $subscribed_folder{$_} = 1 } $imap1->subscribed(); - -# All folders on host1 and host2 -@h1_folders_all = sort $imap1->folders(); -@h2_folders_all = sort $imap2->folders(); - -map { $h1_folders_all{$_} = 1} @h1_folders_all; -map { $h2_folders_all{$_} = 1} @h2_folders_all; - -if (scalar(@folder) or $subscribed or scalar(@folderrec)) { - # folders given by option --folder - if (scalar(@folder)) { - add_to_requested_folders(@folder); - } - - # option --subscribed - if ($subscribed) { - add_to_requested_folders(keys (%subscribed_folder)); - } - - # option --folderrec - if (scalar(@folderrec)) { - foreach my $folderrec (@folderrec) { - add_to_requested_folders($imap1->folders($folderrec)); - } - } -} -else { - # no include, no folder/subscribed/folderrec options => all folders - if (not scalar(@include)) { - add_to_requested_folders(@h1_folders_all); - } -} - - -# consider (optional) includes and excludes -if (scalar(@include)) { - foreach my $include (@include) { - my @included_folders = grep /$include/, @h1_folders_all; - add_to_requested_folders(@included_folders); - print "Including folders matching pattern '$include': @included_folders\n"; - } -} - -if (scalar(@exclude)) { - foreach my $exclude (@exclude) { - my @requested_folder = sort(keys(%requested_folder)); - my @excluded_folders = grep /$exclude/, @requested_folder; - remove_from_requested_folders(@excluded_folders); - print "Excluding folders matching pattern '$exclude': @excluded_folders\n"; - } -} - -# Remove no selectable folders - -foreach my $folder (keys(%requested_folder)) { - if ( not $imap1->selectable($folder)) { - print "Warning: ignoring folder $folder because it is not selectable\n"; - remove_from_requested_folders($folder); - } -} - - -my @requested_folder = sort(keys(%requested_folder)); - -@h1_folders_wanted = @requested_folder; - -my($h1_sep,$h2_sep); -# what are the private folders separators for each server ? - -$debug and print "Getting separators\n"; -$h1_sep = get_separator($imap1, $sep1, "--sep1"); -$h2_sep = get_separator($imap2, $sep2, "--sep2"); - -#my $h1_namespace = $imap1->namespace(); -#my $h2_namespace = $imap2->namespace(); -#$debug and print "Host1 namespace:\n", Data::Dumper->Dump([$h1_namespace]); -#$debug and print "Host2 namespace:\n", Data::Dumper->Dump([$h2_namespace]); - -my($h1_prefix,$h2_prefix); -$h1_prefix = get_prefix($imap1, $prefix1, "--prefix1"); -$h2_prefix = get_prefix($imap2, $prefix2, "--prefix2"); - - -print "Host1 separator and prefix: [$h1_sep][$h1_prefix]\n"; -print "Host2 separator and prefix: [$h2_sep][$h2_prefix]\n"; - - -foreach my $h1_fold (@h1_folders_wanted) { - my $h2_fold; - $h2_fold = imap2_folder_name($h1_fold); - $h2_folders_from_1{$h2_fold}++; -} - -@h2_folders_from_1 = sort keys(%h2_folders_from_1); - -if ($foldersizes) { - foldersizes("Host1", $imap1, @h1_folders_wanted); - foldersizes("Host2", $imap2, @h2_folders_from_1); -} - - -exit_clean(0) if ($justfoldersizes); - -print - "++++ Listing folders\n", - "Host1 folders list:\n", map("[$_]\n",@h1_folders_all),"\n", - "Host2 folders list:\n", map("[$_]\n",@h2_folders_all),"\n"; - -print - "Host1 subscribed folders list: ", - map("[$_] ", sort keys(%subscribed_folder)), "\n" - if ($subscribed); - -my @h2_folders_not_in_1; -@h2_folders_not_in_1 = list_folders_in_2_not_in_1(); - -print "Folders in host2 not in host1:\n", - map("[$_]\n", @h2_folders_not_in_1),"\n"; - -delete_folders_in_2_not_in_1() if $delete2folders; - -# folder loop -print "++++ Looping on each folder\n"; - -FOLDER: foreach my $h1_fold (@h1_folders_wanted) { - - last FOLDER if $imap1->IsUnconnected(); - last FOLDER if $imap2->IsUnconnected(); - - my $h2_fold = imap2_folder_name($h1_fold); - - printf("%-35s -> %-35s\n", "[$h1_fold]", "[$h2_fold]"); - unless ($imap1->select($h1_fold)) { - warn - "Host1 folder $h1_fold: Could not select: ", - $imap1->LastError, "\n"; - $nb_errors++; - next FOLDER; - } - - if ( ! exists($h2_folders_all{$h2_fold})) { - print "Host2 folder $h2_fold does not exist\n"; - print "Creating folder [$h2_fold]\n"; - unless ($dry){ - unless ($imap2->create($h2_fold)){ - warn "Couldn't create [$h2_fold]: ", - $imap2->LastError,"\n"; - $nb_errors++; - next FOLDER; - } - } - else{ - next FOLDER; - } - } - - acls_sync($h1_fold, $h2_fold); - - unless ($imap2->select($h2_fold)) { - warn - "Host2 folder $h2_fold: Could not select: ", - $imap2->LastError, "\n"; - $nb_errors++; - next FOLDER; - } - my @select_results = $imap2->Results(); - - #print "%%% @select_results\n"; - my $permanentflags2 = permanentflags(@select_results); - - if ($expunge){ - print "Expunging host1 $h1_fold\n"; - unless($dry) { $imap1->expunge() }; - #print "Expunging host2 $h2_fold\n"; - #unless($dry) { $imap2->expunge() }; - } - - if (($subscribe and exists $subscribed_folder{$h1_fold}) or $subscribe_all) { - print "Subscribing to folder $h2_fold on destination server\n"; - unless($dry) { $imap2->subscribe($h2_fold) }; - } - - next FOLDER if ($justfolders); - - last FOLDER if $imap1->IsUnconnected(); - last FOLDER if $imap2->IsUnconnected(); - - my @h1_msgs = select_msgs($imap1); - - $debug and print "LIST Host1: ", scalar(@h1_msgs), " messages [@h1_msgs]\n"; - # internal dates on host2 are after the ones on host1 - # normally... - my @h2_msgs = select_msgs($imap2); - - $debug and print "LIST Host2: ", scalar(@h2_msgs), " messages [@h2_msgs]\n"; - - my %h1_hash = (); - my %h2_hash = (); - - $debug and print "Host1 folder [$h1_fold] parsing headers\n"; - last FOLDER if $imap1->IsUnconnected(); - last FOLDER if $imap2->IsUnconnected(); - - my ($h1_heads_ref, $h1_fir_ref) = ({}, {}); - $h1_heads_ref = $imap1->parse_headers([@h1_msgs], @useheader) if (@h1_msgs); - $debug and print "Time headers: ", timenext(), " s\n"; - last FOLDER if $imap1->IsUnconnected(); - - @$h1_fir_ref{@h1_msgs} = (undef); - $h1_fir_ref = $imap1->fetch_hash_2("FLAGS", "INTERNALDATE", "RFC822.SIZE", $h1_fir_ref) - if (@h1_msgs); - $debug and print "Time fir: ", timenext(), " s\n"; - unless ($h1_fir_ref) { - warn - "Host1 folder $h1_fold: Could not fetch_hash_2 ", - scalar(@h1_msgs), " msgs: ", $imap1->LastError, "\n"; - $nb_errors++; - next FOLDER; - } - last FOLDER if $imap1->IsUnconnected(); - - - my @h1_msgs_duplicate; - foreach my $m (@h1_msgs) { - my $rc = parse_header_msg($imap1, $m, $h1_heads_ref, $h1_fir_ref, "F", \%h1_hash); - if (! defined($rc)) { - my $h1_size = $h1_fir_ref->{$m}->{"RFC822.SIZE"} || 0; - print "+ Skipping msg #$m:$h1_size on host1 folder $h1_fold (no header so we ignore this message)\n"; - $total_bytes_skipped += $h1_size; - $nb_msg_skipped += 1; - $h1_nb_msg_noheader +=1; - } elsif(0 == $rc) { - # duplicate - push(@h1_msgs_duplicate, $m); - # duplicate, same id same size? - my $h1_size = $h1_fir_ref->{$m}->{"RFC822.SIZE"} || 0; - $nb_msg_skipped += 1; - $h1_total_bytes_duplicate += $h1_size; - $h1_nb_msg_duplicate += 1; - } - } - $debug and print "Time parsing headers on host1: ", timenext(), " s\n"; - - $debug and print "Host2 folder [$h2_fold] parsing headers\n"; - - my ($h2_heads_ref, $h2_fir_ref) = ({}, {}); - $h2_heads_ref = $imap2->parse_headers([@h2_msgs], @useheader) if (@h2_msgs); - $debug and print "Time headers: ", timenext(), " s\n"; - last FOLDER if $imap2->IsUnconnected(); - - @$h2_fir_ref{@h2_msgs} = (undef); # fetch_hash_2 can select by uid with last arg as ref - $h2_fir_ref = $imap2->fetch_hash_2("FLAGS", "INTERNALDATE", "RFC822.SIZE", $h2_fir_ref) - if (@h2_msgs); - $debug and print "Time fir: ", timenext(), " s\n"; - last FOLDER if $imap2->IsUnconnected(); - - my @h2_msgs_duplicate; - foreach my $m (@h2_msgs) { - my $rc = parse_header_msg($imap2, $m, $h2_heads_ref, $h2_fir_ref, "T", \%h2_hash); - if (! defined($rc)) { - my $h2_size = $h2_fir_ref->{$m}->{"RFC822.SIZE"} || 0; - print "+ Skipping msg #$m:$h2_size in host2 folder $h2_fold (no header so we ignore this message)\n"; - $h2_nb_msg_noheader += 1 ; - } elsif(0 == $rc) { - # duplicate - my $h2_size = $h2_fir_ref->{$m}->{"RFC822.SIZE"} || 0; - $h2_nb_msg_duplicate += 1; - $h2_total_bytes_duplicate += $h2_size; - push(@h2_msgs_duplicate, $m); - } - } - $debug and print "Time parsing headers on host2: ", timenext(), " s\n"; - - $debug and print "++++ Verifying [$h1_fold] -> [$h2_fold]\n"; - # messages in host1 that are not in host2 - - my @h1_hash_keys_sorted_by_uid - = sort {$h1_hash{$a}{'m'} <=> $h1_hash{$b}{'m'}} keys(%h1_hash); - - #print map { $h1_hash{$_}{'m'} . " "} @h1_hash_keys_sorted_by_uid; - - my @h2_hash_keys_sorted_by_uid - = sort {$h2_hash{$a}{'m'} <=> $h2_hash{$b}{'m'}} keys(%h2_hash); - - - if($delete2) { - my @h2_expunge; - foreach my $m_id (@h2_hash_keys_sorted_by_uid) { - #print "$m_id "; - unless (exists($h1_hash{$m_id})) { - my $h2_msg = $h2_hash{$m_id}{'m'}; - my $h2_flags = $h2_hash{$m_id}{'F'} || ""; - my $isdel = $h2_flags =~ /\B\\Deleted\b/ ? 1 : 0; - print "msg $h2_fold/$h2_msg deleted on host2 [$m_id]\n" - if ! $isdel; - push(@h2_expunge, $h2_msg) if $uidexpunge2; - unless ($dry or $isdel) { - $imap2->delete_message($h2_msg); - $h2_nb_msg_deleted += 1; - } - } - } - foreach my $h2_msg (@h2_msgs_duplicate) { - print "msg $h2_fold/$h2_msg deleted [duplicate] on host2\n"; - push(@h2_expunge, $h2_msg) if $uidexpunge2; - unless ($dry) { - $imap2->delete_message($h2_msg); - $h2_nb_msg_deleted += 1; - } - } - - my $cnt = scalar @h2_expunge; - if(@h2_expunge and !$imap2->can("uidexpunge")) { - warn "uidexpunge not supported (< IMAPClient 3.17)\n"; - } - elsif(@h2_expunge) { - print "uidexpunge $cnt message(s)\n"; - $imap2->uidexpunge(\@h2_expunge) if !$dry; - } - } - - MESS: foreach my $m_id (@h1_hash_keys_sorted_by_uid) { - my $h1_size = $h1_hash{$m_id}{'s'}; - my $h1_msg = $h1_hash{$m_id}{'m'}; - my $h1_idate = $h1_hash{$m_id}{'D'}; - - if (defined $maxsize and $h1_size >= $maxsize) { - print "msg $h1_fold/$h1_msg skipping ($h1_size exceeds maxsize limit $maxsize bytes)\n"; - $total_bytes_skipped += $h1_size; - $nb_msg_skipped += 1; - next MESS; - } - if (defined $minsize and $h1_size <= $minsize) { - print "msg $h1_fold/$h1_msg skipping ($h1_size smaller than minsize $minsize bytes)\n"; - $total_bytes_skipped += $h1_size; - $nb_msg_skipped += 1; - next MESS; - } - - unless (exists($h2_hash{$m_id})) { - # copy - $debug and print "msg $h1_fold/$h1_msg copying to $h2_fold\n"; - last FOLDER if $imap1->IsUnconnected(); - last FOLDER if $imap2->IsUnconnected(); - my $string; - #print "Message_string Beg\n", memory_consumption(); - $string = $imap1->message_string($h1_msg); - #print "Message_string End\n", memory_consumption(); - unless (defined($string)) { - warn - "- msg $h1_fold/$h1_msg could not fetch [$m_id $h1_size]: ", - $imap1->LastError, "\n"; - $nb_errors++; - $total_bytes_error += $h1_size; - next MESS; - } - - #my $message_file = "tmp_imapsync_$$"; - #$imap1->select($h1_fold); - #unlink($message_file); - #$imap1->message_to_file($message_file, $h1_msg) or do { - # warn "Could not put message #$h1_msg to file $message_file", - # $imap1->LastError; - # $nb_errors++; - # $total_bytes_error += $h1_size; - # next MESS; - #}; - #$string = file_to_string($message_file); - #print "AAA1[$string]ZZZ\n"; - #unlink($message_file); - if (@regexmess) { - $string = regexmess($string); - - #string_to_file($string, $message_file); - } - - - $debug and print - "=" x80, "\n", - "F message content begin next line\n", - $string, - "F message content ended on previous line\n", "=" x 80, "\n"; - my $h1_date = ""; - if ($syncinternaldates) { - $h1_date = $h1_idate; - $debug and print "internal date from host1: [$h1_date]\n"; - $h1_date = good_date($h1_date); - $debug and print "internal date from host1: [$h1_date] (fixed)\n"; - } - - if ($idatefromheader) { - - $h1_date = $imap1->get_header($h1_msg,"Date"); - $debug and print "header date from host1: [$h1_date]\n"; - $h1_date = good_date($h1_date); - $debug and print "header date from host1: [$h1_date] (fixed)\n"; - } - - my $h1_flags = $h1_hash{$m_id}{'F'} || ""; - # RFC 2060: This flag can not be altered by any client - $h1_flags =~ s@\\Recent\s?@@gi; - $h1_flags = flags_regex($h1_flags) if @regexflag; - - $h1_flags = flags_filter($h1_flags, $permanentflags2) if ($permanentflags2); - - my $new_id; - $debug and print "msg $h1_fold/$h1_msg date [$h1_date] flags [$h1_flags] size [$h1_size]\n"; - last FOLDER if $imap1->IsUnconnected(); - last FOLDER if $imap2->IsUnconnected(); - $h1_date = undef if ($h1_date eq ""); - - unless ($dry) { - $max_msg_size_in_bytes = max($h1_size, $max_msg_size_in_bytes); - $new_id = $imap2->append_string($h2_fold, $string, $h1_flags, $h1_date); - unless($new_id){ - no warnings 'uninitialized'; - warn "- msg $h1_fold/$h1_msg couldn't append (Subject:[". - $imap1->subject($h1_msg)."]) to folder $h2_fold: ", - $imap2->LastError, "\n"; - $nb_errors++; - $total_bytes_error += $h1_size; - next MESS; - } - else{ - # good - # $new_id is an id if the IMAP server has the - # UIDPLUS capability else just a ref - print "msg $h1_fold/$h1_msg copied to $h2_fold/$new_id\n"; - $total_bytes_transferred += $h1_size; - $nb_msg_transferred += 1; - if($delete) { - print "msg $h1_fold/$h1_msg deleted on host1\n"; - unless($dry) { - $imap1->delete_message($h1_msg); - $h1_nb_msg_deleted += 1; - last FOLDER if $imap1->IsUnconnected(); - $imap1->expunge() if ($expunge); - last FOLDER if $imap1->IsUnconnected(); - } - } - } - } - else{ - $nb_msg_skipped_dry_mode += 1; - } - #unlink($message_file); - next MESS; - } - else{ - #my $h2_size = $h2_hash{$m_id}{'s'}; - my $h2_msg = $h2_hash{$m_id}{'m'}; - #my $h2_idate = $h2_hash{$m_id}{'D'}; - $debug and print "msg $h1_fold/$h1_msg equals $h2_fold/$h2_msg\n"; - $total_bytes_skipped += $h1_size; - $nb_msg_skipped += 1; - } - - $fast and next MESS; - #$debug and print "MESSAGE $m_id\n"; - my $h2_size = $h2_hash{$m_id}{'s'}; - my $h2_msg = $h2_hash{$m_id}{'m'}; - - # used cached flag values for efficiency - my $h1_flags = $h1_hash{$m_id}{'F'} || ""; - my $h2_flags = $h2_hash{$m_id}{'F'} || ""; - - # RFC 2060: This flag can not be altered by any client - $h1_flags =~ s@\\Recent\s?@@gi; - $h1_flags = flags_regex($h1_flags) if @regexflag; - $h1_flags = flags_filter($h1_flags, $permanentflags2) if ($permanentflags2); - - - # compare flags - set flags if there a difference - my @h1_flags = sort split(' ', $h1_flags ); - my @h2_flags = sort split(' ', $h2_flags ); - my $diff = compare_lists(\@h1_flags, \@h2_flags); - - $diff and $debug and print "msg $h2_fold/$h2_msg replacing h2 flags($h2_flags) with h1 flags($h1_flags)\n"; - - # This sets flags so flags can be removed with this - # When you remove a \Seen flag on host1 you want to it - # to be removed on host2. Just add flags is not what - # we need most of the time. - - if (!$dry and $diff and !$imap2->store($h2_msg, "FLAGS.SILENT (@h1_flags)") ) { - warn "- msg $h2_fold/$h2_msg could not add flags @h1_flags", - $imap2->LastError, "\n"; - #$nb_errors++; - } - last FOLDER if $imap2->IsUnconnected(); - - $debug and do { - my @h2_flags = @{ $imap2->flags($h2_msg) || [] }; - last FOLDER if $imap2->IsUnconnected(); - - print "host1 flags: $h1_flags\n", - "host2 flags: @h2_flags\n"; - - print "Looking dates\n"; - #my $h1_idate = $imap1->internaldate($h1_msg); - #my $h2_idate = $imap2->internaldate($h2_msg); - my $h1_idate = $h1_hash{$m_id}{'D'}; - my $h2_idate = $h2_hash{$m_id}{'D'}; - print - "host1 internal date: $h1_idate\n", - "host2 internal date: $h2_idate\n"; - - #unless ($h1_idate eq $h2_idate) { - # print "!!! Dates differs !!!\n"; - #} - }; - unless ($skipsize or ($h1_size == $h2_size)) { - # Bad size - print - "- msg $h1_fold/$h1_msg size diff $h1_size != $h2_size $h2_fold/$h2_msg\n"; - $nb_errors++; - } - else { - # Good - $debug and print - "msg $h1_fold/$h1_msg sizes ok $h1_size <=> $h2_size $h2_fold/$h2_msg\n"; - if($delete) { - print "msg $h1_fold/$h1_msg deleted on host1\n"; - unless($dry) { - $imap1->delete_message($h1_msg); - $h1_nb_msg_deleted += 1; - $imap1->expunge() if ($expunge); - } - } - } - } - if ($expunge1){ - print "Expunging host1 folder $h1_fold\n"; - unless($dry) { $imap1->expunge() }; - } - if ($expunge2){ - print "Expunging host2 folder $h2_fold\n"; - unless($dry) { $imap2->expunge() }; - } - -$debug and print "Time: ", timenext(), " s\n"; -} - -print "++++ End looping on each folder\n"; -#print memory_consumption(); - -my $memory_consumption = memory_consumption(); -my $memory_ratio = ($max_msg_size_in_bytes) ? - sprintf('%.1f', $memory_consumption / $max_msg_size_in_bytes) : "NA"; - - -$imap1->logout(); -$imap2->logout(); - -my $host1_reconnect_count = $imap1->Reconnect_counter() || 0; -my $host2_reconnect_count = $imap2->Reconnect_counter() || 0; - - -$timeend = time(); -$timediff = $timeend - $timestart; - -stats(); -exit_clean(1) if($nb_errors); -exit_clean(0); - -# END of main program - -# subroutines - -sub max { - return(undef) if (0 == scalar(@_)); - my @sorted = sort { $a <=> $b } @_; - return(pop(@sorted)); -} - -sub tests_max { - ok(0 == max(0), "max 0"); - ok(1 == max(1), "max 1"); - ok(-1 == max(-1), "max -1"); - ok(! defined(max()), "max no arg"); - ok(100 == max(1, 100), "max 1 100"); - ok(100 == max(100, 1), "max 100 1"); - ok(100 == max(100, 42, 1), "max 100 42 1"); - ok(100 == max(100, "42", 1), "max 100 42 1"); - ok(100 == max("100", "42", 1), "max 100 42 1"); - #ok(100 == max(100, "haha", 1), "max 100 42 1"); -} - -sub check_lib_version { - $debug and print "IMAPClient $Mail::IMAPClient::VERSION\n"; - if ($Mail::IMAPClient::VERSION eq '2.2.9') { - override_imapclient(); - return(1); - } - else{ - # 3.x.x is no longer buggy with imapsync. - if ($allow3xx) { - return(1); - }else{ - return(0); - } - } -} - -sub modules_VERSION { - - my @list_version; - - foreach my $module (qw( -Mail::IMAPClient -IO::Socket -IO::Socket::SSL -Digest::MD5 -Digest::HMAC_MD5 -Term::ReadKey -Authen::NTLM)) - { - my $v = "?"; - - if (eval "require $module") { - # module is here - $v = eval "\$${module}::VERSION"; - }else{ - # no module - $v = "?"; - } - #print ("$module ", $v, "\n"); - push (@list_version, sprintf("%-20s %s\n", $module, $v)); - } - return(@list_version); -} - -# Construct a command line copy with passwords replaced by MASKED. -sub command_line_nopassword { - my @argv_copy = @_; - my @argv_nopassword; - while (@argv_copy) { - my $arg = shift(@argv_copy); # option name or value - if ($arg =~ m/-password[12]/) { - shift(@argv_copy); # password value - push(@argv_nopassword, $arg, "MASKED"); # option name and fake value - }else{ - push(@argv_nopassword, $arg); # same option or value - } - } - return("@argv_nopassword"); -} - -sub tests_command_line_nopassword { - - ok('' eq command_line_nopassword(), 'command_line_nopassword void'); - ok('--blabla' eq command_line_nopassword('--blabla'), 'command_line_nopassword --blabla'); - #print command_line_nopassword((qw{ --password1 secret1 })), "\n"; - ok('--password1 MASKED' eq command_line_nopassword(qw{ --password1 secret1}), 'command_line_nopassword --password1'); - ok('--blabla --password1 MASKED --blibli' - eq command_line_nopassword(qw{ --blabla --password1 secret1 --blibli }), 'command_line_nopassword --password1 --blibli'); - - -} - -sub ask_for_password { - my ($user, $host) = @_; - print "What's the password for $user\@$host? "; - Term::ReadKey::ReadMode(2); - my $password = <>; - chomp $password; - printf "\n"; - Term::ReadKey::ReadMode(0); - return $password; -} - - -sub myconnect { - my $self = shift; - - $debug and print "Entering myconnect\n"; - %$self = (%$self, @_); - - my $sock = (($self->Ssl) ? IO::Socket::SSL->new : IO::Socket::INET->new); - my $dp = ($self->Ssl ? 'imaps(993)' : 'imap(143)'); - - $debug and print "Calling configure\n"; - my $ret = $sock->configure({ - PeerAddr => $self->Server , - PeerPort => $self->Port||$dp , - Proto => 'tcp' , - Timeout => $self->Timeout||0 , - Debug => $self->Debug , - }); - unless ( defined($ret) ) { - $self->LastError( "$@\n"); - $@ = "$@"; - carp "$@" - unless defined wantarray; - return undef; - } - $sock->autoflush(1); - - my $banner = $sock->getline(); - $debug and print "Read: $banner"; - - $self->Banner($banner); - $self->RawSocket2($sock); - $self->State(Connected); - - if ($self->Tls) { - starttls($self); - } - - $self->Ignoresizeerrors($allowsizemismatch); - - if ($self->User and $self->Password) { - $debug and print "Calling login\n"; - return $self->login ; - } - else { - return $self; - } -} - - - - -sub starttls { - my $self = shift; - my $socket = $self->RawSocket2(); - - $debug and print "Entering starttls\n"; - unless ($self->has_capability("STARTTLS")) { - die_clean( "No STARTTLS capability" ); - } - print $socket, "\n"; - print $socket "z00 STARTTLS\015\012"; - CORE::select( undef, undef, undef, 0.025 ); - my $txt = $socket->getline(); - $debug and print "Read tls: $txt"; - unless($txt =~ /^z00 OK/){ - die_clean( "Invalid response for STARTTLS: $txt\n" ); - } - $debug and print "Calling start_SSL\n"; - unless(IO::Socket::SSL->start_SSL($socket, - { - SSL_version => "TLSV1", - SSL_startHandshake => 1, - SSL_verify_depth => 1, - })) - { - die_clean( "Couldn't start TLS: ".IO::Socket::SSL::errstr()."\n"); - } - if (ref($socket) ne "IO::Socket::SSL") { - die_clean( "Socket has NOT been converted to SSL"); - }else{ - $debug and print "Socket successfuly converted to SSL\n"; - } - $debug and print "Ending starttls\n"; -} - - - -sub connect_imap { - my($host, $port, $debugimap, $ssl, $tls) = @_; - my $imap = Mail::IMAPClient->new(); - $imap->Ssl($ssl) if ($ssl); - $imap->Tls($tls) if ($tls); - $imap->Server($host); - $imap->Port($port); - $imap->Debug($debugimap); - #$imap->connect() - myconnect($imap) - or die_clean("Can not open imap connection on [$host]: $@\n"); -} - -sub justconnect { - my $imap1 = (); - my $imap2 = (); - - $imap1 = connect_imap($host1, $port1, $debugimap1, $ssl1, $tls1); - print "Host1 software: ", server_banner($imap1); - print "Host1 capability: ", join(" ", $imap1->capability()), "\n"; - $imap2 = connect_imap($host2, $port2, $debugimap2, $ssl2, $tls2); - print "Host2 software: ", server_banner($imap2); - print "Host2 capability: ", join(" ", $imap2->capability()), "\n"; - $imap1->logout(); - $imap2->logout(); - -} - - -sub login_imap { - my($host, $port, $user, $domain, $password, - $debugimap, $timeout, $fastio, - $ssl, $tls, $authmech, $authuser, $reconnectretry, - $proxyauth, $uid) = @_; - my ($imap); - - $imap = Mail::IMAPClient->new(); - - $imap->Ssl($ssl) if ($ssl); - $imap->Tls($tls) if ($tls); - $imap->Clear(1); - $imap->Server($host); - $imap->Port($port); - $imap->Fast_io($fastio); - $imap->Buffer($buffersize || 4096); - $imap->Uid($uid); - #$imap->Uid(0); - $imap->Peek(1); - $imap->Debug($debugimap); - $timeout and $imap->Timeout($timeout); - - $imap->Reconnectretry($reconnectretry) if ($reconnectretry); - - #$imap->connect() - myconnect($imap) - or die_clean("Can not open imap connection on [$host] with user [$user]: $@\n"); - - print "Banner: ", server_banner($imap); - - if ($imap->has_capability("AUTH=$authmech") - or $imap->has_capability($authmech) - ) { - printf("Host %s says it has CAPABILITY for AUTHENTICATE %s\n", - $imap->Server, $authmech); - } - else { - printf("Host %s says it has NO CAPABILITY for AUTHENTICATE %s\n", - $imap->Server, $authmech); - if ($authmech eq 'PLAIN') { - print "Frequently PLAIN is only supported with SSL, ", - "try --ssl1 or --ssl2 option\n"; - } - } - - if ($proxyauth) { - $imap->Authmechanism(""); - } else { - $imap->Authmechanism($authmech) unless ($authmech eq 'LOGIN'); - } - - $imap->Authcallback(\&plainauth) if $authmech eq "PLAIN"; - - - if ($proxyauth) { - $imap->User($authuser); - $imap->Domain($domain) if (defined($domain)); - $imap->Authuser($authuser); - $imap->Password($password); - } else { - $imap->User($user); - $imap->Domain($domain) if (defined($domain)); - $imap->Authuser($authuser); - $imap->Password($password); - } - - unless ($imap->login()) { - my $info = "Error login: [$host] with user [$user] auth"; - my $einfo = $imap->LastError || @{$imap->History}[-1]; - chomp($einfo); - my $error = "$info [$authmech]: $einfo\n"; - print $error; # note: duplicating error on stdout/stderr - die_clean($error) if ($authmech eq 'LOGIN' or $imap->IsUnconnected() or $authuser); - print "Trying LOGIN Auth mechanism on [$host] with user [$user]\n"; - $imap->Authmechanism(""); - $imap->login() or - die_clean("$info [LOGIN]: ", $imap->LastError, "\n"); - } - $proxyauth && $imap->proxyauth($user); - - print "Success login on [$host] with user [$user] auth [$authmech]\n"; - return($imap); -} - - -sub plainauth() { - my $code = shift; - my $imap = shift; - - my $string = sprintf("%s\x00%s\x00%s", $imap->User, - $imap->Authuser, $imap->Password); - return encode_base64("$string", ""); -} - - -sub server_banner { - my $imap = shift; - my $banner = $imap->Banner() || "No banner\n"; - return $banner; - } - - -sub banner_imapsync { - - my @argv_copy = @_; - my $banner_imapsync = join("", - '$RCSfile: imapsync,v $ ', - '$Revision: 1.383 $ ', - '$Date: 2010/11/28 04:28:52 $ ', - "\n",localhost_info(), "\n", - "Command line used:\n", - "$0 ", command_line_nopassword(@argv_copy), "\n", - ); -} - -sub is_valid_directory { - my $dir = shift; - return(1) if (-d $dir and -r _ and -w _); - # Trying to create it - mkpath($dir) or die "Error creating tmpdir $tmpdir : $!"; - die "Error with tmpdir $tmpdir : $!" if not (-d $dir and -r _ and -w _); - return(1); -} - - -sub write_pidfile { - my $pidfile = shift; - - print "PID file is $pidfile\n"; - if (-e $pidfile) { - warn "$pidfile already exists, overwriting it\n"; - } - open(PIDFILE, ">$pidfile") or do { - warn "Could not open $pidfile for writing"; - return undef; - }; - - print PIDFILE $PROCESS_ID; - close PIDFILE; - return($PROCESS_ID); -} - -sub exit_clean { - my $status = shift; - - unlink($pidfile); - exit($status); -} - -sub die_clean { - - unlink($pidfile); - die @_; -} - -sub missing_option { - my ($option) = @_; - die_clean("$option option must be used, run $0 --help for help\n"); -} - - - -sub tests_folder_routines { - ok( !is_requested_folder('folder_foo') ); - ok( add_to_requested_folders('folder_foo') ); - ok( is_requested_folder('folder_foo') ); - ok( !is_requested_folder('folder_NO_EXIST') ); - ok( !remove_from_requested_folders('folder_foo'), "removed folder_foo"); - ok( !is_requested_folder('folder_foo') ); - my @f; - ok( @f = add_to_requested_folders('folder_bar', 'folder_toto'), "add result: @f"); - ok( is_requested_folder('folder_bar') ); - ok( is_requested_folder('folder_toto') ); - ok( remove_from_requested_folders('folder_toto') ); - ok( !is_requested_folder('folder_toto') ); -} - - -sub is_requested_folder { - my ( $folder ) = @_; - - defined( $requested_folder{ $folder } ); -} - - -sub add_to_requested_folders { - my @wanted_folders = @_; - - foreach my $folder ( @wanted_folders ) { - ++$requested_folder{ $folder }; - } - return( keys( %requested_folder ) ); -} - -sub remove_from_requested_folders { - my @wanted_folders = @_; - - foreach my $folder (@wanted_folders) { - delete $requested_folder{$folder}; - } - return( keys(%requested_folder) ); -} - -sub compare_lists { - my ($list_1_ref, $list_2_ref) = @_; - - return(-1) if ((not defined($list_1_ref)) and defined($list_2_ref)); - return(0) if ((not defined($list_1_ref)) and not defined($list_2_ref)); # end if no list - return(1) if (not defined($list_2_ref)); # end if only one list - - if (not ref($list_1_ref)) {$list_1_ref = [$list_1_ref]}; - if (not ref($list_2_ref)) {$list_2_ref = [$list_2_ref]}; - - - my $last_used_indice = -1; - #print "\$#$list_1_ref:", $#$list_1_ref, "\n"; - #print "\$#$list_2_ref:", $#$list_2_ref, "\n"; - ELEMENT: - foreach my $indice ( 0 .. $#$list_1_ref ) { - $last_used_indice = $indice; - - # End of list_2 - return 1 if ($indice > $#$list_2_ref); - - my $element_list_1 = $list_1_ref->[$indice]; - my $element_list_2 = $list_2_ref->[$indice]; - my $balance = $element_list_1 cmp $element_list_2 ; - next ELEMENT if ($balance == 0) ; - return $balance; - } - # each element equal until last indice of list_1 - return -1 if ($last_used_indice < $#$list_2_ref); - - # same size, each element equal - return 0 -} - -sub tests_compare_lists { - - - my $empty_list_ref = []; - - ok( 0 == compare_lists() , 'compare_lists, no args'); - ok( 0 == compare_lists(undef) , 'compare_lists, undef = nothing'); - ok( 0 == compare_lists(undef, undef) , 'compare_lists, undef = undef'); - ok(-1 == compare_lists(undef , []) , 'compare_lists, undef < []'); - ok(-1 == compare_lists(undef , [1]) , 'compare_lists, undef < [1]'); - ok(-1 == compare_lists(undef , [0]) , 'compare_lists, undef < [0]'); - ok(+1 == compare_lists([]) , 'compare_lists, [] > nothing'); - ok(+1 == compare_lists([], undef) , 'compare_lists, [] > undef'); - ok( 0 == compare_lists([] , []) , 'compare_lists, [] = []'); - - ok(-1 == compare_lists([] , [1]) , 'compare_lists, [] < [1]'); - ok(+1 == compare_lists([1] , []) , 'compare_lists, [1] > []'); - - - ok( 0 == compare_lists([1], 1 ) , "compare_lists, [1] = 1 ") ; - ok( 0 == compare_lists( 1 , [1]) , "compare_lists, 1 = [1]") ; - ok( 0 == compare_lists( 1 , 1 ) , "compare_lists, 1 = 1 ") ; - ok(-1 == compare_lists( 0 , 1 ) , "compare_lists, 0 < 1 ") ; - ok(-1 == compare_lists(-1 , 0 ) , "compare_lists, -1 < 0 ") ; - ok(-1 == compare_lists( 1 , 2 ) , "compare_lists, 1 < 2 ") ; - ok(+1 == compare_lists( 2 , 1 ) , "compare_lists, 2 > 1 ") ; - - - ok( 0 == compare_lists([1,2], [1,2]) , "compare_lists, [1,2] = [1,2]") ; - ok(-1 == compare_lists([1], [1,2]) , "compare_lists, [1] < [1,2]") ; - ok(+1 == compare_lists([2], [1,2]) , "compare_lists, [2] > [1,2]") ; - ok(-1 == compare_lists([1], [1,1]) , "compare_lists, [1] < [1,1]") ; - ok(+1 == compare_lists([1, 1], [1]) , "compare_lists, [1, 1] > [1]") ; - ok( 0 == compare_lists([1 .. 20_000] , [1 .. 20_000]) - , "compare_lists, [1..20_000] = [1..20_000]") ; - ok(-1 == compare_lists([1], [3]) , 'compare_lists, [1] < [3]') ; - ok( 0 == compare_lists([2], [2]) , 'compare_lists, [0] = [2]') ; - ok(+1 == compare_lists([3], [1]) , 'compare_lists, [3] > [1]') ; - - ok(-1 == compare_lists(["a"], ["b"]) , 'compare_lists, ["a"] < ["b"]') ; - ok( 0 == compare_lists(["a"], ["a"]) , 'compare_lists, ["a"] = ["a"]') ; - ok( 0 == compare_lists(["ab"], ["ab"]) , 'compare_lists, ["ab"] = ["ab"]') ; - ok(+1 == compare_lists(["b"], ["a"]) , 'compare_lists, ["b"] > ["a"]') ; - ok(-1 == compare_lists(["a"], ["aa"]) , 'compare_lists, ["a"] < ["aa"]') ; - ok(-1 == compare_lists(["a"], ["a", "a"]), 'compare_lists, ["a"] < ["a", "a"]') ; - ok( 0 == compare_lists([split(" ", "a b")], ["a", "b"]), 'compare_lists, split') ; - ok( 0 == compare_lists([sort split(" ", "b a")], ["a", "b"]), 'compare_lists, sort split') ; -} - - - -sub get_prefix { - my($imap, $prefix_in, $prefix_opt) = @_; - my($prefix_out); - - $debug and print "Getting prefix namespace\n"; - if (defined($prefix_in)) { - print "Using [$prefix_in] given by $prefix_opt\n"; - $prefix_out = $prefix_in; - return($prefix_out); - } - $debug and print "Calling namespace capability\n"; - if ($imap->has_capability("namespace")) { - my $r_namespace = $imap->namespace(); - $prefix_out = $r_namespace->[0][0][0]; - return($prefix_out); - } - else{ - print - "No NAMESPACE capability in imap server ", - $imap->Server(),"\n", - "Give the prefix namespace with the $prefix_opt option\n"; - exit_clean(1); - } -} - - -sub get_separator { - my($imap, $sep_in, $sep_opt) = @_; - my($sep_out); - - - if ($sep_in) { - print "Using [$sep_in] given by $sep_opt\n"; - $sep_out = $sep_in; - return($sep_out); - } - $debug and print "Calling namespace capability\n"; - if ($imap->has_capability("namespace")) { - $sep_out = $imap->separator(); - return($sep_out) if defined $sep_out; - warn - "NAMESPACE request failed for ", - $imap->Server(), ": ", $imap->LastError, "\n"; - exit_clean(1); - } - else{ - warn - "No NAMESPACE capability in imap server ", - $imap->Server(),"\n", - "Give the separator character with the $sep_opt option\n"; - exit_clean(1); - } -} - -sub separator_invert { - # The separator we hope we'll never encounter: 00000000 - my $o_sep="\000"; - - my($h1_fold, $h1_sep, $h2_sep) = @_; - - my $h2_fold = $h1_fold; - $h2_fold =~ s@\Q$h2_sep@$o_sep@g; - $h2_fold =~ s@\Q$h1_sep@$h2_sep@g; - $h2_fold =~ s@\Q$o_sep@$h1_sep@g; - return($h2_fold); -} - - -sub tests_imap2_folder_name { - -$h1_prefix = $h2_prefix = ''; -$h1_sep = '/'; -$h2_sep = '.'; - -$debug and print -"prefix1: [$h1_prefix] -prefix2: [$h2_prefix] -sep1:[$h1_sep] -sep2:[$h2_sep] -"; - -ok('' eq imap2_folder_name(''), 'imap2_folder_name: empty string'); -ok('blabla' eq imap2_folder_name('blabla'), 'imap2_folder_name: blabla'); -ok('spam.spam' eq imap2_folder_name('spam/spam'), 'imap2_folder_name: spam/spam'); -ok('spam/spam' eq imap2_folder_name('spam.spam'), 'imap2_folder_name: spam.spam'); -ok('spam.spam/spam' eq imap2_folder_name('spam/spam.spam'), 'imap2_folder_name: spam/spam.spam'); -@regextrans2 = ('s,/,X,g'); -ok('' eq imap2_folder_name(''), 'imap2_folder_name: empty string [s,/,X,g]'); -ok('blabla' eq imap2_folder_name('blabla'), 'imap2_folder_name: blabla [s,/,X,g]'); -ok('spam.spam' eq imap2_folder_name('spam/spam'), 'imap2_folder_name: spam/spam [s,/,X,g]'); -ok('spamXspam' eq imap2_folder_name('spam.spam'), 'imap2_folder_name: spam.spam [s,/,X,g]'); -ok('spam.spamXspam' eq imap2_folder_name('spam/spam.spam'), 'imap2_folder_name: spam/spam.spam [s,/,X,g]'); - -@regextrans2 = ('s, ,_,g'); -ok('blabla' eq imap2_folder_name('blabla'), 'imap2_folder_name: blabla [s, ,_,g]'); -ok('bla_bla' eq imap2_folder_name('bla bla'), 'imap2_folder_name: blabla [s, ,_,g]'); - -@regextrans2 = ('s,(.*),\U$1,'); -ok('BLABLA' eq imap2_folder_name('blabla'), 'imap2_folder_name: blabla [s,\U(.*)\E,$1,]'); - - -} - -sub imap2_folder_name { - my ($h2_fold); - my ($x_fold) = @_; - # first we remove the prefix - $x_fold =~ s/^\Q$h1_prefix\E//; - $debug and print "removed host1 prefix: [$x_fold]\n"; - $h2_fold = separator_invert($x_fold,$h1_sep, $h2_sep); - $debug and print "inverted separators: [$h2_fold]\n"; - # Adding the prefix supplied by namespace or the --prefix2 option - $h2_fold = $h2_prefix . $h2_fold - unless(($h2_prefix eq "INBOX" . $h2_sep) and ($h2_fold =~ m/^INBOX$/i)); - $debug and print "added host2 prefix: [$h2_fold]\n"; - - # Transforming the folder name by the --regextrans2 option(s) - foreach my $regextrans2 (@regextrans2) { - my $h2_fold_before = $h2_fold; - eval("\$h2_fold =~ $regextrans2"); - $debug and print "[$h2_fold_before] -> [$h2_fold] using re [$regextrans2]\n"; - die_clean("error: eval regextrans2 '$regextrans2': $@\n") if $@; - } - return($h2_fold); -} - - -sub foldersizes { - - my ($side, $imap, @folders) = @_; - my $tot = 0; - my $tmess = 0; - - print "++++ Calculating sizes\n"; - foreach my $folder (@folders) { - my $stot = 0; - my $smess = 0; - printf("$side folder %-35s", "[$folder]"); - unless($imap->exists($folder)) { - print("does not exist yet\n"); - next; - } - unless ($imap->examine($folder)) { - warn - "$side Folder $folder: Could not examine: ", - $imap->LastError, "\n"; - $nb_errors++; - next; - } - - my $hash_ref = {}; - my @msgs = select_msgs($imap); - $smess = scalar(@msgs); - @$hash_ref{@msgs} = (undef); - unless ($smess == 0) { - $imap->fetch_hash_2("RFC822.SIZE",$hash_ref) or die_clean("$@"); - #print map {$hash_ref->{$_}->{"RFC822.SIZE"}, " "} keys %$hash_ref; - map {$stot += $hash_ref->{$_}->{"RFC822.SIZE"}} keys %$hash_ref; - } - - printf(" Size: %9s", $stot); - printf(" Messages: %5s\n", $smess); - $tot += $stot; - $tmess += $smess; - } - print "Total size: $tot\n"; - print "Total messages: $tmess\n"; - print "Time: ", timenext(), " s\n"; -} - -sub timenext { - my ($timenow, $timerel); - # $timebefore is global, beurk ! - $timenow = time; - $timerel = $timenow - $timebefore; - $timebefore = $timenow; - return($timerel); -} - - -sub tests_flags_regex { - - my $string; - ok('' eq flags_regex(''), "flags_regex, null string ''"); - ok('\Seen NonJunk $Spam' eq flags_regex('\Seen NonJunk $Spam'), 'flags_regex, nothing to do'); - ok('\Seen NonJunk $Spam' eq flags_regex('\Seen NonJunk $Spam'), 'flags_regex,'); - @regexflag = ('s/NonJunk//g'); - ok('\Seen $Spam' eq flags_regex('\Seen NonJunk $Spam'), "flags_regex, remove NonJunk: 's/NonJunk//g'"); - @regexflag = ('s/\$Spam//g'); - ok('\Seen NonJunk ' eq flags_regex('\Seen NonJunk $Spam'), 'flags_regex, remove $Spam: '."'s/\$Spam//g'"); - - @regexflag = ('s/\\\\Seen//g'); - - ok(' NonJunk $Spam' eq flags_regex('\Seen NonJunk $Spam'), 'flags_regex, remove \Seen: '. "'s/\\\\\\\\Seen//g'"); - - @regexflag = ('s/(\s|^)[^\\\\]\w+//g'); - ok('\Seen \Middle \End' eq flags_regex('\Seen NonJunk \Middle $Spam \End'), 'flags_regex, only \word [' . flags_regex('\Seen NonJunk \Middle $Spam \End'.']')); - ok(' \Seen \Middle \End1' eq flags_regex('Begin \Seen NonJunk \Middle $Spam \End1 End'), 'flags_regex, only \word [' . flags_regex('Begin \Seen NonJunk \Middle $Spam \End1 End'.']')); - - @regexflag = ('s/.*?(Keep1|Keep2|Keep3)/$1 /g'); - ok('Keep1 Keep2 ReB' eq flags_regex('ReA Keep1 REM Keep2 ReB'), "Keep only regex"); - #ok('Keep1 Keep2' eq flags_regex('Keep1 Keep2 Remove1'), "Keep only regex"); - ok('Keep1 Keep2 ' eq flags_regex('REM REM Keep1 Keep2'), "Keep only regex"); - ok('Keep1 Keep2 ' eq flags_regex('Keep1 REM REM Keep2'), "Keep only regex"); - ok('Keep1 Keep2 ' eq flags_regex('REM Keep1 REM REM Keep2'), "Keep only regex"); - ok('Keep1 Keep2 ' eq flags_regex('Keep1 Keep2'), "Keep only regex"); - ok('Keep1 ' eq flags_regex('REM Keep1'), "Keep only regex"); - - @regexflag = ('s/(Keep1|Keep2|Keep3) (?!(Keep1|Keep2|Keep3)).*/$1 /g'); - ok('Keep1 Keep2 ' eq flags_regex('Keep1 Keep2 ReB'), "Keep only regex"); - ok('Keep1 Keep2 ' eq flags_regex('Keep1 Keep2 REM REM REM'), "Keep only regex"); - ok('Keep2 ' eq flags_regex('Keep2 REM REM REM'), "Keep only regex"); - #ok('' eq flags_regex('REM REM'), "Keep only regex"); - - @regexflag = ('s/.*?(Keep1|Keep2|Keep3)/$1 /g', - 's/(Keep1|Keep2|Keep3) (?!(Keep1|Keep2|Keep3)).*/$1 /g'); - ok('Keep1 Keep2 ' eq flags_regex('REM Keep1 REM Keep2 REM'), "Keep only regex"); - ok('Keep1 Keep2 ' eq flags_regex('Keep1 REM Keep2 REM'), "Keep only regex"); - ok('Keep1 Keep2 ' eq flags_regex('REM Keep1 Keep2 REM'), "Keep only regex"); - ok('Keep1 Keep2 ' eq flags_regex('REM Keep1 REM Keep2'), "Keep only regex"); - ok('Keep1 Keep2 Keep3 ' eq flags_regex('REM Keep1 REM Keep2 REM REM Keep3 REM'), "Keep only regex"); - ok('Keep1 ' eq flags_regex('REM REM Keep1 REM REM REM '), "Keep only regex"); - ok('Keep1 Keep3 ' eq flags_regex('RE1 Keep1 RE2 Keep3 RE3 RE4 RE5 '), "Keep only regex"); - - @regexflag = ('s/(.*)/$1 jrdH8u/'); - ok('REM REM REM REM REM jrdH8u' eq flags_regex('REM REM REM REM REM'), "Keep only regex 's/(.*)/\$1 jrdH8u/'"); - @regexflag = ('s/jrdH8u *//'); - ok('REM REM REM REM REM ' eq flags_regex('REM REM REM REM REM jrdH8u'), "Keep only regex s/jrdH8u *//"); - - @regexflag = ( - 's/(.*)/$1 jrdH8u/', - 's/.*?(Keep1|Keep2|Keep3|jrdH8u)/$1 /g', - 's/(Keep1|Keep2|Keep3|jrdH8u) (?!(Keep1|Keep2|Keep3|jrdH8u)).*/$1 /g', - 's/jrdH8u *//' - ); - - ok('Keep1 Keep2 ' eq flags_regex('REM Keep1 REM Keep2 REM'), "Keep only regex 'REM Keep1 REM Keep2 REM'"); - ok('Keep1 Keep2 ' eq flags_regex('Keep1 REM Keep2 REM'), "Keep only regex"); - ok('Keep1 Keep2 ' eq flags_regex('REM Keep1 Keep2 REM'), "Keep only regex"); - ok('Keep1 Keep2 ' eq flags_regex('REM Keep1 REM Keep2'), "Keep only regex"); - ok('Keep1 Keep2 Keep3 ' eq flags_regex('REM Keep1 REM Keep2 REM REM Keep3 REM'), "Keep only regex"); - ok('Keep1 ' eq flags_regex('REM REM Keep1 REM REM REM '), "Keep only regex"); - ok('Keep1 Keep3 ' eq flags_regex('RE1 Keep1 RE2 Keep3 RE3 RE4 RE5 '), "Keep only regex"); - ok('' eq flags_regex('REM REM REM REM REM'), "Keep only regex"); - - @regexflag = ( - 's/(.*)/$1 jrdH8u/', - 's/.*?(\\\\Seen|\\\\Answered|\\\\Flagged|\\\\Deleted|\\\\Draft|jrdH8u)/$1 /g', - 's/(\\\\Seen|\\\\Answered|\\\\Flagged|\\\\Deleted|\\\\Draft|jrdH8u) (?!(\\\\Seen|\\\\Answered|\\\\Flagged|\\\\Deleted|\\\\Draft|jrdH8u)).*/$1 /g', - 's/jrdH8u *//' - ); - - ok('\\Deleted \\Answered ' - eq flags_regex('Blabla $Junk \\Deleted machin \\Answered truc'), "Keep only regex: Exchange case"); - ok('' eq flags_regex(''), "Keep only regex: Exchange case, null string"); - ok('' - eq flags_regex('Blabla $Junk machin truc'), "Keep only regex: Exchange case, no accepted flags "); - ok('\\Deleted \\Answered \\Draft \\Flagged ' - eq flags_regex('\\Deleted \\Answered \\Draft \\Flagged '), "Keep only regex: Exchange case"); - - - @regexflag = ( - 's/.*?(?:(\\\\(?:Answered|Flagged|Deleted|Seen|Draft)\s?)|$)/defined($1)?$1:q()/eg' - ); - - ok('\\Deleted \\Answered ' - eq flags_regex('Blabla \$Junk \\Deleted machin \\Answered truc'), - "Keep only regex: Exchange case (Phil)"); - - ok('' eq flags_regex(''), "Keep only regex: Exchange case, null string (Phil)"); - - ok('' - eq flags_regex('Blabla $Junk machin truc'), - "Keep only regex: Exchange case, no accepted flags (Phil)"); - - ok('\\Deleted \\Answered \\Draft \\Flagged ' - eq flags_regex('\\Deleted \\Answered \\Draft \\Flagged '), - "Keep only regex: Exchange case (Phil)"); - - -} - -sub flags_regex { - my ($h1_flags) = @_; - foreach my $regexflag (@regexflag) { - my $h1_flags_orig = $h1_flags; - $debug and print "eval \$h1_flags =~ $regexflag\n"; - eval("\$h1_flags =~ $regexflag"); - die_clean("error: eval regexflag '$regexflag': $@\n") if $@; - $debug and print "regexflag $regexflag [$h1_flags_orig] -> [$h1_flags]\n"; - } - return($h1_flags); -} - -sub acls_sync { - my($h1_fold, $h2_fold) = @_; - if ($syncacls) { - my $h1_hash = $imap1->getacl($h1_fold) - or warn "Could not getacl for $h1_fold: $@\n"; - my $h2_hash = $imap2->getacl($h2_fold) - or warn "Could not getacl for $h2_fold: $@\n"; - my %users = map({ ($_, 1) } (keys(%$h1_hash), keys(%$h2_hash))); - foreach my $user (sort(keys(%users))) { - my $acl = $h1_hash->{$user} || "none"; - print "acl $user: [$acl]\n"; - next if ($h1_hash->{$user} && $h2_hash->{$user} && - $h1_hash->{$user} eq $h2_hash->{$user}); - unless ($dry) { - print "setting acl $h2_fold $user $acl\n"; - $imap2->setacl($h2_fold, $user, $acl) - or warn "Could not set acl: $@\n"; - } - } - } -} - - -sub tests_permanentflags { - - my $string; - ok('' eq permanentflags(' * OK [PERMANENTFLAGS (\* \Draft \Answered)] Limited'), - 'permanentflags \*'); - ok('\Draft \Answered' eq permanentflags(' * OK [PERMANENTFLAGS (\Draft \Answered)] Limited'), - 'permanentflags \Draft \Answered'); - ok('\Draft \Answered' - eq permanentflags('Blabla', - ' * OK [PERMANENTFLAGS (\Draft \Answered)] Limited', - 'Blabla'), - 'permanentflags \Draft \Answered' - ); - ok('' eq permanentflags('Blabla'), 'permanentflags nothing'); -} - -sub permanentflags { - my @lines = @_; - - foreach my $line (@lines) { - if ($line =~ m{\[PERMANENTFLAGS \(([^)]+?)\)\]}) { - #print "%%%$1%%%\n"; - my $permanentflags = $1; - if ($permanentflags =~ m{\\\*}) { - $permanentflags = ''; - } - return($permanentflags); - }; - } -} - -sub tests_flags_filter { - - ok( '\Seen' eq flags_filter('\Seen', '\Draft \Seen \Answered'), 'flags_filter ' ); - ok( '' eq flags_filter('\Seen', '\Draft \Answered'), 'flags_filter ' ); - ok( '\Seen' eq flags_filter('\Seen', '\Seen'), 'flags_filter ' ); - ok( '\Seen' eq flags_filter('\Seen', ' \Seen '), 'flags_filter ' ); - ok( '\Seen \Draft' - eq flags_filter('\Seen \Draft', '\Draft \Seen \Answered'), 'flags_filter ' ); - ok( '\Seen \Draft' - eq flags_filter('\Seen \Draft', ' \Draft \Seen \Answered '), 'flags_filter ' ); - -} - -sub flags_filter { - my($flags, $allowed_flags) = @_; - - my @flags = split(/\s+/, $flags); - my %allowed_flags = map { $_ => 1 } split(' ', $allowed_flags ); - my @flags_out = map { exists $allowed_flags{$_} ? $_ : () } @flags; - - my $flags_out = join(' ', @flags_out); - #print "%%%$flags_out%%%\n"; - return($flags_out); -} - - - -sub select_msgs { - my ($imap) = @_; - my (@msgs,@max,@min,@union,@inter); - - unless (defined($maxage) or defined($minage)) { - #@msgs = $imap->search("ALL"); - @msgs = $imap->messages(); - return(@msgs); - } - if (defined($maxage)) { - @max = $imap->sentsince(time - 86400 * $maxage); - } - if (defined($minage)) { - @min = $imap->sentbefore(time - 86400 * $minage); - } - SWITCH: { - unless(defined($minage)) {@msgs = @max; last SWITCH}; - unless(defined($maxage)) {@msgs = @min; last SWITCH}; - my (%union, %inter); - foreach my $m (@min, @max) {$union{$m}++ && $inter{$m}++} - @inter = keys(%inter); - @union = keys(%union); - # normal case - if ($minage <= $maxage) {@msgs = @inter; last SWITCH}; - # just exclude messages between - if ($minage > $maxage) {@msgs = @union; last SWITCH}; - - } - return(@msgs); -} - - - - -sub tests_regexmess { - - ok("blabla" eq regexmess("blabla"), "regexmess, no regexmess, nothing to do"); - - @regexmess = ('s/p/Z/g'); - ok("ZoZoZo" eq regexmess("popopo"), "regexmess, s/p/Z/g"); - - @regexmess = 's{c}{C}gxms'; - ok("H1: abC\nH2: Cde\n\nBody abC" - eq regexmess("H1: abc\nH2: cde\n\nBody abc"), - "regexmess, c->C"); - - @regexmess = 's{\AFrom\ }{From:}gxms'; - ok( '' - eq regexmess(''), - 'From mbox 1 add colon blank'); - - ok( 'From:' - eq regexmess('From '), - 'From mbox 2 add colo'); - - ok( "\n" . 'From ' - eq regexmess("\n" . 'From '), - 'From mbox 3 add colo'); - - ok( "From: zzz\n" . 'From ' - eq regexmess("From zzz\n" . 'From '), - 'From mbox 4 add colo'); - - @regexmess = 's{\AFrom\ [^\n]*(\n)?}{}gxms'; - ok( '' - eq regexmess(''), - 'From mbox 1 remove, blank'); - - ok( '' - eq regexmess('From '), - 'From mbox 2 remove'); - - ok( "\n" . 'From ' - eq regexmess("\n" . 'From '), - 'From mbox 3 remove'); - - #print "[", regexmess("From zzz\n" . 'From '), "]"; - ok( "" . 'From ' - eq regexmess("From zzz\n" . 'From '), - 'From mbox 4 remove'); - - - ok( -'Date: Sat, 10 Jul 2010 05:34:45 -0700 -From: - -Hello, -Bye.' - eq regexmess( -'From zzz -Date: Sat, 10 Jul 2010 05:34:45 -0700 -From: - -Hello, -Bye.' - ), - 'From mbox 5 remove'); -} - -sub regexmess { - my ($string) = @_; - foreach my $regexmess (@regexmess) { - $debug and print "eval \$string =~ $regexmess\n"; - eval("\$string =~ $regexmess"); - die_clean("error: eval regexmess '$regexmess': $@\n") if $@; - } - return($string); -} - - -sub stats { - print "++++ Statistics\n"; - print "Transfer time : $timediff sec\n"; - print "Messages transferred : $nb_msg_transferred "; - print "(could be $nb_msg_skipped_dry_mode without dry mode)" if ($dry); - print "\n"; - print "Messages skipped : $nb_msg_skipped\n"; - print "Messages found duplicate on host1 : $h1_nb_msg_duplicate\n"; - print "Messages found duplicate on host2 : $h2_nb_msg_duplicate\n"; - print "Messages void (noheader) on host1 : $h1_nb_msg_noheader\n"; - print "Messages void (noheader) on host2 : $h2_nb_msg_noheader\n"; - print "Messages deleted on host1 : $h1_nb_msg_deleted\n"; - print "Messages deleted on host2 : $h2_nb_msg_deleted\n"; - print "Total bytes transferred : $total_bytes_transferred\n"; - print "Total bytes duplicate host1 : $h1_total_bytes_duplicate\n"; - print "Total bytes duplicate host2 : $h2_total_bytes_duplicate\n"; - print "Total bytes skipped : $total_bytes_skipped\n"; - print "Total bytes error : $total_bytes_error\n"; - $timediff ||= 1; # No division per 0 - printf ("Message rate : %.1f messages/s\n", $nb_msg_transferred / $timediff); - printf ("Average bandwidth rate : %.1f KiB/s\n", $total_bytes_transferred / 1024 / $timediff); - print "Reconnections to host1 : $host1_reconnect_count\n"; - print "Reconnections to host2 : $host2_reconnect_count\n"; - printf ("Memory consumption : %.1f MB\n", $memory_consumption / 1024 / 1024); - print "Memory/biggest message ratio : $memory_ratio\n"; - print "Detected $nb_errors errors\n\n"; - - print $warn_release, "\n"; - print thank_author(); -} - -sub thank_author { - - return("Homepage: http://www.linux-france.org/prj/imapsync/\n"); - - my $basename = imapsync_basename(); - $debug and print "[$basename]\n"; - return("Homepage: http://www.linux-france.org/prj/imapsync/\n") - if ( $basename =~ /\.exe$|\.bin$/ ); - - return(join("", "Happy with this free, open and gratis DWTFPL software?\n", - "Encourage the author (Gilles LAMIRAL) by giving him a book\n", - "or just money via paypal:\n", - "http://www.linux-france.org/prj/imapsync/\n")); -} - -sub get_options { - my $numopt = scalar(@ARGV); - my $argv = join("¤", @ARGV); - - $test_builder = Test::More->builder; - $test_builder->no_ending(1); - - if($argv =~ m/-delete¤2/) { - print "May be you mean --delete2 instead of --delete 2\n"; - exit 1; - } - my $opt_ret = GetOptions( - "debug!" => \$debug, - "debugimap!" => \$debugimap, - "debugimap1!" => \$debugimap1, - "debugimap2!" => \$debugimap2, - "host1=s" => \$host1, - "host2=s" => \$host2, - "port1=i" => \$port1, - "port2=i" => \$port2, - "user1=s" => \$user1, - "user2=s" => \$user2, - "domain1=s" => \$domain1, - "domain2=s" => \$domain2, - "password1=s" => \$password1, - "password2=s" => \$password2, - "passfile1=s" => \$passfile1, - "passfile2=s" => \$passfile2, - "authmd5!" => \$authmd5, - "sep1=s" => \$sep1, - "sep2=s" => \$sep2, - "folder=s" => \@folder, - "folderrec=s" => \@folderrec, - "include=s" => \@include, - "exclude=s" => \@exclude, - "prefix1=s" => \$prefix1, - "prefix2=s" => \$prefix2, - "regextrans2=s" => \@regextrans2, - "regexmess=s" => \@regexmess, - "regexflag=s" => \@regexflag, - "delete!" => \$delete, - "delete2!" => \$delete2, - "delete2folders!" => \$delete2folders, - "syncinternaldates!" => \$syncinternaldates, - "idatefromheader!" => \$idatefromheader, - "syncacls!" => \$syncacls, - "maxsize=i" => \$maxsize, - "minsize=i" => \$minsize, - "maxage=i" => \$maxage, - "minage=i" => \$minage, - "buffersize=i" => \$buffersize, - "foldersizes!" => \$foldersizes, - "dry!" => \$dry, - "expunge!" => \$expunge, - "expunge1!" => \$expunge1, - "expunge2!" => \$expunge2, - "uidexpunge2!" => \$uidexpunge2, - "subscribed!" => \$subscribed, - "subscribe!" => \$subscribe, - "subscribe_all!" => \$subscribe_all, - "justbanner!" => \$justbanner, - "justconnect!"=> \$justconnect, - "justfolders!"=> \$justfolders, - "justfoldersizes!" => \$justfoldersizes, - "fast!" => \$fast, - "version" => \$version, - "help" => \$help, - "timeout=i" => \$timeout, - "skipheader=s" => \$skipheader, - "useheader=s" => \@useheader, - "skipsize!" => \$skipsize, - "allowsizemismatch!" => \$allowsizemismatch, - "fastio1!" => \$fastio1, - "fastio2!" => \$fastio2, - "ssl1!" => \$ssl1, - "ssl2!" => \$ssl2, - "tls1!" => \$tls1, - "tls2!" => \$tls2, - "uid1!" => \$uid1, - "uid2!" => \$uid2, - "authmech1=s" => \$authmech1, - "authmech2=s" => \$authmech2, - "authuser1=s" => \$authuser1, - "authuser2=s" => \$authuser2, - "proxyauth1" => \$proxyauth1, - "proxyauth2" => \$proxyauth1, - "split1=i" => \$split1, - "split2=i" => \$split2, - "reconnectretry1=i" => \$reconnectretry1, - "reconnectretry2=i" => \$reconnectretry2, - "tests" => \$tests, - "tests_debug" => \$tests_debug, - "allow3xx!" => \$allow3xx, - "justlogin!" => \$justlogin, - "tmpdir=s" => \$tmpdir, - "pidfile=s" => \$pidfile, - "releasecheck!" => \$releasecheck, - "modules_version!" => \$modules_version, - ); - - $debug and print "get options: [$opt_ret]\n"; - - # just the version - print imapsync_version(), "\n" and exit if ($version) ; - - if ($tests) { - $test_builder->no_ending(0); - tests(); - exit; - } - if ($tests_debug) { - $test_builder->no_ending(0); - tests_debug(); - exit; - } - - $help = 1 if ! $numopt; - load_modules(); - - # exit with --help option or no option at all - usage() and exit if ($help or ! $numopt) ; - - # don't go on if options are not all known. - exit(EX_USAGE()) unless ($opt_ret) ; - -} - - -sub load_modules { - - require IO::Socket::SSL if ($ssl1 or $ssl2 or $tls1 or $tls2); - - require Term::ReadKey if ( - ((not($password1 or $passfile1)) - or (not($password2 or $passfile2))) - and (not $help)); - - #require Data::Dumper if ($debug); -} - - - -sub parse_header_msg { - my ($imap, $m_uid, $s_heads, $s_fir, $s, $s_hash) = @_; - - my $head = $s_heads->{$m_uid}; - my $headnum = scalar(keys(%$head)); - $debug and print "Head NUM:", $headnum, "\n"; - unless($headnum) { print "Warning: no header used or found for message $m_uid\n"; } - my $headstr; - - foreach my $h (sort keys(%$head)){ - foreach my $val (sort @{$head->{$h}}) { - # no 8-bit data in headers ! - $val =~ s/[\x80-\xff]/X/g; - - # remove the first blanks (dbmail bug ?) - $val =~ s/^\s*(.+)$/$1/; - - # and uppercase header line - # (dbmail and dovecot) - - my $H = uc("$h: $val"); - # show stuff in debug mode - $debug and print "${s}H $H", "\n"; - - if ($skipheader and $H =~ m/$skipheader/i) { - $debug and print "Skipping header $H\n"; - next; - } - $headstr .= "$H"; - } - } - #return unless ($headstr); - unless ($headstr){ - # taking everything is too heavy, - # should take only 1 Ko - print "no header so taking body first 2Ko\n"; - #$headstr = $imap->message_string($m_uid); - $imap->fetch($m_uid, "BODY.PEEK[TEXT]<0.2048>"); - $headstr = $imap->_transaction_literals; - #print "no header so we ignore this message\n"; - #return undef; - } - my $size = $s_fir->{$m_uid}->{"RFC822.SIZE"}; - my $flags = $s_fir->{$m_uid}->{"FLAGS"}; - my $idate = $s_fir->{$m_uid}->{"INTERNALDATE"}; - $size = length($headstr) unless ($size); - my $m_md5 = md5_base64($headstr); - $debug and print "$s msg $m_uid:$m_md5:$size\n"; - my $key; - if ($skipsize) { - $key = "$m_md5"; - } - else { - $key = "$m_md5:$size"; - } - # 0 return code is used to identify duplicate message hash - return 0 if exists $s_hash->{"$key"}; - $s_hash->{"$key"}{'5'} = $m_md5; - $s_hash->{"$key"}{'s'} = $size; - $s_hash->{"$key"}{'D'} = $idate; - $s_hash->{"$key"}{'F'} = $flags; - $s_hash->{"$key"}{'m'} = $m_uid; -} - - -sub firstline { - # extract the first line of a file (without \n) - - my($file) = @_; - my $line = ""; - - open FILE, $file or die_clean("error [$file]: $! "); - chomp($line = ); - close FILE; - $line = ($line) ? $line: "error !EMPTY! [$file]"; - return $line; -} - - -sub file_to_string { - my($file) = @_; - my @string; - open FILE, $file or die_clean("error [$file]: $! "); - @string = ; - close FILE; - return join("", @string); -} - - -sub string_to_file { - my($string, $file) = @_; - sysopen(FILE, $file,O_WRONLY|O_TRUNC|O_CREAT, 0600) or die_clean("$! $file"); - print FILE $string; - close FILE; -} - -sub tests_is_a_release_number { - ok(is_a_release_number(1.351), 'is_a_release_number 1.351'); - ok(is_a_release_number(42.4242), 'is_a_release_number 42.4242'); - ok(is_a_release_number(imapsync_version()), 'is_a_release_number imapsync_version()'); - ok(! is_a_release_number('blabla' ), '! is_a_release_number blabla'); - -} - -sub is_a_release_number { - my $number = shift; - - $number =~ m{\d\.\d+}; -} - -sub check_last_release { - - my $public_release = not_long('imapsync_version_lfo'); - return('unknown') if ($public_release eq 'unknown'); - return('unknown') if (! is_a_release_number($public_release)); - return('timeout') if ($public_release eq 'timeout'); - - my $imapsync_here = imapsync_version(); - - if ($public_release > $imapsync_here) { - return("New imapsync release $public_release available"); - }else{ - return("This current imapsync is up to date"); - } -} - -sub imapsync_version { - my $rcs = '$Id: imapsync,v 1.383 2010/11/28 04:28:52 gilles Exp $ '; - $rcs =~ m/,v (\d+\.\d+)/; - my $VERSION = ($1) ? $1: "UNKNOWN"; - return($VERSION); -} - -sub tests_imapsync_basename { - - ok('imapsync' eq imapsync_basename(), 'imapsync_basename: imapsync'); - ok('blabla' ne imapsync_basename(), '! imapsync_basename: blabla'); -} - -sub imapsync_basename { - - return basename($0); - -} - -sub imapsync_version_lfo { - - my $local_version = imapsync_version(); - my $imapsync_basename = imapsync_basename(); - my $agent_info = "$OSNAME system, perl " - . sprintf("%vd", $PERL_VERSION) - . ", Mail::IMAPClient $Mail::IMAPClient::VERSION" - . " $imapsync_basename"; - my $sock = new IO::Socket::INET ( - PeerAddr => 'imapsync.lamiral.info', - PeerPort => '80', - Proto => 'tcp'); - return('unknown') if not $sock; - print $sock - "GET /prj/imapsync/VERSION HTTP/1.0\n", - "User-Agent: imapsync/$local_version ($agent_info)\n", - "Host: www.linux-france.org\n\n"; - my @line = <$sock>; - close($sock); - my $last_release = $line[-1]; - chomp($last_release); - return($last_release); -} - -sub not_long { - #print "Entering not_long\n"; - my ($func) = @_; - my $val; - - # Doesn't work with gethostbyname (see perlipc) - #local $SIG{ALRM} = sub { die "alarm\n" }; - - if ('MSWin32' eq $OSNAME) { - local $SIG{ALRM} = sub { die "alarm\n" }; - }else{ - - POSIX::sigaction(SIGALRM, - POSIX::SigAction->new(sub { die "alarm" })) - or warn "Error setting SIGALRM handler: $!\n"; - } - - eval { - - alarm(3); - #print $func, "\n"; - { - no strict "refs"; - #print "Calling $func\n"; - $val = &$func(); - #print "End of $func\n"; - } - alarm(0); - }; - if ($@) { - if ($@ =~ /alarm/) { - # timed out - return('timeout'); - }else{ - alarm(0); - return('unknown'); # propagate unexpected errors - } - }else { - # didn't - return($val); - } -} - -sub localhost_info { - - my($infos) = join("", - "Here is a [$OSNAME] system (", - join(" ", - uname(), - ), - ")\n", - "With perl ", - sprintf("%vd", $PERL_VERSION), - " Mail::IMAPClient $Mail::IMAPClient::VERSION", - ); - return($infos); - -} - -sub usage { - my $localhost_info = localhost_info(); - my $thank = thank_author(); - my $warn_release =''; - $warn_release = check_last_release() if (not defined($releasecheck)); - print < : "from" imap server. Mandatory. ---port1 : port to connect on host1. Default is 143. ---user1 : user to login on host1. Mandatory. ---domain1 : domain on host1 (NTLM authentication). ---authuser1 : user to auth with on host1 (admin user). - Avoid using --authmech1 SOMETHING with --authuser1. ---proxyauth1 : Use proxyauth on host1. Requires --authuser1. - Required by Sun/iPlanet/Netscape IMAP servers to - be able to use an administrative user ---password1 : password for the user1. Dangerous, use --passfile1 ---passfile1 : password file for the user1. Contains the password. ---host2 : "destination" imap server. Mandatory. ---port2 : port to connect on host2. Default is 143. ---user2 : user to login on host2. Mandatory. ---domain2 : domain on host2 (NTLM authentication). ---authuser2 : user to auth with on host2 (admin user). ---proxyauth2 : Use proxyauth on host2. Requires --authuser2. - Required by Sun/iPlanet/Netscape IMAP servers to - be able to use an administrative user ---password2 : password for the user2. Dangerous, use --passfile2 ---passfile2 : password file for the user2. Contains the password. ---noauthmd5 : don't use MD5 authentification. ---authmech1 : auth mechanism to use with host1: - PLAIN, LOGIN, CRAM-MD5 etc. Use UPPERCASE. ---authmech2 : auth mechanism to use with host2. See --authmech1 ---ssl1 : use an SSL connection on host1. ---ssl2 : use an SSL connection on host2. ---tls1 : use an TLS connection on host1. ---tls2 : use an TLS connection on host2. ---folder : sync this folder. ---folder : and this one, etc. ---folderrec : sync this folder recursively. ---folderrec : and this one, etc. ---include : sync folders matching this regular expression ---include : or this one, etc. - in case both --include --exclude options are - use, include is done before. ---exclude : skips folders matching this regular expression - Several folders to avoid: - --exclude 'fold1|fold2|f3' skips fold1, fold2 and f3. ---exclude : or this one, etc. ---tmpdir : where to store temporary files and subdirectories. - Will be created if it doesn't exist. - Default is system specific and should be ok. ---pidfile : the file where imapsync pid is written. ---prefix1 : remove prefix to all destination folders - (usually INBOX. for cyrus imap servers) - you can use --prefix1 if your source imap server - does not have NAMESPACE capability. ---prefix2 : add prefix to all destination folders - (usually INBOX. for cyrus imap servers) - use --prefix2 if your target imap server does not - have NAMESPACE capability. ---regextrans2 : Apply the whole regex to each destination folders. ---regextrans2 : and this one. etc. - When you play with the --regextrans2 option, first - add also the safe options --dry --justfolders - Then, when happy, remove --dry, remove --justfolders ---regexmess : Apply the whole regex to each message before transfer. - Example: 's/\\000/ /g' # to replace null by space. ---regexmess : and this one. ---regexmess : and this one, etc. ---regexflag : Apply the whole regex to each flags list. - Example: 's/\"Junk"//g' # to remove "Junk" flag. ---regexflag : and this one, etc. ---sep1 : separator in case namespace is not supported. ---sep2 : idem. ---delete : delete messages on host1 server after - a successful transfer. Useful in case you - want to migrate from one server to another one. - With imap, "delete" tags messages as deleted, they - are not really deleted. See expunge. ---delete2 : delete messages in host2 that are not in - host1 server. ---delete2folders : delete folders in host2 that are not in - host1 server. For safety try it like this: - --delete2folders --dry --justfolders --nofoldersizes ---expunge : expunge messages on host1. - expunge really deletes messages marked deleted. - expunge is made at the beginning, on host1 only. - Newly transferred messages are expunged if - option --expunge is given. - No expunge is done on destination account - (see --expunge2) but it may change in future releases. ---expunge1 : expunge messages on host1. ---expunge2 : expunge messages on host2. ---uidexpunge2 : uidexpunge messages on the destination imap server - that are not on the source server, requires --delete2 ---syncinternaldates : sets the internal dates on host2 same as host1. - Turned on by default. Internal date is the date - a message arrived on a host (mtime). ---idatefromheader : sets the internal dates on host2 same as the - "Date:" headers. ---buffersize : sets the size of a block of I/O. ---maxsize : skip messages larger (or equal) than bytes ---minsize : skip messages smaller (or equal) than bytes ---maxage : skip messages older than days. - final stats (skipped) don't count older messages - see also --minage ---minage : skip messages newer than days. - final stats (skipped) don't count newer messages - You can do (+ are the messages selected): - past|----maxage+++++++++++++++>now - past|+++++++++++++++minage---->now - past|----maxage+++++minage---->now (intersection) - past|++++minage-----maxage++++>now (union) ---skipheader : Don't take into account header keyword - matching ex: --skipheader 'X.*' ---useheader : Use this header to compare messages on both sides. - Ex: Message-ID or Subject or Date. ---useheader and this one, etc. ---skipsize : Don't take message size into account to compare - messages on both sides. On by default. - Use --no-skipsize for using size comparaison. ---allowsizemismatch : allow RFC822.SIZE != fetched msg size - consider also --skipsize to avoid duplicate messages - when running syncs more than one time per mailbox ---dry : do nothing, just print what would be done. ---subscribed : transfers subscribed folders. ---subscribe : subscribe to the folders transferred on the - host2 that are subscribed on host1. ---subscribe_all : subscribe to the folders transferred on the - host2 even if they are not subscribed on host1. ---nofoldersizes : Do not calculate the size of each folder in bytes - and message counts. Default is to calculate them. ---justfoldersizes : exit after printed the folder sizes. ---syncacls : Synchronises acls (Access Control Lists). ---nosyncacls : Does not synchronise acls. This is the default. ---debug : debug mode. ---debugimap1 : imap debug mode for host1. imap debug is very verbose. ---debugimap2 : imap debug mode for host2. ---debugimap : imap debug mode for host1 and host2. ---version : print software version. ---noreleasecheck : do not check for new imapsync release (a http request). ---justconnect : just connect to both servers and print useful - information. Need only --host1 and --host2 options. ---justlogin : just login to both host1 and host2 with users - credentials, then exit. ---justfolders : just do things about folders (ignore messages). ---fast : be faster (just does not sync flags of messages - already transfered). ---reconnectretry1 : reconnect to host1 if connection is lost up to - times per imap command (default is 3) ---reconnectretry2 : same as --reconnectretry1 but for host2 ---split1 : split the requests in several parts on host1. - is the number of messages handled per request. - default is like --split1 1000. ---split2 : same thing on host2. ---fastio1 : use fastio with host1. ---fastio2 : use fastio with host2. ---timeout : imap connect timeout. ---help : print this help. - -Example: to synchronise imap account "foo" on "imap.truc.org" - to imap account "bar" on "imap.trac.org" - with foo password "secret1" - and bar password "secret2" - -$0 \\ - --host1 imap.truc.org --user1 foo --password1 secret1 \\ - --host2 imap.trac.org --user2 bar --password2 secret2 - -$localhost_info -$rcs -$warn_release - -$thank -EOF -} - - -sub good_date { - # two incoming formats: - # header Tue, 24 Aug 2010 16:00:00 +0200 - # internal 24-Aug-2010 16:00:00 +0200 - - # outgoing format: internal date format - # 24-Aug-2010 16:00:00 +0200 - - my ($d) = @_; - return ('') if not defined($d); - - if ( $d =~ m{(\d?)(\d-...-\d{4})( \d{2}:\d{2}:\d{2})( (?:\+|-)\d{4})?}o ) { - #print "internal: [$1][$2][$3][$4]\n"; - my ($day_1, $date_rest, $hour, $zone) = ($1,$2,$3,$4); - $day_1 = '0' if ($day_1 eq ''); - $zone = '' if not defined($zone); - $d = $day_1 . $date_rest . $hour . $zone; - - - }elsif ($d =~ m{(?:.{3}, )(\d?)(\d) (...) (\d{4})( \d{2}:\d{2}:\d{2})( (?:\+|-)\d{4})?}o ) { - #print "header: [$1][$2][$3][$4][$5][$6]\n"; - my ($day_1, $day_rest, $month, $year, $hour, $zone) = ($1,$2,$3,$4,$5,$6); - $day_1 = '0' if ($day_1 eq ''); - $zone = '' if not defined($zone); - $d = $day_1 . "$day_rest-$month-$year" . $hour . $zone; - - }else{ - # unknown/unmatch => return same string - return($d); - } - - $d = qq("$d"); - return($d); -} - -sub memory_consumption { - # memory consumed by imapsync until now in bytes - return((memory_consumption_of_pids())[0]); -} - -sub memory_consumption_of_pids { - - my @PID = (@_) ? @_ : ($PROCESS_ID); - - #print "PIDs: @PID\n"; - my @val; - if ('MSWin32' eq $OSNAME) { - @val = memory_consumption_of_pids_win32(@PID); - }else{ - # Unix - my @ps = qx{ ps -o vsz @PID }; - shift @ps; # First line is column name "VSZ" - chomp @ps; - # convert to - @val = map { $_ * 1024 } @ps; - return(@val); - } -} - -sub memory_consumption_of_pids_win32 { - # Windows - my @PID = @_; - my %PID; - # hash of pids as key values - map { $PID{$_}++ } @PID; - - # Does not work but should reading the tasklist documentation - #@ps = qx{ tasklist /FI "PID eq @PID" }; - - my @ps = qx{ tasklist /NH /FO CSV }; - #print "-" x 80, "\n", @ps, "-" x 80, "\n"; - my @val; - foreach my $line (@ps) { - my($name, $pid, $mem) = (split(',', $line))[0,1,4]; - next if (! $pid); - #print "[$name][$pid][$mem]"; - if ($PID{remove_qq($pid)}) { - #print "MATCH !\n"; - chomp($mem); - $mem = remove_qq($mem); - $mem = remove_Ko($mem); - $mem = remove_not_num($mem); - #print "[$mem]\n"; - push(@val, $mem * 1024); - } - } - return(@val); -} - -sub remove_not_num { - - my $string = shift; - $string =~ tr/0-9//cd; - #print "tr [$string]\n"; - return($string); -} - -sub tests_remove_not_num { - - ok('123' eq remove_not_num(123), 'remove_not_num( 123 )'); - ok('123' eq remove_not_num('123'), "remove_not_num( '123' )"); - ok('123' eq remove_not_num('12 3'), "remove_not_num( '12 3' )"); - ok('123' eq remove_not_num('a 12 3 Ko'), "remove_not_num( 'a 12 3 Ko' )"); -} - -sub remove_Ko { - my $string = shift; - if ($string =~ /^(.*) Ko$/) { - return($1); - }else{ - return($string); - } -} - -sub remove_qq { - my $string = shift; - if ($string =~ /^"(.*)"$/) { - return($1); - }else{ - return($string); - } -} - -sub memory_consumption_ratio { - - my ($base) = @_; - $base ||= 1; - my $consu = memory_consumption(); - return($consu / $base); -} - -sub tests_memory_consumption { - - ok(print join("\n", memory_consumption_of_pids()), "\n"); - ok(print join("\n", memory_consumption_of_pids('1')), "\n"); - ok(print join("\n", memory_consumption_of_pids('1', $$)), "\n"); - - ok(print memory_consumption_ratio(), "\n"); - ok(print memory_consumption_ratio(1), "\n"); - ok(print memory_consumption_ratio(10), "\n"); - - ok(print memory_consumption(), "\n"); -} - -sub tests_good_date { - - ok('' eq good_date(), 'good_date no arg'); - ok('"24-Aug-2010 16:00:00 +0200"' eq good_date('24-Aug-2010 16:00:00 +0200'), 'good_date internal 2digit zone'); - ok('"24-Aug-2010 16:00:00"' eq good_date('24-Aug-2010 16:00:00'), 'good_date internal 2digit no zone'); - ok('"01-Sep-2010 16:00:00 +0200"' eq good_date( '1-Sep-2010 16:00:00 +0200'), 'good_date internal SP 1digit'); - ok('"24-Aug-2010 16:00:00 +0200"' eq good_date('Tue, 24 Aug 2010 16:00:00 +0200'), 'good_date header 2digit zone'); - ok('"01-Sep-2010 16:00:00"' eq good_date('Wed, 1 Sep 2010 16:00:00'), 'good_date header SP 1digit zone'); - ok('"01-Sep-2010 16:00:00 +0200"' eq good_date('Wed, 1 Sep 2010 16:00:00 +0200'), 'good_date header SP 1digit zone'); - ok('"01-Sep-2010 16:00:00 +0200"' eq good_date('Wed, 1 Sep 2010 16:00:00 +0200 (CEST)'), 'good_date header SP 1digit zone'); - -} - - -sub tests_list_keys_in_2_not_in_1 { - - my @list; - ok( ! list_keys_in_2_not_in_1( {}, {}), 'list_keys_in_2_not_in_1: {} {}'); - ok( 0 == compare_lists( [], [ list_keys_in_2_not_in_1( {}, {} ) ] ), 'list_keys_in_2_not_in_1: {} {}'); - ok( 0 == compare_lists( ['a','b'], [ list_keys_in_2_not_in_1( {}, {'a' => 1, 'b' => 1}) ]), 'list_keys_in_2_not_in_1: {} {a, b}'); - ok( 0 == compare_lists( ['b'], [ list_keys_in_2_not_in_1( {'a' => 1}, {'a' => 1, 'b' => 1}) ]), 'list_keys_in_2_not_in_1: {a} {a, b}'); - ok( 0 == compare_lists( [], [ list_keys_in_2_not_in_1( {'a' => 1, 'b' => 1}, {'a' => 1, 'b' => 1}) ]), 'list_keys_in_2_not_in_1: {a, b} {a, b}'); - ok( 0 == compare_lists( [], [ list_keys_in_2_not_in_1( {'a' => 1, 'b' => 1, 'c' => 1}, {'a' => 1, 'b' => 1}) ]), 'list_keys_in_2_not_in_1: {a, b, c} {a, b}'); - ok( 0 == compare_lists( ['b'], [ list_keys_in_2_not_in_1( {'a' => 1, 'c' => 1}, {'a' => 1, 'b' => 1}) ]), 'list_keys_in_2_not_in_1: {a, b, c} {a, b}'); - -} - -sub list_keys_in_2_not_in_1 { - - my $folders1_ref = shift; - my $folders2_ref = shift; - my @list; - - foreach my $folder ( sort keys %$folders2_ref ) { - next if exists($folders1_ref->{$folder}); - push(@list, $folder); - } - return(@list); -} - - -sub list_folders_in_2_not_in_1 { - - my (@h2_folders_not_in_1, %h2_folders_not_in_1); - @h2_folders_not_in_1 = list_keys_in_2_not_in_1( \%h1_folders_all, \%h2_folders_all); - map { $h2_folders_not_in_1{$_} = 1} @h2_folders_not_in_1; - @h2_folders_not_in_1 = list_keys_in_2_not_in_1( \%h2_folders_from_1, \%h2_folders_not_in_1); - - return( reverse @h2_folders_not_in_1 ); -} - -sub delete_folders_in_2_not_in_1 { - - my $dry_message = ''; - $dry_message = "\t(not really since --dry mode)" if $dry; - foreach my $folder (@h2_folders_not_in_1) { - - my $res = $dry; # always success in dry mode! - $res = $imap2->delete($folder) if ( ! $dry ) ; - if ($res) { - print "Delete $folder", "$dry_message", "\n"; - }else{ - print "Delete $folder failure", "\n"; - } - } -} - -sub tests_debug { - - SKIP: { - skip "No test in normal run" if (not $tests_debug); - tests_list_keys_in_2_not_in_1(); - } -} - -sub tests { - - SKIP: { - skip "No test in normal run" if (not $tests); - tests_folder_routines(); - tests_compare_lists(); - tests_regexmess(); - tests_flags_regex(); - tests_permanentflags(); - tests_flags_filter(); - tests_imap2_folder_name(); - tests_command_line_nopassword(); - tests_good_date(); - tests_max(); - tests_remove_not_num(); - tests_memory_consumption(); - tests_is_a_release_number(); - tests_imapsync_basename(); - tests_list_keys_in_2_not_in_1(); - } -} - -# IMAPClient 2.2.9 overrides - -sub override_imapclient { -no warnings 'redefine'; -no strict 'subs'; - -use constant Unconnected => 0; -use constant Connected => 1; # connected; not logged in -use constant Authenticated => 2; # logged in; no mailbox selected -use constant Selected => 3; # mailbox selected -use constant INDEX => 0; # Array index for output line number -use constant TYPE => 1; # Array index for line type - # (either OUTPUT, INPUT, or LITERAL) -use constant DATA => 2; # Array index for output line data -use constant NonFolderArg => 1; # Value to pass to Massage to - # indicate non-folder argument - - -*Mail::IMAPClient::_transaction_literals = sub { - my $self = shift; - my $string = ""; - - foreach my $result (@{$self->{"History"}{$self->Transaction}}) { - $string .= $result->[DATA] - if defined($result) and $self->_is_literal($result) ; - } - return $string; -}; - - -*Mail::IMAPClient::append_file = sub { - - my $self = shift; - my $folder = $self->Massage(shift); - my $file = shift; - my $control = shift || undef; - my $count = $self->Count($self->Count+1); - my $flags = shift || undef; - my $date = shift || undef; - - if (defined($flags)) { - $flags =~ s/^\s+//g; - $flags =~ s/\s+$//g; - } - - if (defined($date)) { - $date =~ s/^\s+//g; - $date =~ s/\s+$//g; - } - - $flags = "($flags)" if $flags and $flags !~ /^\(.*\)$/ ; - $date = qq/"$date"/ if $date and $date !~ /^"/ ; - - - unless ( -f $file ) { - $self->LastError("File $file not found.\n"); - return undef; - } - - my $fh = IO::File->new($file) ; - - unless ($fh) { - $self->LastError("Unable to open $file: $!\n"); - $@ = "Unable to open $file: $!" ; - carp "unable to open $file: $!"; - return undef; - } - - my $bare_nl_count = scalar grep { /^\x0a$|[^\x0d]\x0a$/} <$fh>; - - seek($fh,0,0); - - my $clear = $self->Clear; - - $self->Clear($clear) - if $self->Count >= $clear and $clear > 0; - - my $length = ( -s $file ) + $bare_nl_count; - - my $string = "$count APPEND $folder " . - ( $flags ? "$flags " : "" ) . - ( $date ? "$date " : "" ) . - "{" . $length . "}\x0d\x0a" ; - - $self->_record($count,[ $self->_next_index($count), "INPUT", "$string" ] ); - - my $feedback = $self->_send_line("$string"); - - unless ($feedback) { - $self->LastError("Error sending '$string' to IMAP: $!\n"); - $fh->close; - return undef; - } - - my ($code, $output) = ("",""); - - until ( $code ) { - $output = $self->_read_line or $fh->close, return undef; - foreach my $o (@$output) { - $self->_record($count,$o); # $o is already an array ref - ($code) = $o->[DATA] =~ /(^\+|^\d+\sNO|^\d+\sBAD)/i; - if ($o->[DATA] =~ /^\*\s+BYE/) { - carp $o->[DATA]; - $self->State(Unconnected); - $fh->close; - return undef ; - } elsif ( $o->[DATA]=~ /^\d+\s+(NO|BAD)/i ) { - carp $o->[DATA]; - $fh->close; - return undef; - } - } - } - - { # Narrow scope - # Slurp up headers: later we'll make this more efficient I guess - local $/ = "\x0d\x0a\x0d\x0a"; - my $text = <$fh>; - $text =~ s/\x0d?\x0a/\x0d\x0a/g; - $self->_record($count,[ $self->_next_index($count), "INPUT", "{From file $file}" ] ) ; - $feedback = $self->_send_line($text); - - unless ($feedback) { - $self->LastError("Error sending append msg text to IMAP: $!\n"); - $fh->close; - return undef; - } - _debug($self, "control points to $$control\n") if ref($control) and $self->Debug; - $/ = ref($control) ? "\x0a" : $control ? $control : "\x0a"; - while (defined($text = <$fh>)) { - $text =~ s/\x0d?\x0a/\x0d\x0a/g; - $self->_record( $count, - [ $self->_next_index($count), "INPUT", "{from $file}\x0d\x0a" ] - ); - $feedback = $self->_send_line($text,1); - - unless ($feedback) { - $self->LastError("Error sending append msg text to IMAP: $!\n"); - $fh->close; - return undef; - } - } - $feedback = $self->_send_line("\x0d\x0a"); - - unless ($feedback) { - $self->LastError("Error sending append msg text to IMAP: $!\n"); - $fh->close; - return undef; - } - } - - # Now for the crucial test: Did the append work or not? - ($code, $output) = ("",""); - - my $uid = undef; - until ( $code ) { - $output = $self->_read_line or return undef; - foreach my $o (@$output) { - $self->_record($count,$o); # $o is already an array ref - $self->_debug("append_file: Deciding if " . $o->[DATA] . " has the code.\n") - if $self->Debug; - ($code) = $o->[DATA] =~ /^\d+\s(NO|BAD|OK)/i; - # try to grab new msg's uid from o/p - $o->[DATA] =~ m#UID\s+\d+\s+(\d+)\]# and $uid = $1; - if ($o->[DATA] =~ /^\*\s+BYE/) { - carp $o->[DATA]; - $self->State(Unconnected); - $fh->close; - return undef ; - } elsif ( $o->[DATA]=~ /^\d+\s+(NO|BAD)/i ) { - carp $o->[DATA]; - $fh->close; - return undef; - } - } - } - $fh->close; - - if ($code !~ /^OK/i) { - return undef; - } - - - return defined($uid) ? $uid : $self; -}; - - - - -*Mail::IMAPClient::fetch_hash = sub { - # taken from original lib, - # just added split code. - my $self = shift; - my $hash = ref($_[-1]) ? pop @_ : {}; - my @words = @_; - for (@words) { - s/([\( ])FAST([\) ])/${1}FLAGS INTERNALDATE RFC822\.SIZE$2/i ; - s/([\( ])FULL([\) ])/${1}FLAGS INTERNALDATE RFC822\.SIZE ENVELOPE BODY$2/i ; - } - my $msgs_ref_all = scalar($self->messages); - my $split = $self->Split() || scalar(@$msgs_ref_all); - while(my @msgs = splice(@$msgs_ref_all, 0, $split)) { - #print "SPLIT: @msgs\n"; - my $msgs_ref = \@msgs; - my $output = scalar($self->fetch($msgs_ref,"(" . join(" ",@_) . ")")) - ; # unless grep(/\b(?:FAST|FULL)\b/i,@words); - my $x; - for ($x = 0; $x <= $#$output ; $x++) { - my $entry = {}; - my $l = $output->[$x]; - if ($self->Uid) { - my($uid) = $l =~ /\((?:.* )?UID (\d+).*\)/i; - next unless $uid; - if ( exists $hash->{$uid} ) { - $entry = $hash->{$uid} ; - } - else { - $hash->{$uid} ||= $entry; - } - } - else { - my($mid) = $l =~ /^\* (\d+) FETCH/i; - next unless $mid; - if ( exists $hash->{$mid} ) { - $entry = $hash->{$mid} ; - } - else { - $hash->{$mid} ||= $entry; - } - } - - foreach my $w (@words) { - if ( $l =~ /\Q$w\E\s*$/i ) { - $entry->{$w} = $output->[$x+1]; - $entry->{$w} =~ s/(?:\x0a?\x0d)+$//g; - chomp $entry->{$w}; - } - else { - $l =~ /\( # open paren followed by ... - (?:.*\s)? # ...optional stuff and a space - \Q$w\E\s # escaped fetch field - (?:" # then: a dbl-quote - (\\.| # then bslashed anychar(s) or ... - [^"]+) # ... nonquote char(s) - "| # then closing quote; or ... - \( # ...an open paren - (\\.| # then bslashed anychar or ... - [^\)]*) # ... non-close-paren char - \)| # then closing paren; or ... - (\S+)) # unquoted string - (?:\s.*)? # possibly followed by space-stuff - \) # close paren - /xi; - $entry->{$w}=defined($1)?$1:defined($2)?$2:$3; - } - } - } -} - return wantarray ? %$hash : $hash; -}; - - - -*Mail::IMAPClient::login = sub { - my $self = shift; - return $self->authenticate($self->Authmechanism,$self->Authcallback) - if $self->{Authmechanism}; - - my $id = $self->User; - my $has_quotes = $id =~ /^".*"$/ ? 1 : 0; - my $string = "Login " . ( $has_quotes ? $id : qq("$id") ) . - " " . $self->Password . "\r\n"; - $self->_imap_command($string) - and $self->State(Authenticated); - # $self->folders and $self->separator unless $self->NoAutoList; - unless ( $self->IsAuthenticated) { - my($carp) = $self->LastError; - $carp =~ s/^[\S]+ ([^\x0d\x0a]*)\x0d?\x0a/$1/; - carp $carp unless defined wantarray; - return undef; - }; - return $self; -}; - - -*Mail::IMAPClient::get_header = sub { - my($self , $msg, $header ) = @_; - my $val; - - #eval { $val = $self->parse_headers([$msg],$header)->{$header}[0] }; - my $h = $self->parse_headers([$msg],$header); - #require Data::Dumper; - #print Data::Dumper->Dump([$h]); - #$val = $self->parse_headers([$msg],$header)->{$header}[0]; - - $val = $h->{$msg}{$header}[0]; - return defined($val)? $val : undef; -}; - - -*Mail::IMAPClient::parse_headers = sub { - my($self,$msgspec_all,@fields) = @_; - my(%fieldmap) = map { ( lc($_),$_ ) } @fields; - my $msg; my $string; my $field; - #print ref($msgspec_all), "\n"; - #if(ref($msgspec_all) eq 'HASH') { - # print ref($msgspec_all), "\n"; - #$msgspec_all = [$msgspec_all]; - #} - - unless(ref($msgspec_all) eq 'ARRAY') { - print "parse_headers want an ARRAY ref\n"; - #exit 1; - return undef; - } - - my $headers = {}; # hash from message ids to header hash - my $split = $self->Split() || scalar(@$msgspec_all); - while(my @msgs = splice(@$msgspec_all, 0, $split)) { - $debug and print "SPLIT: @msgs\n"; - my $msgspec = \@msgs; - - # Make $msg a comma separated list, of messages we want - $msg = $self->Range($msgspec); - - if ($fields[0] =~ /^[Aa][Ll]{2}$/ ) { - - $string = "$msg body" . - # use ".peek" if Peek parameter is a) defined and true, - # or b) undefined, but not if it's defined and untrue: - - ( defined($self->Peek) ? - ( $self->Peek ? ".peek" : "" ) : - ".peek" - ) . "[header]" ; - - }else { - $string = "$msg body" . - # use ".peek" if Peek parameter is a) defined and true, or - # b) undefined, but not if it's defined and untrue: - - ( defined($self->Peek) ? - ( $self->Peek ? ".peek" : "" ) : - ".peek" - ) . "[header.fields (" . join(" ",@fields) . ')]' ; - } - - my @raw=$self->fetch( $string ) or return undef; - - - my $h = 0; # reference to hash of current msgid, or 0 between msgs - - for my $header (map { split(/(?:\x0d\x0a)/,$_) } @raw) { - - no warnings; - if ( $header =~ /^\*\s+\d+\s+FETCH\s+\(.*BODY\[HEADER(?:\]|\.FIELDS)/i) { - if ($self->Uid) { - if ( my($msgid) = $header =~ /UID\s+(\d+)/ ) { - $h = {}; - $headers->{$msgid} = $h; - } - else { - $h = {}; - } - } - else { - if ( my($msgid) = $header =~ /^\*\s+(\d+)/ ) { - #start of new message header: - $h = {}; - $headers->{$msgid} = $h; - } - } - } - next if $header =~ /^\s+$/; - - # ( for vi - if ($header =~ /^\)/) { # end of this message - $h = 0; # set to be between messages - next; - } - # check for 'UID)' - # when parsing headers by UID. - if ($self->Uid and my($msgid) = $header =~ /^\s*UID\s+(\d+)\s*\)/) { - $headers->{$msgid} = $h; # store in results against this message - $h = 0; # set to be between messages - next; - } - - if ($h != 0) { # do we expect this to be a header? - my $hdr = $header; - chomp $hdr; - $hdr =~ s/\r$//; - #print "W[$hdr]", ref($hdr), "!\n"; - #next if ( ! defined($hdr)); - #print "X[$hdr]\n"; - - if (defined($hdr) and ($hdr =~ s/^(\S+):\s*//)) { - # if ($hdr =~ s/^(\S+):\s*//) { - #print "X1\n"; - $field = exists $fieldmap{lc($1)} ? $fieldmap{lc($1)} : $1 ; - push @{$h->{$field}} , $hdr ; - } elsif ($hdr =~ s/^.*FETCH\s\(.*BODY\[HEADER\.FIELDS.*\)\]\s(\S+):\s*//) { - #print "X2\n"; - $field = exists $fieldmap{lc($1)} ? $fieldmap{lc($1)} : $1 ; - push @{$h->{$field}} , $hdr ; - } elsif ( ref($h->{$field}) eq 'ARRAY') { - #print "X3\n"; - - $hdr =~ s/^\s+/ /; - $h->{$field}[-1] .= $hdr ; - } - } - } - use warnings; -# my $candump = 0; -# if ($self->Debug) { -# eval { -# require Data::Dumper; -# Data::Dumper->import; -# }; -# $candump++ unless $@; -# } - - } - # if we asked for one message, just return its hash, - # otherwise, return hash of numbers => header hash - # if (ref($msgspec) eq 'ARRAY') { - - return $headers; - -}; - - -*Mail::IMAPClient::authenticate = sub { - - my $self = shift; - my $scheme = shift; - my $response = shift; - - $scheme ||= $self->Authmechanism; - $response ||= $self->Authcallback; - my $clear = $self->Clear; - - $self->Clear($clear) - if $self->Count >= $clear and $clear > 0; - - my $count = $self->Count($self->Count+1); - - - my $string = "$count AUTHENTICATE $scheme"; - - $self->_record($count,[ $self->_next_index($self->Transaction), - "INPUT", "$string\x0d\x0a"] ); - - my $feedback = $self->_send_line("$string"); - - unless ($feedback) { - $self->LastError("Error sending '$string' to IMAP: $!\n"); - return undef; - } - - my ($code, $output); - - until ($code) { - $output = $self->_read_line or return undef; - - foreach my $o (@$output) { - $self->_record($count,$o); # $o is a ref - ($code) = $o->[DATA] =~ /^\+(.*)$/ ; - if ($o->[DATA] =~ /^\*\s+BYE/) { - $self->State(Unconnected); - return undef ; - } - if ($o->[DATA]=~ /^\d+\s+(NO|BAD)/i) { - return undef ; - } - } - } - - if ('CRAM-MD5' eq $scheme && ! $response) { - if ($Mail::IMAPClient::_CRAM_MD5_ERR) { - $self->LastError($Mail::IMAPClient::_CRAM_MD5_ERR); - carp $Mail::IMAPClient::_CRAM_MD5_ERR; - } - else { - $response = \&Mail::IMAPClient::_cram_md5; - } - } - - $feedback = $self->_send_line($response->($code, $self)); - - unless ($feedback) { - $self->LastError("Error sending append msg text to IMAP: $!\n"); - return undef; - } - - $code = ""; # clear code - until ($code) { - $output = $self->_read_line or return undef; - foreach my $o (@$output) { - $self->_record($count,$o); # $o is a ref - if ( ($code) = $o->[DATA] =~ /^\+ (.*)$/ ) { - $feedback = $self->_send_line($response->($code,$self)); - unless ($feedback) { - $self->LastError("Error sending append msg text to IMAP: $!\n"); - return undef; - } - $code = "" ; # Clear code; we're still not finished - } else { - $o->[DATA] =~ /^$count (OK|NO|BAD)/ and $code = $1; - if ($o->[DATA] =~ /^\*\s+BYE/) { - $self->State(Unconnected); - return undef ; - } - } - } - } - - $code =~ /^OK/ and $self->State(Authenticated) ; - return $code =~ /^OK/ ? $self : undef ; - -}; - - - -*Mail::IMAPClient::_cram_md5 = sub { - my ($code, $client) = @_; - my $hmac = Digest::HMAC_MD5::hmac_md5_hex(MIME::Base64::decode($code), - $client->Password()); - return MIME::Base64::encode($client->User() . " $hmac", ""); -}; - -*Mail::IMAPClient::message_string = sub { - my $self = shift; - my $msg = shift; - my $expected_size = $self->size($msg); - return undef unless(defined $expected_size); # unable to get size - my $cmd = $self->has_capability('IMAP4REV1') ? - "BODY" . ( $self->Peek ? '.PEEK[]' : '[]' ) : - "RFC822" . ( $self->Peek ? '.PEEK' : '' ) ; - - #print "Message_string Beg fetch:\n", memory_consumption(); - $self->fetch($msg,$cmd) or return undef; - #print "Message_string End fetch:\n", memory_consumption(); - - my $string = ""; - - - foreach my $result (@{$self->{"History"}{$self->Transaction}}) { - $string .= $result->[DATA] - if defined($result) and $self->_is_literal($result) ; - } - #print "Message_string End string:\n", memory_consumption(); - - # BUG? should probably return undef if length != expected - # No bug, somme servers are buggy. - - if (! $self->Ignoresizeerrors ) { - if ( length($string) != $expected_size ) { - warn "message_string: " . - "expected $expected_size bytes but received " . - length($string) . "\n"; - $self->LastError("message_string: expected ". - "$expected_size bytes but received " . - length($string)."\n"); - } - } - return $string; -}; - - - -{ -no warnings 'once'; - -*Mail::IMAPClient::Ssl = sub { - my $self = shift; - - if (@_) { $self->{SSL} = shift } - return $self->{SSL}; -}; - -*Mail::IMAPClient::exists = sub { - my ( $self, $folder ) = @_; - $self->status($folder) ? $self : undef; -}; - - - -*Mail::IMAPClient::Authuser = sub { - my $self = shift; - - if (@_) { $self->{AUTHUSER} = shift } - return $self->{AUTHUSER}; -}; - - -*Mail::IMAPClient::Ignoresizeerrors = sub { - my $self = shift; - - if (@_) { $self->{IGNORESIZEERRORS} = shift } - return $self->{IGNORESIZEERRORS}; -}; - -*Mail::IMAPClient::Reconnectretry = sub { - my $self = shift; - - if (@_) { $self->{RECONNECTRETRY} = shift } - return $self->{RECONNECTRETRY}; -}; - - -*Mail::IMAPClient::reconnect = sub { - my $self = shift; - - if ( $self->IsAuthenticated ) { - $self->_debug("reconnect called but already authenticated"); - return $self; - } - - my $einfo = $self->LastError || ""; - $self->_debug( "reconnecting to ", $self->Server, ", last error: $einfo" ); - - # reconnect and select appropriate folder - $self->connect or return undef; - - return ( defined $self->Folder ) ? $self->select( $self->Folder ) : $self; -}; - - -# wrapper for _imap_command_do to enable retrying on lost connections -*Mail::IMAPClient::_imap_command = sub { - my $self = shift; - - my $tries = 0; - my $retry = $self->Reconnectretry || 0; - my ( $rc, @err ); - - #print "@_ Beg _imap_command:\n", memory_consumption(); - - # LastError (if set) will be overwritten masking any earlier errors - while ( $tries++ <= $retry ) { - # do command on the first try or if Connected (reconnect ongoing) - if ( $tries == 1 or $self->IsConnected ) { - #print "call @_\n"; - $rc = $self->_imap_command_do(@_); - push( @err, $self->LastError ) if $self->LastError; - #print "call @_ done [", $rc || '', "] [$tries/$retry][" . $self->IsUnconnected . "]\n"; - } - - if ( !defined($rc) and $retry and $self->IsUnconnected - and $self->LastIMAPCommand !~ /LOGOUT/) { - print "\nWarning: disconnected. "; - if ( $self->reconnect ) { - print "Reconnect successful on try #$tries\n"; - $self->Reconnect_counter($self->Reconnect_counter() + 1); - } - else { - print "Reconnect failed on try #$tries\n"; - push( @err, $self->LastError ) if $self->LastError; - } - } - else { - last; - } - } - - unless ($rc) { - my ( %seen, @keep, @info ); - - foreach my $str (@err) { - my ( $sz, $len ) = ( 96, length($str) ); - $str =~ s/$CR?$LF$/\\n/omg; - if ( !$self->Debug and $len > $sz * 2 ) { - my $beg = substr( $str, 0, $sz ); - my $end = substr( $str, -$sz, $sz ); - $str = $beg . "..." . $end; - } - next if $seen{$str}++; - push( @keep, $str ); - } - foreach my $msg (@keep) { - push( @info, $msg . ( $seen{$msg} > 1 ? " ($seen{$msg}x)" : "" ) ); - } - $self->LastError( join( "; ", @info ) ); - } - #print "@_ End _imap_command:\n", memory_consumption(); - return $rc; -}; - - -*Mail::IMAPClient::_imap_command_do = sub { - - my $self = shift; - my $string = shift or return undef; - my $good = shift || 'GOOD'; - - my $qgood = quotemeta($good); - - my $clear = ""; - $clear = $self->Clear; - - $self->Clear($clear) - if $self->Count >= $clear and $clear > 0; - - my $count = $self->Count($self->Count+1); - - $string = "$count $string" ; - - #print "$string\n", memory_consumption(); - $self->_record($count,[ 0, "INPUT", "$string\x0d\x0a"] ); - #print "\n2 $count\n", memory_consumption(); - my $feedback = $self->_send_line("$string"); - - unless ($feedback) { - $self->LastError( "Error sending '$string' to IMAP: $!\n"); - $@ = "Error sending '$string' to IMAP: $!"; - carp "Error sending '$string' to IMAP: $!"; - return undef; - } - - my ($code, $output); - $output = ""; - - READ: until ( $code) { - # escape infinite loop if read_line never returns any data: - $output = $self->_read_line or return undef; - - for my $o (@$output) { - - $self->_record($count,$o); # $o is a ref - # $self->_debug("Received from readline: ${\($o->[DATA])}<>\n"); - next unless $self->_is_output($o); - if ( $good eq '+' ) { - $o->[DATA] =~ /^$count (OK|BAD|NO|$qgood)|^($qgood)/mi ; - $code = $1||$2 ; - } else { - ($code) = $o->[DATA] =~ /^$count (OK|BAD|NO|$qgood)/mi ; - } - if ($o->[DATA] =~ /^\*\s+BYE/im) { - $self->State(Unconnected); - return undef ; - } - } - } - #print "$string: returned $code\n", memory_consumption(); - # $self->_debug("Command $string: returned $code\n"); - return $code =~ /^OK|$qgood/im ? $self : undef ; - -}; - -# capability 2.2.9 is stupid: it caches and return first imap CAPABILITY call -# but call imap CAPABILITY each time. -# Copy/paste from 3.25 -*Mail::IMAPClient::capability = sub { - my $self = shift; - - if ( $self->{CAPABILITY} ) { - my @caps = keys %{ $self->{CAPABILITY} }; - return wantarray ? @caps : \@caps; - } - - $self->_imap_command('CAPABILITY') - or return undef; - - my @caps = map { split } grep s/^\*\s+CAPABILITY\s+//, $self->History; - foreach (@caps) { - $self->{CAPABILITY}{ uc $_ }++; - $self->{ uc $1 } = uc $2 if /(.*?)\=(.*)/; - } - - return wantarray ? @caps : \@caps; -}; - -*Mail::IMAPClient::_read_line = sub { - my $self = shift; - my $sh = $self->Socket; - my $literal_callback = shift; - my $output_callback = shift; - - unless ($self->IsConnected and $self->Socket) { - $self->LastError("NO Not connected.\n"); - carp "Not connected" if $^W; - return undef; - } - - my $iBuffer = ""; - my $oBuffer = []; - my $count = 0; - my $index = $self->_next_index($self->Transaction); - my $rvec = my $ready = my $errors = 0; - my $timeout = $self->Timeout; - - my $readlen = 1; - my $fast_io = $self->Fast_io; # Remember setting to reduce future method calls - - if ( $fast_io ) { - - # set fcntl if necessary: - exists $self->{_fcntl} or $self->Fast_io($fast_io); - $readlen = $self->{Buffer}||4096; - } - until ( - # there's stuff in output buffer: - scalar(@$oBuffer) and - - # the last thing there has cr-lf: - $oBuffer->[-1][DATA] =~ /\x0d\x0a$/ and - - # that thing is an output line: - $oBuffer->[-1][TYPE] eq "OUTPUT" and - - # and the input buffer has been MT'ed: - $iBuffer eq "" - - ) { - #print memory_consumption(); - my $transno = $self->Transaction; # used below in several places - if ($timeout) { - vec($rvec, fileno($self->Socket), 1) = 1; - my @ready = $self->{_select}->can_read($timeout) ; - unless ( @ready ) { - $self->LastError("Tag $transno: " . - "Timeout after $timeout seconds " . - "waiting for data from server\n"); - $self->_record($transno, - [ $self->_next_index($transno), - "ERROR", - "$transno * NO Timeout after ". - "$timeout seconds " . - "during read from " . - "server\x0d\x0a" - ] - ); - $self->LastError( - "Timeout after $timeout seconds " . - "during read from server\x0d\x0a" - ); - return undef; - } - } - - #local($^W) = undef; # Now quiet down warnings - - # read "$readlen" bytes (or less): - # need to check return code from $self->_sysread - # in case other end has shut down!!! - my $ret = $self->_sysread( $sh, \$iBuffer, $readlen, length($iBuffer)) ; - # $self->_debug("Read so far: $iBuffer<>\n"); - redo if(! defined($ret)) ; - if(($timeout and ! defined($ret))) { # Blocking read error... - my $msg = "Error while reading data from server: $!\x0d\x0a"; - $self->LastError('Error while reading data from server'); - $self->State(Unconnected); - print $msg; - $self->_record($transno, - [ $self->_next_index($transno), - "ERROR", "$transno * NO $msg " - ]); - $@ = "$msg"; - - return undef; - } - elsif(defined($ret) and $ret == 0) { # Caught EOF... - my $msg="Socket closed while reading data from server [$!]\x0d\x0a"; - print "$msg"; - $self->LastError('Socket closed while reading data from server'); - $self->State(Unconnected); - $self->_record($transno, - [ $self->_next_index($transno), - "ERROR", "$transno * NO $msg " - ]); - $@ = "$msg"; - return undef; - } - - # successfully wrote to other end, keep going... - $count += $ret; - LINES: while ( $iBuffer =~ s/^(.*?\x0d?\x0a)// ) { - my $current_line = $1; - #print memory_consumption(); - - # $self->_debug("BUFFER: pulled from buffer: ${current_line}\n" . - # "and left with buffer contents of: ${iBuffer}\n"); - - LITERAL: if ($current_line =~ s/\{(\d+)\}\x0d\x0a$//) { - # This part handles IMAP "Literals", - # which according to rfc2060 look something like this: - # [tag]|* BLAH BLAH {nnn}\r\n - # [nnn bytes of literally transmitted stuff] - # [part of line that follows literal data]\r\n - - # Set $len to be length of impending literal: - my $len = $1 ; - - $self->_debug("LITERAL: received literal in line ". - "$current_line of length $len; ". - "attempting to ". - "retrieve from the " . length($iBuffer) . - " bytes in: $iBuffer\n"); - - # Xfer up to $len bytes from front of $iBuffer to $litstring: - my $litstring = substr($iBuffer, 0, $len); - $iBuffer = substr($iBuffer, length($litstring), - length($iBuffer) - length($litstring) ) ; - - # Figure out what's left to read (i.e. what part of - # literal wasn't in buffer): - my $remainder_count = $len - length($litstring); - my $callback_value = ""; - - if ( defined($literal_callback) ) { - if ( $literal_callback =~ /GLOB/) { - print $literal_callback $litstring ; - $litstring = ""; - } elsif ($literal_callback =~ /CODE/ ) { - # Don't do a thing - - } else { - $self->LastError( - ref($literal_callback) . - " is an invalid callback type; " . - "must be a filehandle or coderef\n" - ); - } - - - } - if ($remainder_count > 0 and $timeout) { - # If we're doing timeouts then here we set up select - # and wait for data from the the IMAP socket. - vec($rvec, fileno($self->Socket), 1) = 1; - unless ( CORE::select( $ready = $rvec, - undef, - $errors = $rvec, - $timeout) - ) { - # Select failed; that means bad news. - # Better tell someone. - $self->LastError("Tag " . $transno . - ": Timeout waiting for literal data " . - "from server\n"); - carp "Tag " . $transno . - ": Timeout waiting for literal data " . - "from server\n" - if $self->Debug or $^W; - return undef; - } - } - - fcntl($sh, F_SETFL, $self->{_fcntl}) - if $fast_io and defined($self->{_fcntl}); - while ( $remainder_count > 0 ) { # As long as not done, - $self->_debug("Still need $remainder_count to " . - "complete literal string\n"); - my $ret = $self->_sysread( # bytes read - $sh, # IMAP handle - \$litstring, # place to read into - $remainder_count, # bytes left to read - length($litstring) # offset to read into - ) ; - $self->_debug("Received ret=$ret and buffer = " . - "\n$litstring\nwhile processing LITERAL\n"); - if ( $timeout and !defined($ret)) { # possible timeout - $self->_record($transno, [ - $self->_next_index($transno), - "ERROR", - "$transno * NO Error reading data " . - "from server: $!\n" - ] - ); - return undef; - } elsif ( $ret == 0 and eof($sh) ) { - $self->_record($transno, [ - $self->_next_index($transno), - "ERROR", - "$transno * ". - "BYE Server unexpectedly " . - "closed connection: $!\n" - ] - ); - $self->State(Unconnected); - return undef; - } - # decrement remaining bytes by amt read: - $remainder_count -= $ret; - - if ( length($litstring) > $len ) { - # copy the extra struff into the iBuffer: - $iBuffer = substr( - $litstring, - $len, - length($litstring) - $len - ); - $litstring = substr($litstring, 0, $len) ; - } - - if ( defined($literal_callback) ) { - if ( $literal_callback =~ /GLOB/ ) { - print $literal_callback $litstring; - $litstring = ""; - } - } - - } - $literal_callback->($litstring) - if defined($litstring) and - defined($literal_callback) and $literal_callback =~ /CODE/; - - $self->Fast_io($fast_io) if $fast_io; - - # Now let's make sure there are no IMAP server output lines - # (i.e. [tag|*] BAD|NO|OK Text) embedded in the literal string - # (There shouldn't be but I've seen it done!), but only if - # EnableServerResponseInLiteral is set to true - - my $embedded_output = 0; - my $lastline = ( split(/\x0d?\x0a/,$litstring))[-1] - if $litstring; - - if ( $self->EnableServerResponseInLiteral and - $lastline and - $lastline =~ /^(?:\*|(\d+))\s(BAD|NO|OK)/i - ) { - $litstring =~ s/\Q$lastline\E\x0d?\x0a//; - $embedded_output++; - - $self->_debug("Got server output mixed in " . - "with literal: $lastline\n" - ) if $self->Debug; - - } - # Finally, we need to stuff the literal onto the - # end of the oBuffer: - push @$oBuffer, [ $index++, "OUTPUT" , $current_line], - [ $index++, "LITERAL", $litstring ]; - push @$oBuffer, [ $index++, "OUTPUT", $lastline ] - if $embedded_output; - - } else { - push @$oBuffer, [ $index++, "OUTPUT" , $current_line ]; - } - - } - #$self->_debug("iBuffer is now: $iBuffer<>\n"); - } - # _debug $self, "Buffer is now $buffer\n"; - _debug $self, "Read: " . join("",map {$_->[DATA]} @$oBuffer) ."\n" - if $self->Debug; - return scalar(@$oBuffer) ? $oBuffer : undef ; -}; - - - -} - -# End of sub override_imapclient (yes, very bad indentation) -} - -# IMAPClient 2.2.9 3.xx ads - -package Mail::IMAPClient; - -sub Split { - my $self = shift; - - if (@_) { - $self->{SPLIT} = shift; - $self->{Maxcommandlength} = 10 * $self->{SPLIT}; - } - return $self->{SPLIT}; -} - -sub Tls { - my $self = shift; - - if (@_) { $self->{TLS} = shift } - return $self->{TLS}; -} - -sub Reconnect_counter { - my $self = shift; - if (@_) { $self->{Reconnect_counter} = shift } - return $self->{Reconnect_counter}; - -} - - -sub Banner { - my $self = shift; - - if (@_) { $self->{BANNER} = shift } - return $self->{BANNER}; -} - - -sub RawSocket2 { - my ( $self, $sock ) = @_; - defined $sock - or return $self->{Socket}; - - $self->{Socket} = $sock; - $self->{_select} = IO::Select->new($sock); - delete $self->{_fcntl}; - #$self->Fast_io( $self->Fast_io ); - $sock; -} - -sub capability_update { - my $self = shift; - - delete $self->{CAPABILITY}; - $self->capability; -} - -sub fetch_hash_2 { - # taken from above *Mail::IMAPClient::fetch_hash - # if last arg is a ref then the fetch is done only - # on the messages listed as the keys of this hash. - # Init an "empty" $hash_ref by value can be done this way: - # @$hash_ref{2, 3, 4, 55} = (undef); - - my $self = shift; - my $hash_ref = ref($_[-1]) ? pop @_ : {}; - my @words = @_; - for (@words) { - s/([\( ])FAST([\) ])/${1}FLAGS INTERNALDATE RFC822\.SIZE$2/i ; - s/([\( ])FULL([\) ])/${1}FLAGS INTERNALDATE RFC822\.SIZE ENVELOPE BODY$2/i ; - } - - my $msgs_ref_all; - if (scalar %$hash_ref) { - $msgs_ref_all = [ sort { $a <=> $b } keys (%$hash_ref) ]; - #print "ZZZZ 1 [@$msgs_ref_all]\n"; - }else{ - $msgs_ref_all = scalar($self->messages); - #print "ZZZZ 2 [@$msgs_ref_all]\n"; - } - - my $split = $self->Split() || scalar(@$msgs_ref_all); - while(my @msgs = splice(@$msgs_ref_all, 0, $split)) { - #print "SPLIT: @msgs\n"; - my $msgs_ref = \@msgs; - my $output = scalar($self->fetch($msgs_ref,"(" . join(" ",@_) . ")")) - ; # unless grep(/\b(?:FAST|FULL)\b/i,@words); - my $x; - for ($x = 0; $x <= $#$output ; $x++) { - my $entry = {}; - my $l = $output->[$x]; - if ($self->Uid) { - my($uid) = $l =~ /\((?:.* )?UID (\d+).*\)/i; - next unless $uid; - if ( defined $hash_ref->{$uid} ) { - $entry = $hash_ref->{$uid} ; - } - else { - $hash_ref->{$uid} ||= $entry; - } - } - else { - my($mid) = $l =~ /^\* (\d+) FETCH/i; - next unless $mid; - if ( defined $hash_ref->{$mid} ) { - $entry = $hash_ref->{$mid} ; - } - else { - $hash_ref->{$mid} ||= $entry; - } - } - - foreach my $w (@words) { - if ( $l =~ /\Q$w\E\s*$/i ) { - $entry->{$w} = $output->[$x+1]; - $entry->{$w} =~ s/(?:\x0a?\x0d)+$//g; - chomp $entry->{$w}; - } - else { - $l =~ /\( # open paren followed by ... - (?:.*\s)? # ...optional stuff and a space - \Q$w\E\s # escaped fetch field - (?:" # then: a dbl-quote - (\\.| # then bslashed anychar(s) or ... - [^"]+) # ... nonquote char(s) - "| # then closing quote; or ... - \( # ...an open paren - (\\.| # then bslashed anychar or ... - [^\)]*) # ... non-close-paren char - \)| # then closing paren; or ... - (\S+)) # unquoted string - (?:\s.*)? # possibly followed by space-stuff - \) # close paren - /xi; - $entry->{$w}=defined($1)?$1:defined($2)?$2:$3; - } - } - } -} - return wantarray ? %$hash_ref : $hash_ref; -} diff --git a/index.shtml b/index.shtml index 38beb6c..a709048 100644 --- a/index.shtml +++ b/index.shtml @@ -5,7 +5,7 @@ imapsync <!--#exec cmd="cat VERSION" --> - + @@ -72,30 +72,12 @@ where the user plays independently on both sides. Use offlineimap imapsync mailing-list (see below section Mailing-List).

- - - -

Latest release is imapsync

-

Written on

- -

See ChangeLog to know what's new.

@@ -122,61 +104,47 @@ where the user plays independently on both sides. Use offlineimap The Perl imapsync source code will run anywhere a Perl interpreter can run: any Unix, Linux, Windows, or Mac OS operating system.

-

Buy latest imapsync Perl source code
-+ standalone imapsync.exe for win32
-+ standalone x86_elf binary for 30 EUR (~40 USD): +

Buy latest imapsync Perl source code for 30 EUR

+

+30 EUR is about 40 USD, no problem to pay in USD with paypal: +

+

-

- - -
Technical support option (+ 80 EUR)
- -

- -

- -

You will receive a download link in few minutes (contact me if the delay is over 20 minutes).
+

You will receive a download link in few minutes (contact me if the delay is over a couple of hours).
30 days money-back guarantee.

Standalone imapsync.exe for win32

Struggle free from source code and Perl installation by
-buying the latest win32 standalone imapsync.exe for 22 EUR (~29 USD):

+buying the latest win32 standalone imapsync.exe for 30 EUR

+

+30 EUR is about 40 USD, no problem to pay in USD with paypal: +

-

- - -
Technical support option (+ 80 EUR)
-

- -

-

You will receive a download link in few minutes (contact me if the delay is over 20 minutes).
+ +

You will receive a download link in few minutes (contact me if the delay is over a couple of hours).
30 days money-back guarantee.

-

Documentation

Read the INSTALL file to know how to install imapsync on your system. @@ -208,7 +175,6 @@ See also the wanted section.

What you can do with imapsync is listed in COPYING.

-

The imapsync mailing list

@@ -265,7 +231,7 @@ If you really want a feature or a fix you can donate money and my next developme will be to code it or fix it.

-

On january 2011: 1 EUR ~ 1.3 USD.

+

On february 2011: 1 EUR ~ 1.3 USD.

@@ -294,7 +260,7 @@ will be to code it or fix it.
YesFix capability changes 1 hour 80 min 0 $ 40 $ YesLarge mailbox --maxage 4 hours 270 min 0 $ 160 $ Yesdkimap support 3 hours 120 min 0 $ 120 $ - Nogratis from here 4 hours 0 min 0 $ 120000 $ + Nogratis from here 4 hours 0 min 0 $ 60000 $

Lists of imap server software failures and success stories

@@ -314,8 +280,6 @@ will be to code it or fix it.
[host2] means "destination server"):

- -
  • 1und1 H mimap1 84498 [host1]
  • Archiveopteryx 2.03, 2.04, 2.09, 2.10 [host2], 3.0.0 [host2] @@ -332,6 +296,7 @@ will be to code it or fix it.
    v2.2.12-Invoca-RPM-2.2.12-3.RHEL4.1, 2.2.13, v2.3.1-Invoca-RPM-2.3.1-2.7.fc5, + v2.3.1-Invoca-RPM-2.3.1-2.8.fc5 [host1], v2.3.7, (http://asg.web.cmu.edu/cyrus/)
  • @@ -346,7 +311,7 @@ will be to code it or fix it.
  • Eudora WorldMail v2
  • GMX IMAP4 StreamProxy.
  • Groupwise IMAP (Novell) 6.x and 7.0. Buggy so see the FAQ.
  • -
  • hMailServer 5.3.3 [host2], 4.4.1 [host1]
  • +
  • hMailServer 5.3.3 [host2], 4.4.1 [host1], HMAILSERVER 5.3.2-B1769 on windows 2003 [hsot2]
  • iPlanet Messaging server 4.15, 5.1, 5.2
  • IMail 7.15 (Ipswitch/Win2003), 8.12
  • MDaemon 7.0.1, 8.0.2, 8.1, 9.5.4 (Windows server 2003 R2 platform)
  • @@ -403,7 +368,7 @@ alt="Viewable With Any Browser" /> This document last modified on -($Id: index.shtml,v 1.50 2011/01/18 04:01:20 gilles Exp gilles $) +($Id: index.shtml,v 1.55 2011/02/21 02:16:36 gilles Exp gilles $)

    diff --git a/paypal_reply/paypal_bilan b/paypal_reply/paypal_bilan new file mode 100755 index 0000000..059a628 --- /dev/null +++ b/paypal_reply/paypal_bilan @@ -0,0 +1,81 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +my $total_usd_received ; +my $total_usd_invoice ; + +my $total_eur_received ; +my $total_eur_invoice ; +my $nb_invoice ; +my $line ; + + +while( $line = <> ) { + next if ( $line =~ /^Date, Heure, Fuseau horaire, Nom, Type, Etat, Devise, Montant, Numéro d'avis de réception, Solde,/ ) ; + #print( "A1 $line" ) ; + chomp( $line ) ; + #print ("A2 $line\n" ); + + my $line2 = '",' . $line . '"' ; + my( $Nothing, $Date, $Heure, $Fuseau_horaire, $Nom, $Type, $Etat, $Devise, $Montant, $Numero_davis_de_reception, $Solde ) + = split( '","', $line2 ) ; + #print ( "[$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ; + + + if ( + 'Paiement sur site marchand reçu' eq $Type + and 'USD' eq $Devise + and 'Terminé' eq $Etat + ) { + $Montant =~tr/,/./; + #print "$Montant\n" ; + my $Montant2_usd; + $Montant2_usd = 15 if ( 14.11 == $Montant or 14.19 == $Montant ) ; + $Montant2_usd = 25 if ( 23.72 == $Montant or 23.85 == $Montant ) ; + $Montant2_usd = 35 if ( 33.33 == $Montant or 33.51 == $Montant ) ; + $Montant2_usd = 50 if ( 47.75 == $Montant or 14.19 == $Montant ) ; + $Montant2_usd = 125 if ( 119.82 == $Montant or 119.82 == $Montant ) ; + $Montant2_usd = 135 if ( 129.43 == $Montant or 129.43 == $Montant ) ; + #print "$Montant $Montant2_usd\n" ; + $total_usd_received += $Montant ; + $total_usd_invoice += $Montant2_usd ; + $nb_invoice++ ; + } + if ( + 'Paiement sur site marchand reçu' eq $Type + and 'EUR' eq $Devise + and 'Terminé' eq $Etat + ) { + $Montant =~tr/,/./; + #print "$Montant\n" ; + my $Montant2_eur; + $Montant2_eur = 22 if ( 20.88 == $Montant or 20.99 == $Montant ) ; + $Montant2_eur = 30 if ( 28.58 == $Montant or 28.73 == $Montant ) ; + $Montant2_eur = 110 if ( 105.46 == $Montant ) ; + #print "$Montant $Montant2_eur\n" ; + $total_eur_received += $Montant ; + $total_eur_invoice += $Montant2_eur ; + $nb_invoice++ ; + } +} + +print "USD banque $total_usd_received\n" ; +print "USD invoice $total_usd_invoice\n" ; +my $total_eur_from_usd ; +$total_eur_from_usd = int( ( $total_usd_invoice / 1.2981 ) + 0.5 ) ; # au 30 nov 2010 http://fr.finance.yahoo.com/devises/convertisseur/#from=EUR;to=USD;amt=1 +print "EUR from USD $total_eur_from_usd\n" ; +#$total_eur = int( ( $total_eur_invoice / 1.3 ) + 0.5 ) ; +#print "EUR $total_eur_from_usd\n" ; +print "EUR banque $total_eur_received\n" ; +print "EUR invoice $total_eur_invoice\n" ; + +my $total_eur = $total_eur_from_usd + $total_eur_invoice ; +print "EUR total $total_eur\n" ; +print "Nb invoice $nb_invoice\n" ; + + + + + diff --git a/paypal_reply/paypal_build_reply b/paypal_reply/paypal_build_reply index 37b6222..ca1c72d 100755 --- a/paypal_reply/paypal_build_reply +++ b/paypal_reply/paypal_build_reply @@ -1,6 +1,6 @@ #!/usr/bin/perl -# $Id: paypal_build_reply,v 1.8 2010/12/29 23:51:23 gilles Exp gilles $ +# $Id: paypal_build_reply,v 1.10 2011/02/02 22:31:41 gilles Exp gilles $ use warnings; use strict; @@ -8,13 +8,22 @@ use strict; my ($msg_id_file, $msg_id); my ($amount, $name, $email); my ( - $buyer, $object, $support, $description, + $paypal_line, $paypal_info, + $buyer, $description, $url_source, $url_exe, $url, $release, ); $msg_id_file = $ARGV[1]; $msg_id = firstline($msg_id_file); + +while(<>) { + next if ( ! /^(.*Num.+ro de transaction :.*)$/ ); + $paypal_line = $1; + $paypal_info = "===== Paypal id =====\n$paypal_line\n"; + last; +} + while(<>) { next if ( ! /^Vous avez re.*paiement d'un montant de (.*) de la part de (.*) \((.*)\)/); ($amount, $name, $email) = ($1, $2, $3); @@ -25,33 +34,7 @@ $url_source = firstline('/g/var/paypal_reply/url_source'); $url_exe = firstline('/g/var/paypal_reply/url_exe'); $release = firstline('/g/var/paypal_reply/url_release'); -# source code wanted -if (('$35,00 USD' eq $amount) or ('$50,00 USD' eq $amount)) { - $object = 'imapsync source code'; - $support = ''; - $url = $url_source; -} - -# win32 binary wanted -if (('$25,00 USD' eq $amount) or ('$15,00 USD' eq $amount)) { - $object = 'imapsync.exe binary'; - $support = ''; - $url = $url_exe; -} - -# source code + technical support wanted -if ('$135,00 USD' eq $amount) { - $object = 'imapsync source code'; - $support = "\nI'm ready to help you by email until success (I hope).\n"; - $url = $url_source; -} - -# win32 binary + technical support wanted -if ('$125,00 USD' eq $amount) { - $object = 'imapsync.exe binary'; - $support = "\nI'm ready to help you by email until success (I hope).\n"; - $url = $url_exe; -} +#print "[$amount] [$name] [$email] [$paypal_line]\n"; @@ -80,7 +63,7 @@ while(<>) { my $address = 'gilles.lamiral@laposte.net'; my $address2 = 'gilles@lamiral.info'; -my $rcstag = '$Id: paypal_build_reply,v 1.8 2010/12/29 23:51:23 gilles Exp gilles $'; +my $rcstag = '$Id: paypal_build_reply,v 1.10 2011/02/02 22:31:41 gilles Exp gilles $'; my $message = < To: <$email> Bcc: Gilles LAMIRAL <$address>, <$address2> -Subject: [imapsync download] $object release $release [$email] +Subject: [imapsync download] imapsync release $release [$email] Hello $name, -You will find the latest $object release $release at the following link: -$url +You will find the latest imapsync source code release $release at the following link: +$url_source + +You will find the latest imapsync.exe binary release $release at the following link: +$url_exe + +Next imapsync releases will be available for one year without extra payment. +Just keep this message and ask for the new links. +(I will build an automatic subscription tool later) I thank you for buying and using imapsync, I wish you successful transfers! -$support + +$paypal_info $buyer $description ==== Vendeur ==== @@ -123,7 +114,7 @@ EOM print $message; -#print "[$amount] [$name] [$email] [$object]\n"; +#print "[$amount] [$name] [$email] [$paypal_line]\n"; sub firstline { diff --git a/paypal_reply/paypal_functions b/paypal_reply/paypal_functions index 36e4762..ebfeb42 100755 --- a/paypal_reply/paypal_functions +++ b/paypal_reply/paypal_functions @@ -1,6 +1,6 @@ #!/bin/sh -# $Id: paypal_functions,v 1.10 2011/01/11 01:41:31 gilles Exp gilles $ +# $Id: paypal_functions,v 1.12 2011/02/02 22:32:26 gilles Exp gilles $ @@ -60,8 +60,8 @@ get_mail() { extract_mail() { - test -z "`ls $tmpdir/msg_in/`" && echo no mail && return mkdir -p $tmpdir/msg_out/ + test -z "`ls $tmpdir/msg_in/`" && echo no mail && return ( cd $tmpdir/msg_out/ test -z "`ls .`" || rm -rf *_d @@ -70,23 +70,10 @@ extract_mail() { #ls -d $tmpdir/msg_out/ } -extract_mail_test() { - test -z "`ls $tmpdir/msg_in/`" && echo no mail && return - mkdir -p $tmpdir/msg_out/ - ( - cd $tmpdir/msg_out/ - test -z "`ls .`" || rm -rf *_d - paypal_mimeexplode ../msg_in/* - ) - #ls -d $tmpdir/msg_out/ -} - - - convert_utf8() { - test -z "`ls $tmpdir/msg_out/`" && echo no mail && return mkdir -p $tmpdir/msg_out_utf8/ + test -z "`ls $tmpdir/msg_out/`" && echo no mail && return for f in $tmpdir/msg_out/*_d/*.txt; do b=`basename "$f"` d=`dirname "$f"` @@ -94,9 +81,15 @@ convert_utf8() { d_utf8="$tmpdir/msg_out_utf8/$bd" f_utf8="$d_utf8/$b" test -d "$d_utf8" && continue - echo converting "$f" to "$f_utf8" mkdir "$d_utf8" - 8859_utf8 "$f" > "$f_utf8" + if file "$f" | grep -i UTF-8 > /dev/null + then + echo copying "$f" to "$f_utf8" + cp "$f" "$f_utf8" + else + echo converting "$f" to "$f_utf8" + 8859_utf8 "$f" > "$f_utf8" + fi done } @@ -123,6 +116,20 @@ build_reply() { done } +build_reply_arg() { + for f in "$@"; do + #echo "$f" + d=`dirname "$f"` + bd=`basename "$d"` + file_id=`troncate_last_2_chars $bd` + d_reply="$tmpdir/msg_reply/$file_id" + test -f "$d_reply/$file_id.txt" && continue + mkdir -p "$d_reply" + echo building "$d_reply/$file_id.txt" + paypal_build_reply "$f" "$tmpdir/msg_id/$file_id" + done +} + send_reply() { mkdir -p $tmpdir/msg_sent/ @@ -134,8 +141,10 @@ send_reply() { test -f "$d_sent/$b" && continue mkdir -p "$d_sent" test X"--send" = X"$1" && paypal_send --send "$f" && touch "$d_sent/$b" + #test X"--send" = X"$1" && touch "$d_sent/$b" test X"" = X"$1" && paypal_send "$f" done + mailq } paypal_all() { diff --git a/test.bat b/test.bat index a48e41f..5f2fbdc 100755 --- a/test.bat +++ b/test.bat @@ -1,11 +1,11 @@ -REM $Id: test.bat,v 1.8 2011/01/15 06:30:33 gilles Exp gilles $ +REM $Id: test.bat,v 1.9 2011/02/21 02:14:35 gilles Exp gilles $ cd C:\msys\1.0\home\Admin\imapsync perl -mMail::IMAPClient -mDigest::MD5 -mTerm::ReadKey -mIO::Socket::SSL -mDate::Manip -mFile::Spec -mDigest::HMAC_MD5 -e '' perl ./imapsync -perl ./imapsync --host1 p --user1 tata --passfile1 secret.tata --host2 p --user2 titi --passfile2 secret.titi --noauthmd5 --delete2 --expunge2 -perl ./imapsync --host1 p --user1 tata --passfile1 secret.tata --host2 p --user2 titi --passfile2 secret.titi --noauthmd5 --delete2 --expunge2 --folder INBOX --nofoldersizes -perl ./imapsync --host1 p --user1 tata --passfile1 secret.tata --host2 p --user2 titi --passfile2 secret.titi --noauthmd5 --delete2 --expunge2 --folder INBOX --nofoldersizes --usecache +perl ./imapsync --host1 p --user1 tata --passfile1 secret.tata --host2 p --user2 titi --passfile2 secret.titi --delete2 --expunge2 +perl ./imapsync --host1 p --user1 tata --passfile1 secret.tata --host2 p --user2 titi --passfile2 secret.titi --delete2 --expunge2 --folder INBOX --nofoldersizes +perl ./imapsync --host1 p --user1 tata --passfile1 secret.tata --host2 p --user2 titi --passfile2 secret.titi --delete2 --expunge2 --folder INBOX --nofoldersizes --usecache diff --git a/test2.bat b/test2.bat new file mode 100755 index 0000000..63037d3 --- /dev/null +++ b/test2.bat @@ -0,0 +1,7 @@ + +REM $Id: test.bat,v 1.8 2011/01/15 06:30:33 gilles Exp gilles $ + +cd C:\msys\1.0\home\Admin\imapsync +REM perl ./imapsync --host1 p --user1 tata --passfile1 secret.tata --host2 p --user2 titi --passfile2 secret.titi --delete2 --expunge2 --folder INBOX +perl ./imapsync --host1 p --user1 tata --passfile1 secret.tata --host2 p --user2 titi --passfile2 secret.titi --delete2 --expunge1 --expunge2 --folder INBOX --usecache + diff --git a/tests.sh b/tests.sh index b3fa0d6..02891f0 100644 --- a/tests.sh +++ b/tests.sh @@ -1,6 +1,6 @@ #!/bin/sh -# $Id: tests.sh,v 1.143 2011/01/18 02:40:36 gilles Exp gilles $ +# $Id: tests.sh,v 1.149 2011/02/21 02:13:52 gilles Exp gilles $ # Example 1: # CMD_PERL='perl -I./Mail-IMAPClient-3.25/lib' sh -x tests.sh @@ -24,7 +24,7 @@ CMD_PERL=${CMD_PERL:-'perl -I./Mail-IMAPClient-2.2.9'} # few debugging tests use: CMD_PERL_2xx='perl -I./Mail-IMAPClient-2.2.9' -CMD_PERL_3xx='perl -I./Mail-IMAPClient-3.25/lib' +CMD_PERL_3xx='perl -I./Mail-IMAPClient-3.27/lib' #### Shell pragmas @@ -227,8 +227,6 @@ ll_timeout_ssl() { } - - ll_folder() { $CMD_PERL ./imapsync \ --host1 $HOST1 --user1 tata \ @@ -261,12 +259,12 @@ ll_folder_create() { ll_oneemail() { - $CMD_PERL ./imapsync \ - --host1 $HOST1 --user1 tata \ - --passfile1 ../../var/pass/secret.tata \ - --host2 $HOST2 --user2 titi \ - --passfile2 ../../var/pass/secret.titi \ - --folder INBOX.oneemail + $CMD_PERL ./imapsync \ + --host1 $HOST1 --user1 tata \ + --passfile1 ../../var/pass/secret.tata \ + --host2 $HOST2 --user2 titi \ + --passfile2 ../../var/pass/secret.titi \ + --folder INBOX.oneemail } ll_debugimap() { @@ -597,13 +595,24 @@ ll_maxage() ll_newmessage() { + can_send && sendtestmessage can_send && sendtestmessage $CMD_PERL ./imapsync \ --host1 $HOST1 --user1 tata \ --passfile1 ../../var/pass/secret.tata \ --host2 $HOST2 --user2 titi \ --passfile2 ../../var/pass/secret.titi \ - --maxage 1 --folder INBOX --nofoldersizes + --maxage 1 --folder INBOX --nofoldersizes --noreleasecheck +} + +ll_folder_INBOX() +{ + $CMD_PERL ./imapsync \ + --host1 $HOST1 --user1 tata \ + --passfile1 ../../var/pass/secret.tata \ + --host2 $HOST2 --user2 titi \ + --passfile2 ../../var/pass/secret.titi \ + --folder INBOX --noreleasecheck --usecache --delete2 --expunge2 } @@ -854,6 +863,7 @@ ll_useheader_noheader() } + ll_regexmess() { if can_send; then @@ -984,9 +994,9 @@ ll_tls_justlogin() { ll_tls_devel() { CMD_PERL='perl -I./Mail-IMAPClient-2.2.9' ll_justlogin ll_ssl_justlogin \ -&& CMD_PERL='perl -I./Mail-IMAPClient-3.25/lib' ll_justlogin ll_ssl_justlogin \ +&& CMD_PERL='perl -I./Mail-IMAPClient-3.27/lib' ll_justlogin ll_ssl_justlogin \ && CMD_PERL='perl -I./Mail-IMAPClient-2.2.9' ll_tls_justconnect ll_tls_justlogin \ -&& CMD_PERL='perl -I./Mail-IMAPClient-3.25/lib' ll_tls_justconnect ll_tls_justlogin +&& CMD_PERL='perl -I./Mail-IMAPClient-3.27/lib' ll_tls_justconnect ll_tls_justlogin } ll_tls() { @@ -1190,13 +1200,42 @@ msw2() { +xxxxx_gmail() { + + ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \ + --host2 imap.gmail.com \ + --ssl2 \ + --user2 gilles.lamiral@gmail.com \ + --passfile2 ../../var/pass/secret.gilles_gmail \ + --host1 $HOST2 \ + --user1 tata \ + --passfile1 ../../var/pass/secret.tata \ + --nofoldersizes \ + --justfolders --dry --prefix2 '[Gmail]/' +} + +gmail_xxxxx() { + + ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \ + --host1 imap.gmail.com \ + --ssl1 \ + --user1 gilles.lamiral@gmail.com \ + --passfile1 ../../var/pass/secret.gilles_gmail \ + --host2 $HOST2 \ + --user2 tata \ + --passfile2 ../../var/pass/secret.tata \ + --useheader 'Message-Id' \ + --useheader="X-Gmail-Received" \ + --nofoldersizes \ + --prefix1 '[Gmail]/' --dry --justfolders +} + gmail() { ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \ --host1 imap.gmail.com \ --ssl1 \ - --authmech1 LOGIN \ --user1 gilles.lamiral@gmail.com \ --passfile1 ../../var/pass/secret.gilles_gmail \ --host2 $HOST2 \ @@ -1221,7 +1260,6 @@ gmail_gmail() { --useheader 'Message-Id' --useheader="X-Gmail-Received" \ --regextrans2 's¤INBOX¤inbox_copy¤' \ --folder INBOX \ - --authmech1 LOGIN --authmech2 LOGIN \ --allowsizemismatch } @@ -1238,7 +1276,6 @@ gmail_gmail2() { --passfile2 ../../var/pass/secret.imapsync.gl_gmail \ --useheader 'Message-Id' --skipsize \ --folder INBOX \ - --authmech1 LOGIN --authmech2 LOGIN \ --allowsizemismatch #--dry # --debug --debugimap # --authmech1 LOGIN @@ -1255,7 +1292,7 @@ allow3xx() { } noallow3xx() { - ! perl -I./Mail-IMAPClient-3.25/lib ./imapsync \ + ! perl -I./Mail-IMAPClient-3.27/lib ./imapsync \ --host1 $HOST1 --user1 tata \ --passfile1 ../../var/pass/secret.tata \ --host2 $HOST2 --user2 titi \ @@ -1328,6 +1365,7 @@ ll_usecache() { --folder INBOX } + ll_nousecache() { if can_send; then sendtestmessage @@ -1344,6 +1382,97 @@ ll_nousecache() { --folder INBOX } +ll_useuid_usecache() +{ + if can_send; then + sendtestmessage + else + : + fi + $CMD_PERL ./imapsync \ + --host1 $HOST1 --user1 tata \ + --passfile1 ../../var/pass/secret.tata \ + --host2 $HOST2 --user2 titi \ + --passfile2 ../../var/pass/secret.titi \ + --folder INBOX \ + --delete2 --expunge2 \ + --useuid + echo 'rm /home/vmail/titi/.yop.yap/cur/*' +} + +ll_usecache_noheader() { + if can_send; then + sendtestmessage + else + : + fi + + $CMD_PERL ./imapsync \ + --host1 $HOST1 --user1 tata \ + --passfile1 ../../var/pass/secret.tata \ + --host2 $HOST2 --user2 titi \ + --passfile2 ../../var/pass/secret.titi \ + --usecache --nofoldersizes \ + --folder INBOX --useheader '' +} + +ll_usecache_debugcache() { + if can_send; then + sendtestmessage + else + : + fi + + $CMD_PERL ./imapsync \ + --host1 $HOST1 --user1 tata \ + --passfile1 ../../var/pass/secret.tata \ + --host2 $HOST2 --user2 titi \ + --passfile2 ../../var/pass/secret.titi \ + --usecache --nofoldersizes \ + --folder INBOX --useheader '' --debugcache +} + +ll_usecache_debugcache_useuid() { + if can_send; then + sendtestmessage + else + : + fi + + $CMD_PERL ./imapsync \ + --host1 $HOST1 --user1 tata \ + --passfile1 ../../var/pass/secret.tata \ + --host2 $HOST2 --user2 titi \ + --passfile2 ../../var/pass/secret.titi \ + --usecache --nofoldersizes \ + --folder INBOX --useheader '' --debugcache --useuid +} + + +ll_useuid() +{ + $CMD_PERL ./imapsync \ + --host1 $HOST1 --user1 tata \ + --passfile1 ../../var/pass/secret.tata \ + --host2 $HOST2 --user2 titi \ + --passfile2 ../../var/pass/secret.titi \ + --folder INBOX.useuid \ + --delete2 --expunge2 \ + --useuid + echo 'rm /home/vmail/titi/.yop.yap/cur/*' +} + +ll_useuid_nousecache() +{ + $CMD_PERL ./imapsync \ + --host1 $HOST1 --user1 tata \ + --passfile1 ../../var/pass/secret.tata \ + --host2 $HOST2 --user2 titi \ + --passfile2 ../../var/pass/secret.titi \ + --folder INBOX.useuid \ + --useuid --nousecache --debugcache + echo 'rm /home/vmail/titi/.yop.yap/cur/*' +} @@ -1351,6 +1480,54 @@ ll_nousecache() { # specific tests ########################## +exchange_1() { + $CMD_PERL ./imapsync \ + --host1 $HOST1 --user1 tata \ + --passfile1 ../../var/pass/secret.tata \ + --host2 mail.ethz.ch --ssl2 --user2 glamiral \ + --passfile2 ../../var/pass/secret.ethz.ch \ + --folder INBOX.oneemail --folder INBOX.few_emails --folder INBOX -maxage 1 +} + +jong_1() { +$CMD_PERL ./imapsync \ + --host1 mail.y-publicaties.nl --user1 gillesl --passfile1 ../../var/pass/secret.jong \ + --host2 $HOST2 --user2 titi --passfile2 ../../var/pass/secret.titi --sep1 / --prefix1 '' \ + --delete2 --expunge2 --folder INBOX --nofoldersizes +# --debugimap1 --dry +} + +jong_1_reverse() { +$CMD_PERL ./imapsync \ + --host2 mail.y-publicaties.nl --user2 gillesl --passfile2 ../../var/pass/secret.jong \ + --host1 $HOST2 --user1 gilles@est.belle --passfile1 ../../var/pass/secret.gilles_mbox \ + --sep2 / --prefix2 '' \ + --folder INBOX.Junk.2009 --delete2 --expunge2 --debug > zzz 2>&1 +#--nofoldersizes +# --debugimap1 --dry +} + +jong_1_lastuid() +{ + can_send && sendtestmessage + $CMD_PERL ./imapsync \ + --host1 $HOST1 --user1 tata \ + --passfile1 ../../var/pass/secret.tata \ + --host2 mail.y-publicaties.nl --user2 gillesl \ + --passfile2 ../../var/pass/secret.jong \ + --sep2 / --prefix2 '' \ + --folder INBOX --nofoldersizes --maxage 1 +} + + + +jong_2_delete() { +$CMD_PERL ./imapsync \ + --host1 mail.y-publicaties.nl --user1 gillesl --passfile1 ../../var/pass/secret.jong \ + --host2 $HOST2 --user2 titi --passfile2 ../../var/pass/secret.titi --sep1 / --prefix1 '' \ + --delete --folder INBOX +# --debugimap1 --dry +} gigamail_1() { $CMD_PERL ./imapsync \ @@ -1410,9 +1587,8 @@ big_transfert() --passfile1 ../../var/pass/secret.gilles_mbox \ --host2 $HOST2 --user2 tete@est.belle \ --passfile2 ../../var/pass/secret.tete \ - --noauthmd5 \ - --fast --folder INBOX.Junk \ - --useheader Message-ID --useheader Received || \ + --folder INBOX.Junk.2010 \ + --useheader Message-ID || \ true } date2=`date` @@ -1427,14 +1603,45 @@ big_transfert_sizes_only() --passfile1 ../../var/pass/secret.gilles_mbox \ --host2 $HOST2 --user2 tete@est.belle \ --passfile2 ../../var/pass/secret.tete \ - --noauthmd5 \ - --justfoldersizes --folder INBOX.Junk || \ + --justfoldersizes --folder INBOX.Junk.2010 || \ true } date2=`date` echo3 "[$date1] [$date2]" } +big_transfert_fast() +{ + date1=`date` + { $CMD_PERL ./imapsync \ + --host1 $HOST1 --user1 gilles@est.belle \ + --passfile1 ../../var/pass/secret.gilles_mbox \ + --host2 $HOST2 --user2 tete@est.belle \ + --passfile2 ../../var/pass/secret.tete \ + --folder INBOX.Junk.2010 \ + --fast || \ + true + } + date2=`date` + echo3 "[$date1] [$date2]" +} + +big_transfert_fast2() +{ + date1=`date` + { $CMD_PERL ./imapsync \ + --host1 $HOST1 --user1 gilles@est.belle \ + --passfile1 ../../var/pass/secret.gilles_mbox \ + --host2 $HOST2 --user2 tete@est.belle \ + --passfile2 ../../var/pass/secret.tete \ + --folder INBOX.Junk \ + --fast || \ + true + } + date2=`date` + echo3 "[$date1] [$date2]" + echo2 'rm -f /home/vmail/tete/.Junk/cur/*' +} dprof_justfoldersizes() @@ -1515,6 +1722,8 @@ locallocal pidfile justbanner nomodules_version +xxxxx_gmail +gmail_xxxxx gmail gmail_gmail gmail_gmail2 @@ -1577,11 +1786,15 @@ noallow3xx ll_memory_consumption ll_newmessage ll_usecache +ll_usecache_noheader +ll_usecache_debugcache ll_nousecache ll_delete2foldersonly ll_delete2foldersonly_tmp ll_delete2foldersbutnot ll_delete2folders +ll_useuid +ll_useuid_nousecache ' other_tests=' diff --git "a/tmp/cache/rr\\uee/142_242" "b/tmp/cache/rr\\uee/142_242" new file mode 100644 index 0000000..e69de29 diff --git "a/tmp/cache/rr\\uee/143_243" "b/tmp/cache/rr\\uee/143_243" new file mode 100644 index 0000000..e69de29 diff --git "a/tmp/cache/rr\\uee/177_777" "b/tmp/cache/rr\\uee/177_777" new file mode 100644 index 0000000..e69de29 diff --git "a/tmp/tests/\\y" "b/tmp/tests/\\y" new file mode 100644 index 0000000..e69de29 diff --git a/tmp/tests/lala b/tmp/tests/lala new file mode 100644 index 0000000..e69de29 diff --git a/tmp/tests/lili b/tmp/tests/lili new file mode 100644 index 0000000..e69de29 diff --git a/tmp/tests/lolo b/tmp/tests/lolo new file mode 100644 index 0000000..e69de29