Changeset 93ee554
- Timestamp:
- Dec 23, 2007, 7:52:17 PM (17 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 5bc0f68
- Parents:
- 34509d5 (diff), 78667f3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 1 added
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile.in
r702aee7 r2bdfed9 45 45 #AUTOGEN=$(GEN_C) 46 46 47 HEADERS=$(GEN_H) owl.h config.h 47 HEADERS=$(GEN_H) owl.h config.h test.h 48 48 49 49 %.o: %.c $(HEADERS) … … 127 127 ${INSTALL} -d ${DESTDIR}${datadir}/lib 128 128 ${INSTALL} -d ${DESTDIR}${datadir}/modules 129 tar -C perl/lib --exclude .svn -c . | tar -C ${DESTDIR}${datadir}/lib -x129 tar -C perl/lib --exclude .svn -cf - . | tar -C ${DESTDIR}${datadir}/lib -xf - 130 130 for i in $(PERL_MODULES); do \ 131 131 ${INSTALL_DATA} perl/modules/$$i/$$i.par ${DESTDIR}${datadir}/modules/$$i.par; \ -
commands.c
r987ff51 rfa4f9c3 132 132 OWLCMD_ARGS("aimwrite", owl_command_aimwrite, OWL_CTX_INTERACTIVE, 133 133 "send an AIM message", 134 "aimzwrite <user>", 135 "Send an aim message to a user.\n"), 134 "aimwrite <user> [-m <message...>]", 135 "Send an aim message to a user.\n\n" 136 "The following options are available:\n\n" 137 "-m Specifies a message to send without prompting.\n"), 136 138 137 139 OWLCMD_ARGS("loopwrite", owl_command_loopwrite, OWL_CTX_INTERACTIVE, … … 280 282 "suppressed to be received again.\n\n" 281 283 "SEE ALSO: zpunt, show zpunts\n"), 284 285 OWLCMD_ARGS("punt", owl_command_punt, OWL_CTX_ANY, 286 "suppress an arbitrary filter", 287 "punt <filter-name>", 288 "punt <filter-text (multiple words)>\n" 289 "The punt command will supress message to the specified\n" 290 "filter\n\n" 291 "SEE ALSO: unpunt, zpunt, show zpunts\n"), 292 293 OWLCMD_ARGS("unpunt", owl_command_unpunt, OWL_CTX_ANY, 294 "remove an entry from the punt list", 295 "zpunt <filter-name>\n" 296 "zpunt <filter-text>\n" 297 "zpunt <number>\n", 298 "The unpunt command will remove an entry from the puntlist.\n" 299 "The first two forms correspond to the first two forms of the :punt\n" 300 "command. The latter allows you to remove a specific entry from the\n" 301 "the list (see :show zpunts)\n\n" 302 "SEE ALSO: punt, zpunt, zunpunt, show zpunts\n"), 282 303 283 304 OWLCMD_VOID("info", owl_command_info, OWL_CTX_INTERACTIVE, … … 1867 1888 char *owl_command_aimwrite(int argc, char **argv, char *buff) 1868 1889 { 1869 char *newbuff; 1870 int i, j; 1890 char *newbuff, *recip, **myargv; 1891 int i, j, myargc; 1892 owl_message *m; 1871 1893 1872 1894 if (!owl_global_is_aimloggedin(&g)) { … … 1878 1900 owl_function_makemsg("Not enough arguments to the aimwrite command."); 1879 1901 return(NULL); 1902 } 1903 1904 myargv=argv; 1905 if (argc<0) { 1906 owl_function_error("Unbalanced quotes in aimwrite"); 1907 return(NULL); 1908 } 1909 myargc=argc; 1910 if (myargc && *(myargv[0])!='-') { 1911 myargc--; 1912 myargv++; 1913 } 1914 while (myargc) { 1915 if (!strcmp(myargv[0], "-m")) { 1916 if (myargc<2) { 1917 break; 1918 } 1919 1920 /* Once we have -m, gobble up everything else on the line */ 1921 myargv++; 1922 myargc--; 1923 newbuff=owl_malloc(1); 1924 newbuff=owl_strdup(""); 1925 while (myargc) { 1926 newbuff=realloc(newbuff, strlen(newbuff)+strlen(myargv[0])+5); 1927 strcat(newbuff, myargv[0]); 1928 strcat(newbuff, " "); 1929 myargc--; 1930 myargv++; 1931 } 1932 newbuff[strlen(newbuff)-1]='\0'; /* remove last space */ 1933 1934 recip=owl_malloc(strlen(argv[0])+5); 1935 sprintf(recip, "%s ", argv[1]); 1936 owl_aim_send_im(recip, newbuff); 1937 m=owl_function_make_outgoing_aim(newbuff, recip); 1938 if (m) { 1939 owl_global_messagequeue_addmsg(&g, m); 1940 } else { 1941 owl_function_error("Could not create outgoing AIM message"); 1942 } 1943 1944 owl_free(recip); 1945 owl_free(newbuff); 1946 return(NULL); 1947 } else { 1948 /* we don't care */ 1949 myargv++; 1950 myargc--; 1951 } 1880 1952 } 1881 1953 … … 2142 2214 char *filename; 2143 2215 2144 filename=owl_ sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);2216 filename=owl_global_get_startupfile(&g); 2145 2217 owl_function_popless_file(filename); 2146 owl_free(filename);2147 2218 } else if (!strcmp(argv[1], "errors")) { 2148 2219 owl_function_showerrs(); … … 2294 2365 return NULL; 2295 2366 } 2296 2297 2367 2298 2368 void owl_command_zpunt_and_zunpunt(int argc, char **argv, int type) … … 2345 2415 } 2346 2416 2417 char *owl_command_punt(int argc, char **argv, char *buff) 2418 { 2419 owl_command_punt_unpunt(argc, argv, buff, 0); 2420 return NULL; 2421 } 2422 2423 char *owl_command_unpunt(int argc, char **argv, char *buff) 2424 { 2425 owl_command_punt_unpunt(argc, argv, buff, 1); 2426 return NULL; 2427 } 2428 2429 void owl_command_punt_unpunt(int argc, char ** argv, char *buff, int unpunt) 2430 { 2431 owl_list * fl; 2432 owl_filter * f; 2433 char * text; 2434 int i; 2435 2436 fl = owl_global_get_puntlist(&g); 2437 if(argc == 1) { 2438 owl_function_show_zpunts(); 2439 } 2440 2441 if(argc == 2) { 2442 /* Handle :unpunt <number> */ 2443 if(unpunt && (i=atoi(argv[1])) !=0) { 2444 i--; /* Accept 1-based indexing */ 2445 if(i < owl_list_get_size(fl)) { 2446 f = (owl_filter*)owl_list_get_element(fl, i); 2447 owl_list_remove_element(fl, i); 2448 owl_filter_free(f); 2449 return; 2450 } else { 2451 owl_function_error("No such filter number: %d", i+1); 2452 } 2453 } 2454 text = owl_sprintf("filter %s", argv[1]); 2455 } else { 2456 text = skiptokens(buff, 1); 2457 } 2458 2459 owl_function_punt(text, unpunt); 2460 } 2461 2462 2347 2463 char *owl_command_getview(int argc, char **argv, char *buff) 2348 2464 { … … 2469 2585 owl_message *m; 2470 2586 owl_view *v; 2587 char *cmd; 2471 2588 2472 2589 v = owl_global_get_current_view(&g); … … 2487 2604 return; 2488 2605 } 2489 c har * cmd = owl_message_get_attribute_value(m, "yescommand");2606 cmd = owl_message_get_attribute_value(m, "yescommand"); 2490 2607 if(!cmd) { 2491 2608 owl_function_error("No yes command!"); … … 2502 2619 owl_message *m; 2503 2620 owl_view *v; 2621 char *cmd; 2504 2622 2505 2623 v = owl_global_get_current_view(&g); … … 2520 2638 return; 2521 2639 } 2522 c har * cmd = owl_message_get_attribute_value(m, "nocommand");2640 cmd = owl_message_get_attribute_value(m, "nocommand"); 2523 2641 if(!cmd) { 2524 2642 owl_function_error("No no command!"); -
configure.in
r34509d5 r93ee554 33 33 34 34 dnl Check for kerberosIV include 35 AC_MSG_CHECKING(for /usr/include/kerberosIV)35 AC_MSG_CHECKING(for kerberosIV) 36 36 if test -d /usr/include/kerberosIV; then 37 37 CFLAGS=${CFLAGS}\ -I/usr/include/kerberosIV 38 38 CPPFLAGS=${CPPFLAGS}\ -I/usr/include/kerberosIV 39 AC_MSG_RESULT(yes) 40 elif test -d /usr/local/include/kerberosIV; then 41 CFLAGS=${CFLAGS}\ -I/usr/local/include/kerberosIV 42 CPPFLAGS=${CPPFLAGS}\ -I/usr/local/include/kerberosIV 39 43 AC_MSG_RESULT(yes) 40 44 else … … 102 106 fi 103 107 104 dnl Add LDFLAGS for embed ed perl108 dnl Add LDFLAGS for embedded perl 105 109 FOO=`perl -MExtUtils::Embed -e ldopts` 106 110 echo Adding perl LDFLAGS ${FOO} … … 117 121 118 122 dnl Checks for typedefs, structures, and compiler characteristics. 119 AC_CHECK_FILE(/usr/share/terminfo, AC_DEFINE(TERMINFO, "/usr/share/terminfo", [Have terminfo]),120 AC_CHECK_FILE(/usr/share/lib/terminfo, AC_DEFINE(TERMINFO, "/usr/share/lib/terminfo", [Have terminfo]),121 AC_MSG_ERROR(No terminfo found for this system)))122 123 123 124 AC_SUBST(XSUBPPDIR) -
debian/control
r8d1a33f rc7172b3 3 3 Priority: optional 4 4 Maintainer: Sam Hartman <hartmans@debian.org> 5 Build-Depends: debhelper (>> 4.0.0), libzephyr-dev (>= 2.1.20010518.SNAPSHOT-7), libncurses5-dev, libkrb5-dev, libperl-dev 5 Build-Depends: debhelper (>> 4.0.0), libzephyr-dev (>= 2.1.20010518.SNAPSHOT-7), libncurses5-dev, libkrb5-dev, libperl-dev, zip 6 6 Standards-Version: 3.5.2 7 7 … … 12 12 Description: A curses-based tty Jabber and Zephyr client. 13 13 An alternative standalone (doesn't use zwgc) Zephyr (instant 14 messaging) client. Also supports Jabber.14 messaging) client. Also supports AIM and Jabber. 15 15 Much of the functionality is written in Perl, which is supported as 16 16 an extension language. 17 17 . 18 ktools software -- The 'k' is for Quality!18 This is a fork of ktools software's owl Zephyr/AIM client -
dict.c
r0138478 r1cf3f8d3 152 152 char *av="aval", *bv="bval", *cv="cval", *dv="dval"; 153 153 154 printf(" BEGIN testing owl_dict\n");154 printf("# BEGIN testing owl_dict\n"); 155 155 FAIL_UNLESS("create", 0==owl_dict_create(&d)); 156 156 FAIL_UNLESS("insert b", 0==owl_dict_insert_element(&d, "b", (void*)bv, owl_dict_noop_free)); … … 179 179 owl_dict_free_all(&d, NULL); 180 180 181 if (numfailed) printf("*** WARNING: failures encountered with owl_dict\n");182 printf(" END testing owl_dict (%d failures)\n", numfailed);181 // if (numfailed) printf("*** WARNING: failures encountered with owl_dict\n"); 182 printf("# END testing owl_dict (%d failures)\n", numfailed); 183 183 return(numfailed); 184 184 } -
filter.c
rd791cdb rad15610 63 63 static owl_filterelement * owl_filter_parse_primitive_expression(int argc, char **argv, int *next) 64 64 { 65 owl_filterelement *fe, *op; 66 int i = 0, skip; 67 65 68 if(!argc) return NULL; 66 69 67 owl_filterelement * fe = owl_malloc(sizeof(owl_filterelement)); 68 owl_filterelement *op; 69 70 fe = owl_malloc(sizeof(owl_filterelement)); 70 71 owl_filterelement_create(fe); 71 int i = 0, skip;72 72 73 73 if(!strcasecmp(argv[i], "(")) { … … 118 118 { 119 119 int i = 0, skip; 120 owl_filterelement * op1 = NULL, * op2 = NULL ;120 owl_filterelement * op1 = NULL, * op2 = NULL, *tmp; 121 121 122 122 op1 = owl_filter_parse_primitive_expression(argc-i, argv+i, &skip); … … 129 129 op2 = owl_filter_parse_primitive_expression(argc-i-1, argv+i+1, &skip); 130 130 if(!op2) goto err; 131 owl_filterelement *tmp = owl_malloc(sizeof(owl_filterelement));131 tmp = owl_malloc(sizeof(owl_filterelement)); 132 132 if(!strcasecmp(argv[i], "and")) { 133 133 owl_filterelement_create_and(tmp, op1, op2); … … 204 204 int owl_filter_message_match(owl_filter *f, owl_message *m) 205 205 { 206 int ret; 206 207 if(!f->root) return 0; 207 intret = owl_filterelement_match(f->root, m);208 ret = owl_filterelement_match(f->root, m); 208 209 if(f->polarity) ret = !ret; 209 210 return ret; … … 283 284 int failed = 0; 284 285 if(owl_filter_init_fromstring(&f, "test-filter", filt)) { 285 printf(" \tFAIL:parse %s\n", filt);286 printf("not ok can't parse %s\n", filt); 286 287 failed = 1; 287 288 goto out; … … 289 290 ok = owl_filter_message_match(&f, m); 290 291 if((shouldmatch && !ok) || (!shouldmatch && ok)) { 291 printf(" \tFAIL:match %s (got %d, expected %d)\n", filt, ok, shouldmatch);292 printf("not ok match %s (got %d, expected %d)\n", filt, ok, shouldmatch); 292 293 failed = 1; 293 294 } … … 295 296 owl_filter_free(&f); 296 297 if(!failed) { 297 printf(" \tok :%s %s\n", shouldmatch ? "matches" : "doesn't match", filt);298 printf("ok %s %s\n", shouldmatch ? "matches" : "doesn't match", filt); 298 299 } 299 300 return failed; … … 305 306 306 307 int owl_filter_regtest(void) { 307 owl_list_create(&(g.filterlist));308 308 int numfailed=0; 309 309 owl_message m; 310 owl_filter f1, f2, f3, f4; 311 312 owl_list_create(&(g.filterlist)); 310 313 owl_message_init(&m); 311 314 owl_message_set_type_zephyr(&m); … … 345 348 TEST_FILTER("true and false or false", 0); 346 349 347 owl_filter f1, f2, f3, f4;348 349 350 owl_filter_init_fromstring(&f1, "f1", "class owl"); 350 351 owl_global_add_filter(&g, &f1); -
functions.c
r34509d5 r93ee554 580 580 581 581 if (i>owl_view_get_size(v)-1) i=owl_view_get_size(v)-1; 582 if (i<0) i=0; 582 583 583 584 if (!found) { … … 848 849 { 849 850 int ret, ret2; 850 char *foo ;851 char *foo, *path; 851 852 852 853 if (file==NULL) { 853 854 ret=owl_zephyr_loadsubs(NULL, 0); 854 855 } else { 855 ret=owl_zephyr_loadsubs(file, 1); 856 path = owl_util_makepath(file); 857 ret=owl_zephyr_loadsubs(path, 1); 858 free(path); 856 859 } 857 860 … … 2057 2060 /* if it's a zephyr we sent, send it out the same way again */ 2058 2061 if (owl_message_is_direction_out(m)) { 2059 owl_function_zwrite_setup(owl_message_get_zwriteline(m)); 2060 owl_global_set_buffercommand(&g, owl_message_get_zwriteline(m)); 2061 return; 2062 buff = owl_strdup(owl_message_get_zwriteline(m)); 2063 } else { 2064 2065 /* Special case a personal reply to a webzephyr user on a class */ 2066 if ((type==1) && !strcasecmp(owl_message_get_opcode(m), OWL_WEBZEPHYR_OPCODE)) { 2067 class=OWL_WEBZEPHYR_CLASS; 2068 inst=owl_message_get_sender(m); 2069 to=OWL_WEBZEPHYR_PRINCIPAL; 2070 } else if (!strcasecmp(owl_message_get_class(m), OWL_WEBZEPHYR_CLASS) && owl_message_is_loginout(m)) { 2071 /* Special case LOGIN/LOGOUT notifications on class "webzephyr" */ 2072 class=OWL_WEBZEPHYR_CLASS; 2073 inst=owl_message_get_instance(m); 2074 to=OWL_WEBZEPHYR_PRINCIPAL; 2075 } else if (owl_message_is_loginout(m)) { 2076 /* Normal LOGIN/LOGOUT messages */ 2077 class="MESSAGE"; 2078 inst="PERSONAL"; 2079 to=owl_message_get_sender(m); 2080 } else if (type==1) { 2081 /* Personal reply */ 2082 class="MESSAGE"; 2083 inst="PERSONAL"; 2084 to=owl_message_get_sender(m); 2085 } else { 2086 /* General reply */ 2087 class=owl_message_get_class(m); 2088 inst=owl_message_get_instance(m); 2089 to=owl_message_get_recipient(m); 2090 cc=owl_message_get_cc_without_recipient(m); 2091 if (!strcmp(to, "") || !strcmp(to, "*")) { 2092 to=""; 2093 } else if (to[0]=='@') { 2094 /* leave it, to get the realm */ 2095 } else { 2096 to=owl_message_get_sender(m); 2097 } 2098 } 2099 2100 /* create the command line */ 2101 if (!strcasecmp(owl_message_get_opcode(m), "CRYPT")) { 2102 buff=owl_strdup("zcrypt"); 2103 } else { 2104 buff = owl_strdup("zwrite"); 2105 } 2106 if (strcasecmp(class, "message")) { 2107 buff = owl_sprintf("%s -c %s%s%s", oldbuff=buff, owl_getquoting(class), class, owl_getquoting(class)); 2108 owl_free(oldbuff); 2109 } 2110 if (strcasecmp(inst, "personal")) { 2111 buff = owl_sprintf("%s -i %s%s%s", oldbuff=buff, owl_getquoting(inst), inst, owl_getquoting(inst)); 2112 owl_free(oldbuff); 2113 } 2114 if (*to != '\0') { 2115 char *tmp, *oldtmp, *tmp2; 2116 tmp=short_zuser(to); 2117 if (cc) { 2118 tmp = owl_util_uniq(oldtmp=tmp, cc, "-"); 2119 owl_free(oldtmp); 2120 buff = owl_sprintf("%s -C %s", oldbuff=buff, tmp); 2121 owl_free(oldbuff); 2122 } else { 2123 if (owl_global_is_smartstrip(&g)) { 2124 tmp2=tmp; 2125 tmp=owl_zephyr_smartstripped_user(tmp2); 2126 owl_free(tmp2); 2127 } 2128 buff = owl_sprintf("%s %s", oldbuff=buff, tmp); 2129 owl_free(oldbuff); 2130 } 2131 owl_free(tmp); 2132 } 2133 if (cc) owl_free(cc); 2062 2134 } 2063 2064 /* Special case a personal reply to a webzephyr user on a class */2065 if ((type==1) && !strcasecmp(owl_message_get_opcode(m), OWL_WEBZEPHYR_OPCODE)) {2066 class=OWL_WEBZEPHYR_CLASS;2067 inst=owl_message_get_sender(m);2068 to=OWL_WEBZEPHYR_PRINCIPAL;2069 } else if (!strcasecmp(owl_message_get_class(m), OWL_WEBZEPHYR_CLASS) && owl_message_is_loginout(m)) {2070 /* Special case LOGIN/LOGOUT notifications on class "webzephyr" */2071 class=OWL_WEBZEPHYR_CLASS;2072 inst=owl_message_get_instance(m);2073 to=OWL_WEBZEPHYR_PRINCIPAL;2074 } else if (owl_message_is_loginout(m)) {2075 /* Normal LOGIN/LOGOUT messages */2076 class="MESSAGE";2077 inst="PERSONAL";2078 to=owl_message_get_sender(m);2079 } else if (type==1) {2080 /* Personal reply */2081 class="MESSAGE";2082 inst="PERSONAL";2083 to=owl_message_get_sender(m);2084 } else {2085 /* General reply */2086 class=owl_message_get_class(m);2087 inst=owl_message_get_instance(m);2088 to=owl_message_get_recipient(m);2089 cc=owl_message_get_cc_without_recipient(m);2090 if (!strcmp(to, "") || !strcmp(to, "*")) {2091 to="";2092 } else if (to[0]=='@') {2093 /* leave it, to get the realm */2094 } else {2095 to=owl_message_get_sender(m);2096 }2097 }2098 2099 /* create the command line */2100 if (!strcasecmp(owl_message_get_opcode(m), "CRYPT")) {2101 buff=owl_strdup("zcrypt");2102 } else {2103 buff = owl_strdup("zwrite");2104 }2105 if (strcasecmp(class, "message")) {2106 buff = owl_sprintf("%s -c %s%s%s", oldbuff=buff, owl_getquoting(class), class, owl_getquoting(class));2107 owl_free(oldbuff);2108 }2109 if (strcasecmp(inst, "personal")) {2110 buff = owl_sprintf("%s -i %s%s%s", oldbuff=buff, owl_getquoting(inst), inst, owl_getquoting(inst));2111 owl_free(oldbuff);2112 }2113 if (*to != '\0') {2114 char *tmp, *oldtmp, *tmp2;2115 tmp=short_zuser(to);2116 if (cc) {2117 tmp = owl_util_uniq(oldtmp=tmp, cc, "-");2118 owl_free(oldtmp);2119 buff = owl_sprintf("%s -C %s", oldbuff=buff, tmp);2120 owl_free(oldbuff);2121 } else {2122 if (owl_global_is_smartstrip(&g)) {2123 tmp2=tmp;2124 tmp=owl_zephyr_smartstripped_user(tmp2);2125 owl_free(tmp2);2126 }2127 buff = owl_sprintf("%s %s", oldbuff=buff, tmp);2128 owl_free(oldbuff);2129 }2130 owl_free(tmp);2131 }2132 if (cc) owl_free(cc);2133 2135 } else if (owl_message_is_type_aim(m)) { 2134 2136 /* aim */ … … 2557 2559 for (i=0; i<j; i++) { 2558 2560 f=owl_list_get_element(fl, i); 2561 snprintf(buff, sizeof(buff), "[% 2d] ", i+1); 2562 owl_fmtext_append_normal(&fm, buff); 2559 2563 owl_filter_print(f, buff); 2560 2564 owl_fmtext_append_normal(&fm, buff); … … 2622 2626 sprintf(argbuff, "class ^(un)*%s(\\.d)*$", tmpclass); 2623 2627 if (tmpinstance) { 2624 sprintf(argbuff, "%s and ( instance ^ %s(\\.d)*$ )", argbuff, tmpinstance);2628 sprintf(argbuff, "%s and ( instance ^(un)*%s(\\.d)*$ )", argbuff, tmpinstance); 2625 2629 } 2626 2630 owl_free(tmpclass); … … 2670 2674 2671 2675 argbuff=owl_malloc(strlen(longuser)+1000); 2672 sprintf(argbuff, "( type ^zephyr$ and ( class ^message$ and instance ^personal$and ");2676 sprintf(argbuff, "( type ^zephyr$ and filter personal and "); 2673 2677 sprintf(argbuff, "%s ( ( direction ^in$ and sender ^%s$ ) or ( direction ^out$ and recipient ^%s$ ) ) )", argbuff, longuser, longuser); 2674 sprintf(argbuff, "%s or ( ( class ^login$ ) and ( sender ^%s$ ) ) )", argbuff, longuser);2678 sprintf(argbuff, "%s or ( ( class ^login$ ) and ( sender ^%s$ ) )", argbuff, longuser); 2675 2679 2676 2680 owl_filter_init_fromstring(f, filtname, argbuff); … … 2800 2804 owl_message *m; 2801 2805 char *zperson, *filtname=NULL; 2806 char *argv[1]; 2802 2807 2803 2808 v=owl_global_get_current_view(&g); … … 2831 2836 /* narrow personal and login messages to the sender or recip as appropriate */ 2832 2837 if (owl_message_is_type_zephyr(m)) { 2833 if (owl_message_is_p rivate(m) || owl_message_is_loginout(m)) {2838 if (owl_message_is_personal(m) || owl_message_is_loginout(m)) { 2834 2839 if (owl_message_is_direction_in(m)) { 2835 2840 zperson=short_zuser(owl_message_get_sender(m)); … … 2858 2863 2859 2864 /* pass it off to perl */ 2860 char *argv[1];2861 2865 if(type) { 2862 2866 argv[0] = "-i"; … … 3016 3020 void owl_function_zpunt(char *class, char *inst, char *recip, int direction) 3017 3021 { 3018 owl_filter *f;3019 owl_list *fl;3020 3022 char *buff; 3021 3023 char *quoted; 3022 int ret, i, j; 3023 3024 fl=owl_global_get_puntlist(&g); 3025 3026 /* first, create the filter */ 3027 f=owl_malloc(sizeof(owl_filter)); 3024 3028 3025 buff=owl_malloc(strlen(class)+strlen(inst)+strlen(recip)+100); 3029 3026 strcpy(buff, "class"); … … 3056 3053 owl_free(quoted); 3057 3054 } 3058 3059 owl_function_debugmsg("About to filter %s", buff); 3060 ret=owl_filter_init_fromstring(f, "punt-filter", buff); 3055 3056 owl_function_punt(buff, direction); 3061 3057 owl_free(buff); 3058 } 3059 3060 void owl_function_punt(char *filter, int direction) 3061 { 3062 owl_filter *f; 3063 owl_list *fl; 3064 int ret, i, j; 3065 fl=owl_global_get_puntlist(&g); 3066 3067 /* first, create the filter */ 3068 f=malloc(sizeof(owl_filter)); 3069 3070 owl_function_debugmsg("About to filter %s", filter); 3071 ret=owl_filter_init_fromstring(f, "punt-filter", filter); 3062 3072 if (ret) { 3063 3073 owl_function_error("Error creating filter for zpunt"); … … 3070 3080 for (i=0; i<j; i++) { 3071 3081 if (owl_filter_equiv(f, owl_list_get_element(fl, i))) { 3082 owl_function_debugmsg("found an equivalent punt filter"); 3072 3083 /* if we're punting, then just silently bow out on this duplicate */ 3073 3084 if (direction==0) { … … 3080 3091 owl_filter_free(owl_list_get_element(fl, i)); 3081 3092 owl_list_remove_element(fl, i); 3093 owl_filter_free(f); 3082 3094 return; 3083 3095 } … … 3085 3097 } 3086 3098 3099 owl_function_debugmsg("punting"); 3087 3100 /* If we're punting, add the filter to the global punt list */ 3088 3101 if (direction==0) { … … 3461 3474 char *filename; 3462 3475 3463 filename=owl_ sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);3476 filename=owl_global_get_startupfile(&g); 3464 3477 file=fopen(filename, "a"); 3465 3478 if (!file) { 3466 3479 owl_function_error("Error opening startupfile for new command"); 3467 owl_free(filename);3468 3480 return; 3469 3481 } … … 3471 3483 /* delete earlier copies */ 3472 3484 owl_util_file_deleteline(filename, buff, 1); 3473 owl_free(filename);3474 3485 3475 3486 /* add this line */ … … 3483 3494 { 3484 3495 char *filename; 3485 filename=owl_ sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);3496 filename=owl_global_get_startupfile(&g); 3486 3497 owl_util_file_deleteline(filename, buff, 1); 3487 owl_free(filename);3488 3498 } 3489 3499 … … 3497 3507 3498 3508 if (!filename) { 3499 filename=owl_ sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);3509 filename=owl_global_get_startupfile(&g); 3500 3510 file=fopen(filename, "r"); 3501 owl_free(filename);3502 3511 } else { 3503 3512 file=fopen(filename, "r"); -
global.c
r34509d5 r93ee554 18 18 struct hostent *hent; 19 19 char hostname[MAXHOSTNAMELEN]; 20 char *cd; 20 21 21 22 g->malloced=0; … … 86 87 g->homedir=owl_strdup(getenv("HOME")); 87 88 89 g->confdir = NULL; 90 g->startupfile = NULL; 91 cd = owl_sprintf("%s/%s", g->homedir, OWL_CONFIG_DIR); 92 owl_global_set_confdir(g, cd); 93 owl_free(cd); 94 88 95 owl_messagelist_create(&(g->msglist)); 89 96 owl_mainwin_init(&(g->mw)); … … 319 326 } 320 327 328 char *owl_global_get_confdir(owl_global *g) { 329 if (g->confdir) return(g->confdir); 330 return("/"); 331 } 332 333 /* 334 * Setting this also sets startupfile to confdir/startup 335 */ 336 void owl_global_set_confdir(owl_global *g, char *cd) { 337 free(g->confdir); 338 g->confdir = owl_strdup(cd); 339 free(g->startupfile); 340 g->startupfile = owl_sprintf("%s/startup", cd); 341 } 342 343 char *owl_global_get_startupfile(owl_global *g) { 344 if(g->startupfile) return(g->startupfile); 345 return("/"); 346 } 347 321 348 int owl_global_get_direction(owl_global *g) { 322 349 return(g->direction); -
keys.c
r51c57f8 r8938188 180 180 BIND_CMD("M-<", "popless:scroll-to-top", ""); 181 181 182 BIND_CMD("END", "popless:scroll-to-bottom", ""); 182 183 BIND_CMD(">", "popless:scroll-to-bottom", ""); 183 184 BIND_CMD("M->", "popless:scroll-to-bottom", ""); -
message.c
r34509d5 r93ee554 27 27 owl_fmtext_cache * owl_message_next_fmtext() /*noproto*/ 28 28 { 29 owl_fmtext_cache * f = fmtext_cache_next; 29 30 if(fmtext_cache_next->message != NULL) { 30 31 owl_message_invalidate_format(fmtext_cache_next->message); 31 32 } 32 owl_fmtext_cache * f = fmtext_cache_next;33 33 fmtext_cache_next++; 34 34 if(fmtext_cache_next - fmtext_cache == OWL_FMTEXT_CACHE_SIZE) … … 121 121 p=owl_list_get_element(&(m->attributes), i); 122 122 buff=owl_sprintf(" %-15.15s: %-35.35s\n", owl_pair_get_key(p), owl_pair_get_value(p)); 123 if(buff == NULL) { 124 buff=owl_sprintf(" %-15.15s: %-35.35s\n", owl_pair_get_key(p), "<error>"); 125 if(buff == NULL) 126 buff=owl_strdup(" <error>\n"); 127 } 123 128 owl_fmtext_append_normal(fm, buff); 124 129 owl_free(buff); … … 417 422 char *owl_message_get_text(owl_message *m) 418 423 { 424 owl_message_format(m); 419 425 return(owl_fmtext_get_text(&(m->fmtext->fmtext))); 420 426 } … … 566 572 567 573 int owl_message_is_answered(owl_message *m) { 574 char *q; 568 575 if(!owl_message_is_question(m)) return 0; 569 char *q = owl_message_get_attribute_value(m, "question");576 q = owl_message_get_attribute_value(m, "question"); 570 577 if(!q) return 0; 571 578 return !strcmp(q, "answered"); … … 813 820 struct hostent *hent; 814 821 char *ptr, *tmp, *tmp2; 822 int len; 815 823 816 824 owl_message_init(m); … … 841 849 owl_message_set_opcode(m, ""); 842 850 } 843 owl_message_set_zsig(m, n->z_message);851 owl_message_set_zsig(m, owl_zephyr_get_zsig(n, &len)); 844 852 845 853 if ((ptr=strchr(n->z_recipient, '@'))!=NULL) { -
obarray.c
rdb90f03 r535d68b 80 80 owl_obarray_init(&oa); 81 81 82 printf(" BEGIN testing owl_obarray\n");82 printf("# BEGIN testing owl_obarray\n"); 83 83 84 84 p = owl_obarray_insert(&oa, "test"); … … 96 96 FAIL_UNLESS("Didn't find a string that isn't there", p == NULL); 97 97 98 printf(" END testing owl_obarray (%d failures)\n", numfailed);98 printf("# END testing owl_obarray (%d failures)\n", numfailed); 99 99 100 100 return numfailed; -
owl.c
r34509d5 r93ee554 65 65 owl_global g; 66 66 67 char * owl_get_datadir() { 68 char * datadir = getenv("BARNOWL_DATA_DIR"); 69 if(datadir != NULL) 70 return strchr(datadir, '=') + 1; 71 return DATADIR; 72 } 73 67 74 int main(int argc, char **argv, char **env) 68 75 { … … 74 81 struct sigaction sigact; 75 82 char *configfile, *tty, *perlout, *perlerr, **argvsave, buff[LINE], startupmsg[LINE]; 83 char *confdir; 76 84 owl_filter *f; 77 85 owl_style *s; … … 88 96 argvsave=argv; 89 97 configfile=NULL; 98 confdir = NULL; 90 99 tty=NULL; 91 100 debug=0; … … 105 114 } else if (!strcmp(argv[0], "-c")) { 106 115 if (argc<2) { 107 108 109 116 fprintf(stderr, "Too few arguments to -c\n"); 117 usage(); 118 exit(1); 110 119 } 111 120 configfile=argv[1]; … … 114 123 } else if (!strcmp(argv[0], "-t")) { 115 124 if (argc<2) { 116 117 118 125 fprintf(stderr, "Too few arguments to -t\n"); 126 usage(); 127 exit(1); 119 128 } 120 129 tty=argv[1]; 130 argv+=2; 131 argc-=2; 132 } else if (!strcmp(argv[0], "-s")){ 133 if (argc<2) { 134 fprintf(stderr, "Too few arguments to -s\n"); 135 usage(); 136 exit(1); 137 } 138 confdir = argv[1]; 121 139 argv+=2; 122 140 argc-=2; … … 131 149 argc--; 132 150 } else if (!strcmp(argv[0], "-v")) { 133 printf("This is owl version %s\n", OWL_VERSION_STRING);151 printf("This is barnowl version %s\n", OWL_VERSION_STRING); 134 152 exit(0); 135 153 } else { … … 163 181 /* screen init */ 164 182 if (!getenv("TERMINFO")) { 165 sprintf(buff, "TERMINFO=%s", TERMINFO); 166 putenv(buff); 167 owl_function_debugmsg("startup: setting TERMINFO to %s", TERMINFO); 183 owl_function_debugmsg("startup: Not setting TERMINFO"); 168 184 } else { 169 185 owl_function_debugmsg("startup: leaving TERMINFO as %s from envrionment", getenv("TERMINFO")); … … 195 211 /* owl global init */ 196 212 owl_global_init(&g); 197 if (debug) owl_global_set_debug_on(&g); 213 if (debug) owl_global_set_debug_on(&g); 214 if (confdir) owl_global_set_confdir(&g, confdir); 198 215 owl_function_debugmsg("startup: first available debugging message"); 199 216 owl_global_set_startupargs(&g, argcsave, argvsave); … … 217 234 /* create the owl directory, in case it does not exist */ 218 235 owl_function_debugmsg("startup: creating owl directory, if not present"); 219 dir=owl_ sprintf("%s/%s", owl_global_get_homedir(&g), OWL_CONFIG_DIR);236 dir=owl_global_get_confdir(&g); 220 237 mkdir(dir, S_IRWXU); 221 owl_free(dir);222 238 223 239 /* set the tty, either from the command line, or by figuring it out */ … … 263 279 owl_function_debugmsg("startup: creating default filters"); 264 280 f=owl_malloc(sizeof(owl_filter)); 265 owl_filter_init_fromstring(f, "personal", "isprivate ^true$"); 281 owl_filter_init_fromstring(f, "personal", "isprivate ^true$ and ( not type ^zephyr$" 282 " or ( class ^message and" 283 " ( instance ^personal$ or instance ^urgent$ ) ) )"); 266 284 owl_list_append_element(owl_global_get_filterlist(&g), f); 267 285 … … 533 551 j=wgetch(typwin); 534 552 if (j==ERR) { 535 usleep(10 );553 usleep(10000); 536 554 } else { 537 555 owl_global_update_lastinputtime(&g); … … 700 718 void usage() 701 719 { 702 fprintf(stderr, " Owl version %s\n", OWL_VERSION_STRING);703 fprintf(stderr, "Usage: owl [-n] [-d] [-D] [-v] [-h] [-c <configfile>] [-t <ttyname>]\n");720 fprintf(stderr, "Barnowl version %s\n", OWL_VERSION_STRING); 721 fprintf(stderr, "Usage: barnowl [-n] [-d] [-D] [-v] [-h] [-c <configfile>] [-s <confdir>] [-t <ttyname>]\n"); 704 722 fprintf(stderr, " -n don't load zephyr subscriptions\n"); 705 723 fprintf(stderr, " -d enable debugging\n"); 706 724 fprintf(stderr, " -D enable debugging and delete previous debug file\n"); 707 fprintf(stderr, " -v print the Owl version number and exit\n");725 fprintf(stderr, " -v print the Barnowl version number and exit\n"); 708 726 fprintf(stderr, " -h print this help message\n"); 709 727 fprintf(stderr, " -c specify an alternate config file\n"); 728 fprintf(stderr, " -s specify an alternate config dir (default ~/.owl)\n"); 710 729 fprintf(stderr, " -t set the tty name\n"); 711 730 } -
owl.h
r34509d5 r93ee554 64 64 #ifdef OWL_PERL 65 65 typedef void WINDOW; 66 /* logout is defined in FreeBSD. */ 67 #define logout logout_ 66 68 #include <perl.h> 69 #undef logout 67 70 #include "XSUB.h" 68 71 #else … … 560 563 char *thishost; 561 564 char *homedir; 565 char *confdir; 566 char *startupfile; 562 567 int direction; 563 568 int zaway; -
perl/lib/BarnOwl/ModuleLoader.pm
r9de39410 rbe98ba5 6 6 use lib (BarnOwl::get_data_dir() . "/modules/"); 7 7 use PAR (BarnOwl::get_data_dir() . "/modules/*.par"); 8 use PAR ( $ENV{HOME} . "/.owl/modules/*.par");8 use PAR (BarnOwl::get_config_dir() . "/modules/*.par"); 9 9 10 10 sub load_all { 11 11 my %modules; 12 12 my @modules; 13 14 my @moddirs = (); 15 push @moddirs, BarnOwl::get_data_dir() . "/modules"; 16 push @moddirs, BarnOwl::get_config_dir() . "/modules"; 13 17 14 for my $dir ( BarnOwl::get_data_dir() . "/modules", 15 $ENV{HOME} . "/.owl/modules" ) { 18 for my $dir (@moddirs) { 16 19 opendir(my $dh, $dir) or next; 17 20 while(defined(my $f = readdir($dh))) { -
perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
rf032974 r892568b 581 581 or die("Usage: jmuc join MUC [-p password] [-a account]"); 582 582 583 die("Error: Must specify a fully-qualified MUC name (e.g. barnowl\@conference.mit.edu)\n") 584 unless $muc =~ /@/; 583 585 $muc = Net::Jabber::JID->new($muc); 584 586 $jid = Net::Jabber::JID->new($jid); … … 586 588 587 589 $conn->getConnectionFromJID($jid)->MUCJoin(JID => $muc, 588 589 590 591 590 Password => $password, 591 History => { 592 MaxChars => 0 593 }); 592 594 return; 593 595 } … … 599 601 die("Usage: jmuc part MUC [-a account]") unless $muc; 600 602 601 $conn->getConnectionFromJID($jid)->MUCLeave(JID => $muc); 602 queue_admin_msg("$jid has left $muc."); 603 if($conn->getConnectionFromJID($jid)->MUCLeave(JID => $muc)) { 604 queue_admin_msg("$jid has left $muc."); 605 } else { 606 die("Error: Not joined to $muc"); 607 } 603 608 } 604 609 … … 639 644 my $m = shift; 640 645 my @jids = $m->Presence(); 641 return "JIDs present in " . $m->BaseJID . "\n\t" 642 . join("\n\t", map {$_->GetResource}@jids) . "\n"; 646 647 my $presence = "JIDs present in " . $m->BaseJID; 648 if($m->Anonymous) { 649 $presence .= " [anonymous MUC]"; 650 } 651 $presence .= "\n\t"; 652 $presence .= join("\n\t", map {pp_jid($m, $_);} @jids) . "\n"; 653 return $presence; 654 } 655 656 sub pp_jid { 657 my ($m, $jid) = @_; 658 my $nick = $jid->GetResource; 659 my $full = $m->GetFullJID($jid); 660 if($full && $full ne $nick) { 661 return "$nick ($full)"; 662 } else { 663 return "$nick"; 664 } 643 665 } 644 666 … … 904 926 sid => $sid } ); 905 927 $jhash{type} = 'admin'; 928 906 929 BarnOwl::queue_message( BarnOwl::Message->new(%jhash) ); 907 930 } … … 1134 1157 } 1135 1158 elsif ( $jtype eq 'normal' ) { 1136 $props{replycmd} = undef;1159 $props{replycmd} = ""; 1137 1160 $props{private} = 1; 1138 1161 } 1139 1162 elsif ( $jtype eq 'headline' ) { 1140 $props{replycmd} = undef;1163 $props{replycmd} = ""; 1141 1164 } 1142 1165 elsif ( $jtype eq 'error' ) { 1143 $props{replycmd} = undef;1166 $props{replycmd} = ""; 1144 1167 $props{body} = "Error " 1145 1168 . $props{error_code} -
perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm
r3c455b4 r892568b 52 52 Leave a MUC. The MUC is specified in the same form as L</FindMUC> 53 53 54 Returns true if successful, false if this connection was not in the 55 named MUC. 56 54 57 =cut 55 58 … … 61 64 $muc->Leave(); 62 65 $self->{_BARNOWL_MUCS} = [grep {$_->BaseJID ne $muc->BaseJID} $self->MUCs]; 66 return 1; 63 67 } 64 68 -
perl/modules/Jabber/lib/Net/Jabber/MUC.pm
rc2bed55 r892568b 64 64 $self->{JID} = $args{jid}; 65 65 $self->{PRESENCE} = { }; 66 $self->{ANONYMOUS} = 1; 66 67 67 68 bless($self, $class); … … 188 189 delete $self->{PRESENCE}->{$from->GetJID('full')}; 189 190 } elsif($type eq 'available') { 190 $self->{PRESENCE}->{$from->GetJID('full')} = $from; 191 $self->{PRESENCE}->{$from->GetJID('full')} = {ROOMNICK => $from}; 192 my $x = $presence->GetX('http://jabber.org/protocol/muc#user'); 193 if($x && $x->DefinedItem()) { 194 my $item = $x->GetItem(); 195 if($item->DefinedJID()) { 196 $self->{PRESENCE}->{$from->GetJID('full')}->{FULLJID} = $item->GetJID(); 197 $self->{ANONYMOUS} = 0; 198 } 199 } 191 200 } 192 201 } … … 207 216 } 208 217 218 =head2 GetFullJID roomjid 219 220 Given the roomnick of a user in the MUC, return their full NIC if the 221 MUC makes it available. If the MUC is anonymous or the user does not 222 exist in the MUC, return undef. 223 224 =cut 225 226 sub GetFullJID { 227 my $self = shift; 228 my $jid = shift; 229 230 $jid = $jid->GetJID('full') if UNIVERSAL::isa($jid, 'Net::Jabber::JID'); 231 my $pres = $self->{PRESENCE}->{$jid}; 232 return unless $pres; 233 return $pres->{FULLJID}; 234 } 235 209 236 =head2 Presence 210 237 … … 215 242 sub Presence { 216 243 my $self = shift; 217 return values %{$self->{PRESENCE}}; 244 return map {$_->{ROOMNICK}} values %{$self->{PRESENCE}}; 245 } 246 247 =head2 Anonymous 248 249 Returns true if the MUC is anonymous (hides participants real JIDs) 250 251 =cut 252 253 sub Anonymous { 254 my $self = shift; 255 return $self->{ANONYMOUS}; 218 256 } 219 257 -
perl/modules/Jabber/lib/XML/Stream.pm
rc2bed55 r5073972 1161 1161 } 1162 1162 1163 delete($self->{SIDS}->{$currsid}); 1163 # 08.04.05(Fri) slipstream@yandex.ru for compapility with ejabberd since it reuses stream id 1164 delete($self->{SIDS}->{$currsid}) unless ($currsid eq $sid); 1164 1165 1165 1166 if (exists($self->GetRoot($sid)->{version}) && -
perlconfig.c
rf6b319c rad15610 137 137 char *key,*val; 138 138 HV * hash; 139 struct tm tm; 139 140 140 141 hash = (HV*)SvRV(msg); … … 162 163 } else if (!strcmp(key, "time")) { 163 164 m->timestr = owl_strdup(val); 164 struct tm tm;165 165 strptime(val, "%a %b %d %T %Y", &tm); 166 166 m->time = mktime(&tm); … … 445 445 int i, count; 446 446 char * ret = NULL; 447 SV *rv; 447 448 STRLEN n_a; 448 449 dSP; … … 467 468 if(count != 1) 468 469 croak("Perl command %s returned more than one value!", cmd->name); 469 SV *rv = POPs;470 rv = POPs; 470 471 if(SvTRUE(rv)) { 471 472 ret = owl_strdup(SvPV(rv, n_a)); … … 488 489 SV *cb = (SV*)(e->cbdata); 489 490 unsigned int n_a; 491 dSP; 492 490 493 if(cb == NULL) { 491 494 owl_function_error("Perl callback is NULL!"); 492 495 } 493 494 dSP;495 496 496 497 ENTER; … … 516 517 void owl_perlconfig_mainloop() 517 518 { 519 dSP; 518 520 if (!owl_perlconfig_is_function("BarnOwl::Hooks::_mainloop_hook")) 519 521 return; 520 dSP ;521 522 PUSHMARK(SP) ; 522 523 call_pv("BarnOwl::Hooks::_mainloop_hook", G_DISCARD|G_EVAL); -
perlglue.xs
r13a3c1db rb363d83 199 199 get_data_dir () 200 200 CODE: 201 RETVAL = (char *) DATADIR;201 RETVAL = (char *) owl_get_datadir(); 202 202 OUTPUT: 203 203 RETVAL 204 205 char * 206 get_config_dir () 207 CODE: 208 RETVAL = (char *) owl_global_get_confdir(&g); 209 OUTPUT: 210 RETVAL 204 211 205 212 void -
perlwrap.pm
r42947f1 r18fb3d4f 21 21 }; 22 22 23 use lib(get_data_dir()."/lib"); 24 use lib($ENV{HOME}."/.owl/lib"); 25 23 use lib(get_data_dir() . "/lib"); 24 use lib(get_config_dir() . "/lib"); 25 26 # perlconfig.c will set this to the value of the -c command-line 27 # switch, if present. 26 28 our $configfile; 27 29 … … 520 522 if ( $m->is_loginout) { 521 523 return format_login($m); 522 } elsif($m->is_ping ) {524 } elsif($m->is_ping && $m->is_personal) { 523 525 return ( "\@b(PING) from \@b(" . $m->pretty_sender . ")\n" ); 524 526 } elsif($m->is_admin) { … … 568 570 } 569 571 572 if($m->opcode) { 573 $header .= " [" . $m->opcode . "]"; 574 } 570 575 $header .= " " . time_hhmm($m); 571 576 my $sender = $m->long_sender; -
test.h
r0138478 r1cf3f8d3 3 3 4 4 #define FAIL_UNLESS(desc,pred) do { int __pred = (pred); \ 5 printf(" \t%-4s: %s", (__pred)?"ok":(numfailed++,"FAIL"), desc); \5 printf("%s %s", (__pred)?"ok":(numfailed++,"not ok"), desc); \ 6 6 if(!(__pred)) printf("\t(%s:%d)", __FILE__, __LINE__); printf("%c", '\n'); } while(0) 7 7 -
tester.c
re7dc035 r1cf3f8d3 143 143 144 144 145 #define OWL_DICT_NTESTS 20 146 #define OWL_UTIL_NTESTS 9 147 #define OWL_OBARRAY_NTESTS 5 148 #define OWL_VARIABLE_NTESTS 52 149 #define OWL_FILTER_NTESTS 23 150 145 151 int main(int argc, char **argv, char **env) 146 152 { … … 149 155 150 156 int numfailures=0; 151 if (argc==2 && 0==strcmp(argv[1],"reg")) { 157 if (argc==1 || (argc==2 && 0==strcmp(argv[1],"reg"))) { 158 printf("1..%d\n", OWL_UTIL_NTESTS+OWL_DICT_NTESTS+OWL_VARIABLE_NTESTS 159 +OWL_FILTER_NTESTS+OWL_OBARRAY_NTESTS); 152 160 numfailures += owl_util_regtest(); 153 161 numfailures += owl_dict_regtest(); … … 156 164 numfailures += owl_obarray_regtest(); 157 165 if (numfailures) { 158 fprintf(stderr, " *** WARNING: %d failures total\n", numfailures);166 fprintf(stderr, "# *** WARNING: %d failures total\n", numfailures); 159 167 } 160 168 return(numfailures); -
util.c
r34509d5 r93ee554 759 759 char * owl_util_baseclass(char * class) 760 760 { 761 char *ret;762 761 char *start, *end; 763 762 … … 769 768 start = owl_strdup(start); 770 769 end = start + strlen(start) - 1; 771 while( *end == 'd' && *(end-1) == '.') {770 while(end > start && *end == 'd' && *(end-1) == '.') { 772 771 end -= 2; 773 772 } … … 789 788 int numfailed=0; 790 789 791 printf(" BEGIN testing owl_util\n");790 printf("# BEGIN testing owl_util\n"); 792 791 793 792 FAIL_UNLESS("owl_util_substitute 1", … … 812 811 !strcmp("meep foo bar", owl_util_uniq("meep foo", "bar foo meep", "-"))); 813 812 814 if (numfailed) printf("*** WARNING: failures encountered with owl_util\n");815 printf(" END testing owl_util (%d failures)\n", numfailed);813 // if (numfailed) printf("*** WARNING: failures encountered with owl_util\n"); 814 printf("# END testing owl_util (%d failures)\n", numfailed); 816 815 return(numfailed); 817 816 } -
variable.c
ra695a68 rad15610 974 974 int numfailed=0; 975 975 char buf[1024]; 976 owl_variable * v; 976 977 977 978 in_regtest = 1; 978 979 979 printf(" BEGIN testing owl_variable\n");980 printf("# BEGIN testing owl_variable\n"); 980 981 FAIL_UNLESS("setup", 0==owl_variable_dict_setup(&vd)); 981 982 … … 1027 1028 FAIL_UNLESS("get enum 10", OWL_WEBBROWSER_NETSCAPE==owl_variable_get_int(&vd,"webbrowser")); 1028 1029 1029 owl_variable * v;1030 1031 1030 owl_variable_dict_newvar_string(&vd, "stringvar", "", "", "testval"); 1032 1031 FAIL_UNLESS("get new string var", NULL != (v = owl_variable_get(&vd, "stringvar", OWL_VARIABLE_STRING))); … … 1049 1048 owl_variable_dict_free(&vd); 1050 1049 1051 if (numfailed) printf("*** WARNING: failures encountered with owl_variable\n");1052 printf(" END testing owl_variable (%d failures)\n", numfailed);1050 // if (numfailed) printf("*** WARNING: failures encountered with owl_variable\n"); 1051 printf("# END testing owl_variable (%d failures)\n", numfailed); 1053 1052 return(numfailed); 1054 1053 } -
zephyr.c
r13a3c1db r50e29e3 328 328 char *out; 329 329 330 /* If there's no message here, just run along now */ 331 if (n->z_message_len == 0) 332 return(owl_strdup("")); 333 330 334 count=save=0; 331 335 for (i=0; i<n->z_message_len; i++) { … … 362 366 { 363 367 int i, fields; 368 369 if(n->z_message_len == 0) 370 return 0; 364 371 365 372 fields=1; -
zwrite.c
r34509d5 r93ee554 125 125 } 126 126 127 if (z->class == NULL && 128 z->inst == NULL && 129 owl_list_get_size(&(z->recips))==0) { 130 owl_function_error("You must specify a recipient for zwrite"); 131 return(-1); 132 } 133 127 134 /* now deal with defaults */ 128 135 if (z->class==NULL) z->class=owl_strdup("message"); … … 132 139 /* z->message is allowed to stay NULL */ 133 140 134 if (!strcasecmp(z->class, "message") &&135 !strcasecmp(z->inst, "personal") &&136 owl_list_get_size(&(z->recips))==0) {137 owl_function_error("You must specify a recipient for zwrite");138 return(-1);139 }140 141 141 /* get a zsig, if not given */ 142 142 if (z->zsig==NULL) { -
aim.c
r9854278 r34509d5 948 948 949 949 if (modname) { 950 if (!(filename = malloc(strlen(priv->aimbinarypath)+1+strlen(modname)+4+1))) {950 if (!(filename = owl_malloc(strlen(priv->aimbinarypath)+1+strlen(modname)+4+1))) { 951 951 /* perror("memrequest: malloc"); */ 952 952 return -1; … … 954 954 sprintf(filename, "%s/%s.ocm", priv->aimbinarypath, modname); 955 955 } else { 956 if (!(filename = malloc(strlen(priv->aimbinarypath)+1+strlen(defaultmod)+1))) {956 if (!(filename = owl_malloc(strlen(priv->aimbinarypath)+1+strlen(defaultmod)+1))) { 957 957 /* perror("memrequest: malloc"); */ 958 958 return -1; … … 964 964 if (!modname) { 965 965 /* perror("memrequest: stat"); */ 966 free(filename);966 owl_free(filename); 967 967 return -1; 968 968 } … … 986 986 int i; 987 987 988 free(filename); /* not needed */988 owl_free(filename); /* not needed */ 989 989 owl_function_error("getaimdata memrequest: recieved invalid request for 0x%08lx bytes at 0x%08lx (file %s)\n", len, offset, modname); 990 990 i = 8; … … 993 993 } 994 994 995 if (!(buf = malloc(i))) {995 if (!(buf = owl_malloc(i))) { 996 996 return -1; 997 997 } … … 1017 1017 *buflenret = i; 1018 1018 } else { 1019 if (!(buf = malloc(len))) {1020 free(filename);1019 if (!(buf = owl_malloc(len))) { 1020 owl_free(filename); 1021 1021 return -1; 1022 1022 } … … 1024 1024 if (!(f = fopen(filename, "r"))) { 1025 1025 /* perror("memrequest: fopen"); */ 1026 free(filename);1027 free(buf);1026 owl_free(filename); 1027 owl_free(buf); 1028 1028 return -1; 1029 1029 } 1030 1030 1031 free(filename);1031 owl_free(filename); 1032 1032 1033 1033 if (fseek(f, offset, SEEK_SET) == -1) { 1034 1034 /* perror("memrequest: fseek"); */ 1035 1035 fclose(f); 1036 free(buf);1036 owl_free(buf); 1037 1037 return -1; 1038 1038 } … … 1041 1041 /* perror("memrequest: fread"); */ 1042 1042 fclose(f); 1043 free(buf);1043 owl_free(buf); 1044 1044 return -1; 1045 1045 } … … 1076 1076 if (priv->aimbinarypath && (getaimdata(sess, &buf, &buflen, offset, len, modname) == 0)) { 1077 1077 aim_sendmemblock(sess, fr->conn, offset, buflen, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); 1078 free(buf);1078 owl_free(buf); 1079 1079 } else { 1080 1080 owl_function_debugmsg("faimtest_memrequest: unable to use AIM binary (\"%s/%s\"), sending defaults...\n", priv->aimbinarypath, modname); … … 1342 1342 int z; 1343 1343 1344 newbuf = malloc(i+1);1344 newbuf = owl_malloc(i+1); 1345 1345 for (z = 0; z < i; z++) 1346 1346 newbuf[z] = (z % 10)+0x30; 1347 1347 newbuf[i] = '\0'; 1348 1348 /* aim_send_im(sess, userinfo->sn, AIM_IMFLAGS_ACK | AIM_IMFLAGS_AWAY, newbuf); */ 1349 free(newbuf);1349 owl_free(newbuf); 1350 1350 } 1351 1351 } else if (strstr(tmpstr, "seticqstatus")) { -
cmd.c
r6922edd r34509d5 74 74 owl_cmd *cmd; 75 75 76 tmpbuff= strdup(cmdbuff);76 tmpbuff=owl_strdup(cmdbuff); 77 77 argv=owl_parseline(tmpbuff, &argc); 78 78 if (argc < 0) { -
text.c
r72db971 r34509d5 327 327 tolen = strlen(to); 328 328 fromlen = strlen(from); 329 out = malloc(outlen);329 out = owl_malloc(outlen); 330 330 331 331 while (in[inpos]) { -
zcrypt.c
r9ceee9d r34509d5 385 385 386 386 /* Build a space-separated string from argv from elements between start * 387 * and end - 1. malloc()'s the returned string. */387 * and end - 1. owl_malloc()'s the returned string. */ 388 388 char *BuildArgString(char **argv, int start, int end) { 389 389 int len = 1; … … 397 397 398 398 /* Allocate memory */ 399 result = (char *) malloc(len);399 result = (char *)owl_malloc(len); 400 400 if (result) { 401 401 /* Build the string */ … … 482 482 /* Prepare result to be returned */ 483 483 char *temp = keyfile; 484 keyfile = (char *) malloc(strlen(temp) + 1);484 keyfile = (char *)owl_malloc(strlen(temp) + 1); 485 485 if (keyfile) { 486 486 strcpy(keyfile, temp); … … 611 611 } 612 612 use_buffer = TRUE; 613 if ((inptr = inbuff = (char *) malloc(MAX_RESULT)) == NULL) {613 if ((inptr = inbuff = (char *)owl_malloc(MAX_RESULT)) == NULL) { 614 614 printf("Memory allocation error\n"); 615 615 return FALSE; … … 639 639 printf("Could not run zwrite\n"); 640 640 if (freein && inbuff) { 641 free(inbuff);641 owl_free(inbuff); 642 642 } 643 643 return(FALSE); … … 685 685 686 686 /* Free the input buffer, if necessary */ 687 if (freein && inbuff) free(inbuff);687 if (freein && inbuff) owl_free(inbuff); 688 688 689 689 return(!error);
Note: See TracChangeset
for help on using the changeset viewer.