Changes in / [8bba1ae:d296c9a]
- Files:
-
- 10 added
- 1 deleted
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
r7d03c8d rde18326 35 35 pm_to_blib 36 36 stamp-h1 37 tester38 37 varstubs.c -
Makefile.am
rea7daa8 r9d27ee8 12 12 zcrypt_SOURCES = zcrypt.c filterproc.c 13 13 14 check_PROGRAMS = tester perl_tester14 check_PROGRAMS = tester.bin 15 15 16 16 barnowl_bin_SOURCES = $(BASE_SRCS) \ … … 19 19 $(GEN_C) $(GEN_H) 20 20 21 man_MANS = doc/barnowl.1 22 doc_DATA = doc/intro.txt doc/advanced.txt 23 21 24 barnowl_bin_LDADD = libfaim/libfaim.a 22 25 23 tester_ SOURCES = $(BASE_SRCS) \26 tester_bin_SOURCES = $(BASE_SRCS) \ 24 27 owl.h owl_perl.h config.h \ 25 28 $(GEN_C) $(GEN_H) \ 26 29 tester.c 27 30 28 tester_LDADD = libfaim/libfaim.a 29 30 perl_tester_SOURCES = $(BASE_SRCS) \ 31 owl.h owl_perl.h config.h \ 32 $(GEN_C) $(GEN_H) \ 33 perl_tester.c 34 35 perl_tester_LDADD = libfaim/libfaim.a 31 tester_bin_LDADD = libfaim/libfaim.a 36 32 37 33 TESTS=runtests.sh -
README
r62c91c1 raeadc74 1 1 BarnOwl - owl, with more ponies 2 2 3 Source is freely available from http://github.com/barnowl/barnowl/ 4 3 5 Based on owl 2.1.11, by James Kretchmar (http://www.ktools.org) 4 5 This project is a work in progress.6 We guarantee no stability of form or function.7 6 8 7 Notes: -
barnowl
r9a7b4f2 rde18326 5 5 6 6 SRCDIR=`dirname "${0}"` 7 EXE="$ SRCDIR/barnowl.bin"7 EXE="$0.bin" 8 8 9 9 if ! test -x "$EXE"; then -
cmd.c
rea7daa8 r1cc9b615 52 52 cmd = owl_malloc(sizeof(owl_cmd)); 53 53 owl_cmd_create_alias(cmd, alias_from, alias_to); 54 owl_perlconfig_new_command(cmd->name); 54 55 owl_dict_insert_element(cd, cmd->name, cmd, (void (*)(void *))owl_cmd_delete); 55 56 return(0); -
commands.c
r9bd51b8 r987cf3f 136 136 "Send a local message.\n"), 137 137 138 OWLCMD_ARGS("zcrypt", owl_command_z crypt, OWL_CTX_INTERACTIVE,138 OWLCMD_ARGS("zcrypt", owl_command_zwrite, OWL_CTX_INTERACTIVE, 139 139 "send an encrypted zephyr", 140 140 "zcrypt [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcode] [-m <message...>]\n", … … 1911 1911 char *owl_command_zwrite(int argc, const char *const *argv, const char *buff) 1912 1912 { 1913 owl_zwrite z;1913 owl_zwrite *z; 1914 1914 1915 1915 if (!owl_global_is_havezephyr(&g)) { … … 1918 1918 } 1919 1919 /* check for a zwrite -m */ 1920 owl_zwrite_create_from_line(&z, buff); 1921 if (owl_zwrite_is_message_set(&z)) { 1922 owl_function_zwrite(buff, NULL); 1923 owl_zwrite_cleanup(&z); 1924 return (NULL); 1925 } 1926 owl_zwrite_cleanup(&z); 1920 z = owl_zwrite_new(buff); 1921 if (!z) { 1922 owl_function_error("Error in zwrite arguments"); 1923 return NULL; 1924 } 1925 1926 if (owl_zwrite_is_message_set(z)) { 1927 owl_function_zwrite(z, NULL); 1928 owl_zwrite_delete(z); 1929 return NULL; 1930 } 1927 1931 1928 1932 if (argc < 2) { 1933 owl_zwrite_delete(z); 1929 1934 owl_function_makemsg("Not enough arguments to the zwrite command."); 1930 1935 } else { 1931 owl_function_zwrite_setup( buff);1936 owl_function_zwrite_setup(z); 1932 1937 } 1933 1938 return(NULL); … … 2016 2021 { 2017 2022 owl_function_loopwrite_setup(); 2018 return(NULL);2019 }2020 2021 char *owl_command_zcrypt(int argc, const char *const *argv, const char *buff)2022 {2023 owl_zwrite z;2024 2025 if (!owl_global_is_havezephyr(&g)) {2026 owl_function_makemsg("Zephyr is not available");2027 return(NULL);2028 }2029 /* check for a zcrypt -m */2030 owl_zwrite_create_from_line(&z, buff);2031 if (owl_zwrite_is_message_set(&z)) {2032 owl_function_zcrypt(buff, NULL);2033 owl_zwrite_cleanup(&z);2034 return (NULL);2035 }2036 owl_zwrite_cleanup(&z);2037 2038 if (argc < 2) {2039 owl_function_makemsg("Not enough arguments to the zcrypt command.");2040 } else {2041 owl_function_zwrite_setup(buff);2042 }2043 2023 return(NULL); 2044 2024 } -
configure.ac
r4751077a r04af908 35 35 [with_zephyr=check]) 36 36 37 AC_ARG_WITH([krb4], 38 AS_HELP_STRING([--with-krb4], 39 [Build with kerberos IV])) 40 37 41 AS_IF([test "x$with_zephyr" != xno], 38 [AC_MSG_CHECKING([for Kerberos IV]) 39 AS_IF([krb5-config krb4 --libs >/dev/null 2>&1], 40 [AC_MSG_RESULT([yes]) 41 AC_DEFINE([HAVE_KERBEROS_IV], [1], [Define if you have kerberos IV]) 42 CFLAGS="${CFLAGS} `krb5-config krb4 --cflags`" 43 LIBS="${LIBS} `krb5-config krb4 --libs`" 44 ], 45 [AC_MSG_RESULT([no]) 46 PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto]) 47 CFLAGS="${CFLAGS} ${LIBCRYPTO_CFLAGS}" 48 LIBS="${LIBS} ${LIBCRYPTO_LIBS}" 49 ]) 42 [AS_IF([test "x$with_krb4" != "xno"], 43 [AC_MSG_CHECKING([for Kerberos IV]) 44 AS_IF([krb5-config krb4 --libs >/dev/null 2>&1], 45 [AC_MSG_RESULT([yes]) 46 AC_DEFINE([HAVE_KERBEROS_IV], [1], [Define if you have kerberos IV]) 47 CFLAGS="${CFLAGS} `krb5-config krb4 --cflags`" 48 LIBS="${LIBS} `krb5-config krb4 --libs`" 49 ], 50 [AC_MSG_RESULT([no]) 51 AS_IF([test "x$with_krb4" = "xyes"], 52 [AC_MSG_ERROR([Kerberos IV requested but not found])]) 53 PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto]) 54 CFLAGS="${CFLAGS} ${LIBCRYPTO_CFLAGS}" 55 LIBS="${LIBS} ${LIBCRYPTO_LIBS}" 56 ])]) 50 57 AC_CHECK_LIB([zephyr], [ZGetSender], 51 58 [LIBS="$LIBS -lzephyr" … … 131 138 test "$HAVE_DES_ECB_ENCRYPT"]) 132 139 140 CFLAGS="$CFLAGS -D_XOPEN_SOURCE" 141 133 142 AC_SUBST([LIBFAIM_CFLAGS]) 134 143 -
functions.c
r8bba1ae r8bba1ae 222 222 * that. 223 223 */ 224 owl_message *owl_function_make_outgoing_zephyr(const char *body, const char *zwriteline, const char *zsig)224 owl_message *owl_function_make_outgoing_zephyr(const owl_zwrite *z) 225 225 { 226 226 owl_message *m; 227 owl_zwrite zw;228 229 owl_zwrite_create_from_line(&zw, zwriteline);230 owl_zwrite_set_zsig(&zw, zsig);231 227 232 228 /* create the message */ 233 229 m=owl_malloc(sizeof(owl_message)); 234 235 owl_message_create_from_zwrite(m, &zw, body); 236 owl_zwrite_cleanup(&zw); 230 owl_message_create_from_zwrite(m, z, owl_zwrite_get_message(z)); 237 231 238 232 return(m); … … 295 289 } 296 290 297 static void owl_function_write_setup(const char * line, const char *noun, void (*callback)(owl_editwin *))291 static void owl_function_write_setup(const char *noun) 298 292 { 299 293 … … 306 300 "End with a dot on a line by itself. ^C will quit.", 307 301 noun); 308 309 owl_function_start_edit_win(line, callback, 302 } 303 304 void owl_function_zwrite_setup(owl_zwrite *z) 305 { 306 /* send a ping if necessary */ 307 if (owl_global_is_txping(&g)) { 308 owl_zwrite_send_ping(z); 309 } 310 311 312 owl_function_write_setup("zephyr"); 313 owl_function_start_edit_win(z->zwriteline, 314 &owl_callback_zwrite, 315 z, (void(*)(void*))owl_zwrite_delete); 316 } 317 318 void owl_function_aimwrite_setup(const char *line) 319 { 320 owl_function_write_setup("message"); 321 owl_function_start_edit_win(line, 322 &owl_callback_aimwrite, 310 323 owl_strdup(line), 311 324 owl_free); 312 } 313 314 void owl_function_zwrite_setup(const char *line) 315 { 316 owl_zwrite z; 317 int ret; 318 319 /* check the arguments */ 320 ret=owl_zwrite_create_from_line(&z, line); 321 if (ret) { 322 owl_function_error("Error in zwrite arguments"); 323 owl_zwrite_cleanup(&z); 324 return; 325 } 326 327 /* send a ping if necessary */ 328 if (owl_global_is_txping(&g)) { 329 owl_zwrite_send_ping(&z); 330 } 331 owl_zwrite_cleanup(&z); 332 333 owl_function_write_setup(line, "zephyr", &owl_callback_zwrite); 334 } 335 336 void owl_function_aimwrite_setup(const char *line) 337 { 338 owl_function_write_setup(line, "message", &owl_callback_aimwrite); 325 339 326 } 340 327 341 328 void owl_function_loopwrite_setup(void) 342 329 { 343 owl_function_write_setup("loopwrite", "message", owl_callback_loopwrite); 330 owl_function_write_setup("message"); 331 owl_function_start_edit_win("loopwrite", 332 &owl_callback_loopwrite, 333 "loopwrite", NULL); 344 334 } 345 335 346 336 void owl_callback_zwrite(owl_editwin *e) { 347 char *command = owl_editwin_get_cbdata(e); 348 owl_function_zwrite(command, 349 owl_editwin_get_text(e)); 337 owl_zwrite *z = owl_editwin_get_cbdata(e); 338 owl_function_zwrite(z, owl_editwin_get_text(e)); 350 339 } 351 340 … … 353 342 * the message is expected to be set from the zwrite line itself 354 343 */ 355 void owl_function_zwrite(const char *line, const char *msg) 356 { 357 owl_zwrite z; 358 const char *mymsg; 344 void owl_function_zwrite(owl_zwrite *z, const char *msg) 345 { 359 346 owl_message *m; 360 347 361 if( !strncmp(line, "zcrypt", strlen("zcrypt"))) {362 owl_function_zcrypt( line, msg);348 if(strcmp(z->cmd, "zcrypt") == 0) { 349 owl_function_zcrypt(z, msg); 363 350 return; 364 351 } 365 352 366 353 /* create the zwrite and send the message */ 367 owl_zwrite_create_from_line(&z, line); 368 owl_zwrite_populate_zsig(&z); 354 owl_zwrite_populate_zsig(z); 369 355 if (msg) { 370 owl_zwrite_set_message( &z, msg);371 } 372 owl_zwrite_send_message( &z);356 owl_zwrite_set_message(z, msg); 357 } 358 owl_zwrite_send_message(z); 373 359 owl_function_makemsg("Waiting for ack..."); 374 360 375 361 /* If it's personal */ 376 if (owl_zwrite_is_personal( &z)) {362 if (owl_zwrite_is_personal(z)) { 377 363 /* create the outgoing message */ 378 mymsg=owl_zwrite_get_message(&z); 379 m=owl_function_make_outgoing_zephyr(mymsg, line, owl_zwrite_get_zsig(&z)); 364 m=owl_function_make_outgoing_zephyr(z); 380 365 381 366 if (m) { … … 385 370 } 386 371 } 387 388 /* free the zwrite */389 owl_zwrite_cleanup(&z);390 372 } 391 373 … … 393 375 * the message is expected to be set from the zwrite line itself 394 376 */ 395 void owl_function_zcrypt(const char *line, const char *msg) 396 { 397 owl_zwrite z; 398 const char *mymsg; 377 void owl_function_zcrypt(owl_zwrite *z, const char *msg) 378 { 399 379 char *cryptmsg; 400 380 owl_message *m; … … 402 382 char *zcrypt; 403 383 int rv, status; 384 char *old_msg; 404 385 405 386 /* create the zwrite and send the message */ 406 owl_zwrite_create_from_line(&z, line); 407 owl_zwrite_populate_zsig(&z); 387 owl_zwrite_populate_zsig(z); 408 388 if (msg) { 409 owl_zwrite_set_message(&z, msg); 410 } 411 412 mymsg=owl_zwrite_get_message(&z); 389 owl_zwrite_set_message(z, msg); 390 } 391 old_msg = owl_strdup(owl_zwrite_get_message(z)); 413 392 414 393 zcrypt = owl_sprintf("%s/zcrypt", owl_get_bindir()); 415 394 argv[0] = "zcrypt"; 416 395 argv[1] = "-E"; 417 argv[2] = "-c"; argv[3] = owl_zwrite_get_class( &z);418 argv[4] = "-i"; argv[5] = owl_zwrite_get_instance( &z);396 argv[2] = "-c"; argv[3] = owl_zwrite_get_class(z); 397 argv[4] = "-i"; argv[5] = owl_zwrite_get_instance(z); 419 398 argv[6] = NULL; 420 399 421 rv = call_filter(zcrypt, argv, mymsg, &cryptmsg, &status);400 rv = call_filter(zcrypt, argv, owl_zwrite_get_message(z), &cryptmsg, &status); 422 401 423 402 owl_free(zcrypt); … … 425 404 if (rv || status) { 426 405 if(cryptmsg) owl_free(cryptmsg); 406 owl_free(old_msg); 427 407 owl_function_error("Error in zcrypt, possibly no key found. Message not sent."); 428 408 owl_function_beep(); 429 owl_zwrite_cleanup(&z);430 409 return; 431 410 } 432 411 433 owl_zwrite_set_message (&z, cryptmsg);434 owl_zwrite_set_opcode( &z, "crypt");435 436 owl_zwrite_send_message( &z);412 owl_zwrite_set_message_raw(z, cryptmsg); 413 owl_zwrite_set_opcode(z, "crypt"); 414 415 owl_zwrite_send_message(z); 437 416 owl_function_makemsg("Waiting for ack..."); 438 417 439 418 /* If it's personal */ 440 if (owl_zwrite_is_personal( &z)) {441 /* create the outgoing message*/442 mymsg=owl_zwrite_get_message(&z);443 m=owl_function_make_outgoing_zephyr( mymsg, line, owl_zwrite_get_zsig(&z));419 if (owl_zwrite_is_personal(z)) { 420 /* Create the outgoing message. Restore the un-crypted message for display. */ 421 owl_zwrite_set_message_raw(z, old_msg); 422 m=owl_function_make_outgoing_zephyr(z); 444 423 if (m) { 445 424 owl_global_messagequeue_addmsg(&g, m); … … 451 430 /* free the zwrite */ 452 431 owl_free(cryptmsg); 453 owl_zwrite_cleanup(&z);454 432 } 455 433 -
global.c
r8bba1ae r8bba1ae 19 19 char hostname[MAXHOSTNAMELEN]; 20 20 char *cd; 21 22 g->malloced=0;23 g->freed=0;24 21 25 22 g_type_init(); … … 955 952 g->interrupted = 0; 956 953 } 954 955 void owl_global_setup_default_filters(owl_global *g) 956 { 957 int i; 958 static const struct { 959 const char *name; 960 const char *desc; 961 } filters[] = { 962 { "personal", 963 "isprivate ^true$ and ( not type ^zephyr$ or ( class ^message ) )" }, 964 { "trash", 965 "class ^mail$ or opcode ^ping$ or type ^admin$ or ( not login ^none$ )" }, 966 { "wordwrap", "not ( type ^admin$ or type ^zephyr$ )" }, 967 { "ping", "opcode ^ping$" }, 968 { "auto", "opcode ^auto$" }, 969 { "login", "not login ^none$" }, 970 { "reply-lockout", "class ^noc or class ^mail$" }, 971 { "out", "direction ^out$" }, 972 { "aim", "type ^aim$" }, 973 { "zephyr", "type ^zephyr$" }, 974 { "none", "false" }, 975 { "all", "true" }, 976 { NULL, NULL } 977 }; 978 979 owl_function_debugmsg("startup: creating default filters"); 980 981 for (i = 0; filters[i].name != NULL; i++) 982 owl_global_add_filter(g, owl_filter_new_fromstring(filters[i].name, 983 filters[i].desc)); 984 } -
owl.c
r0be3efd r0be3efd 149 149 } 150 150 151 static void owl_setup_default_filters(void)152 {153 int i;154 static const struct {155 const char *name;156 const char *desc;157 } filters[] = {158 { "personal",159 "isprivate ^true$ and ( not type ^zephyr$ or ( class ^message ) )" },160 { "trash",161 "class ^mail$ or opcode ^ping$ or type ^admin$ or ( not login ^none$ )" },162 { "wordwrap", "not ( type ^admin$ or type ^zephyr$ )" },163 { "ping", "opcode ^ping$" },164 { "auto", "opcode ^auto$" },165 { "login", "not login ^none$" },166 { "reply-lockout", "class ^noc or class ^mail$" },167 { "out", "direction ^out$" },168 { "aim", "type ^aim$" },169 { "zephyr", "type ^zephyr$" },170 { "none", "false" },171 { "all", "true" },172 { NULL, NULL }173 };174 175 owl_function_debugmsg("startup: creating default filters");176 177 for (i = 0; filters[i].name != NULL; i++)178 owl_global_add_filter(&g, owl_filter_new_fromstring(filters[i].name,179 filters[i].desc));180 }181 151 182 152 /* … … 544 514 owl_global_complete_setup(&g); 545 515 546 owl_ setup_default_filters();516 owl_global_setup_default_filters(&g); 547 517 548 518 /* set the current view */ -
owl.h
r5cc7e5e r987cf3f 347 347 348 348 typedef struct _owl_zwrite { 349 char *cmd; 349 350 char *zwriteline; 350 351 char *class; … … 613 614 owl_colorpair_mgr cpmgr; 614 615 pid_t newmsgproc_pid; 615 int malloced, freed;616 616 owl_regex search_re; 617 617 aim_session_t aimsess; -
perl/modules/Jabber/lib/BarnOwl/Message/Jabber.pm
r8278543 r2f25537 20 20 sub to { shift->{to} }; 21 21 sub room { shift->{room} }; 22 sub nick { shift->{nick} }; 22 23 sub subject { shift->{subject} }; 23 24 sub status { shift->{status} } … … 41 42 sub long_sender { 42 43 my $self = shift; 44 if ($self->jtype eq 'groupchat' && $self->nick) { 45 my $from_jid = Net::Jabber::JID->new($self->from); 46 if ($from_jid->GetJID('base') eq $self->room && 47 $from_jid->GetResource() eq $self->nick) { 48 return $self->nick; 49 } 50 } 43 51 return $self->from; 44 52 } -
perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
raa0a0b5 r2f25537 1241 1241 $muc = $connection->FindMUC(jid => $to); 1242 1242 } 1243 $props{from} = $muc->GetFullJID($from) || $ nick || $room;1243 $props{from} = $muc->GetFullJID($from) || $props{from}; 1244 1244 $props{sender} = $nick || $room; 1245 1245 $props{recipient} = $room; -
perl/modules/Twitter/.gitignore
r40def31a rd27ecf3 1 1 *~ 2 2 blib/ 3 inc/4 3 META.yml 5 4 Makefile 6 5 Twitter.par 7 6 pm_to_blib 7 inc/.author -
perl/modules/Twitter/lib/BarnOwl/Message/Twitter.pm
rf6413c3 r5d59c1e 17 17 sub service { return (shift->{"service"} || "http://twitter.com"); } 18 18 sub account { return shift->{"account"}; } 19 sub retweeted_by { shift->{retweeted_by}; } 19 20 sub long_sender { 20 21 my $self = shift; 21 22 $self->service =~ m#^\s*(.*?://.*?)/.*$#; 22 23 my $service = $1 || $self->service; 23 return $service . '/' . $self->sender 24 my $long = $service . '/' . $self->sender; 25 if ($self->retweeted_by) { 26 $long = "(retweeted by " . $self->retweeted_by . ") $long"; 27 } 28 return $long; 24 29 } 25 30 -
perl/modules/Twitter/lib/BarnOwl/Module/Twitter/Handle.pm
ra2640485 r5d59c1e 248 248 next; 249 249 } 250 my $orig = $tweet->{retweeted_status}; 251 $orig = $tweet unless defined($orig); 252 250 253 my $msg = BarnOwl::Message->new( 251 254 type => 'Twitter', 252 sender => $ tweet->{user}{screen_name},255 sender => $orig->{user}{screen_name}, 253 256 recipient => $self->{cfg}->{user} || $self->{user}, 254 257 direction => 'in', 255 source => decode_entities($ tweet->{source}),256 location => decode_entities($ tweet->{user}{location}||""),257 body => decode_entities($ tweet->{text}),258 source => decode_entities($orig->{source}), 259 location => decode_entities($orig->{user}{location}||""), 260 body => decode_entities($orig->{text}), 258 261 status_id => $tweet->{id}, 259 262 service => $self->{cfg}->{service}, 260 263 account => $self->{cfg}->{account_nickname}, 264 $tweet->{retweeted_status} ? (retweeted_by => $tweet->{user}{screen_name}) : () 261 265 ); 262 266 BarnOwl::queue_message($msg); -
perlconfig.c
r3aa0522 r5aa33fd 12 12 /* extern XS(boot_DBI); */ 13 13 14 static void owl_perl_xs_init(pTHX) 14 void owl_perl_xs_init(pTHX) /* noproto */ 15 15 { 16 16 const char *file = __FILE__; … … 363 363 perl_construct(p); 364 364 365 PL_exit_flags |= PERL_EXIT_DESTRUCT_END; 366 365 367 owl_global_set_no_have_config(&g); 366 368 -
runtests.sh
r9f026c1 r5aa33fd 1 1 #!/bin/sh 2 HARNESS_PERL=./perl_tester exec prove t/ 2 SRCDIR=`dirname "${0}"` 3 4 export BARNOWL_DATA_DIR="$SRCDIR/perl/" 5 export BARNOWL_BIN_DIR="$SRCDIR/" 6 7 HARNESS_PERL=./tester exec prove t/ -
t/00-core-tests.t
r1cf3f8d3 r95414bf 1 1 #!/usr/bin/env perl 2 2 use File::Basename; 3 system(dirname($0) . "/../tester" );3 system(dirname($0) . "/../tester", "--builtin"); -
t/mock.pl
r42ad917 r5aa33fd 1 use File::Basename;2 use lib (dirname($0) . '/../perl/lib');3 4 1 package BarnOwl; 5 2 use strict; 6 3 use warnings; 7 use Carp;8 4 9 sub get_data_dir {"."} 10 sub get_config_dir {"."} 11 sub create_style {} 12 13 sub debug { 5 no warnings 'redefine'; 6 sub debug($) { 14 7 warn "[DEBUG] ", shift, "\n" if $ENV{TEST_VERBOSE}; 15 8 } 16 9 17 sub BarnOwl::Internal::new_command {}18 sub BarnOwl::Internal::new_variable_bool {}19 sub BarnOwl::Internal::new_variable_int {}20 sub BarnOwl::Internal::new_variable_string {}21 sub BarnOwl::Editwin::save_excursion(&) {}22 23 use BarnOwl;24 25 10 1; -
tester.c
r3f6555d r95414bf 1 #define OWL_PERL 2 #define WINDOW FAKE_WINDOW 1 3 #include "owl.h" 4 #undef WINDOW 5 2 6 #include <unistd.h> 3 7 #include <stdlib.h> 4 8 9 #undef instr 10 #include <curses.h> 11 5 12 owl_global g; 6 13 7 14 int numtests; 8 15 16 int owl_regtest(void); 9 17 int owl_util_regtest(void); 10 18 int owl_dict_regtest(void); … … 14 22 int owl_editwin_regtest(void); 15 23 24 extern void owl_perl_xs_init(pTHX); 25 16 26 int main(int argc, char **argv, char **env) 17 27 { 28 FILE *rnull; 29 FILE *wnull; 30 char *perlerr; 31 int status = 0; 32 33 if (argc <= 1) { 34 fprintf(stderr, "Usage: %s --builtin|TEST.t|-le CODE\n", argv[0]); 35 return 1; 36 } 37 18 38 /* initialize a fake ncurses, detached from std{in,out} */ 19 FILE *rnull = fopen("/dev/null", "r");20 FILE *wnull = fopen("/dev/null", "w");39 wnull = fopen("/dev/null", "w"); 40 rnull = fopen("/dev/null", "r"); 21 41 newterm("xterm", wnull, rnull); 22 42 /* initialize global structures */ 23 43 owl_global_init(&g); 24 44 45 perlerr = owl_perlconfig_initperl(NULL, &argc, &argv, &env); 46 if (perlerr) { 47 endwin(); 48 fprintf(stderr, "Internal perl error: %s\n", perlerr); 49 status = 1; 50 goto out; 51 } 52 53 owl_global_complete_setup(&g); 54 owl_global_setup_default_filters(&g); 55 56 owl_view_create(owl_global_get_current_view(&g), "main", 57 owl_global_get_filter(&g, "all"), 58 owl_global_get_style_by_name(&g, "default")); 59 60 owl_function_firstmsg(); 61 62 ENTER; 63 SAVETMPS; 64 65 if (strcmp(argv[1], "--builtin") == 0) { 66 status = owl_regtest(); 67 } else if (strcmp(argv[1], "-le") == 0 && argc > 2) { 68 /* 69 * 'prove' runs its harness perl with '-le CODE' to get some 70 * information out. 71 */ 72 moreswitches("l"); 73 eval_pv(argv[2], true); 74 } else { 75 sv_setpv(get_sv("0", false), argv[1]); 76 sv_setpv(get_sv("main::test_prog", TRUE), argv[1]); 77 78 eval_pv("do $main::test_prog; die($@) if($@)", true); 79 } 80 81 status = 0; 82 83 FREETMPS; 84 LEAVE; 85 86 out: 87 perl_destruct(owl_global_get_perlinterp(&g)); 88 perl_free(owl_global_get_perlinterp(&g)); 89 /* probably not necessary, but tear down the screen */ 90 endwin(); 91 fclose(rnull); 92 fclose(wnull); 93 return status; 94 } 95 96 int owl_regtest(void) { 25 97 numtests = 0; 26 98 int numfailures=0; … … 38 110 } 39 111 printf("1..%d\n", numtests); 40 41 /* probably not necessary, but tear down the screen */42 endwin();43 fclose(rnull);44 fclose(wnull);45 112 46 113 return(numfailures); -
zcrypt.c
r60fcd71 r3c2c7fc 88 88 89 89 cipher_pair ciphers[NCIPHER] = { 90 [CIPHER_DES] { do_encrypt_des, do_decrypt_des},91 [CIPHER_AES] { do_encrypt_aes, do_decrypt_aes},90 [CIPHER_DES] = { do_encrypt_des, do_decrypt_des}, 91 [CIPHER_AES] = { do_encrypt_aes, do_decrypt_aes}, 92 92 }; 93 93 … … 113 113 int mode = M_NONE; 114 114 115 extern int optind, opterr;116 extern char *optarg;117 115 char c; 118 116 -
zephyr.c
r922f589 r987cf3f 852 852 char *tmpbuff, *myuser, *to; 853 853 owl_message *mout; 854 owl_zwrite *z; 854 855 855 856 /* bail if it doesn't look like a message we should reply to. Some … … 887 888 owl_free(to); 888 889 890 z = owl_zwrite_new(tmpbuff); 891 owl_zwrite_set_message(z, owl_global_get_zaway_msg(&g)); 892 owl_zwrite_set_zsig(z, "Automated reply:"); 893 889 894 /* display the message as an admin message in the receive window */ 890 mout=owl_function_make_outgoing_zephyr( owl_global_get_zaway_msg(&g), tmpbuff, "Automated reply:");895 mout=owl_function_make_outgoing_zephyr(z); 891 896 owl_global_messagequeue_addmsg(&g, mout); 892 897 owl_free(tmpbuff); 898 owl_zwrite_delete(z); 893 899 #endif 894 900 } -
zwrite.c
rc230bc1 r7bfc613 5 5 #include "owl.h" 6 6 7 owl_zwrite *owl_zwrite_new(const char *line) 8 { 9 owl_zwrite *z = owl_malloc(sizeof *z); 10 if (owl_zwrite_create_from_line(z, line) < 0) { 11 owl_zwrite_delete(z); 12 return NULL; 13 } 14 return z; 15 } 16 7 17 int owl_zwrite_create_from_line(owl_zwrite *z, const char *line) 8 18 { … … 15 25 16 26 /* start with null entries */ 27 z->cmd=NULL; 17 28 z->realm=NULL; 18 29 z->class=NULL; … … 35 46 myargc=argc; 36 47 if (myargc && *(myargv[0])!='-') { 48 z->cmd=owl_strdup(myargv[0]); 37 49 myargc--; 38 50 myargv++; … … 187 199 } 188 200 201 /* Set the message with no post-processing*/ 202 void owl_zwrite_set_message_raw(owl_zwrite *z, const char *msg) 203 { 204 if (z->message) owl_free(z->message); 205 z->message = owl_validate_utf8(msg); 206 } 207 189 208 void owl_zwrite_set_message(owl_zwrite *z, const char *msg) 190 209 { … … 350 369 } 351 370 371 void owl_zwrite_delete(owl_zwrite *z) 372 { 373 owl_zwrite_cleanup(z); 374 owl_free(z); 375 } 376 352 377 void owl_zwrite_cleanup(owl_zwrite *z) 353 378 {
Note: See TracChangeset
for help on using the changeset viewer.