Changes in / [7f86e3d:4f6097e]
- Files:
-
- 37 added
- 42 deleted
- 94 edited
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
rf93cc34 r1c22155 2 2 *.o 3 3 *.par 4 *~5 .#*6 .*.swp7 4 .deps 5 /bin/ 8 6 META.yml 7 MYMETA.yml 9 8 Makefile 10 9 Makefile.in 11 10 Makefile.old 12 11 TAGS 13 \#*#14 12 aclocal.m4 15 13 autom4te.cache 16 barnowl.bin 17 tester.bin 18 zcrypt 14 barnowl 19 15 blib 20 16 config.cache 21 17 config.h 22 18 config.h.in 19 config.h.in~ 23 20 config.log 24 21 config.status … … 26 23 core 27 24 depcomp 25 gmarshal_funcs.c 26 gmarshal_funcs.h 27 inc/ 28 28 install-sh 29 29 jabber.log … … 32 32 owl_prototypes.h.new 33 33 perlglue.c 34 perlwrap.c35 34 pm_to_blib 35 runtests.sh.log 36 runtests.sh.trs 36 37 stamp-h1 38 test-driver 39 test-suite.log 40 tester 37 41 varstubs.c 42 zcrypt -
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
r2ff0693 r1b17f50 1 1.9 2 * Add getnumlines() to perl interface -asedeno@mit.edu 3 * Include names of invalid filters on filter errors -adehnert@mit.edu 4 * Don't incorrectly mark decryption failures as decrypted -davidben@mit.edu 5 * Hide the default cursor when possible -davidben@mit.edu 6 * Complete viewperson and vp as viewuser and vu -davidben@mit.edu 7 * Set z_charset = ZCHARSET_UTF_8 -andersk@mit.edu 8 * Allow zsender spoofing on cross-realm classes -andersk@mit.edu 9 * Append the realm to the zsender if missing -andersk@mit.edu 10 * Redisplay on setting colorztext -jgross@mit.edu 11 * Rename default config file to .owl/init.pl -kevinr@free-dissociation.com 12 * Add completion for jabberlogout -adehnert@mit.edu 13 * Switch to interactive context before sourcing the startup file -davidben@mit.edu 14 * Add completion for reload-module -adehnert@mit.edu 15 * editwin callback for canceling the editwin -jgross@mit.edu 16 * Fix dirtying windows inside a redraw handler -davidben@mit.edu 17 * Facebook module -ezyang@mit.edu 18 * Complete unstartup command just like startup command -jgross@mit.edu 19 * Fix the description of disable-ctrl-d -jgross@mit.edu 20 * Use wbkgrndset instead of wbkgdset in _owl_fmtext_wcolor_set -davidben@mit.edu 21 * Show the time zone in :info -jgross@mit.edu 22 * Treat [!.?]" as end of sentence in edit:fill-paragraph -jgross@mit.edu 23 * Correctly display multiline fields in :info -jgross@mit.edu 24 25 1.8.1 26 * Only add outgoing messages for personal part of half-personal messages -andersk@mit.edu 27 * Don’t write CC: line on zwrite -C '' -andersk@mit.edu 28 * Don’t send public pings on zwrite '' or zwrite @REALM -andersk@mit.edu 29 * Don’t treat zwrite '' as personal -andersk@mit.edu 30 * Stop pretending to support zwrite * -andersk@mit.edu 31 * Show foreign realms on non-personal zephyrs like Owl did -andersk@mit.edu 32 * Fix memory leak in zcrypt -davidben@mit.edu 33 * Don't attempt to switch filters in :view -d if invalid -davidben@mit.edu 34 * Fixed typo in unbindkey usage error -rileyb@mit.edu 35 * Fix bug generating filter text in 256-color mode -asedeno@mit.edu 36 * Remove ^noc from reply-lockout -geofft@mit.edu 37 * Avoid quadratic loops when receiving zephyrs -andersk@mit.edu 38 * Fix hang on empty zcrypt messages -adehnert@MIT.EDU 39 40 1.8 41 * Compute the home directory in zcrypt consistently with BarnOwl -davidben@mit.edu 42 * Make help show the correct keybinding for A -jgross@mit.edu 43 * Add a delete-and-expunge command. -jgross@mit.edu 44 * Fix a bug in the expunge command -jgross@mit.edu 45 * Replace 'Owl' with 'BarnOwl' in user visible places -jgross@mit.edu 46 * Allow zsigs to be '0' -jgross@mit.edu 47 * Reformat the man page to look more like others -davidben@mit.edu 48 * Consistently use BarnOwl or barnowl -davidben@mit.edu 49 * Update autoconf macros -andersk@mit.edu 50 * history: Do not deduplicate a partial entry -andersk@mit.edu 51 * Drop show timers feature -davidben@mit.edu 52 * Add new dependencies, AnyEvent and perl-Glib -davidben@mit.edu 53 * Bump required glib version to 2.16 -davidben@mit.edu 54 * Don't leak timestr when setting time in a perl message -asedeno@mit.edu 55 * Build with -Wwrite-strings -andersk@mit.edu 56 * Build with C99 -davidben@mit.edu 57 * Jabber: Handle nicks with leading dashes (e.g. Facebook XMPP) -ezyang@mit.edu 58 * Move log-writing onto a background thread. -adam@crossproduct.net 59 * Remove the length limit on field values in :info -jgross@mit.edu 60 * Show how far you are in a long message -jgross@mit.edu 61 * stderr_redirect_handler: Handle partial or failed reads -andersk@mit.edu 62 * Inform the user when an unpunt command does nothing -davidben@mit.edu 63 * Replace custom event loop with GLib's GMainLoop -davidben@mit.edu 64 * Encode glib version requirements in pkg-config check -asedeno@mit.edu 65 * Fix color pair usage on ncurses builds without ext-color -davidben@mit.edu 66 * IRC: Fix reconnect behavior. -nelhage@mit.edu 67 * IRC: Make nick-change events LOGIN messages instead of ADMIN. -nelhage@mit.edu 68 * IRC: Port module to AnyEvent::IRC. -asedeno@mit.edu, nelhage@nelhage.com 69 * Ability to set exposure arbitrarily (like "zctl set exposure") -jgross@mit.edu 70 * Kill --remove-debug option -davidben@mit.edu 71 * exec: Fix input redirection of multistatement commands -andersk@mit.edu 72 * Correctly set the realm in outgoing zwrite errors -davidben@mit.edu 73 * Correctly compute the realm for outgoing messages -davidben@mit.edu 74 * In duplicated outgoing zephyrs only reply on the relevant recipient -davidben@mit.edu 75 * Create per-recipient copies of outgoing messages for non-CC'd personals -liudi@mit.edu 76 * Add black to :show colors -andersk@mit.edu 77 * Fix reporting of errors from libzephyr -kcr@1ts.org 78 * Load Encode module for IRC. -timhill@alum.mit.edu 79 * IRC: Sort the output of :irc-names -nelhage@mit.edu 80 * Prepend "UNAUTH: " to displayed sender for unauthenticated zephyrs -adam@crossproduct.net 81 * For ‘punt’ with one argument, quote the filter name -andersk@mit.edu 82 * Fix spurious error running ‘punt’ with no arguments -andersk@mit.edu 83 * Only handle CCs in messages sent directly to you. -davidben@mit.edu 84 * Update copyright notices for 2011 -davidben@mit.edu 85 * If a smartfilter fails to parse, handle the error -davidben@mit.edu 86 * Replace per-editwin killbuf with a global one. -adam@crossproduct.net 87 * Don't use error_message if we are building without Zephyr. -nelhage@mit.edu 88 * Fix replying to outgoing zwrite when -m is passed -davidben@mit.edu 89 * Fix a number of quoting bugs -davidben@mit.edu 90 * Check passwd entries to determine home dir -davidben@mit.edu 91 92 1.7.1 93 * Append sender's realm to CC'd unqualified names when replying. -adam@crossproduct.net 94 * Don't reset ncurses colorpairs in the middle of drawing. -davidben@mit.edu 95 * Fix viewuser when an unqualified name is given. -davidben@mit.edu 96 1 97 1.7 98 * Fix quoting bugs in smartfilter, zpunt, and numerous other commands. -davidben@mit.edu 2 99 * Download Twitter consumer keys from barnowl.mit.edu. -nelhage@MIT.EDU 3 100 * Fix unsub when .zephyr.subs is a symlink. -jgross@MIT.EDU -
Makefile.am
r3535a6e ra223b6b 4 4 GIT_FLAGS := $(if $(GIT_DESCRIPTION),-DGIT_VERSION=$(GIT_DESCRIPTION:barnowl-%=%)) 5 5 6 bin_PROGRAMS = b arnowl.bin6 bin_PROGRAMS = bin/barnowl 7 7 if ENABLE_ZCRYPT 8 8 bin_PROGRAMS += zcrypt … … 11 11 zcrypt_SOURCES = zcrypt.c filterproc.c 12 12 13 check_PROGRAMS = tester.bin 13 check_PROGRAMS = bin/tester 14 dist_check_DATA = t 15 dist_check_SCRIPTS = runtests.sh 14 16 15 barnowl_bin_SOURCES = $(BASE_SRCS) \ 16 owl.h owl_perl.h config.h \ 17 owl.c \ 18 $(GEN_C) $(GEN_H) 17 noinst_SCRIPTS = barnowl 18 check_SCRIPTS = tester 19 19 20 man_MANS = doc/barnowl.1 21 doc_DATA = doc/intro.txt doc/advanced.txt 20 barnowl tester: %: barnowl-wrapper.in bin/% Makefile 21 sed \ 22 -e 's,[@]abs_srcdir[@],$(abs_srcdir),g' \ 23 -e 's,[@]abs_builddir[@],$(abs_builddir),g' \ 24 $< > $@ 25 chmod +x $@ 22 26 23 barnowl_bin_LDADD = compat/libcompat.a libfaim/libfaim.a 27 bin_barnowl_SOURCES = $(BASE_SRCS) \ 28 owl.h owl_perl.h \ 29 owl.c 30 nodist_bin_barnowl_SOURCES = $(GEN_C) $(GEN_H) 24 31 25 tester_bin_SOURCES = $(BASE_SRCS) \ 26 owl.h owl_perl.h config.h \ 27 $(GEN_C) $(GEN_H) \ 32 dist_man_MANS = doc/barnowl.1 33 dist_doc_DATA = doc/intro.txt doc/advanced.txt 34 35 bin_barnowl_LDADD = compat/libcompat.a libfaim/libfaim.a 36 37 bin_tester_SOURCES = $(BASE_SRCS) \ 38 owl.h owl_perl.h \ 28 39 tester.c 40 nodist_bin_tester_SOURCES = $(GEN_C) $(GEN_H) 29 41 30 tester_bin_LDADD = compat/libcompat.a libfaim/libfaim.a42 bin_tester_LDADD = compat/libcompat.a libfaim/libfaim.a 31 43 32 44 TESTS=runtests.sh 33 45 34 AM_CPPFLAGS = -I$(top_srcdir)/\46 AM_CPPFLAGS = \ 35 47 -I$(top_srcdir)/libfaim/ \ 36 48 -DDATADIR='"$(pkgdatadir)"' \ … … 38 50 $(GIT_FLAGS) 39 51 40 CODELIST_SRCS=list.c 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 \ 52 CODELIST_SRCS=message.c mainwin.c popwin.c zephyr.c messagelist.c \ 53 commands.c global.c text.c fmtext.c editwin.c \ 54 util.c logging.c \ 42 55 perlconfig.c keys.c functions.c zwrite.c viewwin.c help.c filter.c \ 43 56 regex.c history.c view.c dict.c variable.c filterelement.c pair.c \ … … 45 58 aim.c buddy.c buddylist.c style.c errqueue.c \ 46 59 zbuddylist.c popexec.c select.c wcwidth.c \ 47 glib_compat.c mainpanel.c msgwin.c sepbar.c editcontext.c signal.c60 mainpanel.c msgwin.c sepbar.c editcontext.c signal.c closures.c 48 61 49 NORMAL_SRCS = filterproc.c window.cwindowcb.c62 NORMAL_SRCS = filterproc.c filterproc.h window.c window.h windowcb.c 50 63 51 64 BASE_SRCS = $(CODELIST_SRCS) $(NORMAL_SRCS) 52 65 53 GEN_C = varstubs.c perlglue.c 54 GEN_H = owl_prototypes.h 66 GEN_C = varstubs.c perlglue.c gmarshal_funcs.c 67 GEN_H = owl_prototypes.h owl_prototypes.h.new gmarshal_funcs.h 55 68 56 69 BUILT_SOURCES = $(GEN_C) $(GEN_H) … … 65 78 proto: owl_prototypes.h 66 79 67 perlglue.c: perlglue.xs $(TYPEMAP)68 $(AM_V_GEN)perl $(XSUBPPDIR)/xsubpp $(XSUBPPFLAGS) -prototypes perlglue.xs > perlglue.c80 perlglue.c: perlglue.xs typemap 81 $(AM_V_GEN)perl $(XSUBPPDIR)/xsubpp $(XSUBPPFLAGS) -prototypes $< > $@ 69 82 70 83 varstubs.c: stubgen.pl variable.c … … 74 87 $(AM_V_GEN)perl $< $(sort $(filter-out $<,$+)) > $@ 75 88 89 gmarshal_funcs.h: marshal_types 90 glib-genmarshal --header $< > $@ 91 gmarshal_funcs.c: marshal_types 92 glib-genmarshal --body $< > $@ 93 76 94 # For emacs flymake-mode 77 95 check-syntax: proto 78 96 $(COMPILE) -Wall -Wextra -pedantic -fsyntax-only $(CHK_SOURCES) 79 97 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) 98 CLEANFILES = $(BUILT_SOURCES) $(noinst_SCRIPTS) $(check_SCRIPTS) 99 EXTRA_DIST = \ 100 autogen.sh \ 101 barnowl-wrapper.in \ 102 codelist.pl \ 103 doc/code.txt \ 104 doc/owl-window.txt \ 105 doc/releasing-barnowl.txt \ 106 examples \ 107 marshal_types \ 108 perlglue.xs \ 109 scripts \ 110 stubgen.pl \ 111 typemap 88 112 89 113 SUBDIRS = compat libfaim perl -
README
r13ee8f2 r1c22155 7 7 Notes: 8 8 ----- 9 This project's perl/ lib/ contains the lib directories from the9 This project's perl/modules/ contains the lib directories from the 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: 19 20 20 21 AnyEvent 22 Class::Accessor 23 ExtUtils::Depends 24 Glib 25 Module::Install 21 26 PAR 22 Net::DNS23 Authen::SASL::Perl24 IO::Socket::SSL25 Digest::SHA126 27 27 28 (Note that these are all available as Debian packages) … … 29 30 these for you. 30 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 43 31 44 The IRC module requires: 32 45 33 46 AnyEvent::IRC 34 Class::Accessor 47 48 The Jabber module requires: 49 50 Net::DNS 51 Authen::SASL::Perl 52 IO::Socket::SSL 53 Digest::SHA 54 55 The Twitter module requires: 56 57 HTML::Entities 58 Net::Twitter::Lite 35 59 36 60 The WordWrap module requires: -
aim.c
rdc1edbd r8258ea5 1 #include <stdio.h>2 #include <stdio.h>3 #include <sys/stat.h>4 1 #include "owl.h" 5 2 … … 113 110 } 114 111 115 void owl_aim_send_nop(owl_timer *t, void *data) { 116 if(owl_global_is_doaimevents(&g)) { 117 aim_session_t *sess = owl_global_get_aimsess(&g); 118 aim_flap_nop(sess, aim_getconn_type(sess, AIM_CONN_TYPE_BOS)); 119 } 112 gboolean owl_aim_send_nop(gpointer data) { 113 owl_global *g = data; 114 if (owl_global_is_doaimevents(g)) { 115 aim_session_t *sess = owl_global_get_aimsess(g); 116 aim_flap_nop(sess, aim_getconn_type(sess, AIM_CONN_TYPE_BOS)); 117 } 118 return TRUE; 120 119 } 121 120 … … 183 182 owl_function_debugmsg("owl_aim_login: connecting"); 184 183 185 g.aim_nop_timer = owl_select_add_timer("owl_aim_send_nop", 30, 30, owl_aim_send_nop, NULL, NULL);184 g.aim_nop_timer = g_timeout_add_seconds(30, owl_aim_send_nop, &g); 186 185 187 186 return(0); 188 187 } 189 188 190 static void owl_aim_unset_ignorelogin(owl_timer *t, void *data) 191 { 192 owl_global_unset_ignore_aimlogin(&g); 189 static gboolean owl_aim_unset_ignorelogin(void *data) 190 { 191 owl_global *g = data; 192 owl_global_unset_ignore_aimlogin(g); 193 return FALSE; /* only run once. */ 193 194 } 194 195 … … 209 210 /* start the ingorelogin timer */ 210 211 owl_global_set_ignore_aimlogin(&g); 211 owl_select_add_timer("owl_aim_unset_ignorelogin", 212 owl_global_get_aim_ignorelogin_timer(&g), 213 0, owl_aim_unset_ignorelogin, NULL, NULL); 212 g_timeout_add_seconds(owl_global_get_aim_ignorelogin_timer(&g), 213 owl_aim_unset_ignorelogin, &g); 214 214 215 215 /* aim_ssi_setpresence(owl_global_get_aimsess(&g), 0x00000400); */ … … 225 225 owl_global_set_aimnologgedin(&g); 226 226 owl_global_set_no_doaimevents(&g); 227 owl_select_remove_timer(g.aim_nop_timer); 227 if (g.aim_nop_timer) { 228 g_source_remove(g.aim_nop_timer); 229 g.aim_nop_timer = 0; 230 } 228 231 } 229 232 … … 244 247 owl_global_set_aimnologgedin(&g); 245 248 owl_global_set_no_doaimevents(&g); 246 owl_select_remove_timer(g.aim_nop_timer); 249 if (g.aim_nop_timer) { 250 g_source_remove(g.aim_nop_timer); 251 g.aim_nop_timer = 0; 252 } 247 253 } 248 254 … … 428 434 429 435 /* caller must free the return */ 430 char *owl_aim_normalize_screenname(const char *in)436 CALLER_OWN char *owl_aim_normalize_screenname(const char *in) 431 437 { 432 438 char *out; … … 701 707 { 702 708 aim_clientready(sess, fr->conn); 703 owl_function_debugmsg("conninitdone_admin: initializ tion done for admin connection");709 owl_function_debugmsg("conninitdone_admin: initialization done for admin connection"); 704 710 return(1); 705 711 } … … 830 836 params = va_arg(ap, struct aim_icbmparameters *); 831 837 va_end(ap); 832 833 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", 834 840 params->maxchan, params->flags, params->maxmsglen, ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0, params->minmsginterval); 835 841 … … 1055 1061 g_free(wrapmsg); 1056 1062 g_free(nz_screenname); 1063 g_free(realmsg); 1057 1064 1058 1065 return(1); 1059 1066 1060 owl_function_debugmsg("faimtest_parse_incoming_im_chan1: icbm: message: %s\n", realmsg); 1061 1062 if (args->icbmflags & AIM_IMFLAGS_MULTIPART) { 1063 aim_mpmsg_section_t *sec; 1064 int z; 1065 1066 owl_function_debugmsg("faimtest_parse_incoming_im_chan1: icbm: multipart: this message has %d parts\n", args->mpmsg.numparts); 1067 1068 for (sec = args->mpmsg.parts, z = 0; sec; sec = sec->next, z++) { 1069 if ((sec->charset == 0x0000) || (sec->charset == 0x0003) || (sec->charset == 0xffff)) { 1070 owl_function_debugmsg("faimtest_parse_incoming_im_chan1: icbm: multipart: part %d: charset 0x%04x, subset 0x%04x, msg = %s\n", z, sec->charset, sec->charsubset, sec->data); 1071 } else { 1072 owl_function_debugmsg("faimtest_parse_incoming_im_chan1: icbm: multipart: part %d: charset 0x%04x, subset 0x%04x, binary or UNICODE data\n", z, sec->charset, sec->charsubset); 1073 } 1074 } 1075 } 1076 1077 if (args->icbmflags & AIM_IMFLAGS_HASICON) { 1078 /* aim_send_im(sess, userinfo->sn, AIM_IMFLAGS_BUDDYREQ, "You have an icon"); */ 1079 owl_function_debugmsg("faimtest_parse_incoming_im_chan1: icbm: their icon: iconstamp = %ld, iconlen = 0x%08x, iconsum = 0x%04x\n", args->iconstamp, args->iconlen, args->iconsum); 1080 } 1081 1082 g_free(realmsg); 1083 1084 return(1); 1067 /* TODO: Multipart? See history from before 1.8 release. */ 1085 1068 } 1086 1069 … … 1430 1413 const char *address, *SNs; 1431 1414 int num, i; 1432 owl_listlist;1415 GPtrArray *list; 1433 1416 1434 1417 va_start(ap, fr); … … 1438 1421 va_end(ap); 1439 1422 1440 owl_list_create(&list);1423 list = g_ptr_array_new(); 1441 1424 1442 1425 owl_function_debugmsg("faimtest_parse_searchreply: E-Mail Search Results for %s: ", address); 1443 1426 for (i=0; i<num; i++) { 1444 1427 owl_function_debugmsg(" %s", &SNs[i*(MAXSNLEN+1)]); 1445 owl_list_append_element(&list, (void *)&SNs[i*(MAXSNLEN+1)]);1446 } 1447 owl_function_aimsearch_results(address, &list);1448 owl_list_cleanup(&list, NULL);1449 return (1);1428 g_ptr_array_add(list, (void *)&SNs[i*(MAXSNLEN+1)]); 1429 } 1430 owl_function_aimsearch_results(address, list); 1431 g_ptr_array_free(list, true); 1432 return 1; 1450 1433 } 1451 1434 … … 1803 1786 GPollFD *fd; 1804 1787 int i; 1805 if (len < event_source->fds->len) 1788 if (len < event_source->fds->len) { 1806 1789 owl_function_debugmsg("Truncating AIM PollFDs to %d, was %d", len, event_source->fds->len); 1807 for (i = len; i < event_source->fds->len; i++) { 1808 fd = event_source->fds->pdata[i]; 1809 g_source_remove_poll(&event_source->source, fd); 1810 g_free(fd); 1811 } 1812 g_ptr_array_remove_range(event_source->fds, len, event_source->fds->len - len); 1790 for (i = len; i < event_source->fds->len; i++) { 1791 fd = event_source->fds->pdata[i]; 1792 g_source_remove_poll(&event_source->source, fd); 1793 g_free(fd); 1794 } 1795 g_ptr_array_remove_range(event_source->fds, len, event_source->fds->len - len); 1796 } 1813 1797 } 1814 1798 … … 1842 1826 fd = event_source->fds->pdata[i]; 1843 1827 fd->fd = cur->fd; 1844 fd->events |= G_IO_IN | G_IO_HUP | G_IO_ERR;1828 fd->events = G_IO_IN | G_IO_HUP | G_IO_ERR; 1845 1829 if (cur->status & AIM_CONN_STATUS_INPROGRESS) { 1846 /* Yes, we're checking writable sockets here. Without it, AIM 1847 login is really slow. */ 1830 /* AIM login requires checking writable sockets. See aim_select. */ 1848 1831 fd->events |= G_IO_OUT; 1849 1832 } … … 1881 1864 { 1882 1865 owl_aim_event_source *event_source = (owl_aim_event_source*)source; 1883 truncate_pollfd_list(event_source, 0); 1884 g_ptr_array_free(event_source->fds, TRUE); 1866 /* Don't remove the GPollFDs. We are being finalized, so they'll be removed 1867 * for us. Moreover, glib will fire asserts if g_source_remove_poll is called 1868 * on a source which has been destroyed (which occurs when g_source_remove is 1869 * called on it). */ 1870 owl_ptr_array_free(event_source->fds, g_free); 1885 1871 } 1886 1872 -
buddylist.c
r96828e4 r3cdd6d2 3 3 void owl_buddylist_init(owl_buddylist *bl) 4 4 { 5 owl_list_create(&(bl->buddies));5 bl->buddies = g_ptr_array_new(); 6 6 } 7 7 … … 14 14 15 15 owl_buddy_create(b, OWL_PROTOCOL_AIM, screenname); 16 owl_list_append_element(&(bl->buddies), b);16 g_ptr_array_add(bl->buddies, b); 17 17 } 18 18 … … 21 21 int owl_buddylist_remove_aim_buddy(owl_buddylist *bl, const char *name) 22 22 { 23 int i , j;23 int i; 24 24 owl_buddy *b; 25 25 26 j=owl_list_get_size(&(bl->buddies)); 27 for (i=0; i<j; i++) { 28 b=owl_list_get_element(&(bl->buddies), i); 26 for (i = 0; i < bl->buddies->len; i++) { 27 b = bl->buddies->pdata[i]; 29 28 if (!strcasecmp(name, owl_buddy_get_name(b)) && owl_buddy_is_proto_aim(b)) { 30 owl_list_remove_element(&(bl->buddies), i); 31 owl_buddy_delete(b); 29 owl_buddy_delete(g_ptr_array_remove_index(bl->buddies, i)); 32 30 return(0); 33 31 } … … 87 85 int owl_buddylist_get_size(const owl_buddylist *bl) 88 86 { 89 return (owl_list_get_size(&(bl->buddies)));87 return bl->buddies->len; 90 88 } 91 89 … … 97 95 if (index>(owl_buddylist_get_size(bl)-1)) return(NULL); 98 96 99 return (owl_list_get_element(&(bl->buddies), index));97 return bl->buddies->pdata[index]; 100 98 } 101 99 … … 105 103 owl_buddy *owl_buddylist_get_aim_buddy(const owl_buddylist *bl, const char *name) 106 104 { 107 int i , j;105 int i; 108 106 owl_buddy *b; 109 107 110 j=owl_list_get_size(&(bl->buddies)); 111 for (i=0; i<j; i++) { 112 b=owl_list_get_element(&(bl->buddies), i); 108 for (i = 0; i < bl->buddies->len; i++) { 109 b = bl->buddies->pdata[i]; 113 110 if (!strcasecmp(name, owl_buddy_get_name(b))) return(b); 114 111 } … … 131 128 void owl_buddylist_clear(owl_buddylist *bl) 132 129 { 133 owl_list_cleanup(&(bl->buddies), (void (*)(void *))owl_buddy_delete);134 owl_list_create(&(bl->buddies));130 g_ptr_array_foreach(bl->buddies, (GFunc)owl_buddy_delete, NULL); 131 g_ptr_array_set_size(bl->buddies, 0); 135 132 } 136 133 137 134 void owl_buddylist_cleanup(owl_buddylist *bl) 138 135 { 139 owl_ list_cleanup(&(bl->buddies), (void (*)(void *))owl_buddy_delete);136 owl_ptr_array_free(bl->buddies, (GDestroyNotify)owl_buddy_delete); 140 137 } -
cmd.c
r4c7c21f rf271129 1 #include <stdio.h>2 #include <stdlib.h>3 #include <string.h>4 #include <unistd.h>5 1 #include "owl.h" 6 7 extern const owl_cmd commands_to_init[];8 2 9 3 /**************************************************************************/ … … 11 5 /**************************************************************************/ 12 6 13 int owl_cmddict_setup(owl_cmddict *cd) { 7 void owl_cmddict_setup(owl_cmddict *cd) 8 { 14 9 owl_cmddict_init(cd); 15 if (0 != owl_cmddict_add_from_list(cd, commands_to_init)) return(-1); 16 return(0); 10 owl_cmd_add_defaults(cd); 17 11 } 18 12 … … 22 16 23 17 /* for bulk initialization at startup */ 24 int owl_cmddict_add_from_list(owl_cmddict *cd, const owl_cmd *cmds) { 18 void owl_cmddict_add_from_list(owl_cmddict *cd, const owl_cmd *cmds) 19 { 25 20 const owl_cmd *cur; 26 int ret = 0;27 21 for (cur = cmds; cur->name != NULL; cur++) { 28 ret = owl_cmddict_add_cmd(cd, cur); 29 if (ret < 0) break; 30 } 31 return ret; 32 } 33 34 void owl_cmddict_get_names(const owl_cmddict *d, owl_list *l) { 35 owl_dict_get_keys(d, l); 22 owl_cmddict_add_cmd(cd, cur); 23 } 24 } 25 26 GPtrArray *owl_cmddict_get_names(const owl_cmddict *d) { 27 return owl_dict_get_keys(d); 36 28 } 37 29 … … 41 33 42 34 /* creates a new command alias */ 43 intowl_cmddict_add_alias(owl_cmddict *cd, const char *alias_from, const char *alias_to) {35 void owl_cmddict_add_alias(owl_cmddict *cd, const char *alias_from, const char *alias_to) { 44 36 owl_cmd *cmd; 45 37 cmd = g_new(owl_cmd, 1); … … 47 39 owl_perlconfig_new_command(cmd->name); 48 40 owl_dict_insert_element(cd, cmd->name, cmd, (void (*)(void *))owl_cmd_delete); 49 return(0);50 41 } 51 42 … … 60 51 } 61 52 62 char *_owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc, const char *buff) { 53 /* caller must free the return */ 54 CALLER_OWN char *_owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc, const char *buff) 55 { 63 56 char *retval = NULL; 64 57 const owl_cmd *cmd; … … 75 68 } 76 69 77 char *owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *cmdbuff) { 70 /* caller must free the return */ 71 CALLER_OWN char *owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *cmdbuff) 72 { 78 73 char **argv; 79 74 int argc; … … 97 92 } 98 93 99 char *owl_cmddict_execute_argv(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc) { 94 /* caller must free the return */ 95 CALLER_OWN char *owl_cmddict_execute_argv(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc) 96 { 100 97 char *buff; 101 98 char *retval = NULL; … … 124 121 } 125 122 126 intowl_cmd_create_alias(owl_cmd *cmd, const char *name, const char *aliased_to) {123 void owl_cmd_create_alias(owl_cmd *cmd, const char *name, const char *aliased_to) { 127 124 memset(cmd, 0, sizeof(owl_cmd)); 128 125 cmd->name = g_strdup(name); 129 126 cmd->cmd_aliased_to = g_strdup(aliased_to); 130 127 cmd->summary = g_strdup_printf("%s%s", OWL_CMD_ALIAS_SUMMARY_PREFIX, aliased_to); 131 return(0);132 128 } 133 129 … … 153 149 } 154 150 155 char *owl_cmd_execute(const owl_cmd *cmd, const owl_cmddict *cd, const owl_context *ctx, int argc, const char *const *argv, const char *cmdbuff) { 151 /* caller must free the result */ 152 CALLER_OWN char *owl_cmd_execute(const owl_cmd *cmd, const owl_cmddict *cd, const owl_context *ctx, int argc, const char *const *argv, const char *cmdbuff) 153 { 156 154 static int alias_recurse_depth = 0; 157 155 int ival=0; … … 226 224 227 225 /* returns a summary line describing this keymap. the caller must free. */ 228 char *owl_cmd_describe(const owl_cmd *cmd) { 226 CALLER_OWN char *owl_cmd_describe(const owl_cmd *cmd) 227 { 229 228 if (!cmd || !cmd->name || !cmd->summary) return NULL; 230 229 return g_strdup_printf("%-25s - %s", cmd->name, cmd->summary); … … 257 256 if (cmd->usage && *cmd->usage) { 258 257 s = cmd->usage; 259 indent = owl_text_indent(s, OWL_TAB );258 indent = owl_text_indent(s, OWL_TAB, true); 260 259 owl_fmtext_append_bold(fm, "\nSYNOPSIS\n"); 261 260 owl_fmtext_append_normal(fm, indent); … … 271 270 if (cmd->description && *cmd->description) { 272 271 s = cmd->description; 273 indent = owl_text_indent(s, OWL_TAB );272 indent = owl_text_indent(s, OWL_TAB, true); 274 273 owl_fmtext_append_bold(fm, "\nDESCRIPTION\n"); 275 274 owl_fmtext_append_normal(fm, indent); -
commands.c
r697221f r3b9ca71 1 #include "owl.h" 1 2 #include <getopt.h> 2 #include <stdio.h>3 #include <stdlib.h>4 #include <string.h>5 #include <unistd.h>6 #include "owl.h"7 3 8 4 /* fn is "char *foo(int argc, const char *const *argv, const char *buff)" */ 9 5 #define OWLCMD_ARGS(name, fn, ctx, summary, usage, description) \ 10 { name, summary, usage, description, ctx, \6 { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \ 11 7 NULL, fn, NULL, NULL, NULL, NULL, NULL, NULL } 12 8 13 9 /* fn is "void foo(void)" */ 14 10 #define OWLCMD_VOID(name, fn, ctx, summary, usage, description) \ 15 { name, summary, usage, description, ctx, \11 { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \ 16 12 NULL, NULL, fn, NULL, NULL, NULL, NULL, NULL } 17 13 18 14 /* fn is "void foo(int)" */ 19 15 #define OWLCMD_INT(name, fn, ctx, summary, usage, description) \ 20 { name, summary, usage, description, ctx, \16 { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \ 21 17 NULL, NULL, NULL, fn, NULL, NULL, NULL, NULL } 22 18 23 19 #define OWLCMD_ALIAS(name, actualname) \ 24 { name, OWL_CMD_ALIAS_SUMMARY_PREFIX actualname, "", "", OWL_CTX_ANY, \25 actualname, NULL, NULL, NULL, NULL, NULL, NULL, NULL }20 { g_strdup(name), g_strdup(OWL_CMD_ALIAS_SUMMARY_PREFIX actualname), g_strdup(""), g_strdup(""), OWL_CTX_ANY, \ 21 g_strdup(actualname), NULL, NULL, NULL, NULL, NULL, NULL, NULL } 26 22 27 23 /* fn is "char *foo(void *ctx, int argc, const char *const *argv, const char *buff)" */ 28 24 #define OWLCMD_ARGS_CTX(name, fn, ctx, summary, usage, description) \ 29 { name, summary, usage, description, ctx, \25 { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \ 30 26 NULL, NULL, NULL, NULL, ((char*(*)(void*,int,const char*const *,const char*))fn), NULL, NULL, NULL } 31 27 32 28 /* fn is "void foo(void)" */ 33 29 #define OWLCMD_VOID_CTX(name, fn, ctx, summary, usage, description) \ 34 { name, summary, usage, description, ctx, \30 { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \ 35 31 NULL, NULL, NULL, NULL, NULL, ((void(*)(void*))(fn)), NULL, NULL } 36 32 37 33 /* fn is "void foo(int)" */ 38 34 #define OWLCMD_INT_CTX(name, fn, ctx, summary, usage, description) \ 39 { name, summary, usage, description, ctx, \35 { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \ 40 36 NULL, NULL, NULL, NULL, NULL, NULL, ((void(*)(void*,int))fn), NULL } 41 37 42 38 43 const owl_cmd commands_to_init[] 44 = { 39 void owl_cmd_add_defaults(owl_cmddict *cd) 40 { 41 owl_cmd commands_to_init[] = { 42 45 43 OWLCMD_ARGS("zlog", owl_command_zlog, OWL_CTX_ANY, 46 44 "send a login or logout notification", … … 48 46 "zlog in will send a login notification, zlog out will send a\n" 49 47 "logout notification. By default a login notification is sent\n" 50 "when owl is started and a logout notification is sent when owl\n"48 "when BarnOwl is started and a logout notification is sent when owl\n" 51 49 "is exited. This behavior can be changed with the 'startuplogin'\n" 52 50 "and 'shutdownlogout' variables. If a tty is specified for zlog in\n" 53 "then the owl variable 'tty' will be set to that string, causing\n"51 "then the BarnOwl variable 'tty' will be set to that string, causing\n" 54 52 "it to be used as the zephyr location tty.\n"), 55 53 56 54 OWLCMD_VOID("quit", owl_command_quit, OWL_CTX_ANY, 57 "exit owl",55 "exit BarnOwl", 58 56 "", 59 "Exit owl and run any shutdown activities."),57 "Exit BarnOwl and run any shutdown activities."), 60 58 OWLCMD_ALIAS("exit", "quit"), 61 59 OWLCMD_ALIAS("q", "quit"), … … 98 96 OWLCMD_ARGS("unbindkey", owl_command_unbindkey, OWL_CTX_ANY, 99 97 "removes a binding in a keymap", 100 " bindkey <keymap> <keyseq>",98 "unbindkey <keymap> <keyseq>", 101 99 "Removes a binding of a key sequence within a keymap.\n" 102 100 "Use 'show keymaps' to see the existing keymaps.\n" … … 178 176 179 177 OWLCMD_ARGS("startup", owl_command_startup, OWL_CTX_ANY, 180 "run a command and set it to be run at every Owl startup",178 "run a command and set it to be run at every BarnOwl startup", 181 179 "startup <commands> ...", 182 180 "Everything on the command line after the startup command\n" 183 "is executed as a normal owl command and is also placed in\n"184 "a file so that the command is executed every time owl\n"181 "is executed as a normal BarnOwl command and is also placed in\n" 182 "a file so that the command is executed every time BarnOwl\n" 185 183 "is started"), 186 184 187 185 OWLCMD_ARGS("unstartup", owl_command_unstartup, OWL_CTX_ANY, 188 "remove a command from the list of those to be run at Owl startup",186 "remove a command from the list of those to be run at BarnOwl startup", 189 187 "unstartup <commands> ...", 190 188 ""), 191 189 192 190 OWLCMD_VOID("version", owl_command_version, OWL_CTX_ANY, 193 "print the version of the running owl", "", ""),191 "print the version of the running BarnOwl", "", ""), 194 192 195 193 OWLCMD_ARGS("subscribe", owl_command_subscribe, OWL_CTX_ANY, … … 202 200 "only be temporary, i.e., it will not be written to\n" 203 201 "the subscription file and will therefore not be\n" 204 "present the next time owl is started.\n"),202 "present the next time BarnOwl is started.\n"), 205 203 OWLCMD_ALIAS("sub", "subscribe"), 206 204 … … 214 212 "only be temporary, i.e., it will not be updated in\n" 215 213 "the subscription file and will therefore not be\n" 216 "in effect the next time owl is started.\n"),214 "in effect the next time BarnOwl is started.\n"), 217 215 OWLCMD_ALIAS("unsub", "unsubscribe"), 218 216 … … 232 230 233 231 OWLCMD_ARGS("source", owl_command_source, OWL_CTX_ANY, 234 "execute owl commands from a file",232 "execute BarnOwl commands from a file", 235 233 "source <filename>", 236 "Execute the owl commands in <filename>.\n"),234 "Execute the BarnOwl commands in <filename>.\n"), 237 235 238 236 OWLCMD_ARGS("aim", owl_command_aim, OWL_CTX_INTERACTIVE, … … 303 301 304 302 OWLCMD_ARGS("help", owl_command_help, OWL_CTX_INTERACTIVE, 305 "display help on using owl",303 "display help on using BarnOwl", 306 304 "help [command]", ""), 307 305 … … 416 414 417 415 OWLCMD_VOID("suspend", owl_command_suspend, OWL_CTX_ANY, 418 "suspend owl", "", ""),416 "suspend BarnOwl", "", ""), 419 417 420 418 OWLCMD_ARGS("echo", owl_command_echo, OWL_CTX_ANY, … … 507 505 508 506 OWLCMD_VOID("about", owl_command_about, OWL_CTX_INTERACTIVE, 509 "print information about owl", "", ""),507 "print information about BarnOwl", "", ""), 510 508 511 509 OWLCMD_VOID("status", owl_command_status, OWL_CTX_ANY, 512 "print status information about the running owl", "", ""),510 "print status information about the running BarnOwl", "", ""), 513 511 514 512 OWLCMD_ARGS("zlocate", owl_command_zlocate, OWL_CTX_INTERACTIVE, … … 588 586 "The other usages listed above are abbreviated forms that simply set\n" 589 587 "the filter of the current view. The -d option allows you to write a\n" 590 "filter expression that will be dynamically created by owl and then\n"588 "filter expression that will be dynamically created by BarnOwl and then\n" 591 589 "applied as the view's filter\n" 592 590 "SEE ALSO: filter, viewclass, viewuser\n"), … … 654 652 "show subscriptions / show subs\n" 655 653 "show terminal\n" 656 "show timers\n"657 654 "show variables\n" 658 655 "show variable <variable>\n" … … 675 672 "for formatting messages.\n\n" 676 673 "Show variables will list the names of all variables.\n\n" 677 "Show errors will show a list of errors encountered by Owl.\n\n"674 "Show errors will show a list of errors encountered by BarnOwl.\n\n" 678 675 "SEE ALSO: filter, view, alias, bindkey, help\n"), 679 676 … … 693 690 OWLCMD_ALIAS("del", "delete"), 694 691 692 OWLCMD_ARGS("delete-and-expunge", owl_command_delete_and_expunge, OWL_CTX_INTERACTIVE, 693 "delete a message", 694 "delete-and-expunge [-id msgid] [-q | --quiet]", 695 "If no message id is specified the current message is deleted.\n" 696 "Otherwise the message with the given message id is deleted.\n" 697 "If --quiet is specified, then there is no message displayed on\n" 698 "success.\n"), 699 OWLCMD_ALIAS("delx", "delete-and-expunge"), 700 695 701 OWLCMD_ARGS("undelete", owl_command_undelete, OWL_CTX_INTERACTIVE, 696 702 "unmark a message for deletion", … … 1027 1033 OWLCMD_ARGS_CTX("popless:start-search", owl_viewwin_command_start_search, OWL_CTX_POPLESS, 1028 1034 "starts a command line to search for particular string", 1029 "popless:start-search [-r] [init al-value]",1035 "popless:start-search [-r] [initial-value]", 1030 1036 "Initializes the command-line to search for initial-value. If\n" 1031 1037 "-r is used, the search will be performed backwards.\n\n" … … 1037 1043 { NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } 1038 1044 1039 }; 1045 }; 1046 1047 owl_cmddict_add_from_list(cd, commands_to_init); 1048 owl_cmd *cmd; 1049 for (cmd = commands_to_init; cmd->name != NULL; cmd++) 1050 owl_cmd_cleanup(cmd); 1051 } 1040 1052 1041 1053 void owl_command_info(void) … … 1366 1378 } 1367 1379 1368 char *owl_command_smartfilter(int argc, const char *const *argv, const char *buff)1380 CALLER_OWN char *owl_command_smartfilter(int argc, const char *const *argv, const char *buff) 1369 1381 { 1370 1382 char *filtname = NULL; … … 1406 1418 } 1407 1419 1408 char *owl_command_get_shift(int argc, const char *const *argv, const char *buff)1420 CALLER_OWN char *owl_command_get_shift(int argc, const char *const *argv, const char *buff) 1409 1421 { 1410 1422 if(argc != 1) … … 1565 1577 int silent=0; 1566 1578 int requirebool=0; 1579 owl_variable *v; 1567 1580 1568 1581 if (argc == 1) { … … 1587 1600 return NULL; 1588 1601 } 1589 owl_variable_set_fromstring(owl_global_get_vardict(&g), var, val, !silent, requirebool); 1602 1603 v = owl_variable_get_var(owl_global_get_vardict(&g), var); 1604 if (v == NULL) { 1605 if (!silent) owl_function_error("Unknown variable '%s'", var); 1606 } else if (requirebool && !v->takes_on_off) { 1607 if (!silent) owl_function_error("Variable '%s' is not a boolean", var); 1608 } else { 1609 owl_variable_set_fromstring(v, val, !silent); 1610 } 1590 1611 return NULL; 1591 1612 } … … 1593 1614 char *owl_command_unset(int argc, const char *const *argv, const char *buff) 1594 1615 { 1616 owl_variable *v; 1595 1617 const char *var, *val; 1596 1618 int silent=0; … … 1607 1629 return NULL; 1608 1630 } 1609 owl_variable_set_fromstring(owl_global_get_vardict(&g), var, val, !silent, 1); 1631 1632 v = owl_variable_get_var(owl_global_get_vardict(&g), var); 1633 if (v == NULL) { 1634 if (!silent) owl_function_error("Unknown variable '%s'", var); 1635 } else if (!v->takes_on_off) { 1636 if (!silent) owl_function_error("Variable '%s' is not a boolean", var); 1637 } else { 1638 owl_variable_set_fromstring(v, val, !silent); 1639 } 1610 1640 return NULL; 1611 1641 } … … 1615 1645 const char *var; 1616 1646 char *value; 1647 const owl_variable *v; 1617 1648 1618 1649 if (argc==1) { … … 1626 1657 var=argv[1]; 1627 1658 1628 value = owl_variable_get_tostring(owl_global_get_vardict(&g), var); 1629 if (value) { 1630 owl_function_makemsg("%s = '%s'", var, value); 1659 v = owl_variable_get_var(owl_global_get_vardict(&g), var); 1660 if (v) { 1661 value = owl_variable_get_tostring(v); 1662 if (value == NULL) 1663 owl_function_makemsg("%s = <null>", var); 1664 else 1665 owl_function_makemsg("%s = '%s'", var, value); 1631 1666 g_free(value); 1632 1667 } else { … … 1637 1672 1638 1673 1639 char *owl_command_exec(int argc, const char *const *argv, const char *buff)1674 CALLER_OWN char *owl_command_exec(int argc, const char *const *argv, const char *buff) 1640 1675 { 1641 1676 return owl_function_exec(argc, argv, buff, OWL_OUTPUT_RETURN); 1642 1677 } 1643 1678 1644 char *owl_command_pexec(int argc, const char *const *argv, const char *buff)1679 CALLER_OWN char *owl_command_pexec(int argc, const char *const *argv, const char *buff) 1645 1680 { 1646 1681 return owl_function_exec(argc, argv, buff, OWL_OUTPUT_POPUP); 1647 1682 } 1648 1683 1649 char *owl_command_aexec(int argc, const char *const *argv, const char *buff)1684 CALLER_OWN char *owl_command_aexec(int argc, const char *const *argv, const char *buff) 1650 1685 { 1651 1686 return owl_function_exec(argc, argv, buff, OWL_OUTPUT_ADMINMSG); 1652 1687 } 1653 1688 1654 char *owl_command_perl(int argc, const char *const *argv, const char *buff)1689 CALLER_OWN char *owl_command_perl(int argc, const char *const *argv, const char *buff) 1655 1690 { 1656 1691 return owl_function_perl(argc, argv, buff, OWL_OUTPUT_RETURN); 1657 1692 } 1658 1693 1659 char *owl_command_pperl(int argc, const char *const *argv, const char *buff)1694 CALLER_OWN char *owl_command_pperl(int argc, const char *const *argv, const char *buff) 1660 1695 { 1661 1696 return owl_function_perl(argc, argv, buff, OWL_OUTPUT_POPUP); 1662 1697 } 1663 1698 1664 char *owl_command_aperl(int argc, const char *const *argv, const char *buff)1699 CALLER_OWN char *owl_command_aperl(int argc, const char *const *argv, const char *buff) 1665 1700 { 1666 1701 return owl_function_perl(argc, argv, buff, OWL_OUTPUT_ADMINMSG); 1667 1702 } 1668 1703 1669 char *owl_command_multi(int argc, const char *const *argv, const char *buff)1704 CALLER_OWN char *owl_command_multi(int argc, const char *const *argv, const char *buff) 1670 1705 { 1671 1706 char *lastrv = NULL, *newbuff; … … 1743 1778 1744 1779 if (argc < 3) { 1745 owl_function_makemsg("Usage: bindkey <keymap> <binding>");1780 owl_function_makemsg("Usage: unbindkey <keymap> <binding>"); 1746 1781 return NULL; 1747 1782 } … … 1950 1985 } 1951 1986 /* check for a zwrite -m */ 1952 z = owl_zwrite_new( buff);1987 z = owl_zwrite_new(argc, argv); 1953 1988 if (!z) { 1954 1989 owl_function_error("Error in zwrite arguments"); … … 2126 2161 myargv[i]=argv[i]; 2127 2162 } 2128 owl_function_create_filter(argc, myargv); 2129 owl_function_change_currentview_filter("owl-dynamic"); 2163 if (owl_function_create_filter(argc, myargv)) { 2164 owl_function_change_currentview_filter("owl-dynamic"); 2165 } 2130 2166 g_free(myargv); 2131 2167 return NULL; … … 2154 2190 if (!strcmp(argv[0], "-f")) { 2155 2191 if (argc<2) { 2156 owl_function_makemsg("Too few arg ments to the view command");2192 owl_function_makemsg("Too few arguments to the view command"); 2157 2193 return(NULL); 2158 2194 } … … 2166 2202 } else if (!strcmp(argv[0], "-s")) { 2167 2203 if (argc<2) { 2168 owl_function_makemsg("Too few arg ments to the view command");2204 owl_function_makemsg("Too few arguments to the view command"); 2169 2205 return(NULL); 2170 2206 } … … 2173 2209 argv+=2; 2174 2210 } else { 2175 owl_function_makemsg("Too few arg ments to the view command");2211 owl_function_makemsg("Too few arguments to the view command"); 2176 2212 return(NULL); 2177 2213 } … … 2225 2261 } else if (!strcmp(argv[1], "styles")) { 2226 2262 owl_function_show_styles(); 2227 } else if (!strcmp(argv[1], "timers")) {2228 owl_function_show_timers();2229 2263 } else if (!strcmp(argv[1], "subs") || !strcmp(argv[1], "subscriptions")) { 2230 2264 owl_function_getsubs(); … … 2326 2360 } 2327 2361 2362 char *owl_command_delete_and_expunge(int argc, const char *const *argv, const char *buff) 2363 { 2364 bool exclaim_success = true; 2365 2366 if (argc > 1 && (!strcmp(argv[1], "-q") || !strcmp(argv[1], "--quiet"))) { 2367 exclaim_success = false; 2368 argc--; 2369 argv++; 2370 } else if (!strcmp(argv[argc - 1], "-q") || !strcmp(argv[argc - 1], "--quiet")) { 2371 exclaim_success = false; 2372 argc--; 2373 } 2374 2375 if (argc == 1) { 2376 owl_function_delete_and_expunge_cur(exclaim_success); 2377 return NULL; 2378 } 2379 2380 if (argc == 3 && (!strcmp(argv[1], "-id") || !strcmp(argv[1], "--id"))) { 2381 owl_function_delete_and_expunge_by_id(atoi(argv[2]), exclaim_success); 2382 return NULL; 2383 } 2384 2385 owl_function_makemsg("Unknown arguments to delete-and-expunge command"); 2386 return NULL; 2387 } 2388 2328 2389 char *owl_command_undelete(int argc, const char *const *argv, const char *buff) 2329 2390 { … … 2462 2523 void owl_command_punt_unpunt(int argc, const char *const * argv, const char *buff, int unpunt) 2463 2524 { 2464 owl_list * fl; 2465 owl_filter * f; 2525 GPtrArray * fl; 2466 2526 int i; 2467 2527 … … 2471 2531 } else if(argc == 2) { 2472 2532 /* Handle :unpunt <number> */ 2473 if (unpunt && (i=atoi(argv[1])) !=0) {2533 if (unpunt && (i = atoi(argv[1])) > 0) { 2474 2534 i--; /* Accept 1-based indexing */ 2475 if(i < owl_list_get_size(fl)) { 2476 f = owl_list_get_element(fl, i); 2477 owl_list_remove_element(fl, i); 2478 owl_filter_delete(f); 2535 if (i < fl->len) { 2536 owl_filter_delete(g_ptr_array_remove_index(fl, i)); 2479 2537 return; 2480 2538 } else { … … 2503 2561 } 2504 2562 2505 char *owl_command_getvar(int argc, const char *const *argv, const char *buff) 2506 { 2563 CALLER_OWN char *owl_command_getvar(int argc, const char *const *argv, const char *buff) 2564 { 2565 const owl_variable *v; 2507 2566 if (argc != 2) { 2508 2567 owl_function_makemsg("Wrong number of arguments for %s", argv[0]); 2509 2568 return NULL; 2510 2569 } 2511 return owl_variable_get_tostring(owl_global_get_vardict(&g), argv[1]); 2570 v = owl_variable_get_var(owl_global_get_vardict(&g), argv[1]); 2571 if (v == NULL) return NULL; 2572 return owl_variable_get_tostring(v); 2512 2573 } 2513 2574 … … 2589 2650 } 2590 2651 2591 char *owl_command_getstyle(int argc, const char *const *argv, const char *buff)2652 CALLER_OWN char *owl_command_getstyle(int argc, const char *const *argv, const char *buff) 2592 2653 { 2593 2654 const char *stylename; … … 2627 2688 ptr = skiptokens(buff, 1); 2628 2689 hist = owl_global_get_cmd_history(&g); 2629 owl_history_store(hist, ptr); 2630 owl_history_reset(hist); 2690 owl_history_store(hist, ptr, false); 2631 2691 /* owl_function_makemsg("History '%s' stored successfully", ptr+1); */ 2632 2692 return NULL; 2633 2693 } 2634 2694 2635 char *owl_command_with_history(int argc, const char *const *argv, const char *buff)2695 CALLER_OWN char *owl_command_with_history(int argc, const char *const *argv, const char *buff) 2636 2696 { 2637 2697 owl_history *hist; … … 2650 2710 2651 2711 hist = owl_global_get_cmd_history(&g); 2652 owl_history_store(hist, ptr); 2653 owl_history_reset(hist); 2712 owl_history_store(hist, ptr, false); 2654 2713 return owl_function_command(ptr); 2655 2714 } … … 2734 2793 2735 2794 hist = owl_editwin_get_history(e); 2736 if (hist) { 2737 owl_history_store(hist, owl_editwin_get_text(e)); 2738 owl_history_reset(hist); 2739 } 2740 2795 if (hist) 2796 owl_history_store(hist, owl_editwin_get_text(e), false); 2797 2798 /* Take a reference to the editwin, so that it survives the pop 2799 * context. TODO: We should perhaps refcount or otherwise protect 2800 * the context so that, even if a command pops a context, the 2801 * context itself will last until the command returns. */ 2802 owl_editwin_ref(e); 2741 2803 owl_global_pop_context(&g); 2804 2805 owl_editwin_do_callback(e, false); 2806 owl_editwin_unref(e); 2742 2807 } 2743 2808 … … 2750 2815 if (!hist) 2751 2816 return; 2752 if (!owl_history_is_touched(hist)) { 2753 owl_history_store(hist, owl_editwin_get_text(e)); 2754 owl_history_set_partial(hist); 2755 } 2817 if (!owl_history_is_touched(hist)) 2818 owl_history_store(hist, owl_editwin_get_text(e), true); 2756 2819 ptr=owl_history_get_prev(hist); 2757 2820 if (ptr) { … … 2791 2854 owl_history *hist=owl_editwin_get_history(e); 2792 2855 2793 if (hist) { 2794 owl_history_store(hist, owl_editwin_get_text(e)); 2795 owl_history_reset(hist); 2796 } 2856 if (hist) 2857 owl_history_store(hist, owl_editwin_get_text(e), false); 2797 2858 2798 2859 /* Take a reference to the editwin, so that it survives the pop … … 2803 2864 owl_global_pop_context(&g); 2804 2865 2805 owl_editwin_do_callback(e );2866 owl_editwin_do_callback(e, true); 2806 2867 owl_editwin_unref(e); 2807 2868 } -
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
r1255365 re4b8f93 1 1 dnl Process this file with autoconf to produce a configure script. 2 AC_INIT([BarnOwl],[1.8dev],[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 … … 8 9 9 10 AC_PROG_CC 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 ) 10 29 11 30 AC_ARG_WITH([stack-protector], … … 16 35 17 36 AS_IF([test "x$with_stack_protector" != xno], 18 [AX_C _CHECK_FLAG([-fstack-protector],[],[],37 [AX_CHECK_COMPILE_FLAG([-fstack-protector], 19 38 [AM_CFLAGS="$AM_CFLAGS -fstack-protector"], 20 39 [if test "x$with_stack_protector" != xcheck; then … … 40 59 41 60 AS_IF([test "x$with_zephyr" != xno], 42 [AS_IF([test "x$with_krb4" != "xno"], 61 [have_krb4=no 62 63 AS_IF([test "x$with_krb4" != "xno"], 43 64 [AC_MSG_CHECKING([for Kerberos IV]) 44 65 AS_IF([krb5-config krb4 --libs >/dev/null 2>&1], 45 66 [AC_MSG_RESULT([yes]) 67 have_krb4=yes 46 68 AC_DEFINE([HAVE_KERBEROS_IV], [1], [Define if you have kerberos IV]) 47 69 AM_CFLAGS="${AM_CFLAGS} `krb5-config krb4 --cflags`" … … 50 72 [AC_MSG_RESULT([no]) 51 73 AS_IF([test "x$with_krb4" = "xyes"], 52 [AC_MSG_ERROR([Kerberos IV requested but not found])]) 53 PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto]) 54 AM_CFLAGS="${AM_CFLAGS} ${LIBCRYPTO_CFLAGS}" 55 LIBS="${LIBS} ${LIBCRYPTO_LIBS}" 56 ])]) 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 57 86 AC_CHECK_LIB([zephyr], [ZGetSender], 58 87 [LIBS="$LIBS -lzephyr" … … 80 109 AC_HEADER_STDC 81 110 AC_HEADER_SYS_WAIT 82 AC_HEADER_STDBOOL 83 AC_CHECK_HEADERS(strings.h sys/ioctl.h sys/filio.h unistd.h) 111 AC_CHECK_HEADERS(stdbool.h strings.h sys/ioctl.h sys/filio.h unistd.h) 84 112 85 113 dnl Add CFLAGS for embeded perl … … 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}) … … 109 137 AC_CHECK_LIB([perl], [perl_alloc],, AC_MSG_ERROR([No libperl found])) 110 138 139 AX_PROG_PERL_MODULES([AnyEvent],, 140 [AC_MSG_ERROR([cannot find perl module AnyEvent.])]) 111 141 AX_PROG_PERL_MODULES([Class::Accessor::Fast],, 112 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])]) 145 AX_PROG_PERL_MODULES([Glib],, 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])]) 113 149 AX_PROG_PERL_MODULES([PAR],, 114 150 [AC_MSG_WARN([PAR.pm not found. Loadable modules will be disabled.])]) 115 151 116 152 dnl Add CFLAGS and LIBS for glib-2.0 117 PKG_CHECK_MODULES(GLIB,[glib-2.0 >= 2.1 2gobject-2.0 gthread-2.0])153 PKG_CHECK_MODULES(GLIB,[glib-2.0 >= 2.16 gobject-2.0 gthread-2.0]) 118 154 119 155 AC_MSG_NOTICE([Adding glib-2.0 CFLAGS ${GLIB_CFLAGS}]) … … 126 162 fi 127 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}" 168 128 169 dnl Checks for typedefs, structures, and compiler characteristics. 129 170 130 171 AX_CFLAGS_WARN_ALL([AM_CFLAGS]) 131 AX_ C_CHECK_FLAG([-Wstrict-prototypes],[],[],[AM_CFLAGS="$AM_CFLAGS -Wstrict-prototypes"])172 AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes -Wwrite-strings],[AM_CFLAGS]) 132 173 133 174 dnl Shut gcc up about zero-length format strings; the warning's apparently for 134 175 dnl efficiency reasons, which is bogus for custom functions. 135 AX_C_CHECK_FLAG([-Wno-format-zero-length],[],[],[AM_CFLAGS="$AM_CFLAGS -Wno-format-zero-length"]) 136 137 m4_foreach([myflag], 138 [[-Wno-pointer-sign],[-Wno-empty-body],[-Wno-unused-value]], 139 [AX_C_CHECK_FLAG([myflag],[],[],[LIBFAIM_CFLAGS="$LIBFAIM_CFLAGS myflag"])]) 176 AX_APPEND_COMPILE_FLAGS([-Wno-format-zero-length],[AM_CFLAGS]) 177 178 AX_APPEND_COMPILE_FLAGS([-Wno-pointer-sign -Wno-empty-body -Wno-unused-value],[LIBFAIM_CFLAGS]) 140 179 141 180 AM_CONDITIONAL([ENABLE_ZCRYPT], [test "$HAVE_DES_STRING_TO_KEY" && dnl … … 143 182 test "$HAVE_DES_ECB_ENCRYPT"]) 144 183 145 AM_CFLAGS="$AM_CFLAGS -D_XOPEN_SOURCE= 500"184 AM_CFLAGS="$AM_CFLAGS -D_XOPEN_SOURCE=600" 146 185 dnl Define _BSD_SOURCE because zephyr needs caddr_t. 147 186 AM_CFLAGS="$AM_CFLAGS -D_BSD_SOURCE" … … 166 205 AC_REPLACE_FUNCS([memrchr]) 167 206 207 AC_SUBST([abs_builddir]) 208 AC_SUBST([abs_srcdir]) 209 168 210 AC_CONFIG_FILES([Makefile compat/Makefile libfaim/Makefile perl/Makefile perl/modules/Makefile]) 169 211 AC_OUTPUT -
context.c
rd4927a7 rf271129 1 #include <string.h>2 1 #include "owl.h" 3 2 … … 6 5 7 6 /* TODO: dependency from owl_context -> owl_window is annoying. */ 8 owl_context *owl_context_new(int mode, void *data, const char *keymap, owl_window *cursor)7 CALLER_OWN owl_context *owl_context_new(int mode, void *data, const char *keymap, owl_window *cursor) 9 8 { 10 9 owl_context *c; -
dict.c
r4c7c21f rf271129 6 6 */ 7 7 8 #include <stdlib.h>9 #include <string.h>10 #include <unistd.h>11 8 #include "owl.h" 12 13 9 14 10 #define INITSIZE 30 … … 56 52 } 57 53 58 /* Appends dictionary keys to a list. Duplicates the keys, 59 * so they will need to be freed by the caller. */ 60 void owl_dict_get_keys(const owl_dict *d, owl_list *l) { 54 /* Returns a GPtrArray of dictionary keys. Duplicates the keys, so 55 * they will need to be freed by the caller with g_free. */ 56 CALLER_OWN GPtrArray *owl_dict_get_keys(const owl_dict *d) { 57 GPtrArray *keys = g_ptr_array_sized_new(d->size); 61 58 int i; 62 for (i =0; i<d->size; i++) {63 owl_list_append_element(l, g_strdup(d->els[i].k));59 for (i = 0; i < d->size; i++) { 60 g_ptr_array_add(keys, g_strdup(d->els[i].k)); 64 61 } 62 return keys; 65 63 } 66 64 … … 107 105 /* Doesn't free the value of the element, but does 108 106 * return it so the caller can free it. */ 109 void *owl_dict_remove_element(owl_dict *d, const char *k) { 107 CALLER_OWN void *owl_dict_remove_element(owl_dict *d, const char *k) 108 { 110 109 int i; 111 110 int pos, found; -
doc/barnowl.1
rfa1b15b r8135737 1 .TH barnowl 1 "23 Jun 2008"1 .TH BARNOWL 1 "24 Jun 2011" 2 2 .SH NAME 3 barnowl \- ttybased zephyr client3 BarnOwl \- tty\(hybased zephyr client 4 4 .SH SYNOPSIS 5 5 .B barnowl 6 [ \-n 7 ] 8 [ \-d 9 ] 10 [ \-D 11 ] 12 [ \-v 13 ] 14 [ \-h 15 ] 16 [ \-c 17 .I configfile 18 ] 19 [ \-t 20 .I tty 21 ] 22 [ \-s 23 .I configdir 24 ] 6 [\-n] 7 [\-d] 8 [\-D] 9 [\-v] 10 [\-h] 11 [\-c \fICONFIGFILE\fP] 12 [\-t \fITTY\fP] 13 [\-s \fICONFIGDIR\fP] 25 14 .br 26 15 .SH DESCRIPTION 27 16 .B BarnOwl 28 is a fully integrated tty 29 it supports AOL Instant Messenger, MIT Zephyr, and Jabber. It is30 curses -based, allows for emacs-style editing of outgoing messagesand31 uses perl as an extension and configuration language. BarnOwlwill17 is a fully integrated tty\(hybased instant messaging client. Currently 18 it supports AOL Instant Messenger, MIT Zephyr, Jabber, IRC, and Twitter. It is 19 curses\(hybased, allows for emacs\(hystyle editing of outgoing messages, and 20 uses Perl as an extension and configuration language. \fBBarnOwl\fP will 32 21 also run happily without a configuration file. 33 22 34 Once BarnOwl is started, typing 'h'will display a help screen.35 Typing \ ':\' enters command mode, allowing the user to type a barnowl23 Once \fBBarnOwl\fP is started, typing \(oqh\(cq will display a help screen. 24 Typing \(oq:\(cq enters command mode, allowing the user to type a \fBBarnOwl\fP 36 25 command line. 37 26 38 .PP 39 .SH USE 40 The following command line options are avilable when running barnowl: 27 .SH OPTIONS 28 The following command\-line options are avilable when running \fBBarnOwl\fP: 29 .TP 30 \fB\-n\fP, \fB\-\-no\-subs\fP 31 Do not subscribe to zephyr messages on startup. By default, \fBBarnOwl\fP 32 subscribes to the default subscriptions and to anything found in 33 \fI~/.zephyr.subs\fP. When this option is used, no subscriptions are loaded. 41 34 42 .B \-n 43 .IP 44 Do not subscribe to zephyr messages on startup. By default BarnOwl 45 subscribes to the default subscriptions and to anything found in 46 ~/.zephyr.subs. When this option is used no subscriptions are loaded. 47 .LP 35 .TP 36 \fB\-c\fP, \fB\-\-config\-file\fP=\fIFILE\fP 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.) 48 42 49 .B \-c \fIconfigfile\fP 50 .IP 51 Specifiy an alternate config file for BarnOwl to use. By default, 52 barnowl uses ~/.barnowlconf if it exists, and ~/.owlconf otherwise. 53 .LP 43 By default, \fBBarnOwl\fP uses the first of \fI~/.owl/init.pl\fP, 44 \fI~/.barnowlconf\fP, or \fI~/.owlconf\fP that exists. 54 45 55 .B \-s \fIconfigdir\fP 56 .IP 57 Specify an alternate configuration directory. By default, BarnOwl uses 58 ~/.owl/. 59 .LP 46 .TP 47 \fB\-s\fP, \fB\-\-config\-dir\fP=\fIDIR\fP 48 Specify an alternate configuration directory. By default, \fBBarnOwl\fP uses 49 \fI~/.owl/\fP. 60 50 61 .B \-t \fItty\fP 62 .IP 63 Specifiy the tty name to use for the zephyr location. 64 .LP 51 .TP 52 \fB\-t\fP, \fB\-\-tty\fP=\fITTY\fP 53 Specify the tty name to use for the zephyr location. 65 54 66 .B \-v 67 .IP 68 Print the version number of barnowl and exit. 69 .LP 55 .TP 56 \fB\-v\fP, \fB\-\-version\fP 57 Print the version number of \fBBarnOwl\fP and exit. 70 58 71 .B \-d 72 .IP 73 Enable debugging. By default debugging information is placed in 74 /var/tmp/owldebug. 75 .LP 59 .TP 60 \fB\-d\fP, \fB\-\-debug\fP 61 Enable debugging. By default, debugging information is placed in 62 \fI/var/tmp/barnowl\-debug.PID\fP. 76 63 77 .B \-D 78 .IP 79 Enable debugging, but first delete any existing debugging file. 80 .LP 64 .TP 65 \fB\-h\fP, \fB\-\-help\fP 66 Print command\(hyline option help. 81 67 82 .B \-h 83 .IP 84 Print command line option help. 85 .LP 86 87 .SH AUTHOR 68 .SH AUTHORS 88 69 Written by Nelson Elhage and Alejandro Sedeno at the Massachusetts 89 Institute of Technology. Based on Owl by James Kretchmar.70 Institute of Technology. Based on Owl by James Kretchmar. 90 71 91 72 Comments, questions, and bug reports may be mailed to 92 \fBbug -barnowl@mit.edu\fP.73 \fBbug\-barnowl@mit.edu\fP. -
editcontext.c
r4a41f16 rf271129 1 1 #include "owl.h" 2 3 2 #include <assert.h> 4 3 … … 8 7 } 9 8 10 owl_context *owl_editcontext_new(int mode, owl_editwin *e, const char *keymap, void (*deactivate_cb)(owl_context*), void *cbdata)9 CALLER_OWN owl_context *owl_editcontext_new(int mode, owl_editwin *e, const char *keymap, void (*deactivate_cb)(owl_context*), void *cbdata) 11 10 { 12 11 owl_context *ctx = owl_context_new(mode, owl_editwin_ref(e), keymap, -
editwin.c
r3b8a563 r8258ea5 1 1 #include "owl.h" 2 #include <stdlib.h>3 #include <unistd.h>4 #include <string.h>5 #include <ctype.h>6 2 7 3 #define VALID_EXCURSION (0x9a2b4729) … … 37 33 oe_excursion *excursions; 38 34 39 void (*callback)(struct _owl_editwin *);35 void (*callback)(struct _owl_editwin *e, bool success); 40 36 void (*destroy_cbdata)(void *); 41 37 void *cbdata; … … 61 57 static const char *oe_copy_buf(owl_editwin *e, const char *buf, int len); 62 58 static int oe_copy_region(owl_editwin *e); 63 static char *oe_chunk(owl_editwin *e, int start, int end);59 static CALLER_OWN char *oe_chunk(owl_editwin *e, int start, int end); 64 60 static void oe_destroy_cbdata(owl_editwin *e); 65 61 static void oe_dirty(owl_editwin *e); … … 70 66 #define WHITESPACE " \n\t" 71 67 72 static owl_editwin *owl_editwin_allocate(void)68 static CALLER_OWN owl_editwin *owl_editwin_allocate(void) 73 69 { 74 70 owl_editwin *e = g_new0(owl_editwin, 1); … … 142 138 } 143 139 144 owl_editwin *owl_editwin_new(owl_window *win, int winlines, int wincols, int style, owl_history *hist)140 CALLER_OWN owl_editwin *owl_editwin_new(owl_window *win, int winlines, int wincols, int style, owl_history *hist) 145 141 { 146 142 owl_editwin *e = owl_editwin_allocate(); … … 224 220 } 225 221 226 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)) 227 223 { 228 224 e->callback = cb; 229 225 } 230 226 231 void (*owl_editwin_get_callback(owl_editwin *e))(owl_editwin *)227 void (*owl_editwin_get_callback(owl_editwin *e))(owl_editwin *, bool) 232 228 { 233 229 return e->callback; … … 252 248 } 253 249 254 void owl_editwin_do_callback(owl_editwin *e) { 255 void (*cb)(owl_editwin*); 256 cb=owl_editwin_get_callback(e); 257 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) { 258 255 owl_function_error("Internal error: No editwin callback!"); 259 256 } else { 260 /* owl_function_error("text: |%s|", owl_editwin_get_text(e)); */ 261 cb(e); 257 cb(e, success); 262 258 } 263 259 } … … 623 619 624 620 if (!g_utf8_validate(s, -1, NULL)) { 625 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."); 626 622 return 0; 627 623 } … … 1151 1147 { 1152 1148 oe_excursion x; 1153 gunichar ch; 1149 gunichar ch = 0; 1150 gunichar last_ch; 1154 1151 int sentence; 1155 1152 … … 1184 1181 } 1185 1182 1183 last_ch = ch; 1186 1184 ch = owl_editwin_get_char_at_point(e); 1187 1185 … … 1201 1199 } 1202 1200 1203 if(ch == '.' || ch == '!' || ch == '?') 1201 if (ch == '.' || ch == '!' || ch == '?' || 1202 (ch == '"' && (last_ch == '.' || last_ch == '!' || last_ch == '?'))) 1204 1203 sentence = 1; 1205 1204 else … … 1369 1368 } 1370 1369 1371 char *owl_editwin_get_region(owl_editwin *e)1370 CALLER_OWN char *owl_editwin_get_region(owl_editwin *e) 1372 1371 { 1373 1372 int start, end; … … 1388 1387 } 1389 1388 1390 static char *oe_chunk(owl_editwin *e, int start, int end)1389 static CALLER_OWN char *oe_chunk(owl_editwin *e, int start, int end) 1391 1390 { 1392 1391 char *p; -
errqueue.c
rd4927a7 reb897c6 3 3 void owl_errqueue_init(owl_errqueue *eq) 4 4 { 5 owl_list_create(&(eq->errlist));5 eq->errlist = g_ptr_array_new(); 6 6 } 7 7 8 8 void owl_errqueue_append_err(owl_errqueue *eq, const char *msg) 9 9 { 10 owl_list_append_element(&(eq->errlist), g_strdup(msg));10 g_ptr_array_add(eq->errlist, g_strdup(msg)); 11 11 } 12 12 … … 14 14 void owl_errqueue_to_fmtext(const owl_errqueue *eq, owl_fmtext *fm) 15 15 { 16 int i, j; 17 18 j=owl_list_get_size(&(eq->errlist)); 19 for (i=0; i<j; i++) { 20 owl_fmtext_append_normal(fm, owl_list_get_element(&(eq->errlist), i)); 16 int i; 17 for (i = 0; i < eq->errlist->len; i++) { 18 owl_fmtext_append_normal(fm, eq->errlist->pdata[i]); 21 19 owl_fmtext_append_normal(fm, "\n"); 22 20 } -
filter.c
re56303f rc068c03 1 #include <string.h>2 1 #include "owl.h" 3 2 … … 125 124 126 125 op1 = owl_filter_parse_primitive_expression(argc-i, argv+i, &skip); 126 if(!op1) goto err; 127 127 i += skip; 128 if(!op1) goto err;129 128 130 129 while(i < argc) { … … 200 199 201 200 202 char*owl_filter_print(const owl_filter *f)201 CALLER_OWN char *owl_filter_print(const owl_filter *f) 203 202 { 204 203 GString *out = g_string_new(""); … … 220 219 } 221 220 else { 222 g_string_append_printf(out, "%i",f-> fgcolor);221 g_string_append_printf(out, "%i",f->bgcolor); 223 222 } 224 223 g_string_append(out, " "); -
filterelement.c
rd4927a7 r7756dde 104 104 } 105 105 106 /* XXX: Our boolea operators short-circuit here. The original owl did106 /* XXX: Our boolean operators short-circuit here. The original owl did 107 107 not. Do we care? 108 108 */ -
filterproc.c
re2cc848 r7155955 1 #include <signal.h> 1 #include "filterproc.h" 2 #include <sys/wait.h> 3 #include <fcntl.h> 4 #include <glib.h> 5 #include <poll.h> 6 #include <string.h> 2 7 #include <unistd.h> 3 #include <sys/select.h>4 #include <sys/types.h>5 #include <sys/wait.h>6 #include <poll.h>7 #include <fcntl.h>8 #include <string.h>9 8 10 #include <glib.h> 11 12 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) 13 12 { 14 13 GString *str = g_string_new(""); … … 25 24 fds[1].fd = wfd; 26 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 } 27 32 28 33 while(1) { … … 47 52 } 48 53 if(!out || !*out || fds[1].revents & (POLLERR | POLLHUP)) { 49 close(wfd); 54 close(wfd); wfd = -1; 50 55 out = NULL; 51 56 } … … 63 68 } 64 69 70 if (wfd >= 0) close(wfd); 71 close(rfd); 65 72 *in = g_string_free(str, err < 0); 66 73 return err; 67 74 } 68 75 69 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) 70 77 { 71 int err = 0; 72 pid_t pid; 73 int rfd[2]; 74 int wfd[2]; 78 int err; 79 GPid child_pid; 80 int child_stdin, child_stdout; 75 81 76 if((err = pipe(rfd))) goto out; 77 if((err = pipe(wfd))) goto out_close_rfd; 78 79 pid = fork(); 80 if(pid < 0) { 81 err = pid; 82 goto out_close_all; 83 } 84 if(pid) { 85 /* parent */ 86 close(rfd[1]); 87 close(wfd[0]); 88 err = send_receive(rfd[0], wfd[1], in, out); 89 if(err == 0) { 90 waitpid(pid, status, 0); 91 } 92 } else { 93 /* child */ 94 close(rfd[0]); 95 close(wfd[1]); 96 dup2(rfd[1], 1); 97 dup2(wfd[0], 0); 98 close(rfd[1]); 99 close(wfd[0]); 100 101 if(execvp(prog, (char *const *)argv)) { 102 _exit(-1); 103 } 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; 104 89 } 105 90 106 out_close_all: 107 close(wfd[0]); 108 close(wfd[1]); 109 out_close_rfd: 110 close(rfd[0]); 111 close(rfd[1]); 112 out: 91 err = send_receive(child_stdout, child_stdin, in, out); 92 if (err == 0) { 93 waitpid(child_pid, status, 0); 94 } 113 95 return err; 114 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); -
fmtext.c
r7b4f3be rf271129 1 1 #include "owl.h" 2 #include <stdlib.h>3 #include <string.h>4 2 5 3 /* initialize an fmtext with no data */ … … 171 169 * freeing the return 172 170 */ 173 char *owl_fmtext_print_plain(const owl_fmtext *f)171 CALLER_OWN char *owl_fmtext_print_plain(const owl_fmtext *f) 174 172 { 175 173 return owl_strip_format_chars(f->buff->str); … … 186 184 static void _owl_fmtext_wcolor_set(WINDOW *w, short pair) 187 185 { 186 cchar_t background; 187 wchar_t blank[2] = { ' ', 0 }; 188 188 if (has_colors()) { 189 wcolor_set(w,pair,NULL); 190 wbkgdset(w, COLOR_PAIR(pair)); 189 wcolor_set(w, pair, NULL); 190 /* Set the background with wbkgrndset so that we can handle color-pairs 191 * past 256 on ncurses ABI 6 and later. */ 192 setcchar(&background, blank, 0, pair, NULL); 193 wbkgrndset(w, &background); 191 194 } 192 195 } … … 686 689 * but zwgc seems to be smarter about some screw cases than I am 687 690 */ 691 g_free(buff); 688 692 owl_fmtext_append_attr(f, "@", curattrs, curcolor, OWL_COLOR_DEFAULT); 689 693 txtptr++; … … 755 759 * If format_fn is specified, passes it the list element value 756 760 * and it will return a string which this needs to free. */ 757 void owl_fmtext_append_list(owl_fmtext *f, const owl_list*l, const char *join_with, char *(format_fn)(const char *))758 { 759 int i , size;761 void owl_fmtext_append_list(owl_fmtext *f, const GPtrArray *l, const char *join_with, char *(format_fn)(const char *)) 762 { 763 int i; 760 764 const char *elem; 761 765 char *text; 762 766 763 size = owl_list_get_size(l); 764 for (i=0; i<size; i++) { 765 elem = owl_list_get_element(l,i); 767 for (i = 0; i < l->len; i++) { 768 elem = l->pdata[i]; 766 769 if (elem && format_fn) { 767 770 text = format_fn(elem); … … 773 776 owl_fmtext_append_normal(f, elem); 774 777 } 775 if ((i < size-1) && join_with) {778 if ((i < l->len - 1) && join_with) { 776 779 owl_fmtext_append_normal(f, join_with); 777 780 } -
functions.c
r259e60a8 r60e8617 1 #include "owl.h" 2 #include "filterproc.h" 1 3 #include <stdio.h> 2 #include <stdlib.h>3 #include <unistd.h>4 #include <signal.h>5 #include <netinet/in.h>6 #include <string.h>7 #include <time.h>8 #include <sys/types.h>9 4 #include <sys/stat.h> 10 5 #include <sys/wait.h> 11 #include <errno.h> 12 #include <signal.h> 13 #include "owl.h" 14 #include "filterproc.h" 15 16 char *owl_function_command(const char *cmdbuff) 6 7 CALLER_OWN char *owl_function_command(const char *cmdbuff) 17 8 { 18 9 owl_function_debugmsg("executing command: %s", cmdbuff); … … 21 12 } 22 13 23 char *owl_function_command_argv(const char *const *argv, int argc)14 CALLER_OWN char *owl_function_command_argv(const char *const *argv, int argc) 24 15 { 25 16 return owl_cmddict_execute_argv(owl_global_get_cmddict(&g), … … 47 38 void owl_function_show_commands(void) 48 39 { 49 owl_listl;40 GPtrArray *l; 50 41 owl_fmtext fm; 51 42 … … 53 44 owl_fmtext_append_bold(&fm, "Commands: "); 54 45 owl_fmtext_append_normal(&fm, "(use 'show command <name>' for details)\n"); 55 owl_list_create(&l); 56 owl_cmddict_get_names(owl_global_get_cmddict(&g), &l); 57 owl_fmtext_append_list(&fm, &l, "\n", owl_function_cmd_describe); 46 l = owl_cmddict_get_names(owl_global_get_cmddict(&g)); 47 owl_fmtext_append_list(&fm, l, "\n", owl_function_cmd_describe); 58 48 owl_fmtext_append_normal(&fm, "\n"); 59 49 owl_function_popless_fmtext(&fm); 60 owl_ list_cleanup(&l, g_free);50 owl_ptr_array_free(l, g_free); 61 51 owl_fmtext_cleanup(&fm); 62 52 } … … 81 71 82 72 void owl_function_show_styles(void) { 83 owl_listl;73 GPtrArray *l; 84 74 owl_fmtext fm; 85 75 86 76 owl_fmtext_init_null(&fm); 87 77 owl_fmtext_append_bold(&fm, "Styles:\n"); 88 owl_list_create(&l); 89 owl_global_get_style_names(&g, &l); 90 owl_fmtext_append_list(&fm, &l, "\n", owl_function_style_describe); 78 l = owl_global_get_style_names(&g); 79 owl_fmtext_append_list(&fm, l, "\n", owl_function_style_describe); 91 80 owl_fmtext_append_normal(&fm, "\n"); 92 81 owl_function_popless_fmtext(&fm); 93 owl_ list_cleanup(&l, g_free);82 owl_ptr_array_free(l, g_free); 94 83 owl_fmtext_cleanup(&fm); 95 84 } 96 85 97 static void _owl_function_timer_append_fmtext(gpointer data, gpointer user_data) { 98 owl_fmtext *fm = user_data; 99 owl_timer *timer = data; 100 char *str = g_strdup_printf("- %s: in %d seconds", 101 timer->name ? timer->name : "(unnamed)", 102 (int)(timer->time - time(NULL))); 103 owl_fmtext_append_normal(fm, str); 104 g_free(str); 105 if (timer->interval) { 106 str = g_strdup_printf(", repeat every %d seconds", timer->interval); 107 owl_fmtext_append_normal(fm, str); 108 g_free(str); 109 } 110 owl_fmtext_append_normal(fm, "\n"); 111 } 112 113 void owl_function_show_timers(void) { 114 owl_fmtext fm; 115 GList **timers; 116 117 owl_fmtext_init_null(&fm); 118 owl_fmtext_append_bold(&fm, "Active timers:\n"); 119 120 timers = owl_global_get_timerlist(&g); 121 g_list_foreach(*timers, _owl_function_timer_append_fmtext, &fm); 122 123 owl_function_popless_fmtext(&fm); 124 owl_fmtext_cleanup(&fm); 125 } 126 127 char *owl_function_style_describe(const char *name) { 86 CALLER_OWN char *owl_function_style_describe(const char *name) 87 { 128 88 const char *desc; 129 89 char *s; … … 141 101 } 142 102 143 char *owl_function_cmd_describe(const char *name)103 CALLER_OWN char *owl_function_cmd_describe(const char *name) 144 104 { 145 105 const owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name); … … 158 118 159 119 text="" 160 " barnowl version " OWL_VERSION_STRING "\n"120 "BarnOwl version " OWL_VERSION_STRING "\n" 161 121 "Copyright (c) 2006-2011 The BarnOwl Developers. All rights reserved.\n" 162 122 "Copyright (c) 2004 James Kretchmar. All rights reserved.\n" … … 175 135 "\n" 176 136 " * Redistributions in any form must be accompanied by information on\n" 177 " how to obtain complete source code for the Owl software and any\n"178 " accompanying software that uses the Owl software. The source code\n"137 " how to obtain complete source code for the BarnOwl software and any\n" 138 " accompanying software that uses the BarnOwl software. The source code\n" 179 139 " must either be included in the distribution or be available for no\n" 180 140 " more than the cost of distribution plus a nominal fee, and must be\n" … … 244 204 245 205 /* do followlast if necessary */ 246 if (owl_global_should_followlast(&g)) owl_function_lastmsg _noredisplay();206 if (owl_global_should_followlast(&g)) owl_function_lastmsg(); 247 207 248 208 /* redisplay etc. */ … … 256 216 void owl_function_add_outgoing_zephyrs(const owl_zwrite *z) 257 217 { 258 if (z->cc || owl_zwrite_get_numrecips(z) == 0) {218 if (z->cc && owl_zwrite_is_personal(z)) { 259 219 /* create the message */ 260 220 owl_message *m = g_new(owl_message, 1); … … 265 225 int i; 266 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 267 232 /* create the message */ 268 owl_message *m = g_new(owl_message, 1);233 m = g_new(owl_message, 1); 269 234 owl_message_create_from_zwrite(m, z, owl_zwrite_get_message(z), i); 270 235 … … 279 244 * owl_global_messagequeue_addmsg() for that. 280 245 */ 281 owl_message *owl_function_make_outgoing_aim(const char *body, const char *to)246 CALLER_OWN owl_message *owl_function_make_outgoing_aim(const char *body, const char *to) 282 247 { 283 248 owl_message *m; … … 300 265 * owl_global_messagequeue_addmsg() for that. 301 266 */ 302 owl_message *owl_function_make_outgoing_loopback(const char *body)267 CALLER_OWN owl_message *owl_function_make_outgoing_loopback(const char *body) 303 268 { 304 269 owl_message *m; … … 312 277 } 313 278 314 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) 315 280 { 316 281 owl_editwin *e; … … 326 291 g_free(s); 327 292 328 owl_editwin_set_cbdata(e, data, cleanup);329 owl_editwin_set_callback(e, callback);330 293 ctx = owl_editcontext_new(OWL_CTX_EDITMULTI, e, "editmulti", 331 294 owl_global_deactivate_editcontext, &g); 332 295 owl_global_push_context_obj(&g, ctx); 333 296 return e; 334 297 } 335 298 … … 349 312 void owl_function_zwrite_setup(owl_zwrite *z) 350 313 { 314 owl_editwin *e; 351 315 /* send a ping if necessary */ 352 316 if (owl_global_is_txping(&g)) { … … 356 320 357 321 owl_function_write_setup("zephyr"); 358 owl_function_start_edit_win(z->zwriteline,359 &owl_callback_zwrite,360 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); 361 325 } 362 326 363 327 void owl_function_aimwrite_setup(const char *to) 364 328 { 329 owl_editwin *e; 365 330 /* TODO: We probably actually want an owl_aimwrite object like 366 331 * owl_zwrite. */ 367 332 char *line = g_strdup_printf("aimwrite %s", to); 368 333 owl_function_write_setup("message"); 369 owl_function_start_edit_win(line, 370 &owl_callback_aimwrite, 371 g_strdup(to), 372 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); 373 337 g_free(line); 374 338 } … … 376 340 void owl_function_loopwrite_setup(void) 377 341 { 342 owl_editwin *e; 378 343 owl_function_write_setup("message"); 379 owl_function_start_edit_win("loopwrite", 380 &owl_callback_loopwrite, 381 NULL, NULL); 382 } 383 384 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; 385 351 owl_zwrite *z = owl_editwin_get_cbdata(e); 386 352 owl_function_zwrite(z, owl_editwin_get_text(e)); … … 412 378 owl_function_makemsg("Waiting for ack..."); 413 379 414 /* If it's personal */ 415 if (owl_zwrite_is_personal(z)) { 416 /* create the outgoing message */ 417 owl_function_add_outgoing_zephyrs(z); 418 } 380 /* create the outgoing message */ 381 owl_function_add_outgoing_zephyrs(z); 419 382 } 420 383 #else … … 441 404 old_msg = g_strdup(owl_zwrite_get_message(z)); 442 405 443 zcrypt = g_ strdup_printf("%s/zcrypt", owl_get_bindir());444 argv[0] = "zcrypt";406 zcrypt = g_build_filename(owl_get_bindir(), "zcrypt", NULL); 407 argv[0] = zcrypt; 445 408 argv[1] = "-E"; 446 409 argv[2] = "-c"; argv[3] = owl_zwrite_get_class(z); … … 448 411 argv[6] = NULL; 449 412 450 rv = call_filter( zcrypt,argv, owl_zwrite_get_message(z), &cryptmsg, &status);413 rv = call_filter(argv, owl_zwrite_get_message(z), &cryptmsg, &status); 451 414 452 415 g_free(zcrypt); … … 466 429 owl_function_makemsg("Waiting for ack..."); 467 430 468 /* If it's personal */ 469 if (owl_zwrite_is_personal(z)) { 470 /* Create the outgoing message. Restore the un-crypted message for display. */ 471 owl_zwrite_set_message_raw(z, old_msg); 472 owl_function_add_outgoing_zephyrs(z); 473 } 474 475 /* 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. */ 476 436 g_free(cryptmsg); 477 } 478 479 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; 480 443 char *to = owl_editwin_get_cbdata(e); 481 444 owl_function_aimwrite(to, owl_editwin_get_text(e), true); … … 541 504 } 542 505 543 void owl_callback_loopwrite(owl_editwin *e) { 506 void owl_callback_loopwrite(owl_editwin *e, bool success) 507 { 508 if (!success) return; 544 509 owl_function_loopwrite(owl_editwin_get_text(e)); 545 510 } … … 691 656 { 692 657 owl_function_prevmsg_full(NULL, 1, 1); 658 } 659 660 void owl_function_delete_and_expunge_message(int n) 661 { 662 owl_messagelist *ml = owl_global_get_msglist(&g); 663 owl_view *v = owl_global_get_current_view(&g); 664 int lastmsgid = owl_function_get_curmsg_id(v); 665 666 /* delete and expunge the message */ 667 owl_messagelist_delete_and_expunge_element(ml, n); 668 669 owl_function_redisplay_to_nearest(lastmsgid, v); 670 } 671 672 void owl_function_delete_and_expunge_cur(bool exclaim_success) 673 { 674 int curmsg; 675 const owl_view *v = owl_global_get_current_view(&g); 676 677 /* bail if there's no current message */ 678 if (owl_view_get_size(v) < 1) { 679 owl_function_error("No current message to delete"); 680 return; 681 } 682 683 /* delete the current message */ 684 curmsg = owl_global_get_curmsg(&g); 685 owl_function_delete_and_expunge_message(curmsg); 686 if (exclaim_success) 687 owl_function_makemsg("Message deleted and expunged"); 693 688 } 694 689 … … 752 747 } 753 748 749 /* returns the current message id, if it exists. Otherwise returns 750 * -1 if we are past the end of the message list, and 0 otherwise. */ 751 int owl_function_get_curmsg_id(const owl_view *v) 752 { 753 int curmsg = owl_global_get_curmsg(&g); 754 const owl_message *m = owl_view_get_element(v, curmsg); 755 if (m) 756 return owl_message_get_id(m); 757 if (curmsg > 0) /* past the end of the message list (probably) */ 758 return -1; 759 return 0; 760 } 761 762 /* redisplays the view to the nearest message to the id given. 763 * if msgid < 0, redisplay to past the end of the message list */ 764 void owl_function_redisplay_to_nearest(int msgid, owl_view *v) 765 { 766 int curmsg; 767 /* update all views (we only have one right now) */ 768 owl_view_recalculate(v); 769 770 /* find where the new position should be */ 771 if (msgid < 0) { 772 /* If already at the end, blank the screen and move curmsg 773 * past the end of the messages. */ 774 curmsg = owl_view_get_size(v); 775 owl_global_set_topmsg(&g, curmsg); 776 owl_global_set_curmsg(&g, curmsg); 777 } else { 778 curmsg = owl_view_get_nearest_to_msgid(v, msgid); 779 if (curmsg > owl_view_get_size(v) - 1) 780 curmsg = owl_view_get_size(v) - 1; 781 if (curmsg < 0) 782 curmsg = 0; 783 owl_global_set_curmsg(&g, curmsg); 784 owl_function_calculate_topmsg(OWL_DIRECTION_NONE); 785 } 786 /* if there are no messages set the direction to down in case we 787 * delete everything upwards */ 788 owl_global_set_direction_downwards(&g); 789 790 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 791 } 792 754 793 void owl_function_expunge(void) 755 794 { 756 int curmsg; 757 const owl_message *m; 758 owl_messagelist *ml; 759 owl_view *v; 760 int lastmsgid=0; 761 762 curmsg=owl_global_get_curmsg(&g); 763 v=owl_global_get_current_view(&g); 764 ml=owl_global_get_msglist(&g); 765 766 m=owl_view_get_element(v, curmsg); 767 if (m) lastmsgid = owl_message_get_id(m); 795 owl_messagelist *ml = owl_global_get_msglist(&g); 796 owl_view *v = owl_global_get_current_view(&g); 797 int lastmsgid = owl_function_get_curmsg_id(v); 768 798 769 799 /* expunge the message list */ 770 800 owl_messagelist_expunge(ml); 771 801 772 /* update all views (we only have one right now) */ 773 owl_view_recalculate(v); 774 775 /* find where the new position should be 776 (as close as possible to where we last where) */ 777 curmsg = owl_view_get_nearest_to_msgid(v, lastmsgid); 778 if (curmsg>owl_view_get_size(v)-1) curmsg = owl_view_get_size(v)-1; 779 if (curmsg<0) curmsg = 0; 780 owl_global_set_curmsg(&g, curmsg); 781 owl_function_calculate_topmsg(OWL_DIRECTION_NONE); 782 /* if there are no messages set the direction to down in case we 783 delete everything upwards */ 784 owl_global_set_direction_downwards(&g); 802 owl_function_redisplay_to_nearest(lastmsgid, v); 785 803 786 804 owl_function_makemsg("Messages expunged"); 787 owl_mainwin_redisplay(owl_global_get_mainwin(&g));788 805 } 789 806 … … 796 813 } 797 814 798 void owl_function_lastmsg _noredisplay(void)815 void owl_function_lastmsg(void) 799 816 { 800 817 int oldcurmsg, curmsg; … … 814 831 owl_global_set_curmsg(&g, curmsg+1); 815 832 } 816 /* owl_mainwin_redisplay(owl_global_get_mainwin(&g)); */833 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 817 834 owl_global_set_direction_downwards(&g); 818 }819 820 void owl_function_lastmsg(void)821 {822 owl_function_lastmsg_noredisplay();823 owl_mainwin_redisplay(owl_global_get_mainwin(&g));824 835 } 825 836 … … 844 855 void owl_function_unsuball(void) 845 856 { 846 unsuball();847 owl_function_makemsg("Unsubscribed from all messages.");857 if (unsuball()) 858 owl_function_makemsg("Unsubscribed from all messages."); 848 859 } 849 860 … … 860 871 void owl_function_loadsubs(const char *file) 861 872 { 862 int ret, ret2; 863 const char *foo; 873 int ret, ret2, ret3; 864 874 char *path; 865 875 … … 873 883 874 884 /* for backwards compatibility for now */ 875 ret2=owl_zephyr_loaddefaultsubs(); 885 ret2 = owl_zephyr_loaddefaultsubs(); 886 ret3 = owl_zephyr_loadbarnowldefaultsubs(); 876 887 877 888 if (!owl_context_is_interactive(owl_global_get_context(&g))) return; 878 889 879 foo=file?file:"file"; 880 if (ret==0 && ret2==0) { 890 if (ret == 0 && ret2 == 0 && ret3 == 0) { 881 891 if (!file) { 882 892 owl_function_makemsg("Subscribed to messages."); … … 884 894 owl_function_makemsg("Subscribed to messages from %s", file); 885 895 } 886 } else if (ret ==-1) {887 owl_function_error("Could not read %s", f oo);888 } else {896 } else if (ret == -1) { 897 owl_function_error("Could not read %s", file ? file : "file"); 898 } else if (ret2 == -1) { 889 899 owl_function_error("Error subscribing to messages"); 900 } else { 901 owl_function_error("Error subscribing to instanced personals"); 890 902 } 891 903 } … … 906 918 } 907 919 908 void owl_callback_aimlogin(owl_editwin *e) { 920 void owl_callback_aimlogin(owl_editwin *e, bool success) 921 { 922 if (!success) return; 909 923 char *user = owl_editwin_get_cbdata(e); 910 924 owl_function_aimlogin(user, … … 1003 1017 } 1004 1018 1005 owl_function_debugmsg("Quitting Owl");1019 owl_function_debugmsg("Quitting BarnOwl"); 1006 1020 owl_select_quit_loop(); 1007 1021 } … … 1202 1216 void G_GNUC_PRINTF(1, 2) owl_function_debugmsg(const char *fmt, ...) 1203 1217 { 1218 char *tmpbuff; 1204 1219 FILE *file; 1205 1220 time_t now; … … 1216 1231 now = time(NULL); 1217 1232 1218 fprintf(file, "[%d - %.24s - %lds]: ", 1219 (int) getpid(), ctime(&now), now - owl_global_get_starttime(&g)); 1233 tmpbuff = owl_util_format_time(localtime(&now)); 1234 fprintf(file, "[%d - %s - %lds]: ", 1235 (int) getpid(), tmpbuff, now - owl_global_get_starttime(&g)); 1236 g_free(tmpbuff); 1220 1237 vfprintf(file, fmt, ap); 1221 1238 putc('\n', file); … … 1257 1274 } 1258 1275 1259 static void _dirty_everything(owl_window *w) { 1276 static void _dirty_everything(gpointer data, gpointer user_data) { 1277 owl_window *w = data; 1260 1278 if (!owl_window_is_realized(w)) 1261 1279 return; 1262 1280 owl_window_dirty(w); 1263 owl_window_children_foreach(w, (GFunc)_dirty_everything, NULL);1281 owl_window_children_foreach(w, _dirty_everything, NULL); 1264 1282 } 1265 1283 … … 1267 1285 { 1268 1286 /* Ask every widget to redraw itself. */ 1269 _dirty_everything(owl_window_get_screen() );1287 _dirty_everything(owl_window_get_screen(), NULL); 1270 1288 /* Force ncurses to redisplay everything. */ 1271 1289 clearok(stdscr, TRUE); … … 1335 1353 { 1336 1354 owl_function_popless_text( 1337 "This is barnowl version " OWL_VERSION_STRING ".\n\n"1338 " barnowl is a fork of the Owl zephyr client, written and\n"1355 "This is BarnOwl version " OWL_VERSION_STRING ".\n\n" 1356 "BarnOwl is a fork of the Owl zephyr client, written and\n" 1339 1357 "maintained by Alejandro Sedeno and Nelson Elhage at the\n" 1340 1358 "Massachusetts Institute of Technology. \n" … … 1345 1363 "The name 'owl' was chosen in reference to the owls in the\n" 1346 1364 "Harry Potter novels, who are tasked with carrying messages\n" 1347 "between Witches and Wizards. The name ' barnowl' was chosen\n"1365 "between Witches and Wizards. The name 'BarnOwl' was chosen\n" 1348 1366 "because we feel our owls should live closer to our ponies.\n" 1349 1367 "\n" … … 1363 1381 owl_fmtext fm, attrfm; 1364 1382 const owl_view *v; 1383 char *time; 1365 1384 #ifdef HAVE_LIBZEPHYR 1366 1385 const ZNotice_t *n; … … 1393 1412 } 1394 1413 1395 owl_fmtext_appendf_normal(&fm, " Time : %s\n", owl_message_get_timestr(m)); 1414 time = owl_message_format_time(m); 1415 owl_fmtext_appendf_normal(&fm, " Time : %s\n", time); 1416 g_free(time); 1396 1417 1397 1418 if (!owl_message_is_type_admin(m)) { … … 1407 1428 owl_fmtext_appendf_normal(&fm, " Opcode : %s\n", owl_message_get_opcode(m)); 1408 1429 #ifdef HAVE_LIBZEPHYR 1409 if (owl_message_is_direction_in(m)) { 1410 char *tmpbuff; 1430 n = owl_message_get_notice(m); 1431 if (n != NULL) { 1432 char *tmpbuff, *tmpbuff2; 1411 1433 int i, fields; 1412 1413 n=owl_message_get_notice(m); 1434 const char *f; 1414 1435 1415 1436 if (!owl_message_is_pseudo(m)) { … … 1453 1474 owl_fmtext_appendf_normal(&fm, " Fields : %i\n", fields); 1454 1475 1455 for (i = 0; i < fields; i++) { 1456 tmpbuff = owl_zephyr_get_field_as_utf8(n, i + 1); 1457 1458 g_strdelimit(tmpbuff, "\n", '~'); 1459 g_strdelimit(tmpbuff, "\r", '!'); 1460 1461 owl_fmtext_appendf_normal(&fm, " Field %i : %s\n", i + 1, tmpbuff); 1462 g_free(tmpbuff); 1476 for (i = 0, f = owl_zephyr_first_raw_field(n); f != NULL; 1477 i++, f = owl_zephyr_next_raw_field(n, f)) { 1478 tmpbuff = owl_zephyr_field_as_utf8(n, f); 1479 tmpbuff2 = owl_text_indent(tmpbuff, 14, false); 1480 owl_fmtext_appendf_normal(&fm, " Field %i : %s\n", i + 1, tmpbuff2); 1481 g_free(tmpbuff2); 1482 g_free(tmpbuff); 1463 1483 } 1464 owl_fmtext_appendf_normal(&fm, " Default Fm: %s\n", n->z_default_format); 1484 tmpbuff = owl_text_indent(n->z_default_format, 14, false); 1485 owl_fmtext_appendf_normal(&fm, " Default Fm: %s\n", tmpbuff); 1486 g_free(tmpbuff); 1465 1487 } 1466 1488 … … 1469 1491 } 1470 1492 1471 owl_fmtext_append_bold(&fm, "\n Owl Message Attributes:\n");1493 owl_fmtext_append_bold(&fm, "\nBarnOwl Message Attributes:\n"); 1472 1494 owl_message_attributes_tofmtext(m, &attrfm); 1473 1495 owl_fmtext_append_fmtext(&fm, &attrfm); … … 1602 1624 void owl_function_printallvars(void) 1603 1625 { 1626 const owl_variable *v; 1604 1627 const char *name; 1605 1628 char *var; 1606 owl_listvarnames;1607 int i , numvarnames;1629 GPtrArray *varnames; 1630 int i; 1608 1631 GString *str = g_string_new(""); 1609 1632 1610 1633 g_string_append_printf(str, "%-20s = %s\n", "VARIABLE", "VALUE"); 1611 1634 g_string_append_printf(str, "%-20s %s\n", "--------", "-----"); 1612 owl_list_create(&varnames); 1613 owl_variable_dict_get_names(owl_global_get_vardict(&g), &varnames); 1614 numvarnames = owl_list_get_size(&varnames); 1615 for (i=0; i<numvarnames; i++) { 1616 name = owl_list_get_element(&varnames, i); 1635 varnames = owl_variable_dict_get_names(owl_global_get_vardict(&g)); 1636 for (i = 0; i < varnames->len; i++) { 1637 name = varnames->pdata[i]; 1617 1638 if (name && name[0]!='_') { 1618 1639 g_string_append_printf(str, "\n%-20s = ", name); 1619 var = owl_variable_get_tostring(owl_global_get_vardict(&g), name); 1640 v = owl_variable_get_var(owl_global_get_vardict(&g), name); 1641 var = owl_variable_get_tostring(v); 1620 1642 if (var) { 1621 g_string_append(str, var); 1622 g_free(var); 1643 g_string_append(str, var); 1644 g_free(var); 1645 } else { 1646 g_string_append(str, "<null>"); 1623 1647 } 1624 1648 } 1625 1649 } 1626 1650 g_string_append(str, "\n"); 1627 owl_ list_cleanup(&varnames, g_free);1651 owl_ptr_array_free(varnames, g_free); 1628 1652 1629 1653 owl_function_popless_text(str->str); … … 1633 1657 void owl_function_show_variables(void) 1634 1658 { 1635 owl_list varnames; 1659 const owl_variable *v; 1660 GPtrArray *varnames; 1636 1661 owl_fmtext fm; 1637 int i , numvarnames;1662 int i; 1638 1663 const char *varname; 1639 1664 … … 1641 1666 owl_fmtext_append_bold(&fm, 1642 1667 "Variables: (use 'show variable <name>' for details)\n"); 1643 owl_list_create(&varnames); 1644 owl_variable_dict_get_names(owl_global_get_vardict(&g), &varnames); 1645 numvarnames = owl_list_get_size(&varnames); 1646 for (i=0; i<numvarnames; i++) { 1647 varname = owl_list_get_element(&varnames, i); 1668 varnames = owl_variable_dict_get_names(owl_global_get_vardict(&g)); 1669 for (i = 0; i < varnames->len; i++) { 1670 varname = varnames->pdata[i]; 1648 1671 if (varname && varname[0]!='_') { 1649 owl_variable_describe(owl_global_get_vardict(&g), varname, &fm); 1650 } 1651 } 1652 owl_list_cleanup(&varnames, g_free); 1672 v = owl_variable_get_var(owl_global_get_vardict(&g), varname); 1673 owl_variable_describe(v, &fm); 1674 } 1675 } 1676 owl_ptr_array_free(varnames, g_free); 1653 1677 owl_function_popless_fmtext(&fm); 1654 1678 owl_fmtext_cleanup(&fm); … … 1657 1681 void owl_function_show_variable(const char *name) 1658 1682 { 1683 const owl_variable *v; 1659 1684 owl_fmtext fm; 1660 1685 1661 1686 owl_fmtext_init_null(&fm); 1662 owl_variable_get_help(owl_global_get_vardict(&g), name, &fm); 1687 v = owl_variable_get_var(owl_global_get_vardict(&g), name); 1688 if (v) 1689 owl_variable_get_help(v, &fm); 1690 else 1691 owl_fmtext_append_normal(&fm, "No such variable...\n"); 1663 1692 owl_function_popless_fmtext(&fm); 1664 1693 owl_fmtext_cleanup(&fm); 1694 } 1695 1696 void owl_function_delete_and_expunge_by_id(int id, bool exclaim_success) 1697 { 1698 const owl_messagelist *ml = owl_global_get_msglist(&g); 1699 int msg = owl_messagelist_get_index_by_id(ml, id); 1700 if (msg < 0) { 1701 owl_function_error("No message with id %d: unable to delete", id); 1702 } else { 1703 owl_function_delete_and_expunge_message(msg); 1704 if (exclaim_success) 1705 owl_function_makemsg("Message deleted and expunged"); 1706 } 1665 1707 } 1666 1708 … … 1719 1761 void owl_function_status(void) 1720 1762 { 1763 char *tmpbuff; 1721 1764 char buff[MAXPATHLEN+1]; 1722 1765 time_t start; … … 1746 1789 owl_fmtext_append_normal(&fm, "\n"); 1747 1790 1748 owl_fmtext_appendf_normal(&fm, " Startup Time: %s", ctime(&start)); 1791 tmpbuff = owl_util_format_time(localtime(&start)); 1792 owl_fmtext_appendf_normal(&fm, " Startup Time: %s\n", tmpbuff); 1793 g_free(tmpbuff); 1749 1794 1750 1795 up=owl_global_get_runtime(&g); … … 1869 1914 if (enter) { 1870 1915 owl_history *hist = owl_global_get_cmd_history(&g); 1871 owl_history_store(hist, buff); 1872 owl_history_reset(hist); 1916 owl_history_store(hist, buff, false); 1873 1917 owl_function_command_norv(buff); 1874 1918 } else { … … 1900 1944 } 1901 1945 1902 void owl_callback_command(owl_editwin *e) 1903 { 1946 void owl_callback_command(owl_editwin *e, bool success) 1947 { 1948 if (!success) return; 1904 1949 char *rv; 1905 1950 const char *line = owl_editwin_get_text(e); … … 1912 1957 } 1913 1958 1914 voidowl_function_start_command(const char *line)1959 owl_editwin *owl_function_start_command(const char *line) 1915 1960 { 1916 1961 owl_editwin *tw; … … 1927 1972 owl_global_push_context_obj(&g, ctx); 1928 1973 owl_editwin_set_callback(tw, owl_callback_command); 1974 return tw; 1929 1975 } 1930 1976 … … 1961 2007 } 1962 2008 1963 char *owl_function_exec(int argc, const char *const *argv, const char *buff, int type)2009 CALLER_OWN char *owl_function_exec(int argc, const char *const *argv, const char *buff, int type) 1964 2010 { 1965 2011 /* if type == 1 display in a popup … … 2004 2050 } 2005 2051 2006 char *owl_function_perl(int argc, const char *const *argv, const char *buff, int type)2052 CALLER_OWN char *owl_function_perl(int argc, const char *const *argv, const char *buff, int type) 2007 2053 { 2008 2054 /* if type == 1 display in a popup … … 2085 2131 2086 2132 /* Create a new filter, or replace an existing one 2087 * with a new definition. 2133 * with a new definition. Returns true on success. 2088 2134 */ 2089 voidowl_function_create_filter(int argc, const char *const *argv)2135 bool owl_function_create_filter(int argc, const char *const *argv) 2090 2136 { 2091 2137 owl_filter *f; … … 2095 2141 if (argc < 2) { 2096 2142 owl_function_error("Wrong number of arguments to filter command"); 2097 return ;2143 return false; 2098 2144 } 2099 2145 … … 2105 2151 if (!strcmp(argv[1], "all")) { 2106 2152 owl_function_error("You may not change the 'all' filter."); 2107 return ;2153 return false; 2108 2154 } 2109 2155 … … 2113 2159 if (!f) { 2114 2160 owl_function_error("The filter '%s' does not exist.", argv[1]); 2115 return ;2161 return false; 2116 2162 } 2117 2163 if (owl_util_string_to_color(argv[3])==OWL_COLOR_INVALID) { 2118 2164 owl_function_error("The color '%s' is not available.", argv[3]); 2119 return ;2165 return false; 2120 2166 } 2121 2167 owl_filter_set_fgcolor(f, owl_util_string_to_color(argv[3])); 2122 2168 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 2123 return ;2169 return false; 2124 2170 } 2125 2171 if (argc==4 && !strcmp(argv[2], "-b")) { … … 2127 2173 if (!f) { 2128 2174 owl_function_error("The filter '%s' does not exist.", argv[1]); 2129 return ;2175 return false; 2130 2176 } 2131 2177 if (owl_util_string_to_color(argv[3])==OWL_COLOR_INVALID) { 2132 2178 owl_function_error("The color '%s' is not available.", argv[3]); 2133 return ;2179 return false; 2134 2180 } 2135 2181 owl_filter_set_bgcolor(f, owl_util_string_to_color(argv[3])); 2136 2182 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 2137 return ;2183 return true; 2138 2184 } 2139 2185 … … 2141 2187 f = owl_filter_new(argv[1], argc-2, argv+2); 2142 2188 if (f == NULL) { 2143 owl_function_error("Invalid filter ");2144 return ;2189 owl_function_error("Invalid filter: %s", argv[1]); 2190 return false; 2145 2191 } 2146 2192 … … 2163 2209 } 2164 2210 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 2211 return true; 2165 2212 } 2166 2213 … … 2174 2221 * Returns the name of the negated filter, which the caller must free. 2175 2222 */ 2176 char *owl_function_create_negative_filter(const char *filtername)2223 CALLER_OWN char *owl_function_create_negative_filter(const char *filtername) 2177 2224 { 2178 2225 char *newname; … … 2244 2291 { 2245 2292 const owl_filter *f; 2246 const owl_list*fl;2293 const GPtrArray *fl; 2247 2294 char *tmp; 2248 2295 owl_fmtext fm; 2249 int i , j;2296 int i; 2250 2297 2251 2298 owl_fmtext_init_null(&fm); 2252 2299 2253 2300 fl=owl_global_get_puntlist(&g); 2254 j=owl_list_get_size(fl);2255 2301 owl_fmtext_append_bold(&fm, "Active zpunt filters:\n"); 2256 2302 2257 for (i =0; i<j; i++) {2258 f =owl_list_get_element(fl, i);2303 for (i = 0; i < fl->len; i++) { 2304 f = fl->pdata[i]; 2259 2305 owl_fmtext_appendf_normal(&fm, "[% 2d] ", i+1); 2260 2306 tmp = owl_filter_print(f); … … 2271 2317 * If 'related' is nonzero, encompass unclasses and .d classes as well. 2272 2318 */ 2273 char *owl_function_classinstfilt(const char *c, const char *i, int related)2319 CALLER_OWN char *owl_function_classinstfilt(const char *c, const char *i, int related) 2274 2320 { 2275 2321 owl_filter *f; … … 2358 2404 * the filter, which the caller must free. 2359 2405 */ 2360 char *owl_function_zuserfilt(const char *longuser)2406 CALLER_OWN char *owl_function_zuserfilt(const char *longuser) 2361 2407 { 2362 2408 owl_filter *f; … … 2404 2450 * Returns the name of the filter, which the caller must free. 2405 2451 */ 2406 char *owl_function_aimuserfilt(const char *user)2452 CALLER_OWN char *owl_function_aimuserfilt(const char *user) 2407 2453 { 2408 2454 owl_filter *f; … … 2415 2461 /* if it already exists then go with it. This lets users override */ 2416 2462 if (owl_global_get_filter(&g, filtname)) { 2417 return (g_strdup(filtname));2463 return filtname; 2418 2464 } 2419 2465 … … 2442 2488 } 2443 2489 2444 char *owl_function_typefilt(const char *type)2490 CALLER_OWN char *owl_function_typefilt(const char *type) 2445 2491 { 2446 2492 owl_filter *f; … … 2498 2544 } 2499 2545 2500 static char *owl_function_smartfilter_cc(const owl_message *m) { 2546 static CALLER_OWN char *owl_function_smartfilter_cc(const owl_message *m) 2547 { 2501 2548 const char *ccs; 2502 2549 char *ccs_quoted; … … 2549 2596 * name to the AIM conversation with that user 2550 2597 */ 2551 char *owl_function_smartfilter(int type, int invert_related)2598 CALLER_OWN char *owl_function_smartfilter(int type, int invert_related) 2552 2599 { 2553 2600 const owl_view *v; … … 2808 2855 2809 2856 owl_function_punt(argv->len, (const char *const*) argv->pdata, direction); 2810 g_ptr_array_foreach(argv, (GFunc)g_free, NULL); 2811 g_ptr_array_free(argv, true); 2857 owl_ptr_array_free(argv, g_free); 2812 2858 } 2813 2859 … … 2815 2861 { 2816 2862 owl_filter *f; 2817 owl_list*fl;2818 int i , j;2863 GPtrArray *fl; 2864 int i; 2819 2865 fl=owl_global_get_puntlist(&g); 2820 2866 … … 2827 2873 2828 2874 /* Check for an identical filter */ 2829 j=owl_list_get_size(fl); 2830 for (i=0; i<j; i++) { 2831 if (owl_filter_equiv(f, owl_list_get_element(fl, i))) { 2875 for (i = 0; i < fl->len; i++) { 2876 if (owl_filter_equiv(f, fl->pdata[i])) { 2832 2877 owl_function_debugmsg("found an equivalent punt filter"); 2833 2878 /* if we're punting, then just silently bow out on this duplicate */ … … 2839 2884 /* if we're unpunting, then remove this filter from the puntlist */ 2840 2885 if (direction==1) { 2841 owl_filter_delete(owl_list_get_element(fl, i)); 2842 owl_list_remove_element(fl, i); 2886 owl_filter_delete(g_ptr_array_remove_index(fl, i)); 2843 2887 owl_filter_delete(f); 2844 2888 return; … … 2850 2894 owl_function_debugmsg("punting"); 2851 2895 /* If we're punting, add the filter to the global punt list */ 2852 owl_list_append_element(fl, f);2896 g_ptr_array_add(fl, f); 2853 2897 } else if (direction == 1) { 2854 2898 owl_function_makemsg("No matching punt filter"); … … 2858 2902 void owl_function_show_keymaps(void) 2859 2903 { 2860 owl_listl;2904 GPtrArray *l; 2861 2905 owl_fmtext fm; 2862 2906 const owl_keymap *km; 2863 2907 const owl_keyhandler *kh; 2864 int i , numkm;2908 int i; 2865 2909 const char *kmname; 2866 2910 … … 2869 2913 owl_fmtext_append_bold(&fm, "Keymaps: "); 2870 2914 owl_fmtext_append_normal(&fm, "(use 'show keymap <name>' for details)\n"); 2871 owl_list_create(&l); 2872 owl_keyhandler_get_keymap_names(kh, &l); 2873 owl_fmtext_append_list(&fm, &l, "\n", owl_function_keymap_summary); 2915 l = owl_keyhandler_get_keymap_names(kh); 2916 owl_fmtext_append_list(&fm, l, "\n", owl_function_keymap_summary); 2874 2917 owl_fmtext_append_normal(&fm, "\n"); 2875 2918 2876 numkm = owl_list_get_size(&l); 2877 for (i=0; i<numkm; i++) { 2878 kmname = owl_list_get_element(&l, i); 2919 for (i = 0; i < l->len; i++) { 2920 kmname = l->pdata[i]; 2879 2921 km = owl_keyhandler_get_keymap(kh, kmname); 2880 2922 owl_fmtext_append_bold(&fm, "\n\n----------------------------------------------------------------------------------------------------\n\n"); … … 2884 2926 2885 2927 owl_function_popless_fmtext(&fm); 2886 owl_ list_cleanup(&l, g_free);2928 owl_ptr_array_free(l, g_free); 2887 2929 owl_fmtext_cleanup(&fm); 2888 2930 } 2889 2931 2890 char *owl_function_keymap_summary(const char *name)2932 CALLER_OWN char *owl_function_keymap_summary(const char *name) 2891 2933 { 2892 2934 const owl_keymap *km … … 3002 3044 /* strips formatting from ztext and returns the unformatted text. 3003 3045 * caller is responsible for freeing. */ 3004 char *owl_function_ztext_stylestrip(const char *zt)3046 CALLER_OWN char *owl_function_ztext_stylestrip(const char *zt) 3005 3047 { 3006 3048 owl_fmtext fm; … … 3025 3067 #ifdef HAVE_LIBZEPHYR 3026 3068 int x; 3027 owl_listanyone;3069 GPtrArray *anyone; 3028 3070 const char *user; 3029 3071 char *tmp; … … 3045 3087 idle=owl_buddy_get_idle_time(b); 3046 3088 if (idle!=0) { 3047 timestr=owl_util_ minutes_to_timestr(idle);3089 timestr=owl_util_format_minutes(idle); 3048 3090 } else { 3049 3091 timestr=g_strdup(""); … … 3060 3102 } else { 3061 3103 owl_fmtext_append_bold(&fm, "Zephyr users logged in:\n"); 3062 owl_list_create(&anyone); 3063 ret=owl_zephyr_get_anyone_list(&anyone, filename); 3064 if (ret) { 3104 anyone = owl_zephyr_get_anyone_list(filename); 3105 if (anyone == NULL) { 3065 3106 if (errno == ENOENT) { 3066 3107 owl_fmtext_append_normal(&fm, " You have not added any zephyr buddies. Use the\n"); … … 3072 3113 } 3073 3114 } else { 3074 j=owl_list_get_size(&anyone); 3075 for (i=0; i<j; i++) { 3076 user=owl_list_get_element(&anyone, i); 3115 for (i = 0; i < anyone->len; i++) { 3116 user = anyone->pdata[i]; 3077 3117 ret=ZLocateUser(zstr(user), &numlocs, ZAUTH); 3078 3118 … … 3106 3146 } 3107 3147 } 3108 owl_ list_cleanup(&anyone, g_free);3148 owl_ptr_array_free(anyone, g_free); 3109 3149 } 3110 3150 } … … 3183 3223 } 3184 3224 3185 /* if it exited, fork & execa new one */3225 /* if it exited, spawn a new one */ 3186 3226 if (owl_global_get_newmsgproc_pid(&g)==0) { 3187 pid_t i;3188 3227 int myargc; 3189 i=fork(); 3190 if (i) { 3191 /* parent set the child's pid */ 3192 owl_global_set_newmsgproc_pid(&g, i); 3193 owl_function_debugmsg("I'm the parent and I started a new newmsgproc with pid %i", i); 3194 } else { 3195 /* child exec's the program */ 3196 char **parsed; 3197 parsed=owl_parseline(owl_global_get_newmsgproc(&g), &myargc); 3198 if (myargc < 0) { 3199 owl_function_debugmsg("Could not parse newmsgproc '%s': unbalanced quotes?", owl_global_get_newmsgproc(&g)); 3200 } 3201 if (myargc <= 0) { 3202 _exit(127); 3203 } 3204 owl_function_debugmsg("About to exec \"%s\" with %d arguments", parsed[0], myargc); 3205 3206 execvp(parsed[0], parsed); 3207 3208 3209 /* was there an error exec'ing? */ 3210 owl_function_debugmsg("Cannot run newmsgproc '%s': cannot exec '%s': %s", 3211 owl_global_get_newmsgproc(&g), parsed[0], strerror(errno)); 3212 _exit(127); 3228 char **argv = owl_parseline(owl_global_get_newmsgproc(&g), &myargc); 3229 if (myargc < 0) { 3230 owl_function_debugmsg("Could not parse newmsgproc '%s': unbalanced quotes?", 3231 owl_global_get_newmsgproc(&g)); 3232 } else if (myargc > 0) { 3233 /* Spawn the child. */ 3234 GPid pid; 3235 GError *error = NULL; 3236 owl_function_debugmsg("About to exec \"%s\" with %d arguments", argv[0], myargc); 3237 if (g_spawn_async(NULL, argv, NULL, 3238 G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, 3239 NULL, NULL, &pid, &error)) { 3240 owl_global_set_newmsgproc_pid(&g, pid); 3241 owl_function_debugmsg("I'm the parent and I started a new newmsgproc with pid %i", pid); 3242 } else { 3243 owl_function_debugmsg("Cannot run newmsgproc '%s': %s", 3244 owl_global_get_newmsgproc(&g), error->message); 3245 g_error_free(error); 3246 } 3213 3247 } 3248 g_strfreev(argv); 3214 3249 } 3215 3250 } … … 3380 3415 char *buff; 3381 3416 3382 now=time(NULL); 3383 date=g_strdup(ctime(&now)); 3384 date[strlen(date)-1]='\0'; 3417 now = time(NULL); 3418 date = owl_util_format_time(localtime(&now)); 3385 3419 3386 3420 buff = g_strdup_printf("%s %s", date, string); … … 3423 3457 { 3424 3458 #ifdef HAVE_LIBZEPHYR 3425 int i , j;3426 owl_listanyone;3459 int i; 3460 GPtrArray *anyone; 3427 3461 GList **zaldlist; 3428 3462 GList *zaldptr; … … 3444 3478 *zaldlist = NULL; 3445 3479 3446 owl_list_create(&anyone); 3447 owl_zephyr_get_anyone_list(&anyone, NULL); 3448 j = owl_list_get_size(&anyone); 3449 for (i = 0; i < j; i++) { 3450 user = owl_list_get_element(&anyone, i); 3451 zald = g_new(ZAsyncLocateData_t, 1); 3452 if (ZRequestLocations(zstr(user), zald, UNACKED, ZAUTH) == ZERR_NONE) { 3453 *zaldlist = g_list_append(*zaldlist, zald); 3454 } else { 3455 g_free(zald); 3456 } 3457 } 3458 3459 owl_list_cleanup(&anyone, g_free); 3480 anyone = owl_zephyr_get_anyone_list(NULL); 3481 if (anyone != NULL) { 3482 for (i = 0; i < anyone->len; i++) { 3483 user = anyone->pdata[i]; 3484 zald = g_new(ZAsyncLocateData_t, 1); 3485 if (ZRequestLocations(zstr(user), zald, UNACKED, ZAUTH) == ZERR_NONE) { 3486 *zaldlist = g_list_append(*zaldlist, zald); 3487 } else { 3488 g_free(zald); 3489 } 3490 } 3491 owl_ptr_array_free(anyone, g_free); 3492 } 3460 3493 #endif 3461 3494 } 3462 3495 3463 void owl_function_aimsearch_results(const char *email, owl_list*namelist)3496 void owl_function_aimsearch_results(const char *email, GPtrArray *namelist) 3464 3497 { 3465 3498 owl_fmtext fm; 3466 int i , j;3499 int i; 3467 3500 3468 3501 owl_fmtext_init_null(&fm); … … 3471 3504 owl_fmtext_append_normal(&fm, ":\n"); 3472 3505 3473 j=owl_list_get_size(namelist); 3474 for (i=0; i<j; i++) { 3506 for (i = 0; i < namelist->len; i++) { 3475 3507 owl_fmtext_append_normal(&fm, " "); 3476 owl_fmtext_append_normal(&fm, owl_list_get_element(namelist, i));3508 owl_fmtext_append_normal(&fm, namelist->pdata[i]); 3477 3509 owl_fmtext_append_normal(&fm, "\n"); 3478 3510 } -
global.c
rdc1edbd r6383920 1 #include "owl.h" 1 2 #include <stdio.h> 2 #include <unistd.h>3 #include <stdlib.h>4 #include <string.h>5 #include <netdb.h>6 #include <termios.h>7 3 #include <sys/ioctl.h> 8 #include <time.h>9 #include "owl.h"10 4 11 5 static void _owl_global_init_windows(owl_global *g); … … 15 9 const char *homedir; 16 10 11 #if !GLIB_CHECK_VERSION(2, 35, 0) 17 12 g_type_init(); 13 #endif 14 #if !GLIB_CHECK_VERSION(2, 31, 0) 18 15 g_thread_init(NULL); 16 #endif 19 17 20 18 owl_select_init(); … … 47 45 owl_dict_create(&(g->filters)); 48 46 g->filterlist = NULL; 49 owl_list_create(&(g->puntlist));47 g->puntlist = g_ptr_array_new(); 50 48 g->messagequeue = g_queue_new(); 51 49 owl_dict_create(&(g->styledict)); … … 53 51 g->resizepending=0; 54 52 g->direction=OWL_DIRECTION_DOWNWARDS; 55 g->zaway=0;56 53 owl_fmtext_init_colorpair_mgr(&(g->cpmgr)); 57 54 g->debug=OWL_DEBUG; … … 65 62 owl_history_init(&(g->msghist)); 66 63 owl_history_init(&(g->cmdhist)); 67 owl_history_set_norepeats(&(g->cmdhist));68 64 g->nextmsgid=0; 69 65 … … 79 75 g->confdir = NULL; 80 76 g->startupfile = NULL; 81 cd = g_ strdup_printf("%s/%s", g->homedir, OWL_CONFIG_DIR);77 cd = g_build_filename(g->homedir, OWL_CONFIG_DIR, NULL); 82 78 owl_global_set_confdir(g, cd); 83 79 g_free(cd); 84 80 85 owl_messagelist_create(&(g->msglist));81 g->msglist = owl_messagelist_new(); 86 82 87 83 _owl_global_init_windows(g); … … 105 101 106 102 owl_message_init_fmtext_cache(); 107 owl_list_create(&(g->io_dispatch_list));108 g->timerlist = NULL;109 103 g->kill_buffer = NULL; 110 104 111 105 g->interrupt_count = 0; 106 #if GLIB_CHECK_VERSION(2, 31, 0) 107 g_mutex_init(&g->interrupt_lock); 108 #else 112 109 g->interrupt_lock = g_mutex_new(); 110 #endif 113 111 } 114 112 … … 119 117 120 118 /* Create the widgets */ 121 owl_mainwin_init(&(g->mw),g->mainpanel.recwin);119 g->mw = owl_mainwin_new(g->mainpanel.recwin); 122 120 owl_msgwin_init(&(g->msgwin), g->mainpanel.msgwin); 123 121 owl_sepbar_init(g->mainpanel.sepwin); … … 175 173 /* Pops the current context from the context stack and returns it. Caller is 176 174 * responsible for freeing. */ 177 owl_context *owl_global_pop_context_no_delete(owl_global *g) { 175 CALLER_OWN owl_context *owl_global_pop_context_no_delete(owl_global *g) 176 { 178 177 owl_context *c; 179 178 if (!g->context_stack) … … 250 249 /* windows */ 251 250 252 owl_mainwin *owl_global_get_mainwin(owl_global *g) { 253 return(&(g->mw)); 251 owl_mainwin *owl_global_get_mainwin(owl_global *g) 252 { 253 return g->mw; 254 254 } 255 255 … … 265 265 266 266 owl_messagelist *owl_global_get_msglist(owl_global *g) { 267 return (&(g->msglist));267 return g->msglist; 268 268 } 269 269 … … 367 367 g->confdir = g_strdup(cd); 368 368 g_free(g->startupfile); 369 g->startupfile = g_ strdup_printf("%s/startup", cd);369 g->startupfile = g_build_filename(cd, "startup", NULL); 370 370 } 371 371 … … 581 581 /* puntlist */ 582 582 583 owl_list*owl_global_get_puntlist(owl_global *g) {584 return (&(g->puntlist));583 GPtrArray *owl_global_get_puntlist(owl_global *g) { 584 return g->puntlist; 585 585 } 586 586 587 587 int owl_global_message_is_puntable(owl_global *g, const owl_message *m) { 588 const owl_list *pl; 589 int i, j; 590 591 pl=owl_global_get_puntlist(g); 592 j=owl_list_get_size(pl); 593 for (i=0; i<j; i++) { 594 if (owl_filter_message_match(owl_list_get_element(pl, i), m)) return(1); 595 } 596 return(0); 588 const GPtrArray *pl; 589 int i; 590 591 pl = owl_global_get_puntlist(g); 592 for (i = 0; i < pl->len; i++) { 593 if (owl_filter_message_match(pl->pdata[i], m)) return 1; 594 } 595 return 0; 597 596 } 598 597 … … 727 726 * necessary. 728 727 */ 729 owl_message *owl_global_messagequeue_popmsg(owl_global *g)728 CALLER_OWN owl_message *owl_global_messagequeue_popmsg(owl_global *g) 730 729 { 731 730 owl_message *out; … … 756 755 } 757 756 758 void owl_global_get_style_names(const owl_global *g, owl_list *l) { 759 owl_dict_get_keys(&(g->styledict), l); 757 CALLER_OWN GPtrArray *owl_global_get_style_names(const owl_global *g) 758 { 759 return owl_dict_get_keys(&g->styledict); 760 760 } 761 761 … … 841 841 } 842 842 843 owl_list *owl_global_get_io_dispatch_list(owl_global *g)844 {845 return &(g->io_dispatch_list);846 }847 848 GList **owl_global_get_timerlist(owl_global *g)849 {850 return &(g->timerlist);851 }852 853 843 void owl_global_setup_default_filters(owl_global *g) 854 844 { … … 859 849 } filters[] = { 860 850 { "personal", 861 "isprivate ^true$ and ( not type ^zephyr$ or ( class ^message 851 "isprivate ^true$ and ( not type ^zephyr$ or ( class ^message$ ) )" }, 862 852 { "trash", 863 853 "class ^mail$ or opcode ^ping$ or type ^admin$ or ( not login ^none$ )" }, … … 866 856 { "auto", "opcode ^auto$" }, 867 857 { "login", "not login ^none$" }, 868 { "reply-lockout", "class ^ noc or class ^mail$" },858 { "reply-lockout", "class ^mail$ or class ^filsrv$" }, 869 859 { "out", "direction ^out$" }, 870 860 { "aim", "type ^aim$" }, … … 917 907 } 918 908 909 static GMutex *owl_global_get_interrupt_lock(owl_global *g) 910 { 911 #if GLIB_CHECK_VERSION(2, 31, 0) 912 return &g->interrupt_lock; 913 #else 914 return g->interrupt_lock; 915 #endif 916 } 917 919 918 void owl_global_add_interrupt(owl_global *g) { 920 919 /* TODO: This can almost certainly be done with atomic 921 920 * operations. Whatever. */ 922 g_mutex_lock( g->interrupt_lock);921 g_mutex_lock(owl_global_get_interrupt_lock(g)); 923 922 g->interrupt_count++; 924 g_mutex_unlock( g->interrupt_lock);923 g_mutex_unlock(owl_global_get_interrupt_lock(g)); 925 924 } 926 925 927 926 bool owl_global_take_interrupt(owl_global *g) { 928 927 bool ans = false; 929 g_mutex_lock( g->interrupt_lock);928 g_mutex_lock(owl_global_get_interrupt_lock(g)); 930 929 if (g->interrupt_count > 0) { 931 930 ans = true; 932 931 g->interrupt_count--; 933 932 } 934 g_mutex_unlock( g->interrupt_lock);933 g_mutex_unlock(owl_global_get_interrupt_lock(g)); 935 934 return ans; 936 935 } -
help.c
rf25df21 r8258ea5 1 1 #include "owl.h" 2 #include <string.h>3 2 4 3 void owl_help(void) 5 4 { 5 const owl_variable *v; 6 6 owl_fmtext fm; 7 7 const char *varname; 8 owl_listvarnames;9 int i , numvarnames;8 GPtrArray *varnames; 9 int i; 10 10 11 11 owl_fmtext_init_null(&fm); … … 65 65 "\n" 66 66 " l Print a zephyr/AIM buddy listing\n" 67 " A Toggle zaway\n"67 " A Toggle away\n" 68 68 " o Toggle one-line display mode\n" 69 69 " w Open a URL in the current message\n" 70 70 " C-l Refresh the screen\n" 71 " C-z Suspend Owl\n"71 " C-z Suspend BarnOwl\n" 72 72 " h Print this help message\n" 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" … … 83 83 owl_fmtext_append_normal 84 84 (&fm, 85 " quit, exit Exit owl\n"85 " quit, exit Exit BarnOwl\n" 86 86 " help Get help about commands\n" 87 " show Show information about owl (see detailed help)\n"87 " show Show information about BarnOwl (see detailed help)\n" 88 88 "\n" 89 89 " zwrite Send a zephyr\n" … … 101 101 " set Set a variable (see list below)\n" 102 102 " print Print a variable's value (variables listed below)\n" 103 " startup Set a command to be run at every Owl startup\n"104 " unstartup Remove a command to be run at every Owl startup\n"103 " startup Set a command to be run at every BarnOwl startup\n" 104 " unstartup Remove a command to be run at every BarnOwl startup\n" 105 105 "\n" 106 106 " getsubs Print a list of current subscriptions\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" … … 121 121 " dump Dump messagelist as text to a file\n" 122 122 "\n" 123 " about Print information about owl\n"124 " status Print status information about the running owl\n"125 " version Print the version number of owl\n"123 " about Print information about BarnOwl\n" 124 " status Print status information about the running BarnOwl\n" 125 " version Print the version number of BarnOwl\n" 126 126 "\n"); 127 127 … … 129 129 owl_fmtext_append_bold(&fm, 130 130 "Variables:\n"); 131 owl_list_create(&varnames); 132 owl_variable_dict_get_names(owl_global_get_vardict(&g), &varnames); 133 numvarnames = owl_list_get_size(&varnames); 134 for (i=0; i<numvarnames; i++) { 135 varname = owl_list_get_element(&varnames, i); 131 varnames = owl_variable_dict_get_names(owl_global_get_vardict(&g)); 132 for (i = 0; i < varnames->len; i++) { 133 varname = varnames->pdata[i]; 136 134 if (varname && varname[0]!='_') { 137 owl_variable_describe(owl_global_get_vardict(&g), varname, &fm); 135 v = owl_variable_get_var(owl_global_get_vardict(&g), varname); 136 owl_variable_describe(v, &fm); 138 137 } 139 138 } 140 owl_ list_cleanup(&varnames, g_free);139 owl_ptr_array_free(varnames, g_free); 141 140 142 141 owl_fmtext_append_normal(&fm, "\n"); -
history.c
rd4927a7 r25891a8 3 3 void owl_history_init(owl_history *h) 4 4 { 5 owl_list_create(&(h->hist)); 6 h->cur=0; /* current position in history */ 7 h->touched=0; /* whether we've gone into history */ 8 h->partial=0; /* is the 0th element is partially composed? */ 9 h->repeats=1; /* by default we'll allow repeat entries */ 5 g_queue_init(&h->hist); 6 h->cur = h->hist.tail; /* current position in history */ 7 h->partial = false; /* is the 0th element is partially composed? */ 10 8 } 11 9 12 void owl_history_ set_norepeats(owl_history *h)10 void owl_history_cleanup(owl_history *h) 13 11 { 14 h->repeats=0; 12 g_queue_foreach(&h->hist, (GFunc)g_free, NULL); 13 g_queue_clear(&h->hist); 15 14 } 16 15 17 16 const char *owl_history_get_prev(owl_history *h) 18 17 { 18 if (!h) return NULL; 19 19 20 if (!h) return NULL; 21 h->touched=1; 20 if (h->cur == NULL || g_list_previous(h->cur) == NULL) return NULL; 22 21 23 if (owl_list_get_size(&(h->hist))==0) return(NULL); 24 25 if (h->cur == owl_list_get_size(&(h->hist))-1) { 26 return(NULL); 27 } 28 29 h->cur++; 30 31 return(owl_list_get_element(&(h->hist), h->cur)); 22 h->cur = g_list_previous(h->cur); 23 return h->cur->data; 32 24 } 33 25 … … 35 27 { 36 28 if (!h) return NULL; 37 if (owl_list_get_size(&(h->hist))==0) return(NULL);38 if (h->cur==0) {39 return(NULL);40 }41 29 42 h->cur--; 43 return(owl_list_get_element(&(h->hist), h->cur)); 30 if (h->cur == NULL || g_list_next(h->cur) == NULL) return NULL; 31 32 h->cur = g_list_next(h->cur); 33 return h->cur->data; 44 34 } 45 35 46 void owl_history_store(owl_history *h, const char *line )36 void owl_history_store(owl_history *h, const char *line, bool partial) 47 37 { 48 i nt size;38 if (!h) return; 49 39 50 if (!h) return; 51 size=owl_list_get_size(&(h->hist)); 40 owl_history_reset(h); 52 41 53 /* if partial is set, remove the first entry first */ 54 if (h->partial) { 55 g_free(owl_list_get_element(&(h->hist), 0)); 56 owl_list_remove_element(&(h->hist), 0); 57 } 58 59 /* if repeats are disallowed, check if the line is the same as the last */ 60 if (owl_list_get_size(&(h->hist))>0) { 61 if (!strcmp(line, owl_list_get_element(&(h->hist), 0))) return; 62 } 42 /* check if the line is the same as the last */ 43 if (!partial && !g_queue_is_empty(&h->hist) && 44 strcmp(line, g_queue_peek_tail(&h->hist)) == 0) 45 return; 63 46 64 47 /* if we've reached the max history size, pop off the last element */ 65 if (size>OWL_HISTORYSIZE) { 66 g_free(owl_list_get_element(&(h->hist), size-1)); 67 owl_list_remove_element(&(h->hist), size-1); 68 } 48 if (g_queue_get_length(&h->hist) >= OWL_HISTORYSIZE) 49 g_free(g_queue_pop_head(&h->hist)); 69 50 70 51 /* add the new line */ 71 owl_list_prepend_element(&(h->hist), g_strdup(line)); 72 } 73 74 void owl_history_set_partial(owl_history *h) 75 { 76 if (!h) return; 77 h->partial=1; 52 g_queue_push_tail(&h->hist, g_strdup(line)); 53 h->partial = partial; 54 h->cur = h->hist.tail; 78 55 } 79 56 … … 81 58 { 82 59 if (!h) return; 83 h->cur=0; 84 h->touched=0; 85 h->partial=0; 60 61 /* if partial is set, remove the first entry first */ 62 if (h->partial) { 63 g_free(g_queue_pop_tail(&h->hist)); 64 h->partial = false; 65 } 66 67 h->cur = h->hist.tail; 86 68 } 87 69 … … 89 71 { 90 72 if (!h) return(0); 91 if (h->touched) return(1); 92 return(0); 73 return h->cur != NULL && g_list_next(h->cur) != NULL; 93 74 } -
keybinding.c
r3b8a563 rf271129 1 #include <ctype.h>2 #include <string.h>3 1 #include "owl.h" 4 2 … … 14 12 15 13 /* sets up a new keybinding for a command */ 16 owl_keybinding *owl_keybinding_new(const char *keyseq, const char *command, void (*function_fn)(void), const char *desc)14 CALLER_OWN owl_keybinding *owl_keybinding_new(const char *keyseq, const char *command, void (*function_fn)(void), const char *desc) 17 15 { 18 16 owl_keybinding *kb = g_new(owl_keybinding, 1); … … 85 83 } 86 84 87 char *owl_keybinding_stack_tostring(int *j, int len)85 CALLER_OWN char *owl_keybinding_stack_tostring(int *j, int len) 88 86 { 89 87 GString *string; … … 100 98 } 101 99 102 char *owl_keybinding_tostring(const owl_keybinding *kb)100 CALLER_OWN char *owl_keybinding_tostring(const owl_keybinding *kb) 103 101 { 104 102 return owl_keybinding_stack_tostring(kb->keys, kb->len); -
keymap.c
r4c7c21f rf271129 1 #include <string.h>2 1 #include "owl.h" 3 2 … … 11 10 km->name = g_strdup(name); 12 11 km->desc = g_strdup(desc); 13 owl_list_create(&km->bindings);12 km->bindings = g_ptr_array_new(); 14 13 km->parent = NULL; 15 14 km->default_fn = default_fn; … … 24 23 g_free(km->name); 25 24 g_free(km->desc); 26 owl_ list_cleanup(&km->bindings, (void (*)(void *))owl_keybinding_delete);25 owl_ptr_array_free(km->bindings, (GDestroyNotify)owl_keybinding_delete); 27 26 } 28 27 … … 35 34 int owl_keymap_create_binding(owl_keymap *km, const char *keyseq, const char *command, void (*function_fn)(void), const char *desc) 36 35 { 37 owl_keybinding *kb , *curkb;36 owl_keybinding *kb; 38 37 int i; 39 38 … … 44 43 * otherwise just add this one. 45 44 */ 46 for (i = owl_list_get_size(&km->bindings)-1; i>=0; i--) { 47 curkb = owl_list_get_element(&km->bindings, i); 48 if (owl_keybinding_equal(curkb, kb)) { 49 owl_list_remove_element(&km->bindings, i); 50 owl_keybinding_delete(curkb); 51 } 52 } 53 return owl_list_append_element(&km->bindings, kb); 54 45 for (i = km->bindings->len-1; i >= 0; i--) { 46 if (owl_keybinding_equal(km->bindings->pdata[i], kb)) { 47 owl_keybinding_delete(g_ptr_array_remove_index(km->bindings, i)); 48 } 49 } 50 g_ptr_array_add(km->bindings, kb); 51 return 0; 55 52 } 56 53 … … 58 55 int owl_keymap_remove_binding(owl_keymap *km, const char *keyseq) 59 56 { 60 owl_keybinding *kb , *curkb;57 owl_keybinding *kb; 61 58 int i; 62 59 … … 65 62 return -1; 66 63 67 for (i = owl_list_get_size(&km->bindings)-1; i >= 0; i--) { 68 curkb = owl_list_get_element(&km->bindings, i); 69 if (owl_keybinding_equal(curkb, kb)) { 70 owl_list_remove_element(&km->bindings, i); 71 owl_keybinding_delete(curkb); 64 for (i = km->bindings->len-1; i >= 0; i--) { 65 if (owl_keybinding_equal(km->bindings->pdata[i], kb)) { 66 owl_keybinding_delete(g_ptr_array_remove_index(km->bindings, i)); 72 67 owl_keybinding_delete(kb); 73 68 return(0); … … 80 75 81 76 /* returns a summary line describing this keymap. the caller must free. */ 82 char *owl_keymap_summary(const owl_keymap *km)77 CALLER_OWN char *owl_keymap_summary(const owl_keymap *km) 83 78 { 84 79 if (!km || !km->name || !km->desc) return NULL; … … 139 134 static void _owl_keymap_format_bindings(const owl_keymap *km, owl_fmtext *fm) 140 135 { 141 int i , nbindings;136 int i; 142 137 const owl_keybinding *kb; 143 138 144 nbindings = owl_list_get_size(&km->bindings); 145 for (i=0; i<nbindings; i++) { 139 for (i = 0; i < km->bindings->len; i++) { 146 140 char *kbstr; 147 141 const owl_cmd *cmd; 148 142 const char *tmpdesc, *desc = ""; 149 143 150 kb = owl_list_get_element(&km->bindings, i);144 kb = km->bindings->pdata[i]; 151 145 kbstr = owl_keybinding_tostring(kb); 152 146 owl_fmtext_append_normal(fm, OWL_TABSTR); … … 214 208 } 215 209 216 void owl_keyhandler_get_keymap_names(const owl_keyhandler *kh, owl_list *l)217 { 218 owl_dict_get_keys(&kh->keymaps, l);210 CALLER_OWN GPtrArray *owl_keyhandler_get_keymap_names(const owl_keyhandler *kh) 211 { 212 return owl_dict_get_keys(&kh->keymaps); 219 213 } 220 214 … … 274 268 * keyhandler and keymap apart. */ 275 269 for (km=kh->active; km; km=km->parent) { 276 for (i =owl_list_get_size(&km->bindings)-1; i>=0; i--) {277 kb = owl_list_get_element(&km->bindings, i);270 for (i = km->bindings->len-1; i >= 0; i--) { 271 kb = km->bindings->pdata[i]; 278 272 match = owl_keybinding_match(kb, kh); 279 273 if (match == 1) { /* subset match */ -
keypress.c
rd07af84 rf271129 1 #include <ctype.h>2 #include <string.h>3 1 #include "owl.h" 4 2 … … 129 127 /* OWL_META is definied in owl.h */ 130 128 131 char *owl_keypress_tostring(int j, int esc)129 CALLER_OWN char *owl_keypress_tostring(int j, int esc) 132 130 { 133 131 GString *kb; -
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 -
libfaim/aim.h
r63de71c rfe73d0c 18 18 19 19 #include "config.h" 20 #ifdef HAVE_STDBOOL_H21 20 #include <stdbool.h> 22 #else23 #ifndef HAVE__BOOL24 #define _Bool signed char25 #endif26 #define bool _Bool27 #define false 028 #define true 129 #define __bool_true_false_are_defined 130 #endif /* HAVE_STDBOOL_H */31 21 32 22 #include <stdio.h> -
logging.c
rcc305b5 r0792d99 1 1 #include "owl.h" 2 #include <stdlib.h> 3 #include <string.h> 4 #include <ctype.h> 5 #include <sys/param.h> 2 #include <stdio.h> 6 3 7 4 typedef struct _owl_log_entry { /* noproto */ … … 80 77 } 81 78 82 char *owl_log_zephyr(const owl_message *m) { 79 CALLER_OWN char *owl_log_zephyr(const owl_message *m) 80 { 83 81 char *tmp = NULL; 84 82 GString *buffer = NULL; … … 103 101 } 104 102 105 char *owl_log_aim(const owl_message *m) { 103 CALLER_OWN char *owl_log_aim(const owl_message *m) 104 { 106 105 GString *buffer = NULL; 107 106 buffer = g_string_new(""); … … 120 119 } 121 120 122 char *owl_log_jabber(const owl_message *m) { 121 CALLER_OWN char *owl_log_jabber(const owl_message *m) 122 { 123 123 GString *buffer = NULL; 124 124 buffer = g_string_new(""); … … 132 132 } 133 133 134 char *owl_log_generic(const owl_message *m) { 134 CALLER_OWN char *owl_log_generic(const owl_message *m) 135 { 135 136 GString *buffer; 136 137 buffer = g_string_new(""); … … 220 221 while (cc != NULL) { 221 222 temp = short_zuser(cc->data); 222 filename = g_ strdup_printf("%s/%s", logpath, temp);223 filename = g_build_filename(logpath, temp, NULL); 223 224 owl_log_append(m, filename); 224 225 … … 244 245 } 245 246 246 filename = g_ strdup_printf("%s/%s", logpath, to);247 filename = g_build_filename(logpath, to, NULL); 247 248 owl_log_append(m, filename); 248 249 g_free(to); 249 250 g_free(filename); 250 251 251 filename = g_ strdup_printf("%s/all", logpath);252 filename = g_build_filename(logpath, "all", NULL); 252 253 owl_log_append(m, filename); 253 254 g_free(logpath); … … 281 282 /* expand ~ in path names */ 282 283 logpath = owl_util_makepath(owl_global_get_logpath(&g)); 283 filename = g_ strdup_printf("%s/%s", logpath, tobuff);284 filename = g_build_filename(logpath, tobuff, NULL); 284 285 msgbuf = g_string_new(""); 285 286 g_string_printf(msgbuf, "ERROR (owl): %s\n%s\n", tobuff, text); … … 290 291 g_string_free(msgbuf, TRUE); 291 292 292 filename = g_ strdup_printf("%s/all", logpath);293 filename = g_build_filename(logpath, "all", NULL); 293 294 g_free(logpath); 294 295 msgbuf = g_string_new(""); … … 389 390 if (personal) { 390 391 logpath = owl_util_makepath(owl_global_get_logpath(&g)); 391 filename = g_ strdup_printf("%s/%s", logpath, from);392 allfilename = g_ strdup_printf("%s/all", logpath);392 filename = g_build_filename(logpath, from, NULL); 393 allfilename = g_build_filename(logpath, "all", NULL); 393 394 owl_log_append(m, allfilename); 394 395 g_free(allfilename); 395 396 } else { 396 397 logpath = owl_util_makepath(owl_global_get_classlogpath(&g)); 397 filename = g_ strdup_printf("%s/%s", logpath, from);398 filename = g_build_filename(logpath, from, NULL); 398 399 } 399 400 … … 411 412 temp = short_zuser(cc->data); 412 413 if (strcasecmp(temp, frombuff) != 0) { 413 filename = g_ strdup_printf("%s/%s", logpath, temp);414 filename = g_build_filename(logpath, temp, NULL); 414 415 owl_log_append(m, filename); 415 416 g_free(filename); … … 428 429 static gpointer owl_log_thread_func(gpointer data) 429 430 { 430 log_context = g_main_context_new();431 431 log_loop = g_main_loop_new(log_context, FALSE); 432 432 g_main_loop_run(log_loop); … … 436 436 void owl_log_init(void) 437 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 438 444 GError *error = NULL; 439 445 logging_thread = g_thread_create(owl_log_thread_func, … … 447 453 exit(1); 448 454 } 455 #endif 449 456 450 457 } -
m4/ax_cflags_warn_all.m4
r8073852 re9b4a2c 1 1 # =========================================================================== 2 # http://autoconf-archive.cryp.to/ax_cflags_warn_all.html2 # http://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html 3 3 # =========================================================================== 4 4 # 5 5 # SYNOPSIS 6 6 # 7 # AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] 7 # AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] 8 # AX_CXXFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] 9 # AX_FCFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] 8 10 # 9 11 # DESCRIPTION 10 12 # 11 13 # Try to find a compiler option that enables most reasonable warnings. 12 # This macro is directly derived from VL_PROG_CC_WARNINGS which is split13 # up into two AX_CFLAGS_WARN_ALL and AX_CFLAGS_WARN_ALL_ANSI14 14 # 15 # For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The16 # result is added to the shellvar beingCFLAGS by default.15 # For the GNU compiler it will be -Wall (and -ansi -pedantic) The result 16 # is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by default. 17 17 # 18 # Currently this macro knows about GCC, Solaris C compiler, Digital Unix C19 # compiler, C for AIX Compiler, HP-UX C compiler, IRIX C compiler, NEC20 # SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos 10.0.0.8) C21 # compiler.18 # Currently this macro knows about the GCC, Solaris, Digital Unix, AIX, 19 # HP-UX, IRIX, NEC SX-5 (Super-UX 10), Cray J90 (Unicos 10.0.0.8), and 20 # Intel compilers. For a given compiler, the Fortran flags are much more 21 # experimental than their C equivalents. 22 22 # 23 # - $1 shell-variable-to-add-to : CFLAGS 23 # - $1 shell-variable-to-add-to : CFLAGS, CXXFLAGS, or FCFLAGS 24 24 # - $2 add-value-if-not-found : nothing 25 25 # - $3 action-if-found : add value to shellvariable 26 26 # - $4 action-if-not-found : nothing 27 27 # 28 # NOTE: These macros depend on AX_APPEND_FLAG. 29 # 28 30 # LICENSE 29 31 # 30 32 # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> 33 # Copyright (c) 2010 Rhys Ulerich <rhys.ulerich@gmail.com> 31 34 # 32 35 # This program is free software; you can redistribute it and/or modify it 33 36 # under the terms of the GNU General Public License as published by the 34 # Free Software Foundation; either version 2of the License, or (at your37 # Free Software Foundation; either version 3 of the License, or (at your 35 38 # option) any later version. 36 39 # … … 56 59 # exception to the GPL to apply to your modified version as well. 57 60 58 AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl 59 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl 60 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all])dnl 61 #serial 14 62 63 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 61 66 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], 62 67 VAR,[VAR="no, unknown" 63 AC_LANG_SAVE 64 AC_LANG_C 65 ac_save_[]FLAGS="$[]FLAGS" 68 ac_save_[]FLAGS="$[]FLAGS" 66 69 for ac_arg dnl 67 in "-pedantic % -Wall" dnl GCC 70 in "-warn all % -warn all" dnl Intel 71 "-pedantic % -Wall" dnl GCC 68 72 "-xstrconst % -v" dnl Solaris C 69 73 "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix … … 75 79 # 76 80 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` 77 AC_ TRY_COMPILE([],[return 0;],78 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])81 AC_COMPILE_IFELSE([AC_LANG_PROGRAM], 82 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) 79 83 done 80 FLAGS="$ac_save_[]FLAGS" 81 AC_LANG_RESTORE 84 FLAGS="$ac_save_[]FLAGS" 82 85 ]) 86 AS_VAR_POPDEF([FLAGS])dnl 87 AC_REQUIRE([AX_APPEND_FLAG]) 83 88 case ".$VAR" in 84 89 .ok|.ok,*) m4_ifvaln($3,$3) ;; 85 .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ 86 AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) 87 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; 88 *) m4_ifvaln($3,$3,[ 89 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null 90 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) 91 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) 92 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" 93 fi ]) ;; 90 .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;; 91 *) m4_default($3,[AX_APPEND_FLAG([$VAR], [$1])]) ;; 94 92 esac 95 93 AS_VAR_POPDEF([VAR])dnl 96 AS_VAR_POPDEF([FLAGS])dnl 97 ]) 98 99 dnl the only difference - the LANG selection... and the default FLAGS 100 101 AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl 102 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl 103 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all])dnl 104 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], 105 VAR,[VAR="no, unknown" 106 AC_LANG_SAVE 107 AC_LANG_CPLUSPLUS 108 ac_save_[]FLAGS="$[]FLAGS" 109 for ac_arg dnl 110 in "-pedantic % -Wall" dnl GCC 111 "-xstrconst % -v" dnl Solaris C 112 "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix 113 "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX 114 "-ansi -ansiE % -fullwarn" dnl IRIX 115 "+ESlit % +w1" dnl HP-UX C 116 "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) 117 "-h conform % -h msglevel 2" dnl Cray C (Unicos) 118 # 119 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` 120 AC_TRY_COMPILE([],[return 0;], 121 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) 122 done 123 FLAGS="$ac_save_[]FLAGS" 124 AC_LANG_RESTORE 125 ]) 126 case ".$VAR" in 127 .ok|.ok,*) m4_ifvaln($3,$3) ;; 128 .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ 129 AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) 130 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; 131 *) m4_ifvaln($3,$3,[ 132 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null 133 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) 134 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) 135 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" 136 fi ]) ;; 137 esac 138 AS_VAR_POPDEF([VAR])dnl 139 AS_VAR_POPDEF([FLAGS])dnl 140 ]) 141 94 ])dnl AX_FLAGS_WARN_ALL 142 95 dnl implementation tactics: 143 96 dnl the for-argument contains a list of options. The first part of … … 148 101 dnl like -Woption or -Xoption as they think of it is a pass-through 149 102 dnl to later compile stages or something. The "%" is used as a 150 dnl delimi miter. A non-option comment can be given after "%%" marks103 dnl delimiter. A non-option comment can be given after "%%" marks 151 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/ax_prog_perl_modules.m4
r2d3ed95 r378ede7 1 1 # =========================================================================== 2 # http://www.nongnu.org/autoconf-archive/ax_prog_perl_modules.html2 # http://www.gnu.org/software/autoconf-archive/ax_prog_perl_modules.html 3 3 # =========================================================================== 4 4 # … … 33 33 # warranty. 34 34 35 #serial 635 #serial 7 36 36 37 37 AU_ALIAS([AC_PROG_PERL_MODULES], [AX_PROG_PERL_MODULES]) -
m4/pkg.m4
r8073852 r13a39ae8 1 1 # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- 2 # serial 1 (pkg-config-0.24) 2 3 # 3 4 # Copyright © 2004 Scott James Remnant <scott@netsplit.com>. … … 26 27 AC_DEFUN([PKG_PROG_PKG_CONFIG], 27 28 [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) 28 m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) 29 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl 29 m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) 30 m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) 31 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) 32 AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) 33 AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) 34 30 35 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then 31 36 AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) … … 40 45 PKG_CONFIG="" 41 46 fi 42 43 47 fi[]dnl 44 48 ])# PKG_PROG_PKG_CONFIG … … 49 53 # to PKG_CHECK_MODULES(), but does not set variables or print errors. 50 54 # 51 # 52 # Similar to PKG_CHECK_MODULES, make sure that the first instance of53 # this or PKG_CHECK_MODULES is called, or make sure to call54 # PKG_CHECK_EXISTS manually55 # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 56 # only at the first occurence in configure.ac, so if the first place 57 # it's called might be skipped (such as if it is within an "if", you 58 # have to call PKG_CHECK_EXISTS manually 55 59 # -------------------------------------------------------------- 56 60 AC_DEFUN([PKG_CHECK_EXISTS], … … 58 62 if test -n "$PKG_CONFIG" && \ 59 63 AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then 60 m4_ ifval([$2],[$2], [:])64 m4_default([$2], [:]) 61 65 m4_ifvaln([$3], [else 62 66 $3])dnl 63 67 fi]) 64 68 65 66 69 # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) 67 70 # --------------------------------------------- 68 71 m4_define([_PKG_CONFIG], 69 [if test -n "$PKG_CONFIG"; then 70 if test -n "$$1"; then 71 pkg_cv_[]$1="$$1" 72 else 73 PKG_CHECK_EXISTS([$3], 74 [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], 75 [pkg_failed=yes]) 76 fi 77 else 78 pkg_failed=untried 72 [if test -n "$$1"; then 73 pkg_cv_[]$1="$$1" 74 elif test -n "$PKG_CONFIG"; then 75 PKG_CHECK_EXISTS([$3], 76 [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` 77 test "x$?" != "x0" && pkg_failed=yes ], 78 [pkg_failed=yes]) 79 else 80 pkg_failed=untried 79 81 fi[]dnl 80 82 ])# _PKG_CONFIG … … 118 120 119 121 if test $pkg_failed = yes; then 122 AC_MSG_RESULT([no]) 120 123 _PKG_SHORT_ERRORS_SUPPORTED 121 124 if test $_pkg_short_errors_supported = yes; then 122 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors -- errors-to-stdout --print-errors "$2"`125 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` 123 126 else 124 $1[]_PKG_ERRORS=`$PKG_CONFIG -- errors-to-stdout --print-errors "$2"`127 $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` 125 128 fi 126 129 # Put the nasty error message in config.log where it belongs 127 130 echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD 128 131 129 ifelse([$4], , [AC_MSG_ERROR(dnl132 m4_default([$4], [AC_MSG_ERROR( 130 133 [Package requirements ($2) were not met: 131 134 … … 135 138 installed software in a non-standard prefix. 136 139 137 _PKG_TEXT 138 ])], 139 [AC_MSG_RESULT([no]) 140 $4]) 140 _PKG_TEXT])[]dnl 141 ]) 141 142 elif test $pkg_failed = untried; then 142 ifelse([$4], , [AC_MSG_FAILURE(dnl 143 AC_MSG_RESULT([no]) 144 m4_default([$4], [AC_MSG_FAILURE( 143 145 [The pkg-config script could not be found or is too old. Make sure it 144 146 is in your PATH or set the PKG_CONFIG environment variable to the full … … 147 149 _PKG_TEXT 148 150 149 To get pkg-config, see <http://pkg-config.freedesktop.org/>.]) ],150 [$4])151 To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl 152 ]) 151 153 else 152 154 $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS 153 155 $1[]_LIBS=$pkg_cv_[]$1[]_LIBS 154 156 AC_MSG_RESULT([yes]) 155 ifelse([$3], , :, [$3])157 $3 156 158 fi[]dnl 157 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 rab88b05 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_new(owl_mainwin, 1); 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
r259e60a8 r2354e9a 1 #include <stdlib.h>2 #include <unistd.h>3 #include <string.h>4 #include <sys/socket.h>5 #include <netdb.h>6 #include <sys/types.h>7 #include <sys/socket.h>8 #include <netinet/in.h>9 #include <arpa/inet.h>10 #include <time.h>11 1 #include "owl.h" 12 2 #include "filterproc.h" 3 #include <sys/socket.h> 4 #include <arpa/inet.h> 13 5 14 6 static owl_fmtext_cache fmtext_cache[OWL_FMTEXT_CACHE_SIZE]; … … 42 34 m->delete=0; 43 35 36 #ifdef HAVE_LIBZEPHYR 37 m->has_notice = false; 38 #endif 39 44 40 owl_message_set_hostname(m, ""); 45 owl_list_create(&(m->attributes));41 m->attributes = g_ptr_array_new(); 46 42 47 43 /* save the time */ 48 m->time =time(NULL);49 m->timestr =g_strdup(ctime(&(m->time)));50 m->timestr[strlen(m->timestr)-1] ='\0';44 m->time = time(NULL); 45 m->timestr = g_strdup(ctime(&m->time)); 46 m->timestr[strlen(m->timestr)-1] = '\0'; 51 47 52 48 m->fmtext = NULL; … … 58 54 void owl_message_set_attribute(owl_message *m, const char *attrname, const char *attrvalue) 59 55 { 60 int i , j;56 int i; 61 57 owl_pair *p = NULL, *pair = NULL; 62 58 … … 64 60 65 61 /* look for an existing pair with this key, */ 66 j=owl_list_get_size(&(m->attributes)); 67 for (i=0; i<j; i++) { 68 p=owl_list_get_element(&(m->attributes), i); 62 for (i = 0; i < m->attributes->len; i++) { 63 p = m->attributes->pdata[i]; 69 64 if (owl_pair_get_key(p) == attrname) { 70 65 g_free(owl_pair_get_value(p)); … … 77 72 pair = g_new(owl_pair, 1); 78 73 owl_pair_create(pair, attrname, NULL); 79 owl_list_append_element(&(m->attributes), pair);74 g_ptr_array_add(m->attributes, pair); 80 75 } 81 76 owl_pair_set_value(pair, owl_validate_or_convert(attrvalue)); … … 87 82 const char *owl_message_get_attribute_value(const owl_message *m, const char *attrname) 88 83 { 89 int i , j;84 int i; 90 85 owl_pair *p; 91 86 GQuark quark; … … 97 92 attrname = g_quark_to_string(quark); 98 93 99 j=owl_list_get_size(&(m->attributes)); 100 for (i=0; i<j; i++) { 101 p=owl_list_get_element(&(m->attributes), i); 94 for (i = 0; i < m->attributes->len; i++) { 95 p = m->attributes->pdata[i]; 102 96 if (owl_pair_get_key(p) == attrname) { 103 97 return(owl_pair_get_value(p)); … … 118 112 */ 119 113 void owl_message_attributes_tofmtext(const owl_message *m, owl_fmtext *fm) { 120 int i , j;114 int i; 121 115 owl_pair *p; 122 116 char *buff, *tmpbuff; … … 124 118 owl_fmtext_init_null(fm); 125 119 126 j=owl_list_get_size(&(m->attributes)); 127 for (i=0; i<j; i++) { 128 p=owl_list_get_element(&(m->attributes), i); 129 130 tmpbuff = g_strdup(owl_pair_get_value(p)); 131 g_strdelimit(tmpbuff, "\n", '~'); 132 g_strdelimit(tmpbuff, "\r", '!'); 133 buff = g_strdup_printf(" %-15.15s: %s\n", owl_pair_get_key(p), tmpbuff); 134 g_free(tmpbuff); 120 for (i = 0; i < m->attributes->len; i++) { 121 p = m->attributes->pdata[i]; 122 123 buff = g_strdup(owl_pair_get_value(p)); 124 if (buff) { 125 tmpbuff = owl_text_indent(buff, 19, false); 126 g_free(buff); 127 buff = g_strdup_printf(" %-15.15s: %s\n", owl_pair_get_key(p), tmpbuff); 128 g_free(tmpbuff); 129 } 135 130 136 131 if(buff == NULL) { … … 352 347 } 353 348 349 CALLER_OWN char *owl_message_format_time(const owl_message *m) 350 { 351 return owl_util_format_time(localtime(&m->time)); 352 } 353 354 354 void owl_message_set_type_admin(owl_message *m) 355 355 { … … 500 500 const ZNotice_t *owl_message_get_notice(const owl_message *m) 501 501 { 502 return (&(m->notice));502 return m->has_notice ? &m->notice : NULL; 503 503 } 504 504 #else … … 580 580 581 581 /* caller must free return value. */ 582 char *owl_message_get_cc(const owl_message *m)582 CALLER_OWN char *owl_message_get_cc(const owl_message *m) 583 583 { 584 584 const char *cur; … … 597 597 598 598 /* caller must free return value */ 599 GList *owl_message_get_cc_without_recipient(const owl_message *m)599 CALLER_OWN GList *owl_message_get_cc_without_recipient(const owl_message *m) 600 600 { 601 601 char *cc, *shortuser, *recip; … … 791 791 /* first save the full notice */ 792 792 m->notice = *n; 793 m->has_notice = true; 793 794 794 795 /* a little gross, we'll replace \r's with ' ' for now */ … … 797 798 /* save the time, we need to nuke the string saved by message_init */ 798 799 if (m->timestr) g_free(m->timestr); 799 m->time =n->z_time.tv_sec;800 m->timestr =g_strdup(ctime(&(m->time)));801 m->timestr[strlen(m->timestr)-1] ='\0';800 m->time = n->z_time.tv_sec; 801 m->timestr = g_strdup(ctime(&m->time)); 802 m->timestr[strlen(m->timestr)-1] = '\0'; 802 803 803 804 /* set other info */ … … 835 836 836 837 837 /* set the "isprivate" attribute if it's a private zephyr. 838 ``private'' means recipient is non-empty and doesn't start wit 839 `@' */ 840 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)) { 841 840 owl_message_set_isprivate(m); 842 841 } … … 876 875 if (owl_global_is_zcrypt(&g) && !strcasecmp(n->z_opcode, "crypt")) { 877 876 const char *argv[] = { 878 "zcrypt",877 NULL, 879 878 "-D", 880 879 "-c", owl_message_get_class(m), … … 882 881 NULL 883 882 }; 884 char *out ;883 char *out = NULL; 885 884 int rv; 886 885 int status; 887 886 char *zcrypt; 888 887 889 zcrypt = g_strdup_printf("%s/zcrypt", owl_get_bindir()); 890 891 rv = call_filter(zcrypt, argv, owl_message_get_body(m), &out, &status); 888 zcrypt = g_build_filename(owl_get_bindir(), "zcrypt", NULL); 889 argv[0] = zcrypt; 890 891 rv = call_filter(argv, owl_message_get_body(m), &out, &status); 892 892 g_free(zcrypt); 893 893 … … 898 898 } 899 899 owl_message_set_body(m, out); 900 g_free(out); 901 } else if(out) { 902 g_free(out); 903 } 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); 904 906 } 905 907 … … 1004 1006 void owl_message_cleanup(owl_message *m) 1005 1007 { 1006 int i , j;1008 int i; 1007 1009 owl_pair *p; 1008 1010 #ifdef HAVE_LIBZEPHYR 1009 if ( owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) {1011 if (m->has_notice) { 1010 1012 ZFreeNotice(&(m->notice)); 1011 1013 } … … 1014 1016 1015 1017 /* free all the attributes */ 1016 j=owl_list_get_size(&(m->attributes)); 1017 for (i=0; i<j; i++) { 1018 p=owl_list_get_element(&(m->attributes), i); 1018 for (i = 0; i < m->attributes->len; i++) { 1019 p = m->attributes->pdata[i]; 1019 1020 g_free(owl_pair_get_value(p)); 1020 1021 g_free(p); 1021 1022 } 1022 1023 1023 owl_list_cleanup(&(m->attributes), NULL);1024 g_ptr_array_free(m->attributes, true); 1024 1025 1025 1026 owl_message_invalidate_format(m); -
messagelist.c
r66a8cd6 r219f52c