Changeset ec6ff52
- Timestamp:
- Oct 17, 2003, 5:16:25 PM (22 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 836ea3a3
- Parents:
- a053de8
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile.in
rf4d0975 rec6ff52 23 23 regex.c history.c view.c dict.c variable.c filterelement.c pair.c \ 24 24 keypress.c keymap.c keybinding.c cmd.c context.c zcrypt.c \ 25 aim.c buddy.c buddylist.c timer.c style.c stylefunc.c 25 aim.c buddy.c buddylist.c timer.c style.c stylefunc.c errqueue.c 26 26 OWL_SRC = owl.c 27 27 TESTER_SRC = tester.c -
aim.c
r257a22f rec6ff52 26 26 }; 27 27 28 /*29 28 static char *msgerrreasons[] = { 30 29 "Invalid error", … … 55 54 }; 56 55 static int msgerrreasonslen = 25; 57 */58 56 59 57 static void faimtest_debugcb(aim_session_t *sess, int level, const char *format, va_list va); … … 245 243 246 244 /* I don't know how to check for an error yet */ 247 return( 0);245 return(ret); 248 246 } 249 247 … … 1598 1596 1599 1597 /* printf("snac threw error (reason 0x%04x: %s)\n", reason, (reason<msgerrreasonslen)?msgerrreasons[reason]:"unknown"); */ 1598 owl_function_makemsg(msgerrreasons[reason]); 1600 1599 1601 1600 return 1; -
commands.c
r2404c3a rec6ff52 585 585 "show version\n" 586 586 "show view [<view>]\n" 587 "show status\n", 587 "show status\n" 588 "show errors\n", 588 589 589 590 "Show colors will display a list of valid colors for the\n" … … 600 601 "for formatting messages.\n\n" 601 602 "Show variables will list the names of all variables.\n\n" 603 "Show errors will show a list of errors ecountered by Owl.\n\n" 602 604 "SEE ALSO: filter, view, alias, bindkey, help\n"), 603 605 … … 1922 1924 } else if (!strcmp(argv[1], "status")) { 1923 1925 owl_function_status(); 1926 } else if (!strcmp(argv[1], "errors")) { 1927 owl_function_showerrs(); 1924 1928 } else { 1925 1929 owl_function_makemsg("Unknown subcommand for 'show' command (see 'help show' for allowed args)"); -
functions.c
r8a54409 rec6ff52 67 67 v=owl_global_get_current_view(&g); 68 68 if (viewname && strcmp(viewname, owl_view_get_name(v))) { 69 owl_function_ makemsg("No view named '%s'", viewname);69 owl_function_error("No view named '%s'", viewname); 70 70 return; 71 71 } … … 218 218 ret=owl_zwrite_create_from_line(&z, line); 219 219 if (ret) { 220 owl_function_ makemsg("Error in zwrite arugments");220 owl_function_error("Error in zwrite arugments"); 221 221 owl_zwrite_free(&z); 222 222 return; … … 343 343 ret=owl_zcrypt_encrypt(cryptmsg, mymsg, owl_zwrite_get_class(&z), owl_zwrite_get_instance(&z)); 344 344 if (ret) { 345 owl_function_ makemsg("Error in zcrypt, possibly no key found. Message not sent.");345 owl_function_error("Error in zcrypt, possibly no key found. Message not sent."); 346 346 owl_function_beep(); 347 347 owl_free(cryptmsg); … … 379 379 void owl_function_aimwrite(char *to) 380 380 { 381 int ret; 382 381 383 /* send the message */ 382 owl_aim_send_im(to, owl_editwin_get_text(owl_global_get_typwin(&g))); 383 owl_function_makemsg("AIM message sent."); 384 ret=owl_aim_send_im(to, owl_editwin_get_text(owl_global_get_typwin(&g))); 385 if (!ret) { 386 owl_function_makemsg("AIM message sent."); 387 } else { 388 owl_function_error("Could not send AIM message."); 389 } 384 390 385 391 /* display the message as an outgoing message in the receive window */ … … 410 416 f=owl_global_get_filter(&g, filter); 411 417 if (!f) { 412 owl_function_ makemsg("No %s filter defined", filter);418 owl_function_error("No %s filter defined", filter); 413 419 return; 414 420 } … … 434 440 435 441 if (!found) { 436 owl_function_ makemsg("already at last%s message%s%s",442 owl_function_error("already at last%s message%s%s", 437 443 skip_deleted?" non-deleted":"", 438 444 filter?" in ":"", filter?filter:""); … … 460 466 f=owl_global_get_filter(&g, filter); 461 467 if (!f) { 462 owl_function_ makemsg("No %s filter defined", filter);468 owl_function_error("No %s filter defined", filter); 463 469 return; 464 470 } … … 483 489 484 490 if (!found) { 485 owl_function_ makemsg("already at first%s message%s%s",491 owl_function_error("already at first%s message%s%s", 486 492 skip_deleted?" non-deleted":"", 487 493 filter?" in ":"", filter?filter:""); … … 538 544 /* bail if there's no current message */ 539 545 if (owl_view_get_size(v) < 1) { 540 owl_function_ makemsg("No current message to delete");546 owl_function_error("No current message to delete"); 541 547 return; 542 548 } … … 565 571 566 572 if (owl_view_get_size(v) < 1) { 567 owl_function_ makemsg("No current message to undelete");573 owl_function_error("No current message to undelete"); 568 574 return; 569 575 } … … 677 683 } else { 678 684 owl_function_beep(); 679 owl_function_ makemsg("Already full left");685 owl_function_error("Already full left"); 680 686 } 681 687 } … … 697 703 owl_function_makemsg("Subscribed to messages from file."); 698 704 } else if (ret==-1) { 699 owl_function_ makemsg("Could not open file.");705 owl_function_error("Could not open file."); 700 706 } else { 701 owl_function_ makemsg("Error subscribing to messages from file.");707 owl_function_error("Error subscribing to messages from file."); 702 708 } 703 709 } … … 713 719 owl_function_makemsg("Subscribed to login messages from file."); 714 720 } else if (ret==-1) { 715 owl_function_ makemsg("Could not open file for login subscriptions.");721 owl_function_error("Could not open file for login subscriptions."); 716 722 } else { 717 owl_function_ makemsg("Error subscribing to login messages from file.");723 owl_function_error("Error subscribing to login messages from file."); 718 724 } 719 725 } … … 776 782 } 777 783 778 void owl_function_makemsg(char *fmt, ...)779 {780 va_list ap;781 char buff[2048];782 783 if (!owl_global_get_curs_msgwin(&g)) return;784 785 va_start(ap, fmt);786 werase(owl_global_get_curs_msgwin(&g));787 788 vsnprintf(buff, 2048, fmt, ap);789 owl_function_debugmsg("makemsg: %s", buff);790 waddstr(owl_global_get_curs_msgwin(&g), buff);791 wnoutrefresh(owl_global_get_curs_msgwin(&g));792 owl_global_set_needrefresh(&g);793 va_end(ap);794 }795 796 void owl_function_errormsg(char *fmt, ...)797 {798 va_list ap;799 char buff[2048];800 801 if (!owl_global_get_curs_msgwin(&g)) return;802 803 va_start(ap, fmt);804 werase(owl_global_get_curs_msgwin(&g));805 806 vsnprintf(buff, 2048, fmt, ap);807 owl_function_debugmsg("ERROR: %s", buff);808 waddstr(owl_global_get_curs_msgwin(&g), buff);809 waddstr(owl_global_get_curs_msgwin(&g), "ERROR: ");810 wnoutrefresh(owl_global_get_curs_msgwin(&g));811 owl_global_set_needrefresh(&g);812 va_end(ap);813 }814 815 784 void owl_function_openurl() 816 785 { … … 824 793 825 794 if (webbrowser < 0 || webbrowser == OWL_WEBBROWSER_NONE) { 826 owl_function_ makemsg("No browser selected");795 owl_function_error("No browser selected"); 827 796 return; 828 797 } … … 833 802 834 803 if (!m || owl_view_get_size(v)==0) { 835 owl_function_ makemsg("No current message selected");804 owl_function_error("No current message selected"); 836 805 return; 837 806 } … … 882 851 } else { 883 852 owl_function_beep(); 884 owl_function_ makemsg("Could not find URL to open.");853 owl_function_error("Could not find URL to open."); 885 854 return; 886 855 } … … 890 859 if (*ptr1 == '"' || *ptr1 == '\\') { 891 860 owl_function_beep(); 892 owl_function_ makemsg("URL contains invalid characters.");861 owl_function_error("URL contains invalid characters."); 893 862 return; 894 863 } … … 1162 1131 ret=owl_zephyr_sub(class, inst, recip); 1163 1132 if (ret) { 1164 owl_function_ makemsg("Error subscribing.");1133 owl_function_error("Error subscribing."); 1165 1134 } else { 1166 1135 owl_function_makemsg("Subscribed."); … … 1174 1143 ret=owl_zephyr_unsub(class, inst, recip); 1175 1144 if (ret) { 1176 owl_function_ makemsg("Error subscribing.");1145 owl_function_error("Error subscribing."); 1177 1146 } else { 1178 1147 owl_function_makemsg("Unsubscribed."); … … 1278 1247 m=owl_view_get_element(v, owl_global_get_curmsg(&g)); 1279 1248 if (!m || owl_view_get_size(v)==0) { 1280 owl_function_ makemsg("No message selected\n");1249 owl_function_error("No message selected\n"); 1281 1250 return; 1282 1251 } … … 1443 1412 1444 1413 if (!m || owl_view_get_size(v)==0) { 1445 owl_function_ makemsg("No current message");1414 owl_function_error("No current message"); 1446 1415 return; 1447 1416 } … … 1472 1441 /* Bail if the curmsg isn't the last one displayed */ 1473 1442 if (curmsg != owl_mainwin_get_last_msg(owl_global_get_mainwin(&g))) { 1474 owl_function_ makemsg("The entire message is already displayed");1443 owl_function_error("The entire message is already displayed"); 1475 1444 return; 1476 1445 } … … 1478 1447 /* Bail if we're not truncated */ 1479 1448 if (!owl_mainwin_is_curmsg_truncated(owl_global_get_mainwin(&g))) { 1480 owl_function_ makemsg("The entire message is already displayed");1449 owl_function_error("The entire message is already displayed"); 1481 1450 return; 1482 1451 } … … 1647 1616 owl_global_set_needrefresh(&g); 1648 1617 } else { 1649 owl_function_ makemsg("No message with id %d: unable to mark for (un)delete",id);1618 owl_function_error("No message with id %d: unable to mark for (un)delete",id); 1650 1619 } 1651 1620 } … … 1664 1633 f=owl_global_get_filter(&g, "trash"); 1665 1634 if (!f) { 1666 owl_function_ makemsg("No trash filter defined");1635 owl_function_error("No trash filter defined"); 1667 1636 return; 1668 1637 } … … 1787 1756 1788 1757 if (owl_view_get_size(owl_global_get_current_view(&g))==0) { 1789 owl_function_ makemsg("No message selected");1758 owl_function_error("No message selected"); 1790 1759 } else { 1791 1760 char *class, *inst, *to, *cc=NULL; … … 1793 1762 m=owl_view_get_element(owl_global_get_current_view(&g), owl_global_get_curmsg(&g)); 1794 1763 if (!m) { 1795 owl_function_ makemsg("No message selected");1764 owl_function_error("No message selected"); 1796 1765 return; 1797 1766 } … … 1801 1770 if (f) { 1802 1771 if (owl_filter_message_match(f, m)) { 1803 owl_function_ makemsg("Sorry, replies to this message have been disabled by the reply-lockout filter");1772 owl_function_error("Sorry, replies to this message have been disabled by the reply-lockout filter"); 1804 1773 return; 1805 1774 } … … 1808 1777 /* admin */ 1809 1778 if (owl_message_is_type_admin(m)) { 1810 owl_function_ makemsg("You cannot reply to an admin message");1779 owl_function_error("You cannot reply to an admin message"); 1811 1780 return; 1812 1781 } … … 2004 1973 2005 1974 if (argc<2) { 2006 owl_function_ makemsg("Wrong number of arguments to the exec command");1975 owl_function_error("Wrong number of arguments to the exec command"); 2007 1976 return NULL; 2008 1977 } … … 2047 2016 2048 2017 if (argc<2) { 2049 owl_function_ makemsg("Wrong number of arguments to perl command");2018 owl_function_error("Wrong number of arguments to perl command"); 2050 2019 return NULL; 2051 2020 } … … 2093 2062 f=owl_global_get_filter(&g, filtname); 2094 2063 if (!f) { 2095 owl_function_ makemsg("Unknown filter");2064 owl_function_error("Unknown filter %s", filtname); 2096 2065 return; 2097 2066 } … … 2142 2111 f=owl_global_get_filter(&g, filtname); 2143 2112 if (!f) { 2144 owl_function_ makemsg("Unknown filter");2113 owl_function_error("Unknown filter %s", filtname); 2145 2114 return; 2146 2115 } … … 2172 2141 2173 2142 if (argc < 2) { 2174 owl_function_ makemsg("Wrong number of arguments to filter command");2143 owl_function_error("Wrong number of arguments to filter command"); 2175 2144 return; 2176 2145 } … … 2180 2149 /* don't touch the all filter */ 2181 2150 if (!strcmp(argv[1], "all")) { 2182 owl_function_ makemsg("You may not change the 'all' filter.");2151 owl_function_error("You may not change the 'all' filter."); 2183 2152 return; 2184 2153 } … … 2188 2157 f=owl_global_get_filter(&g, argv[1]); 2189 2158 if (!f) { 2190 owl_function_ makemsg("The filter '%s' does not exist.", argv[1]);2159 owl_function_error("The filter '%s' does not exist.", argv[1]); 2191 2160 return; 2192 2161 } … … 2202 2171 if (ret==-1) { 2203 2172 owl_free(f); 2204 owl_function_ makemsg("Invalid filter syntax");2173 owl_function_error("Invalid filter syntax"); 2205 2174 return; 2206 2175 } … … 2262 2231 f=owl_global_get_filter(&g, name); 2263 2232 if (!f) { 2264 owl_function_ makemsg("There is no filter with that name");2233 owl_function_error("There is no filter named %s", name); 2265 2234 return; 2266 2235 } … … 2510 2479 2511 2480 if (!m || owl_view_get_size(v)==0) { 2512 owl_function_ makemsg("No message selected\n");2481 owl_function_error("No message selected\n"); 2513 2482 return(NULL); 2514 2483 } … … 2571 2540 2572 2541 if (!m || owl_view_get_size(v)==0) { 2573 owl_function_ makemsg("No message selected\n");2542 owl_function_error("No message selected\n"); 2574 2543 return; 2575 2544 } … … 2579 2548 || owl_message_is_loginout(m) 2580 2549 || !owl_message_is_type_zephyr(m)) { 2581 owl_function_ makemsg("smartzpunt doesn't support this message type.");2550 owl_function_error("smartzpunt doesn't support this message type."); 2582 2551 return; 2583 2552 } … … 2588 2557 || (!strcasecmp(mclass, "message") && !strcasecmp(minst, "personal")) 2589 2558 || (type && (!minst || !*minst|| *minst==' '))) { 2590 owl_function_ makemsg("smartzpunt can't safely do this for <%s,%s>",2559 owl_function_error("smartzpunt can't safely do this for <%s,%s>", 2591 2560 mclass, minst); 2592 2561 } else { … … 2614 2583 f=owl_global_get_filter(&g, name); 2615 2584 if (!f) { 2616 owl_function_ makemsg("Unknown filter");2585 owl_function_error("Unknown filter"); 2617 2586 return; 2618 2587 } … … 2620 2589 /* don't touch the all filter */ 2621 2590 if (!strcmp(name, "all")) { 2622 owl_function_ makemsg("You may not change the 'all' filter.");2591 owl_function_error("You may not change the 'all' filter."); 2623 2592 return; 2624 2593 } … … 2683 2652 owl_free(buff); 2684 2653 if (ret) { 2685 owl_function_ makemsg("Error creating filter for zpunt");2654 owl_function_error("Error creating filter for zpunt"); 2686 2655 owl_filter_free(f); 2687 2656 return; … … 2716 2685 { 2717 2686 if (!owl_keyhandler_activate(owl_global_get_keyhandler(&g), keymap)) { 2718 owl_function_ makemsg("Unable to activate keymap '%s'", keymap);2687 owl_function_error("Unable to activate keymap '%s'", keymap); 2719 2688 } 2720 2689 } … … 2818 2787 2819 2788 if (viewsize==0) { 2820 owl_function_ makemsg("No messages present");2789 owl_function_error("No messages present"); 2821 2790 return; 2822 2791 } … … 2832 2801 /* bounds check */ 2833 2802 if (start>=viewsize || start<0) { 2834 owl_function_ makemsg("No further matches found");2803 owl_function_error("No further matches found"); 2835 2804 return; 2836 2805 } … … 2856 2825 } 2857 2826 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 2858 owl_function_ makemsg("No matches found");2827 owl_function_error("No matches found"); 2859 2828 } 2860 2829 … … 2918 2887 tmp=owl_global_get_homedir(&g); 2919 2888 if (!tmp) { 2920 owl_function_ makemsg("Could not determine home directory");2889 owl_function_error("Could not determine home directory"); 2921 2890 return; 2922 2891 } … … 2929 2898 f=fopen(ourfile, "r"); 2930 2899 if (!f) { 2931 owl_function_ makemsg("Error opening file %s: %s",2900 owl_function_error("Error opening file %s: %s", 2932 2901 ourfile, 2933 2902 strerror(errno) ? strerror(errno) : ""); … … 2962 2931 ret=ZLocateUser(buff, &numlocs, ZAUTH); 2963 2932 if (ret!=ZERR_NONE) { 2964 owl_function_ makemsg("Error getting location for %s", buff);2933 owl_function_error("Error getting location for %s", buff); 2965 2934 continue; 2966 2935 } … … 3015 2984 file=fopen(filename, "w"); 3016 2985 if (!file) { 3017 owl_function_ makemsg("Error opening file");2986 owl_function_error("Error opening file"); 3018 2987 return; 3019 2988 } … … 3107 3076 file=fopen(filename, "a"); 3108 3077 if (!file) { 3109 owl_function_ makemsg("Error opening startupfile for new command");3078 owl_function_error("Error opening startupfile for new command"); 3110 3079 owl_free(filename); 3111 3080 return; … … 3163 3132 s=owl_global_get_style_by_name(&g, stylename); 3164 3133 if (!s) { 3165 owl_function_ makemsg("No style named %s", stylename);3134 owl_function_error("No style named %s", stylename); 3166 3135 return; 3167 3136 } … … 3170 3139 owl_function_calculate_topmsg(OWL_DIRECTION_DOWNWARDS); 3171 3140 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 3172 3173 3141 } 3174 3142 … … 3191 3159 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 3192 3160 } 3161 3162 void owl_function_error(char *fmt, ...) 3163 { 3164 va_list ap; 3165 char buff[2048], buff2[2048]; 3166 char *date; 3167 time_t now; 3168 3169 now=time(NULL); 3170 date=owl_strdup(ctime(&now)); 3171 date[strlen(date)-1]='\0'; 3172 3173 va_start(ap, fmt); 3174 3175 vsnprintf(buff, 2048, fmt, ap); 3176 sprintf(buff2, "%s %s", date, buff); 3177 owl_function_debugmsg("ERROR: %s", buff); 3178 if (owl_global_get_curs_msgwin(&g)) { 3179 werase(owl_global_get_curs_msgwin(&g)); 3180 waddstr(owl_global_get_curs_msgwin(&g), buff); 3181 wnoutrefresh(owl_global_get_curs_msgwin(&g)); 3182 owl_global_set_needrefresh(&g); 3183 } 3184 owl_errqueue_append_err(owl_global_get_errqueue(&g), buff2); 3185 va_end(ap); 3186 owl_free(date); 3187 } 3188 3189 void owl_function_showerrs() 3190 { 3191 owl_fmtext fm; 3192 3193 owl_fmtext_init_null(&fm); 3194 owl_fmtext_append_normal(&fm, "Errors:\n\n"); 3195 owl_errqueue_to_fmtext(owl_global_get_errqueue(&g), &fm); 3196 owl_function_popless_fmtext(&fm); 3197 } 3198 3199 void owl_function_makemsg(char *fmt, ...) 3200 { 3201 va_list ap; 3202 char buff[2048]; 3203 3204 if (!owl_global_get_curs_msgwin(&g)) return; 3205 3206 va_start(ap, fmt); 3207 werase(owl_global_get_curs_msgwin(&g)); 3208 3209 vsnprintf(buff, 2048, fmt, ap); 3210 owl_function_debugmsg("makemsg: %s", buff); 3211 waddstr(owl_global_get_curs_msgwin(&g), buff); 3212 wnoutrefresh(owl_global_get_curs_msgwin(&g)); 3213 owl_global_set_needrefresh(&g); 3214 va_end(ap); 3215 } -
global.c
r2404c3a rec6ff52 102 102 g->haveaim=0; 103 103 owl_global_set_no_doaimevents(g); 104 105 owl_errqueue_init(&(g->errqueue)); 104 106 } 105 107 … … 832 834 return(&(g->aim_buddyinfo_timer)); 833 835 } 836 837 owl_errqueue *owl_global_get_errqueue(owl_global *g) 838 { 839 return(&(g->errqueue)); 840 } -
owl.c
rf4d0975 rec6ff52 159 159 "Basic message formatting."); 160 160 owl_global_add_style(&g, s); 161 161 #if 0 162 s=owl_malloc(sizeof(owl_style)); 163 owl_style_create_internal(s, "vt", &owl_stylefunc_vt, 164 "VT message formatting."); 165 owl_global_add_style(&g, s); 166 #endif 162 167 s=owl_malloc(sizeof(owl_style)); 163 168 owl_style_create_internal(s, "oneline", &owl_stylefunc_oneline, … … 544 549 fprintf(stderr, " -c specify an alternate config file\n"); 545 550 fprintf(stderr, " -t set the tty name\n"); 546 547 551 } -
owl.h
rc5f3b46 rec6ff52 21 21 static const char owl_h_fileIdent[] = "$Id$"; 22 22 23 #define OWL_VERSION 2.0. 824 #define OWL_VERSION_STRING "2.0. 8"23 #define OWL_VERSION 2.0.9-pre-1 24 #define OWL_VERSION_STRING "2.0.9-pre-1" 25 25 26 26 #define OWL_DEBUG 0 … … 408 408 } owl_timer; 409 409 410 typedef struct _owl_errqueue { 411 owl_list errlist; 412 } owl_errqueue; 413 410 414 typedef struct _owl_global { 411 415 owl_mainwin mw; … … 419 423 owl_cmddict cmds; 420 424 owl_context ctx; 425 owl_errqueue errqueue; 421 426 int lines, cols; 422 427 int curmsg, topmsg; -
stylefunc.c
r03955f3 rec6ff52 529 529 530 530 } 531 532 void owl_stylefunc_vt(owl_fmtext *fm, owl_message *m) 533 { 534 #ifdef HAVE_LIBZEPHYR 535 char *body, *indent, *ptr, *zsigbuff, frombuff[LINE]; 536 owl_fmtext fm_first, fm_other, fm_tmp; 537 ZNotice_t *n; 538 #endif 539 char *sender, *hostname, *timestr, *classinst1, *classinst2; 540 541 if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) { 542 #ifdef HAVE_LIBZEPHYR 543 n=owl_message_get_notice(m); 544 545 /* get the body */ 546 body=owl_malloc(strlen(owl_message_get_body(m))+30); 547 strcpy(body, owl_message_get_body(m)); 548 549 /* add a newline if we need to */ 550 if (body[0]!='\0' && body[strlen(body)-1]!='\n') { 551 strcat(body, "\n"); 552 } 553 554 owl_fmtext_init_null(&fm_tmp); 555 owl_fmtext_append_ztext(&fm_tmp, body); 556 owl_fmtext_init_null(&fm_first); 557 owl_fmtext_truncate_lines(&fm_tmp, 0, 1, &fm_first); 558 559 /* do the indenting into indent */ 560 indent=owl_malloc(strlen(body)+owl_text_num_lines(body)*OWL_MSGTAB+10); 561 owl_text_indent(indent, body, 31); 562 563 owl_fmtext_free(&fm_tmp); 564 owl_fmtext_init_null(&fm_tmp); 565 owl_fmtext_append_ztext(&fm_tmp, indent); 566 owl_fmtext_init_null(&fm_other); 567 owl_fmtext_truncate_lines(&fm_tmp, 1, owl_fmtext_num_lines(&fm_tmp)-1, &fm_other); 568 owl_fmtext_free(&fm_tmp); 569 570 /* edit the from addr for printing */ 571 strcpy(frombuff, owl_message_get_sender(m)); 572 ptr=strchr(frombuff, '@'); 573 if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) { 574 *ptr='\0'; 575 } 576 sender=owl_sprintf("%-9.9s", frombuff); 577 578 hostname=owl_sprintf("%-9.9s", owl_message_get_hostname(m)); 579 timestr=owl_strdup("00:00"); 580 classinst1=owl_sprintf("<%s>[%s]", owl_message_get_class(m), owl_message_get_instance(m)); 581 classinst2=owl_sprintf("%-9.9s", classinst1); 582 583 /* set the message for printing */ 584 owl_fmtext_append_normal(fm, OWL_TABSTR); 585 586 if (owl_message_is_ping(m) && owl_message_is_private(m)) { 587 owl_fmtext_append_bold(fm, "PING"); 588 owl_fmtext_append_normal(fm, " from "); 589 owl_fmtext_append_bold(fm, frombuff); 590 owl_fmtext_append_normal(fm, "\n"); 591 } else if (owl_message_is_loginout(m)) { 592 char *ptr, *host, *tty; 593 int len; 594 595 ptr=owl_zephyr_get_field(n, 1, &len); 596 host=owl_malloc(len+10); 597 strncpy(host, ptr, len); 598 host[len]='\0'; 599 600 ptr=owl_zephyr_get_field(n, 3, &len); 601 tty=owl_malloc(len+10); 602 strncpy(tty, ptr, len); 603 tty[len]='\0'; 604 605 if (owl_message_is_login(m)) { 606 owl_fmtext_append_bold(fm, "LOGIN"); 607 } else if (owl_message_is_logout(m)) { 608 owl_fmtext_append_bold(fm, "LOGOUT"); 609 } 610 owl_fmtext_append_normal(fm, " for "); 611 ptr=short_zuser(owl_message_get_instance(m)); 612 owl_fmtext_append_bold(fm, ptr); 613 owl_free(ptr); 614 owl_fmtext_append_normal(fm, " at "); 615 owl_fmtext_append_normal(fm, host); 616 owl_fmtext_append_normal(fm, " "); 617 owl_fmtext_append_normal(fm, tty); 618 owl_fmtext_append_normal(fm, "\n"); 619 620 owl_free(host); 621 owl_free(tty); 622 } else { 623 owl_fmtext_append_normal(fm, sender); 624 owl_fmtext_append_normal(fm, "|"); 625 owl_fmtext_append_normal(fm, hostname); 626 owl_fmtext_append_normal(fm, " "); 627 owl_fmtext_append_normal(fm, timestr); 628 owl_fmtext_append_normal(fm, " "); 629 owl_fmtext_append_normal(fm, classinst2); 630 631 owl_fmtext_append_normal(fm, " "); 632 owl_fmtext_append_fmtext(fm, &fm_first); 633 owl_fmtext_append_fmtext(fm, &fm_other); 634 635 owl_fmtext_free(&fm_other); 636 owl_fmtext_free(&fm_first); 637 638 /* make private messages bold for smaat users */ 639 if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) { 640 if (owl_message_is_personal(m)) { 641 owl_fmtext_addattr((&m->fmtext), OWL_FMTEXT_ATTR_BOLD); 642 } 643 } 644 } 645 646 owl_free(sender); 647 owl_free(hostname); 648 owl_free(timestr); 649 owl_free(classinst1); 650 owl_free(classinst2); 651 652 owl_free(body); 653 owl_free(indent); 654 #endif 655 } else if (owl_message_is_type_zephyr(m) && owl_message_is_direction_out(m)) { 656 char *indent, *text, *zsigbuff, *foo; 657 658 text=owl_message_get_body(m); 659 660 indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10); 661 owl_text_indent(indent, text, OWL_MSGTAB); 662 owl_fmtext_append_normal(fm, OWL_TABSTR); 663 owl_fmtext_append_normal(fm, "Zephyr sent to "); 664 foo=short_zuser(owl_message_get_recipient(m)); 665 owl_fmtext_append_normal(fm, foo); 666 owl_free(foo); 667 owl_fmtext_append_normal(fm, " (Zsig: "); 668 669 zsigbuff=owl_malloc(strlen(owl_message_get_zsig(m))+30); 670 owl_message_pretty_zsig(m, zsigbuff); 671 owl_fmtext_append_ztext(fm, zsigbuff); 672 owl_free(zsigbuff); 673 674 owl_fmtext_append_normal(fm, ")"); 675 owl_fmtext_append_normal(fm, "\n"); 676 owl_fmtext_append_ztext(fm, indent); 677 if (text[strlen(text)-1]!='\n') { 678 owl_fmtext_append_normal(fm, "\n"); 679 } 680 681 owl_free(indent); 682 } else if (owl_message_is_type_aim(m)) { 683 char *indent; 684 685 if (owl_message_is_loginout(m)) { 686 owl_fmtext_append_normal(fm, OWL_TABSTR); 687 if (owl_message_is_login(m)) { 688 owl_fmtext_append_bold(fm, "AIM LOGIN"); 689 } else { 690 owl_fmtext_append_bold(fm, "AIM LOGOUT"); 691 } 692 owl_fmtext_append_normal(fm, " for "); 693 owl_fmtext_append_normal(fm, owl_message_get_sender(m)); 694 owl_fmtext_append_normal(fm, "\n"); 695 } else if (owl_message_is_direction_in(m)) { 696 indent=owl_malloc(strlen(owl_message_get_body(m))+owl_text_num_lines(owl_message_get_body(m))*OWL_MSGTAB+10); 697 owl_text_indent(indent, owl_message_get_body(m), OWL_MSGTAB); 698 owl_fmtext_append_bold(fm, OWL_TABSTR); 699 owl_fmtext_append_bold(fm, "AIM from "); 700 owl_fmtext_append_bold(fm, owl_message_get_sender(m)); 701 owl_fmtext_append_bold(fm, "\n"); 702 owl_fmtext_append_bold(fm, indent); 703 if (indent[strlen(indent)-1]!='\n') { 704 owl_fmtext_append_normal(fm, "\n"); 705 } 706 owl_free(indent); 707 } else if (owl_message_is_direction_out(m)) { 708 indent=owl_malloc(strlen(owl_message_get_body(m))+owl_text_num_lines(owl_message_get_body(m))*OWL_MSGTAB+10); 709 owl_text_indent(indent, owl_message_get_body(m), OWL_MSGTAB); 710 owl_fmtext_append_normal(fm, OWL_TABSTR); 711 owl_fmtext_append_normal(fm, "AIM sent to "); 712 owl_fmtext_append_normal(fm, owl_message_get_recipient(m)); 713 owl_fmtext_append_normal(fm, "\n"); 714 owl_fmtext_append_ztext(fm, indent); 715 if (indent[strlen(indent)-1]!='\n') { 716 owl_fmtext_append_normal(fm, "\n"); 717 } 718 owl_free(indent); 719 } 720 } else if (owl_message_is_type_admin(m)) { 721 char *text, *header, *indent; 722 723 text=owl_message_get_body(m); 724 header=owl_message_get_attribute_value(m, "adminheader"); 725 726 indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10); 727 owl_text_indent(indent, text, OWL_MSGTAB); 728 owl_fmtext_append_normal(fm, OWL_TABSTR); 729 owl_fmtext_append_bold(fm, "OWL ADMIN "); 730 owl_fmtext_append_ztext(fm, header); 731 owl_fmtext_append_normal(fm, "\n"); 732 owl_fmtext_append_ztext(fm, indent); 733 if (text[strlen(text)-1]!='\n') { 734 owl_fmtext_append_normal(fm, "\n"); 735 } 736 737 owl_free(indent); 738 } 739 } -
zephyr.c
rf1e629d rec6ff52 381 381 ZFreeNotice(¬ice); 382 382 if (ret!=ZERR_NONE) { 383 owl_function_ makemsg("Error sending zephyr");383 owl_function_error("Error sending zephyr"); 384 384 return(ret); 385 385 } … … 413 413 414 414 if (retnotice->z_kind == SERVNAK) { 415 owl_function_ makemsg("Authorization failure sending zephyr");415 owl_function_error("Authorization failure sending zephyr"); 416 416 } else if ((retnotice->z_kind != SERVACK) || !retnotice->z_message_len) { 417 owl_function_ makemsg("Detected server failure while receiving acknowledgement");417 owl_function_error("Detected server failure while receiving acknowledgement"); 418 418 } else if (!strcmp(retnotice->z_message, ZSRVACK_SENT)) { 419 419 if (!strcasecmp(retnotice->z_opcode, "ping")) { … … 422 422 !strcasecmp(retnotice->z_class_inst, "personal")) { 423 423 tmp=short_zuser(retnotice->z_recipient); 424 owl_function_ makemsg("Message sent to %s.", tmp);424 owl_function_error("Message sent to %s.", tmp); 425 425 free(tmp); 426 426 } else { 427 owl_function_ makemsg("Message sent to -c %s -i %s\n", retnotice->z_class, retnotice->z_class_inst);427 owl_function_error("Message sent to -c %s -i %s\n", retnotice->z_class, retnotice->z_class_inst); 428 428 } 429 429 } else if (!strcmp(retnotice->z_message, ZSRVACK_NOTSENT)) { 430 430 if (strcasecmp(retnotice->z_class, "message")) { 431 owl_function_ makemsg("Not logged in or not subscribing to class %s, instance %s",431 owl_function_error("Not logged in or not subscribing to class %s, instance %s", 432 432 retnotice->z_class, retnotice->z_class_inst); 433 433 } else { 434 434 tmp = short_zuser(retnotice->z_recipient); 435 owl_function_ makemsg("%s: Not logged in or subscribing to messages.",435 owl_function_error("%s: Not logged in or subscribing to messages.", 436 436 tmp); 437 437 owl_free(tmp); 438 438 } 439 439 } else { 440 owl_function_ makemsg("Internal error on ack (%s)", retnotice->z_message);440 owl_function_error("Internal error on ack (%s)", retnotice->z_message); 441 441 } 442 442 } … … 532 532 ret=ZLocateUser(user,&numlocs,auth?ZAUTH:ZNOAUTH); 533 533 if (ret != ZERR_NONE) { 534 owl_function_ makemsg("Error locating user");534 owl_function_error("Error locating user %s", user); 535 535 } 536 536 … … 568 568 file=fopen(subsfile, "r"); 569 569 if (!file) { 570 owl_function_ makemsg("Error opening file %s", subsfile);570 owl_function_error("Error opening file %s", subsfile); 571 571 owl_free(line); 572 572 return; … … 574 574 while (fgets(buff, LINE, file)!=NULL) { 575 575 if (!strcasecmp(buff, line)) { 576 owl_function_ makemsg("Subscription already present in %s", subsfile);576 owl_function_error("Subscription already present in %s", subsfile); 577 577 owl_free(line); 578 578 return; … … 584 584 file=fopen(subsfile, "a"); 585 585 if (!file) { 586 owl_function_ makemsg("Error opening file %s for writing", subsfile);586 owl_function_error("Error opening file %s for writing", subsfile); 587 587 owl_free(line); 588 588 return; … … 691 691 owl_free(filename); 692 692 if (!file) { 693 owl_function_ makemsg("Error opening zephyr buddy file for append");693 owl_function_error("Error opening zephyr buddy file for append"); 694 694 return; 695 695 }
Note: See TracChangeset
for help on using the changeset viewer.