Changeset 2e42098
- Timestamp:
- Feb 5, 2014, 3:04:26 AM (9 years ago)
- 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. - Files:
-
- 37 added
- 40 deleted
- 77 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
rf93cc34 r7834bb5 1 # Generated by autoreconf 2 Makefile.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 15 Makefile 16 .deps/ 17 /config.cache 18 /config.h 19 /config.log 20 /config.status 21 /stamp-h1 22 23 # Generated by make 24 *.o 1 25 *.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. 46 ID 12 47 TAGS 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 48 tags 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 3 3 4 4 The following people have provided patches or other contributions: 5 Alex Vandiver 6 Kevin Chen 7 Arun Tharuvai 5 8 Sam Hartman 6 Alex Vandiver7 Geoffrey Thomas8 9 Derrick Brashear 9 10 David Glasser 11 Eric Price 10 12 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 14 34 15 BarnOwl is based on code from Owl, which was originally primar ly35 BarnOwl is based on code from Owl, which was originally primarily 16 36 written by James Kretchmar. Erik Nygren also made substantial 17 contributions and improvem nts to the program.37 contributions and improvements to the program. 18 38 19 The following people provided patches and other tech incal support for39 The following people provided patches and other technical support for 20 40 Owl: 21 41 … … 30 50 Mark Eichin 31 51 32 Mark Eichin is also maintaining the debian package of Owl.52 Mark Eichin is also maintaining the Debian package of Owl. 33 53 34 54 The following people helped with beta testing the earliest versions of -
COPYING
rb03c714 rccc182c 549 549 550 550 That's all there is to it! 551 552 ====================================================================== 553 554 Files under perl/modules/Facebook/lib/Facebook are copyright (c) 2010 Plain 555 Black Corporation. 556 557 This software is copyright (c) 2010 by Plain Black Corporation. 558 559 This is free software; you can redistribute it and/or modify it under 560 the same terms as the Perl 5 programming language system itself. 561 562 Terms of the Perl programming language system itself 563 564 a) 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 567 b) the "Artistic License" 568 569 --- The GNU General Public License, Version 1, February 1989 --- 570 571 This software is Copyright (c) 2010 by Plain Black Corporation. 572 573 This 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 589 at the mercy of those companies. By contrast, our General Public 590 License is intended to guarantee your freedom to share and change free 591 software--to make sure the software is free for all its users. The 592 General Public License applies to the Free Software Foundation's 593 software and to any other program whose authors commit to using it. 594 You can use it for your programs, too. 595 596 When we speak of free software, we are referring to freedom, not 597 price. Specifically, the General Public License is designed to make 598 sure that you have the freedom to give away or sell copies of free 599 software, that you receive source code or can get it if you want it, 600 that you can change the software or use pieces of it in new free 601 programs; and that you know you can do these things. 602 603 To protect your rights, we need to make restrictions that forbid 604 anyone to deny you these rights or to ask you to surrender the rights. 605 These restrictions translate to certain responsibilities for you if you 606 distribute copies of the software, or if you modify it. 607 608 For example, if you distribute copies of a such a program, whether 609 gratis or for a fee, you must give the recipients all the rights that 610 you have. You must make sure that they, too, receive or can get the 611 source 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, 615 distribute and/or modify the software. 616 617 Also, for each author's protection and ours, we want to make certain 618 that everyone understands that there is no warranty for this free 619 software. If the software is modified by someone else and passed on, we 620 want its recipients to know that what they have is not the original, so 621 that any problems introduced by others will not reflect on the original 622 authors' reputations. 623 624 The precise terms and conditions for copying, distribution and 625 modification 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 631 contains a notice placed by the copyright holder saying it may be 632 distributed under the terms of this General Public License. The 633 "Program", below, refers to any such program or work, and a "work based 634 on the Program" means either the Program or any work containing the 635 Program or a portion of it, either verbatim or with modifications. Each 636 licensee is addressed as "you". 637 638 1. You may copy and distribute verbatim copies of the Program's source 639 code as you receive it, in any medium, provided that you conspicuously and 640 appropriately publish on each copy an appropriate copyright notice and 641 disclaimer of warranty; keep intact all the notices that refer to this 642 General Public License and to the absence of any warranty; and give any 643 other recipients of the Program a copy of this General Public License 644 along with the Program. You may charge a fee for the physical act of 645 transferring a copy. 646 647 2. You may modify your copy or copies of the Program or any portion of 648 it, and copy and distribute such modifications under the terms of Paragraph 649 1 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 674 Mere aggregation of another independent work with the Program (or its 675 derivative) on a volume of a storage or distribution medium does not bring 676 the other work under the scope of these terms. 677 678 3. You may copy and distribute the Program (or a portion or derivative of 679 it, under Paragraph 2) in object code or executable form under the terms of 680 Paragraphs 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 697 Source code for a work means the preferred form of the work for making 698 modifications to it. For an executable file, complete source code means 699 all the source code for all modules it contains; but, as a special 700 exception, it need not include source code for modules which are standard 701 libraries that accompany the operating system on which the executable 702 file runs, or for standard header files or definitions files that 703 accompany that operating system. 704 705 4. You may not copy, modify, sublicense, distribute or transfer the 706 Program except as expressly provided under this General Public License. 707 Any attempt otherwise to copy, modify, sublicense, distribute or transfer 708 the Program is void, and will automatically terminate your rights to use 709 the Program under this License. However, parties who have received 710 copies, or rights to use copies, from you under this General Public 711 License will not have their licenses terminated so long as such parties 712 remain in full compliance. 713 714 5. By copying, distributing or modifying the Program (or any work based 715 on the Program) you indicate your acceptance of this license to do so, 716 and all its terms and conditions. 717 718 6. Each time you redistribute the Program (or any work based on the 719 Program), the recipient automatically receives a license from the original 720 licensor to copy, distribute or modify the Program subject to these 721 terms and conditions. You may not impose any further restrictions on the 722 recipients' exercise of the rights granted herein. 723 724 7. The Free Software Foundation may publish revised and/or new versions 725 of the General Public License from time to time. Such new versions will 726 be similar in spirit to the present version, but may differ in detail to 727 address new problems or concerns. 728 729 Each version is given a distinguishing version number. If the Program 730 specifies a version number of the license which applies to it and "any 731 later version", you have the option of following the terms and conditions 732 either of that version or of any later version published by the Free 733 Software Foundation. If the Program does not specify a version number of 734 the license, you may choose any version ever published by the Free Software 735 Foundation. 736 737 8. If you wish to incorporate parts of the Program into other free 738 programs whose distribution conditions are different, write to the author 739 to ask for permission. For software which is copyrighted by the Free 740 Software Foundation, write to the Free Software Foundation; we sometimes 741 make exceptions for this. Our decision will be guided by the two goals 742 of preserving the free status of all derivatives of our free software and 743 of 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 748 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 749 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 750 PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 751 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 752 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 753 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 754 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 755 REPAIR OR CORRECTION. 756 757 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 758 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 759 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 760 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 761 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 762 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 763 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 764 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 765 POSSIBILITY 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 772 possible use to humanity, the best way to achieve this is to make it 773 free software which everyone can redistribute and change under these 774 terms. 775 776 To do so, attach the following notices to the program. It is safest to 777 attach them to the start of each source file to most effectively convey 778 the 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 799 Also add information on how to contact you by electronic and paper mail. 800 801 If the program is interactive, make it output a short notice like this 802 when 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 809 The hypothetical commands `show w' and `show c' should show the 810 appropriate parts of the General Public License. Of course, the 811 commands you use may be called something other than `show w' and `show 812 c'; they could even be mouse-clicks or menu items--whatever suits your 813 program. 814 815 You should also get your employer (if you work as a programmer) or your 816 school, if any, to sign a "copyright disclaimer" for the program, if 817 necessary. 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 826 That's all there is to it! 827 828 829 --- The Artistic License 1.0 --- 830 831 This software is Copyright (c) 2010 by Plain Black Corporation. 832 833 This is free software, licensed under: 834 835 The Artistic License 1.0 836 837 The Artistic License 838 839 Preamble 840 841 The intent of this document is to state the conditions under which a Package 842 may be copied, such that the Copyright Holder maintains some semblance of 843 artistic control over the development of the package, while giving the users of 844 the package the right to use and distribute the Package in a more-or-less 845 customary fashion, plus the right to make reasonable modifications. 846 847 Definitions: 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 867 1. You may make and give away verbatim copies of the source form of the 868 Standard Version of this Package without restriction, provided that you 869 duplicate all of the original copyright notices and associated disclaimers. 870 871 2. You may apply bug fixes, portability fixes and other modifications derived 872 from the Public Domain or from the Copyright Holder. A Package modified in such 873 a way shall still be considered the Standard Version. 874 875 3. You may otherwise modify your copy of this Package in any way, provided that 876 you insert a prominent notice in each changed file stating how and when you 877 changed 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 894 4. You may distribute the programs of this Package in object code or executable 895 form, 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 912 5. You may charge a reasonable copying fee for any distribution of this 913 Package. You may charge any fee you choose for support of this Package. You 914 may not charge a fee for this Package itself. However, you may distribute this 915 Package in aggregate with other (possibly commercial) programs as part of a 916 larger (possibly commercial) software distribution provided that you do not 917 advertise this Package as a product of your own. 918 919 6. The scripts and library files supplied as input to or produced as output 920 from the programs of this Package do not automatically fall under the copyright 921 of this Package, but belong to whomever generated them, and may be sold 922 commercially, and may be aggregated with this Package. 923 924 7. C or perl subroutines supplied by you and linked into this Package shall not 925 be considered part of this Package. 926 927 8. The name of the Copyright Holder may not be used to endorse or promote 928 products derived from this software without specific prior written permission. 929 930 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED 931 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 932 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 933 934 The End -
ChangeLog
r65ff3f4 r6f87658 1 1.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 33 1.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 1 48 1.8 2 49 * Compute the home directory in zcrypt consistently with BarnOwl -davidben@mit.edu … … 282 329 * Support --program-{prefix,suffix,transform}. -nelhage 283 330 * Send instanced pings and give useful error messages -adehnert 284 * Add <message,*,%me%> to default Barn owl subs. -adehnert331 * Add <message,*,%me%> to default BarnOwl subs. -adehnert 285 332 * Maintain instance when using shift-R on personals -adehnert 286 333 * Improve handling of outgoing instanced personals -adehnert -
Makefile.am
rc266281 rca1fb26a 1 1 ACLOCAL_AMFLAGS = -I m4 2 2 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-%=%)) 3 GIT_DESCRIPTION := $(if $(wildcard $(srcdir)/.git),$(shell cd $(srcdir) && git describe --match='barnowl-*' HEAD 2>/dev/null)) 4 VERSION = $(if $(GIT_DESCRIPTION),$(GIT_DESCRIPTION:barnowl-%=%),@VERSION@) 5 -include BUILD_VERSION.mk 5 6 6 bin_PROGRAMS = barnowl.bin 7 FORCE: 8 BUILD_VERSION.mk: $(if $(filter-out $(BUILD_VERSION),$(VERSION)),FORCE) 9 echo 'BUILD_VERSION = $(VERSION)' > $@ 10 11 bin_PROGRAMS = bin/barnowl 7 12 if ENABLE_ZCRYPT 8 13 bin_PROGRAMS += zcrypt 9 14 endif 10 15 11 zcrypt_SOURCES = zcrypt.c filterproc.c 16 zcrypt_SOURCES = zcrypt.c filterproc.c version.c 12 17 13 check_PROGRAMS = tester.bin 18 check_PROGRAMS = bin/tester 19 dist_check_DATA = t 20 dist_check_SCRIPTS = runtests.sh 14 21 15 barnowl_bin_SOURCES = $(BASE_SRCS) \ 16 owl.h owl_perl.h config.h \ 17 owl.c \ 18 $(GEN_C) $(GEN_H) 22 noinst_SCRIPTS = barnowl 23 check_SCRIPTS = tester 19 24 20 man_MANS = doc/barnowl.1 21 doc_DATA = doc/intro.txt doc/advanced.txt 25 barnowl 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 $@ 22 31 23 barnowl_bin_LDADD = compat/libcompat.a libfaim/libfaim.a 32 bin_barnowl_SOURCES = $(BASE_SRCS) \ 33 owl.h owl_perl.h \ 34 owl.c 35 nodist_bin_barnowl_SOURCES = $(GEN_C) $(GEN_H) 24 36 25 tester_bin_SOURCES = $(BASE_SRCS) \ 26 owl.h owl_perl.h config.h \ 27 $(GEN_C) $(GEN_H) \ 37 dist_man_MANS = doc/barnowl.1 38 dist_doc_DATA = doc/intro.txt doc/advanced.txt 39 40 bin_barnowl_LDADD = compat/libcompat.a libfaim/libfaim.a 41 42 bin_tester_SOURCES = $(BASE_SRCS) \ 43 owl.h owl_perl.h \ 28 44 tester.c 45 nodist_bin_tester_SOURCES = $(GEN_C) $(GEN_H) 29 46 30 tester_bin_LDADD = compat/libcompat.a libfaim/libfaim.a47 bin_tester_LDADD = compat/libcompat.a libfaim/libfaim.a 31 48 32 49 TESTS=runtests.sh 33 50 34 AM_CPPFLAGS = -I$(top_srcdir)/\51 AM_CPPFLAGS = \ 35 52 -I$(top_srcdir)/libfaim/ \ 36 53 -DDATADIR='"$(pkgdatadir)"' \ 37 -DBINDIR='"$(bindir)"' \ 38 $(GIT_FLAGS) 54 -DBINDIR='"$(bindir)"' 39 55 40 56 CODELIST_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 \ 42 59 perlconfig.c keys.c functions.c zwrite.c viewwin.c help.c filter.c \ 43 60 regex.c history.c view.c dict.c variable.c filterelement.c pair.c \ … … 45 62 aim.c buddy.c buddylist.c style.c errqueue.c \ 46 63 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 48 65 49 NORMAL_SRCS = filterproc.c window.cwindowcb.c66 NORMAL_SRCS = filterproc.c filterproc.h window.c window.h windowcb.c 50 67 51 68 BASE_SRCS = $(CODELIST_SRCS) $(NORMAL_SRCS) 52 69 53 GEN_C = varstubs.c perlglue.c 54 GEN_H = owl_prototypes.h 70 GEN_C = varstubs.c perlglue.c gmarshal_funcs.c version.c version.c.new 71 GEN_H = owl_prototypes.h owl_prototypes.h.new gmarshal_funcs.h 55 72 56 BUILT_SOURCES = $(GEN_ C) $(GEN_H)73 BUILT_SOURCES = $(GEN_H) 57 74 58 75 # Only copy file into place if file.new is different 59 %: %.new76 owl_prototypes.h version.c: %: %.new 60 77 @diff -U0 $@ $< || { \ 61 78 test -f $@ && echo '$@ changed!'; \ … … 65 82 proto: owl_prototypes.h 66 83 67 perlglue.c: perlglue.xs $(TYPEMAP)68 $(AM_V_GEN)perl $(XSUBPPDIR)/xsubpp $(XSUBPPFLAGS) -prototypes perlglue.xs > perlglue.c84 perlglue.c: perlglue.xs typemap 85 $(AM_V_GEN)perl $(XSUBPPDIR)/xsubpp $(XSUBPPFLAGS) -prototypes $< > $@ 69 86 70 87 varstubs.c: stubgen.pl variable.c … … 74 91 $(AM_V_GEN)perl $< $(sort $(filter-out $<,$+)) > $@ 75 92 93 version.c.new: Makefile BUILD_VERSION.mk 94 $(AM_V_GEN)echo 'const char *version = "$(VERSION)";' > $@ 95 96 gmarshal_funcs.h: marshal_types 97 glib-genmarshal --header $< > $@ 98 gmarshal_funcs.c: marshal_types 99 glib-genmarshal --body $< > $@ 100 76 101 # For emacs flymake-mode 77 102 check-syntax: proto 78 103 $(COMPILE) -Wall -Wextra -pedantic -fsyntax-only $(CHK_SOURCES) 79 104 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) 105 CLEANFILES = $(BUILT_SOURCES) $(GEN_C) $(noinst_SCRIPTS) $(check_SCRIPTS) BUILD_VERSION.mk 106 EXTRA_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 88 119 89 120 SUBDIRS = compat libfaim perl -
README
rb711711 r1c22155 10 10 following CPAN modules: 11 11 12 Facebook::Graph 12 13 Net::Jabber 13 14 Net::XMPP 14 15 XML::Stream 15 16 16 Theyhave been modified slightly for the needs of this project.17 Some have been modified slightly for the needs of this project. 17 18 18 19 BarnOwl currently requires the following perl modules off of CPAN: … … 20 21 AnyEvent 21 22 Class::Accessor 23 ExtUtils::Depends 22 24 Glib 25 Module::Install 23 26 PAR 24 27 … … 26 29 We plan to soon add targets to the Makefile to check for and install 27 30 these for you. 31 32 The Facebook module requires: 33 34 Any::Moose 35 AnyEvent::HTTP 36 DateTime 37 DateTime::Format::Strptime 38 JSON 39 MIME::Base64::URLSafe 40 Ouch 41 URI 42 URI::Encode 28 43 29 44 The IRC module requires: … … 36 51 Authen::SASL::Perl 37 52 IO::Socket::SSL 38 Digest::SHA 153 Digest::SHA 39 54 40 55 The Twitter module requires: -
aim.c
rf271129 r7dcef03 707 707 { 708 708 aim_clientready(sess, fr->conn); 709 owl_function_debugmsg("conninitdone_admin: initializ tion done for admin connection");709 owl_function_debugmsg("conninitdone_admin: initialization done for admin connection"); 710 710 return(1); 711 711 } … … 836 836 params = va_arg(ap, struct aim_icbmparameters *); 837 837 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 rec iever 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", 840 840 params->maxchan, params->flags, params->maxmsglen, ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0, params->minmsginterval); 841 841 … … 1049 1049 wrapmsg=owl_text_wordwrap(stripmsg, 70); 1050 1050 nz_screenname=owl_aim_normalize_screenname(userinfo->sn); 1051 m=g_ new(owl_message, 1);1051 m=g_slice_new(owl_message); 1052 1052 owl_message_create_aim(m, 1053 1053 nz_screenname, -
barnowl-wrapper.in
- Property mode changed from 100755 to 100644
rf5f6ec0 ra223b6b 1 1 #!/bin/sh 2 2 # This is a wrapper script to point BARNOWL_DATA_DIR at the source dir 3 # if we're running from a build tree. b arnowl.binis the actual built3 # if we're running from a build tree. bin/barnowl is the actual built 4 4 # binary. 5 5 6 SRCDIR=`dirname "${0}"` 7 EXE="$0.bin" 6 EXE="@abs_builddir@/bin/$(basename "$0")" 8 7 9 8 if test ! -x "$EXE"; then … … 12 11 fi 13 12 14 BARNOWL_DATA_DIR=" $SRCDIR/perl/"15 BARNOWL_BIN_DIR=" $SRCDIR/"13 BARNOWL_DATA_DIR="@abs_srcdir@/perl" 14 BARNOWL_BIN_DIR="@abs_builddir@" 16 15 export BARNOWL_DATA_DIR 17 16 export BARNOWL_BIN_DIR -
buddy.c
rd4927a7 r7dcef03 72 72 { 73 73 owl_buddy_cleanup(b); 74 g_ free(b);74 g_slice_free(owl_buddy, b); 75 75 } -
buddylist.c
r3cdd6d2 r7dcef03 11 11 { 12 12 owl_buddy *b; 13 b=g_ new(owl_buddy, 1);13 b=g_slice_new(owl_buddy); 14 14 15 15 owl_buddy_create(b, OWL_PROTOCOL_AIM, screenname); … … 50 50 51 51 /* if not, create the login message */ 52 m=g_ new(owl_message, 1);52 m=g_slice_new(owl_message); 53 53 owl_message_create_aim(m, 54 54 screenname, … … 69 69 70 70 if (owl_buddylist_is_aim_buddy_loggedin(bl, screenname)) { 71 m=g_ new(owl_message, 1);71 m=g_slice_new(owl_message); 72 72 owl_message_create_aim(m, 73 73 screenname, -
cmd.c
rf271129 r7dcef03 35 35 void owl_cmddict_add_alias(owl_cmddict *cd, const char *alias_from, const char *alias_to) { 36 36 owl_cmd *cmd; 37 cmd = g_ new(owl_cmd, 1);37 cmd = g_slice_new(owl_cmd); 38 38 owl_cmd_create_alias(cmd, alias_from, alias_to); 39 39 owl_perlconfig_new_command(cmd->name); … … 42 42 43 43 int 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); 45 45 if(owl_cmd_create_from_template(newcmd, cmd) < 0) { 46 g_ free(newcmd);46 g_slice_free(owl_cmd, newcmd); 47 47 return -1; 48 48 } … … 141 141 { 142 142 owl_cmd_cleanup(cmd); 143 g_ free(cmd);143 g_slice_free(owl_cmd, cmd); 144 144 } 145 145 -
commands.c
rf271129 rca1fb26a 96 96 OWLCMD_ARGS("unbindkey", owl_command_unbindkey, OWL_CTX_ANY, 97 97 "removes a binding in a keymap", 98 " bindkey <keymap> <keyseq>",98 "unbindkey <keymap> <keyseq>", 99 99 "Removes a binding of a key sequence within a keymap.\n" 100 100 "Use 'show keymaps' to see the existing keymaps.\n" … … 479 479 480 480 OWLCMD_ARGS("away", owl_command_away, OWL_CTX_INTERACTIVE, 481 "Set, enable or disable both AIM and zephyraway messages",481 "Set, enable or disable all away messages", 482 482 "away [ on | off | toggle ]\n" 483 483 "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" 485 485 "'message' is specified turn them on with that message,\n" 486 486 "otherwise use the default.\n" 487 "\n"488 "This command really just runs the 'aaway' and 'zaway'\n"489 "commands together\n"490 487 "\n" 491 488 "SEE ALSO: aaway, zaway"), … … 1033 1030 OWLCMD_ARGS_CTX("popless:start-search", owl_viewwin_command_start_search, OWL_CTX_POPLESS, 1034 1031 "starts a command line to search for particular string", 1035 "popless:start-search [-r] [init al-value]",1032 "popless:start-search [-r] [initial-value]", 1036 1033 "Initializes the command-line to search for initial-value. If\n" 1037 1034 "-r is used, the search will be performed backwards.\n\n" … … 1117 1114 void owl_command_version(void) 1118 1115 { 1119 owl_function_makemsg("BarnOwl version %s", OWL_VERSION_STRING);1116 owl_function_makemsg("BarnOwl version %s", version); 1120 1117 } 1121 1118 … … 1531 1528 char *owl_command_away(int argc, const char *const *argv, const char *buff) 1532 1529 { 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; 1535 1536 owl_global_set_aaway_msg(&g, owl_global_get_aaway_msg_default(&g)); 1536 1537 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); 1537 1555 owl_function_aaway_on(); 1538 1556 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); 1539 1563 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 1571 1566 return NULL; 1572 1567 } … … 1604 1599 if (v == NULL) { 1605 1600 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) { 1607 1602 if (!silent) owl_function_error("Variable '%s' is not a boolean", var); 1608 1603 } else { … … 1633 1628 if (v == NULL) { 1634 1629 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) { 1636 1631 if (!silent) owl_function_error("Variable '%s' is not a boolean", var); 1637 1632 } else { … … 1778 1773 1779 1774 if (argc < 3) { 1780 owl_function_makemsg("Usage: bindkey <keymap> <binding>");1775 owl_function_makemsg("Usage: unbindkey <keymap> <binding>"); 1781 1776 return NULL; 1782 1777 } … … 1985 1980 } 1986 1981 /* check for a zwrite -m */ 1987 z = owl_zwrite_new( buff);1982 z = owl_zwrite_new(argc, argv); 1988 1983 if (!z) { 1989 1984 owl_function_error("Error in zwrite arguments"); … … 2190 2185 if (!strcmp(argv[0], "-f")) { 2191 2186 if (argc<2) { 2192 owl_function_makemsg("Too few arg ments to the view command");2187 owl_function_makemsg("Too few arguments to the view command"); 2193 2188 return(NULL); 2194 2189 } … … 2202 2197 } else if (!strcmp(argv[0], "-s")) { 2203 2198 if (argc<2) { 2204 owl_function_makemsg("Too few arg ments to the view command");2199 owl_function_makemsg("Too few arguments to the view command"); 2205 2200 return(NULL); 2206 2201 } … … 2209 2204 argv+=2; 2210 2205 } else { 2211 owl_function_makemsg("Too few arg ments to the view command");2206 owl_function_makemsg("Too few arguments to the view command"); 2212 2207 return(NULL); 2213 2208 } … … 2796 2791 owl_history_store(hist, owl_editwin_get_text(e), false); 2797 2792 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); 2798 2798 owl_global_pop_context(&g); 2799 2800 owl_editwin_do_callback(e, false); 2801 owl_editwin_unref(e); 2799 2802 } 2800 2803 … … 2856 2859 owl_global_pop_context(&g); 2857 2860 2858 owl_editwin_do_callback(e );2861 owl_editwin_do_callback(e, true); 2859 2862 owl_editwin_unref(e); 2860 2863 } -
compat/Makefile.am
r12a6616 rb80bae0 1 1 noinst_LIBRARIES = libcompat.a 2 2 3 libcompat_a_SOURCES = 3 libcompat_a_SOURCES = compat.h 4 4 libcompat_a_LIBADD = $(LIBOBJS) -
compat/compat.h
r4dde585 r6249a88f 2 2 #define INC_BARNOWL_COMPAT_COMPAT_H 3 3 4 #include "../config.h"4 #include <config.h> 5 5 6 6 #include <stddef.h> -
configure.ac
r883502d r77dfeb1 1 1 dnl 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]) 2 AC_INIT([BarnOwl],[1.10dev],[bug-barnowl@mit.edu]) 3 AM_INIT_AUTOMAKE([1.7.0 foreign std-options -Wall -Wno-portability]) 4 AM_MAINTAINER_MODE([enable]) 4 5 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) 5 6 … … 9 10 AC_PROG_CC 10 11 AC_PROG_CC_C99 12 AC_PROG_LN_S 13 14 AC_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']) 25 AC_DEFINE_UNQUOTED( 26 [ZEPHYR_DEFAULT_FORMAT], ["$zephyr_default_format"], 27 [Value for the default format zephyrgram field] 28 ) 11 29 12 30 AC_ARG_WITH([stack-protector], … … 41 59 42 60 AS_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"], 44 64 [AC_MSG_CHECKING([for Kerberos IV]) 45 65 AS_IF([krb5-config krb4 --libs >/dev/null 2>&1], 46 66 [AC_MSG_RESULT([yes]) 67 have_krb4=yes 47 68 AC_DEFINE([HAVE_KERBEROS_IV], [1], [Define if you have kerberos IV]) 48 69 AM_CFLAGS="${AM_CFLAGS} `krb5-config krb4 --cflags`" … … 51 72 [AC_MSG_RESULT([no]) 52 73 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 58 86 AC_CHECK_LIB([zephyr], [ZGetSender], 59 87 [LIBS="$LIBS -lzephyr" … … 90 118 dnl Find the location of perl XSUBPP 91 119 AC_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;'`"120 XSUBPPDIR="`cd "$srcdir" && perl -MExtUtils::MakeMaker -e 'print ExtUtils::MakeMaker->new({NAME => qw(owl)})->tool_xsubpp;' | grep \^XSUBPPDIR | sed -e 's/XSUBPPDIR = //g;'`" 93 121 if test -n "${XSUBPPDIR}"; then 94 122 AC_MSG_RESULT(${XSUBPPDIR}) … … 113 141 AX_PROG_PERL_MODULES([Class::Accessor::Fast],, 114 142 [AC_MSG_ERROR([cannot find perl module Class::Accessor::Fast.])]) 143 AX_PROG_PERL_MODULES([ExtUtils::Depends],, 144 [AC_MSG_ERROR([cannot find perl module ExtUtils::Depends])]) 115 145 AX_PROG_PERL_MODULES([Glib],, 116 146 [AC_MSG_ERROR([cannot find perl module Glib.])]) 147 AX_PROG_PERL_MODULES([Module::Install::Base],, 148 [AC_MSG_ERROR([cannot find perl module Module::Install::Base])]) 117 149 AX_PROG_PERL_MODULES([PAR],, 118 150 [AC_MSG_WARN([PAR.pm not found. Loadable modules will be disabled.])]) … … 129 161 prefix="${ac_default_prefix}" 130 162 fi 163 164 dnl Add CFLAGS for glib-perl 165 GLIB_PERL_CFLAGS=`perl -MExtUtils::Depends -e 'my $e = ExtUtils::Depends->new("BarnOwl","Glib"); my %h = $e->get_makefile_vars; print $h{"INC"}'` 166 AC_MSG_NOTICE([Adding glib-perl CFLAGS ${GLIB_PERL_CFLAGS}]) 167 AM_CFLAGS="${GLIB_PERL_CFLAGS} ${AM_CFLAGS}" 131 168 132 169 dnl Checks for typedefs, structures, and compiler characteristics. … … 150 187 dnl Define __EXTENSIONS__ for strcasecmp on Solaris. 151 188 AM_CFLAGS="$AM_CFLAGS -D__EXTENSIONS__" 189 dnl Define _XOPEN_SOURCE_EXTENDED for some features in ncurses, 190 dnl including cchar_t. This should not be necessary with 191 dnl _XOPEN_SOURCE=600, but some versions of ncurses 192 dnl apparently still need it. 193 AM_CFLAGS="$AM_CFLAGS -D_XOPEN_SOURCE_EXTENDED" 152 194 153 195 AC_SUBST([AM_CFLAGS]) … … 168 210 AC_REPLACE_FUNCS([memrchr]) 169 211 212 AC_SUBST([abs_builddir]) 213 AC_SUBST([abs_srcdir]) 214 170 215 AC_CONFIG_FILES([Makefile compat/Makefile libfaim/Makefile perl/Makefile perl/modules/Makefile]) 171 216 AC_OUTPUT -
context.c
rf271129 r7dcef03 10 10 if (!(mode & OWL_CTX_MODE_BITS)) 11 11 mode |= OWL_CTX_INTERACTIVE; 12 c = g_ new0(owl_context, 1);12 c = g_slice_new0(owl_context); 13 13 c->mode = mode; 14 14 c->data = data; … … 71 71 if (ctx->delete_cb) 72 72 ctx->delete_cb(ctx); 73 g_ free(ctx);73 g_slice_free(owl_context, ctx); 74 74 } -
doc/barnowl.1
rbad4496 r8135737 35 35 .TP 36 36 \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. 37 Specify an alternate config file for \fBBarnOwl\fP to use. The config file is 38 an arbitrary Perl script evaluated in the \fImain\fP package, and if it 39 overrides the \fIBarnOwl::startup\fP method that is run when \fBBarnOwl\fP 40 starts. (Compare \fI~/.owl/startup\fP, which contains \fBBarnOwl\fP commands 41 that are run at startup after the config file is loaded.) 42 43 By default, \fBBarnOwl\fP uses the first of \fI~/.owl/init.pl\fP, 44 \fI~/.barnowlconf\fP, or \fI~/.owlconf\fP that exists. 39 45 40 46 .TP -
doc/releasing-barnowl.txt
r5f08dbe rd995ff3 16 16 - [ ] Do a locker build (See DOING A LOCKER BUILD) 17 17 - [ ] Update configure.ac on master to bump the version to 1.(N+1)dev 18 - [ ] Add the barnowl-1.(N+1)dev git tag 18 19 - [ ] Push git git: 19 20 - [ ] The RC commit 20 21 - [ ] The configure.ac change on master 21 22 - [ ] 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 22 30 - [ ] Copy tarball into /mit/barnowl/web_scripts/dist 23 31 - [ ] Send mail announcing the RC to barnowl-dev@mit.edu … … 31 39 * DOING THE ACTUAL RELEASE 32 40 - [ ] Update the changelog and configure.ac for barnowl 1.N 41 - [ ] Copy the changelog changes to the master branch 33 42 - [ ] run ./scripts/do-release 34 43 - [ ] Do the locker build -
editwin.c
rf271129 r7dcef03 33 33 oe_excursion *excursions; 34 34 35 void (*callback)(struct _owl_editwin *);35 void (*callback)(struct _owl_editwin *e, bool success); 36 36 void (*destroy_cbdata)(void *); 37 37 void *cbdata; … … 68 68 static CALLER_OWN owl_editwin *owl_editwin_allocate(void) 69 69 { 70 owl_editwin *e = g_ new0(owl_editwin, 1);70 owl_editwin *e = g_slice_new0(owl_editwin); 71 71 e->refcount = 1; 72 72 return e; … … 87 87 oe_destroy_cbdata(e); 88 88 89 g_ free(e);89 g_slice_free(owl_editwin, e); 90 90 } 91 91 … … 220 220 } 221 221 222 void owl_editwin_set_callback(owl_editwin *e, void (*cb)(owl_editwin *))222 void owl_editwin_set_callback(owl_editwin *e, void (*cb)(owl_editwin *, bool)) 223 223 { 224 224 e->callback = cb; 225 225 } 226 226 227 void (*owl_editwin_get_callback(owl_editwin *e))(owl_editwin *)227 void (*owl_editwin_get_callback(owl_editwin *e))(owl_editwin *, bool) 228 228 { 229 229 return e->callback; … … 248 248 } 249 249 250 void owl_editwin_do_callback(owl_editwin *e) { 251 void (*cb)(owl_editwin*); 252 cb=owl_editwin_get_callback(e); 253 if(!cb) { 250 void 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) { 254 255 owl_function_error("Internal error: No editwin callback!"); 255 256 } else { 256 /* owl_function_error("text: |%s|", owl_editwin_get_text(e)); */ 257 cb(e); 257 cb(e, success); 258 258 } 259 259 } … … 373 373 owl_editwin_excursion *owl_editwin_begin_excursion(owl_editwin *e) 374 374 { 375 owl_editwin_excursion *x = g_ new(owl_editwin_excursion, 1);375 owl_editwin_excursion *x = g_slice_new(owl_editwin_excursion); 376 376 oe_save_excursion(e, x); 377 377 return x; … … 381 381 { 382 382 oe_restore_excursion(e, x); 383 g_ free(x);383 g_slice_free(owl_editwin_excursion, x); 384 384 } 385 385 … … 619 619 620 620 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."); 622 622 return 0; 623 623 } -
filter.c
rf271129 r7dcef03 18 18 owl_filter *f; 19 19 20 f = g_ new(owl_filter, 1);20 f = g_slice_new(owl_filter); 21 21 22 22 f->name=g_strdup(name); … … 69 69 if(!argc) return NULL; 70 70 71 fe = g_ new(owl_filterelement, 1);71 fe = g_slice_new(owl_filterelement); 72 72 owl_filterelement_create(fe); 73 73 … … 114 114 err: 115 115 owl_filterelement_cleanup(fe); 116 g_ free(fe);116 g_slice_free(owl_filterelement, fe); 117 117 return NULL; 118 118 } … … 124 124 125 125 op1 = owl_filter_parse_primitive_expression(argc-i, argv+i, &skip); 126 if(!op1) goto err; 126 127 i += skip; 127 if(!op1) goto err;128 128 129 129 while(i < argc) { … … 132 132 op2 = owl_filter_parse_primitive_expression(argc-i-1, argv+i+1, &skip); 133 133 if(!op2) goto err; 134 tmp = g_ new(owl_filterelement, 1);134 tmp = g_slice_new(owl_filterelement); 135 135 if(!strcasecmp(argv[i], "and")) { 136 136 owl_filterelement_create_and(tmp, op1, op2); … … 152 152 if(op1) { 153 153 owl_filterelement_cleanup(op1); 154 g_ free(op1);154 g_slice_free(owl_filterelement, op1); 155 155 } 156 156 return NULL; … … 219 219 } 220 220 else { 221 g_string_append_printf(out, "%i",f-> fgcolor);221 g_string_append_printf(out, "%i",f->bgcolor); 222 222 } 223 223 g_string_append(out, " "); … … 262 262 if (f->root) { 263 263 owl_filterelement_cleanup(f->root); 264 g_ free(f->root);264 g_slice_free(owl_filterelement, f->root); 265 265 } 266 266 if (f->name) 267 267 g_free(f->name); 268 g_ free(f);269 } 268 g_slice_free(owl_filter, f); 269 } -
filterelement.c
r7756dde r7dcef03 328 328 if (fe->left) { 329 329 owl_filterelement_cleanup(fe->left); 330 g_ free(fe->left);330 g_slice_free(owl_filterelement, fe->left); 331 331 } 332 332 if (fe->right) { 333 333 owl_filterelement_cleanup(fe->right); 334 g_ free(fe->right);334 g_slice_free(owl_filterelement, fe->right); 335 335 } 336 336 owl_regex_cleanup(&(fe->re)); -
filterproc.c
rf271129 r7155955 1 #include " owl.h"1 #include "filterproc.h" 2 2 #include <sys/wait.h> 3 #include <fcntl.h> 4 #include <glib.h> 3 5 #include <poll.h> 6 #include <string.h> 7 #include <unistd.h> 4 8 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). */ 11 static int send_receive(int rfd, int wfd, const char *out, char **in) 6 12 { 7 13 GString *str = g_string_new(""); … … 18 24 fds[1].fd = wfd; 19 25 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 } 20 32 21 33 while(1) { … … 40 52 } 41 53 if(!out || !*out || fds[1].revents & (POLLERR | POLLHUP)) { 42 close(wfd); 54 close(wfd); wfd = -1; 43 55 out = NULL; 44 56 } … … 56 68 } 57 69 70 if (wfd >= 0) close(wfd); 71 close(rfd); 58 72 *in = g_string_free(str, err < 0); 59 73 return err; 60 74 } 61 75 62 int call_filter(const char * prog, const char *const *argv, const char *in, char **out, int *status)76 int call_filter(const char *const *argv, const char *in, char **out, int *status) 63 77 { 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; 68 81 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; 97 89 } 98 90 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 } 106 95 return err; 107 96 } -
filterproc.h
r06adc25 r97cdbaf5 2 2 #define INC_BARNOWL_FILTER_PROC_H 3 3 4 int call_filter(const char *prog, 5 const char *const *argv, 4 int call_filter(const char *const *argv, 6 5 const char *in, 7 6 char **out, int *status); -
functions.c
r0071c88 r7dcef03 115 115 void owl_function_show_license(void) 116 116 { 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" 121 119 "Copyright (c) 2006-2011 The BarnOwl Developers. All rights reserved.\n" 122 120 "Copyright (c) 2004 James Kretchmar. All rights reserved.\n" … … 155 153 "WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n" 156 154 "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); 158 157 owl_function_popless_text(text); 158 g_free(text); 159 159 } 160 160 … … 196 196 owl_message *m; 197 197 198 m=g_ new(owl_message, 1);198 m=g_slice_new(owl_message); 199 199 owl_message_create_admin(m, header, body); 200 200 … … 204 204 205 205 /* 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(); 207 207 208 208 /* redisplay etc. */ … … 216 216 void owl_function_add_outgoing_zephyrs(const owl_zwrite *z) 217 217 { 218 if (z->cc || owl_zwrite_get_numrecips(z) == 0) {218 if (z->cc && owl_zwrite_is_personal(z)) { 219 219 /* create the message */ 220 owl_message *m = g_ new(owl_message, 1);220 owl_message *m = g_slice_new(owl_message); 221 221 owl_message_create_from_zwrite(m, z, owl_zwrite_get_message(z), 0); 222 222 … … 225 225 int i; 226 226 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 227 232 /* create the message */ 228 owl_message *m = g_new(owl_message, 1);233 m = g_slice_new(owl_message); 229 234 owl_message_create_from_zwrite(m, z, owl_zwrite_get_message(z), i); 230 235 … … 246 251 if (!owl_global_is_aimloggedin(&g)) return(NULL); 247 252 248 m=g_ new(owl_message, 1);253 m=g_slice_new(owl_message); 249 254 owl_message_create_aim(m, 250 255 owl_global_get_aim_screenname(&g), … … 265 270 266 271 /* create the message */ 267 m=g_ new(owl_message, 1);272 m=g_slice_new(owl_message); 268 273 owl_message_create_loopback(m, body); 269 274 owl_message_set_direction_out(m); … … 272 277 } 273 278 274 void owl_function_start_edit_win(const char *line, void (*callback)(owl_editwin *), void *data, void (*cleanup)(void *))279 owl_editwin *owl_function_start_edit_win(const char *line) 275 280 { 276 281 owl_editwin *e; … … 286 291 g_free(s); 287 292 288 owl_editwin_set_cbdata(e, data, cleanup);289 owl_editwin_set_callback(e, callback);290 293 ctx = owl_editcontext_new(OWL_CTX_EDITMULTI, e, "editmulti", 291 294 owl_global_deactivate_editcontext, &g); 292 295 owl_global_push_context_obj(&g, ctx); 293 296 return e; 294 297 } 295 298 … … 309 312 void owl_function_zwrite_setup(owl_zwrite *z) 310 313 { 314 owl_editwin *e; 311 315 /* send a ping if necessary */ 312 316 if (owl_global_is_txping(&g)) { … … 316 320 317 321 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); 321 325 } 322 326 323 327 void owl_function_aimwrite_setup(const char *to) 324 328 { 329 owl_editwin *e; 325 330 /* TODO: We probably actually want an owl_aimwrite object like 326 331 * owl_zwrite. */ 327 332 char *line = g_strdup_printf("aimwrite %s", to); 328 333 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); 333 337 g_free(line); 334 338 } … … 336 340 void owl_function_loopwrite_setup(void) 337 341 { 342 owl_editwin *e; 338 343 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 348 void owl_callback_zwrite(owl_editwin *e, bool success) 349 { 350 if (!success) return; 345 351 owl_zwrite *z = owl_editwin_get_cbdata(e); 346 352 owl_function_zwrite(z, owl_editwin_get_text(e)); … … 372 378 owl_function_makemsg("Waiting for ack..."); 373 379 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); 379 382 } 380 383 #else … … 402 405 403 406 zcrypt = g_build_filename(owl_get_bindir(), "zcrypt", NULL); 404 argv[0] = "zcrypt";407 argv[0] = zcrypt; 405 408 argv[1] = "-E"; 406 409 argv[2] = "-c"; argv[3] = owl_zwrite_get_class(z); … … 408 411 argv[6] = NULL; 409 412 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); 411 414 412 415 g_free(zcrypt); … … 426 429 owl_function_makemsg("Waiting for ack..."); 427 430 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. */ 436 436 g_free(cryptmsg); 437 } 438 439 void owl_callback_aimwrite(owl_editwin *e) { 437 g_free(old_msg); 438 } 439 440 void owl_callback_aimwrite(owl_editwin *e, bool success) 441 { 442 if (!success) return; 440 443 char *to = owl_editwin_get_cbdata(e); 441 444 owl_function_aimwrite(to, owl_editwin_get_text(e), true); … … 501 504 } 502 505 503 void owl_callback_loopwrite(owl_editwin *e) { 506 void owl_callback_loopwrite(owl_editwin *e, bool success) 507 { 508 if (!success) return; 504 509 owl_function_loopwrite(owl_editwin_get_text(e)); 505 510 } … … 511 516 /* create a message and put it on the message queue. This simulates 512 517 * an incoming message */ 513 min=g_ new(owl_message, 1);518 min=g_slice_new(owl_message); 514 519 mout=owl_function_make_outgoing_loopback(msg); 515 520 … … 808 813 } 809 814 810 void owl_function_lastmsg _noredisplay(void)815 void owl_function_lastmsg(void) 811 816 { 812 817 int oldcurmsg, curmsg; … … 826 831 owl_global_set_curmsg(&g, curmsg+1); 827 832 } 828 /* owl_mainwin_redisplay(owl_global_get_mainwin(&g)); */833 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 829 834 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));836 835 } 837 836 … … 856 855 void owl_function_unsuball(void) 857 856 { 858 unsuball();859 owl_function_makemsg("Unsubscribed from all messages.");857 if (unsuball()) 858 owl_function_makemsg("Unsubscribed from all messages."); 860 859 } 861 860 … … 872 871 void owl_function_loadsubs(const char *file) 873 872 { 874 int ret, ret2; 875 const char *foo; 873 int ret, ret2, ret3; 876 874 char *path; 877 875 … … 885 883 886 884 /* for backwards compatibility for now */ 887 ret2=owl_zephyr_loaddefaultsubs(); 885 ret2 = owl_zephyr_loaddefaultsubs(); 886 ret3 = owl_zephyr_loadbarnowldefaultsubs(); 888 887 889 888 if (!owl_context_is_interactive(owl_global_get_context(&g))) return; 890 889 891 foo=file?file:"file"; 892 if (ret==0 && ret2==0) { 890 if (ret == 0 && ret2 == 0 && ret3 == 0) { 893 891 if (!file) { 894 892 owl_function_makemsg("Subscribed to messages."); … … 896 894 owl_function_makemsg("Subscribed to messages from %s", file); 897 895 } 898 } else if (ret ==-1) {899 owl_function_error("Could not read %s", f oo);900 } else {896 } else if (ret == -1) { 897 owl_function_error("Could not read %s", file ? file : "file"); 898 } else if (ret2 == -1) { 901 899 owl_function_error("Error subscribing to messages"); 900 } else { 901 owl_function_error("Error subscribing to instanced personals"); 902 902 } 903 903 } … … 918 918 } 919 919 920 void owl_callback_aimlogin(owl_editwin *e) { 920 void owl_callback_aimlogin(owl_editwin *e, bool success) 921 { 922 if (!success) return; 921 923 char *user = owl_editwin_get_cbdata(e); 922 924 owl_function_aimlogin(user, … … 989 991 /* owl_aim_set_awaymsg(""); */ 990 992 owl_function_makemsg("AIM away off"); 993 } 994 995 bool 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); 991 1000 } 992 1001 … … 1350 1359 void owl_function_about(void) 1351 1360 { 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" 1354 1363 "BarnOwl is a fork of the Owl zephyr client, written and\n" 1355 1364 "maintained by Alejandro Sedeno and Nelson Elhage at the\n" … … 1370 1379 "This program is free software. You can redistribute it and/or\n" 1371 1380 "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); 1374 1385 } 1375 1386 … … 1430 1441 char *tmpbuff, *tmpbuff2; 1431 1442 int i, fields; 1443 const char *f; 1432 1444 1433 1445 if (!owl_message_is_pseudo(m)) { … … 1460 1472 owl_fmtext_append_normal(&fm, "\n"); 1461 1473 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)); 1462 1475 owl_fmtext_appendf_normal(&fm, " Auth : %s\n", owl_zephyr_get_authstr(n)); 1463 1476 … … 1471 1484 owl_fmtext_appendf_normal(&fm, " Fields : %i\n", fields); 1472 1485 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); 1475 1489 tmpbuff2 = owl_text_indent(tmpbuff, 14, false); 1476 1490 owl_fmtext_appendf_normal(&fm, " Field %i : %s\n", i + 1, tmpbuff2); … … 1770 1784 1771 1785 owl_fmtext_append_normal(&fm, " Version: "); 1772 owl_fmtext_append_normal(&fm, OWL_VERSION_STRING);1786 owl_fmtext_append_normal(&fm, version); 1773 1787 owl_fmtext_append_normal(&fm, "\n"); 1774 1788 … … 1940 1954 } 1941 1955 1942 void owl_callback_command(owl_editwin *e) 1943 { 1956 void owl_callback_command(owl_editwin *e, bool success) 1957 { 1958 if (!success) return; 1944 1959 char *rv; 1945 1960 const char *line = owl_editwin_get_text(e); … … 1952 1967 } 1953 1968 1954 voidowl_function_start_command(const char *line)1969 owl_editwin *owl_function_start_command(const char *line) 1955 1970 { 1956 1971 owl_editwin *tw; … … 1967 1982 owl_global_push_context_obj(&g, ctx); 1968 1983 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 1987 owl_editwin *owl_function_start_question(const char *line) 1972 1988 { 1973 1989 owl_editwin *tw; … … 1984 2000 } 1985 2001 1986 CALLER_OWNowl_editwin *owl_function_start_password(const char *line)2002 owl_editwin *owl_function_start_password(const char *line) 1987 2003 { 1988 2004 owl_editwin *tw; … … 2181 2197 f = owl_filter_new(argv[1], argc-2, argv+2); 2182 2198 if (f == NULL) { 2183 owl_function_error("Invalid filter ");2199 owl_function_error("Invalid filter: %s", argv[1]); 2184 2200 return false; 2185 2201 } … … 3466 3482 while (zaldptr) { 3467 3483 ZFreeALD(zaldptr->data); 3468 g_ free(zaldptr->data);3484 g_slice_free(ZAsyncLocateData_t, zaldptr->data); 3469 3485 zaldptr = g_list_next(zaldptr); 3470 3486 } … … 3476 3492 for (i = 0; i < anyone->len; i++) { 3477 3493 user = anyone->pdata[i]; 3478 zald = g_ new(ZAsyncLocateData_t, 1);3494 zald = g_slice_new(ZAsyncLocateData_t); 3479 3495 if (ZRequestLocations(zstr(user), zald, UNACKED, ZAUTH) == ZERR_NONE) { 3480 3496 *zaldlist = g_list_append(*zaldlist, zald); 3481 3497 } else { 3482 g_ free(zald);3498 g_slice_free(ZAsyncLocateData_t, zald); 3483 3499 } 3484 3500 } -
global.c
r9078f69 r7dcef03 9 9 const char *homedir; 10 10 11 #if !GLIB_CHECK_VERSION(2, 35, 0) 11 12 g_type_init(); 13 #endif 14 #if !GLIB_CHECK_VERSION(2, 31, 0) 12 15 g_thread_init(NULL); 16 #endif 13 17 14 18 owl_select_init(); … … 52 56 g->starttime=time(NULL); /* assumes we call init only a start time */ 53 57 g->lastinputtime=g->starttime; 58 g->last_wakeup_time = g->starttime; 54 59 g->newmsgproc_pid=0; 55 60 … … 75 80 g_free(cd); 76 81 77 owl_messagelist_create(&(g->msglist));82 g->msglist = owl_messagelist_new(); 78 83 79 84 _owl_global_init_windows(g); … … 100 105 101 106 g->interrupt_count = 0; 107 #if GLIB_CHECK_VERSION(2, 31, 0) 108 g_mutex_init(&g->interrupt_lock); 109 #else 102 110 g->interrupt_lock = g_mutex_new(); 111 #endif 103 112 } 104 113 … … 109 118 110 119 /* Create the widgets */ 111 owl_mainwin_init(&(g->mw),g->mainpanel.recwin);120 g->mw = owl_mainwin_new(g->mainpanel.recwin); 112 121 owl_msgwin_init(&(g->msgwin), g->mainpanel.msgwin); 113 122 owl_sepbar_init(g->mainpanel.sepwin); … … 241 250 /* windows */ 242 251 243 owl_mainwin *owl_global_get_mainwin(owl_global *g) { 244 return(&(g->mw)); 252 owl_mainwin *owl_global_get_mainwin(owl_global *g) 253 { 254 return g->mw; 245 255 } 246 256 … … 256 266 257 267 owl_messagelist *owl_global_get_msglist(owl_global *g) { 258 return (&(g->msglist));268 return g->msglist; 259 269 } 260 270 … … 475 485 } 476 486 487 void 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 477 495 /* viewwin */ 478 496 … … 535 553 e->g->filterlist = g_list_remove(e->g->filterlist, e->f); 536 554 owl_filter_delete(e->f); 537 g_ free(e);555 g_slice_free(owl_global_filter_ent, e); 538 556 } 539 557 540 558 void 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); 542 560 e->g = g; 543 561 e->f = f; … … 840 858 } filters[] = { 841 859 { "personal", 842 "isprivate ^true$ and ( not type ^zephyr$ or ( class ^message 860 "isprivate ^true$ and ( not type ^zephyr$ or ( class ^message$ ) )" }, 843 861 { "trash", 844 862 "class ^mail$ or opcode ^ping$ or type ^admin$ or ( not login ^none$ )" }, … … 847 865 { "auto", "opcode ^auto$" }, 848 866 { "login", "not login ^none$" }, 849 { "reply-lockout", "class ^mail$ " },867 { "reply-lockout", "class ^mail$ or class ^filsrv$" }, 850 868 { "out", "direction ^out$" }, 851 869 { "aim", "type ^aim$" }, … … 898 916 } 899 917 918 static 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 900 927 void owl_global_add_interrupt(owl_global *g) { 901 928 /* TODO: This can almost certainly be done with atomic 902 929 * operations. Whatever. */ 903 g_mutex_lock( g->interrupt_lock);930 g_mutex_lock(owl_global_get_interrupt_lock(g)); 904 931 g->interrupt_count++; 905 g_mutex_unlock( g->interrupt_lock);932 g_mutex_unlock(owl_global_get_interrupt_lock(g)); 906 933 } 907 934 908 935 bool owl_global_take_interrupt(owl_global *g) { 909 936 bool ans = false; 910 g_mutex_lock( g->interrupt_lock);937 g_mutex_lock(owl_global_get_interrupt_lock(g)); 911 938 if (g->interrupt_count > 0) { 912 939 ans = true; 913 940 g->interrupt_count--; 914 941 } 915 g_mutex_unlock( g->interrupt_lock);942 g_mutex_unlock(owl_global_get_interrupt_lock(g)); 916 943 return ans; 917 944 } -
help.c
rf271129 r8258ea5 73 73 " : , M-x Enter command mode\n" 74 74 "\n" 75 " / Fo ward search\n"75 " / Forward search\n" 76 76 " ? Reverse search\n" 77 77 "\n\n" … … 107 107 " unsuball Unsubscribe from all zephyr classes\n" 108 108 " load-subs Load zephyr subscriptions from a file\n" 109 " zpunt Sup ress messages from a zephyr triplet\n"109 " zpunt Suppress messages from a zephyr triplet\n" 110 110 " zlog Send a login or logout notification\n" 111 111 " zlist Print a list of zephyr buddies logged in\n" -
keybinding.c
rf271129 r7dcef03 14 14 CALLER_OWN owl_keybinding *owl_keybinding_new(const char *keyseq, const char *command, void (*function_fn)(void), const char *desc) 15 15 { 16 owl_keybinding *kb = g_ new(owl_keybinding, 1);16 owl_keybinding *kb = g_slice_new(owl_keybinding); 17 17 18 18 owl_function_debugmsg("owl_keybinding_init: creating binding for <%s> with desc: <%s>", keyseq, desc); 19 19 if (command && function_fn) { 20 g_ free(kb);20 g_slice_free(owl_keybinding, kb); 21 21 return NULL; 22 22 } else if (command && !function_fn) { … … 29 29 30 30 if (owl_keybinding_make_keys(kb, keyseq) != 0) { 31 g_ free(kb);31 g_slice_free(owl_keybinding, kb); 32 32 return NULL; 33 33 } … … 70 70 g_free(kb->desc); 71 71 g_free(kb->command); 72 g_ free(kb);72 g_slice_free(owl_keybinding, kb); 73 73 } 74 74 -
keymap.c
rf271129 r7dcef03 189 189 { 190 190 owl_keymap *km; 191 km = g_ new(owl_keymap, 1);191 km = g_slice_new(owl_keymap); 192 192 owl_keymap_init(km, name, desc, default_fn, prealways_fn, postalways_fn); 193 193 owl_keyhandler_add_keymap(kh, km); -
libfaim/Makefile.am
r215c119 rb80bae0 13 13 libfaim_a_CPPFLAGS = -DAIM_BUILDDATE=\"x\" -DAIM_BUILDTIME=\"x\" \ 14 14 -I${top_srcdir}/libfaim 15 16 EXTRA_DIST = oscar.c -
logging.c
rf271129 r7dcef03 177 177 g_free(msg->message); 178 178 g_free(msg->filename); 179 g_ free(msg);179 g_slice_free(owl_log_entry, msg); 180 180 } 181 181 } … … 184 184 { 185 185 owl_log_entry *log_msg = NULL; 186 log_msg = g_ new(owl_log_entry,1);186 log_msg = g_slice_new(owl_log_entry); 187 187 log_msg->message = g_strdup(buffer); 188 188 log_msg->filename = g_strdup(filename); … … 266 266 * owl_log_shouldlog_message(void) 267 267 */ 268 m = g_ new(owl_message, 1);268 m = g_slice_new(owl_message); 269 269 /* recip_index = 0 because there can only be one recipient anyway */ 270 270 owl_message_create_from_zwrite(m, zw, text, 0); … … 429 429 static gpointer owl_log_thread_func(gpointer data) 430 430 { 431 log_context = g_main_context_new();432 431 log_loop = g_main_loop_new(log_context, FALSE); 433 432 g_main_loop_run(log_loop); … … 437 436 void owl_log_init(void) 438 437 { 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 439 444 GError *error = NULL; 440 445 logging_thread = g_thread_create(owl_log_thread_func, … … 448 453 exit(1); 449 454 } 455 #endif 450 456 451 457 } -
m4/ax_cflags_warn_all.m4
r378ede7 re9b4a2c 25 25 # - $3 action-if-found : add value to shellvariable 26 26 # - $4 action-if-not-found : nothing 27 # 28 # NOTE: These macros depend on AX_APPEND_FLAG. 27 29 # 28 30 # LICENSE … … 57 59 # exception to the GPL to apply to your modified version as well. 58 60 59 #serial 1 061 #serial 14 60 62 61 AC_DEFUN([AX_ CFLAGS_WARN_ALL],[dnl62 AS_VAR_PUSHDEF([FLAGS],[ CFLAGS])dnl63 AS_VAR_PUSHDEF([VAR],[ac_cv_ cflags_warn_all])dnl63 AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl 64 AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl 65 AS_VAR_PUSHDEF([VAR],[ac_cv_[]_AC_LANG_ABBREV[]flags_warn_all])dnl 64 66 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], 65 67 VAR,[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" 68 ac_save_[]FLAGS="$[]FLAGS" 152 69 for ac_arg dnl 153 70 in "-warn all % -warn all" dnl Intel … … 165 82 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) 166 83 done 167 FLAGS="$ac_save_[]FLAGS" 168 AC_LANG_POP([Fortran]) 84 FLAGS="$ac_save_[]FLAGS" 169 85 ]) 86 AS_VAR_POPDEF([FLAGS])dnl 87 AC_REQUIRE([AX_APPEND_FLAG]) 170 88 case ".$VAR" in 171 89 .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])]) ;; 181 92 esac 182 93 AS_VAR_POPDEF([VAR])dnl 183 AS_VAR_POPDEF([FLAGS])dnl 184 ]) 185 94 ])dnl AX_FLAGS_WARN_ALL 186 95 dnl implementation tactics: 187 96 dnl the for-argument contains a list of options. The first part of … … 194 103 dnl delimiter. A non-option comment can be given after "%%" marks 195 104 dnl which will be shown but not added to the respective C/CXXFLAGS. 105 106 AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl 107 AC_LANG_PUSH([C]) 108 AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) 109 AC_LANG_POP([C]) 110 ]) 111 112 AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl 113 AC_LANG_PUSH([C++]) 114 AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) 115 AC_LANG_POP([C++]) 116 ]) 117 118 AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl 119 AC_LANG_PUSH([Fortran]) 120 AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) 121 AC_LANG_POP([Fortran]) 122 ]) -
m4/pkg.m4
r650fb2c r13a39ae8 158 158 fi[]dnl 159 159 ])# 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. 169 AC_DEFUN([PKG_INSTALLDIR], 170 [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) 171 m4_pushdef([pkg_description], 172 [pkg-config installation directory @<:@]pkg_default[@:>@]) 173 AC_ARG_WITH([pkgconfigdir], 174 [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, 175 [with_pkgconfigdir=]pkg_default) 176 AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) 177 m4_popdef([pkg_default]) 178 m4_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. 189 AC_DEFUN([PKG_NOARCH_INSTALLDIR], 190 [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) 191 m4_pushdef([pkg_description], 192 [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) 193 AC_ARG_WITH([noarch-pkgconfigdir], 194 [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, 195 [with_noarch_pkgconfigdir=]pkg_default) 196 AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) 197 m4_popdef([pkg_default]) 198 m4_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. 206 AC_DEFUN([PKG_CHECK_VAR], 207 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 208 AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl 209 210 _PKG_CONFIG([$1], [variable="][$3]["], [$2]) 211 AS_VAR_COPY([$1], [pkg_cv_][$1]) 212 213 AS_VAR_IF([$1], [""], [$5], [$4])dnl 214 ])# PKG_CHECK_VAR -
mainwin.c
r099597c r7dcef03 4 4 static void owl_mainwin_resized(owl_window *w, void *user_data); 5 5 6 void owl_mainwin_init(owl_mainwin *mw,owl_window *window)6 CALLER_OWN owl_mainwin *owl_mainwin_new(owl_window *window) 7 7 { 8 owl_mainwin *mw = g_slice_new(owl_mainwin); 8 9 mw->curtruncated=0; 9 10 mw->lastdisplayed=-1; … … 16 17 /* For now, we do not bother with connecting up dependencies; that'll be a 17 18 * future refactor of the mainwin */ 19 20 return mw; 18 21 } 19 22 -
message.c
r0071c88 r7dcef03 70 70 71 71 if(pair == NULL) { 72 pair = g_ new(owl_pair, 1);72 pair = g_slice_new(owl_pair); 73 73 owl_pair_create(pair, attrname, NULL); 74 74 g_ptr_array_add(m->attributes, pair); … … 836 836 837 837 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)) { 842 840 owl_message_set_isprivate(m); 843 841 } … … 877 875 if (owl_global_is_zcrypt(&g) && !strcasecmp(n->z_opcode, "crypt")) { 878 876 const char *argv[] = { 879 "zcrypt",877 NULL, 880 878 "-D", 881 879 "-c", owl_message_get_class(m), … … 883 881 NULL 884 882 }; 885 char *out ;883 char *out = NULL; 886 884 int rv; 887 885 int status; … … 889 887 890 888 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); 893 892 g_free(zcrypt); 894 893 … … 899 898 } 900 899 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); 905 906 } 906 907 … … 1018 1019 p = m->attributes->pdata[i]; 1019 1020 g_free(owl_pair_get_value(p)); 1020 g_ free(p);1021 g_slice_free(owl_pair, p); 1021 1022 } 1022 1023 … … 1029 1030 { 1030 1031 owl_message_cleanup(m); 1031 g_ free(m);1032 } 1032 g_slice_free(owl_message, m); 1033 } -
messagelist.c
rf271129 r7dcef03 1 1 #include "owl.h" 2 2 3 void owl_messagelist_create(owl_messagelist *ml)3 CALLER_OWN owl_messagelist *owl_messagelist_new(void) 4 4 { 5 owl_messagelist *ml = g_slice_new(owl_messagelist); 5 6 ml->list = g_ptr_array_new(); 7 return ml; 6 8 } 7 9 8 void owl_messagelist_ cleanup(owl_messagelist *ml, bool free_messages)10 void owl_messagelist_delete(owl_messagelist *ml, bool free_messages) 9 11 { 10 12 if (free_messages) 11 13 g_ptr_array_foreach(ml->list, (GFunc)owl_message_delete, NULL); 12 14 g_ptr_array_free(ml->list, true); 15 g_slice_free(owl_messagelist, ml); 13 16 } 14 17 -
owl.c
rf271129 r441fd42 12 12 #include <sys/stat.h> 13 13 #include <locale.h> 14 #include <unistd.h> 14 15 15 16 #if OWL_STDERR_REDIR … … 33 34 } owl_options; 34 35 35 void usage( void)36 void usage(FILE *file) 36 37 { 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"); 46 47 } 47 48 … … 79 80 break; 80 81 case 'v': 81 printf("This is BarnOwl version %s\n", OWL_VERSION_STRING);82 printf("This is BarnOwl version %s\n", version); 82 83 exit(0); 83 84 case 'h': 85 usage(stdout); 86 exit(0); 84 87 default: 85 usage( );88 usage(stderr); 86 89 exit(1); 87 90 } … … 262 265 /* follow the last message if we're supposed to */ 263 266 if (followlast) 264 owl_function_lastmsg _noredisplay();267 owl_function_lastmsg(); 265 268 266 269 /* do the newmsgproc thing */ … … 286 289 287 290 owl_global_set_lastinputtime(&g, time(NULL)); 291 owl_global_wakeup(&g); 288 292 ret = owl_keyhandler_process(owl_global_get_keyhandler(&g), j); 289 293 if (ret!=0 && ret!=1) { … … 427 431 if (0 != pipe(pipefds)) { 428 432 perror("pipe"); 429 owl_function_debugmsg("stderr_replace: pipe FAILED \n");433 owl_function_debugmsg("stderr_replace: pipe FAILED"); 430 434 return -1; 431 435 } 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)); 435 439 perror("dup2"); 436 440 return -1; … … 514 518 #if OWL_STDERR_REDIR 515 519 /* 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 } 520 526 #endif 521 527 … … 572 578 /* welcome message */ 573 579 owl_function_debugmsg("startup: creating splash message"); 574 owl_function_adminmsg("",580 char *welcome = g_strdup_printf( 575 581 "-----------------------------------------------------------------------\n" 576 "Welcome to BarnOwl version " OWL_VERSION_STRING ".\n"582 "Welcome to BarnOwl version %s.\n" 577 583 "To see a quick introduction, type ':show quickstart'. \n" 578 584 "Press 'h' for on-line help. \n" … … 582 588 " OvO \n" 583 589 "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); 586 599 587 600 /* process the startup file */ … … 596 609 owl_function_error("No such style: %s", owl_global_get_default_style(&g)); 597 610 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 603 611 source = owl_window_redraw_source_new(); 604 612 g_source_attach(source, NULL); -
owl.h
rb9517cf rca1fb26a 10 10 #define INC_BARNOWL_OWL_H 11 11 12 #include "config.h"12 #include <config.h> 13 13 14 14 #include "compat/compat.h" … … 47 47 /* Perl and curses don't play nice. */ 48 48 #ifdef OWL_PERL 49 typedef voidWINDOW;50 typedef voidPANEL;49 typedef struct _owl_fake_WINDOW WINDOW; 50 typedef struct _owl_fake_PANEL PANEL; 51 51 /* logout is defined in FreeBSD. */ 52 52 #define logout logout_ … … 57 57 #include "XSUB.h" 58 58 #else 59 typedef voidSV;60 typedef voidAV;61 typedef voidHV;59 typedef struct _owl_fake_SV SV; 60 typedef struct _owl_fake_AV AV; 61 typedef struct _owl_fake_HV HV; 62 62 #endif 63 63 64 64 #include "window.h" 65 65 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 */ 66 extern const char *version; 75 67 76 68 /* Feature that is being tested to redirect stderr through a pipe. … … 235 227 char *name; 236 228 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 */ 240 231 char *summary; /* summary of usage */ 241 232 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; 244 252 /* returns 1 if newval is valid */ 245 int (*set_fn)(struct _owl_variable *v, const void *newval);253 GCallback set_fn; 246 254 /* 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. */ 266 259 } owl_variable; 260 267 261 268 262 typedef struct _owl_input { … … 452 446 char *name; 453 447 owl_filter *filter; 454 owl_messagelist ml;448 owl_messagelist *ml; 455 449 const owl_style *style; 456 450 int cachedmsgid; … … 533 527 534 528 typedef struct _owl_global { 535 owl_mainwin mw;529 owl_mainwin *mw; 536 530 owl_popwin *pw; 537 531 owl_msgwin msgwin; … … 551 545 int curmsg_vert_offset; 552 546 owl_view current_view; 553 owl_messagelist msglist;547 owl_messagelist *msglist; 554 548 WINDOW *input_pad; 555 549 owl_mainpanel mainpanel; … … 569 563 time_t starttime; 570 564 time_t lastinputtime; 565 time_t last_wakeup_time; 571 566 char *startupargs; 572 567 int nextmsgid; … … 596 591 char *kill_buffer; 597 592 int interrupt_count; 593 #if GLIB_CHECK_VERSION(2, 31, 0) 594 GMutex interrupt_lock; 595 #else 598 596 GMutex *interrupt_lock; 597 #endif 599 598 } owl_global; 600 599 … … 602 601 extern owl_global g; 603 602 604 #include "owl_prototypes.h"603 #include <owl_prototypes.h> 605 604 606 605 /* These were missing from the Zephyr includes before Zephyr 3. */ … … 610 609 #endif 611 610 611 /* We have to dynamically bind these ourselves */ 612 extern gboolean (*gvalue_from_sv) (GValue * value, SV * sv); 613 extern SV * (*sv_from_gvalue) (const GValue * value); 614 extern GClosure * (*perl_closure_new) (SV * callback, SV * data, gboolean swap); 615 616 612 617 #endif /* INC_BARNOWL_OWL_H */ -
owl_perl.h
rf271129 r92ffd89 4 4 #include <stdio.h> 5 5 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 } 7 22 8 23 /* 9 24 * 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. 11 26 * 12 27 * 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 19 35 * 20 36 * See also: `perldoc perlcall', `perldoc perlapi' 21 37 */ 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); \ 39 65 } \ 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; \ 55 72 } 56 73 -
perl/Makefile.am
r10557e6 ra870319 1 1 SUBDIRS = modules 2 nobase_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 5 5 6 6 use base qw(Exporter); 7 our @EXPORT_OK = qw(command getcurmsg getnumcols getidletime 7 our @EXPORT_OK = qw(command getcurmsg getnumcols getnumlines getidletime 8 register_idle_watcher unregister_idle_watcher 8 9 zephyr_getsender zephyr_getrealm zephyr_zwrite 9 10 zephyr_stylestrip zephyr_smartstrip_user zephyr_getsubs 10 11 queue_message admin_message 12 start_edit 11 13 start_question start_password start_edit_win 12 14 get_data_dir get_config_dir popless_text popless_ztext 13 15 error debug 14 16 create_style getnumcolors wordwrap 17 message_matches_filter 15 18 add_dispatch remove_dispatch 16 19 add_io_dispatch remove_io_dispatch 17 20 new_command 18 21 new_variable_int new_variable_bool new_variable_string 22 new_variable_enum 19 23 quote redisplay); 20 24 our %EXPORT_TAGS = (all => \@EXPORT_OK); … … 43 47 44 48 use List::Util qw(max); 49 use Tie::RefHash; 45 50 46 51 =head1 NAME … … 92 97 command line, and C<MESSAGE> is the zephyr body to send. 93 98 99 =cut 100 101 sub 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 94 107 =head2 ztext_stylestrip STRING 95 108 … … 105 118 Enqueue a message in the BarnOwl message list, logging it and 106 119 processing 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. 120 BarnOwl::Message or a subclass. 109 121 110 122 =head2 admin_message HEADER BODY … … 112 124 Display a BarnOwl B<Admin> message, with the given header and body. 113 125 126 =head2 start_edit %ARGS 127 128 Displays a prompt on the screen and lets the user enter text, 129 and calls a callback when the editwin is closed. 130 131 C<%ARGS> must contain the following keys: 132 133 =over 4 134 135 =item prompt 136 137 The line to display on the screen 138 139 =item type 140 141 One of: 142 143 =over 4 144 145 =item edit_win 146 147 Displays the prompt on a line of its own and opens the edit_win. 148 149 =item question 150 151 Displays prompt on the screen and lets the user enter a line of 152 text. 153 154 =item password 155 156 Like question, but echoes the user's input as C<*>s when they 157 input. 158 159 =back 160 161 =item callback 162 163 A Perl subroutine that is called when the user closes the edit_win. 164 C<CALLBACK> gets called with two parameters: the text the user entered, 165 and a C<SUCCESS> boolean parameter which is false if the user canceled 166 the edit_win and true otherwise. 167 168 =back 169 114 170 =head2 start_question PROMPT CALLBACK 115 171 116 Displays C<PROMPT> on the screen and lets the user enter a line of117 text, and calls C<CALLBACK>, which must be a perl subroutine118 reference, with the text the user entered119 120 172 =head2 start_password PROMPT CALLBACK 121 173 122 Like C<start_question>, but echoes the user's input as C<*>s when they123 input.124 125 174 =head2 start_edit_win PROMPT CALLBACK 126 175 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. 176 Roughly equivalent to C<start_edit> called with the appropriate parameters. 177 C<CALLBACK> is only called on success, for compatibility. 178 179 These are deprecated wrappers around L<BarnOwl::start_edit>, and should not 180 be uesd in new code. 181 182 =cut 183 184 sub start_edit { 185 my %args = (@_); 186 BarnOwl::Internal::start_edit($args{type}, $args{prompt}, $args{callback}); 187 } 188 189 sub 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 197 sub 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 205 sub 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 } 130 212 131 213 =head2 get_data_dir … … 160 242 161 243 Returns the number of colors this BarnOwl is capable of displaying 244 245 =head2 message_matches_filter MESSAGE FILTER_NAME [QUIET = 0] 246 247 Returns 1 if C<FILTER_NAME> is the name of a valid filter, and 248 C<MESSAGE> matches that filter. Returns 0 otherwise. If 249 C<QUIET> is false, this method displays an error message if 250 if C<FILTER_NAME> does not name a valid filter. 162 251 163 252 =head2 add_dispatch FD CALLBACK … … 259 348 our @all_commands; 260 349 261 if(!$configfile && -f $ENV{HOME} . "/.barnowlconf") { 262 $configfile = $ENV{HOME} . "/.barnowlconf"; 263 } 264 $configfile ||= $ENV{HOME}."/.owlconf"; 350 if(!$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 } 265 359 266 360 # populate global variable space for legacy owlconf files … … 319 413 =head2 new_variable_string NAME [{ARGS}] 320 414 321 Add a new owl variable, either an int, a bool, or a string, with the 415 =head2 new_variable_enum NAME [{ARGS}] 416 417 Add a new owl variable, either an int, a bool, a string, or an enum with the 322 418 specified name. 323 419 324 ARGS can optionally contain the following keys: 420 For new_variable_enum, ARGS is required to contain a validsettings key pointing 421 to an array reference. For all four, it can optionally contain the following 422 keys: 325 423 326 424 =over 4 … … 340 438 =back 341 439 440 In addition, new_variable_string optionally accepts a string validsettings 441 parameter, in case people want to set it to "<path>". 442 342 443 =cut 343 444 344 445 sub 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 }); 347 458 } 348 459 349 460 sub 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 }); 352 473 } 353 474 354 475 sub 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 490 sub 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 514 Create 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 524 The get/set functions are required. Note that the caller manages storage for the 525 variable. get_tostring/set_fromstring both convert AND store the value. 526 set_fromstring dies on failure. 527 528 If the variable takes parameters 'on' and 'off' (i.e. is boolean-looking), set 529 takes_on_off to 1. This makes :set VAR and :unset VAR work. set_fromstring will 530 be called with those arguments. 531 532 =cut 533 534 sub new_variable_full { 362 535 my $name = shift; 363 536 my $args = shift || {}; 364 537 my %args = ( 365 summary 538 summary => "", 366 539 description => "", 367 default => $default_default, 540 takes_on_off => 0, 541 validsettings => "<string>", 368 542 %{$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); 370 562 } 371 563 … … 603 795 } 604 796 797 =head3 register_idle_watcher %ARGS 798 799 Call a callback whenever the amount of time the user becomes idle or comes 800 back from being idle. 801 802 You must include the following parameters: 803 804 =over 4 805 806 =item name 807 808 The name given to the idle watcher 809 810 =item after 811 812 How long the user must be idle, in seconds, before the callback is called. 813 If 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 818 The Perl subroutine that gets called when the user has been idle for C<AFTER> 819 seconds, or comes back from being idle. The subroutine is passed one parameter, 820 which is true if the user is currently idle, and false otherwise. 821 822 =back 823 824 This method returns a unique identifier which may be passed to 825 L<BarnOwl::unregister_idle_watcher>. 826 827 =cut 828 829 =head3 unregister_idle_watcher UNIQUE_ID [...] 830 831 Removed and returns the idle watcher specified by C<UNIQUE_ID>. 832 You may specify multiple unique ids. 833 834 =cut 835 836 my %idle_watchers; 837 tie %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 845 sub _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 865 sub 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 872 sub 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 605 878 # Stub for owl::startup / BarnOwl::startup, so it isn't bound to the 606 879 # startup command. This may be redefined in a user's configfile. -
perl/lib/BarnOwl/Complete/Client.pm
r58f4fb2 r4626016 20 20 21 21 my %show = ( 22 information => undef,23 22 colors => undef, 24 23 commands => undef, … … 205 204 BarnOwl::Completion::register_completer(set => \&complete_set); 206 205 BarnOwl::Completion::register_completer(unset => \&complete_set); 207 BarnOwl::Completion::register_completer(startup => \&complete_startup); 206 BarnOwl::Completion::register_completer(startup => \&complete_startup); 207 BarnOwl::Completion::register_completer(unstartup => \&complete_startup); 208 208 BarnOwl::Completion::register_completer(bindkey => \&complete_bindkey); 209 209 BarnOwl::Completion::register_completer(print => \&complete_print); -
perl/lib/BarnOwl/Complete/Zephyr.pm
r3e8625f re6e7842 64 64 BarnOwl::Completion::register_completer(viewuser => \&complete_viewuser); 65 65 BarnOwl::Completion::register_completer(vu => \&complete_viewuser); 66 BarnOwl::Completion::register_completer(viewperson => \&complete_viewuser); 67 BarnOwl::Completion::register_completer(vp => \&complete_viewuser); 66 68 67 69 BarnOwl::Completion::register_completer(unsub => \&complete_unsub); -
perl/lib/BarnOwl/Hooks.pm
rb8a3e00 r120dac7 36 36 Called before BarnOwl shutdown 37 37 38 =item $wakeup 39 40 Called, at most once per second, on user input 41 38 42 =item $receiveMessage 39 43 … … 57 61 from every function registered with this hook will be appended and 58 62 displayed in a popup window, with zephyr formatting parsed. 63 64 =item $awayOn 65 66 Called, for all protocol handlers, to go away, with the away message, 67 if any. 68 69 =item $awayOff 70 71 Called, for all protocol handlers, to come back from away. 72 73 =item $getIsAway 74 75 Called to check away status for all protocol handlers. Protocol 76 handlers should return a true value if any account of the user is away 77 for the given protocol, and a false value otherwise. 59 78 60 79 =item $getQuickstart … … 73 92 74 93 our @EXPORT_OK = qw($startup $shutdown 94 $wakeup 75 95 $receiveMessage $newMessage 76 96 $mainLoop $getBuddyList 97 $awayOn $awayOff $getIsAway 77 98 $getQuickstart); 78 99 … … 83 104 our $startup = BarnOwl::Hook->new; 84 105 our $shutdown = BarnOwl::Hook->new; 106 our $wakeup = BarnOwl::Hook->new; 85 107 our $receiveMessage = BarnOwl::Hook->new; 86 108 our $newMessage = BarnOwl::Hook->new; … … 88 110 our $getBuddyList = BarnOwl::Hook->new; 89 111 our $getQuickstart = BarnOwl::Hook->new; 112 our $awayOn = BarnOwl::Hook->new; 113 our $awayOff = BarnOwl::Hook->new; 114 our $getIsAway = BarnOwl::Hook->new; 90 115 91 116 # Internal startup/shutdown routines called by the C code … … 175 200 } 176 201 202 sub _wakeup { 203 $wakeup->run; 204 } 205 177 206 sub _receive_msg { 178 207 my $m = shift; … … 199 228 sub _get_quickstart { 200 229 return join("\n", $getQuickstart->run); 230 } 231 232 sub _away_on { 233 $awayOn->run(@_); 234 } 235 236 sub _away_off { 237 $awayOff->run(); 238 } 239 240 sub _get_is_away { 241 my @is_away = grep { $_ } $getIsAway->run(); 242 return scalar @is_away; 201 243 } 202 244 -
perl/lib/BarnOwl/Message.pm
ra130fc5 r0adbce1 51 51 sub is_ping { return 0; } 52 52 sub is_mail { return 0; } 53 sub is_personal { return shift->is_private; }53 sub is_personal { return BarnOwl::message_matches_filter(shift, "personal"); } 54 54 sub class { return undef; } 55 55 sub instance { return undef; } -
perl/lib/BarnOwl/Message/Zephyr.pm
redd0be7 r0adbce1 51 51 my ($m) = @_; 52 52 return undef if (!$m->is_loginout); 53 return undef if (!defined($m->fields)); 53 54 return $m->fields->[2]; 54 55 } … … 57 58 my ($m) = @_; 58 59 return undef if (!$m->is_loginout); 60 return undef if (!defined($m->fields)); 59 61 return $m->fields->[0]; 60 62 } … … 63 65 64 66 sub 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 }71 67 72 68 sub is_mail { … … 171 167 $class = $self->class; 172 168 $instance = $self->instance; 173 if ($self->recipient eq '*' || $self->recipient eq '') { 174 $to = ''; 175 } elsif ($self->recipient =~ /^@/) { 169 if ($self->recipient eq '' || $self->recipient =~ /^@/) { 176 170 $to = $self->recipient; 177 171 } else { -
perl/lib/BarnOwl/ModuleLoader.pm
rf544216 rf34728b 127 127 } 128 128 129 sub complete_module_name { 130 return sort(keys %modules); 131 } 132 129 133 sub register_keybindings { 130 134 BarnOwl::new_command('reload-modules', sub {BarnOwl::ModuleLoader->reload}, { … … 138 142 description => q{Reloads a single module located in ~/.owl/modules or the system modules directory} 139 143 }); 144 145 BarnOwl::Completion::register_completer('reload-module', \&complete_module_name); 140 146 } 141 147 -
perl/lib/BarnOwl/Style/Default.pm
r5738650 rebc6f77 113 113 } 114 114 $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 } 115 118 } 116 119 … … 126 129 my $self = shift; 127 130 my $m = shift; 128 my $sender = $m->long_sender; 129 $sender =~ s/\n.*$//s; 131 my $sender = $self->humanize($m->long_sender, 1); 130 132 if (BarnOwl::getvar('colorztext') eq 'on') { 131 133 return " (" . $sender . '@color[default]' . ")"; -
perl/lib/BarnOwl/Zephyr.pm
rdf569c5 r53151d4 12 12 use BarnOwl::Hook; 13 13 14 my$zephyrStartup = BarnOwl::Hook->new;14 our $zephyrStartup = BarnOwl::Hook->new; 15 15 16 16 sub _zephyr_startup { -
perl/lib/Module/Install/BarnOwl.pm
rb8a3e00 re4b8f93 41 41 my $class = ref $self; 42 42 43 my $srcdir = $ENV{BARNOWL_SRCDIR} || '.'; 44 43 45 $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"]); 45 49 46 50 $self->postamble(<<"END_MAKEFILE"); 47 51 48 52 # --- $class section: 53 54 BARNOWL_SRCDIR = $srcdir 55 export BARNOWL_SRCDIR 49 56 50 57 $name.par: pm_to_blib -
perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
rb8a3e00 r926c721 21 21 22 22 use AnyEvent::IRC; 23 use Encode; 24 use File::Spec; 23 25 use Getopt::Long; 24 use Encode;26 use Text::Wrap; 25 27 26 28 our $VERSION = 0.02; 29 30 our $IRC_SUBS_FILENAME = "ircchannels"; 27 31 28 32 our $irc; … … 67 71 }); 68 72 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 69 81 register_commands(); 70 82 BarnOwl::filter(qw{irc type ^IRC$ or ( type ^admin$ and adminheader ^IRC$ )}); … … 129 141 argument listed above, and die if no channel argument can be found. 130 142 143 =item C<CHANNEL_OR_USER> 144 145 Pass the channel argument, but accept it if it's a username (e.g. 146 has no hash). Only relevant with C<CHANNEL_ARG>. 147 131 148 =item C<CHANNEL_OPTIONAL> 132 149 … … 145 162 use constant CHANNEL_ARG => 1; 146 163 use constant CHANNEL_OPTIONAL => 2; 147 148 use constant ALLOW_DISCONNECTED => 4; 164 use constant CHANNEL_OR_USER => 4; 165 166 use constant ALLOW_DISCONNECTED => 8; 149 167 150 168 sub register_commands { … … 154 172 summary => 'Connect to an IRC server', 155 173 usage => 156 'irc-connect [-a ALIAS 174 'irc-connect [-a ALIAS] [-s] [-p PASSWORD] [-n NICK] SERVER [port]', 157 175 description => <<END_DESCR 158 176 Connect to an IRC server. Supported options are: … … 188 206 189 207 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 ), 191 209 { 192 210 summary => 'Send an IRC message', … … 215 233 { 216 234 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 238 Join an IRC channel. If the -t option is present the subscription will only be 239 temporary, i.e., it will not be written to the subscription file and will 240 therefore not be present the next time BarnOwl is started, and will disappear 241 if the connection is lost. 221 242 END_DESCR 222 243 } … … 227 248 { 228 249 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 253 Part from an IRC channel. If the -t option is present the unsubscription will 254 only be temporary, i.e., it will not be updated in the subscription file and 255 will therefore not be in effect the next time BarnOwl is started, or if the 256 connection is lost. 233 257 END_DESCR 234 258 } … … 327 351 This can be used to perform some operation not yet supported by 328 352 BarnOwl, or to define new IRC commands. 353 END_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 364 Load persistent channels from a file. The file defaults to 365 \$HOME/.owl/$IRC_SUBS_FILENAME. If the ALIAS is present, only channels 366 on the given alias are loaded. The ALIAS is case-sensitive. 367 368 Each line of the file should describe a single channel, in the format 369 '\$alias \$channel' (without quotes). 329 370 END_DESCR 330 371 } … … 341 382 ######################## Owl command handlers ################################## 342 383 ################################################################################ 384 385 sub 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 397 sub _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 416 sub 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 435 sub 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 464 sub 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 473 sub 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 } 343 502 344 503 sub cmd_connect { … … 378 537 } 379 538 539 my %channel_hash = get_autoconnect_channels; 540 380 541 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} 387 549 }); 388 550 $ircnets{$alias} = $conn; … … 427 589 @msgs = split "\n\n", $fullbody; 428 590 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 } 429 599 for my $body (@msgs) { 430 600 if ($body =~ /^\/me (.*)/) { … … 463 633 sub cmd_join { 464 634 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 468 663 return; 469 664 } … … 471 666 sub cmd_part { 472 667 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 475 679 $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 476 692 return; 477 693 } … … 573 789 my $alias; 574 790 my $channel; 791 my $is_temporary; 575 792 my $getopt = Getopt::Long::Parser->new; 576 793 my $m = BarnOwl::getcurmsg(); … … 578 795 local @ARGV = @_; 579 796 $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); 581 799 582 800 if(defined($alias)) { … … 591 809 $conn ||= $c; 592 810 } 811 } elsif (defined($channel) && ($flags & CHANNEL_OR_USER)) { 812 shift @ARGV; 593 813 } elsif ($m && $m->type eq 'IRC' && !$m->is_private) { 594 814 $channel = $m->channel; … … 598 818 } 599 819 600 if(! $channel&&820 if(!defined($channel) && 601 821 ($flags & CHANNEL_ARG) && 602 822 !($flags & CHANNEL_OPTIONAL)) { … … 615 835 die("You must specify an IRC network using -a.\n"); 616 836 } 837 push @ARGV, "-t" if $is_temporary; 617 838 if($flags & CHANNEL_ARG) { 618 839 $sub->($cmd, $conn, $channel, @ARGV); -
perl/modules/IRC/lib/BarnOwl/Module/IRC/Completion.pm
rdace02a r76e80de 57 57 } 58 58 59 sub 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 59 70 sub complete_irc_channel { 60 71 my $ctx = shift; … … 95 106 BarnOwl::Completion::register_completer('irc-msg' => \&complete_irc_dest); 96 107 BarnOwl::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);108 BarnOwl::Completion::register_completer('irc-join' => \&complete_irc_join_part); 109 BarnOwl::Completion::register_completer('irc-part' => \&complete_irc_join_part); 99 110 BarnOwl::Completion::register_completer('irc-names' => \&complete_irc_channel); 100 111 BarnOwl::Completion::register_completer('irc-whois' => \&complete_irc_nick); -
perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
r13ee8f2 rbe43554 39 39 my $self = bless({}, $class); 40 40 $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} : []); 42 43 $self->alias($alias); 43 44 $self->server($host); … … 412 413 $self->{reconnect_timer}->stop; 413 414 } 414 $self->{reconnect_timer} = 415 $self->{reconnect_timer} = 415 416 BarnOwl::Timer->new( { 416 417 name => 'IRC (' . $self->alias . ') reconnect_timer', … … 445 446 $self->conn->send_msg(join => $c); 446 447 } 447 $self->autoconnect_channels([]);448 448 } 449 449 $self->conn->enable_ping(60, sub { … … 458 458 my $backoff = $self->backoff; 459 459 460 $self->autoconnect_channels([keys(%{$self->{channel_list}})]);461 460 $self->conn->connect(@{$self->connect_args}); 462 461 } -
perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
rb8a3e00 r41064be 320 320 . "configure [<muc>]\n" 321 321 . " Configures a MUC.\n" 322 . " Necessary to init alize a new MUC.\n"322 . " Necessary to initialize a new MUC.\n" 323 323 . " At present, only the default configuration is supported.\n" 324 324 . " The MUC is taken from the current message if not supplied.\n\n" … … 1313 1313 { 1314 1314 my @answer = $packet->answer; 1315 return $answer[0] {target}, $answer[0]{port};1315 return $answer[0]->target, $answer[0]->port if @answer; 1316 1316 } 1317 1317 … … 1482 1482 } 1483 1483 1484 sub complete_jabberlogout { 1485 my $ctx = shift; 1486 if($ctx->word == 1) { 1487 return ("-A", complete_account() ); 1488 } else { 1489 return (); 1490 } 1491 } 1492 1484 1493 BarnOwl::Completion::register_completer(jwrite => sub { BarnOwl::Module::Jabber::complete_jwrite(@_) }); 1494 BarnOwl::Completion::register_completer(jabberlogout => sub { BarnOwl::Module::Jabber::complete_jabberlogout(@_) }); 1485 1495 1486 1496 1; -
perl/modules/Jabber/lib/Net/Jabber/Component.pm
rc2bed55 ra8c55b5 220 220 $self->{STREAM}->SetCallBacks(node=>undef); 221 221 222 $self->Send("<handshake>".Digest::SHA 1::sha1_hex($self->{SESSION}->{id}.$args{secret})."</handshake>");222 $self->Send("<handshake>".Digest::SHA::sha1_hex($self->{SESSION}->{id}.$args{secret})."</handshake>"); 223 223 my $handshake = $self->Process(); 224 224 -
perl/modules/Jabber/lib/Net/Jabber/Key.pm
rc2bed55 ra8c55b5 104 104 $self->{CACHE} = {}; 105 105 106 if (eval "require Digest::SHA 1")106 if (eval "require Digest::SHA") 107 107 { 108 108 $self->{DIGEST} = 1; 109 Digest::SHA 1->import(qw(sha1 sha1_hex sha1_base64));109 Digest::SHA->import(qw(sha1 sha1_hex sha1_base64)); 110 110 } 111 111 else 112 112 { 113 print "ERROR: You cannot use Key.pm unless you have Digest::SHA 1installed.\n";113 print "ERROR: You cannot use Key.pm unless you have Digest::SHA installed.\n"; 114 114 exit(0); 115 115 } … … 132 132 133 133 my $string = $$.time.rand(1000000); 134 $string = Digest::SHA 1::sha1_hex($string);134 $string = Digest::SHA::sha1_hex($string); 135 135 $self->{DEBUG}->Log1("Generate: key($string)"); 136 136 return $string; -
perl/modules/Jabber/lib/Net/XMPP.pm
rc2bed55 ra8c55b5 213 213 use Time::Local; 214 214 use Carp; 215 use Digest::SHA 1;215 use Digest::SHA; 216 216 use Authen::SASL; 217 217 use MIME::Base64; -
perl/modules/Jabber/lib/Net/XMPP/Protocol.pm
r7f33c18 ra8c55b5 1849 1849 if ($authType eq "zerok") 1850 1850 { 1851 my $hashA = Digest::SHA 1::sha1_hex($password);1852 $args{hash} = Digest::SHA 1::sha1_hex($hashA.$token);1851 my $hashA = Digest::SHA::sha1_hex($password); 1852 $args{hash} = Digest::SHA::sha1_hex($hashA.$token); 1853 1853 1854 1854 for (1..$sequence) 1855 1855 { 1856 $args{hash} = Digest::SHA 1::sha1_hex($args{hash});1856 $args{hash} = Digest::SHA::sha1_hex($args{hash}); 1857 1857 } 1858 1858 } … … 1868 1868 if ($authType eq "digest") 1869 1869 { 1870 $args{digest} = Digest::SHA 1::sha1_hex($self->GetStreamID().$password);1870 $args{digest} = Digest::SHA::sha1_hex($self->GetStreamID().$password); 1871 1871 } 1872 1872 -
perl/modules/Makefile.am
r1fd469d4 re4b8f93 1 MODULES = Jabber IRC WordWrap Twitter 1 MODULES = Jabber IRC WordWrap Twitter Facebook 2 2 3 EXTRA_DIST = $(MODULES:=/Makefile.PL) $(MODULES:=/inc) $(MODULES:=/lib) 3 EXTRA_DIST = $(MODULES:=/Makefile.PL) $(MODULES:=/lib) 4 EXTRA_DIST += \ 5 Facebook/README \ 6 Twitter/README \ 7 Twitter/twitter.example 4 8 5 9 all-local: $(MODULES) … … 7 11 (cd $* && $(MAKE) $*.par) 8 12 13 BARNOWL_PERL := $(shell which perl) -I$(abs_srcdir)/../lib 14 9 15 MODULES_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)') 12 20 13 21 MODULES_CLEAN = $(MODULES:%=clean_%) 14 22 clean-local: $(MODULES_CLEAN) 15 23 $(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 17 28 18 29 MODULES_INSTALL = $(MODULES:%=module_install_%) … … 23 34 ${INSTALL_DATA} $*/$*.par ${DESTDIR}${pkgdatadir}/modules/$*.par 24 35 36 uninstall-local: 37 rm -f $(MODULES:%=${DESTDIR}${pkgdatadir}/modules/%.par) 38 25 39 .PHONY: $(MODULES) $(MODULES_CLEAN) $(MODULES_INSTALL) -
perl/modules/Twitter/lib/BarnOwl/Module/Twitter.pm
rb8a3e00 r140429f 137 137 my $twitter_args = { username => $cfg->{user}, 138 138 password => $cfg->{password}, 139 source => 'barnowl', 139 source => 'barnowl', 140 ssl => 1, 141 legacy_lists_api => 0, 140 142 }; 141 143 if (defined $cfg->{service}) { … … 274 276 ); 275 277 278 BarnOwl::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 283 Favorite the current Twitter message using ACCOUNT (defaults to the 284 account that received the tweet). 285 END_DESCRIPTION 286 } 287 ); 288 276 289 BarnOwl::new_command( 'twitter-follow' => sub { cmd_twitter_follow(@_); }, 277 290 { … … 355 368 $account = $m->account unless defined($account); 356 369 find_account($account)->twitter_retweet($m); 370 return; 371 } 372 373 sub 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); 357 383 return; 358 384 } -
perl/modules/Twitter/lib/BarnOwl/Module/Twitter/Handle.pm
r4ebbfbc r140429f 371 371 $self->twitter_direct($1, $2); 372 372 } elsif(defined $self->{twitter}) { 373 if(length($msg) > 140) {374 die("Twitter: Message over 140 characters long.\n");375 }376 373 $self->twitter_command('update', { 377 374 status => $msg, … … 432 429 } 433 430 431 sub 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 434 442 sub twitter_follow { 435 443 my $self = shift; -
perlconfig.c
rb9517cf r7dcef03 75 75 const char *type; 76 76 char *ptr, *utype, *blessas; 77 int i, j; 77 const char *f; 78 int i; 78 79 const owl_pair *pair; 79 80 const owl_filter *wrap; … … 91 92 owl_new_sv(owl_message_get_##field(m)), 0) 92 93 93 if (owl_message_ get_notice(m)) {94 if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) { 94 95 /* 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); 103 110 } 104 111 (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);108 112 } 109 113 … … 184 188 hash = (HV*)SvRV(msg); 185 189 186 m = g_ new(owl_message, 1);190 m = g_slice_new(owl_message); 187 191 owl_message_init(m); 188 192 … … 224 228 CALLER_OWN char *owl_perlconfig_call_with_message(const char *subname, const owl_message *m) 225 229 { 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 235 233 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 ); 266 249 return out; 267 250 } … … 273 256 CALLER_OWN char *owl_perlconfig_message_call_method(const owl_message *m, const char *method, int argc, const char **argv) 274 257 { 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; 279 261 280 262 msgref = owl_perlconfig_message2hashref(m); 281 263 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 ); 319 279 return out; 320 280 } … … 327 287 char *err; 328 288 const char *args[4] = {"", "-e", "0;", NULL}; 289 const char *dlerr; 329 290 AV *inc; 330 291 char *path; … … 375 336 } 376 337 377 sv_setpv(get_sv("BarnOwl::VERSION", TRUE), OWL_VERSION_STRING);338 sv_setpv(get_sv("BarnOwl::VERSION", TRUE), version); 378 339 379 340 /* Add the system lib path to @INC */ … … 384 345 g_free(path); 385 346 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. */ 386 357 eval_pv("use BarnOwl;", FALSE); 387 358 … … 455 426 void owl_perlconfig_new_command(const char *name) 456 427 { 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 441 CALLER_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 463 int 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 485 bool 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 507 void 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 ); 476 521 } 477 522 … … 479 524 CALLER_OWN char *owl_perlconfig_perlcmd(const owl_cmd *cmd, int argc, const char *const *argv) 480 525 { 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; 515 545 } 516 546 … … 520 550 } 521 551 522 void owl_perlconfig_edit_callback(owl_editwin *e )552 void owl_perlconfig_edit_callback(owl_editwin *e, bool success) 523 553 { 524 554 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) { 529 558 owl_function_error("Perl callback is NULL!"); 530 559 return; 531 560 } 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 ); 549 574 } 550 575 -
perlglue.xs
rf271129 r7dcef03 67 67 OUTPUT: 68 68 RETVAL 69 69 70 int 71 getnumlines() 72 CODE: 73 RETVAL = owl_global_get_lines(&g); 74 OUTPUT: 75 RETVAL 76 70 77 time_t 71 78 getidletime() … … 88 95 OUTPUT: 89 96 RETVAL 90 91 void92 zephyr_zwrite(cmd,msg)93 const char *cmd94 const char *msg95 PREINIT:96 int i;97 CODE:98 i = owl_zwrite_create_and_send_from_line(cmd, msg);99 97 100 98 const utf8 * … … 165 163 { 166 164 owl_function_adminmsg(header, body); 167 }168 169 void170 start_question(line, callback)171 const char *line172 SV *callback173 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 void189 start_password(line, callback)190 const char *line191 SV *callback192 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 void208 start_edit_win(line, callback)209 const char *line210 SV *callback211 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);220 165 } 221 166 … … 287 232 CODE: 288 233 { 289 s = g_ new(owl_style, 1);234 s = g_slice_new(owl_style); 290 235 owl_style_create_perl(s, name, newSVsv(object)); 291 236 owl_global_add_style(&g, s); … … 311 256 } 312 257 258 bool 259 message_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 313 284 const utf8 * 314 285 wordwrap(in, cols) … … 426 397 MODULE = BarnOwl PACKAGE = BarnOwl::Internal 427 398 399 400 int 401 file_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 428 409 429 410 void … … 457 438 } 458 439 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 441 MODULE = BarnOwl PACKAGE = BarnOwl::Internal 442 443 void 444 new_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 470 void 471 start_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 495 int 496 zephyr_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 497 503 498 504 MODULE = BarnOwl PACKAGE = BarnOwl::Editwin -
popexec.c
re146cd7 r7dcef03 23 23 } 24 24 25 pe = g_ new(owl_popexec, 1);25 pe = g_slice_new(owl_popexec); 26 26 pe->winactive=0; 27 27 pe->pid=0; … … 179 179 if (pe->refcount<=0) { 180 180 owl_function_debugmsg("doing free of %p", pe); 181 g_ free(pe);181 g_slice_free(owl_popexec, pe); 182 182 } 183 183 } -
popwin.c
r6829afc r7dcef03 3 3 CALLER_OWN owl_popwin *owl_popwin_new(void) 4 4 { 5 owl_popwin *pw = g_ new0(owl_popwin, 1);5 owl_popwin *pw = g_slice_new0(owl_popwin); 6 6 7 7 pw->border = owl_window_new(NULL); … … 92 92 g_object_unref(pw->content); 93 93 94 g_ free(pw);94 g_slice_free(owl_popwin, pw); 95 95 } 96 96 -
runtests.sh
rf6ab6ee r7dcef03 1 1 #!/bin/sh 2 exec env HARNESS_PERL=./tester prove --failures t/ 2 export G_SLICE=debug-blocks 3 exec env HARNESS_PERL=./tester prove --failures "${srcdir:=$(dirname "$0")}/t/" -
select.c
r84a071f r7dcef03 41 41 if (t->destroy_cbdata) 42 42 t->destroy_cbdata(t->cbdata); 43 g_ free(t);43 g_slice_free(owl_task, t); 44 44 } 45 45 … … 47 47 { 48 48 GSource *source = g_idle_source_new(); 49 owl_task *t = g_ new0(owl_task, 1);49 owl_task *t = g_slice_new0(owl_task); 50 50 t->cb = cb; 51 51 t->cbdata = cbdata; -
sepbar.c
r6eb3ed9 ra38becd 67 67 } 68 68 69 if (owl_ global_is_zaway(&g) || owl_global_is_aaway(&g)) {69 if (owl_function_is_away()) { 70 70 getyx(sepwin, y, x); 71 71 wmove(sepwin, y, x+2); 72 72 wattron(sepwin, A_BOLD); 73 73 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 "); 81 75 wattron(sepwin, A_REVERSE); 82 76 wattroff(sepwin, A_BOLD); -
style.c
r14be3a5 r7dcef03 23 23 { 24 24 SV *sv = NULL; 25 OWL_PERL_CALL _METHOD(s->perlobj,26 "description",27 ;,28 "Error in style_get_description: %s",29 0,30 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) { 33 33 return SvPV_nolen(sv_2mortal(sv)); 34 34 } else { … … 50 50 51 51 /* 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 ); 59 60 60 if (sv) {61 if (sv) { 61 62 body = SvPV_nolen(sv); 62 63 } else { … … 102 103 { 103 104 owl_style_cleanup(s); 104 g_ free(s);105 g_slice_free(owl_style, s); 105 106 } -
t/00-core-tests.t
r95414bf r5db8835 1 1 #!/usr/bin/env perl 2 use File::Basename; 3 system(dirname($0) . "/../tester", "--builtin"); 2 system("./tester", "--builtin"); -
tester.c
ra74a044 r21dc927 3 3 #include "owl.h" 4 4 #undef WINDOW 5 #include "filterproc.h" 5 6 6 7 #include <stdio.h> … … 23 24 int owl_smartfilter_regtest(void); 24 25 int owl_history_regtest(void); 26 int call_filter_regtest(void); 27 int owl_smartstrip_regtest(void); 25 28 26 29 extern void owl_perl_xs_init(pTHX); … … 113 116 numfailures += owl_smartfilter_regtest(); 114 117 numfailures += owl_history_regtest(); 118 numfailures += call_filter_regtest(); 119 numfailures += owl_smartstrip_regtest(); 115 120 if (numfailures) { 116 121 fprintf(stderr, "# *** WARNING: %d failures total\n", numfailures); … … 130 135 { 131 136 int numfailed=0; 132 char * s, *path, *home;137 char *path, *home; 133 138 134 139 printf("# BEGIN testing owl_util\n"); … … 226 231 227 232 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/")); 267 260 268 261 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("~")); 272 264 273 265 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")); 277 268 g_free(path); 278 269