Changeset 098376e
- Timestamp:
- Jan 24, 2009, 8:53:45 PM (16 years ago)
- Children:
- 92f8fc2
- Parents:
- 209ea94 (diff), b940b91 (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:
-
- 12 added
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r43a306c rb940b91 1 1.0.4 2 * Added a ':show quickstart' command. -geofft 3 * Allow filters that reference a sub filter more than once non-cyclically. -nelhage 4 * Make 'version' return 'BarnOwl' not 'Owl' 5 * Escape interpolated regexes in filters. -andersk 6 * Various code cleanups. -andersk 7 * Fix format string injection bugs. -andersk 8 * Clean up various code warnings. -nelhage 9 * Replace questionable sprintf(buf, "%s...", buf, ...) pattern. -andersk 10 * Show IRC /me messages with the conventional * instead of bold. -andersk 11 * Rip out the openurl function and webbrowser variable. -andersk 12 1 13 1.0.3 2 14 * Moved BarnOwl source control to git on github. -
Makefile.in
r3e9485d r098376e 5 5 prefix = @prefix@ 6 6 exec_prefix = @exec_prefix@ 7 datarootdir = @datarootdir@ 7 8 datadir = @datadir@/barnowl 8 9 bindir = @bindir@ … … 53 54 $(ATHSTATIC) $(CC) -o $(EXE) owl.o $(OBJS) $(LDFLAGS) $(LIBS) 54 55 55 tester: $(AUTOGEN) $(OBJS) tester.o 56 tester: $(AUTOGEN) $(OBJS) tester.o libfaim 56 57 $(ATHSTATIC) $(CC) -o tester tester.o $(OBJS) $(LDFLAGS) $(LIBS) 57 58 -
aim.c
rdb0ac7e r554a2b8 239 239 { 240 240 if (message) { 241 owl_function_error( message);241 owl_function_error("%s", message); 242 242 } else { 243 243 owl_function_error("Authentication error on login"); … … 252 252 int ret; 253 253 254 ret=aim_im_sendch1(owl_global_get_aimsess(&g), to, NULL, msg);254 ret=aim_im_sendch1(owl_global_get_aimsess(&g), to, 0, msg); 255 255 256 256 /* I don't know how to check for an error yet */ … … 1698 1698 1699 1699 /* printf("snac threw error (reason 0x%04x: %s)\n", reason, (reason<msgerrreasonslen)?msgerrreasons[reason]:"unknown"); */ 1700 if (reason<msgerrreasonslen) owl_function_error( msgerrreasons[reason]);1700 if (reason<msgerrreasonslen) owl_function_error("%s", msgerrreasons[reason]); 1701 1701 1702 1702 return 1; … … 1715 1715 1716 1716 /* printf("message to %s bounced (reason 0x%04x: %s)\n", destsn, reason, (reason<msgerrreasonslen)?msgerrreasons[reason]:"unknown"); */ 1717 if (reason<msgerrreasonslen) owl_function_error( msgerrreasons[reason]);1717 if (reason<msgerrreasonslen) owl_function_error("%s", msgerrreasons[reason]); 1718 1718 1719 1719 if (reason==4) { … … 1736 1736 1737 1737 /* printf("user information for %s unavailable (reason 0x%04x: %s)\n", destsn, reason, (reason<msgerrreasonslen)?msgerrreasons[reason]:"unknown"); */ 1738 if (reason<msgerrreasonslen) owl_function_error( msgerrreasons[reason]);1738 if (reason<msgerrreasonslen) owl_function_error("%s", msgerrreasons[reason]); 1739 1739 1740 1740 return 1; … … 2309 2309 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); 2310 2310 return; 2311 } 2312 2313 void owl_process_aim() 2314 { 2315 if (owl_global_is_doaimevents(&g)) { 2316 owl_aim_process_events(); 2317 2318 if (owl_global_is_aimloggedin(&g)) { 2319 if (owl_timer_is_expired(owl_global_get_aim_buddyinfo_timer(&g))) { 2320 /* owl_buddylist_request_idletimes(owl_global_get_buddylist(&g)); */ 2321 owl_timer_reset(owl_global_get_aim_buddyinfo_timer(&g)); 2322 } 2323 } 2324 } 2311 2325 } 2312 2326 -
commands.c
r451db9e r9b70dd4 453 453 OWLCMD_VOID("pop-message", owl_command_pop_message, OWL_CTX_RECWIN, 454 454 "pops up a message in a window", "", ""), 455 456 OWLCMD_VOID("openurl", owl_command_openurl, OWL_CTX_INTERACTIVE,457 "opens up a URL from the current message",458 "",459 "Uses the 'webbrowser' variable to determine\n"460 "which browser to use. Currently, 'netscape'\n"461 "and 'galeon' are supported.\n"),462 455 463 456 OWLCMD_ARGS("zaway", owl_command_zaway, OWL_CTX_INTERACTIVE, … … 641 634 "show keymap <keymap>\n" 642 635 "show license\n" 636 "show quickstart\n" 643 637 "show startup\n" 644 638 "show status\n" … … 1046 1040 void owl_command_version() 1047 1041 { 1048 char buff[1024]; 1049 1050 sprintf(buff, "Owl version %s", OWL_VERSION_STRING); 1051 owl_function_makemsg(buff); 1042 owl_function_makemsg("BarnOwl version %s", OWL_VERSION_STRING); 1052 1043 } 1053 1044 … … 1461 1452 owl_function_aaway_on(); 1462 1453 owl_function_zaway_on(); 1463 owl_function_makemsg("Away messages set." , owl_global_get_aaway_msg_default(&g));1454 owl_function_makemsg("Away messages set."); 1464 1455 return NULL; 1465 1456 } … … 1691 1682 } 1692 1683 1693 owl_function_debugmsg( argv[1]);1684 owl_function_debugmsg("%s", argv[1]); 1694 1685 return(NULL); 1695 1686 } … … 2207 2198 } else if (!strcmp(argv[1], "license")) { 2208 2199 owl_function_show_license(); 2200 } else if (!strcmp(argv[1], "quickstart")) { 2201 owl_function_show_quickstart(); 2209 2202 } else if (!strcmp(argv[1], "startup")) { 2210 2203 char *filename; … … 2251 2244 { 2252 2245 owl_function_curmsg_to_popwin(); 2253 }2254 2255 void owl_command_openurl(void)2256 {2257 owl_function_openurl();2258 2246 } 2259 2247 … … 2580 2568 { 2581 2569 buff = skiptokens(buff, 1); 2582 owl_function_error( buff);2570 owl_function_error("%s", buff); 2583 2571 return NULL; 2584 2572 } … … 2587 2575 { 2588 2576 buff = skiptokens(buff, 1); 2589 owl_function_makemsg( buff);2577 owl_function_makemsg("%s", buff); 2590 2578 return NULL; 2591 2579 } -
examples/owlconf.erik
r5d9c664 r160d3f4 147 147 owl::command("set -q rxping on"); 148 148 owl::command("set -q typewinsize 5"); 149 if ($ENV{"DISPLAY"} eq ":0.0") {150 owl::command("set -q webbrowser galeon");151 }152 149 owl::command("filter me recipient %me% or ( sender %me% and class message and instance personal ) or class mail or type aim"); 153 150 owl::command("filter owl instance ^owl.*"); -
examples/owlconf.simple
r2b14303 r160d3f4 93 93 # owl::command('set -q view_home all'); 94 94 95 96 ## Which webbrowser to use to launch URLs with the 'w' key.97 # owl::command('set -q webbrowser netscape');98 # owl::command('set -q webbrowser galeon');99 # owl::command('set -q webbrowser none');100 95 101 96 ## Default message to send when zaway is on (toggle with 'A') -
filter.c
rcdc6ff1 r9711a6e 3 3 4 4 static const char fileIdent[] = "$Id$"; 5 6 #define OWL_FILTER_MAXRECURSE 207 5 8 6 int owl_filter_init_fromstring(owl_filter *f, char *name, char *string) … … 50 48 /* Now check for recursion. */ 51 49 if (owl_filter_is_toodeep(f)) { 52 owl_function_error("Filter loop or exceeds recursion depth");50 owl_function_error("Filter loop!"); 53 51 owl_filter_free(f); 54 52 return(-1); … … 313 311 int numfailed=0; 314 312 owl_message m; 315 owl_filter f1, f2, f3, f4 ;313 owl_filter f1, f2, f3, f4, f5; 316 314 317 315 owl_list_create(&(g.filterlist)); … … 365 363 FAIL_UNLESS("mutual recursion", owl_filter_init_fromstring(&f4, "f4", "filter f3")); 366 364 365 /* support referencing a filter several times */ 366 FAIL_UNLESS("DAG", !owl_filter_init_fromstring(&f5, "dag", "filter f1 or filter f1")); 367 367 368 return 0; 368 369 } -
filterelement.c
r0504f63 rf446454 279 279 } 280 280 281 static int fe_visiting = 0; 282 static int fe_visited = 1; 283 281 284 int owl_filterelement_is_toodeep(owl_filter *f, owl_filterelement *fe) 282 285 { 283 int one = 1; 284 owl_list nodes; 286 int rv; 285 287 owl_dict filters; 286 owl_list_create(&nodes);287 288 owl_dict_create(&filters); 288 289 owl_list_append_element(&nodes, fe); 290 owl_dict_insert_element(&filters, f->name, &one, NULL); 291 while(owl_list_get_size(&nodes)) { 292 fe = owl_list_get_element(&nodes, 0); 293 owl_list_remove_element(&nodes, 0); 294 if(fe->left) owl_list_append_element(&nodes, fe->left); 295 if(fe->right) owl_list_append_element(&nodes, fe->right); 296 if(fe->match_message == owl_filterelement_match_filter) { 297 if(owl_dict_find_element(&filters, fe->field)) return 1; 298 owl_dict_insert_element(&filters, fe->field, &one, NULL); 289 290 owl_dict_insert_element(&filters, f->name, &fe_visiting, owl_dict_noop_free); 291 292 rv = _owl_filterelement_is_toodeep(fe, &filters); 293 294 owl_dict_free_simple(&filters); 295 return rv; 296 } 297 298 int _owl_filterelement_is_toodeep(owl_filterelement *fe, owl_dict *seen) 299 { 300 int rv = 0; 301 owl_filter *f; 302 303 if(fe->match_message == owl_filterelement_match_filter) { 304 int *nval = owl_dict_find_element(seen, fe->field); 305 if(nval == &fe_visiting) { 306 return 1; 307 } else if (nval == NULL) { 299 308 f = owl_global_get_filter(&g, fe->field); 300 if(f) owl_list_append_element(&nodes, f->root); 309 owl_dict_insert_element(seen, fe->field, &fe_visiting, owl_dict_noop_free); 310 if(f) rv = _owl_filterelement_is_toodeep(f->root, seen); 311 owl_dict_insert_element(seen, fe->field, &fe_visited, owl_dict_noop_free); 301 312 } 302 } 303 304 owl_list_free_simple(&nodes); 305 owl_dict_free_simple(&filters); 306 return 0; 313 } else { 314 if(fe->left) 315 rv = rv || _owl_filterelement_is_toodeep(fe->left, seen); 316 if(fe->right) 317 rv = rv || _owl_filterelement_is_toodeep(fe->right, seen); 318 } 319 return rv; 307 320 } 308 321 -
fmtext.c
r6f6330b r2aaca94 763 763 * If format_fn is specified, passes it the list element value 764 764 * and it will return a string which this needs to free. */ 765 void owl_fmtext_append_list(owl_fmtext *f, owl_list *l, char *join_with, char *(format_fn)( void*))765 void owl_fmtext_append_list(owl_fmtext *f, owl_list *l, char *join_with, char *(format_fn)(char *)) 766 766 { 767 767 int i, size; 768 void*elem;768 char *elem; 769 769 char *text; 770 770 -
functions.c
r3f3ee61 r9b70dd4 99 99 } 100 100 101 char *owl_function_style_describe( void*name) {101 char *owl_function_style_describe(char *name) { 102 102 char *desc, *s; 103 103 owl_style *style; … … 114 114 } 115 115 116 char *owl_function_cmd_describe( void*name)116 char *owl_function_cmd_describe(char *name) 117 117 { 118 118 owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name); … … 172 172 } 173 173 174 void owl_function_show_quickstart() 175 { 176 char *message = 177 "Move between messages with the arrow keys, and press 'r' to reply.\n" 178 "For more info, press 'h' or visit http://barnowl.mit.edu/\n\n" 179 #ifdef HAVE_LIBZEPHYR 180 "@b(Zephyr:)\n" 181 "To send a message to a user, type ':zwrite @b(username)'. You can also\n" 182 "press 'z' and then type the username. To subscribe to a class, type\n" 183 "':sub @b(class)', and then type ':zwrite -c @b(class)' to send.\n\n" 184 #endif 185 "@b(AIM:)\n" 186 "Log in to AIM with ':aimlogin @b(screenname)'. Use ':aimwrite @b(screenname)',\n" 187 "or 'a' and then the screen name, to send someone a message.\n\n" 188 ; 189 190 if (owl_perlconfig_is_function("BarnOwl::Hooks::_get_quickstart")) { 191 char *perlquickstart = owl_perlconfig_execute("BarnOwl::Hooks::_get_quickstart()"); 192 if (perlquickstart) { 193 char *result = owl_sprintf("%s%s", message, perlquickstart); 194 owl_function_adminmsg("BarnOwl Quickstart", result); 195 owl_free(result); 196 owl_free(perlquickstart); 197 return; 198 } 199 } 200 owl_function_adminmsg("BarnOwl Quickstart", message); 201 } 202 203 174 204 /* Create an admin message, append it to the global list of messages 175 205 * and redisplay if necessary. … … 602 632 603 633 if (!found) { 604 owl_function_makemsg("already at last%s message%s%s ",634 owl_function_makemsg("already at last%s message%s%s%s", 605 635 skip_deleted?" non-deleted":"", 606 filter?" in ":"", filter?filter:""); 636 filter?" in ":"", filter?filter:"", 637 owl_mainwin_is_curmsg_truncated(owl_global_get_mainwin(&g)) ? 638 ", press Enter to scroll" : ""); 607 639 /* if (!skip_deleted) owl_function_beep(); */ 608 640 } … … 1019 1051 owl_function_debugmsg("Quitting Owl"); 1020 1052 exit(0); 1021 }1022 1023 void owl_function_openurl()1024 {1025 /* visit the first url in the current message */1026 owl_message *m;1027 owl_view *v;1028 char *ptr1, *ptr2, *text, url[LINE], tmpbuff[LINE];1029 int webbrowser;1030 1031 webbrowser = owl_global_get_webbrowser(&g);1032 1033 if (webbrowser < 0 || webbrowser == OWL_WEBBROWSER_NONE) {1034 owl_function_error("No browser selected");1035 return;1036 }1037 1038 v=owl_global_get_current_view(&g);1039 1040 m=owl_view_get_element(v, owl_global_get_curmsg(&g));1041 1042 if (!m || owl_view_get_size(v)==0) {1043 owl_function_error("No current message selected");1044 return;1045 }1046 1047 text=owl_message_get_text(m);1048 1049 /* First look for a good URL */1050 if ((ptr1=strstr(text, "http://"))!=NULL) {1051 ptr2=strpbrk(ptr1, " \n\t");1052 if (ptr2) {1053 strncpy(url, ptr1, ptr2-ptr1+1);1054 url[ptr2-ptr1+1]='\0';1055 } else {1056 strcpy(url, ptr1);1057 }1058 1059 /* if we had <http strip a trailing > */1060 if (ptr1>text && ptr1[-1]=='<') {1061 if (url[strlen(url)-1]=='>') {1062 url[strlen(url)-1]='\0';1063 }1064 }1065 } else if ((ptr1=strstr(text, "https://"))!=NULL) {1066 /* Look for an https URL */1067 ptr2=strpbrk(ptr1, " \n\t");1068 if (ptr2) {1069 strncpy(url, ptr1, ptr2-ptr1+1);1070 url[ptr2-ptr1+1]='\0';1071 } else {1072 strcpy(url, ptr1);1073 }1074 1075 /* if we had <http strip a trailing > */1076 if (ptr1>text && ptr1[-1]=='<') {1077 if (url[strlen(url)-1]=='>') {1078 url[strlen(url)-1]='\0';1079 }1080 }1081 } else if ((ptr1=strstr(text, "www."))!=NULL) {1082 /* if we can't find a real url look for www.something */1083 ptr2=strpbrk(ptr1, " \n\t");1084 if (ptr2) {1085 strncpy(url, ptr1, ptr2-ptr1+1);1086 url[ptr2-ptr1+1]='\0';1087 } else {1088 strcpy(url, ptr1);1089 }1090 } else {1091 owl_function_beep();1092 owl_function_error("Could not find URL to open.");1093 return;1094 }1095 1096 /* Make sure there aren't any quotes or \'s in the url */1097 for (ptr1 = url; *ptr1; ptr1++) {1098 if (*ptr1 == '"' || *ptr1 == '\\') {1099 owl_function_beep();1100 owl_function_error("URL contains invalid characters.");1101 return;1102 }1103 }1104 1105 /* NOTE: There are potentially serious security issues here... */1106 1107 /* open the page */1108 owl_function_makemsg("Opening %s", url);1109 if (webbrowser == OWL_WEBBROWSER_NETSCAPE) {1110 snprintf(tmpbuff, LINE, "netscape -remote \"openURL(%s)\" > /dev/null 2> /dev/null", url);1111 system(tmpbuff);1112 } else if (webbrowser == OWL_WEBBROWSER_GALEON) {1113 snprintf(tmpbuff, LINE, "galeon \"%s\" > /dev/null 2> /dev/null &", url);1114 system(tmpbuff);1115 } else if (webbrowser == OWL_WEBBROWSER_OPERA) {1116 snprintf(tmpbuff, LINE, "opera \"%s\" > /dev/null 2> /dev/null &", url);1117 system(tmpbuff);1118 }1119 1053 } 1120 1054 … … 1610 1544 /* fix this */ 1611 1545 sprintf(buff, " Checkd Ath: %i\n", n->z_checked_auth); 1612 sprintf(buff , "%s Multi notc: %s\n", buff, n->z_multinotice);1613 sprintf(buff , "%s Num other : %i\n", buff, n->z_num_other_fields);1614 sprintf(buff , "%s Msg Len : %i\n", buff, n->z_message_len);1546 sprintf(buff + strlen(buff), " Multi notc: %s\n", n->z_multinotice); 1547 sprintf(buff + strlen(buff), " Num other : %i\n", n->z_num_other_fields); 1548 sprintf(buff + strlen(buff), " Msg Len : %i\n", n->z_message_len); 1615 1549 owl_fmtext_append_normal(&fm, buff); 1616 1550 … … 1922 1856 void owl_function_status() 1923 1857 { 1924 char buff[ 5000];1858 char buff[MAXPATHLEN+1]; 1925 1859 time_t start; 1926 1860 int up, days, hours, minutes; … … 1942 1876 1943 1877 owl_fmtext_append_normal(&fm, " Current Directory: "); 1944 (void) getcwd(buff, MAXPATHLEN); 1945 owl_fmtext_append_normal(&fm, buff); 1878 if(getcwd(buff, MAXPATHLEN) == NULL) { 1879 owl_fmtext_append_normal(&fm, "<Error in getcwd>"); 1880 } else { 1881 owl_fmtext_append_normal(&fm, buff); 1882 } 1946 1883 owl_fmtext_append_normal(&fm, "\n"); 1947 1884 … … 2052 1989 return; 2053 1990 } 1991 } 1992 1993 /* then check if it's a question and just bring up the command prompt */ 1994 if (owl_message_is_question(m)) { 1995 owl_function_start_command(""); 1996 return; 2054 1997 } 2055 1998 … … 2548 2491 sprintf(argbuff, "class ^(un)*%s(\\.d)*$", tmpclass); 2549 2492 if (tmpinstance) { 2550 sprintf(argbuff , "%s and ( instance ^(un)*%s(\\.d)*$ )", argbuff, tmpinstance);2493 sprintf(argbuff + strlen(argbuff), " and ( instance ^(un)*%s(\\.d)*$ )", tmpinstance); 2551 2494 } 2552 2495 owl_free(tmpclass); … … 2577 2520 { 2578 2521 owl_filter *f; 2579 char *argbuff, *longuser, * shortuser, *filtname;2522 char *argbuff, *longuser, *esclonguser, *shortuser, *filtname; 2580 2523 2581 2524 /* stick the local realm on if it's not there */ … … 2584 2527 2585 2528 /* name for the filter */ 2586 filtname=owl_malloc(strlen(shortuser)+20); 2587 sprintf(filtname, "user-%s", shortuser); 2529 filtname=owl_sprintf("user-%s", shortuser); 2588 2530 2589 2531 /* if it already exists then go with it. This lets users override */ … … 2595 2537 f=owl_malloc(sizeof(owl_filter)); 2596 2538 2597 argbuff=owl_malloc(strlen(longuser)+1000); 2598 sprintf(argbuff, "( type ^zephyr$ and filter personal and "); 2599 sprintf(argbuff, "%s ( ( direction ^in$ and sender ^%s$ ) or ( direction ^out$ and recipient ^%s$ ) ) )", argbuff, longuser, longuser); 2600 sprintf(argbuff, "%s or ( ( class ^login$ ) and ( sender ^%s$ ) )", argbuff, longuser); 2539 esclonguser = owl_text_quote(longuser, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH); 2540 2541 argbuff=owl_sprintf("( type ^zephyr$ and filter personal and " 2542 "( ( direction ^in$ and sender ^%1$s$ ) or ( direction ^out$ and " 2543 "recipient ^%1$s$ ) ) ) or ( ( class ^login$ ) and ( sender ^%1$s$ ) )", 2544 esclonguser); 2601 2545 2602 2546 owl_filter_init_fromstring(f, filtname, argbuff); … … 2608 2552 owl_free(argbuff); 2609 2553 owl_free(longuser); 2554 owl_free(esclonguser); 2610 2555 owl_free(shortuser); 2611 2556 … … 2626 2571 2627 2572 /* name for the filter */ 2628 filtname=owl_malloc(strlen(user)+40); 2629 sprintf(filtname, "aimuser-%s", user); 2573 filtname=owl_sprintf("aimuser-%s", user); 2630 2574 2631 2575 /* if it already exists then go with it. This lets users override */ … … 2639 2583 escuser = owl_text_quote(user, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH); 2640 2584 2641 argbuff=owl_malloc(1000); 2642 sprintf(argbuff, 2643 "( type ^aim$ and ( ( sender ^%s$ and recipient ^%s$ ) or ( sender ^%s$ and recipient ^%s$ ) ) )", 2644 escuser, owl_global_get_aim_screenname_for_filters(&g), 2645 owl_global_get_aim_screenname_for_filters(&g), escuser); 2585 argbuff = owl_sprintf( 2586 "( type ^aim$ and ( ( sender ^%1$s$ and recipient ^%2$s$ ) or " 2587 "( sender ^%2$s$ and recipient ^%1$s$ ) ) )", 2588 escuser, owl_global_get_aim_screenname_for_filters(&g)); 2646 2589 2647 2590 owl_filter_init_fromstring(f, filtname, argbuff); … … 2660 2603 { 2661 2604 owl_filter *f; 2662 char *argbuff, *filtname ;2605 char *argbuff, *filtname, *esctype; 2663 2606 2664 2607 /* name for the filter */ … … 2673 2616 f=owl_malloc(sizeof(owl_filter)); 2674 2617 2675 argbuff = owl_sprintf("type ^%s$", type); 2618 esctype = owl_text_quote(type, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH); 2619 2620 argbuff = owl_sprintf("type ^%s$", esctype); 2676 2621 2677 2622 owl_filter_init_fromstring(f, filtname, argbuff); … … 2682 2627 /* free stuff */ 2683 2628 owl_free(argbuff); 2629 owl_free(esctype); 2684 2630 2685 2631 return filtname; … … 2955 2901 owl_text_tr(quoted, '\'', '.'); 2956 2902 owl_text_tr(quoted, '"', '.'); 2957 sprintf(buff , "%s ^(un)*%s(\\.d)*$", buff, quoted);2903 sprintf(buff + strlen(buff), " ^(un)*%s(\\.d)*$", quoted); 2958 2904 owl_free(quoted); 2959 2905 } … … 2965 2911 owl_text_tr(quoted, '\'', '.'); 2966 2912 owl_text_tr(quoted, '"', '.'); 2967 sprintf(buff , "%s and instance ^(un)*%s(\\.d)*$", buff, quoted);2913 sprintf(buff + strlen(buff), " and instance ^(un)*%s(\\.d)*$", quoted); 2968 2914 owl_free(quoted); 2969 2915 } … … 2973 2919 owl_text_tr(quoted, '\'', '.'); 2974 2920 owl_text_tr(quoted, '"', '.'); 2975 sprintf(buff , "%s and recipient ^%s$", buff, quoted);2921 sprintf(buff + strlen(buff), " and recipient ^%s$", quoted); 2976 2922 owl_free(quoted); 2977 2923 } … … 3065 3011 } 3066 3012 3067 char *owl_function_keymap_summary( void*name)3013 char *owl_function_keymap_summary(char *name) 3068 3014 { 3069 3015 owl_keymap *km -
global.c
rda466e0 r5547211b 139 139 g->recwin=newwin(g->recwinlines, cols, 0, 0); 140 140 if (g->recwin==NULL) { 141 owl_function_debugmsg("_owl_global_setup_windows: newwin returned NULL\n" , g->recwinlines, cols);141 owl_function_debugmsg("_owl_global_setup_windows: newwin returned NULL\n"); 142 142 endwin(); 143 143 exit(50); … … 570 570 strcpy(g->startupargs, ""); 571 571 for (i=0; i<argc; i++) { 572 sprintf(g->startupargs , "%s%s ", g->startupargs, argv[i]);572 sprintf(g->startupargs + strlen(g->startupargs), "%s ", argv[i]); 573 573 } 574 574 g->startupargs[strlen(g->startupargs)-1]='\0'; -
help.c
r0398d55 r799b60e 18 18 owl_fmtext_append_normal 19 19 (&fm, 20 " If you're new to BarnOwl, the first thing you should type is\n\n" 21 " :show quickstart\n\n" 20 22 " For help on a specific command use 'help <command>'\n" 21 23 " For information on advanced keys, use 'show keymaps'.\n" -
keys.c
rdb0ac7e r9b70dd4 282 282 BIND_CMD("M-r", "reply -e", "reply to the current message, but allow editing of recipient"); 283 283 BIND_CMD("M-R", "reply -e sender", "reply to sender of the current message, but allow editing of recipient"); 284 285 BIND_CMD("w", "openurl", "open a URL using a webbrowser");286 284 287 285 BIND_CMD("W", "start-command webzephyr ", "start a webzephyr command"); -
owl.c
r5b37c063 r098376e 323 323 sprintf(buff, "Welcome to barnowl version %s. Press 'h' for on-line help. \n", OWL_VERSION_STRING); 324 324 strcat(startupmsg, buff); 325 strcat(startupmsg, "To see a quick introduction, type ':show quickstart'. \n"); 325 326 strcat(startupmsg, " \n"); 326 327 strcat(startupmsg, "BarnOwl is free software. Type ':show license' for more \n"); 327 strcat(startupmsg, "information. \n"); 328 strcat(startupmsg, " ^ ^ \n"); 328 strcat(startupmsg, "information. ^ ^ \n"); 329 329 strcat(startupmsg, " OvO \n"); 330 330 strcat(startupmsg, "Please report any bugs or suggestions to bug-barnowl@mit.edu ( ) \n"); … … 511 511 int signum; 512 512 if ((signum = owl_global_get_errsignal_and_clear(&g, &si)) > 0) { 513 owl_function_error("Got unexpected signal: %d %s (code: %d band: % d errno: %d)",513 owl_function_error("Got unexpected signal: %d %s (code: %d band: %ld errno: %d)", 514 514 signum, signum==SIGPIPE?"SIGPIPE":"SIG????", 515 515 si.si_code, si.si_band, si.si_errno); … … 612 612 613 613 return 1; 614 }615 616 void owl_process_aim()617 {618 if (owl_global_is_doaimevents(&g)) {619 owl_aim_process_events();620 621 if (owl_global_is_aimloggedin(&g)) {622 if (owl_timer_is_expired(owl_global_get_aim_buddyinfo_timer(&g))) {623 /* owl_buddylist_request_idletimes(owl_global_get_buddylist(&g)); */624 owl_timer_reset(owl_global_get_aim_buddyinfo_timer(&g));625 }626 }627 }628 614 } 629 615 -
owl.h
r43a306c rb940b91 52 52 53 53 #ifndef OWL_VERSION_STRING 54 #define OWL_VERSION_STRING "1.0. 3"54 #define OWL_VERSION_STRING "1.0.4.1" 55 55 #endif 56 56 … … 320 320 321 321 typedef struct _owl_pair { 322 void*key;323 void*value;322 char *key; 323 char *value; 324 324 } owl_pair; 325 325 -
pair.c
r160ea47 rde1c8a5 1 1 #include "owl.h" 2 2 3 void owl_pair_create(owl_pair *p, void *key, void*value) {3 void owl_pair_create(owl_pair *p, char *key, char *value) { 4 4 p->key=key; 5 5 p->value=value; 6 6 } 7 7 8 void owl_pair_set_key(owl_pair *p, void*key) {8 void owl_pair_set_key(owl_pair *p, char *key) { 9 9 p->key=key; 10 10 } 11 11 12 void owl_pair_set_value(owl_pair *p, void*value) {12 void owl_pair_set_value(owl_pair *p, char *value) { 13 13 p->value=value; 14 14 } 15 15 16 void*owl_pair_get_key(owl_pair *p) {16 char *owl_pair_get_key(owl_pair *p) { 17 17 return(p->key); 18 18 } 19 19 20 void*owl_pair_get_value(owl_pair *p) {20 char *owl_pair_get_value(owl_pair *p) { 21 21 return(p->value); 22 22 } -
perl/modules/IRC/lib/BarnOwl/Message/IRC.pm
r38a7f22 rf79d6a2 33 33 @filter = 34 34 (qw{( type ^irc$ and filter personal and }, 35 qw{( ( direction ^in$ and sender}, "^ $who\$",36 qw{ ) or ( direction ^out$ and recipient}, "^ $who\$",35 qw{( ( direction ^in$ and sender}, "^\Q$who\E\$", 36 qw{ ) or ( direction ^out$ and recipient}, "^\Q$who\E\$", 37 37 qw{) ) ) }); 38 38 BarnOwl::command("filter", "$filter", @filter); … … 47 47 $filter = "irc-$network-channel-$channel-$sender-$1"; 48 48 @filter = 49 (qw{type ^irc$ and network}, "^ $network\$",50 qw{and channel}, "^ $channel\$",51 qw{and ( sender}, "^ $sender\$",52 qw{or sender}, "^ $1\$",qq{)});49 (qw{type ^irc$ and network}, "^\Q$network\E\$", 50 qw{and channel}, "^\Q$channel\E\$", 51 qw{and ( sender}, "^\Q$sender\E\$", 52 qw{or sender}, "^\Q$1\E\$",qq{)}); 53 53 } else { 54 54 $filter = "irc-$network-channel-$channel"; 55 @filter = (qw{type ^irc$ and network}, "^ $network\$",56 qw{and channel}, "^ $channel\$");55 @filter = (qw{type ^irc$ and network}, "^\Q$network\E\$", 56 qw{and channel}, "^\Q$channel\E\$"); 57 57 } 58 58 BarnOwl::command("filter", "$filter", @filter); -
perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
r167044b r1c014eec 214 214 if ($body =~ /^\/me (.*)/) { 215 215 $conn->conn->me($to, $1); 216 $body = BarnOwl::Style::boldify($conn->nick.' '.$1);216 $body = '* '.$conn->nick.' '.$1; 217 217 } else { 218 218 $conn->conn->privmsg($to, $body); -
perl/modules/Jabber/lib/BarnOwl/Message/Jabber.pm
r96134cb r9375f8c 70 70 $filter = "jabber-room-$room"; 71 71 BarnOwl::command(qw[filter], $filter, 72 qw[type ^jabber$ and room], "^ $room\$");72 qw[type ^jabber$ and room], "^\Q$room\E\$"); 73 73 return $filter; 74 74 } elsif ($self->login ne 'none') { … … 84 84 my $filter = "jabber-user-$user"; 85 85 BarnOwl::command(qw[filter], $filter, qw[type ^jabber$], 86 qw[and ( ( direction ^in$ and from], "^ $user",87 qw[) or ( direction ^out$ and to ], "^ $user",86 qw[and ( ( direction ^in$ and from], "^\Q$user\E(/.*)?\$", 87 qw[) or ( direction ^out$ and to ], "^\Q$user\E(/.*)?\$", 88 88 qw[ ) ) ]); 89 89 return $filter; -
perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
re979da9 r799b60e 70 70 $BarnOwl::Hooks::mainLoop->add("BarnOwl::Module::Jabber::onMainLoop"); 71 71 $BarnOwl::Hooks::getBuddyList->add("BarnOwl::Module::Jabber::onGetBuddyList"); 72 $BarnOwl::Hooks::getQuickstart->add("BarnOwl::Module::Jabber::onGetQuickstart"); 72 73 $vars{show} = ''; 73 74 BarnOwl::new_variable_bool("jabber:show_offline_buddies", … … 222 223 } 223 224 225 sub onGetQuickstart { 226 return <<'EOF' 227 @b(Jabber:) 228 Type ':jabberlogin @b(username@mit.edu)' to log in to Jabber. The command 229 ':jroster sub @b(somebody@gmail.com)' will request that they let you message 230 them. Once you get a message saying you are subscribed, you can message 231 them by typing ':jwrite @b(somebody@gmail.com)' or just 'j @b(somebody)'. 232 EOF 233 } 234 224 235 ################################################################################ 225 236 ### Owl Commands -
perlconfig.c
r5b37c063 r098376e 44 44 h = newHV(); 45 45 46 #define MSG2H(h,field) hv_store(h, #field, strlen(#field),\47 46 #define MSG2H(h,field) (void)hv_store(h, #field, strlen(#field), \ 47 newSVpv(owl_message_get_##field(m),0), 0) 48 48 49 49 if (owl_message_is_type_zephyr(m) … … 59 59 owl_free(ptr); 60 60 } 61 hv_store(h, "fields", strlen("fields"), newRV_noinc((SV*)av_zfields), 0);62 63 hv_store(h, "auth", strlen("auth"),64 61 (void)hv_store(h, "fields", strlen("fields"), newRV_noinc((SV*)av_zfields), 0); 62 63 (void)hv_store(h, "auth", strlen("auth"), 64 newSVpv(owl_zephyr_get_authstr(owl_message_get_notice(m)),0),0); 65 65 } 66 66 … … 68 68 for(i=0; i<j; i++) { 69 69 pair=owl_list_get_element(&(m->attributes), i); 70 hv_store(h, owl_pair_get_key(pair), strlen(owl_pair_get_key(pair)),71 70 (void)hv_store(h, owl_pair_get_key(pair), strlen(owl_pair_get_key(pair)), 71 newSVpv(owl_pair_get_value(pair),0),0); 72 72 } 73 73 … … 88 88 MSG2H(h, header); 89 89 } 90 hv_store(h, "time", strlen("time"), newSVpv(owl_message_get_timestr(m),0),0);91 hv_store(h, "id", strlen("id"), newSViv(owl_message_get_id(m)),0);92 hv_store(h, "deleted", strlen("deleted"), newSViv(owl_message_is_delete(m)),0);93 hv_store(h, "private", strlen("private"), newSViv(owl_message_is_private(m)),0);94 hv_store(h, "should_wordwrap",95 96 90 (void)hv_store(h, "time", strlen("time"), newSVpv(owl_message_get_timestr(m),0),0); 91 (void)hv_store(h, "id", strlen("id"), newSViv(owl_message_get_id(m)),0); 92 (void)hv_store(h, "deleted", strlen("deleted"), newSViv(owl_message_is_delete(m)),0); 93 (void)hv_store(h, "private", strlen("private"), newSViv(owl_message_is_private(m)),0); 94 (void)hv_store(h, "should_wordwrap", 95 strlen("should_wordwrap"), newSViv( 96 owl_filter_message_match(wrap, m)),0); 97 97 98 98 type = owl_message_get_type(m); … … 102 102 blessas = owl_sprintf("BarnOwl::Message::%s", type); 103 103 104 hr = sv_2mortal(newRV_noinc((SV*)h));104 hr = newRV_noinc((SV*)h); 105 105 stash = gv_stashpv(blessas,0); 106 106 if(!stash) { … … 182 182 dSP ; 183 183 int count; 184 unsigned int len;185 184 SV *msgref, *srv; 186 char *out , *preout;185 char *out; 187 186 188 187 ENTER ; … … 191 190 PUSHMARK(SP) ; 192 191 msgref = owl_perlconfig_message2hashref(m); 193 XPUSHs( msgref);192 XPUSHs(sv_2mortal(msgref)); 194 193 PUTBACK ; 195 194 … … 199 198 200 199 if (SvTRUE(ERRSV)) { 201 STRLEN n_a; 202 owl_function_error("Perl Error: '%s'", SvPV(ERRSV, n_a)); 200 owl_function_error("Perl Error: '%s'", SvPV_nolen(ERRSV)); 203 201 /* and clear the error */ 204 202 sv_setsv (ERRSV, &PL_sv_undef); … … 213 211 214 212 if (srv) { 215 preout=SvPV(srv, len); 216 out = owl_malloc(strlen(preout)+1); 217 strncpy(out, preout, len); 218 out[len] = '\0'; 213 out = owl_strdup(SvPV_nolen(srv)); 219 214 } else { 220 215 out = NULL; … … 235 230 { 236 231 dSP; 237 unsigned int count, len,i;232 unsigned int count, i; 238 233 SV *msgref, *srv; 239 char *out , *preout;234 char *out; 240 235 241 236 msgref = owl_perlconfig_message2hashref(m); … … 245 240 246 241 PUSHMARK(SP); 247 XPUSHs( msgref);242 XPUSHs(sv_2mortal(msgref)); 248 243 for(i=0;i<argc;i++) { 249 244 XPUSHs(sv_2mortal(newSVpv(argv[i], 0))); … … 261 256 262 257 if (SvTRUE(ERRSV)) { 263 STRLEN n_a; 264 owl_function_error("Error: '%s'", SvPV(ERRSV, n_a)); 258 owl_function_error("Error: '%s'", SvPV_nolen(ERRSV)); 265 259 /* and clear the error */ 266 260 sv_setsv (ERRSV, &PL_sv_undef); … … 270 264 271 265 if (srv) { 272 preout=SvPV(srv, len); 273 out = owl_malloc(strlen(preout)+1); 274 strncpy(out, preout, len); 275 out[len] = '\0'; 266 out = owl_strdup(SvPV_nolen(srv)); 276 267 } else { 277 268 out = NULL; … … 304 295 ret=perl_parse(p, owl_perl_xs_init, 2, args, NULL); 305 296 if (ret || SvTRUE(ERRSV)) { 306 STRLEN n_a; 307 err=owl_strdup(SvPV(ERRSV, n_a)); 297 err=owl_strdup(SvPV_nolen(ERRSV)); 308 298 sv_setsv(ERRSV, &PL_sv_undef); /* and clear the error */ 309 299 return(err); … … 312 302 ret=perl_run(p); 313 303 if (ret || SvTRUE(ERRSV)) { 314 STRLEN n_a; 315 err=owl_strdup(SvPV(ERRSV, n_a)); 304 err=owl_strdup(SvPV_nolen(ERRSV)); 316 305 sv_setsv(ERRSV, &PL_sv_undef); /* and clear the error */ 317 306 return(err); … … 342 331 343 332 if (SvTRUE(ERRSV)) { 344 STRLEN n_a; 345 err=owl_strdup(SvPV(ERRSV, n_a)); 333 err=owl_strdup(SvPV_nolen(ERRSV)); 346 334 sv_setsv (ERRSV, &PL_sv_undef); /* and clear the error */ 347 335 return(err); … … 396 384 397 385 if (SvTRUE(ERRSV)) { 398 STRLEN n_a; 399 owl_function_error("Perl Error: '%s'", SvPV(ERRSV, n_a)); 386 owl_function_error("Perl Error: '%s'", SvPV_nolen(ERRSV)); 400 387 sv_setsv (ERRSV, &PL_sv_undef); /* and clear the error */ 401 388 } 402 389 403 390 preout=SvPV(response, len); 404 /* leave enough space in case we have to add a newline */ 405 out = owl_malloc(strlen(preout)+2); 406 strncpy(out, preout, len); 407 out[len] = '\0'; 408 if (!strlen(out) || out[strlen(out)-1]!='\n') { 409 strcat(out, "\n"); 410 } 391 if (len == 0 || preout[len - 1] != '\n') 392 out = owl_sprintf("%s\n", preout); 393 else 394 out = owl_strdup(preout); 411 395 412 396 return(out); … … 439 423 char * ret = NULL; 440 424 SV *rv; 441 STRLEN n_a;442 425 dSP; 443 426 … … 458 441 459 442 if(SvTRUE(ERRSV)) { 460 owl_function_error("%s", SvPV (ERRSV, n_a));443 owl_function_error("%s", SvPV_nolen(ERRSV)); 461 444 (void)POPs; 462 445 } else { … … 465 448 rv = POPs; 466 449 if(SvTRUE(rv)) { 467 ret = owl_strdup(SvPV (rv, n_a));450 ret = owl_strdup(SvPV_nolen(rv)); 468 451 } 469 452 } … … 489 472 SV *cb = (SV*)(e->cbdata); 490 473 SV *text; 491 unsigned int n_a;492 474 dSP; 493 475 … … 508 490 509 491 if(SvTRUE(ERRSV)) { 510 owl_function_error("%s", SvPV (ERRSV, n_a));492 owl_function_error("%s", SvPV_nolen(ERRSV)); 511 493 } 512 494 … … 526 508 call_pv("BarnOwl::Hooks::_mainloop_hook", G_DISCARD|G_EVAL); 527 509 if(SvTRUE(ERRSV)) { 528 STRLEN n_a; 529 owl_function_error("%s", SvPV(ERRSV, n_a)); 510 owl_function_error("%s", SvPV_nolen(ERRSV)); 530 511 } 531 512 return; … … 535 516 { 536 517 SV *cb = d->pfunc; 537 unsigned int n_a;538 518 dSP; 539 519 if(cb == NULL) { … … 550 530 551 531 if(SvTRUE(ERRSV)) { 552 owl_function_error("%s", SvPV (ERRSV, n_a));532 owl_function_error("%s", SvPV_nolen(ERRSV)); 553 533 } 554 534 -
perlglue.xs
r740d5f7 r5d2248c 24 24 * complex argument processing or something, we define a 25 25 * simple version here that takes arguments in as flat a 26 * manner as possible, to simplify the XS code, with a name27 * with a trailing `_internal', and write a perl wrapper in28 * perlwrap.pm that munges the arguments as appropriate and29 * calls theinternal version.26 * manner as possible, to simplify the XS code, put it in 27 * BarnOwl::Intenal::, and write a perl wrapper in perlwrap.pm 28 * that munges the arguments as appropriate and calls the 29 * internal version. 30 30 */ 31 31 … … 62 62 getcurmsg() 63 63 CODE: 64 ST(0) = owl_perlconfig_curmessage2hashref(); 64 RETVAL = owl_perlconfig_curmessage2hashref(); 65 OUTPUT: 66 RETVAL 65 67 66 68 int … … 141 143 if (rv) owl_free(rv); 142 144 143 void 144 new_command_internal(name, func, summary, usage, description) 145 void queue_message(msg) 146 SV *msg 147 PREINIT: 148 owl_message *m; 149 CODE: 150 { 151 if(!SvROK(msg) || SvTYPE(SvRV(msg)) != SVt_PVHV) { 152 croak("Usage: BarnOwl::queue_message($message)"); 153 } 154 155 m = owl_perlconfig_hashref2message(msg); 156 157 owl_global_messagequeue_addmsg(&g, m); 158 } 159 160 void admin_message(header, body) 161 char *header 162 char *body 163 CODE: 164 { 165 owl_function_adminmsg(header, body); 166 } 167 168 void start_question(line, callback) 169 char *line 170 SV *callback 171 PREINIT: 172 CODE: 173 { 174 if(!SV_IS_CODEREF(callback)) 175 croak("Callback must be a subref"); 176 177 owl_function_start_question(line); 178 179 SvREFCNT_inc(callback); 180 owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback); 181 owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback); 182 } 183 184 void start_password(line, callback) 185 char *line 186 SV *callback 187 PREINIT: 188 CODE: 189 { 190 if(!SV_IS_CODEREF(callback)) 191 croak("Callback must be a subref"); 192 193 owl_function_start_password(line); 194 195 SvREFCNT_inc(callback); 196 owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback); 197 owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback); 198 } 199 200 void start_edit_win(line, callback) 201 char *line 202 SV *callback 203 PREINIT: 204 owl_editwin * e; 205 char buff[1024]; 206 CODE: 207 { 208 if(!SV_IS_CODEREF(callback)) 209 croak("Callback must be a subref"); 210 211 e = owl_global_get_typwin(&g); 212 owl_editwin_new_style(e, OWL_EDITWIN_STYLE_MULTILINE, 213 owl_global_get_msg_history(&g)); 214 owl_editwin_clear(e); 215 owl_editwin_set_dotsend(e); 216 snprintf(buff, 1023, "----> %s\n", line); 217 owl_editwin_set_locktext(e, buff); 218 219 owl_global_set_typwin_active(&g); 220 221 SvREFCNT_inc(callback); 222 owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback); 223 owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback); 224 } 225 226 227 char * 228 get_data_dir () 229 CODE: 230 RETVAL = (char *) owl_get_datadir(); 231 OUTPUT: 232 RETVAL 233 234 char * 235 get_config_dir () 236 CODE: 237 RETVAL = (char *) owl_global_get_confdir(&g); 238 OUTPUT: 239 RETVAL 240 241 void 242 popless_text(text) 243 char *text 244 CODE: 245 { 246 owl_function_popless_text(text); 247 } 248 249 void 250 popless_ztext(text) 251 char *text 252 CODE: 253 { 254 owl_fmtext fm; 255 owl_fmtext_init_null(&fm); 256 owl_fmtext_append_ztext(&fm, text); 257 owl_function_popless_fmtext(&fm); 258 owl_fmtext_free(&fm); 259 } 260 261 void 262 error(text) 263 char *text 264 CODE: 265 { 266 owl_function_error("%s", text); 267 } 268 269 void 270 create_style(name, object) 271 char *name 272 SV *object 273 PREINIT: 274 owl_style *s; 275 CODE: 276 { 277 s = owl_malloc(sizeof(owl_style)); 278 owl_style_create_perl(s, name, object); 279 owl_global_add_style(&g, s); 280 } 281 282 int 283 getnumcolors() 284 CODE: 285 RETVAL = owl_function_get_color_count(); 286 OUTPUT: 287 RETVAL 288 289 void 290 _remove_filter(filterName) 291 char *filterName 292 CODE: 293 { 294 /* Don't delete the current view, or the 'all' filter */ 295 if (strcmp(filterName, owl_view_get_filtname(owl_global_get_current_view(&g))) 296 && strcmp(filterName, "all")) { 297 owl_global_remove_filter(&g,filterName); 298 } 299 } 300 301 char * 302 wordwrap(in, cols) 303 char *in 304 int cols 305 PREINIT: 306 char *rv = NULL; 307 CODE: 308 rv = owl_text_wordwrap(in, cols); 309 RETVAL = rv; 310 OUTPUT: 311 RETVAL 312 CLEANUP: 313 if (rv) owl_free(rv); 314 315 void 316 add_dispatch(fd, cb) 317 int fd 318 SV * cb 319 CODE: 320 SvREFCNT_inc(cb); 321 owl_select_add_perl_dispatch(fd, cb); 322 323 void 324 remove_dispatch(fd) 325 int fd 326 CODE: 327 owl_select_remove_perl_dispatch(fd); 328 329 MODULE = BarnOwl PACKAGE = BarnOwl::Internal 330 331 332 void 333 new_command(name, func, summary, usage, description) 145 334 char *name 146 335 SV *func … … 172 361 } 173 362 174 void queue_message(msg) 175 SV *msg 176 PREINIT: 177 owl_message *m; 178 CODE: 179 { 180 if(!SvROK(msg) || SvTYPE(SvRV(msg)) != SVt_PVHV) { 181 croak("Usage: BarnOwl::queue_message($message)"); 182 } 183 184 m = owl_perlconfig_hashref2message(msg); 185 186 owl_global_messagequeue_addmsg(&g, m); 187 } 188 189 void admin_message(header, body) 190 char *header 191 char *body 192 CODE: 193 { 194 owl_function_adminmsg(header, body); 195 } 196 197 void start_question(line, callback) 198 char *line 199 SV *callback 200 PREINIT: 201 CODE: 202 { 203 if(!SV_IS_CODEREF(callback)) 204 croak("Callback must be a subref"); 205 206 owl_function_start_question(line); 207 208 SvREFCNT_inc(callback); 209 owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback); 210 owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback); 211 } 212 213 void start_password(line, callback) 214 char *line 215 SV *callback 216 PREINIT: 217 CODE: 218 { 219 if(!SV_IS_CODEREF(callback)) 220 croak("Callback must be a subref"); 221 222 owl_function_start_password(line); 223 224 SvREFCNT_inc(callback); 225 owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback); 226 owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback); 227 } 228 229 void start_edit_win(line, callback) 230 char *line 231 SV *callback 232 PREINIT: 233 owl_editwin * e; 234 char buff[1024]; 235 CODE: 236 { 237 if(!SV_IS_CODEREF(callback)) 238 croak("Callback must be a subref"); 239 240 e = owl_global_get_typwin(&g); 241 owl_editwin_new_style(e, OWL_EDITWIN_STYLE_MULTILINE, 242 owl_global_get_msg_history(&g)); 243 owl_editwin_clear(e); 244 owl_editwin_set_dotsend(e); 245 snprintf(buff, 1023, "----> %s\n", line); 246 owl_editwin_set_locktext(e, buff); 247 248 owl_global_set_typwin_active(&g); 249 250 SvREFCNT_inc(callback); 251 owl_editwin_set_cbdata(owl_global_get_typwin(&g), callback); 252 owl_editwin_set_callback(owl_global_get_typwin(&g), owl_perlconfig_edit_callback); 253 } 254 255 256 char * 257 get_data_dir () 258 CODE: 259 RETVAL = (char *) owl_get_datadir(); 260 OUTPUT: 261 RETVAL 262 263 char * 264 get_config_dir () 265 CODE: 266 RETVAL = (char *) owl_global_get_confdir(&g); 267 OUTPUT: 268 RETVAL 269 270 void 271 popless_text(text) 272 char *text 273 CODE: 274 { 275 owl_function_popless_text(text); 276 } 277 278 void 279 popless_ztext(text) 280 char *text 281 CODE: 282 { 283 owl_fmtext fm; 284 owl_fmtext_init_null(&fm); 285 owl_fmtext_append_ztext(&fm, text); 286 owl_function_popless_fmtext(&fm); 287 owl_fmtext_free(&fm); 288 } 289 290 void 291 error(text) 292 char *text 293 CODE: 294 { 295 owl_function_error("%s", text); 296 } 297 298 void 299 create_style(name, object) 300 char *name 301 SV *object 302 PREINIT: 303 owl_style *s; 304 CODE: 305 { 306 s = owl_malloc(sizeof(owl_style)); 307 owl_style_create_perl(s, name, object); 308 owl_global_add_style(&g, s); 309 } 310 311 int 312 getnumcolors() 313 CODE: 314 RETVAL = owl_function_get_color_count(); 315 OUTPUT: 316 RETVAL 317 318 void 319 _remove_filter(filterName) 320 char *filterName 321 CODE: 322 { 323 /* Don't delete the current view, or the 'all' filter */ 324 if (strcmp(filterName, owl_view_get_filtname(owl_global_get_current_view(&g))) 325 && strcmp(filterName, "all")) { 326 owl_global_remove_filter(&g,filterName); 327 } 328 } 329 330 char * 331 wordwrap(in, cols) 332 char *in 333 int cols 334 PREINIT: 335 char *rv = NULL; 336 CODE: 337 rv = owl_text_wordwrap(in, cols); 338 RETVAL = rv; 339 OUTPUT: 340 RETVAL 341 CLEANUP: 342 if (rv) owl_free(rv); 343 344 void 345 new_variable_string_internal(name, ival, summ, desc) 363 void 364 new_variable_string(name, ival, summ, desc) 346 365 char * name 347 366 char * ival … … 356 375 357 376 void 358 new_variable_int _internal(name, ival, summ, desc)377 new_variable_int(name, ival, summ, desc) 359 378 char * name 360 379 int ival … … 369 388 370 389 void 371 new_variable_bool _internal(name, ival, summ, desc)390 new_variable_bool(name, ival, summ, desc) 372 391 char * name 373 392 int ival … … 380 399 desc, 381 400 ival); 382 383 void384 add_dispatch(fd, cb)385 int fd386 SV * cb387 CODE:388 SvREFCNT_inc(cb);389 owl_select_add_perl_dispatch(fd, cb);390 391 void392 remove_dispatch(fd)393 int fd394 CODE:395 owl_select_remove_perl_dispatch(fd); -
perlwrap.pm
r740d5f7 r5d2248c 242 242 ); 243 243 244 BarnOwl:: new_command_internal($name, $func, $args{summary}, $args{usage}, $args{description});244 BarnOwl::Internal::new_command($name, $func, $args{summary}, $args{usage}, $args{description}); 245 245 } 246 246 … … 275 275 276 276 sub new_variable_int { 277 unshift @_, \&BarnOwl:: new_variable_int_internal, 0;277 unshift @_, \&BarnOwl::Internal::new_variable_int, 0; 278 278 goto \&_new_variable; 279 279 } 280 280 281 281 sub new_variable_bool { 282 unshift @_, \&BarnOwl:: new_variable_bool_internal, 0;282 unshift @_, \&BarnOwl::Internal::new_variable_bool, 0; 283 283 goto \&_new_variable; 284 284 } 285 285 286 286 sub new_variable_string { 287 unshift @_, \&BarnOwl:: new_variable_string_internal, "";287 unshift @_, \&BarnOwl::Internal::new_variable_string, ""; 288 288 goto \&_new_variable; 289 289 } … … 810 810 displayed in a popup window, with zephyr formatting parsed. 811 811 812 =item $getQuickstart 813 814 Called by :show quickstart to display 2-5 lines of help on how to 815 start using the protocol. The result from every function registered 816 with this hook will be appended and displayed in an admin message, 817 with zephyr formatting parsed. The format should be 818 "@b(Protocol:)\nSome text.\nMore text.\n" 819 812 820 =back 813 821 … … 818 826 our @EXPORT_OK = qw($startup $shutdown 819 827 $receiveMessage $newMessage 820 $mainLoop $getBuddyList); 828 $mainLoop $getBuddyList 829 $getQuickstart); 821 830 822 831 our %EXPORT_TAGS = (all => [@EXPORT_OK]); … … 828 837 our $mainLoop = BarnOwl::Hook->new; 829 838 our $getBuddyList = BarnOwl::Hook->new; 839 our $getQuickstart = BarnOwl::Hook->new; 830 840 831 841 # Internal startup/shutdown routines called by the C code … … 921 931 } 922 932 933 sub _get_quickstart { 934 return join("\n", $getQuickstart->run); 935 } 936 923 937 ################################################################################ 924 938 # Built-in perl styles -
popexec.c
r1971b59 r44fc93b 73 73 dup2(child_write_fd, 2 /*stderr*/); 74 74 close(child_write_fd); 75 76 while(0) {77 write(child_write_fd, "meep\n", 5);78 sleep(1);79 }80 75 81 76 argv[0] = "sh"; -
regex.c
r8b7466b r554a2b8 13 13 { 14 14 int ret; 15 char buff1[LINE] , buff2[LINE];15 char buff1[LINE]; 16 16 char *ptr; 17 17 … … 29 29 if (ret) { 30 30 regerror(ret, NULL, buff1, LINE); 31 sprintf(buff2, "Error in regular expression: %s", buff1); 32 owl_function_makemsg(buff2); 31 owl_function_makemsg("Error in regular expression: %s", buff1); 33 32 owl_free(re->string); 34 33 re->string=NULL; -
tester.c
r1cf3f8d3 r3381399 6 6 7 7 owl_global g; 8 9 void screeninit()10 {11 char buff[1024];12 13 sprintf(buff, "TERMINFO=%s", TERMINFO);14 putenv(buff);15 16 initscr();17 start_color();18 /* cbreak(); */19 raw();20 noecho();21 intrflush(stdscr,FALSE);22 keypad(stdscr,TRUE);23 nodelay(stdscr,1);24 clear();25 refresh();26 meta(stdscr, TRUE);27 }28 29 void test1()30 {31 int j;32 owl_editwin e;33 34 screeninit();35 36 owl_editwin_init(&e, stdscr, LINES, COLS, OWL_EDITWIN_STYLE_MULTILINE, NULL);37 /* owl_editwin_set_locktext(&e, "Here is some locktext:\n");*/38 doupdate();39 while (1) {40 usleep(50);41 42 j=getch();43 44 if (j==ERR) continue;45 46 if (j==3) break;47 48 if (j==27) {49 j=getch();50 if (j==ERR) continue;51 owl_editwin_process_char(&e, j);52 doupdate();53 } else {54 owl_editwin_process_char(&e, j);55 doupdate();56 }57 }58 endwin();59 printf("Had:\n%s", owl_editwin_get_text(&e));60 }61 62 void test2(char *in)63 {64 owl_fmtext t;65 66 screeninit();67 68 owl_fmtext_init_null(&t);69 owl_fmtext_append_ztext(&t, in);70 owl_fmtext_curs_waddstr(&t, stdscr);71 wrefresh(stdscr);72 sleep(5000);73 endwin();74 }75 76 void test3()77 {78 ZNotice_t *n;79 80 printf("%i\n", sizeof(n->z_uid.zuid_addr));81 /* gethostbyaddr((char *) &(n->z_uid.zuid_addr), sizeof(n->z_uid.zuid_addr), AF_INET); */82 }83 84 void colorinfo()85 {86 char buff[1024];87 88 screeninit();89 sprintf(buff, "Have %i COLOR_PAIRS\n", COLOR_PAIRS);90 addstr(buff);91 refresh();92 sleep(10);93 endwin();94 }95 96 void test4()97 {98 int j;99 char buff[1024];100 101 screeninit();102 103 while (1) {104 usleep(100);105 106 j=getch();107 108 if (j==ERR) continue;109 110 if (j==3) break;111 sprintf(buff, "%o\n", j);112 addstr(buff);113 }114 endwin();115 }116 117 void test_keypress()118 {119 int j, rev;120 char buff[1024], buff2[64];121 122 screeninit();123 124 while (1) {125 usleep(100);126 127 j=wgetch(stdscr);128 129 if (j==ERR) continue;130 131 if (j==3) break;132 if (0 == owl_keypress_tostring(j, 0, buff2, 1000)) {133 rev = owl_keypress_fromstring(buff2);134 sprintf(buff, "%s : 0x%x 0%o %d %d %s\n", buff2, j, j, j, rev,135 (j==rev?"matches":"*** WARNING: Does Not Reverse"));136 } else {137 sprintf(buff, "UNKNOWN : 0x%x 0%o %d\n", j, j, j);138 }139 addstr(buff);140 }141 endwin();142 }143 144 8 145 9 #define OWL_DICT_NTESTS 20 … … 155 19 156 20 int numfailures=0; 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); 160 numfailures += owl_util_regtest(); 161 numfailures += owl_dict_regtest(); 162 numfailures += owl_variable_regtest(); 163 numfailures += owl_filter_regtest(); 164 numfailures += owl_obarray_regtest(); 165 if (numfailures) { 21 printf("1..%d\n", OWL_UTIL_NTESTS+OWL_DICT_NTESTS+OWL_VARIABLE_NTESTS 22 +OWL_FILTER_NTESTS+OWL_OBARRAY_NTESTS); 23 numfailures += owl_util_regtest(); 24 numfailures += owl_dict_regtest(); 25 numfailures += owl_variable_regtest(); 26 numfailures += owl_filter_regtest(); 27 numfailures += owl_obarray_regtest(); 28 if (numfailures) { 166 29 fprintf(stderr, "# *** WARNING: %d failures total\n", numfailures); 167 }168 return(numfailures);169 } else if (argc==2 && 0==strcmp(argv[1],"test1")) {170 test1();171 } else if (argc==2 && 0==strcmp(argv[1],"colorinfo")) {172 colorinfo();173 } else if (argc==2 && 0==strcmp(argv[1],"test4")) {174 test4();175 } else if (argc==2 && 0==strcmp(argv[1],"keypress")) {176 test_keypress();177 } else {178 fprintf(stderr, "No test specified. Current options are: reg test1\n");179 30 } 180 return( 0);31 return(numfailures); 181 32 } -
util.c
r601733d r6eaf35b 373 373 374 374 if (days>0) { 375 out=owl_sprintf("%i d %2.2i:%2.2 i", days, hours, run);375 out=owl_sprintf("%i d %2.2i:%2.2li", days, hours, run); 376 376 } else { 377 out=owl_sprintf(" %2.2i:%2.2 i", hours, run);377 out=owl_sprintf(" %2.2i:%2.2li", hours, run); 378 378 } 379 379 return(out); -
variable.c
r451db9e r160d3f4 351 351 " the cursor will be near the center.\n", 352 352 "normal,top,neartop,center,paged,pagedcenter" ), 353 354 OWLVAR_ENUM( "webbrowser" /* %OwlVarStub */, OWL_WEBBROWSER_NETSCAPE,355 "web browser to use to launch URLs",356 "When the 'w' key is pressed, this browser is used\n"357 "to display the requested URL.\n",358 "none,netscape,galeon,opera" ),359 353 360 354 … … 1056 1050 FAIL_UNLESS("get int 7", 9==owl_variable_get_int(&vd,"typewinsize")); 1057 1051 1058 FAIL_UNLESS("get enum", OWL_WEBBROWSER_NETSCAPE==owl_variable_get_int(&vd,"webbrowser"));1059 FAIL_UNLESS("get enum as string 1", 0==owl_variable_get_tostring(&vd,"webbrowser", buf, 1024));1060 FAIL_UNLESS("get enum as string 2", 0==strcmp(buf,"netscape"));1061 FAIL_UNLESS("set enum 1", 0==owl_variable_set_int(&vd,"webbrowser",OWL_WEBBROWSER_GALEON));1062 FAIL_UNLESS("get enum 2", OWL_WEBBROWSER_GALEON==owl_variable_get_int(&vd,"webbrowser"));1063 FAIL_UNLESS("set enum 1b", -1==owl_variable_set_int(&vd,"webbrowser",-3));1064 FAIL_UNLESS("set enum 1b", -1==owl_variable_set_int(&vd,"webbrowser",209));1065 FAIL_UNLESS("get enum 2b", OWL_WEBBROWSER_GALEON==owl_variable_get_int(&vd,"webbrowser"));1066 FAIL_UNLESS("set enum 3", 0==owl_variable_set_fromstring(&vd,"webbrowser","none",0,0));1067 FAIL_UNLESS("get enum 4", OWL_WEBBROWSER_NONE==owl_variable_get_int(&vd,"webbrowser"));1068 FAIL_UNLESS("set enum 5", 0==owl_variable_set_fromstring(&vd,"webbrowser","netscape",0,0));1069 FAIL_UNLESS("get enum 6", OWL_WEBBROWSER_NETSCAPE==owl_variable_get_int(&vd,"webbrowser"));1070 FAIL_UNLESS("set enum 7", -1==owl_variable_set_fromstring(&vd,"webbrowser","xxx",0,0));1071 FAIL_UNLESS("set enum 8", -1==owl_variable_set_fromstring(&vd,"webbrowser","",0,0));1072 FAIL_UNLESS("set enum 9", -1==owl_variable_set_fromstring(&vd,"webbrowser","netscapey",0,0));1073 FAIL_UNLESS("get enum 10", OWL_WEBBROWSER_NETSCAPE==owl_variable_get_int(&vd,"webbrowser"));1074 1075 1052 owl_variable_dict_newvar_string(&vd, "stringvar", "", "", "testval"); 1076 1053 FAIL_UNLESS("get new string var", NULL != (v = owl_variable_get(&vd, "stringvar", OWL_VARIABLE_STRING))); -
wcwidth.c
r47519e1b r44fc93b 62 62 #include <wchar.h> 63 63 64 st atic struct interval {64 struct interval { /* noproto */ 65 65 int first; 66 66 int last; -
zcrypt.c
r34509d5 r5547211b 375 375 376 376 for (i = 0; i < 8; i++) { 377 sprintf(out , "%s%c", out, ((output[i] & 0xf0) >> 4) + BASE_CODE);378 sprintf(out , "%s%c", out, (output[i] & 0x0f) + BASE_CODE);377 sprintf(out + strlen(out), "%c", ((output[i] & 0xf0) >> 4) + BASE_CODE); 378 sprintf(out + strlen(out), "%c", (output[i] & 0x0f) + BASE_CODE); 379 379 } 380 380 -
zephyr.c
r451db9e r5547211b 814 814 ZGetLocations(&locations,&one); 815 815 myuser=short_zuser(user); 816 sprintf(out , "%s%s: %s\t%s\t%s\n", out, myuser,816 sprintf(out + strlen(out), "%s: %s\t%s\t%s\n", myuser, 817 817 locations.host ? locations.host : "?", 818 818 locations.tty ? locations.tty : "?", -
zwrite.c
r3f3ee61 r5547211b 231 231 for (i=0; i<j; i++) { 232 232 if (strcmp(z->realm, "")) { 233 sprintf(toline , "%s%s@%s ", toline, (char *) owl_list_get_element(&(z->recips), i), z->realm);233 sprintf(toline + strlen(toline), "%s@%s ", (char *) owl_list_get_element(&(z->recips), i), z->realm); 234 234 } else { 235 sprintf(toline , "%s%s ", toline, (char *) owl_list_get_element(&(z->recips), i));235 sprintf(toline + strlen(toline), "%s ", (char *) owl_list_get_element(&(z->recips), i)); 236 236 } 237 237 } -
.gitignore
ree0574c r3e9485d 1 *~ 1 2 *.a 2 3 autom4te.cache … … 10 11 core 11 12 jabber.log 13 libfaim/rxhandlers.c.orig 12 14 Makefile 13 15 META.yml
Note: See TracChangeset
for help on using the changeset viewer.