Changeset 2e42098


Ignore:
Timestamp:
Feb 5, 2014, 3:04:26 AM (9 years ago)
Author:
David Benjamin <davidben@davidben.net>
Parents:
9ae6095 (diff), 0071c88 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merge 0071c88bc882ae44b235200e821626eb6e96230e into 9ae6095ed62f67742f9d4dc1008180e8d23e7b12
Files:
37 added
40 deleted
77 edited
1 moved

Legend:

Unmodified
Added
Removed
  • .gitignore

    rf93cc34 r7834bb5  
     1# Generated by autoreconf
     2Makefile.in
     3/aclocal.m4
     4/autom4te.cache/
     5/compile
     6/config.h.in
     7/config.h.in~
     8/configure
     9/depcomp
     10/install-sh
     11/missing
     12/test-driver
     13
     14# Generated by configure
     15Makefile
     16.deps/
     17/config.cache
     18/config.h
     19/config.log
     20/config.status
     21/stamp-h1
     22
     23# Generated by make
     24*.o
    125*.a
    2 *.o
    3 *.par
    4 *~
    5 .#*
    6 .*.swp
    7 .deps
    8 META.yml
    9 Makefile
    10 Makefile.in
    11 Makefile.old
     26/BUILD_VERSION.mk
     27/barnowl
     28/bin/
     29/gmarshal_funcs.c
     30/gmarshal_funcs.h
     31/owl_prototypes.h
     32/owl_prototypes.h.new
     33/perlglue.c
     34/varstubs.c
     35/version.c
     36/version.c.new
     37/zcrypt
     38
     39# Generated by make check
     40/runtests.sh.log
     41/runtests.sh.trs
     42/test-suite.log
     43/tester
     44
     45# Generated by make tags et al.
     46ID
    1247TAGS
    13 \#*#
    14 aclocal.m4
    15 autom4te.cache
    16 barnowl.bin
    17 tester.bin
    18 zcrypt
    19 blib
    20 config.cache
    21 config.h
    22 config.h.in
    23 config.log
    24 config.status
    25 configure
    26 core
    27 depcomp
    28 install-sh
    29 jabber.log
    30 missing
    31 owl_prototypes.h
    32 owl_prototypes.h.new
    33 perlglue.c
    34 perlwrap.c
    35 pm_to_blib
    36 stamp-h1
    37 varstubs.c
     48tags
     49/GPATH
     50/GRTAGS
     51/GSYMS
     52/GTAGS
     53/cscope.files
     54/cscope.in.out
     55/cscope.out
     56/cscope.po.out
  • AUTHORS

    r1d2c4c3 r80c0fc7  
    33
    44The following people have provided patches or other contributions:
     5  Alex Vandiver
     6  Kevin Chen
     7  Arun Tharuvai
    58  Sam Hartman
    6   Alex Vandiver
    7   Geoffrey Thomas
    89  Derrick Brashear
    910  David Glasser
     11  Eric Price
    1012  Matthew Goldstein
    11   Arun Tharuvai
    12   Kevin Chen
    13   Eric Price
     13  Geoffrey Thomas
     14  Anders Kaseorg
     15  Greg Price
     16  Chris Lesniewski-Laas
     17  Alex Dehnert
     18  Edward Z. Yang
     19  Karl Ramm
     20  Evan Broder
     21  David Benjamin
     22  Cathy Zhang
     23  Joshua Oreman
     24  Leonid Grinberg
     25  Kevin Riggle
     26  Brian Sniffen
     27  William Throwe
     28  Jason Gross
     29  Adam Glasgall
     30  Tim Hill
     31  DD Liu
     32  Betsy Riley
     33  Robert Jacobs
    1434
    15 BarnOwl is based on code from Owl, which was originally primarly
     35BarnOwl is based on code from Owl, which was originally primarily
    1636written by James Kretchmar.  Erik Nygren also made substantial
    17 contributions and improvemnts to the program.
     37contributions and improvements to the program.
    1838
    19 The following people provided patches and other techincal support for
     39The following people provided patches and other technical support for
    2040Owl:
    2141
     
    3050  Mark Eichin
    3151
    32 Mark Eichin is also maintaining the debian package of Owl.
     52Mark Eichin is also maintaining the Debian package of Owl.
    3353
    3454The following people helped with beta testing the earliest versions of
  • COPYING

    rb03c714 rccc182c  
    549549
    550550That's all there is to it!
     551
     552======================================================================
     553
     554Files under perl/modules/Facebook/lib/Facebook are copyright (c) 2010 Plain
     555Black Corporation.
     556
     557This software is copyright (c) 2010 by Plain Black Corporation.
     558
     559This is free software; you can redistribute it and/or modify it under
     560the same terms as the Perl 5 programming language system itself.
     561
     562Terms of the Perl programming language system itself
     563
     564a) the GNU General Public License as published by the Free
     565   Software Foundation; either version 1, or (at your option) any
     566   later version, or
     567b) the "Artistic License"
     568
     569--- The GNU General Public License, Version 1, February 1989 ---
     570
     571This software is Copyright (c) 2010 by Plain Black Corporation.
     572
     573This is free software, licensed under:
     574
     575  The GNU General Public License, Version 1, February 1989
     576
     577                    GNU GENERAL PUBLIC LICENSE
     578                     Version 1, February 1989
     579
     580 Copyright (C) 1989 Free Software Foundation, Inc.
     581                    51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     582
     583 Everyone is permitted to copy and distribute verbatim copies
     584 of this license document, but changing it is not allowed.
     585
     586                            Preamble
     587
     588  The license agreements of most software companies try to keep users
     589at the mercy of those companies.  By contrast, our General Public
     590License is intended to guarantee your freedom to share and change free
     591software--to make sure the software is free for all its users.  The
     592General Public License applies to the Free Software Foundation's
     593software and to any other program whose authors commit to using it.
     594You can use it for your programs, too.
     595
     596  When we speak of free software, we are referring to freedom, not
     597price.  Specifically, the General Public License is designed to make
     598sure that you have the freedom to give away or sell copies of free
     599software, that you receive source code or can get it if you want it,
     600that you can change the software or use pieces of it in new free
     601programs; and that you know you can do these things.
     602
     603  To protect your rights, we need to make restrictions that forbid
     604anyone to deny you these rights or to ask you to surrender the rights.
     605These restrictions translate to certain responsibilities for you if you
     606distribute copies of the software, or if you modify it.
     607
     608  For example, if you distribute copies of a such a program, whether
     609gratis or for a fee, you must give the recipients all the rights that
     610you have.  You must make sure that they, too, receive or can get the
     611source code.  And you must tell them their rights.
     612
     613  We protect your rights with two steps: (1) copyright the software, and
     614(2) offer you this license which gives you legal permission to copy,
     615distribute and/or modify the software.
     616
     617  Also, for each author's protection and ours, we want to make certain
     618that everyone understands that there is no warranty for this free
     619software.  If the software is modified by someone else and passed on, we
     620want its recipients to know that what they have is not the original, so
     621that any problems introduced by others will not reflect on the original
     622authors' reputations.
     623
     624  The precise terms and conditions for copying, distribution and
     625modification follow.
     626
     627                    GNU GENERAL PUBLIC LICENSE
     628   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
     629
     630  0. This License Agreement applies to any program or other work which
     631contains a notice placed by the copyright holder saying it may be
     632distributed under the terms of this General Public License.  The
     633"Program", below, refers to any such program or work, and a "work based
     634on the Program" means either the Program or any work containing the
     635Program or a portion of it, either verbatim or with modifications.  Each
     636licensee is addressed as "you".
     637
     638  1. You may copy and distribute verbatim copies of the Program's source
     639code as you receive it, in any medium, provided that you conspicuously and
     640appropriately publish on each copy an appropriate copyright notice and
     641disclaimer of warranty; keep intact all the notices that refer to this
     642General Public License and to the absence of any warranty; and give any
     643other recipients of the Program a copy of this General Public License
     644along with the Program.  You may charge a fee for the physical act of
     645transferring a copy.
     646
     647  2. You may modify your copy or copies of the Program or any portion of
     648it, and copy and distribute such modifications under the terms of Paragraph
     6491 above, provided that you also do the following:
     650
     651    a) cause the modified files to carry prominent notices stating that
     652    you changed the files and the date of any change; and
     653
     654    b) cause the whole of any work that you distribute or publish, that
     655    in whole or in part contains the Program or any part thereof, either
     656    with or without modifications, to be licensed at no charge to all
     657    third parties under the terms of this General Public License (except
     658    that you may choose to grant warranty protection to some or all
     659    third parties, at your option).
     660
     661    c) If the modified program normally reads commands interactively when
     662    run, you must cause it, when started running for such interactive use
     663    in the simplest and most usual way, to print or display an
     664    announcement including an appropriate copyright notice and a notice
     665    that there is no warranty (or else, saying that you provide a
     666    warranty) and that users may redistribute the program under these
     667    conditions, and telling the user how to view a copy of this General
     668    Public License.
     669
     670    d) You may charge a fee for the physical act of transferring a
     671    copy, and you may at your option offer warranty protection in
     672    exchange for a fee.
     673
     674Mere aggregation of another independent work with the Program (or its
     675derivative) on a volume of a storage or distribution medium does not bring
     676the other work under the scope of these terms.
     677
     678  3. You may copy and distribute the Program (or a portion or derivative of
     679it, under Paragraph 2) in object code or executable form under the terms of
     680Paragraphs 1 and 2 above provided that you also do one of the following:
     681
     682    a) accompany it with the complete corresponding machine-readable
     683    source code, which must be distributed under the terms of
     684    Paragraphs 1 and 2 above; or,
     685
     686    b) accompany it with a written offer, valid for at least three
     687    years, to give any third party free (except for a nominal charge
     688    for the cost of distribution) a complete machine-readable copy of the
     689    corresponding source code, to be distributed under the terms of
     690    Paragraphs 1 and 2 above; or,
     691
     692    c) accompany it with the information you received as to where the
     693    corresponding source code may be obtained.  (This alternative is
     694    allowed only for noncommercial distribution and only if you
     695    received the program in object code or executable form alone.)
     696
     697Source code for a work means the preferred form of the work for making
     698modifications to it.  For an executable file, complete source code means
     699all the source code for all modules it contains; but, as a special
     700exception, it need not include source code for modules which are standard
     701libraries that accompany the operating system on which the executable
     702file runs, or for standard header files or definitions files that
     703accompany that operating system.
     704
     705  4. You may not copy, modify, sublicense, distribute or transfer the
     706Program except as expressly provided under this General Public License.
     707Any attempt otherwise to copy, modify, sublicense, distribute or transfer
     708the Program is void, and will automatically terminate your rights to use
     709the Program under this License.  However, parties who have received
     710copies, or rights to use copies, from you under this General Public
     711License will not have their licenses terminated so long as such parties
     712remain in full compliance.
     713
     714  5. By copying, distributing or modifying the Program (or any work based
     715on the Program) you indicate your acceptance of this license to do so,
     716and all its terms and conditions.
     717
     718  6. Each time you redistribute the Program (or any work based on the
     719Program), the recipient automatically receives a license from the original
     720licensor to copy, distribute or modify the Program subject to these
     721terms and conditions.  You may not impose any further restrictions on the
     722recipients' exercise of the rights granted herein.
     723
     724  7. The Free Software Foundation may publish revised and/or new versions
     725of the General Public License from time to time.  Such new versions will
     726be similar in spirit to the present version, but may differ in detail to
     727address new problems or concerns.
     728
     729Each version is given a distinguishing version number.  If the Program
     730specifies a version number of the license which applies to it and "any
     731later version", you have the option of following the terms and conditions
     732either of that version or of any later version published by the Free
     733Software Foundation.  If the Program does not specify a version number of
     734the license, you may choose any version ever published by the Free Software
     735Foundation.
     736
     737  8. If you wish to incorporate parts of the Program into other free
     738programs whose distribution conditions are different, write to the author
     739to ask for permission.  For software which is copyrighted by the Free
     740Software Foundation, write to the Free Software Foundation; we sometimes
     741make exceptions for this.  Our decision will be guided by the two goals
     742of preserving the free status of all derivatives of our free software and
     743of promoting the sharing and reuse of software generally.
     744
     745                            NO WARRANTY
     746
     747  9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
     748FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
     749OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
     750PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
     751OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     752MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
     753TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
     754PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
     755REPAIR OR CORRECTION.
     756
     757  10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
     758WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
     759REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
     760INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
     761OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
     762TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
     763YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
     764PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
     765POSSIBILITY OF SUCH DAMAGES.
     766
     767                     END OF TERMS AND CONDITIONS
     768
     769        Appendix: How to Apply These Terms to Your New Programs
     770
     771  If you develop a new program, and you want it to be of the greatest
     772possible use to humanity, the best way to achieve this is to make it
     773free software which everyone can redistribute and change under these
     774terms.
     775
     776  To do so, attach the following notices to the program.  It is safest to
     777attach them to the start of each source file to most effectively convey
     778the exclusion of warranty; and each file should have at least the
     779"copyright" line and a pointer to where the full notice is found.
     780
     781    <one line to give the program's name and a brief idea of what it does.>
     782    Copyright (C) 19yy  <name of author>
     783
     784    This program is free software; you can redistribute it and/or modify
     785    it under the terms of the GNU General Public License as published by
     786    the Free Software Foundation; either version 1, or (at your option)
     787    any later version.
     788
     789    This program is distributed in the hope that it will be useful,
     790    but WITHOUT ANY WARRANTY; without even the implied warranty of
     791    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     792    GNU General Public License for more details.
     793
     794    You should have received a copy of the GNU General Public License
     795    along with this program; if not, write to the Free Software
     796    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA  02110-1301 USA
     797
     798
     799Also add information on how to contact you by electronic and paper mail.
     800
     801If the program is interactive, make it output a short notice like this
     802when it starts in an interactive mode:
     803
     804    Gnomovision version 69, Copyright (C) 19xx name of author
     805    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
     806    This is free software, and you are welcome to redistribute it
     807    under certain conditions; type `show c' for details.
     808
     809The hypothetical commands `show w' and `show c' should show the
     810appropriate parts of the General Public License.  Of course, the
     811commands you use may be called something other than `show w' and `show
     812c'; they could even be mouse-clicks or menu items--whatever suits your
     813program.
     814
     815You should also get your employer (if you work as a programmer) or your
     816school, if any, to sign a "copyright disclaimer" for the program, if
     817necessary.  Here a sample; alter the names:
     818
     819  Yoyodyne, Inc., hereby disclaims all copyright interest in the
     820  program `Gnomovision' (a program to direct compilers to make passes
     821  at assemblers) written by James Hacker.
     822
     823  <signature of Ty Coon>, 1 April 1989
     824  Ty Coon, President of Vice
     825
     826That's all there is to it!
     827
     828
     829--- The Artistic License 1.0 ---
     830
     831This software is Copyright (c) 2010 by Plain Black Corporation.
     832
     833This is free software, licensed under:
     834
     835  The Artistic License 1.0
     836
     837The Artistic License
     838
     839Preamble
     840
     841The intent of this document is to state the conditions under which a Package
     842may be copied, such that the Copyright Holder maintains some semblance of
     843artistic control over the development of the package, while giving the users of
     844the package the right to use and distribute the Package in a more-or-less
     845customary fashion, plus the right to make reasonable modifications.
     846
     847Definitions:
     848
     849  - "Package" refers to the collection of files distributed by the Copyright
     850    Holder, and derivatives of that collection of files created through
     851    textual modification.
     852  - "Standard Version" refers to such a Package if it has not been modified,
     853    or has been modified in accordance with the wishes of the Copyright
     854    Holder.
     855  - "Copyright Holder" is whoever is named in the copyright or copyrights for
     856    the package.
     857  - "You" is you, if you're thinking about copying or distributing this Package.
     858  - "Reasonable copying fee" is whatever you can justify on the basis of media
     859    cost, duplication charges, time of people involved, and so on. (You will
     860    not be required to justify it to the Copyright Holder, but only to the
     861    computing community at large as a market that must bear the fee.)
     862  - "Freely Available" means that no fee is charged for the item itself, though
     863    there may be fees involved in handling the item. It also means that
     864    recipients of the item may redistribute it under the same conditions they
     865    received it.
     866
     8671. You may make and give away verbatim copies of the source form of the
     868Standard Version of this Package without restriction, provided that you
     869duplicate all of the original copyright notices and associated disclaimers.
     870
     8712. You may apply bug fixes, portability fixes and other modifications derived
     872from the Public Domain or from the Copyright Holder. A Package modified in such
     873a way shall still be considered the Standard Version.
     874
     8753. You may otherwise modify your copy of this Package in any way, provided that
     876you insert a prominent notice in each changed file stating how and when you
     877changed that file, and provided that you do at least ONE of the following:
     878
     879  a) place your modifications in the Public Domain or otherwise make them
     880     Freely Available, such as by posting said modifications to Usenet or an
     881     equivalent medium, or placing the modifications on a major archive site
     882     such as ftp.uu.net, or by allowing the Copyright Holder to include your
     883     modifications in the Standard Version of the Package.
     884
     885  b) use the modified Package only within your corporation or organization.
     886
     887  c) rename any non-standard executables so the names do not conflict with
     888     standard executables, which must also be provided, and provide a separate
     889     manual page for each non-standard executable that clearly documents how it
     890     differs from the Standard Version.
     891
     892  d) make other distribution arrangements with the Copyright Holder.
     893
     8944. You may distribute the programs of this Package in object code or executable
     895form, provided that you do at least ONE of the following:
     896
     897  a) distribute a Standard Version of the executables and library files,
     898     together with instructions (in the manual page or equivalent) on where to
     899     get the Standard Version.
     900
     901  b) accompany the distribution with the machine-readable source of the Package
     902     with your modifications.
     903
     904  c) accompany any non-standard executables with their corresponding Standard
     905     Version executables, giving the non-standard executables non-standard
     906     names, and clearly documenting the differences in manual pages (or
     907     equivalent), together with instructions on where to get the Standard
     908     Version.
     909
     910  d) make other distribution arrangements with the Copyright Holder.
     911
     9125. You may charge a reasonable copying fee for any distribution of this
     913Package.  You may charge any fee you choose for support of this Package. You
     914may not charge a fee for this Package itself. However, you may distribute this
     915Package in aggregate with other (possibly commercial) programs as part of a
     916larger (possibly commercial) software distribution provided that you do not
     917advertise this Package as a product of your own.
     918
     9196. The scripts and library files supplied as input to or produced as output
     920from the programs of this Package do not automatically fall under the copyright
     921of this Package, but belong to whomever generated them, and may be sold
     922commercially, and may be aggregated with this Package.
     923
     9247. C or perl subroutines supplied by you and linked into this Package shall not
     925be considered part of this Package.
     926
     9278. The name of the Copyright Holder may not be used to endorse or promote
     928products derived from this software without specific prior written permission.
     929
     9309. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
     931WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
     932MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
     933
     934The End
  • ChangeLog

    r65ff3f4 r6f87658  
     11.9
     2 * Update Jabber module for Net::DNS changes -james2vegas@aim.com
     3 * Update and make configurable the Zephyr default format -adehnert@mit.edu
     4 * Fix a crash when zcrypt fails -andersk@mit.edu
     5 * Fix building with OpenSSL before 0.9.8 -andersk@mit.edu
     6 * Make :loadsubs reload instanced personals too -davidben@mit.edu
     7 * Make Perl zephyr_zwrite call die() when it fails -jgross@mit.edu
     8 * Tell gpg calls from zcrypt to ignore ~/.gnupg -andersk@mit.edu
     9 * Replace outgoing zephyr default format with a small URL -geofft@mit.edu
     10 * Add getnumlines() to perl interface -asedeno@mit.edu
     11 * Include names of invalid filters on filter errors -adehnert@mit.edu
     12 * Don't incorrectly mark decryption failures as decrypted -davidben@mit.edu
     13 * Hide the default cursor when possible -davidben@mit.edu
     14 * Complete viewperson and vp as viewuser and vu -davidben@mit.edu
     15 * Set z_charset = ZCHARSET_UTF_8 -andersk@mit.edu
     16 * Allow zsender spoofing on cross-realm classes -andersk@mit.edu
     17 * Append the realm to the zsender if missing -andersk@mit.edu
     18 * Redisplay on setting colorztext -jgross@mit.edu
     19 * Rename default config file to .owl/init.pl -kevinr@free-dissociation.com
     20 * Add completion for jabberlogout -adehnert@mit.edu
     21 * Switch to interactive context before sourcing the startup file -davidben@mit.edu
     22 * Add completion for reload-module -adehnert@mit.edu
     23 * editwin callback for canceling the editwin -jgross@mit.edu
     24 * Fix dirtying windows inside a redraw handler -davidben@mit.edu
     25 * Facebook module -ezyang@mit.edu
     26 * Complete unstartup command just like startup command -jgross@mit.edu
     27 * Fix the description of disable-ctrl-d -jgross@mit.edu
     28 * Use wbkgrndset instead of wbkgdset in _owl_fmtext_wcolor_set -davidben@mit.edu
     29 * Show the time zone in :info -jgross@mit.edu
     30 * Treat [!.?]" as end of sentence in edit:fill-paragraph -jgross@mit.edu
     31 * Correctly display multiline fields in :info -jgross@mit.edu
     32
     331.8.1
     34 * Only add outgoing messages for personal part of half-personal messages -andersk@mit.edu
     35 * Don’t write CC: line on zwrite -C '' -andersk@mit.edu
     36 * Don’t send public pings on zwrite '' or zwrite @REALM -andersk@mit.edu
     37 * Don’t treat zwrite '' as personal -andersk@mit.edu
     38 * Stop pretending to support zwrite * -andersk@mit.edu
     39 * Show foreign realms on non-personal zephyrs like Owl did -andersk@mit.edu
     40 * Fix memory leak in zcrypt -davidben@mit.edu
     41 * Don't attempt to switch filters in :view -d if invalid -davidben@mit.edu
     42 * Fixed typo in unbindkey usage error -rileyb@mit.edu
     43 * Fix bug generating filter text in 256-color mode -asedeno@mit.edu
     44 * Remove ^noc from reply-lockout -geofft@mit.edu
     45 * Avoid quadratic loops when receiving zephyrs -andersk@mit.edu
     46 * Fix hang on empty zcrypt messages -adehnert@MIT.EDU
     47
    1481.8
    249 * Compute the home directory in zcrypt consistently with BarnOwl -davidben@mit.edu
     
    282329 * Support --program-{prefix,suffix,transform}. -nelhage
    283330 * Send instanced pings and give useful error messages -adehnert
    284  * Add <message,*,%me%> to default Barnowl subs. -adehnert
     331 * Add <message,*,%me%> to default BarnOwl subs. -adehnert
    285332 * Maintain instance when using shift-R on personals -adehnert
    286333 * Improve handling of outgoing instanced personals -adehnert
  • Makefile.am

    rc266281 rca1fb26a  
    11ACLOCAL_AMFLAGS = -I m4
    22
    3 GIT_DESCRIPTION := $(if $(wildcard .git),$(shell git describe --match='barnowl-*' HEAD 2>/dev/null))
    4 GIT_FLAGS := $(if $(GIT_DESCRIPTION),-DGIT_VERSION=$(GIT_DESCRIPTION:barnowl-%=%))
     3GIT_DESCRIPTION := $(if $(wildcard $(srcdir)/.git),$(shell cd $(srcdir) && git describe --match='barnowl-*' HEAD 2>/dev/null))
     4VERSION = $(if $(GIT_DESCRIPTION),$(GIT_DESCRIPTION:barnowl-%=%),@VERSION@)
     5-include BUILD_VERSION.mk
    56
    6 bin_PROGRAMS = barnowl.bin
     7FORCE:
     8BUILD_VERSION.mk: $(if $(filter-out $(BUILD_VERSION),$(VERSION)),FORCE)
     9        echo 'BUILD_VERSION = $(VERSION)' > $@
     10
     11bin_PROGRAMS = bin/barnowl
    712if ENABLE_ZCRYPT
    813bin_PROGRAMS += zcrypt
    914endif
    1015
    11 zcrypt_SOURCES = zcrypt.c filterproc.c
     16zcrypt_SOURCES = zcrypt.c filterproc.c version.c
    1217
    13 check_PROGRAMS = tester.bin
     18check_PROGRAMS = bin/tester
     19dist_check_DATA = t
     20dist_check_SCRIPTS = runtests.sh
    1421
    15 barnowl_bin_SOURCES = $(BASE_SRCS) \
    16      owl.h owl_perl.h config.h \
    17      owl.c \
    18      $(GEN_C) $(GEN_H)
     22noinst_SCRIPTS = barnowl
     23check_SCRIPTS = tester
    1924
    20 man_MANS = doc/barnowl.1
    21 doc_DATA = doc/intro.txt doc/advanced.txt
     25barnowl tester: %: barnowl-wrapper.in bin/% Makefile
     26        sed \
     27            -e 's,[@]abs_srcdir[@],$(abs_srcdir),g' \
     28            -e 's,[@]abs_builddir[@],$(abs_builddir),g' \
     29            $< > $@
     30        chmod +x $@
    2231
    23 barnowl_bin_LDADD = compat/libcompat.a libfaim/libfaim.a
     32bin_barnowl_SOURCES = $(BASE_SRCS) \
     33     owl.h owl_perl.h \
     34     owl.c
     35nodist_bin_barnowl_SOURCES = $(GEN_C) $(GEN_H)
    2436
    25 tester_bin_SOURCES = $(BASE_SRCS) \
    26      owl.h owl_perl.h config.h \
    27      $(GEN_C) $(GEN_H) \
     37dist_man_MANS = doc/barnowl.1
     38dist_doc_DATA = doc/intro.txt doc/advanced.txt
     39
     40bin_barnowl_LDADD = compat/libcompat.a libfaim/libfaim.a
     41
     42bin_tester_SOURCES = $(BASE_SRCS) \
     43     owl.h owl_perl.h \
    2844     tester.c
     45nodist_bin_tester_SOURCES = $(GEN_C) $(GEN_H)
    2946
    30 tester_bin_LDADD = compat/libcompat.a libfaim/libfaim.a
     47bin_tester_LDADD = compat/libcompat.a libfaim/libfaim.a
    3148
    3249TESTS=runtests.sh
    3350
    34 AM_CPPFLAGS = -I$(top_srcdir)/ \
     51AM_CPPFLAGS = \
    3552           -I$(top_srcdir)/libfaim/ \
    3653           -DDATADIR='"$(pkgdatadir)"' \
    37            -DBINDIR='"$(bindir)"' \
    38            $(GIT_FLAGS)
     54           -DBINDIR='"$(bindir)"'
    3955
    4056CODELIST_SRCS=message.c mainwin.c popwin.c zephyr.c messagelist.c \
    41      commands.c global.c text.c fmtext.c editwin.c util.c logging.c \
     57     commands.c global.c text.c fmtext.c editwin.c \
     58     util.c logging.c \
    4259     perlconfig.c keys.c functions.c zwrite.c viewwin.c help.c filter.c \
    4360     regex.c history.c view.c dict.c variable.c filterelement.c pair.c \
     
    4562     aim.c buddy.c buddylist.c style.c errqueue.c \
    4663     zbuddylist.c popexec.c select.c wcwidth.c \
    47      mainpanel.c msgwin.c sepbar.c editcontext.c signal.c
     64     mainpanel.c msgwin.c sepbar.c editcontext.c signal.c closures.c
    4865
    49 NORMAL_SRCS = filterproc.c window.c windowcb.c
     66NORMAL_SRCS = filterproc.c filterproc.h window.c window.h windowcb.c
    5067
    5168BASE_SRCS = $(CODELIST_SRCS) $(NORMAL_SRCS)
    5269
    53 GEN_C = varstubs.c perlglue.c
    54 GEN_H = owl_prototypes.h
     70GEN_C = varstubs.c perlglue.c gmarshal_funcs.c version.c version.c.new
     71GEN_H = owl_prototypes.h owl_prototypes.h.new gmarshal_funcs.h
    5572
    56 BUILT_SOURCES = $(GEN_C) $(GEN_H)
     73BUILT_SOURCES = $(GEN_H)
    5774
    5875# Only copy file into place if file.new is different
    59 %: %.new
     76owl_prototypes.h version.c: %: %.new
    6077        @diff -U0 $@ $< || { \
    6178         test -f $@ && echo '$@ changed!'; \
     
    6582proto: owl_prototypes.h
    6683
    67 perlglue.c: perlglue.xs $(TYPEMAP)
    68         $(AM_V_GEN)perl $(XSUBPPDIR)/xsubpp $(XSUBPPFLAGS) -prototypes perlglue.xs > perlglue.c
     84perlglue.c: perlglue.xs typemap
     85        $(AM_V_GEN)perl $(XSUBPPDIR)/xsubpp $(XSUBPPFLAGS) -prototypes $< > $@
    6986
    7087varstubs.c: stubgen.pl variable.c
     
    7491        $(AM_V_GEN)perl $< $(sort $(filter-out $<,$+)) > $@
    7592
     93version.c.new: Makefile BUILD_VERSION.mk
     94        $(AM_V_GEN)echo 'const char *version = "$(VERSION)";' > $@
     95
     96gmarshal_funcs.h: marshal_types
     97        glib-genmarshal --header $< > $@
     98gmarshal_funcs.c: marshal_types
     99        glib-genmarshal --body $< > $@
     100
    76101# For emacs flymake-mode
    77102check-syntax: proto
    78103        $(COMPILE) -Wall -Wextra -pedantic -fsyntax-only $(CHK_SOURCES)
    79104
    80 install-data-local:
    81         $(mkinstalldirs) ${DESTDIR}${pkgdatadir}/lib
    82         (cd perl/lib && tar -cf - . ) | (cd ${DESTDIR}${pkgdatadir}/lib && tar -xf - )
    83 
    84 do_transform = $(shell echo '$(1)' | sed '$(transform)')
    85 install-exec-hook:
    86         mv -f $(DESTDIR)$(bindir)/$(call do_transform,barnowl.bin) \
    87               $(DESTDIR)$(bindir)/$(call do_transform,barnowl)
     105CLEANFILES = $(BUILT_SOURCES) $(GEN_C) $(noinst_SCRIPTS) $(check_SCRIPTS) BUILD_VERSION.mk
     106EXTRA_DIST = \
     107    autogen.sh \
     108    barnowl-wrapper.in \
     109    codelist.pl \
     110    doc/code.txt \
     111    doc/owl-window.txt \
     112    doc/releasing-barnowl.txt \
     113    examples \
     114    marshal_types \
     115    perlglue.xs \
     116    scripts \
     117    stubgen.pl \
     118    typemap
    88119
    89120SUBDIRS = compat libfaim perl
  • README

    rb711711 r1c22155  
    1010following CPAN modules:
    1111
     12Facebook::Graph
    1213Net::Jabber
    1314Net::XMPP
    1415XML::Stream
    1516
    16 They have been modified slightly for the needs of this project.
     17Some have been modified slightly for the needs of this project.
    1718
    1819BarnOwl currently requires the following perl modules off of CPAN:
     
    2021AnyEvent
    2122Class::Accessor
     23ExtUtils::Depends
    2224Glib
     25Module::Install
    2326PAR
    2427
     
    2629We plan to soon add targets to the Makefile to check for and install
    2730these for you.
     31
     32The Facebook module requires:
     33
     34Any::Moose
     35AnyEvent::HTTP
     36DateTime
     37DateTime::Format::Strptime
     38JSON
     39MIME::Base64::URLSafe
     40Ouch
     41URI
     42URI::Encode
    2843
    2944The IRC module requires:
     
    3651Authen::SASL::Perl
    3752IO::Socket::SSL
    38 Digest::SHA1
     53Digest::SHA
    3954
    4055The Twitter module requires:
  • aim.c

    rf271129 r7dcef03  
    707707{
    708708  aim_clientready(sess, fr->conn);
    709   owl_function_debugmsg("conninitdone_admin: initializtion done for admin connection");
     709  owl_function_debugmsg("conninitdone_admin: initialization done for admin connection");
    710710  return(1);
    711711}
     
    836836  params = va_arg(ap, struct aim_icbmparameters *);
    837837  va_end(ap);
    838  
    839   owl_function_debugmsg("faimtest_icbmparaminfo: ICBM Parameters: maxchannel = %d, default flags = 0x%08x, max msg len = %d, max sender evil = %f, max reciever evil = %f, min msg interval = %u",
     838
     839  owl_function_debugmsg("faimtest_icbmparaminfo: ICBM Parameters: maxchannel = %d, default flags = 0x%08x, max msg len = %d, max sender evil = %f, max receiver evil = %f, min msg interval = %u",
    840840                       params->maxchan, params->flags, params->maxmsglen, ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0, params->minmsginterval);
    841841     
     
    10491049  wrapmsg=owl_text_wordwrap(stripmsg, 70);
    10501050  nz_screenname=owl_aim_normalize_screenname(userinfo->sn);
    1051   m=g_new(owl_message, 1);
     1051  m=g_slice_new(owl_message);
    10521052  owl_message_create_aim(m,
    10531053                         nz_screenname,
  • barnowl-wrapper.in

    • Property mode changed from 100755 to 100644
    rf5f6ec0 ra223b6b  
    11#!/bin/sh
    22# This is a wrapper script to point BARNOWL_DATA_DIR at the source dir
    3 # if we're running from a build tree. barnowl.bin is the actual built
     3# if we're running from a build tree. bin/barnowl is the actual built
    44# binary.
    55
    6 SRCDIR=`dirname "${0}"`
    7 EXE="$0.bin"
     6EXE="@abs_builddir@/bin/$(basename "$0")"
    87
    98if test ! -x "$EXE"; then
     
    1211fi
    1312
    14 BARNOWL_DATA_DIR="$SRCDIR/perl/"
    15 BARNOWL_BIN_DIR="$SRCDIR/"
     13BARNOWL_DATA_DIR="@abs_srcdir@/perl"
     14BARNOWL_BIN_DIR="@abs_builddir@"
    1615export BARNOWL_DATA_DIR
    1716export BARNOWL_BIN_DIR
  • buddy.c

    rd4927a7 r7dcef03  
    7272{
    7373  owl_buddy_cleanup(b);
    74   g_free(b);
     74  g_slice_free(owl_buddy, b);
    7575}
  • buddylist.c

    r3cdd6d2 r7dcef03  
    1111{
    1212  owl_buddy *b;
    13   b=g_new(owl_buddy, 1);
     13  b=g_slice_new(owl_buddy);
    1414 
    1515  owl_buddy_create(b, OWL_PROTOCOL_AIM, screenname);
     
    5050
    5151    /* if not, create the login message */
    52     m=g_new(owl_message, 1);
     52    m=g_slice_new(owl_message);
    5353    owl_message_create_aim(m,
    5454                           screenname,
     
    6969
    7070  if (owl_buddylist_is_aim_buddy_loggedin(bl, screenname)) {
    71     m=g_new(owl_message, 1);
     71    m=g_slice_new(owl_message);
    7272    owl_message_create_aim(m,
    7373                           screenname,
  • cmd.c

    rf271129 r7dcef03  
    3535void owl_cmddict_add_alias(owl_cmddict *cd, const char *alias_from, const char *alias_to) {
    3636  owl_cmd *cmd;
    37   cmd = g_new(owl_cmd, 1);
     37  cmd = g_slice_new(owl_cmd);
    3838  owl_cmd_create_alias(cmd, alias_from, alias_to);
    3939  owl_perlconfig_new_command(cmd->name);
     
    4242
    4343int owl_cmddict_add_cmd(owl_cmddict *cd, const owl_cmd * cmd) {
    44   owl_cmd * newcmd = g_new(owl_cmd, 1);
     44  owl_cmd * newcmd = g_slice_new(owl_cmd);
    4545  if(owl_cmd_create_from_template(newcmd, cmd) < 0) {
    46     g_free(newcmd);
     46    g_slice_free(owl_cmd, newcmd);
    4747    return -1;
    4848  }
     
    141141{
    142142  owl_cmd_cleanup(cmd);
    143   g_free(cmd);
     143  g_slice_free(owl_cmd, cmd);
    144144}
    145145
  • commands.c

    rf271129 rca1fb26a  
    9696  OWLCMD_ARGS("unbindkey", owl_command_unbindkey, OWL_CTX_ANY,
    9797              "removes a binding in a keymap",
    98               "bindkey <keymap> <keyseq>",
     98              "unbindkey <keymap> <keyseq>",
    9999              "Removes a binding of a key sequence within a keymap.\n"
    100100              "Use 'show keymaps' to see the existing keymaps.\n"
     
    479479
    480480  OWLCMD_ARGS("away", owl_command_away, OWL_CTX_INTERACTIVE,
    481               "Set, enable or disable both AIM and zephyr away messages",
     481              "Set, enable or disable all away messages",
    482482              "away [ on | off | toggle ]\n"
    483483              "away <message>",
    484               "Turn on or off the AIM and zephyr away message.  If\n"
     484              "Turn on or off all away messages.  If\n"
    485485              "'message' is specified turn them on with that message,\n"
    486486              "otherwise use the default.\n"
    487               "\n"
    488               "This command really just runs the 'aaway' and 'zaway'\n"
    489               "commands together\n"
    490487              "\n"
    491488              "SEE ALSO: aaway, zaway"),
     
    10331030  OWLCMD_ARGS_CTX("popless:start-search", owl_viewwin_command_start_search, OWL_CTX_POPLESS,
    10341031                  "starts a command line to search for particular string",
    1035                   "popless:start-search [-r] [inital-value]",
     1032                  "popless:start-search [-r] [initial-value]",
    10361033                  "Initializes the command-line to search for initial-value. If\n"
    10371034                  "-r is used, the search will be performed backwards.\n\n"
     
    11171114void owl_command_version(void)
    11181115{
    1119   owl_function_makemsg("BarnOwl version %s", OWL_VERSION_STRING);
     1116  owl_function_makemsg("BarnOwl version %s", version);
    11201117}
    11211118
     
    15311528char *owl_command_away(int argc, const char *const *argv, const char *buff)
    15321529{
    1533   if ((argc==1) ||
    1534       ((argc==2) && !strcmp(argv[1], "on"))) {
     1530  bool away_off;
     1531  const char *message = NULL;
     1532
     1533  if (argc == 1 ||
     1534      (argc == 2 && !strcmp(argv[1], "on"))) {
     1535    away_off = false;
    15351536    owl_global_set_aaway_msg(&g, owl_global_get_aaway_msg_default(&g));
    15361537    owl_global_set_zaway_msg(&g, owl_global_get_zaway_msg_default(&g));
     1538  } else if (argc == 2 && !strcmp(argv[1], "off")) {
     1539    away_off = true;
     1540  } else if (argc == 2 && !strcmp(argv[1], "toggle")) {
     1541    away_off = owl_function_is_away();
     1542  } else {
     1543    away_off = false;
     1544    message = skiptokens(buff, 1);
     1545  }
     1546
     1547  if (away_off) {
     1548    owl_function_aaway_off();
     1549    owl_function_zaway_off();
     1550    owl_perlconfig_perl_call_norv("BarnOwl::Hooks::_away_off", 0, NULL);
     1551    owl_function_makemsg("Away messages off.");
     1552  } else if (message != NULL) {
     1553    owl_global_set_aaway_msg(&g, message);
     1554    owl_global_set_zaway_msg(&g, message);
    15371555    owl_function_aaway_on();
    15381556    owl_function_zaway_on();
     1557    owl_perlconfig_perl_call_norv("BarnOwl::Hooks::_away_on", 1, &message);
     1558    owl_function_makemsg("Away messages set (%s).", message);
     1559  } else {
     1560    owl_function_aaway_on();
     1561    owl_function_zaway_on();
     1562    owl_perlconfig_perl_call_norv("BarnOwl::Hooks::_away_on", 0, NULL);
    15391563    owl_function_makemsg("Away messages set.");
    1540     return NULL;
    1541   }
    1542 
    1543   if (argc==2 && !strcmp(argv[1], "off")) {
    1544     owl_function_aaway_off();
    1545     owl_function_zaway_off();
    1546     return NULL;
    1547   }
    1548 
    1549   if (argc==2 && !strcmp(argv[1], "toggle")) {
    1550     /* if either one is on, turn it off, otherwise toggle both (turn
    1551      *  them both on)
    1552      */
    1553     if (!owl_global_is_zaway(&g) && !owl_global_is_aaway(&g)) {
    1554       owl_function_aaway_toggle();
    1555       owl_function_zaway_toggle();
    1556       owl_function_makemsg("Away messages set.");
    1557     } else {
    1558       if (owl_global_is_zaway(&g)) owl_function_zaway_toggle();
    1559       if (owl_global_is_aaway(&g)) owl_function_aaway_toggle();
    1560       owl_function_makemsg("Away messages off.");
    1561     }
    1562     return NULL;
    1563   }
    1564 
    1565   buff = skiptokens(buff, 1);
    1566   owl_global_set_aaway_msg(&g, buff);
    1567   owl_global_set_zaway_msg(&g, buff);
    1568   owl_function_aaway_on();
    1569   owl_function_zaway_on();
    1570   owl_function_makemsg("Away messages set.");
     1564  }
     1565
    15711566  return NULL;
    15721567}
     
    16041599  if (v == NULL) {
    16051600    if (!silent) owl_function_error("Unknown variable '%s'", var);
    1606   } else if (requirebool && owl_variable_get_type(v) != OWL_VARIABLE_BOOL) {
     1601  } else if (requirebool && !v->takes_on_off) {
    16071602    if (!silent) owl_function_error("Variable '%s' is not a boolean", var);
    16081603  } else {
     
    16331628  if (v == NULL) {
    16341629    if (!silent) owl_function_error("Unknown variable '%s'", var);
    1635   } else if (owl_variable_get_type(v) != OWL_VARIABLE_BOOL) {
     1630  } else if (!v->takes_on_off) {
    16361631    if (!silent) owl_function_error("Variable '%s' is not a boolean", var);
    16371632  } else {
     
    17781773
    17791774  if (argc < 3) {
    1780     owl_function_makemsg("Usage: bindkey <keymap> <binding>");
     1775    owl_function_makemsg("Usage: unbindkey <keymap> <binding>");
    17811776    return NULL;
    17821777  }
     
    19851980  }
    19861981  /* check for a zwrite -m */
    1987   z = owl_zwrite_new(buff);
     1982  z = owl_zwrite_new(argc, argv);
    19881983  if (!z) {
    19891984    owl_function_error("Error in zwrite arguments");
     
    21902185    if (!strcmp(argv[0], "-f")) {
    21912186      if (argc<2) {
    2192         owl_function_makemsg("Too few argments to the view command");
     2187        owl_function_makemsg("Too few arguments to the view command");
    21932188        return(NULL);
    21942189      }
     
    22022197    } else if (!strcmp(argv[0], "-s")) {
    22032198      if (argc<2) {
    2204         owl_function_makemsg("Too few argments to the view command");
     2199        owl_function_makemsg("Too few arguments to the view command");
    22052200        return(NULL);
    22062201      }
     
    22092204      argv+=2;
    22102205    } else {
    2211       owl_function_makemsg("Too few argments to the view command");
     2206      owl_function_makemsg("Too few arguments to the view command");
    22122207      return(NULL);
    22132208    }
     
    27962791    owl_history_store(hist, owl_editwin_get_text(e), false);
    27972792
     2793  /* Take a reference to the editwin, so that it survives the pop
     2794   * context. TODO: We should perhaps refcount or otherwise protect
     2795   * the context so that, even if a command pops a context, the
     2796   * context itself will last until the command returns. */
     2797  owl_editwin_ref(e);
    27982798  owl_global_pop_context(&g);
     2799
     2800  owl_editwin_do_callback(e, false);
     2801  owl_editwin_unref(e);
    27992802}
    28002803
     
    28562859  owl_global_pop_context(&g);
    28572860
    2858   owl_editwin_do_callback(e);
     2861  owl_editwin_do_callback(e, true);
    28592862  owl_editwin_unref(e);
    28602863}
  • compat/Makefile.am

    r12a6616 rb80bae0  
    11noinst_LIBRARIES = libcompat.a
    22
    3 libcompat_a_SOURCES =
     3libcompat_a_SOURCES = compat.h
    44libcompat_a_LIBADD = $(LIBOBJS)
  • compat/compat.h

    r4dde585 r6249a88f  
    22#define INC_BARNOWL_COMPAT_COMPAT_H
    33
    4 #include "../config.h"
     4#include <config.h>
    55
    66#include <stddef.h>
  • configure.ac

    r883502d r77dfeb1  
    11dnl Process this file with autoconf to produce a configure script.
    2 AC_INIT([BarnOwl],[1.9dev],[bug-barnowl@mit.edu])
    3 AM_INIT_AUTOMAKE([1.7.0 -Wall -Wno-portability foreign])
     2AC_INIT([BarnOwl],[1.10dev],[bug-barnowl@mit.edu])
     3AM_INIT_AUTOMAKE([1.7.0 foreign std-options -Wall -Wno-portability])
     4AM_MAINTAINER_MODE([enable])
    45m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
    56
     
    910AC_PROG_CC
    1011AC_PROG_CC_C99
     12AC_PROG_LN_S
     13
     14AC_ARG_WITH([zephyr-default-format],
     15    [AS_HELP_STRING([--with-zephyr-default-format],
     16                    [value for the default format zephyrgram field])],
     17    [
     18        case $withval in
     19            yes) withval='Config error: see http://mit.edu/df';;
     20            no) withval='';;
     21        esac
     22        zephyr_default_format=$withval
     23    ],
     24    [zephyr_default_format='Config error: see http://mit.edu/df'])
     25AC_DEFINE_UNQUOTED(
     26    [ZEPHYR_DEFAULT_FORMAT], ["$zephyr_default_format"],
     27    [Value for the default format zephyrgram field]
     28)
    1129
    1230AC_ARG_WITH([stack-protector],
     
    4159
    4260AS_IF([test "x$with_zephyr" != xno],
    43   [AS_IF([test "x$with_krb4" != "xno"],
     61  [have_krb4=no
     62
     63   AS_IF([test "x$with_krb4" != "xno"],
    4464   [AC_MSG_CHECKING([for Kerberos IV])
    4565    AS_IF([krb5-config krb4 --libs >/dev/null 2>&1],
    4666      [AC_MSG_RESULT([yes])
     67       have_krb4=yes
    4768       AC_DEFINE([HAVE_KERBEROS_IV], [1], [Define if you have kerberos IV])
    4869       AM_CFLAGS="${AM_CFLAGS} `krb5-config krb4 --cflags`"
     
    5172      [AC_MSG_RESULT([no])
    5273       AS_IF([test "x$with_krb4" = "xyes"],
    53              [AC_MSG_ERROR([Kerberos IV requested but not found])])
    54        PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
    55        AM_CFLAGS="${AM_CFLAGS} ${LIBCRYPTO_CFLAGS}"
    56        LIBS="${LIBS} ${LIBCRYPTO_LIBS}"
    57      ])])
     74             [AC_MSG_ERROR([Kerberos IV requested but not found])])])])
     75
     76   AS_IF([test "x$have_krb4" != xyes],
     77     [PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto],
     78        [AM_CFLAGS="${AM_CFLAGS} ${LIBCRYPTO_CFLAGS}"
     79         LIBS="${LIBS} ${LIBCRYPTO_LIBS}"
     80        ],
     81        [PKG_CHECK_MODULES([OPENSSL], [openssl],
     82           [AM_CFLAGS="${AM_CFLAGS} ${OPENSSL_CFLAGS}"
     83            LIBS="${LIBS} ${OPENSSL_LIBS}"
     84           ])])])
     85
    5886   AC_CHECK_LIB([zephyr], [ZGetSender],
    5987   [LIBS="$LIBS -lzephyr"
     
    90118dnl Find the location of perl XSUBPP
    91119AC_MSG_CHECKING(for the perl xsubpp precompiler)
    92 XSUBPPDIR="`(perl -MExtUtils::MakeMaker -e 'print ExtUtils::MakeMaker->new({NAME => qw(owl)})->tool_xsubpp;') | grep \^XSUBPPDIR | sed -e 's/XSUBPPDIR = //g;'`"
     120XSUBPPDIR="`cd "$srcdir" && perl -MExtUtils::MakeMaker -e 'print ExtUtils::MakeMaker->new({NAME => qw(owl)})->tool_xsubpp;' | grep \^XSUBPPDIR | sed -e 's/XSUBPPDIR = //g;'`"
    93121if test -n "${XSUBPPDIR}"; then
    94122   AC_MSG_RESULT(${XSUBPPDIR})
     
    113141AX_PROG_PERL_MODULES([Class::Accessor::Fast],,
    114142                     [AC_MSG_ERROR([cannot find perl module Class::Accessor::Fast.])])
     143AX_PROG_PERL_MODULES([ExtUtils::Depends],,
     144                     [AC_MSG_ERROR([cannot find perl module ExtUtils::Depends])])
    115145AX_PROG_PERL_MODULES([Glib],,
    116146                     [AC_MSG_ERROR([cannot find perl module Glib.])])
     147AX_PROG_PERL_MODULES([Module::Install::Base],,
     148                     [AC_MSG_ERROR([cannot find perl module Module::Install::Base])])
    117149AX_PROG_PERL_MODULES([PAR],,
    118150                     [AC_MSG_WARN([PAR.pm not found. Loadable modules will be disabled.])])
     
    129161   prefix="${ac_default_prefix}"
    130162fi
     163
     164dnl Add CFLAGS for glib-perl
     165GLIB_PERL_CFLAGS=`perl -MExtUtils::Depends -e 'my $e = ExtUtils::Depends->new("BarnOwl","Glib"); my %h = $e->get_makefile_vars; print $h{"INC"}'`
     166AC_MSG_NOTICE([Adding glib-perl CFLAGS ${GLIB_PERL_CFLAGS}])
     167AM_CFLAGS="${GLIB_PERL_CFLAGS} ${AM_CFLAGS}"
    131168
    132169dnl Checks for typedefs, structures, and compiler characteristics.
     
    150187dnl Define __EXTENSIONS__ for strcasecmp on Solaris.
    151188AM_CFLAGS="$AM_CFLAGS -D__EXTENSIONS__"
     189dnl Define _XOPEN_SOURCE_EXTENDED for some features in ncurses,
     190dnl including cchar_t.  This should not be necessary with
     191dnl _XOPEN_SOURCE=600, but some versions of ncurses
     192dnl apparently still need it.
     193AM_CFLAGS="$AM_CFLAGS -D_XOPEN_SOURCE_EXTENDED"
    152194
    153195AC_SUBST([AM_CFLAGS])
     
    168210AC_REPLACE_FUNCS([memrchr])
    169211
     212AC_SUBST([abs_builddir])
     213AC_SUBST([abs_srcdir])
     214
    170215AC_CONFIG_FILES([Makefile compat/Makefile libfaim/Makefile perl/Makefile perl/modules/Makefile])
    171216AC_OUTPUT
  • context.c

    rf271129 r7dcef03  
    1010  if (!(mode & OWL_CTX_MODE_BITS))
    1111    mode |= OWL_CTX_INTERACTIVE;
    12   c = g_new0(owl_context, 1);
     12  c = g_slice_new0(owl_context);
    1313  c->mode = mode;
    1414  c->data = data;
     
    7171  if (ctx->delete_cb)
    7272    ctx->delete_cb(ctx);
    73   g_free(ctx);
     73  g_slice_free(owl_context, ctx);
    7474}
  • doc/barnowl.1

    rbad4496 r8135737  
    3535.TP
    3636\fB\-c\fP, \fB\-\-config\-file\fP=\fIFILE\fP
    37 Specify an alternate config file for \fBBarnOwl\fP to use.  By default,
    38 \fBBarnOwl\fP uses \fI~/.barnowlconf\fP if it exists, and \fI~/.owlconf\fP otherwise.
     37Specify an alternate config file for \fBBarnOwl\fP to use.  The config file is
     38an arbitrary Perl script evaluated in the \fImain\fP package, and if it
     39overrides the \fIBarnOwl::startup\fP method that is run when \fBBarnOwl\fP
     40starts.  (Compare \fI~/.owl/startup\fP, which contains \fBBarnOwl\fP commands
     41that are run at startup after the config file is loaded.)
     42
     43By default, \fBBarnOwl\fP uses the first of \fI~/.owl/init.pl\fP,
     44\fI~/.barnowlconf\fP, or \fI~/.owlconf\fP that exists.
    3945
    4046.TP
  • doc/releasing-barnowl.txt

    r5f08dbe rd995ff3  
    1616  - [ ] Do a locker build (See DOING A LOCKER BUILD)
    1717  - [ ] Update configure.ac on master to bump the version to 1.(N+1)dev
     18  - [ ] Add the barnowl-1.(N+1)dev git tag
    1819  - [ ] Push git git:
    1920   - [ ] The RC commit
    2021   - [ ] The configure.ac change on master
    2122   - [ ] A release-1.N branch pointing at the RC commit
     23   - [ ] the new git tags
     24  - [ ] Update debian/changelog on the launchpad build using `dch -v 1.(N+1)`
     25   - [ ] bzr branch lp:~barnowl/barnowl/packaging && cd packaging && dch -v 1.(N+1)
     26   - [ ] Add relevant changelog entries such as "New upstream release" or
     27         "Placeholder version number for daily builds."; fix your name and email
     28         if necessary
     29   - [ ] bzr commit && bzr push
    2230  - [ ] Copy tarball into /mit/barnowl/web_scripts/dist
    2331  - [ ] Send mail announcing the RC to barnowl-dev@mit.edu
     
    3139* DOING THE ACTUAL RELEASE
    3240  - [ ] Update the changelog and configure.ac for barnowl 1.N
     41  - [ ] Copy the changelog changes to the master branch
    3342  - [ ] run ./scripts/do-release
    3443  - [ ] Do the locker build
  • editwin.c

    rf271129 r7dcef03  
    3333  oe_excursion *excursions;
    3434
    35   void (*callback)(struct _owl_editwin*);
     35  void (*callback)(struct _owl_editwin *e, bool success);
    3636  void (*destroy_cbdata)(void *);
    3737  void *cbdata;
     
    6868static CALLER_OWN owl_editwin *owl_editwin_allocate(void)
    6969{
    70   owl_editwin *e = g_new0(owl_editwin, 1);
     70  owl_editwin *e = g_slice_new0(owl_editwin);
    7171  e->refcount = 1;
    7272  return e;
     
    8787  oe_destroy_cbdata(e);
    8888
    89   g_free(e);
     89  g_slice_free(owl_editwin, e);
    9090}
    9191
     
    220220}
    221221
    222 void owl_editwin_set_callback(owl_editwin *e, void (*cb)(owl_editwin*))
     222void owl_editwin_set_callback(owl_editwin *e, void (*cb)(owl_editwin *, bool))
    223223{
    224224  e->callback = cb;
    225225}
    226226
    227 void (*owl_editwin_get_callback(owl_editwin *e))(owl_editwin*)
     227void (*owl_editwin_get_callback(owl_editwin *e))(owl_editwin *, bool)
    228228{
    229229  return e->callback;
     
    248248}
    249249
    250 void owl_editwin_do_callback(owl_editwin *e) {
    251   void (*cb)(owl_editwin*);
    252   cb=owl_editwin_get_callback(e);
    253   if(!cb) {
     250void owl_editwin_do_callback(owl_editwin *e, bool success)
     251{
     252  void (*cb)(owl_editwin *, bool);
     253  cb = owl_editwin_get_callback(e);
     254  if (!cb) {
    254255    owl_function_error("Internal error: No editwin callback!");
    255256  } else {
    256     /* owl_function_error("text: |%s|", owl_editwin_get_text(e)); */
    257     cb(e);
     257    cb(e, success);
    258258  }
    259259}
     
    373373owl_editwin_excursion *owl_editwin_begin_excursion(owl_editwin *e)
    374374{
    375   owl_editwin_excursion *x = g_new(owl_editwin_excursion, 1);
     375  owl_editwin_excursion *x = g_slice_new(owl_editwin_excursion);
    376376  oe_save_excursion(e, x);
    377377  return x;
     
    381381{
    382382  oe_restore_excursion(e, x);
    383   g_free(x);
     383  g_slice_free(owl_editwin_excursion, x);
    384384}
    385385
     
    619619
    620620  if (!g_utf8_validate(s, -1, NULL)) {
    621     owl_function_debugmsg("owl_editwin_insert_string: received non-utf-8 string.");
     621    owl_function_debugmsg("owl_editwin_insert_string: received non-UTF-8 string.");
    622622    return 0;
    623623  }
  • filter.c

    rf271129 r7dcef03  
    1818  owl_filter *f;
    1919
    20   f = g_new(owl_filter, 1);
     20  f = g_slice_new(owl_filter);
    2121
    2222  f->name=g_strdup(name);
     
    6969  if(!argc) return NULL;
    7070
    71   fe = g_new(owl_filterelement, 1);
     71  fe = g_slice_new(owl_filterelement);
    7272  owl_filterelement_create(fe);
    7373
     
    114114err:
    115115  owl_filterelement_cleanup(fe);
    116   g_free(fe);
     116  g_slice_free(owl_filterelement, fe);
    117117  return NULL;
    118118}
     
    124124
    125125  op1 = owl_filter_parse_primitive_expression(argc-i, argv+i, &skip);
     126  if(!op1) goto err;
    126127  i += skip;
    127   if(!op1) goto err;
    128128
    129129  while(i < argc) {
     
    132132    op2 = owl_filter_parse_primitive_expression(argc-i-1, argv+i+1, &skip);
    133133    if(!op2) goto err;
    134     tmp = g_new(owl_filterelement, 1);
     134    tmp = g_slice_new(owl_filterelement);
    135135    if(!strcasecmp(argv[i], "and")) {
    136136      owl_filterelement_create_and(tmp, op1, op2);
     
    152152  if(op1) {
    153153    owl_filterelement_cleanup(op1);
    154     g_free(op1);
     154    g_slice_free(owl_filterelement, op1);
    155155  }
    156156  return NULL;
     
    219219    }
    220220    else {
    221       g_string_append_printf(out, "%i",f->fgcolor);
     221      g_string_append_printf(out, "%i",f->bgcolor);
    222222    }
    223223    g_string_append(out, " ");
     
    262262  if (f->root) {
    263263    owl_filterelement_cleanup(f->root);
    264     g_free(f->root);
     264    g_slice_free(owl_filterelement, f->root);
    265265  }
    266266  if (f->name)
    267267    g_free(f->name);
    268   g_free(f);
    269 }
     268  g_slice_free(owl_filter, f);
     269}
  • filterelement.c

    r7756dde r7dcef03  
    328328  if (fe->left) {
    329329    owl_filterelement_cleanup(fe->left);
    330     g_free(fe->left);
     330    g_slice_free(owl_filterelement, fe->left);
    331331  }
    332332  if (fe->right) {
    333333    owl_filterelement_cleanup(fe->right);
    334     g_free(fe->right);
     334    g_slice_free(owl_filterelement, fe->right);
    335335  }
    336336  owl_regex_cleanup(&(fe->re));
  • filterproc.c

    rf271129 r7155955  
    1 #include "owl.h"
     1#include "filterproc.h"
    22#include <sys/wait.h>
     3#include <fcntl.h>
     4#include <glib.h>
    35#include <poll.h>
     6#include <string.h>
     7#include <unistd.h>
    48
    5 int send_receive(int rfd, int wfd, const char *out, char **in)
     9/* Even in case of error, send_receive is responsible for closing wfd
     10 * (to EOF the child) and rfd (for consistency). */
     11static int send_receive(int rfd, int wfd, const char *out, char **in)
    612{
    713  GString *str = g_string_new("");
     
    1824  fds[1].fd = wfd;
    1925  fds[1].events = POLLOUT;
     26
     27  if(!out || !*out) {
     28    /* Nothing to write. Close our end so the child doesn't hang waiting. */
     29    close(wfd); wfd = -1;
     30    out = NULL;
     31  }
    2032
    2133  while(1) {
     
    4052      }
    4153      if(!out || !*out || fds[1].revents & (POLLERR | POLLHUP)) {
    42         close(wfd);
     54        close(wfd); wfd = -1;
    4355        out = NULL;
    4456      }
     
    5668  }
    5769
     70  if (wfd >= 0) close(wfd);
     71  close(rfd);
    5872  *in = g_string_free(str, err < 0);
    5973  return err;
    6074}
    6175
    62 int call_filter(const char *prog, const char *const *argv, const char *in, char **out, int *status)
     76int call_filter(const char *const *argv, const char *in, char **out, int *status)
    6377{
    64   int err = 0;
    65   pid_t pid;
    66   int rfd[2];
    67   int wfd[2];
     78  int err;
     79  GPid child_pid;
     80  int child_stdin, child_stdout;
    6881
    69   if((err = pipe(rfd))) goto out;
    70   if((err = pipe(wfd))) goto out_close_rfd;
    71 
    72   pid = fork();
    73   if(pid < 0) {
    74     err = pid;
    75     goto out_close_all;
    76   }
    77   if(pid) {
    78     /* parent */
    79     close(rfd[1]);
    80     close(wfd[0]);
    81     err = send_receive(rfd[0], wfd[1], in, out);
    82     if(err == 0) {
    83       waitpid(pid, status, 0);
    84     }
    85   } else {
    86     /* child */
    87     close(rfd[0]);
    88     close(wfd[1]);
    89     dup2(rfd[1], 1);
    90     dup2(wfd[0], 0);
    91     close(rfd[1]);
    92     close(wfd[0]);
    93 
    94     if(execvp(prog, (char *const *)argv)) {
    95       _exit(-1);
    96     }
     82  if (!g_spawn_async_with_pipes(NULL, (char**)argv, NULL,
     83                                G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
     84                                NULL, NULL,
     85                                &child_pid, &child_stdin, &child_stdout, NULL,
     86                                NULL)) {
     87    *out = NULL;
     88    return 1;
    9789  }
    9890
    99  out_close_all:
    100   close(wfd[0]);
    101   close(wfd[1]);
    102  out_close_rfd:
    103   close(rfd[0]);
    104   close(rfd[1]);
    105  out:
     91  err = send_receive(child_stdout, child_stdin, in, out);
     92  if (err == 0) {
     93    waitpid(child_pid, status, 0);
     94  }
    10695  return err;
    10796}
  • filterproc.h

    r06adc25 r97cdbaf5  
    22#define INC_BARNOWL_FILTER_PROC_H
    33
    4 int call_filter(const char *prog,
    5                 const char *const *argv,
     4int call_filter(const char *const *argv,
    65                const char *in,
    76                char **out, int *status);
  • functions.c

    r0071c88 r7dcef03  
    115115void owl_function_show_license(void)
    116116{
    117   const char *text;
    118 
    119   text=""
    120     "BarnOwl version " OWL_VERSION_STRING "\n"
     117  char *text = g_strdup_printf(
     118    "BarnOwl version %s\n"
    121119    "Copyright (c) 2006-2011 The BarnOwl Developers. All rights reserved.\n"
    122120    "Copyright (c) 2004 James Kretchmar. All rights reserved.\n"
     
    155153    "WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n"
    156154    "OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\n"
    157     "IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n";
     155    "IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n",
     156    version);
    158157  owl_function_popless_text(text);
     158  g_free(text);
    159159}
    160160
     
    196196  owl_message *m;
    197197
    198   m=g_new(owl_message, 1);
     198  m=g_slice_new(owl_message);
    199199  owl_message_create_admin(m, header, body);
    200200 
     
    204204
    205205  /* do followlast if necessary */
    206   if (owl_global_should_followlast(&g)) owl_function_lastmsg_noredisplay();
     206  if (owl_global_should_followlast(&g)) owl_function_lastmsg();
    207207
    208208  /* redisplay etc. */
     
    216216void owl_function_add_outgoing_zephyrs(const owl_zwrite *z)
    217217{
    218   if (z->cc || owl_zwrite_get_numrecips(z) == 0) {
     218  if (z->cc && owl_zwrite_is_personal(z)) {
    219219    /* create the message */
    220     owl_message *m = g_new(owl_message, 1);
     220    owl_message *m = g_slice_new(owl_message);
    221221    owl_message_create_from_zwrite(m, z, owl_zwrite_get_message(z), 0);
    222222
     
    225225    int i;
    226226    for (i = 0; i < owl_zwrite_get_numrecips(z); i++) {
     227      owl_message *m;
     228
     229      if (!owl_zwrite_recip_is_personal(owl_zwrite_get_recip_n(z, i)))
     230        continue;
     231
    227232      /* create the message */
    228       owl_message *m = g_new(owl_message, 1);
     233      m = g_slice_new(owl_message);
    229234      owl_message_create_from_zwrite(m, z, owl_zwrite_get_message(z), i);
    230235
     
    246251  if (!owl_global_is_aimloggedin(&g)) return(NULL);
    247252 
    248   m=g_new(owl_message, 1);
     253  m=g_slice_new(owl_message);
    249254  owl_message_create_aim(m,
    250255                         owl_global_get_aim_screenname(&g),
     
    265270
    266271  /* create the message */
    267   m=g_new(owl_message, 1);
     272  m=g_slice_new(owl_message);
    268273  owl_message_create_loopback(m, body);
    269274  owl_message_set_direction_out(m);
     
    272277}
    273278
    274 void owl_function_start_edit_win(const char *line, void (*callback)(owl_editwin *), void *data, void (*cleanup)(void *))
     279owl_editwin *owl_function_start_edit_win(const char *line)
    275280{
    276281  owl_editwin *e;
     
    286291  g_free(s);
    287292
    288   owl_editwin_set_cbdata(e, data, cleanup);
    289   owl_editwin_set_callback(e, callback);
    290293  ctx = owl_editcontext_new(OWL_CTX_EDITMULTI, e, "editmulti",
    291294                            owl_global_deactivate_editcontext, &g);
    292295  owl_global_push_context_obj(&g, ctx);
    293 
     296  return e;
    294297}
    295298
     
    309312void owl_function_zwrite_setup(owl_zwrite *z)
    310313{
     314  owl_editwin *e;
    311315  /* send a ping if necessary */
    312316  if (owl_global_is_txping(&g)) {
     
    316320
    317321  owl_function_write_setup("zephyr");
    318   owl_function_start_edit_win(z->zwriteline,
    319                               &owl_callback_zwrite,
    320                               z, (void(*)(void*))owl_zwrite_delete);
     322  e = owl_function_start_edit_win(z->zwriteline);
     323  owl_editwin_set_cbdata(e, z, (void (*)(void *))owl_zwrite_delete);
     324  owl_editwin_set_callback(e, &owl_callback_zwrite);
    321325}
    322326
    323327void owl_function_aimwrite_setup(const char *to)
    324328{
     329  owl_editwin *e;
    325330  /* TODO: We probably actually want an owl_aimwrite object like
    326331   * owl_zwrite. */
    327332  char *line = g_strdup_printf("aimwrite %s", to);
    328333  owl_function_write_setup("message");
    329   owl_function_start_edit_win(line,
    330                               &owl_callback_aimwrite,
    331                               g_strdup(to),
    332                               g_free);
     334  e = owl_function_start_edit_win(line);
     335  owl_editwin_set_cbdata(e, g_strdup(to), g_free);
     336  owl_editwin_set_callback(e, &owl_callback_aimwrite);
    333337  g_free(line);
    334338}
     
    336340void owl_function_loopwrite_setup(void)
    337341{
     342  owl_editwin *e;
    338343  owl_function_write_setup("message");
    339   owl_function_start_edit_win("loopwrite",
    340                               &owl_callback_loopwrite,
    341                               NULL, NULL);
    342 }
    343 
    344 void owl_callback_zwrite(owl_editwin *e) {
     344  e = owl_function_start_edit_win("loopwrite");
     345  owl_editwin_set_callback(e, &owl_callback_loopwrite);
     346}
     347
     348void owl_callback_zwrite(owl_editwin *e, bool success)
     349{
     350  if (!success) return;
    345351  owl_zwrite *z = owl_editwin_get_cbdata(e);
    346352  owl_function_zwrite(z, owl_editwin_get_text(e));
     
    372378  owl_function_makemsg("Waiting for ack...");
    373379
    374   /* If it's personal */
    375   if (owl_zwrite_is_personal(z)) {
    376     /* create the outgoing message */
    377     owl_function_add_outgoing_zephyrs(z);
    378   }
     380  /* create the outgoing message */
     381  owl_function_add_outgoing_zephyrs(z);
    379382}
    380383#else
     
    402405
    403406  zcrypt = g_build_filename(owl_get_bindir(), "zcrypt", NULL);
    404   argv[0] = "zcrypt";
     407  argv[0] = zcrypt;
    405408  argv[1] = "-E";
    406409  argv[2] = "-c"; argv[3] = owl_zwrite_get_class(z);
     
    408411  argv[6] = NULL;
    409412
    410   rv = call_filter(zcrypt, argv, owl_zwrite_get_message(z), &cryptmsg, &status);
     413  rv = call_filter(argv, owl_zwrite_get_message(z), &cryptmsg, &status);
    411414
    412415  g_free(zcrypt);
     
    426429  owl_function_makemsg("Waiting for ack...");
    427430
    428   /* If it's personal */
    429   if (owl_zwrite_is_personal(z)) {
    430     /* Create the outgoing message. Restore the un-crypted message for display. */
    431     owl_zwrite_set_message_raw(z, old_msg);
    432     owl_function_add_outgoing_zephyrs(z);
    433   }
    434 
    435   /* free the zwrite */
     431  /* Create the outgoing message. Restore the un-crypted message for display. */
     432  owl_zwrite_set_message_raw(z, old_msg);
     433  owl_function_add_outgoing_zephyrs(z);
     434
     435  /* Clean up. */
    436436  g_free(cryptmsg);
    437 }
    438 
    439 void owl_callback_aimwrite(owl_editwin *e) {
     437  g_free(old_msg);
     438}
     439
     440void owl_callback_aimwrite(owl_editwin *e, bool success)
     441{
     442  if (!success) return;
    440443  char *to = owl_editwin_get_cbdata(e);
    441444  owl_function_aimwrite(to, owl_editwin_get_text(e), true);
     
    501504}
    502505
    503 void owl_callback_loopwrite(owl_editwin *e) {
     506void owl_callback_loopwrite(owl_editwin *e, bool success)
     507{
     508  if (!success) return;
    504509  owl_function_loopwrite(owl_editwin_get_text(e));
    505510}
     
    511516  /* create a message and put it on the message queue.  This simulates
    512517   * an incoming message */
    513   min=g_new(owl_message, 1);
     518  min=g_slice_new(owl_message);
    514519  mout=owl_function_make_outgoing_loopback(msg);
    515520
     
    808813}
    809814
    810 void owl_function_lastmsg_noredisplay(void)
     815void owl_function_lastmsg(void)
    811816{
    812817  int oldcurmsg, curmsg;
     
    826831    owl_global_set_curmsg(&g, curmsg+1);
    827832  }
    828   /* owl_mainwin_redisplay(owl_global_get_mainwin(&g)); */
     833  owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    829834  owl_global_set_direction_downwards(&g);
    830 }
    831 
    832 void owl_function_lastmsg(void)
    833 {
    834   owl_function_lastmsg_noredisplay();
    835   owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 
    836835}
    837836
     
    856855void owl_function_unsuball(void)
    857856{
    858   unsuball();
    859   owl_function_makemsg("Unsubscribed from all messages.");
     857  if (unsuball())
     858    owl_function_makemsg("Unsubscribed from all messages.");
    860859}
    861860
     
    872871void owl_function_loadsubs(const char *file)
    873872{
    874   int ret, ret2;
    875   const char *foo;
     873  int ret, ret2, ret3;
    876874  char *path;
    877875
     
    885883
    886884  /* for backwards compatibility for now */
    887   ret2=owl_zephyr_loaddefaultsubs();
     885  ret2 = owl_zephyr_loaddefaultsubs();
     886  ret3 = owl_zephyr_loadbarnowldefaultsubs();
    888887
    889888  if (!owl_context_is_interactive(owl_global_get_context(&g))) return;
    890889
    891   foo=file?file:"file";
    892   if (ret==0 && ret2==0) {
     890  if (ret == 0 && ret2 == 0 && ret3 == 0) {
    893891    if (!file) {
    894892      owl_function_makemsg("Subscribed to messages.");
     
    896894      owl_function_makemsg("Subscribed to messages from %s", file);
    897895    }
    898   } else if (ret==-1) {
    899     owl_function_error("Could not read %s", foo);
    900   } else {
     896  } else if (ret == -1) {
     897    owl_function_error("Could not read %s", file ? file : "file");
     898  } else if (ret2 == -1) {
    901899    owl_function_error("Error subscribing to messages");
     900  } else {
     901    owl_function_error("Error subscribing to instanced personals");
    902902  }
    903903}
     
    918918}
    919919
    920 void owl_callback_aimlogin(owl_editwin *e) {
     920void owl_callback_aimlogin(owl_editwin *e, bool success)
     921{
     922  if (!success) return;
    921923  char *user = owl_editwin_get_cbdata(e);
    922924  owl_function_aimlogin(user,
     
    989991  /* owl_aim_set_awaymsg(""); */
    990992  owl_function_makemsg("AIM away off");
     993}
     994
     995bool owl_function_is_away(void)
     996{
     997  return owl_global_is_zaway(&g) ||
     998         owl_global_is_aaway(&g) ||
     999         owl_perlconfig_perl_call_bool("BarnOwl::Hooks::_get_is_away", 0, NULL);
    9911000}
    9921001
     
    13501359void owl_function_about(void)
    13511360{
    1352   owl_function_popless_text(
    1353     "This is BarnOwl version " OWL_VERSION_STRING ".\n\n"
     1361  char *text = g_strdup_printf(
     1362    "This is BarnOwl version %s.\n\n"
    13541363    "BarnOwl is a fork of the Owl zephyr client, written and\n"
    13551364    "maintained by Alejandro Sedeno and Nelson Elhage at the\n"
     
    13701379    "This program is free software. You can redistribute it and/or\n"
    13711380    "modify under the terms of the Sleepycat License. Use the \n"
    1372     "':show license' command to display the full license\n"
    1373   );
     1381      "':show license' command to display the full license\n",
     1382      version);
     1383  owl_function_popless_text(text);
     1384  g_free(text);
    13741385}
    13751386
     
    14301441      char *tmpbuff, *tmpbuff2;
    14311442      int i, fields;
     1443      const char *f;
    14321444
    14331445      if (!owl_message_is_pseudo(m)) {
     
    14601472        owl_fmtext_append_normal(&fm, "\n");
    14611473        owl_fmtext_appendf_normal(&fm, "  Port      : %i\n", ntohs(n->z_port));
     1474        owl_fmtext_appendf_normal(&fm, "  Charset   : %s\n", owl_zephyr_get_charsetstr(n));
    14621475        owl_fmtext_appendf_normal(&fm, "  Auth      : %s\n", owl_zephyr_get_authstr(n));
    14631476
     
    14711484        owl_fmtext_appendf_normal(&fm, "  Fields    : %i\n", fields);
    14721485
    1473         for (i = 0; i < fields; i++) {
    1474           tmpbuff = owl_zephyr_get_field_as_utf8(n, i + 1);
     1486        for (i = 0, f = owl_zephyr_first_raw_field(n); f != NULL;
     1487             i++, f = owl_zephyr_next_raw_field(n, f)) {
     1488          tmpbuff = owl_zephyr_field_as_utf8(n, f);
    14751489          tmpbuff2 = owl_text_indent(tmpbuff, 14, false);
    14761490          owl_fmtext_appendf_normal(&fm, "  Field %i   : %s\n", i + 1, tmpbuff2);
     
    17701784
    17711785  owl_fmtext_append_normal(&fm, "  Version: ");
    1772   owl_fmtext_append_normal(&fm, OWL_VERSION_STRING);
     1786  owl_fmtext_append_normal(&fm, version);
    17731787  owl_fmtext_append_normal(&fm, "\n");
    17741788
     
    19401954}
    19411955
    1942 void owl_callback_command(owl_editwin *e)
    1943 {
     1956void owl_callback_command(owl_editwin *e, bool success)
     1957{
     1958  if (!success) return;
    19441959  char *rv;
    19451960  const char *line = owl_editwin_get_text(e);
     
    19521967}
    19531968
    1954 void owl_function_start_command(const char *line)
     1969owl_editwin *owl_function_start_command(const char *line)
    19551970{
    19561971  owl_editwin *tw;
     
    19671982  owl_global_push_context_obj(&g, ctx);
    19681983  owl_editwin_set_callback(tw, owl_callback_command);
    1969 }
    1970 
    1971 CALLER_OWN owl_editwin *owl_function_start_question(const char *line)
     1984  return tw;
     1985}
     1986
     1987owl_editwin *owl_function_start_question(const char *line)
    19721988{
    19731989  owl_editwin *tw;
     
    19842000}
    19852001
    1986 CALLER_OWN owl_editwin *owl_function_start_password(const char *line)
     2002owl_editwin *owl_function_start_password(const char *line)
    19872003{
    19882004  owl_editwin *tw;
     
    21812197  f = owl_filter_new(argv[1], argc-2, argv+2);
    21822198  if (f == NULL) {
    2183     owl_function_error("Invalid filter");
     2199    owl_function_error("Invalid filter: %s", argv[1]);
    21842200    return false;
    21852201  }
     
    34663482  while (zaldptr) {
    34673483    ZFreeALD(zaldptr->data);
    3468     g_free(zaldptr->data);
     3484    g_slice_free(ZAsyncLocateData_t, zaldptr->data);
    34693485    zaldptr = g_list_next(zaldptr);
    34703486  }
     
    34763492    for (i = 0; i < anyone->len; i++) {
    34773493      user = anyone->pdata[i];
    3478       zald = g_new(ZAsyncLocateData_t, 1);
     3494      zald = g_slice_new(ZAsyncLocateData_t);
    34793495      if (ZRequestLocations(zstr(user), zald, UNACKED, ZAUTH) == ZERR_NONE) {
    34803496        *zaldlist = g_list_append(*zaldlist, zald);
    34813497      } else {
    3482         g_free(zald);
     3498        g_slice_free(ZAsyncLocateData_t, zald);
    34833499      }
    34843500    }
  • global.c

    r9078f69 r7dcef03  
    99  const char *homedir;
    1010
     11#if !GLIB_CHECK_VERSION(2, 35, 0)
    1112  g_type_init();
     13#endif
     14#if !GLIB_CHECK_VERSION(2, 31, 0)
    1215  g_thread_init(NULL);
     16#endif
    1317
    1418  owl_select_init();
     
    5256  g->starttime=time(NULL); /* assumes we call init only a start time */
    5357  g->lastinputtime=g->starttime;
     58  g->last_wakeup_time = g->starttime;
    5459  g->newmsgproc_pid=0;
    5560 
     
    7580  g_free(cd);
    7681
    77   owl_messagelist_create(&(g->msglist));
     82  g->msglist = owl_messagelist_new();
    7883
    7984  _owl_global_init_windows(g);
     
    100105
    101106  g->interrupt_count = 0;
     107#if GLIB_CHECK_VERSION(2, 31, 0)
     108  g_mutex_init(&g->interrupt_lock);
     109#else
    102110  g->interrupt_lock = g_mutex_new();
     111#endif
    103112}
    104113
     
    109118
    110119  /* Create the widgets */
    111   owl_mainwin_init(&(g->mw), g->mainpanel.recwin);
     120  g->mw = owl_mainwin_new(g->mainpanel.recwin);
    112121  owl_msgwin_init(&(g->msgwin), g->mainpanel.msgwin);
    113122  owl_sepbar_init(g->mainpanel.sepwin);
     
    241250/* windows */
    242251
    243 owl_mainwin *owl_global_get_mainwin(owl_global *g) {
    244   return(&(g->mw));
     252owl_mainwin *owl_global_get_mainwin(owl_global *g)
     253{
     254  return g->mw;
    245255}
    246256
     
    256266
    257267owl_messagelist *owl_global_get_msglist(owl_global *g) {
    258   return(&(g->msglist));
     268  return g->msglist;
    259269}
    260270
     
    475485}
    476486
     487void owl_global_wakeup(owl_global *g)
     488{
     489  if (time(NULL) - g->last_wakeup_time >= 1) {
     490    g_free(owl_perlconfig_execute("BarnOwl::Hooks::_wakeup()"));
     491    g->last_wakeup_time = time(NULL);
     492  }
     493}
     494
    477495/* viewwin */
    478496
     
    535553  e->g->filterlist = g_list_remove(e->g->filterlist, e->f);
    536554  owl_filter_delete(e->f);
    537   g_free(e);
     555  g_slice_free(owl_global_filter_ent, e);
    538556}
    539557
    540558void owl_global_add_filter(owl_global *g, owl_filter *f) {
    541   owl_global_filter_ent *e = g_new(owl_global_filter_ent, 1);
     559  owl_global_filter_ent *e = g_slice_new(owl_global_filter_ent);
    542560  e->g = g;
    543561  e->f = f;
     
    840858  } filters[] = {
    841859    { "personal",
    842       "isprivate ^true$ and ( not type ^zephyr$ or ( class ^message  ) )" },
     860      "isprivate ^true$ and ( not type ^zephyr$ or ( class ^message$ ) )" },
    843861    { "trash",
    844862      "class ^mail$ or opcode ^ping$ or type ^admin$ or ( not login ^none$ )" },
     
    847865    { "auto", "opcode ^auto$" },
    848866    { "login", "not login ^none$" },
    849     { "reply-lockout", "class ^mail$" },
     867    { "reply-lockout", "class ^mail$ or class ^filsrv$" },
    850868    { "out", "direction ^out$" },
    851869    { "aim", "type ^aim$" },
     
    898916}
    899917
     918static GMutex *owl_global_get_interrupt_lock(owl_global *g)
     919{
     920#if GLIB_CHECK_VERSION(2, 31, 0)
     921  return &g->interrupt_lock;
     922#else
     923  return g->interrupt_lock;
     924#endif
     925}
     926
    900927void owl_global_add_interrupt(owl_global *g) {
    901928  /* TODO: This can almost certainly be done with atomic
    902929   * operations. Whatever. */
    903   g_mutex_lock(g->interrupt_lock);
     930  g_mutex_lock(owl_global_get_interrupt_lock(g));
    904931  g->interrupt_count++;
    905   g_mutex_unlock(g->interrupt_lock);
     932  g_mutex_unlock(owl_global_get_interrupt_lock(g));
    906933}
    907934
    908935bool owl_global_take_interrupt(owl_global *g) {
    909936  bool ans = false;
    910   g_mutex_lock(g->interrupt_lock);
     937  g_mutex_lock(owl_global_get_interrupt_lock(g));
    911938  if (g->interrupt_count > 0) {
    912939    ans = true;
    913940    g->interrupt_count--;
    914941  }
    915   g_mutex_unlock(g->interrupt_lock);
     942  g_mutex_unlock(owl_global_get_interrupt_lock(g));
    916943  return ans;
    917944}
  • help.c

    rf271129 r8258ea5  
    7373     "    : , M-x       Enter command mode\n"
    7474     "\n"
    75      "    /             Foward search\n"
     75     "    /             Forward search\n"
    7676     "    ?             Reverse search\n"
    7777     "\n\n"
     
    107107     "    unsuball      Unsubscribe from all zephyr classes\n"
    108108     "    load-subs     Load zephyr subscriptions from a file\n"
    109      "    zpunt         Supress messages from a zephyr triplet\n"
     109     "    zpunt         Suppress messages from a zephyr triplet\n"
    110110     "    zlog          Send a login or logout notification\n"
    111111     "    zlist         Print a list of zephyr buddies logged in\n"
  • keybinding.c

    rf271129 r7dcef03  
    1414CALLER_OWN owl_keybinding *owl_keybinding_new(const char *keyseq, const char *command, void (*function_fn)(void), const char *desc)
    1515{
    16   owl_keybinding *kb = g_new(owl_keybinding, 1);
     16  owl_keybinding *kb = g_slice_new(owl_keybinding);
    1717
    1818  owl_function_debugmsg("owl_keybinding_init: creating binding for <%s> with desc: <%s>", keyseq, desc);
    1919  if (command && function_fn) {
    20     g_free(kb);
     20    g_slice_free(owl_keybinding, kb);
    2121    return NULL;
    2222  } else if (command && !function_fn) {
     
    2929
    3030  if (owl_keybinding_make_keys(kb, keyseq) != 0) {
    31     g_free(kb);
     31    g_slice_free(owl_keybinding, kb);
    3232    return NULL;
    3333  }
     
    7070  g_free(kb->desc);
    7171  g_free(kb->command);
    72   g_free(kb);
     72  g_slice_free(owl_keybinding, kb);
    7373}
    7474
  • keymap.c

    rf271129 r7dcef03  
    189189{
    190190  owl_keymap *km;
    191   km = g_new(owl_keymap, 1);
     191  km = g_slice_new(owl_keymap);
    192192  owl_keymap_init(km, name, desc, default_fn, prealways_fn, postalways_fn);
    193193  owl_keyhandler_add_keymap(kh, km);
  • libfaim/Makefile.am

    r215c119 rb80bae0  
    1313libfaim_a_CPPFLAGS = -DAIM_BUILDDATE=\"x\" -DAIM_BUILDTIME=\"x\" \
    1414                     -I${top_srcdir}/libfaim
     15
     16EXTRA_DIST = oscar.c
  • logging.c

    rf271129 r7dcef03  
    177177    g_free(msg->message);
    178178    g_free(msg->filename);
    179     g_free(msg);
     179    g_slice_free(owl_log_entry, msg);
    180180  }
    181181}
     
    184184{
    185185  owl_log_entry *log_msg = NULL;
    186   log_msg = g_new(owl_log_entry,1);
     186  log_msg = g_slice_new(owl_log_entry);
    187187  log_msg->message = g_strdup(buffer);
    188188  log_msg->filename = g_strdup(filename);
     
    266266   * owl_log_shouldlog_message(void)
    267267   */
    268   m = g_new(owl_message, 1);
     268  m = g_slice_new(owl_message);
    269269  /* recip_index = 0 because there can only be one recipient anyway */
    270270  owl_message_create_from_zwrite(m, zw, text, 0);
     
    429429static gpointer owl_log_thread_func(gpointer data)
    430430{
    431   log_context = g_main_context_new();
    432431  log_loop = g_main_loop_new(log_context, FALSE);
    433432  g_main_loop_run(log_loop);
     
    437436void owl_log_init(void)
    438437{
     438  log_context = g_main_context_new();
     439#if GLIB_CHECK_VERSION(2, 31, 0)
     440  logging_thread = g_thread_new("logging",
     441                                owl_log_thread_func,
     442                                NULL);
     443#else
    439444  GError *error = NULL;
    440445  logging_thread = g_thread_create(owl_log_thread_func,
     
    448453    exit(1);
    449454  }
     455#endif
    450456 
    451457}
  • m4/ax_cflags_warn_all.m4

    r378ede7 re9b4a2c  
    2525#    - $3 action-if-found : add value to shellvariable
    2626#    - $4 action-if-not-found : nothing
     27#
     28#   NOTE: These macros depend on AX_APPEND_FLAG.
    2729#
    2830# LICENSE
     
    5759#   exception to the GPL to apply to your modified version as well.
    5860
    59 #serial 10
     61#serial 14
    6062
    61 AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
    62 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
    63 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all])dnl
     63AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl
     64AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl
     65AS_VAR_PUSHDEF([VAR],[ac_cv_[]_AC_LANG_ABBREV[]flags_warn_all])dnl
    6466AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
    6567VAR,[VAR="no, unknown"
    66  AC_LANG_PUSH([C])
    67  ac_save_[]FLAGS="$[]FLAGS"
    68 for ac_arg dnl
    69 in "-pedantic  % -Wall"       dnl   GCC
    70    "-xstrconst % -v"          dnl Solaris C
    71    "-std1      % -verbose -w0 -warnprotos" dnl Digital Unix
    72    "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
    73    "-ansi -ansiE % -fullwarn" dnl IRIX
    74    "+ESlit     % +w1"         dnl HP-UX C
    75    "-Xc        % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
    76    "-h conform % -h msglevel 2" dnl Cray C (Unicos)
    77    #
    78 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
    79    AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
    80                      [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
    81 done
    82  FLAGS="$ac_save_[]FLAGS"
    83  AC_LANG_POP([C])
    84 ])
    85 case ".$VAR" in
    86      .ok|.ok,*) m4_ifvaln($3,$3) ;;
    87    .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
    88         AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
    89                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
    90    *) m4_ifvaln($3,$3,[
    91    if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
    92    then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
    93    else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
    94                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
    95    fi ]) ;;
    96 esac
    97 AS_VAR_POPDEF([VAR])dnl
    98 AS_VAR_POPDEF([FLAGS])dnl
    99 ])
    100 
    101 dnl the only difference - the LANG selection... and the default FLAGS
    102 
    103 AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl
    104 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
    105 AS_VAR_PUSHDEF([VAR],[ax_cv_cxxflags_warn_all])dnl
    106 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
    107 VAR,[VAR="no, unknown"
    108  AC_LANG_PUSH([C++])
    109  ac_save_[]FLAGS="$[]FLAGS"
    110 for ac_arg dnl
    111 in "-pedantic  % -Wall"       dnl   GCC
    112    "-xstrconst % -v"          dnl Solaris C
    113    "-std1      % -verbose -w0 -warnprotos" dnl Digital Unix
    114    "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
    115    "-ansi -ansiE % -fullwarn" dnl IRIX
    116    "+ESlit     % +w1"         dnl HP-UX C
    117    "-Xc        % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
    118    "-h conform % -h msglevel 2" dnl Cray C (Unicos)
    119    #
    120 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
    121    AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
    122                      [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
    123 done
    124  FLAGS="$ac_save_[]FLAGS"
    125  AC_LANG_POP([C++])
    126 ])
    127 case ".$VAR" in
    128      .ok|.ok,*) m4_ifvaln($3,$3) ;;
    129    .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
    130         AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
    131                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
    132    *) m4_ifvaln($3,$3,[
    133    if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
    134    then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
    135    else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
    136                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
    137    fi ]) ;;
    138 esac
    139 AS_VAR_POPDEF([VAR])dnl
    140 AS_VAR_POPDEF([FLAGS])dnl
    141 ])
    142 
    143 dnl the only difference - the LANG selection... and the default FLAGS
    144 
    145 AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl
    146 AS_VAR_PUSHDEF([FLAGS],[FCFLAGS])dnl
    147 AS_VAR_PUSHDEF([VAR],[ax_cv_fcflags_warn_all])dnl
    148 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
    149 VAR,[VAR="no, unknown"
    150  AC_LANG_PUSH([Fortran])
    151  ac_save_[]FLAGS="$[]FLAGS"
     68ac_save_[]FLAGS="$[]FLAGS"
    15269for ac_arg dnl
    15370in "-warn all  % -warn all"   dnl Intel
     
    16582                     [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
    16683done
    167  FLAGS="$ac_save_[]FLAGS"
    168  AC_LANG_POP([Fortran])
     84FLAGS="$ac_save_[]FLAGS"
    16985])
     86AS_VAR_POPDEF([FLAGS])dnl
     87AC_REQUIRE([AX_APPEND_FLAG])
    17088case ".$VAR" in
    17189     .ok|.ok,*) m4_ifvaln($3,$3) ;;
    172    .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
    173         AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
    174                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
    175    *) m4_ifvaln($3,$3,[
    176    if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
    177    then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
    178    else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
    179                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
    180    fi ]) ;;
     90   .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;;
     91   *) m4_default($3,[AX_APPEND_FLAG([$VAR], [$1])]) ;;
    18192esac
    18293AS_VAR_POPDEF([VAR])dnl
    183 AS_VAR_POPDEF([FLAGS])dnl
    184 ])
    185 
     94])dnl AX_FLAGS_WARN_ALL
    18695dnl  implementation tactics:
    18796dnl   the for-argument contains a list of options. The first part of
     
    194103dnl   delimiter. A non-option comment can be given after "%%" marks
    195104dnl   which will be shown but not added to the respective C/CXXFLAGS.
     105
     106AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
     107AC_LANG_PUSH([C])
     108AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
     109AC_LANG_POP([C])
     110])
     111
     112AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl
     113AC_LANG_PUSH([C++])
     114AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
     115AC_LANG_POP([C++])
     116])
     117
     118AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl
     119AC_LANG_PUSH([Fortran])
     120AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
     121AC_LANG_POP([Fortran])
     122])
  • m4/pkg.m4

    r650fb2c r13a39ae8  
    158158fi[]dnl
    159159])# PKG_CHECK_MODULES
     160
     161
     162# PKG_INSTALLDIR(DIRECTORY)
     163# -------------------------
     164# Substitutes the variable pkgconfigdir as the location where a module
     165# should install pkg-config .pc files. By default the directory is
     166# $libdir/pkgconfig, but the default can be changed by passing
     167# DIRECTORY. The user can override through the --with-pkgconfigdir
     168# parameter.
     169AC_DEFUN([PKG_INSTALLDIR],
     170[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
     171m4_pushdef([pkg_description],
     172    [pkg-config installation directory @<:@]pkg_default[@:>@])
     173AC_ARG_WITH([pkgconfigdir],
     174    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
     175    [with_pkgconfigdir=]pkg_default)
     176AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
     177m4_popdef([pkg_default])
     178m4_popdef([pkg_description])
     179]) dnl PKG_INSTALLDIR
     180
     181
     182# PKG_NOARCH_INSTALLDIR(DIRECTORY)
     183# -------------------------
     184# Substitutes the variable noarch_pkgconfigdir as the location where a
     185# module should install arch-independent pkg-config .pc files. By
     186# default the directory is $datadir/pkgconfig, but the default can be
     187# changed by passing DIRECTORY. The user can override through the
     188# --with-noarch-pkgconfigdir parameter.
     189AC_DEFUN([PKG_NOARCH_INSTALLDIR],
     190[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
     191m4_pushdef([pkg_description],
     192    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
     193AC_ARG_WITH([noarch-pkgconfigdir],
     194    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
     195    [with_noarch_pkgconfigdir=]pkg_default)
     196AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
     197m4_popdef([pkg_default])
     198m4_popdef([pkg_description])
     199]) dnl PKG_NOARCH_INSTALLDIR
     200
     201
     202# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
     203# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
     204# -------------------------------------------
     205# Retrieves the value of the pkg-config variable for the given module.
     206AC_DEFUN([PKG_CHECK_VAR],
     207[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
     208AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
     209
     210_PKG_CONFIG([$1], [variable="][$3]["], [$2])
     211AS_VAR_COPY([$1], [pkg_cv_][$1])
     212
     213AS_VAR_IF([$1], [""], [$5], [$4])dnl
     214])# PKG_CHECK_VAR
  • mainwin.c

    r099597c r7dcef03  
    44static void owl_mainwin_resized(owl_window *w, void *user_data);
    55
    6 void owl_mainwin_init(owl_mainwin *mw, owl_window *window)
     6CALLER_OWN owl_mainwin *owl_mainwin_new(owl_window *window)
    77{
     8  owl_mainwin *mw = g_slice_new(owl_mainwin);
    89  mw->curtruncated=0;
    910  mw->lastdisplayed=-1;
     
    1617  /* For now, we do not bother with connecting up dependencies; that'll be a
    1718   * future refactor of the mainwin */
     19
     20  return mw;
    1821}
    1922
  • message.c

    r0071c88 r7dcef03  
    7070
    7171  if(pair ==  NULL) {
    72     pair = g_new(owl_pair, 1);
     72    pair = g_slice_new(owl_pair);
    7373    owl_pair_create(pair, attrname, NULL);
    7474    g_ptr_array_add(m->attributes, pair);
     
    836836
    837837 
    838   /* set the "isprivate" attribute if it's a private zephyr.
    839    ``private'' means recipient is non-empty and doesn't start wit
    840    `@' */
    841   if (*n->z_recipient && *n->z_recipient != '@') {
     838  /* set the "isprivate" attribute if it's a private zephyr. */
     839  if (owl_zwrite_recip_is_personal(n->z_recipient)) {
    842840    owl_message_set_isprivate(m);
    843841  }
     
    877875  if (owl_global_is_zcrypt(&g) && !strcasecmp(n->z_opcode, "crypt")) {
    878876    const char *argv[] = {
    879       "zcrypt",
     877      NULL,
    880878      "-D",
    881879      "-c", owl_message_get_class(m),
     
    883881      NULL
    884882    };
    885     char *out;
     883    char *out = NULL;
    886884    int rv;
    887885    int status;
     
    889887
    890888    zcrypt = g_build_filename(owl_get_bindir(), "zcrypt", NULL);
    891 
    892     rv = call_filter(zcrypt, argv, owl_message_get_body(m), &out, &status);
     889    argv[0] = zcrypt;
     890
     891    rv = call_filter(argv, owl_message_get_body(m), &out, &status);
    893892    g_free(zcrypt);
    894893
     
    899898      }
    900899      owl_message_set_body(m, out);
    901       g_free(out);
    902     } else if(out) {
    903       g_free(out);
    904     }
     900    } else {
     901      /* Replace the opcode. Otherwise the UI and other bits of code think the
     902       * message was encrypted. */
     903      owl_message_set_opcode(m, "failed-decrypt");
     904    }
     905    g_free(out);
    905906  }
    906907
     
    10181019    p = m->attributes->pdata[i];
    10191020    g_free(owl_pair_get_value(p));
    1020     g_free(p);
     1021    g_slice_free(owl_pair, p);
    10211022  }
    10221023
     
    10291030{
    10301031  owl_message_cleanup(m);
    1031   g_free(m);
    1032 }
     1032  g_slice_free(owl_message, m);
     1033}
  • messagelist.c

    rf271129 r7dcef03  
    11#include "owl.h"
    22
    3 void owl_messagelist_create(owl_messagelist *ml)
     3CALLER_OWN owl_messagelist *owl_messagelist_new(void)
    44{
     5  owl_messagelist *ml = g_slice_new(owl_messagelist);
    56  ml->list = g_ptr_array_new();
     7  return ml;
    68}
    79
    8 void owl_messagelist_cleanup(owl_messagelist *ml, bool free_messages)
     10void owl_messagelist_delete(owl_messagelist *ml, bool free_messages)
    911{
    1012  if (free_messages)
    1113    g_ptr_array_foreach(ml->list, (GFunc)owl_message_delete, NULL);
    1214  g_ptr_array_free(ml->list, true);
     15  g_slice_free(owl_messagelist, ml);
    1316}
    1417
  • owl.c

    rf271129 r441fd42  
    1212#include <sys/stat.h>
    1313#include <locale.h>
     14#include <unistd.h>
    1415
    1516#if OWL_STDERR_REDIR
     
    3334} owl_options;
    3435
    35 void usage(void)
     36void usage(FILE *file)
    3637{
    37   fprintf(stderr, "Barnowl version %s\n", OWL_VERSION_STRING);
    38   fprintf(stderr, "Usage: barnowl [-n] [-d] [-D] [-v] [-h] [-c <configfile>] [-s <confdir>] [-t <ttyname>]\n");
    39   fprintf(stderr, "  -n,--no-subs        don't load zephyr subscriptions\n");
    40   fprintf(stderr, "  -d,--debug          enable debugging\n");
    41   fprintf(stderr, "  -v,--version        print the Barnowl version number and exit\n");
    42   fprintf(stderr, "  -h,--help           print this help message\n");
    43   fprintf(stderr, "  -c,--config-file    specify an alternate config file\n");
    44   fprintf(stderr, "  -s,--config-dir     specify an alternate config dir (default ~/.owl)\n");
    45   fprintf(stderr, "  -t,--tty            set the tty name\n");
     38  fprintf(file, "BarnOwl version %s\n", version);
     39  fprintf(file, "Usage: barnowl [-n] [-d] [-D] [-v] [-h] [-c <configfile>] [-s <confdir>] [-t <ttyname>]\n");
     40  fprintf(file, "  -n,--no-subs        don't load zephyr subscriptions\n");
     41  fprintf(file, "  -d,--debug          enable debugging\n");
     42  fprintf(file, "  -v,--version        print the BarnOwl version number and exit\n");
     43  fprintf(file, "  -h,--help           print this help message\n");
     44  fprintf(file, "  -s,--config-dir     specify an alternate config dir (default ~/.owl)\n");
     45  fprintf(file, "  -c,--config-file    specify an alternate config file (default ~/.owl/init.pl)\n");
     46  fprintf(file, "  -t,--tty            set the tty name\n");
    4647}
    4748
     
    7980      break;
    8081    case 'v':
    81       printf("This is BarnOwl version %s\n", OWL_VERSION_STRING);
     82      printf("This is BarnOwl version %s\n", version);
    8283      exit(0);
    8384    case 'h':
     85      usage(stdout);
     86      exit(0);
    8487    default:
    85       usage();
     88      usage(stderr);
    8689      exit(1);
    8790    }
     
    262265    /* follow the last message if we're supposed to */
    263266    if (followlast)
    264       owl_function_lastmsg_noredisplay();
     267      owl_function_lastmsg();
    265268
    266269    /* do the newmsgproc thing */
     
    286289
    287290  owl_global_set_lastinputtime(&g, time(NULL));
     291  owl_global_wakeup(&g);
    288292  ret = owl_keyhandler_process(owl_global_get_keyhandler(&g), j);
    289293  if (ret!=0 && ret!=1) {
     
    427431  if (0 != pipe(pipefds)) {
    428432    perror("pipe");
    429     owl_function_debugmsg("stderr_replace: pipe FAILED\n");
     433    owl_function_debugmsg("stderr_replace: pipe FAILED");
    430434    return -1;
    431435  }
    432     owl_function_debugmsg("stderr_replace: pipe: %d,%d\n", pipefds[0], pipefds[1]);
    433   if (-1 == dup2(pipefds[1], 2 /*stderr*/)) {
    434     owl_function_debugmsg("stderr_replace: dup2 FAILED (%s)\n", strerror(errno));
     436    owl_function_debugmsg("stderr_replace: pipe: %d,%d", pipefds[0], pipefds[1]);
     437  if (-1 == dup2(pipefds[1], STDERR_FILENO)) {
     438    owl_function_debugmsg("stderr_replace: dup2 FAILED (%s)", strerror(errno));
    435439    perror("dup2");
    436440    return -1;
     
    514518#if OWL_STDERR_REDIR
    515519  /* Do this only after we've started curses up... */
    516   owl_function_debugmsg("startup: doing stderr redirection");
    517   channel = g_io_channel_unix_new(stderr_replace());
    518   g_io_add_watch(channel, G_IO_IN | G_IO_HUP | G_IO_ERR, &stderr_redirect_handler, NULL);
    519   g_io_channel_unref(channel);
     520  if (isatty(STDERR_FILENO)) {
     521    owl_function_debugmsg("startup: doing stderr redirection");
     522    channel = g_io_channel_unix_new(stderr_replace());
     523    g_io_add_watch(channel, G_IO_IN | G_IO_HUP | G_IO_ERR, &stderr_redirect_handler, NULL);
     524    g_io_channel_unref(channel);
     525  }
    520526#endif
    521527
     
    572578  /* welcome message */
    573579  owl_function_debugmsg("startup: creating splash message");
    574   owl_function_adminmsg("",
     580  char *welcome = g_strdup_printf(
    575581    "-----------------------------------------------------------------------\n"
    576     "Welcome to BarnOwl version " OWL_VERSION_STRING ".\n"
     582    "Welcome to BarnOwl version %s.\n"
    577583    "To see a quick introduction, type ':show quickstart'.                  \n"
    578584    "Press 'h' for on-line help.                                            \n"
     
    582588    "                                                                 OvO   \n"
    583589    "Please report any bugs or suggestions to bug-barnowl@mit.edu    (   )  \n"
    584     "-----------------------------------------------------------------m-m---\n"
    585   );
     590    "-----------------------------------------------------------------m-m---\n",
     591    version);
     592  owl_function_adminmsg("", welcome);
     593  g_free(welcome);
     594
     595  owl_function_debugmsg("startup: setting context interactive");
     596
     597  owl_global_pop_context(&g);
     598  owl_global_push_context(&g, OWL_CTX_INTERACTIVE|OWL_CTX_RECV, NULL, "recv", NULL);
    586599
    587600  /* process the startup file */
     
    596609      owl_function_error("No such style: %s", owl_global_get_default_style(&g));
    597610
    598   owl_function_debugmsg("startup: setting context interactive");
    599 
    600   owl_global_pop_context(&g);
    601   owl_global_push_context(&g, OWL_CTX_INTERACTIVE|OWL_CTX_RECV, NULL, "recv", NULL);
    602 
    603611  source = owl_window_redraw_source_new();
    604612  g_source_attach(source, NULL);
  • owl.h

    rb9517cf rca1fb26a  
    1010#define INC_BARNOWL_OWL_H
    1111
    12 #include "config.h"
     12#include <config.h>
    1313
    1414#include "compat/compat.h"
     
    4747/* Perl and curses don't play nice. */
    4848#ifdef OWL_PERL
    49 typedef void WINDOW;
    50 typedef void PANEL;
     49typedef struct _owl_fake_WINDOW WINDOW;
     50typedef struct _owl_fake_PANEL PANEL;
    5151/* logout is defined in FreeBSD. */
    5252#define logout logout_
     
    5757#include "XSUB.h"
    5858#else
    59 typedef void SV;
    60 typedef void AV;
    61 typedef void HV;
     59typedef struct _owl_fake_SV SV;
     60typedef struct _owl_fake_AV AV;
     61typedef struct _owl_fake_HV HV;
    6262#endif
    6363
    6464#include "window.h"
    6565
    66 #ifndef OWL_VERSION_STRING
    67 #ifdef  GIT_VERSION
    68 #define stringify(x)       __stringify(x)
    69 #define __stringify(x)     #x
    70 #define OWL_VERSION_STRING stringify(GIT_VERSION)
    71 #else
    72 #define OWL_VERSION_STRING PACKAGE_VERSION
    73 #endif
    74 #endif /* !OWL_VERSION_STRING */
     66extern const char *version;
    7567
    7668/* Feature that is being tested to redirect stderr through a pipe.
     
    235227  char *name;
    236228  int   type;  /* OWL_VARIABLE_* */
    237   void *pval_default;  /* for types other and string */
    238   int   ival_default;  /* for types int and bool     */
    239   const char *validsettings;    /* documentation of valid settings */
     229  char *default_str;            /* the default value as a string */
     230  char *validsettings;          /* documentation of valid settings */
    240231  char *summary;                /* summary of usage */
    241232  char *description;            /* detailed description */
    242   void *val;                    /* current value */
    243   int  (*validate_fn)(const struct _owl_variable *v, const void *newval);
     233  bool takes_on_off;            /* allow passing on/off in argument-less set/unset */
     234  GClosure *set_fromstring_fn;
     235                                /* sets the variable to a value
     236                                 * of the appropriate type.
     237                                 * unless documented, this
     238                                 * should make a copy.
     239                                 * returns 0 on success. */
     240  GClosure *get_tostring_fn;
     241                                /* converts val to a string;
     242                                 * caller must free the result */
     243
     244  /* These are only valid for OWL_VARIABLE_{INT,BOOL,STRING} */
     245  GValue val;                   /* current value, if default get_fn/set_fn */
     246
     247  GCallback get_fn;
     248                                /* returns a reference to the current value.
     249                                 * WARNING:  this approach is hard to make
     250                                 * thread-safe... */
     251  GCallback validate_fn;
    244252                                /* returns 1 if newval is valid */
    245   int  (*set_fn)(struct _owl_variable *v, const void *newval);
     253  GCallback set_fn;
    246254                                /* sets the variable to a value
    247                                  * of the appropriate type.
    248                                  * unless documented, this
    249                                  * should make a copy.
    250                                  * returns 0 on success. */
    251   int  (*set_fromstring_fn)(struct _owl_variable *v, const char *newval);
    252                                 /* sets the variable to a value
    253                                  * of the appropriate type.
    254                                  * unless documented, this
    255                                  * should make a copy.
    256                                  * returns 0 on success. */
    257   const void *(*get_fn)(const struct _owl_variable *v);
    258                                 /* returns a reference to the current value.
    259                                  * WARNING:  this approach is hard to make
    260                                  * thread-safe... */
    261   CALLER_OWN char *(*get_tostring_fn)(const struct _owl_variable *v, const void *val);
    262                                 /* converts val to a string;
    263                                  * caller must free the result */
    264   void (*delete_fn)(struct _owl_variable *v);
    265                                 /* frees val as needed */
     255                                 * of the appropriate type.
     256                                 * unless documented, this
     257                                 * should make a copy.
     258                                 * returns 0 on success. */
    266259} owl_variable;
     260
    267261
    268262typedef struct _owl_input {
     
    452446  char *name;
    453447  owl_filter *filter;
    454   owl_messagelist ml;
     448  owl_messagelist *ml;
    455449  const owl_style *style;
    456450  int cachedmsgid;
     
    533527
    534528typedef struct _owl_global {
    535   owl_mainwin mw;
     529  owl_mainwin *mw;
    536530  owl_popwin *pw;
    537531  owl_msgwin msgwin;
     
    551545  int curmsg_vert_offset;
    552546  owl_view current_view;
    553   owl_messagelist msglist;
     547  owl_messagelist *msglist;
    554548  WINDOW *input_pad;
    555549  owl_mainpanel mainpanel;
     
    569563  time_t starttime;
    570564  time_t lastinputtime;
     565  time_t last_wakeup_time;
    571566  char *startupargs;
    572567  int nextmsgid;
     
    596591  char *kill_buffer;
    597592  int interrupt_count;
     593#if GLIB_CHECK_VERSION(2, 31, 0)
     594  GMutex interrupt_lock;
     595#else
    598596  GMutex *interrupt_lock;
     597#endif
    599598} owl_global;
    600599
     
    602601extern owl_global g;
    603602
    604 #include "owl_prototypes.h"
     603#include <owl_prototypes.h>
    605604
    606605/* These were missing from the Zephyr includes before Zephyr 3. */
     
    610609#endif
    611610
     611/* We have to dynamically bind these ourselves */
     612extern gboolean (*gvalue_from_sv) (GValue * value, SV * sv);
     613extern SV * (*sv_from_gvalue) (const GValue * value);
     614extern GClosure * (*perl_closure_new) (SV * callback, SV * data, gboolean swap);
     615
     616
    612617#endif /* INC_BARNOWL_OWL_H */
  • owl_perl.h

    rf271129 r92ffd89  
    44#include <stdio.h>
    55
    6 #define OWL_PERL_VOID_CALL (void)POPs;
     6/*
     7 * This macro defines a convenience wrapper around the boilerplate
     8 * of pushing char * arguments on to the stack for perl calling.
     9 *
     10 * Arguments are
     11 * * i     - the counter variable to use, which must be declared prior
     12 *           to calling this macro
     13 * * argc  - the number of arguments
     14 * * argv  - an array of char*s, of length at least argc; the arguments
     15 *           to push on to the stack
     16 */
     17#define OWL_PERL_PUSH_ARGS(i, argc, argv) { \
     18  for (i = 0; i < argc; i++) { \
     19    XPUSHs(sv_2mortal(owl_new_sv(argv[i]))); \
     20  } \
     21}
    722
    823/*
    924 * This macro defines a convenience wrapper around the boilerplate of
    10  * calling a method on a perl object (SV*) from C.
     25 * the perlcall methods.
    1126 *
    1227 * Arguments are
    13  * * obj    - the SV* to call the method on
    14  * * meth   - a char* method name
    15  * * args   - a code block responsible for pushing args (other than the object)
    16  * * err    - a string with a %s format specifier to log in case of error
    17  * * fatalp - if true, perl errors terminate BarnOwl
    18  * * ret    - a code block executed if the call succeeded
     28 * * call       - the line of code to make the perl call
     29 * * args       - a code block responsible for pushing args
     30 * * err        - a string with a %s format specifier to log in case of error
     31 * * fatalp     - if true, perl errors terminate BarnOwl
     32 * * discardret - should be true if no return is expected
     33 *                (if the call is passed the flag G_DISCARD or G_VOID)
     34 * * ret        - a code block executed if the call succeeded
    1935 *
    2036 * See also: `perldoc perlcall', `perldoc perlapi'
    2137 */
    22 #define OWL_PERL_CALL_METHOD(obj, meth, args, err, fatalp, ret) { \
    23     int count; \
    24     dSP; \
    25     ENTER; \
    26     SAVETMPS; \
    27     PUSHMARK(SP); \
    28     XPUSHs(obj); \
    29     {args} \
    30     PUTBACK; \
    31     \
    32     count = call_method(meth, G_SCALAR|G_EVAL); \
    33     \
    34     SPAGAIN; \
    35     \
    36     if(count != 1) { \
    37       fprintf(stderr, "perl returned wrong count: %d\n", count); \
    38       abort();                                                   \
     38#define OWL_PERL_CALL(call, args, err, fatalp, discardret, ret) { \
     39  int count; \
     40  dSP; \
     41  \
     42  ENTER; \
     43  SAVETMPS; \
     44  \
     45  PUSHMARK(SP); \
     46  {args} \
     47  PUTBACK; \
     48  \
     49  count = call; \
     50  \
     51  SPAGAIN; \
     52  \
     53  if (!discardret && count != 1) { \
     54    croak("Perl returned wrong count: %d\n", count); \
     55  } \
     56  \
     57  if (SvTRUE(ERRSV)) { \
     58    if (fatalp) { \
     59      fprintf(stderr, err, SvPV_nolen(ERRSV)); \
     60      exit(-1); \
     61    } else { \
     62      owl_function_error(err, SvPV_nolen(ERRSV)); \
     63      if (!discardret) (void)POPs; \
     64      sv_setsv(ERRSV, &PL_sv_undef); \
    3965    } \
    40     if (SvTRUE(ERRSV)) { \
    41       if(fatalp) { \
    42         printf(err, SvPV_nolen(ERRSV)); \
    43         exit(-1); \
    44       } else { \
    45         owl_function_error(err, SvPV_nolen(ERRSV)); \
    46         (void)POPs; \
    47         sv_setsv(ERRSV, &PL_sv_undef); \
    48       } \
    49     } else { \
    50       ret; \
    51     } \
    52     PUTBACK; \
    53     FREETMPS; \
    54     LEAVE; \
     66  } else if (!discardret) { \
     67    ret; \
     68  } \
     69  PUTBACK; \
     70  FREETMPS; \
     71  LEAVE; \
    5572}
    5673
  • perl/Makefile.am

    r10557e6 ra870319  
    11SUBDIRS = modules
     2nobase_dist_pkgdata_DATA = \
     3        lib/BarnOwl.pm \
     4        lib/BarnOwl/Complete/AIM.pm \
     5        lib/BarnOwl/Complete/Client.pm \
     6        lib/BarnOwl/Complete/Filter.pm \
     7        lib/BarnOwl/Complete/Zephyr.pm \
     8        lib/BarnOwl/Completion.pm \
     9        lib/BarnOwl/Completion/Context.pm \
     10        lib/BarnOwl/Completion/Util.pm \
     11        lib/BarnOwl/Editwin.pm \
     12        lib/BarnOwl/Help.pm \
     13        lib/BarnOwl/Hook.pm \
     14        lib/BarnOwl/Hooks.pm \
     15        lib/BarnOwl/MainLoopCompatHook.pm \
     16        lib/BarnOwl/Message.pm \
     17        lib/BarnOwl/Message/AIM.pm \
     18        lib/BarnOwl/Message/Admin.pm \
     19        lib/BarnOwl/Message/Generic.pm \
     20        lib/BarnOwl/Message/Loopback.pm \
     21        lib/BarnOwl/Message/Zephyr.pm \
     22        lib/BarnOwl/ModuleLoader.pm \
     23        lib/BarnOwl/Parse.pm \
     24        lib/BarnOwl/Style.pm \
     25        lib/BarnOwl/Style/Basic.pm \
     26        lib/BarnOwl/Style/Default.pm \
     27        lib/BarnOwl/Style/Legacy.pm \
     28        lib/BarnOwl/Style/OneLine.pm \
     29        lib/BarnOwl/Timer.pm \
     30        lib/BarnOwl/Zephyr.pm \
     31        lib/Module/Install/BarnOwl.pm
  • perl/lib/BarnOwl.pm

    ra130fc5 recd4edf  
    55
    66use base qw(Exporter);
    7 our @EXPORT_OK = qw(command getcurmsg getnumcols getidletime
     7our @EXPORT_OK = qw(command getcurmsg getnumcols getnumlines getidletime
     8                    register_idle_watcher unregister_idle_watcher
    89                    zephyr_getsender zephyr_getrealm zephyr_zwrite
    910                    zephyr_stylestrip zephyr_smartstrip_user zephyr_getsubs
    1011                    queue_message admin_message
     12                    start_edit
    1113                    start_question start_password start_edit_win
    1214                    get_data_dir get_config_dir popless_text popless_ztext
    1315                    error debug
    1416                    create_style getnumcolors wordwrap
     17                    message_matches_filter
    1518                    add_dispatch remove_dispatch
    1619                    add_io_dispatch remove_io_dispatch
    1720                    new_command
    1821                    new_variable_int new_variable_bool new_variable_string
     22                    new_variable_enum
    1923                    quote redisplay);
    2024our %EXPORT_TAGS = (all => \@EXPORT_OK);
     
    4347
    4448use List::Util qw(max);
     49use Tie::RefHash;
    4550
    4651=head1 NAME
     
    9297command line, and C<MESSAGE> is the zephyr body to send.
    9398
     99=cut
     100
     101sub zephyr_zwrite {
     102    my ($command, $message) = @_;
     103    my $ret = BarnOwl::Internal::zephyr_zwrite($command, $message);
     104    die "Error sending zephyr" unless $ret == 0;
     105}
     106
    94107=head2 ztext_stylestrip STRING
    95108
     
    105118Enqueue a message in the BarnOwl message list, logging it and
    106119processing it appropriately. C<MESSAGE> should be an instance of
    107 BarnOwl::Message or a subclass.  Returns the queued message.  This
    108 is useful for, e.g., deleting a message from the message list.
     120BarnOwl::Message or a subclass.
    109121
    110122=head2 admin_message HEADER BODY
     
    112124Display a BarnOwl B<Admin> message, with the given header and body.
    113125
     126=head2 start_edit %ARGS
     127
     128Displays a prompt on the screen and lets the user enter text,
     129and calls a callback when the editwin is closed.
     130
     131C<%ARGS> must contain the following keys:
     132
     133=over 4
     134
     135=item prompt
     136
     137The line to display on the screen
     138
     139=item type
     140
     141One of:
     142
     143=over 4
     144
     145=item edit_win
     146
     147Displays the prompt on a line of its own and opens the edit_win.
     148
     149=item question
     150
     151Displays prompt on the screen and lets the user enter a line of
     152text.
     153
     154=item password
     155
     156Like question, but echoes the user's input as C<*>s when they
     157input.
     158
     159=back
     160
     161=item callback
     162
     163A Perl subroutine that is called when the user closes the edit_win.
     164C<CALLBACK> gets called with two parameters: the text the user entered,
     165and a C<SUCCESS> boolean parameter which is false if the user canceled
     166the edit_win and true otherwise.
     167
     168=back
     169
    114170=head2 start_question PROMPT CALLBACK
    115171
    116 Displays C<PROMPT> on the screen and lets the user enter a line of
    117 text, and calls C<CALLBACK>, which must be a perl subroutine
    118 reference, with the text the user entered
    119 
    120172=head2 start_password PROMPT CALLBACK
    121173
    122 Like C<start_question>, but echoes the user's input as C<*>s when they
    123 input.
    124 
    125174=head2 start_edit_win PROMPT CALLBACK
    126175
    127 Like C<start_question>, but displays C<PROMPT> on a line of its own
    128 and opens the editwin. If the user cancels the edit win, C<CALLBACK>
    129 is not invoked.
     176Roughly equivalent to C<start_edit> called with the appropriate parameters.
     177C<CALLBACK> is only called on success, for compatibility.
     178
     179These are deprecated wrappers around L<BarnOwl::start_edit>, and should not
     180be uesd in new code.
     181
     182=cut
     183
     184sub start_edit {
     185    my %args = (@_);
     186    BarnOwl::Internal::start_edit($args{type}, $args{prompt}, $args{callback});
     187}
     188
     189sub start_question {
     190    my ($prompt, $callback) = @_;
     191    BarnOwl::start_edit(type => 'question', prompt => $prompt, callback => sub {
     192            my ($text, $success) = @_;
     193            $callback->($text) if $success;
     194        });
     195}
     196
     197sub start_password {
     198    my ($prompt, $callback) = @_;
     199    BarnOwl::start_edit(type => 'password', prompt => $prompt, callback => sub {
     200            my ($text, $success) = @_;
     201            $callback->($text) if $success;
     202        });
     203}
     204
     205sub start_edit_win {
     206    my ($prompt, $callback) = @_;
     207    BarnOwl::start_edit(type => 'edit_win', prompt => $prompt, callback => sub {
     208            my ($text, $success) = @_;
     209            $callback->($text) if $success;
     210        });
     211}
    130212
    131213=head2 get_data_dir
     
    160242
    161243Returns the number of colors this BarnOwl is capable of displaying
     244
     245=head2 message_matches_filter MESSAGE FILTER_NAME [QUIET = 0]
     246
     247Returns 1 if C<FILTER_NAME> is the name of a valid filter, and
     248C<MESSAGE> matches that filter.  Returns 0 otherwise.  If
     249C<QUIET> is false, this method displays an error message if
     250if C<FILTER_NAME> does not name a valid filter.
    162251
    163252=head2 add_dispatch FD CALLBACK
     
    259348our @all_commands;
    260349
    261 if(!$configfile && -f $ENV{HOME} . "/.barnowlconf") {
    262     $configfile = $ENV{HOME} . "/.barnowlconf";
    263 }
    264 $configfile ||= $ENV{HOME}."/.owlconf";
     350if(!$configfile) {
     351    if (-f get_config_dir() . "/init.pl") {
     352        $configfile = get_config_dir() . "/init.pl";
     353    } elsif (-f $ENV{HOME} . "/.barnowlconf") {
     354        $configfile = $ENV{HOME} . "/.barnowlconf";
     355    } else {
     356        $configfile = $ENV{HOME}."/.owlconf";
     357    }
     358}
    265359
    266360# populate global variable space for legacy owlconf files
     
    319413=head2 new_variable_string NAME [{ARGS}]
    320414
    321 Add a new owl variable, either an int, a bool, or a string, with the
     415=head2 new_variable_enum NAME [{ARGS}]
     416
     417Add a new owl variable, either an int, a bool, a string, or an enum with the
    322418specified name.
    323419
    324 ARGS can optionally contain the following keys:
     420For new_variable_enum, ARGS is required to contain a validsettings key pointing
     421to an array reference. For all four, it can optionally contain the following
     422keys:
    325423
    326424=over 4
     
    340438=back
    341439
     440In addition, new_variable_string optionally accepts a string validsettings
     441parameter, in case people want to set it to "<path>".
     442
    342443=cut
    343444
    344445sub new_variable_int {
    345     unshift @_, \&BarnOwl::Internal::new_variable_int, 0;
    346     goto \&_new_variable;
     446    my ($name, $args) = @_;
     447    my $storage = defined($args->{default}) ? $args->{default} : 0;
     448    BarnOwl::new_variable_full($name, {
     449            %{$args},
     450            get_tostring => sub { "$storage" },
     451            set_fromstring => sub {
     452                die "Expected integer" unless $_[0] =~ /^-?[0-9]+$/;
     453                $storage = 0 + $_[0];
     454            },
     455            validsettings => "<int>",
     456            takes_on_off => 0,
     457        });
    347458}
    348459
    349460sub new_variable_bool {
    350     unshift @_, \&BarnOwl::Internal::new_variable_bool, 0;
    351     goto \&_new_variable;
     461    my ($name, $args) = @_;
     462    my $storage = defined($args->{default}) ? $args->{default} : 0;
     463    BarnOwl::new_variable_full($name, {
     464            %{$args},
     465            get_tostring => sub { $storage ? "on" : "off" },
     466            set_fromstring => sub {
     467                die "Valid settings are on/off" unless $_[0] eq "on" || $_[0] eq "off";
     468                $storage = $_[0] eq "on";
     469            },
     470            validsettings => "on,off",
     471            takes_on_off => 1,
     472        });
    352473}
    353474
    354475sub new_variable_string {
    355     unshift @_, \&BarnOwl::Internal::new_variable_string, "";
    356     goto \&_new_variable;
    357 }
    358 
    359 sub _new_variable {
    360     my $func = shift;
    361     my $default_default = shift;
     476    my ($name, $args) = @_;
     477    my $storage = defined($args->{default}) ? $args->{default} : "";
     478    BarnOwl::new_variable_full($name, {
     479            # Allow people to override this one if they /reaaally/ want to for
     480            # some reason. Though we still reserve the right to interpret this
     481            # value in interesting ways for tab-completion purposes.
     482            validsettings => "<string>",
     483            %{$args},
     484            get_tostring => sub { $storage },
     485            set_fromstring => sub { $storage = $_[0]; },
     486            takes_on_off => 0,
     487        });
     488}
     489
     490sub new_variable_enum {
     491    my ($name, $args) = @_;
     492
     493    # Gather the valid settings.
     494    die "validsettings is required" unless defined($args->{validsettings});
     495    my %valid;
     496    map { $valid{$_} = 1 } @{$args->{validsettings}};
     497
     498    my $storage = (defined($args->{default}) ?
     499                   $args->{default} :
     500                   $args->{validsettings}->[0]);
     501    BarnOwl::new_variable_full($name, {
     502            %{$args},
     503            get_tostring => sub { $storage },
     504            set_fromstring => sub {
     505                die "Invalid input" unless $valid{$_[0]};
     506                $storage = $_[0];
     507            },
     508            validsettings => join(",", @{$args->{validsettings}})
     509        });
     510}
     511
     512=head2 new_variable_full NAME {ARGS}
     513
     514Create a variable, in full generality. The keyword arguments have types below:
     515
     516 get_tostring : ()  -> string
     517 set_fromstring : string -> int
     518 -- optional --
     519 summary : string
     520 description : string
     521 validsettings : string
     522 takes_on_off : int
     523
     524The get/set functions are required. Note that the caller manages storage for the
     525variable. get_tostring/set_fromstring both convert AND store the value.
     526set_fromstring dies on failure.
     527
     528If the variable takes parameters 'on' and 'off' (i.e. is boolean-looking), set
     529takes_on_off to 1. This makes :set VAR and :unset VAR work. set_fromstring will
     530be called with those arguments.
     531
     532=cut
     533
     534sub new_variable_full {
    362535    my $name = shift;
    363536    my $args = shift || {};
    364537    my %args = (
    365         summary     => "",
     538        summary => "",
    366539        description => "",
    367         default     => $default_default,
     540        takes_on_off => 0,
     541        validsettings => "<string>",
    368542        %{$args});
    369     $func->($name, $args{default}, $args{summary}, $args{description});
     543
     544    die "get_tostring required" unless $args{get_tostring};
     545    die "set_fromstring required" unless $args{set_fromstring};
     546
     547    # Strip off the bogus dummy argument. Aargh perl-Glib.
     548    my $get_tostring_fn = sub { $args{get_tostring}->() };
     549    my $set_fromstring_fn = sub {
     550      my ($dummy, $val) = @_;
     551      # Translate from user-supplied die-on-failure callback to expected
     552      # non-zero on error. Less of a nuisance than interacting with ERRSV.
     553      eval { $args{set_fromstring}->($val) };
     554      # TODO: Consider changing B::I::new_variable to expect string|NULL with
     555      # string as the error message. That can then be translated to a GError in
     556      # owl_variable_set_fromstring. For now the string is ignored.
     557      return ($@ ? -1 : 0);
     558    };
     559
     560    BarnOwl::Internal::new_variable($name, $args{summary}, $args{description}, $args{validsettings},
     561                                    $args{takes_on_off}, $get_tostring_fn, $set_fromstring_fn, undef);
    370562}
    371563
     
    603795}
    604796
     797=head3 register_idle_watcher %ARGS
     798
     799Call a callback whenever the amount of time the user becomes idle or comes
     800back from being idle.
     801
     802You must include the following parameters:
     803
     804=over 4
     805
     806=item name
     807
     808The name given to the idle watcher
     809
     810=item after
     811
     812How long the user must be idle, in seconds, before the callback is called.
     813If the value is too small, you may have spurious or inaccurate calls.
     814(The current lower limit is about 1 second.)
     815
     816=item callback
     817
     818The Perl subroutine that gets called when the user has been idle for C<AFTER>
     819seconds, or comes back from being idle.  The subroutine is passed one parameter,
     820which is true if the user is currently idle, and false otherwise.
     821
     822=back
     823
     824This method returns a unique identifier which may be passed to
     825L<BarnOwl::unregister_idle_watcher>.
     826
     827=cut
     828
     829=head3 unregister_idle_watcher UNIQUE_ID [...]
     830
     831Removed and returns the idle watcher specified by C<UNIQUE_ID>.
     832You may specify multiple unique ids.
     833
     834=cut
     835
     836my %idle_watchers;
     837tie %idle_watchers, 'Tie::RefHash';
     838
     839$BarnOwl::Hooks::wakeup->add(sub {
     840        foreach my $idle_watcher (values %idle_watchers) {
     841            _wakeup_idle_watcher($idle_watcher);
     842        }
     843    });
     844
     845sub _wakeup_idle_watcher {
     846    my ($idle_watcher, $offset) = @_;
     847    $offset = 0 unless defined $offset;
     848    # go unidle
     849    $idle_watcher->{idle_timer}->stop if $idle_watcher->{idle_timer};
     850    undef $idle_watcher->{idle_timer};
     851    $idle_watcher->{callback}->(0) if $idle_watcher->{is_idle};
     852    $idle_watcher->{is_idle} = 0;
     853
     854    # queue going idle
     855    $idle_watcher->{idle_timer} = BarnOwl::Timer->new({
     856        name  => $idle_watcher->{name},
     857        after => $idle_watcher->{after} - $offset,
     858        cb    => sub {
     859            $idle_watcher->{is_idle} = 1;
     860            $idle_watcher->{callback}->(1);
     861        }
     862    });
     863}
     864
     865sub register_idle_watcher {
     866    my %args = (@_);
     867    $idle_watchers{\%args} = \%args;
     868    _wakeup_idle_watcher(\%args, BarnOwl::getidletime); # make sure to queue up the idle/unidle events from this idle watcher
     869    return \%args;
     870}
     871
     872sub unregister_idle_watcher {
     873    my ($id) = @_;
     874    $idle_watchers{$id}->{idle_timer}->stop if $idle_watchers{$id}->{idle_timer};
     875    return delete $idle_watchers{$id};
     876}
     877
    605878# Stub for owl::startup / BarnOwl::startup, so it isn't bound to the
    606879# startup command. This may be redefined in a user's configfile.
  • perl/lib/BarnOwl/Complete/Client.pm

    r58f4fb2 r4626016  
    2020
    2121my %show = (
    22     information => undef,
    2322    colors      => undef,
    2423    commands    => undef,
     
    205204BarnOwl::Completion::register_completer(set     => \&complete_set);
    206205BarnOwl::Completion::register_completer(unset   => \&complete_set);
    207 BarnOwl::Completion::register_completer(startup => \&complete_startup);
     206BarnOwl::Completion::register_completer(startup   => \&complete_startup);
     207BarnOwl::Completion::register_completer(unstartup => \&complete_startup);
    208208BarnOwl::Completion::register_completer(bindkey => \&complete_bindkey);
    209209BarnOwl::Completion::register_completer(print   => \&complete_print);
  • perl/lib/BarnOwl/Complete/Zephyr.pm

    r3e8625f re6e7842  
    6464BarnOwl::Completion::register_completer(viewuser  => \&complete_viewuser);
    6565BarnOwl::Completion::register_completer(vu        => \&complete_viewuser);
     66BarnOwl::Completion::register_completer(viewperson => \&complete_viewuser);
     67BarnOwl::Completion::register_completer(vp        => \&complete_viewuser);
    6668
    6769BarnOwl::Completion::register_completer(unsub     => \&complete_unsub);
  • perl/lib/BarnOwl/Hooks.pm

    rb8a3e00 r120dac7  
    3636Called before BarnOwl shutdown
    3737
     38=item $wakeup
     39
     40Called, at most once per second, on user input
     41
    3842=item $receiveMessage
    3943
     
    5761from every function registered with this hook will be appended and
    5862displayed in a popup window, with zephyr formatting parsed.
     63
     64=item $awayOn
     65
     66Called, for all protocol handlers, to go away, with the away message,
     67if any.
     68
     69=item $awayOff
     70
     71Called, for all protocol handlers, to come back from away.
     72
     73=item $getIsAway
     74
     75Called to check away status for all protocol handlers.  Protocol
     76handlers should return a true value if any account of the user is away
     77for the given protocol, and a false value otherwise.
    5978
    6079=item $getQuickstart
     
    7392
    7493our @EXPORT_OK = qw($startup $shutdown
     94                    $wakeup
    7595                    $receiveMessage $newMessage
    7696                    $mainLoop $getBuddyList
     97                    $awayOn $awayOff $getIsAway
    7798                    $getQuickstart);
    7899
     
    83104our $startup = BarnOwl::Hook->new;
    84105our $shutdown = BarnOwl::Hook->new;
     106our $wakeup = BarnOwl::Hook->new;
    85107our $receiveMessage = BarnOwl::Hook->new;
    86108our $newMessage = BarnOwl::Hook->new;
     
    88110our $getBuddyList = BarnOwl::Hook->new;
    89111our $getQuickstart = BarnOwl::Hook->new;
     112our $awayOn = BarnOwl::Hook->new;
     113our $awayOff = BarnOwl::Hook->new;
     114our $getIsAway = BarnOwl::Hook->new;
    90115
    91116# Internal startup/shutdown routines called by the C code
     
    175200}
    176201
     202sub _wakeup {
     203    $wakeup->run;
     204}
     205
    177206sub _receive_msg {
    178207    my $m = shift;
     
    199228sub _get_quickstart {
    200229    return join("\n", $getQuickstart->run);
     230}
     231
     232sub _away_on {
     233    $awayOn->run(@_);
     234}
     235
     236sub _away_off {
     237    $awayOff->run();
     238}
     239
     240sub _get_is_away {
     241    my @is_away = grep { $_ } $getIsAway->run();
     242    return scalar @is_away;
    201243}
    202244
  • perl/lib/BarnOwl/Message.pm

    ra130fc5 r0adbce1  
    5151sub is_ping     { return 0; }
    5252sub is_mail     { return 0; }
    53 sub is_personal { return shift->is_private; }
     53sub is_personal { return BarnOwl::message_matches_filter(shift, "personal"); }
    5454sub class       { return undef; }
    5555sub instance    { return undef; }
  • perl/lib/BarnOwl/Message/Zephyr.pm

    redd0be7 r0adbce1  
    5151    my ($m) = @_;
    5252    return undef if (!$m->is_loginout);
     53    return undef if (!defined($m->fields));
    5354    return $m->fields->[2];
    5455}
     
    5758    my ($m) = @_;
    5859    return undef if (!$m->is_loginout);
     60    return undef if (!defined($m->fields));
    5961    return $m->fields->[0];
    6062}
     
    6365
    6466sub is_ping     { return (lc(shift->opcode) eq "ping"); }
    65 
    66 sub is_personal {
    67     my ($m) = @_;
    68     return ((lc($m->class) eq "message")
    69             && $m->is_private);
    70 }
    7167
    7268sub is_mail {
     
    171167        $class = $self->class;
    172168        $instance = $self->instance;
    173         if ($self->recipient eq '*' || $self->recipient eq '') {
    174             $to = '';
    175         } elsif ($self->recipient =~ /^@/) {
     169        if ($self->recipient eq '' || $self->recipient =~ /^@/) {
    176170            $to = $self->recipient;
    177171        } else {
  • perl/lib/BarnOwl/ModuleLoader.pm

    rf544216 rf34728b  
    127127}
    128128
     129sub complete_module_name {
     130    return sort(keys %modules);
     131}
     132
    129133sub register_keybindings {
    130134    BarnOwl::new_command('reload-modules', sub {BarnOwl::ModuleLoader->reload}, {
     
    138142                           description => q{Reloads a single module located in ~/.owl/modules or the system modules directory}
    139143                          });
     144
     145    BarnOwl::Completion::register_completer('reload-module', \&complete_module_name);
    140146}
    141147
  • perl/lib/BarnOwl/Style/Default.pm

    r5738650 rebc6f77  
    113113        }
    114114        $header .= '@b{' . maybe($m->pretty_sender) . '}';
     115        if (defined($m->realm) && $m->realm ne BarnOwl::zephyr_getrealm()) {
     116            $header .= ' {' . $self->humanize($m->realm, 1) . '}';
     117        }
    115118    }
    116119
     
    126129    my $self = shift;
    127130    my $m = shift;
    128     my $sender = $m->long_sender;
    129     $sender =~ s/\n.*$//s;
     131    my $sender = $self->humanize($m->long_sender, 1);
    130132    if (BarnOwl::getvar('colorztext') eq 'on') {
    131133      return "  (" . $sender . '@color[default]' . ")";
  • perl/lib/BarnOwl/Zephyr.pm

    rdf569c5 r53151d4  
    1212use BarnOwl::Hook;
    1313
    14 my $zephyrStartup = BarnOwl::Hook->new;
     14our $zephyrStartup = BarnOwl::Hook->new;
    1515
    1616sub _zephyr_startup {
  • perl/lib/Module/Install/BarnOwl.pm

    rb8a3e00 re4b8f93  
    4141    my $class = ref $self;
    4242
     43    my $srcdir = $ENV{BARNOWL_SRCDIR} || '.';
     44
    4345    $self->name("BarnOwl-Module-$name");
    44     $self->all_from("lib/BarnOwl/Module/$name.pm");
     46    $self->all_from("$srcdir/lib/BarnOwl/Module/$name.pm");
     47    $self->makemaker_args(PMLIBDIRS => ["$srcdir/lib"],
     48                          PMLIBPARENTDIRS => ["$srcdir/lib"]);
    4549
    4650    $self->postamble(<<"END_MAKEFILE");
    4751
    4852# --- $class section:
     53
     54BARNOWL_SRCDIR = $srcdir
     55export BARNOWL_SRCDIR
    4956
    5057$name.par: pm_to_blib
  • perl/modules/IRC/lib/BarnOwl/Module/IRC.pm

    rb8a3e00 r926c721  
    2121
    2222use AnyEvent::IRC;
     23use Encode;
     24use File::Spec;
    2325use Getopt::Long;
    24 use Encode;
     26use Text::Wrap;
    2527
    2628our $VERSION = 0.02;
     29
     30our $IRC_SUBS_FILENAME = "ircchannels";
    2731
    2832our $irc;
     
    6771       });
    6872
     73    BarnOwl::new_variable_int('irc:max-message-length', {
     74        default     => 450,
     75        summary     => 'Split messages to at most this many characters.' .
     76                       "If non-positive, don't split messages",
     77        description => 'If set to a positive number, any paragraph in an ' .
     78                       'IRC message will be split after this many characters.'
     79       });
     80
    6981    register_commands();
    7082    BarnOwl::filter(qw{irc type ^IRC$ or ( type ^admin$ and adminheader ^IRC$ )});
     
    129141argument listed above, and die if no channel argument can be found.
    130142
     143=item C<CHANNEL_OR_USER>
     144
     145Pass the channel argument, but accept it if it's a username (e.g.
     146has no hash).  Only relevant with C<CHANNEL_ARG>.
     147
    131148=item C<CHANNEL_OPTIONAL>
    132149
     
    145162use constant CHANNEL_ARG        => 1;
    146163use constant CHANNEL_OPTIONAL   => 2;
    147 
    148 use constant ALLOW_DISCONNECTED => 4;
     164use constant CHANNEL_OR_USER    => 4;
     165
     166use constant ALLOW_DISCONNECTED => 8;
    149167
    150168sub register_commands {
     
    154172            summary => 'Connect to an IRC server',
    155173            usage =>
    156 'irc-connect [-a ALIAS ] [-s] [-p PASSWORD] [-n NICK] SERVER [port]',
     174'irc-connect [-a ALIAS] [-s] [-p PASSWORD] [-n NICK] SERVER [port]',
    157175            description => <<END_DESCR
    158176Connect to an IRC server. Supported options are:
     
    188206
    189207    BarnOwl::new_command(
    190         'irc-msg' => mk_irc_command( \&cmd_msg ),
     208        'irc-msg' => mk_irc_command( \&cmd_msg, CHANNEL_OR_USER|CHANNEL_ARG|CHANNEL_OPTIONAL ),
    191209        {
    192210            summary => 'Send an IRC message',
     
    215233        {
    216234            summary => 'Join an IRC channel',
    217             usage   => 'irc-join [-a ALIAS] #channel [KEY]',
    218 
    219             description => <<END_DESCR
    220 Join an IRC channel.
     235            usage   => 'irc-join [-a ALIAS] [-t] #channel [KEY]',
     236
     237            description => <<END_DESCR
     238Join an IRC channel.  If the -t option is present the subscription will only be
     239temporary, i.e., it will not be written to the subscription file and will
     240therefore not be present the next time BarnOwl is started, and will disappear
     241if the connection is lost.
    221242END_DESCR
    222243        }
     
    227248        {
    228249            summary => 'Leave an IRC channel',
    229             usage   => 'irc-part [-a ALIAS] #channel',
    230 
    231             description => <<END_DESCR
    232 Part from an IRC channel.
     250            usage   => 'irc-part [-a ALIAS] [-t] #channel',
     251
     252            description => <<END_DESCR
     253Part from an IRC channel.  If the -t option is present the unsubscription will
     254only be temporary, i.e., it will not be updated in the subscription file and
     255will therefore not be in effect the next time BarnOwl is started, or if the
     256connection is lost.
    233257END_DESCR
    234258        }
     
    327351This can be used to perform some operation not yet supported by
    328352BarnOwl, or to define new IRC commands.
     353END_DESCR
     354        }
     355    );
     356
     357    BarnOwl::new_command(
     358        'irc-loadchannels' => \&cmd_loadchannels,
     359        {
     360            summary => 'Reload persistent channels',
     361            usage   => 'irc-loadchannels [-a ALIAS] [<file>]',
     362
     363            description => <<END_DESCR
     364Load persistent channels from a file.  The file defaults to
     365\$HOME/.owl/$IRC_SUBS_FILENAME.  If the ALIAS is present, only channels
     366on the given alias are loaded.  The ALIAS is case-sensitive.
     367
     368Each line of the file should describe a single channel, in the format
     369'\$alias \$channel' (without quotes).
    329370END_DESCR
    330371        }
     
    341382######################## Owl command handlers ##################################
    342383################################################################################
     384
     385sub make_autoconnect_filename {
     386    # can't use ||, or else we'll treat '0' as invalid.  We could check for eq "" ...
     387    # TODO(jgross): When we move to requiring perl 5.10, combine the
     388    # following two lines using //
     389    my $filename = shift;
     390    $filename = File::Spec->catfile(BarnOwl::get_config_dir(), $IRC_SUBS_FILENAME) unless defined $filename;
     391    if (!File::Spec->file_name_is_absolute($filename)) {
     392        $filename = File::Spec->catfile($ENV{HOME}, $filename);
     393    }
     394    return $filename;
     395}
     396
     397sub _get_autoconnect_lines {
     398    my $filename = shift;
     399
     400    # TODO(jgross): Write a C-side function to do this, asynchronously;
     401    #               AIUI, perl doesn't do asynchronous I/O in any useful way
     402    if (open (my $subsfile, "<:encoding(UTF-8)", $filename)) {
     403        my @lines = <$subsfile>;
     404        close($subsfile);
     405
     406        # strip trailing newlines
     407        local $/ = "";
     408        chomp(@lines);
     409
     410        return @lines;
     411    }
     412
     413    return ();
     414}
     415
     416sub get_autoconnect_channels {
     417    my $filename = make_autoconnect_filename(shift);
     418    my %channel_hash = ();
     419
     420    # Load the subs from the file
     421    my @lines = _get_autoconnect_lines($filename);
     422
     423    foreach my $line (@lines) {
     424        my @parsed_args = split(' ', $line);
     425        if (scalar @parsed_args == 2) {
     426            push @{$channel_hash{$parsed_args[0]}}, $parsed_args[1];
     427        } else {
     428            warn "Trouble parsing irc configuration file '$filename' line '$line'; the format is '\$alias \$channel', with no spaces in either\n";
     429        }
     430    }
     431
     432    return %channel_hash;
     433}
     434
     435sub add_autoconnect_channel {
     436    my $conn = shift;
     437    my $channel = shift;
     438    my $alias = $conn->alias;
     439    my $filename = make_autoconnect_filename(shift);
     440
     441    # we already checked for spaces in $channel in cmd_join, but we still need
     442    # to check $alias
     443    die "Alias name '$alias' contains a space; parsing will fail.  Use the -t flag.\n" unless index($alias, " ") == -1;
     444
     445    my $line = "$alias $channel";
     446
     447    my @lines = _get_autoconnect_lines($filename);
     448
     449    # We don't want to be noisy about duplicated joins.  For example, some
     450    # people might have :irc-join in startup files, even though that doesn't
     451    # work correctly anymore because connect is asynchronous and so join on
     452    # startup races with connect.  Regardless, just fail silently if the line
     453    # already exists.
     454    return if grep { $_ eq $line } @lines;
     455
     456    open (my $subsfile, ">>:encoding(UTF-8)", make_autoconnect_filename($filename))
     457        or die "Cannot open $filename for writing: $!\n";
     458    local $, = "";
     459    local $/ = "";
     460    print $subsfile "$line\n";
     461    close($subsfile);
     462}
     463
     464sub remove_autoconnect_channel {
     465    my $conn = shift;
     466    my $channel = shift;
     467    my $alias = $conn->alias;
     468    my $filename = make_autoconnect_filename(shift);
     469
     470    BarnOwl::Internal::file_deleteline($filename, "$alias $channel", 1);
     471}
     472
     473sub cmd_loadchannels {
     474    my $cmd = shift;
     475    my $alias;
     476    my $getopt = Getopt::Long::Parser->new;
     477
     478    local @ARGV = @_;
     479    $getopt->configure(qw(pass_through permute no_getopt_compat prefix_pattern=-|--));
     480    $getopt->getoptions("alias=s" => \$alias);
     481
     482    my %channel_hash = get_autoconnect_channels(@ARGV);
     483
     484    my $aliases = (defined $alias) ? [$alias] : [keys %channel_hash];
     485
     486    foreach my $cur_alias (@$aliases) {
     487        # get_connection_by_alias might die, and we don't want to
     488        eval {
     489            my $conn = get_connection_by_alias($cur_alias, 1);
     490            my %existing_channels = map { $_ => 1 } @{$conn->autoconnect_channels}, @{$channel_hash{$cur_alias}};
     491            $conn->autoconnect_channels([keys %existing_channels]);
     492        };
     493        foreach my $channel (@{$channel_hash{$cur_alias}}) {
     494            if ($cur_alias eq "") {
     495                BarnOwl::command("irc-join", "-t", $channel);
     496            } else {
     497                BarnOwl::command("irc-join", "-t", "-a", $cur_alias, $channel);
     498            }
     499        }
     500    }
     501}
    343502
    344503sub cmd_connect {
     
    378537    }
    379538
     539    my %channel_hash = get_autoconnect_channels;
     540
    380541    my $conn = BarnOwl::Module::IRC::Connection->new($alias, $host, $port, {
    381         nick      => $nick,
    382         user      => $username,
    383         real      => $ircname,
    384         password  => $password,
    385         SSL       => $ssl,
    386         timeout   => sub {0}
     542        nick                 => $nick,
     543        user                 => $username,
     544        real                 => $ircname,
     545        password             => $password,
     546        SSL                  => $ssl,
     547        timeout              => sub {0},
     548        autoconnect_channels => $channel_hash{$alias}
    387549       });
    388550    $ircnets{$alias} = $conn;
     
    427589    @msgs = split "\n\n", $fullbody;
    428590    map { tr/\n/ / } @msgs;
     591    # split each body at irc:max-message-length characters, if that number
     592    # is positive.  Only split at space boundaries.  Start counting a-fresh
     593    # at the beginning of each paragraph
     594    my $max_len = BarnOwl::getvar('irc:max-message-length');
     595    if ($max_len > 0) {
     596        local($Text::Wrap::columns) = $max_len;
     597        @msgs = split "\n", wrap("", "", join "\n", @msgs);
     598    }
    429599    for my $body (@msgs) {
    430600        if ($body =~ /^\/me (.*)/) {
     
    463633sub cmd_join {
    464634    my $cmd = shift;
    465     my $conn = shift;
    466     my $chan = shift or die("Usage: $cmd channel\n");
    467     $conn->conn->send_msg(join => $chan, @_);
     635    my $is_temporary;
     636
     637    my $getopt = Getopt::Long::Parser->new;
     638
     639    local @ARGV = @_;
     640    $getopt->configure(qw(pass_through permute no_getopt_compat prefix_pattern=-|--));
     641    $getopt->getoptions("temporary" => \$is_temporary);
     642
     643    my $conn = shift @ARGV;
     644    my $chan = shift @ARGV or die("Usage: $cmd channel\n");
     645
     646    die "Channel name '$chan' contains a space.  As per RFC 2812, IRC channel names may not contain spaces.\n" unless index($chan, " ") == -1;
     647
     648    $conn->conn->send_msg(join => $chan, @ARGV);
     649
     650    # regardless of whether or not this is temporary, we want to persist it
     651    # across reconnects.
     652
     653    # check if the channel is already in the list
     654    if (!grep { $_ eq $chan } @{$conn->autoconnect_channels}) {
     655        push @{$conn->autoconnect_channels}, $chan;
     656    }
     657
     658    if (!$is_temporary) {
     659        # add the line to the subs file
     660        add_autoconnect_channel($conn, $chan);
     661    }
     662
    468663    return;
    469664}
     
    471666sub cmd_part {
    472667    my $cmd = shift;
    473     my $conn = shift;
    474     my $chan = shift;
     668    my $is_temporary;
     669
     670    my $getopt = Getopt::Long::Parser->new;
     671
     672    local @ARGV = @_;
     673    $getopt->configure(qw(pass_through permute no_getopt_compat prefix_pattern=-|--));
     674    $getopt->getoptions("temporary" => \$is_temporary);
     675
     676    my $conn = shift @ARGV;
     677    my $chan = shift @ARGV or die("Usage: $cmd channel\n");
     678
    475679    $conn->conn->send_msg(part => $chan);
     680
     681    # regardless of whether or not this is temporary, we want to persist it
     682    # across reconnects
     683    my %existing_channels = map { $_ => 1 } @{$conn->autoconnect_channels};
     684    delete $existing_channels{$chan};
     685    $conn->autoconnect_channels([keys %existing_channels]);
     686
     687    if (!$is_temporary) {
     688        # remove the line from the subs file
     689        remove_autoconnect_channel($conn, $chan);
     690    }
     691
    476692    return;
    477693}
     
    573789        my $alias;
    574790        my $channel;
     791        my $is_temporary;
    575792        my $getopt = Getopt::Long::Parser->new;
    576793        my $m = BarnOwl::getcurmsg();
     
    578795        local @ARGV = @_;
    579796        $getopt->configure(qw(pass_through permute no_getopt_compat prefix_pattern=-|--));
    580         $getopt->getoptions("alias=s" => \$alias);
     797        $getopt->getoptions("alias=s" => \$alias,
     798                            "temporary" => \$is_temporary);
    581799
    582800        if(defined($alias)) {
     
    591809                    $conn ||= $c;
    592810                }
     811            } elsif (defined($channel) && ($flags & CHANNEL_OR_USER)) {
     812                shift @ARGV;
    593813            } elsif ($m && $m->type eq 'IRC' && !$m->is_private) {
    594814                $channel = $m->channel;
     
    598818        }
    599819
    600         if(!$channel &&
     820        if(!defined($channel) &&
    601821           ($flags & CHANNEL_ARG) &&
    602822           !($flags & CHANNEL_OPTIONAL)) {
     
    615835            die("You must specify an IRC network using -a.\n");
    616836        }
     837        push @ARGV, "-t" if $is_temporary;
    617838        if($flags & CHANNEL_ARG) {
    618839            $sub->($cmd, $conn, $channel, @ARGV);
  • perl/modules/IRC/lib/BarnOwl/Module/IRC/Completion.pm

    rdace02a r76e80de  
    5757}
    5858
     59sub complete_irc_join_part {
     60    my $ctx = shift;
     61    return complete_flags($ctx,
     62        [qw(-t)],
     63        {
     64            "-a" => \&complete_networks,
     65        },
     66        \&complete_channels
     67       );
     68}
     69
    5970sub complete_irc_channel {
    6071    my $ctx = shift;
     
    95106BarnOwl::Completion::register_completer('irc-msg'        => \&complete_irc_dest);
    96107BarnOwl::Completion::register_completer('irc-mode'       => \&complete_irc_dest);
    97 BarnOwl::Completion::register_completer('irc-join'       => \&complete_irc_channel);
    98 BarnOwl::Completion::register_completer('irc-part'       => \&complete_irc_channel);
     108BarnOwl::Completion::register_completer('irc-join'       => \&complete_irc_join_part);
     109BarnOwl::Completion::register_completer('irc-part'       => \&complete_irc_join_part);
    99110BarnOwl::Completion::register_completer('irc-names'      => \&complete_irc_channel);
    100111BarnOwl::Completion::register_completer('irc-whois'      => \&complete_irc_nick);
  • perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm

    r13ee8f2 rbe43554  
    3939    my $self = bless({}, $class);
    4040    $self->conn($conn);
    41     $self->autoconnect_channels([]);
     41    # TODO(jgross): use // when we move to requiring perl 5.10
     42    $self->autoconnect_channels(defined $args->{autoconnect_channels} ? $args->{autoconnect_channels} : []);
    4243    $self->alias($alias);
    4344    $self->server($host);
     
    412413        $self->{reconnect_timer}->stop;
    413414    }
    414     $self->{reconnect_timer} = 
     415    $self->{reconnect_timer} =
    415416        BarnOwl::Timer->new( {
    416417            name  => 'IRC (' . $self->alias . ') reconnect_timer',
     
    445446            $self->conn->send_msg(join => $c);
    446447        }
    447         $self->autoconnect_channels([]);
    448448    }
    449449    $self->conn->enable_ping(60, sub {
     
    458458    my $backoff = $self->backoff;
    459459
    460     $self->autoconnect_channels([keys(%{$self->{channel_list}})]);
    461460    $self->conn->connect(@{$self->connect_args});
    462461}
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm

    rb8a3e00 r41064be  
    320320              . "configure [<muc>]\n"
    321321              . "            Configures a MUC.\n"
    322               . "            Necessary to initalize a new MUC.\n"
     322              . "            Necessary to initialize a new MUC.\n"
    323323              . "            At present, only the default configuration is supported.\n"
    324324              . "            The MUC is taken from the current message if not supplied.\n\n"
     
    13131313    {
    13141314        my @answer = $packet->answer;
    1315         return $answer[0]{target}, $answer[0]{port};
     1315        return $answer[0]->target, $answer[0]->port if @answer;
    13161316    }
    13171317
     
    14821482}
    14831483
     1484sub complete_jabberlogout {
     1485    my $ctx = shift;
     1486    if($ctx->word == 1) {
     1487        return ("-A", complete_account() );
     1488    } else {
     1489        return ();
     1490    }
     1491}
     1492
    14841493BarnOwl::Completion::register_completer(jwrite => sub { BarnOwl::Module::Jabber::complete_jwrite(@_) });
     1494BarnOwl::Completion::register_completer(jabberlogout => sub { BarnOwl::Module::Jabber::complete_jabberlogout(@_) });
    14851495
    148614961;
  • perl/modules/Jabber/lib/Net/Jabber/Component.pm

    rc2bed55 ra8c55b5  
    220220    $self->{STREAM}->SetCallBacks(node=>undef);
    221221
    222     $self->Send("<handshake>".Digest::SHA1::sha1_hex($self->{SESSION}->{id}.$args{secret})."</handshake>");
     222    $self->Send("<handshake>".Digest::SHA::sha1_hex($self->{SESSION}->{id}.$args{secret})."</handshake>");
    223223    my $handshake = $self->Process();
    224224
  • perl/modules/Jabber/lib/Net/Jabber/Key.pm

    rc2bed55 ra8c55b5  
    104104    $self->{CACHE} = {};
    105105
    106     if (eval "require Digest::SHA1")
     106    if (eval "require Digest::SHA")
    107107    {
    108108        $self->{DIGEST} = 1;
    109         Digest::SHA1->import(qw(sha1 sha1_hex sha1_base64));
     109        Digest::SHA->import(qw(sha1 sha1_hex sha1_base64));
    110110    }
    111111    else
    112112    {
    113         print "ERROR:  You cannot use Key.pm unless you have Digest::SHA1 installed.\n";
     113        print "ERROR:  You cannot use Key.pm unless you have Digest::SHA installed.\n";
    114114        exit(0);
    115115    }
     
    132132
    133133    my $string = $$.time.rand(1000000);
    134     $string = Digest::SHA1::sha1_hex($string);
     134    $string = Digest::SHA::sha1_hex($string);
    135135    $self->{DEBUG}->Log1("Generate: key($string)");
    136136    return $string;
  • perl/modules/Jabber/lib/Net/XMPP.pm

    rc2bed55 ra8c55b5  
    213213use Time::Local;
    214214use Carp;
    215 use Digest::SHA1;
     215use Digest::SHA;
    216216use Authen::SASL;
    217217use MIME::Base64;
  • perl/modules/Jabber/lib/Net/XMPP/Protocol.pm

    r7f33c18 ra8c55b5  
    18491849    if ($authType eq "zerok")
    18501850    {
    1851         my $hashA = Digest::SHA1::sha1_hex($password);
    1852         $args{hash} = Digest::SHA1::sha1_hex($hashA.$token);
     1851        my $hashA = Digest::SHA::sha1_hex($password);
     1852        $args{hash} = Digest::SHA::sha1_hex($hashA.$token);
    18531853
    18541854        for (1..$sequence)
    18551855        {
    1856             $args{hash} = Digest::SHA1::sha1_hex($args{hash});
     1856            $args{hash} = Digest::SHA::sha1_hex($args{hash});
    18571857        }
    18581858    }
     
    18681868    if ($authType eq "digest")
    18691869    {
    1870         $args{digest} = Digest::SHA1::sha1_hex($self->GetStreamID().$password);
     1870        $args{digest} = Digest::SHA::sha1_hex($self->GetStreamID().$password);
    18711871    }
    18721872
  • perl/modules/Makefile.am

    r1fd469d4 re4b8f93  
    1 MODULES = Jabber IRC WordWrap Twitter
     1MODULES = Jabber IRC WordWrap Twitter Facebook
    22
    3 EXTRA_DIST = $(MODULES:=/Makefile.PL) $(MODULES:=/inc) $(MODULES:=/lib)
     3EXTRA_DIST = $(MODULES:=/Makefile.PL) $(MODULES:=/lib)
     4EXTRA_DIST += \
     5    Facebook/README \
     6    Twitter/README \
     7    Twitter/twitter.example
    48
    59all-local: $(MODULES)
     
    711        (cd $* && $(MAKE) $*.par)
    812
     13BARNOWL_PERL := $(shell which perl) -I$(abs_srcdir)/../lib
     14
    915MODULES_MAKEFILE = $(MODULES:=/Makefile)
    10 $(MODULES_MAKEFILE): %/Makefile: %/Makefile.PL
    11         $(AM_V_GEN)(cd $* && perl -I../../lib Makefile.PL)
     16$(MODULES_MAKEFILE): %/Makefile: %/Makefile.PL ../lib/Module/Install/BarnOwl.pm
     17        $(AM_V_GEN)test -d $* || mkdir $*
     18        $(AM_V_at)test $(srcdir) = . || $(LN_S) $(abs_srcdir)/$*/Makefile.PL $*/Makefile.PL
     19        $(AM_V_at)(cd $* && BARNOWL_SRCDIR='$(abs_srcdir)/$*' && export BARNOWL_SRCDIR && $(BARNOWL_PERL) Makefile.PL 'PERL=$(BARNOWL_PERL)')
    1220
    1321MODULES_CLEAN = $(MODULES:%=clean_%)
    1422clean-local: $(MODULES_CLEAN)
    1523$(MODULES_CLEAN): clean_%:
    16         (cd $* && (test ! -f Makefile || $(MAKE) clean))
     24        (cd $* && { test ! -f Makefile || $(MAKE) realclean; })
     25        rm -f $*/$*.par
     26        rm -rf $*/inc
     27        test $(srcdir) = . || rm -f $*/Makefile.PL
    1728
    1829MODULES_INSTALL = $(MODULES:%=module_install_%)
     
    2334        ${INSTALL_DATA} $*/$*.par ${DESTDIR}${pkgdatadir}/modules/$*.par
    2435
     36uninstall-local:
     37        rm -f $(MODULES:%=${DESTDIR}${pkgdatadir}/modules/%.par)
     38
    2539.PHONY: $(MODULES) $(MODULES_CLEAN) $(MODULES_INSTALL)
  • perl/modules/Twitter/lib/BarnOwl/Module/Twitter.pm

    rb8a3e00 r140429f  
    137137        my $twitter_args = { username   => $cfg->{user},
    138138                             password   => $cfg->{password},
    139                              source     => 'barnowl',
     139                             source     => 'barnowl',
     140                             ssl        => 1,
     141                             legacy_lists_api => 0,
    140142                         };
    141143        if (defined $cfg->{service}) {
     
    274276);
    275277
     278BarnOwl::new_command( 'twitter-favorite' => sub { cmd_twitter_favorite(@_) },
     279    {
     280    summary     => 'Favorite the current Twitter message',
     281    usage       => 'twitter-favorite [ACCOUNT]',
     282    description => <<END_DESCRIPTION
     283Favorite the current Twitter message using ACCOUNT (defaults to the
     284account that received the tweet).
     285END_DESCRIPTION
     286    }
     287);
     288
    276289BarnOwl::new_command( 'twitter-follow' => sub { cmd_twitter_follow(@_); },
    277290    {
     
    355368    $account = $m->account unless defined($account);
    356369    find_account($account)->twitter_retweet($m);
     370    return;
     371}
     372
     373sub cmd_twitter_favorite {
     374    my $cmd = shift;
     375    my $account = shift;
     376    my $m = BarnOwl::getcurmsg();
     377    if(!$m || $m->type ne 'Twitter') {
     378        die("$cmd must be used with a Twitter message selected.\n");
     379    }
     380
     381    $account = $m->account unless defined($account);
     382    find_account($account)->twitter_favorite($m);
    357383    return;
    358384}
  • perl/modules/Twitter/lib/BarnOwl/Module/Twitter/Handle.pm

    r4ebbfbc r140429f  
    371371        $self->twitter_direct($1, $2);
    372372    } elsif(defined $self->{twitter}) {
    373         if(length($msg) > 140) {
    374             die("Twitter: Message over 140 characters long.\n");
    375         }
    376373        $self->twitter_command('update', {
    377374            status => $msg,
     
    432429}
    433430
     431sub twitter_favorite {
     432    my $self = shift;
     433    my $msg = shift;
     434
     435    if($msg->service ne $self->{cfg}->{service}) {
     436        die("Cannot favorite a message from a different service.\n");
     437    }
     438    $self->twitter_command(create_favorite => $msg->{status_id});
     439}
     440
     441
    434442sub twitter_follow {
    435443    my $self = shift;
  • perlconfig.c

    rb9517cf r7dcef03  
    7575  const char *type;
    7676  char *ptr, *utype, *blessas;
    77   int i, j;
     77  const char *f;
     78  int i;
    7879  const owl_pair *pair;
    7980  const owl_filter *wrap;
     
    9192                                      owl_new_sv(owl_message_get_##field(m)), 0)
    9293
    93   if (owl_message_get_notice(m)) {
     94  if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) {
    9495    /* Handle zephyr-specific fields... */
    95     AV *av_zfields;
    96 
    97     av_zfields = newAV();
    98     j=owl_zephyr_get_num_fields(owl_message_get_notice(m));
    99     for (i=0; i<j; i++) {
    100       ptr=owl_zephyr_get_field_as_utf8(owl_message_get_notice(m), i+1);
    101       av_push(av_zfields, owl_new_sv(ptr));
    102       g_free(ptr);
     96    AV *av_zfields = newAV();
     97    if (owl_message_get_notice(m)) {
     98      for (f = owl_zephyr_first_raw_field(owl_message_get_notice(m)); f != NULL;
     99           f = owl_zephyr_next_raw_field(owl_message_get_notice(m), f)) {
     100        ptr = owl_zephyr_field_as_utf8(owl_message_get_notice(m), f);
     101        av_push(av_zfields, owl_new_sv(ptr));
     102        g_free(ptr);
     103      }
     104      (void)hv_store(h, "auth", strlen("auth"),
     105                     owl_new_sv(owl_zephyr_get_authstr(owl_message_get_notice(m))), 0);
     106    } else {
     107      /* Incoming zephyrs without a ZNotice_t are pseudo-logins. To appease
     108       * existing styles, put in bogus 'auth' and 'fields' keys. */
     109      (void)hv_store(h, "auth", strlen("auth"), owl_new_sv("NO"), 0);
    103110    }
    104111    (void)hv_store(h, "fields", strlen("fields"), newRV_noinc((SV*)av_zfields), 0);
    105 
    106     (void)hv_store(h, "auth", strlen("auth"),
    107                    owl_new_sv(owl_zephyr_get_authstr(owl_message_get_notice(m))),0);
    108112  }
    109113
     
    184188  hash = (HV*)SvRV(msg);
    185189
    186   m = g_new(owl_message, 1);
     190  m = g_slice_new(owl_message);
    187191  owl_message_init(m);
    188192
     
    224228CALLER_OWN char *owl_perlconfig_call_with_message(const char *subname, const owl_message *m)
    225229{
    226   dSP ;
    227   int count;
    228   SV *msgref, *srv;
    229   char *out;
    230  
    231   ENTER ;
    232   SAVETMPS;
    233  
    234   PUSHMARK(SP) ;
     230  SV *msgref, *rv;
     231  char *out = NULL;
     232
    235233  msgref = owl_perlconfig_message2hashref(m);
    236   XPUSHs(sv_2mortal(msgref));
    237   PUTBACK ;
    238  
    239   count = call_pv(subname, G_SCALAR|G_EVAL);
    240  
    241   SPAGAIN ;
    242 
    243   if (SvTRUE(ERRSV)) {
    244     owl_function_error("Perl Error: '%s'", SvPV_nolen(ERRSV));
    245     /* and clear the error */
    246     sv_setsv (ERRSV, &PL_sv_undef);
    247   }
    248 
    249   if (count != 1) {
    250     fprintf(stderr, "bad perl!  no biscuit!  returned wrong count!\n");
    251     abort();
    252   }
    253 
    254   srv = POPs;
    255 
    256   if (srv) {
    257     out = g_strdup(SvPV_nolen(srv));
    258   } else {
    259     out = NULL;
    260   }
    261  
    262   PUTBACK ;
    263   FREETMPS ;
    264   LEAVE ;
    265 
     234
     235  OWL_PERL_CALL((call_pv(subname, G_SCALAR|G_EVAL))
     236                ,
     237                XPUSHs(sv_2mortal(msgref));
     238                ,
     239                "Perl Error: '%s'"
     240                ,
     241                false
     242                ,
     243                false
     244                ,
     245                rv = POPs;
     246                if (rv && SvPOK(rv))
     247                  out = g_strdup(SvPV_nolen(rv));
     248                );
    266249  return out;
    267250}
     
    273256CALLER_OWN char *owl_perlconfig_message_call_method(const owl_message *m, const char *method, int argc, const char **argv)
    274257{
    275   dSP;
    276   unsigned int count, i;
    277   SV *msgref, *srv;
    278   char *out;
     258  SV *msgref, *rv;
     259  char *out = NULL;
     260  int i;
    279261
    280262  msgref = owl_perlconfig_message2hashref(m);
    281263
    282   ENTER;
    283   SAVETMPS;
    284 
    285   PUSHMARK(SP);
    286   XPUSHs(sv_2mortal(msgref));
    287   for(i=0;i<argc;i++) {
    288     XPUSHs(sv_2mortal(owl_new_sv(argv[i])));
    289   }
    290   PUTBACK;
    291 
    292   count = call_method(method, G_SCALAR|G_EVAL);
    293 
    294   SPAGAIN;
    295 
    296   if(count != 1) {
    297     fprintf(stderr, "perl returned wrong count %u\n", count);
    298     abort();
    299   }
    300 
    301   if (SvTRUE(ERRSV)) {
    302     owl_function_error("Error: '%s'", SvPV_nolen(ERRSV));
    303     /* and clear the error */
    304     sv_setsv (ERRSV, &PL_sv_undef);
    305   }
    306 
    307   srv = POPs;
    308 
    309   if (srv) {
    310     out = g_strdup(SvPV_nolen(srv));
    311   } else {
    312     out = NULL;
    313   }
    314 
    315   PUTBACK;
    316   FREETMPS;
    317   LEAVE;
    318 
     264  OWL_PERL_CALL(call_method(method, G_SCALAR|G_EVAL)
     265                ,
     266                XPUSHs(sv_2mortal(msgref));
     267                OWL_PERL_PUSH_ARGS(i, argc, argv);
     268                ,
     269                "Perl Error: '%s'"
     270                ,
     271                false
     272                ,
     273                false
     274                ,
     275                rv = POPs;
     276                if (rv && SvPOK(rv))
     277                  out = g_strdup(SvPV_nolen(rv));
     278                );
    319279  return out;
    320280}
     
    327287  char *err;
    328288  const char *args[4] = {"", "-e", "0;", NULL};
     289  const char *dlerr;
    329290  AV *inc;
    330291  char *path;
     
    375336  }
    376337
    377   sv_setpv(get_sv("BarnOwl::VERSION", TRUE), OWL_VERSION_STRING);
     338  sv_setpv(get_sv("BarnOwl::VERSION", TRUE), version);
    378339
    379340  /* Add the system lib path to @INC */
     
    384345  g_free(path);
    385346
     347  /* Load up perl-Glib. */
     348  eval_pv("use Glib;", FALSE);
     349
     350  /* Now, before BarnOwl tries to use them, get the relevant function pointers out. */
     351  dlerr = owl_closure_init();
     352  if (dlerr) {
     353    return g_strdup(dlerr);
     354  }
     355
     356  /* And now it's safe to import BarnOwl. */
    386357  eval_pv("use BarnOwl;", FALSE);
    387358
     
    455426void owl_perlconfig_new_command(const char *name)
    456427{
    457   dSP;
    458 
    459   ENTER;
    460   SAVETMPS;
    461 
    462   PUSHMARK(SP);
    463   XPUSHs(sv_2mortal(owl_new_sv(name)));
    464   PUTBACK;
    465 
    466   call_pv("BarnOwl::Hooks::_new_command", G_VOID|G_EVAL);
    467 
    468   SPAGAIN;
    469 
    470   if(SvTRUE(ERRSV)) {
    471     owl_function_error("%s", SvPV_nolen(ERRSV));
    472   }
    473 
    474   FREETMPS;
    475   LEAVE;
     428  OWL_PERL_CALL(call_pv("BarnOwl::Hooks::_new_command", G_VOID|G_EVAL);
     429                ,
     430                XPUSHs(sv_2mortal(owl_new_sv(name)));
     431                ,
     432                "Perl Error: '%s'"
     433                ,
     434                false
     435                ,
     436                true
     437                ,
     438                );
     439}
     440
     441CALLER_OWN char *owl_perlconfig_perl_call(const char *method, int argc, const char *const *argv)
     442{
     443  SV *rv;
     444  char *out = NULL;
     445  int i;
     446  OWL_PERL_CALL(call_pv(method, G_SCALAR|G_EVAL)
     447                ,
     448                OWL_PERL_PUSH_ARGS(i, argc, argv);
     449                ,
     450                "Perl Error: '%s'"
     451                ,
     452                false
     453                ,
     454                false
     455                ,
     456                rv = POPs;
     457                if (rv && SvPOK(rv))
     458                  out = g_strdup(SvPV_nolen(rv));
     459                );
     460  return out;
     461}
     462
     463int owl_perlconfig_perl_call_int(const char *method, int argc, const char *const *argv)
     464{
     465  SV *rv;
     466  int ret = -1;
     467  int i;
     468  OWL_PERL_CALL(call_pv(method, G_SCALAR|G_EVAL)
     469                ,
     470                OWL_PERL_PUSH_ARGS(i, argc, argv);
     471                ,
     472                "Perl Error: '%s'"
     473                ,
     474                false
     475                ,
     476                false
     477                ,
     478                rv = POPs;
     479                if (rv && SvIOK(rv))
     480                  ret = SvIV(rv);
     481                );
     482  return ret;
     483}
     484
     485bool owl_perlconfig_perl_call_bool(const char *method, int argc, const char *const *argv)
     486{
     487  SV *rv;
     488  bool ret = false;
     489  int i;
     490  OWL_PERL_CALL(call_pv(method, G_SCALAR|G_EVAL)
     491                ,
     492                OWL_PERL_PUSH_ARGS(i, argc, argv);
     493                ,
     494                "Perl Error: '%s'"
     495                ,
     496                false
     497                ,
     498                false
     499                ,
     500                rv = POPs;
     501                if (rv)
     502                  ret = SvTRUE(rv);
     503                );
     504  return ret;
     505}
     506
     507void owl_perlconfig_perl_call_norv(const char *method, int argc, const char *const *argv)
     508{
     509  int i;
     510  OWL_PERL_CALL(call_pv(method, G_DISCARD|G_EVAL)
     511                ,
     512                OWL_PERL_PUSH_ARGS(i, argc, argv);
     513                ,
     514                "Perl Error: '%s'"
     515                ,
     516                false
     517                ,
     518                true
     519                ,
     520                );
    476521}
    477522
     
    479524CALLER_OWN char *owl_perlconfig_perlcmd(const owl_cmd *cmd, int argc, const char *const *argv)
    480525{
    481   int i, count;
    482   char * ret = NULL;
    483   SV *rv;
    484   dSP;
    485 
    486   ENTER;
    487   SAVETMPS;
    488 
    489   PUSHMARK(SP);
    490   for(i=0;i<argc;i++) {
    491     XPUSHs(sv_2mortal(owl_new_sv(argv[i])));
    492   }
    493   PUTBACK;
    494 
    495   count = call_sv(cmd->cmd_perl, G_SCALAR|G_EVAL);
    496 
    497   SPAGAIN;
    498 
    499   if(SvTRUE(ERRSV)) {
    500     owl_function_error("%s", SvPV_nolen(ERRSV));
    501     (void)POPs;
    502   } else {
    503     if(count != 1)
    504       croak("Perl command %s returned more than one value!", cmd->name);
    505     rv = POPs;
    506     if(SvTRUE(rv)) {
    507       ret = g_strdup(SvPV_nolen(rv));
    508     }
    509   }
    510 
    511   FREETMPS;
    512   LEAVE;
    513 
    514   return ret;
     526  int i;
     527  SV* rv;
     528  char *out = NULL;
     529
     530  OWL_PERL_CALL(call_sv(cmd->cmd_perl, G_SCALAR|G_EVAL)
     531                ,
     532                OWL_PERL_PUSH_ARGS(i, argc, argv);
     533                ,
     534                "Perl Error: '%s'"
     535                ,
     536                false
     537                ,
     538                false
     539                ,
     540                rv = POPs;
     541                if (rv && SvPOK(rv))
     542                  out = g_strdup(SvPV_nolen(rv));
     543                );
     544  return out;
    515545}
    516546
     
    520550}
    521551
    522 void owl_perlconfig_edit_callback(owl_editwin *e)
     552void owl_perlconfig_edit_callback(owl_editwin *e, bool success)
    523553{
    524554  SV *cb = owl_editwin_get_cbdata(e);
    525   SV *text;
    526   dSP;
    527 
    528   if(cb == NULL) {
     555  SV *text = owl_new_sv(owl_editwin_get_text(e));
     556
     557  if (cb == NULL) {
    529558    owl_function_error("Perl callback is NULL!");
    530559    return;
    531560  }
    532   text = owl_new_sv(owl_editwin_get_text(e));
    533 
    534   ENTER;
    535   SAVETMPS;
    536 
    537   PUSHMARK(SP);
    538   XPUSHs(sv_2mortal(text));
    539   PUTBACK;
    540  
    541   call_sv(cb, G_DISCARD|G_EVAL);
    542 
    543   if(SvTRUE(ERRSV)) {
    544     owl_function_error("%s", SvPV_nolen(ERRSV));
    545   }
    546 
    547   FREETMPS;
    548   LEAVE;
     561
     562  OWL_PERL_CALL(call_sv(cb, G_DISCARD|G_EVAL)
     563                ,
     564                XPUSHs(sv_2mortal(text));
     565                XPUSHs(sv_2mortal(newSViv(success)));
     566                ,
     567                "Perl Error: '%s'"
     568                ,
     569                false
     570                ,
     571                true
     572                ,
     573                );
    549574}
    550575
  • perlglue.xs

    rf271129 r7dcef03  
    6767        OUTPUT:
    6868                RETVAL
    69                
     69
     70int
     71getnumlines()
     72        CODE:
     73                RETVAL = owl_global_get_lines(&g);
     74        OUTPUT:
     75                RETVAL
     76
    7077time_t
    7178getidletime()
     
    8895        OUTPUT:
    8996                RETVAL
    90 
    91 void
    92 zephyr_zwrite(cmd,msg)
    93         const char *cmd
    94         const char *msg
    95         PREINIT:
    96                 int i;
    97         CODE:
    98                 i = owl_zwrite_create_and_send_from_line(cmd, msg);
    9997
    10098const utf8 *
     
    165163        {
    166164                owl_function_adminmsg(header, body);           
    167         }
    168 
    169 void
    170 start_question(line, callback)
    171         const char *line
    172         SV *callback
    173         PREINIT:
    174                 owl_editwin *e;
    175         CODE:
    176         {
    177                 if(!SV_IS_CODEREF(callback))
    178                         croak("Callback must be a subref");
    179 
    180                 e = owl_function_start_question(line);
    181 
    182                 owl_editwin_set_cbdata(e,
    183                                        newSVsv(callback),
    184                                        owl_perlconfig_dec_refcnt);
    185                 owl_editwin_set_callback(e, owl_perlconfig_edit_callback);
    186         }
    187 
    188 void
    189 start_password(line, callback)
    190         const char *line
    191         SV *callback
    192         PREINIT:
    193                 owl_editwin *e;
    194         CODE:
    195         {
    196                 if(!SV_IS_CODEREF(callback))
    197                         croak("Callback must be a subref");
    198 
    199                 e = owl_function_start_password(line);
    200 
    201                 owl_editwin_set_cbdata(e,
    202                                        newSVsv(callback),
    203                                        owl_perlconfig_dec_refcnt);
    204                 owl_editwin_set_callback(e, owl_perlconfig_edit_callback);
    205         }
    206 
    207 void
    208 start_edit_win(line, callback)
    209         const char *line
    210         SV *callback
    211         CODE:
    212         {
    213                 if(!SV_IS_CODEREF(callback))
    214                         croak("Callback must be a subref");
    215 
    216                 owl_function_start_edit_win(line,
    217                                             owl_perlconfig_edit_callback,
    218                                             newSVsv(callback),
    219                                             owl_perlconfig_dec_refcnt);
    220165        }
    221166
     
    287232     CODE:
    288233        {
    289                 s = g_new(owl_style, 1);
     234                s = g_slice_new(owl_style);
    290235                owl_style_create_perl(s, name, newSVsv(object));
    291236                owl_global_add_style(&g, s);
     
    311256        }
    312257
     258bool
     259message_matches_filter(message, filter_name, quiet = false)
     260        SV *message
     261        const char *filter_name
     262        bool quiet
     263        PREINIT:
     264                owl_message *m;
     265                const owl_filter *f;
     266        CODE:
     267        {
     268                if (!SvROK(message) || SvTYPE(SvRV(message)) != SVt_PVHV) {
     269                        croak("Usage: BarnOwl::message_matches_filter($message, $filter_name[, $quiet])");
     270                }
     271
     272                m = owl_perlconfig_hashref2message(message);
     273                f = owl_global_get_filter(&g, filter_name);
     274                if (!f && !quiet) {
     275                        owl_function_error("%s filter is not defined", filter_name);
     276                }
     277                RETVAL = f && owl_filter_message_match(f, m);
     278        }
     279        OUTPUT:
     280                RETVAL
     281        CLEANUP:
     282                owl_message_delete(m);
     283
    313284const utf8 *
    314285wordwrap(in, cols)
     
    426397MODULE = BarnOwl                PACKAGE = BarnOwl::Internal
    427398
     399
     400int
     401file_deleteline(filename, line, backup)
     402        const char *filename
     403        const char *line
     404        int backup
     405        CODE:
     406                RETVAL = owl_util_file_deleteline(filename, line, backup);
     407        OUTPUT:
     408                RETVAL
    428409
    429410void
     
    457438           }
    458439
    459 void
    460 new_variable_string(name, ival, summ, desc)
    461         const char * name
    462         const char * ival
    463         const char * summ
    464         const char * desc
    465         CODE:
    466         owl_variable_dict_newvar_string(owl_global_get_vardict(&g),
    467                                         name,
    468                                         summ,
    469                                         desc,
    470                                         ival);
    471 
    472 void
    473 new_variable_int(name, ival, summ, desc)
    474         const char * name
    475         int ival
    476         const char * summ
    477         const char * desc
    478         CODE:
    479         owl_variable_dict_newvar_int(owl_global_get_vardict(&g),
    480                                      name,
    481                                      summ,
    482                                      desc,
    483                                      ival);
    484 
    485 void
    486 new_variable_bool(name, ival, summ, desc)
    487         const char * name
    488         int ival
    489         const char * summ
    490         const char * desc
    491         CODE:
    492         owl_variable_dict_newvar_bool(owl_global_get_vardict(&g),
    493                                       name,
    494                                       summ,
    495                                       desc,
    496                                       ival);
     440
     441MODULE = BarnOwl                PACKAGE = BarnOwl::Internal
     442
     443void
     444new_variable(name, summary, description, validsettings, takes_on_off, get_tostring_fn, set_fromstring_fn, data)
     445    const char *name
     446    const char *summary
     447    const char *description
     448    const char *validsettings
     449    int takes_on_off
     450    SV *get_tostring_fn
     451    SV *set_fromstring_fn
     452    SV *data
     453    CODE:
     454{
     455        /* data is somewhat redundant given we can create closures, but oh
     456         * well. Might be convenient sometimes. */
     457        if(!SV_IS_CODEREF(get_tostring_fn)) {
     458                croak("To-string function must be a coderef!");
     459        }
     460        if(!SV_IS_CODEREF(set_fromstring_fn)) {
     461                croak("From-string function must be a coderef!");
     462        }
     463
     464        owl_variable_dict_newvar_other(owl_global_get_vardict(&g),
     465                                       name, summary, description, validsettings, takes_on_off,
     466                                       perl_closure_new(get_tostring_fn, data, false),
     467                                       perl_closure_new(set_fromstring_fn, data, false));
     468}
     469
     470void
     471start_edit(edit_type, line, callback)
     472        const char *edit_type
     473        const char *line
     474        SV *callback
     475        PREINIT:
     476                owl_editwin *e;
     477        CODE:
     478        {
     479                if (!SV_IS_CODEREF(callback))
     480                        croak("Callback must be a subref");
     481
     482                if (!strcmp(edit_type, "question"))
     483                        e = owl_function_start_question(line);
     484                else if (!strcmp(edit_type, "password"))
     485                        e = owl_function_start_password(line);
     486                else if (!strcmp(edit_type, "edit_win"))
     487                        e = owl_function_start_edit_win(line);
     488                else
     489                        croak("edit_type must be one of 'password', 'question', 'edit_win', not '%s'", edit_type);
     490
     491                owl_editwin_set_cbdata(e, newSVsv(callback), owl_perlconfig_dec_refcnt);
     492                owl_editwin_set_callback(e, owl_perlconfig_edit_callback);
     493        }
     494
     495int
     496zephyr_zwrite(cmd,msg)
     497        const char *cmd
     498        const char *msg
     499        CODE:
     500                RETVAL = owl_zwrite_create_and_send_from_line(cmd, msg);
     501        OUTPUT:
     502                RETVAL
    497503
    498504MODULE = BarnOwl                PACKAGE = BarnOwl::Editwin
  • popexec.c

    re146cd7 r7dcef03  
    2323  }
    2424
    25   pe = g_new(owl_popexec, 1);
     25  pe = g_slice_new(owl_popexec);
    2626  pe->winactive=0;
    2727  pe->pid=0;
     
    179179  if (pe->refcount<=0) {
    180180    owl_function_debugmsg("doing free of %p", pe);
    181     g_free(pe);
     181    g_slice_free(owl_popexec, pe);
    182182  }
    183183}
  • popwin.c

    r6829afc r7dcef03  
    33CALLER_OWN owl_popwin *owl_popwin_new(void)
    44{
    5   owl_popwin *pw = g_new0(owl_popwin, 1);
     5  owl_popwin *pw = g_slice_new0(owl_popwin);
    66
    77  pw->border = owl_window_new(NULL);
     
    9292  g_object_unref(pw->content);
    9393
    94   g_free(pw);
     94  g_slice_free(owl_popwin, pw);
    9595}
    9696
  • runtests.sh

    rf6ab6ee r7dcef03  
    11#!/bin/sh
    2 exec env HARNESS_PERL=./tester prove --failures t/
     2export G_SLICE=debug-blocks
     3exec env HARNESS_PERL=./tester prove --failures "${srcdir:=$(dirname "$0")}/t/"
  • select.c

    r84a071f r7dcef03  
    4141  if (t->destroy_cbdata)
    4242    t->destroy_cbdata(t->cbdata);
    43   g_free(t);
     43  g_slice_free(owl_task, t);
    4444}
    4545
     
    4747{
    4848  GSource *source = g_idle_source_new();
    49   owl_task *t = g_new0(owl_task, 1);
     49  owl_task *t = g_slice_new0(owl_task);
    5050  t->cb = cb;
    5151  t->cbdata = cbdata;
  • sepbar.c

    r6eb3ed9 ra38becd  
    6767  }
    6868
    69   if (owl_global_is_zaway(&g) || owl_global_is_aaway(&g)) {
     69  if (owl_function_is_away()) {
    7070    getyx(sepwin, y, x);
    7171    wmove(sepwin, y, x+2);
    7272    wattron(sepwin, A_BOLD);
    7373    wattroff(sepwin, A_REVERSE);
    74     if (owl_global_is_zaway(&g) && owl_global_is_aaway(&g)) {
    75       waddstr(sepwin, " AWAY ");
    76     } else if (owl_global_is_zaway(&g)) {
    77       waddstr(sepwin, " Z-AWAY ");
    78     } else if (owl_global_is_aaway(&g)) {
    79       waddstr(sepwin, " A-AWAY ");
    80     }
     74    waddstr(sepwin, " AWAY ");
    8175    wattron(sepwin, A_REVERSE);
    8276    wattroff(sepwin, A_BOLD);
  • style.c

    r14be3a5 r7dcef03  
    2323{
    2424  SV *sv = NULL;
    25   OWL_PERL_CALL_METHOD(s->perlobj,
    26                        "description",
    27                        ;,
    28                        "Error in style_get_description: %s",
    29                        0,
    30                        sv = SvREFCNT_inc(POPs);
    31                        );
    32   if(sv) {
     25  OWL_PERL_CALL(call_method("description", G_SCALAR|G_EVAL),
     26                XPUSHs(s->perlobj);,
     27                "Error in style_get_description: %s",
     28                0,
     29                false,
     30                sv = SvREFCNT_inc(POPs);
     31                );
     32  if (sv) {
    3333    return SvPV_nolen(sv_2mortal(sv));
    3434  } else {
     
    5050 
    5151  /* Call the perl object */
    52   OWL_PERL_CALL_METHOD(s->perlobj,
    53                        "format_message",
    54                        XPUSHs(sv_2mortal(owl_perlconfig_message2hashref(m)));,
    55                        "Error in format_message: %s",
    56                        0,
    57                        sv = SvREFCNT_inc(POPs);
    58                        );
     52  OWL_PERL_CALL(call_method("format_message", G_SCALAR|G_EVAL),
     53                XPUSHs(s->perlobj);
     54                XPUSHs(sv_2mortal(owl_perlconfig_message2hashref(m)));,
     55                "Error in format_message: %s",
     56                0,
     57                false,
     58                sv = SvREFCNT_inc(POPs);
     59                );
    5960
    60   if(sv) {
     61  if (sv) {
    6162    body = SvPV_nolen(sv);
    6263  } else {
     
    102103{
    103104  owl_style_cleanup(s);
    104   g_free(s);
     105  g_slice_free(owl_style, s);
    105106}
  • t/00-core-tests.t

    r95414bf r5db8835  
    11#!/usr/bin/env perl
    2 use File::Basename;
    3 system(dirname($0) . "/../tester", "--builtin");
     2system("./tester", "--builtin");
  • tester.c

    ra74a044 r21dc927  
    33#include "owl.h"
    44#undef WINDOW
     5#include "filterproc.h"
    56
    67#include <stdio.h>
     
    2324int owl_smartfilter_regtest(void);
    2425int owl_history_regtest(void);
     26int call_filter_regtest(void);
     27int owl_smartstrip_regtest(void);
    2528
    2629extern void owl_perl_xs_init(pTHX);
     
    113116  numfailures += owl_smartfilter_regtest();
    114117  numfailures += owl_history_regtest();
     118  numfailures += call_filter_regtest();
     119  numfailures += owl_smartstrip_regtest();
    115120  if (numfailures) {
    116121      fprintf(stderr, "# *** WARNING: %d failures total\n", numfailures);
     
    130135{
    131136  int numfailed=0;
    132   char *s, *path, *home;
     137  char *path, *home;
    133138
    134139  printf("# BEGIN testing owl_util\n");
     
    226231
    227232
    228   s = owl_util_baseclass("barnowl");
    229   FAIL_UNLESS("baseclass barnowl", !strcmp("barnowl", s));
    230   g_free(s);
    231   s = owl_util_baseclass("unbarnowl");
    232   FAIL_UNLESS("baseclass unbarnowl", !strcmp("barnowl", s));
    233   g_free(s);
    234   s = owl_util_baseclass("unununbarnowl.d.d");
    235   FAIL_UNLESS("baseclass unununbarnowl.d.d", !strcmp("barnowl", s));
    236   g_free(s);
    237   s = owl_util_baseclass("ununun.d.d");
    238   FAIL_UNLESS("baseclass ununun.d.d", !strcmp("", s));
    239   g_free(s);
    240   s = owl_util_baseclass("d.d.d.d");
    241   FAIL_UNLESS("baseclass d.d.d.d", !strcmp("d", s));
    242   g_free(s);
    243   s = owl_util_baseclass("n.d.d.d");
    244   FAIL_UNLESS("baseclass n.d.d.d", !strcmp("n", s));
    245   g_free(s);
    246   s = owl_util_baseclass("ununun.");
    247   FAIL_UNLESS("baseclass ununun.", !strcmp(".", s));
    248   g_free(s);
    249   s = owl_util_baseclass("unununu");
    250   FAIL_UNLESS("baseclass unununu", !strcmp("u", s));
    251   g_free(s);
    252 
    253 
    254   s = owl_util_makepath("foo/bar");
    255   FAIL_UNLESS("makepath foo/bar", !strcmp("foo/bar", s));
    256   g_free(s);
    257   s = owl_util_makepath("//foo///bar");
    258   FAIL_UNLESS("makepath //foo///bar", !strcmp("/foo/bar", s));
    259   g_free(s);
    260   s = owl_util_makepath("foo/~//bar/");
    261   FAIL_UNLESS("makepath foo/~//bar/", !strcmp("foo/~/bar/", s));
    262   g_free(s);
    263   s = owl_util_makepath("~thisuserhadreallybetternotexist/foobar/");
    264   FAIL_UNLESS("makepath ~thisuserhadreallybetternotexist/foobar/",
    265               !strcmp("~thisuserhadreallybetternotexist/foobar/", s));
    266   g_free(s);
     233  CHECK_STR_AND_FREE("baseclass barnowl",
     234                     "barnowl", owl_util_baseclass("barnowl"));
     235  CHECK_STR_AND_FREE("baseclass unbarnowl",
     236                     "barnowl", owl_util_baseclass("unbarnowl"));
     237  CHECK_STR_AND_FREE("baseclass unununbarnowl.d.d",
     238                     "barnowl", owl_util_baseclass("unununbarnowl.d.d"));
     239  CHECK_STR_AND_FREE("baseclass ununun.d.d",
     240                     "", owl_util_baseclass("ununun.d.d"));
     241  CHECK_STR_AND_FREE("baseclass d.d.d.d",
     242                     "d", owl_util_baseclass("d.d.d.d"));
     243  CHECK_STR_AND_FREE("baseclass n.d.d.d",
     244                     "n", owl_util_baseclass("n.d.d.d"));
     245  CHECK_STR_AND_FREE("baseclass ununun.",
     246                     ".", owl_util_baseclass("ununun."));
     247  CHECK_STR_AND_FREE("baseclass unununu",
     248                     "u", owl_util_baseclass("unununu"));
     249
     250
     251  CHECK_STR_AND_FREE("makepath foo/bar",
     252                     "foo/bar", owl_util_makepath("foo/bar"));
     253  CHECK_STR_AND_FREE("makepath //foo///bar",
     254                     "/foo/bar", owl_util_makepath("//foo///bar"));
     255  CHECK_STR_AND_FREE("makepath foo/~//bar/",
     256                     "foo/~/bar/", owl_util_makepath("foo/~//bar/"));
     257  CHECK_STR_AND_FREE("makepath ~thisuserhadreallybetternotexist/foobar/",
     258                     "~thisuserhadreallybetternotexist/foobar/",
     259                     owl_util_makepath("~thisuserhadreallybetternotexist/foobar/"));
    267260
    268261  home = g_strdup(owl_global_get_homedir(&g));
    269   s = owl_util_makepath("~");
    270   FAIL_UNLESS("makepath ~", !strcmp(home, s));
    271   g_free(s);
     262  CHECK_STR_AND_FREE("makepath ~",
     263                     home, owl_util_makepath("~"));
    272264
    273265  path = g_build_filename(home, "foo/bar/baz", NULL);
    274   s = owl_util_makepath("~///foo/bar//baz");
    275   FAIL_UNLESS("makepath ~///foo/bar//baz", !strcmp(path, s));
    276   g_free(s);
     266  CHECK_STR_AND_FREE("makepath ~///foo/bar//baz",
     267                     path, owl_util_makepath("~///foo/bar//baz"));
    277268  g_free(path);
    278269