Changeset b2b0773
- Timestamp:
- Jun 9, 2003, 10:54:18 AM (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:
- 6bf73ce
- Parents:
- d559df9
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
rdafd919 rb2b0773 4 4 Don't ring the terminal bell on mail messages. 5 5 Nuke <FONT> 6 Make the build work a little better on OSX 6 7 7 8 2.0.2 -
aim.c
rd559df9 rb2b0773 295 295 296 296 aim_send_login(sess, fr->conn, priv->screenname, priv->password, &info, key); 297 297 298 298 return 1; 299 299 } … … 466 466 if (!priv->screenname || !priv->password) { 467 467 /* printf("need SN and password\n"); */ 468 return -1;468 return(-1); 469 469 } 470 470 … … 479 479 } 480 480 aim_conn_kill(sess, &authconn); 481 482 return (-1); 481 return(-1); 483 482 } 484 483 … … 492 491 493 492 /* printf("login request sent\n"); */ 494 495 493 return(0); 496 494 } -
buddylist.c
rd559df9 rb2b0773 37 37 } 38 38 } 39 40 41 39 42 40 /* Deal with an "offgoing" message. This means recognizing the user … … 72 70 } 73 71 72 /* return the number of logged in buddies */ 74 73 int owl_buddylist_get_size(owl_buddylist *b) 75 74 { … … 77 76 } 78 77 78 /* get buddy number 'n' */ 79 79 char *owl_buddylist_get_buddy(owl_buddylist *b, int n) 80 80 { … … 82 82 } 83 83 84 /* remove all buddies from the list */ 84 85 void owl_buddylist_clear(owl_buddylist *b) { 85 86 owl_list_free_all(&(b->buddies), owl_free); -
fmtext.c
rd559df9 rb2b0773 5 5 static const char fileIdent[] = "$Id$"; 6 6 7 /* initialize an fmtext with no data */ 7 8 void owl_fmtext_init_null(owl_fmtext *f) 8 9 { … … 15 16 } 16 17 17 18 /* Internal function. Set the attribute 'attr' from index 'first' to 19 * index 'last' 20 */ 18 21 void _owl_fmtext_set_attr(owl_fmtext *f, int attr, int first, int last) 19 22 { … … 24 27 } 25 28 29 /* Internal function. Add the attribute 'attr' to the existing 30 * attributes from index 'first' to index 'last' 31 */ 26 32 void _owl_fmtext_add_attr(owl_fmtext *f, int attr, int first, int last) 27 33 { … … 32 38 } 33 39 40 /* Internal function. Set the color to be 'color' from index 'first' 41 * to index 'last 42 */ 34 43 void _owl_fmtext_set_color(owl_fmtext *f, int color, int first, int last) 35 44 { … … 40 49 } 41 50 42 51 /* append text to the end of 'f' with attribute 'attr' and color 52 * 'color' 53 */ 43 54 void owl_fmtext_append_attr(owl_fmtext *f, char *text, int attr, int color) 44 55 { … … 56 67 } 57 68 58 69 /* Append normal, uncolored text 'text' to 'f' */ 59 70 void owl_fmtext_append_normal(owl_fmtext *f, char *text) 60 71 { … … 62 73 } 63 74 75 /* Append normal text 'text' to 'f' with color 'color' */ 64 76 void owl_fmtext_append_normal_color(owl_fmtext *f, char *text, int color) 65 77 { … … 67 79 } 68 80 69 81 /* Append bold text 'text' to 'f' */ 70 82 void owl_fmtext_append_bold(owl_fmtext *f, char *text) 71 83 { … … 73 85 } 74 86 75 87 /* Append reverse video text 'text' to 'f' */ 76 88 void owl_fmtext_append_reverse(owl_fmtext *f, char *text) 77 89 { … … 79 91 } 80 92 81 93 /* Append reversed and bold, uncolored text 'text' to 'f' */ 82 94 void owl_fmtext_append_reversebold(owl_fmtext *f, char *text) 83 95 { … … 85 97 } 86 98 87 99 /* Add the attribute 'attr' to all text in 'f' */ 88 100 void owl_fmtext_addattr(owl_fmtext *f, int attr) 89 101 { … … 97 109 } 98 110 111 /* Anywhere the color is NOT ALREDY SET, set the color to 'color'. 112 * Other colors are left unchanged 113 */ 99 114 void owl_fmtext_colorize(owl_fmtext *f, int color) 100 115 { … … 108 123 } 109 124 110 125 /* Append the text 'text' to 'f' and interpret the zephyr style 126 * formatting syntax to set appropriate attributes. 127 */ 111 128 void owl_fmtext_append_ztext(owl_fmtext *f, char *text) 112 129 { … … 293 310 } 294 311 } 295 296 } 297 298 /* This is used internally to fmtext. Use owl_fmtext_append_fmtext() 299 * (no initial underscore) externally */312 } 313 314 /* Internal function. Append text from 'in' between index 'start' and 315 * 'stop' to the end of 'f' 316 */ 300 317 void _owl_fmtext_append_fmtext(owl_fmtext *f, owl_fmtext *in, int start, int stop) 301 318 { … … 316 333 } 317 334 335 /* append fmtext 'in' to 'f' */ 318 336 void owl_fmtext_append_fmtext(owl_fmtext *f, owl_fmtext *in) 319 337 { … … 322 340 } 323 341 342 /* Append 'nspaces' number of spaces to the end of 'f' */ 324 343 void owl_fmtext_append_spaces(owl_fmtext *f, int nspaces) 325 344 { … … 358 377 } 359 378 360 361 /* caller is responsible for freeing */ 379 /* Return a plain version of the fmtext. Caller is responsible for 380 * freeing the return 381 */ 362 382 char *owl_fmtext_print_plain(owl_fmtext *f) 363 383 { 364 return owl_strdup(f->textbuff); 365 } 366 367 384 return(owl_strdup(f->textbuff)); 385 } 386 387 /* add the formatted text to the curses window 'w'. The window 'w' 388 * must already be initiatlized with curses 389 */ 368 390 void owl_fmtext_curs_waddstr(owl_fmtext *f, WINDOW *w) 369 391 { … … 422 444 423 445 446 /* start with line 'aline' (where the first line is 0) and print 447 * 'lines' number of lines into 'out' 448 */ 424 449 int owl_fmtext_truncate_lines(owl_fmtext *in, int aline, int lines, owl_fmtext *out) 425 450 { 426 /* start with line aline (where the first line is 0) and print427 * 'lines' lines428 */429 451 char *ptr1, *ptr2; 430 452 int i, offset; … … 445 467 446 468 for (i=0; i<lines; i++) { 447 ptr2=strchr(ptr1, '\n');448 469 offset=ptr1-in->textbuff; 470 ptr2=strchr(ptr1, '\n'); /* this is a valgrind suspicious line */ 449 471 if (!ptr2) { 450 _owl_fmtext_append_fmtext(out, in, offset, in->textlen-1);472 _owl_fmtext_append_fmtext(out, in, offset, (in->textlen)-1); 451 473 return(-1); 452 474 } … … 457 479 } 458 480 459 460 /* the first column is column 0 */ 461 /* the message is expected to end in a new line for now */ 481 /* Truncate the message so that each line begins at column 'acol' and 482 * ends at 'bcol' or sooner. The first column is number 0. The new 483 * message is placed in 'out'. The message is * expected to end in a 484 * new line for now 485 */ 462 486 void owl_fmtext_truncate_cols(owl_fmtext *in, int acol, int bcol, owl_fmtext *out) 463 487 { … … 504 528 } 505 529 506 530 /* Return the number of lines in 'f' */ 507 531 int owl_fmtext_num_lines(owl_fmtext *f) 508 532 { … … 522 546 } 523 547 524 525 548 char *owl_fmtext_get_text(owl_fmtext *f) 526 549 { … … 536 559 } 537 560 561 /* Free all memory allocated by the object */ 538 562 void owl_fmtext_free(owl_fmtext *f) 539 563 { … … 543 567 } 544 568 545 569 /* Make a copy of the fmtext 'src' into 'dst' */ 546 570 void owl_fmtext_copy(owl_fmtext *dst, owl_fmtext *src) 547 571 { 572 int mallocsize; 573 574 if (src->textlen==0) { 575 mallocsize=5; 576 } else { 577 mallocsize=src->textlen+2; 578 } 548 579 dst->textlen=src->textlen; 549 dst->textbuff=owl_malloc( src->textlen+5);550 dst->fmbuff=owl_malloc( src->textlen+5);551 dst->colorbuff=owl_malloc( src->textlen+5);580 dst->textbuff=owl_malloc(mallocsize); /* valgrind suspcious line */ 581 dst->fmbuff=owl_malloc(mallocsize); 582 dst->colorbuff=owl_malloc(mallocsize); 552 583 memcpy(dst->textbuff, src->textbuff, src->textlen); 553 584 memcpy(dst->fmbuff, src->fmbuff, src->textlen); … … 555 586 } 556 587 557 558 588 /* highlight all instance of "string". Return the number of 559 * instances found. This is case insensitive.589 * instances found. This is a case insensitive search. 560 590 */ 561 591 int owl_fmtext_search_and_highlight(owl_fmtext *f, char *string) … … 582 612 } 583 613 584 /* return 1 if the string is found, 0 if not. This is case585 * insensitive 614 /* return 1 if the string is found, 0 if not. This is a case 615 * insensitive search. 586 616 */ 587 617 int owl_fmtext_search(owl_fmtext *f, char *string) -
owl.c
rdafd919 rb2b0773 26 26 27 27 static const char fileIdent[] = "$Id$"; 28 29 owl_global g; 28 30 29 31 int main(int argc, char **argv, char **env) { -
owl.h
rdafd919 rb2b0773 422 422 423 423 /* globals */ 424 owl_global g;424 extern owl_global g; 425 425 426 426 #include "owl_prototypes.h" -
popwin.c
r1aee7d9 rb2b0773 3 3 static const char fileIdent[] = "$Id$"; 4 4 5 int owl_popwin_init(owl_popwin *pw) { 5 int owl_popwin_init(owl_popwin *pw) 6 { 6 7 pw->active=0; 7 8 pw->needsfirstrefresh=0; … … 11 12 } 12 13 13 int owl_popwin_up(owl_popwin *pw) { 14 int owl_popwin_up(owl_popwin *pw) 15 { 14 16 int glines, gcols, startcol, startline; 15 17 … … 50 52 } 51 53 52 int owl_popwin_display_text(owl_popwin *pw, char *text) { 54 int owl_popwin_display_text(owl_popwin *pw, char *text) 55 { 53 56 waddstr(pw->popwin, text); 54 57 wnoutrefresh(pw->popwin); … … 59 62 } 60 63 61 int owl_popwin_close(owl_popwin *pw) { 64 int owl_popwin_close(owl_popwin *pw) 65 { 62 66 delwin(pw->popwin); 63 67 delwin(pw->borderwin); … … 69 73 } 70 74 71 int owl_popwin_is_active(owl_popwin *pw) { 75 int owl_popwin_is_active(owl_popwin *pw) 76 { 72 77 if (pw->active==1) return(1); 73 78 return(0); 74 79 } 75 80 76 int owl_popwin_refresh(owl_popwin *pw) { 77 /* this will refresh the border as well as the text area */ 81 /* this will refresh the border as well as the text area */ 82 int owl_popwin_refresh(owl_popwin *pw) 83 { 78 84 touchwin(pw->borderwin); 79 85 touchwin(pw->popwin); … … 85 91 } 86 92 87 void owl_popwin_set_handler(owl_popwin *pw, void (*func)(int ch)) { 93 void owl_popwin_set_handler(owl_popwin *pw, void (*func)(int ch)) 94 { 88 95 pw->handler=func; 89 96 } 90 97 91 void owl_popwin_unset_handler(owl_popwin *pw) { 98 void owl_popwin_unset_handler(owl_popwin *pw) 99 { 92 100 pw->handler=NULL; 93 101 } 94 102 95 WINDOW *owl_popwin_get_curswin(owl_popwin *pw) { 103 WINDOW *owl_popwin_get_curswin(owl_popwin *pw) 104 { 96 105 return(pw->popwin); 97 106 } 98 107 99 int owl_popwin_get_lines(owl_popwin *pw) { 108 int owl_popwin_get_lines(owl_popwin *pw) 109 { 100 110 return(pw->lines-2); 101 111 } 102 112 103 int owl_popwin_get_cols(owl_popwin *pw) { 113 int owl_popwin_get_cols(owl_popwin *pw) 114 { 104 115 return(pw->cols-2); 105 116 } 106 117 107 int owl_popwin_needs_first_refresh(owl_popwin *pw) { 118 int owl_popwin_needs_first_refresh(owl_popwin *pw) 119 { 108 120 if (pw->needsfirstrefresh) return(1); 109 121 return(0); 110 122 } 111 123 112 void owl_popwin_no_needs_first_refresh(owl_popwin *pw) { 124 void owl_popwin_no_needs_first_refresh(owl_popwin *pw) 125 { 113 126 pw->needsfirstrefresh=0; 114 127 } -
tester.c
re1c4636 rb2b0773 4 4 5 5 static const char fileIdent[] = "$Id$"; 6 7 owl_global g; 6 8 7 9 void screeninit() { -
util.c
r378fa14 rb2b0773 3 3 #include <string.h> 4 4 #include <unistd.h> 5 #include <malloc.h>6 5 #include <unistd.h> 7 6 #include <ctype.h> -
viewwin.c
r3a2daac rb2b0773 6 6 #define BOTTOM_OFFSET 1 7 7 8 void owl_viewwin_init_text(owl_viewwin *v, WINDOW *win, int winlines, int wincols, char *text) { 9 /* initialize the viewwin e.10 * 'win' is an already initialzed curses window that will be used by viewwin11 */ 12 8 /* initialize the viewwin e. 'win' is an already initialzed curses 9 * window that will be used by viewwin 10 */ 11 void owl_viewwin_init_text(owl_viewwin *v, WINDOW *win, int winlines, int wincols, char *text) 12 { 13 13 owl_fmtext_init_null(&(v->fmtext)); 14 14 if (text) { … … 26 26 } 27 27 28 void owl_viewwin_init_fmtext(owl_viewwin *v, WINDOW *win, int winlines, int wincols, owl_fmtext *fmtext) { 29 /* initialize the viewwin e.30 * 'win' is an already initialzed curses window that will be used by viewwin31 */ 32 28 /* initialize the viewwin e. 'win' is an already initialzed curses 29 * window that will be used by viewwin 30 */ 31 void owl_viewwin_init_fmtext(owl_viewwin *v, WINDOW *win, int winlines, int wincols, owl_fmtext *fmtext) 32 { 33 33 owl_fmtext_copy(&(v->fmtext), fmtext); 34 34 v->textlines=owl_fmtext_num_lines(&(v->fmtext)); … … 40 40 } 41 41 42 void owl_viewwin_set_curswin(owl_viewwin *v, WINDOW *w, int winlines, int wincols) { 42 void owl_viewwin_set_curswin(owl_viewwin *v, WINDOW *w, int winlines, int wincols) 43 { 43 44 v->curswin=w; 44 45 v->winlines=winlines; … … 46 47 } 47 48 48 void owl_viewwin_redisplay(owl_viewwin *v, int update) { 49 /* regenerate text on the curses window.*/50 /* if update == 1 then do a doupdate() */ 51 49 /* regenerate text on the curses window. */ 50 /* if update == 1 then do a doupdate() */ 51 void owl_viewwin_redisplay(owl_viewwin *v, int update) 52 { 52 53 owl_fmtext fm1, fm2; 53 54 … … 82 83 } 83 84 84 void owl_viewwin_pagedown(owl_viewwin *v) { 85 void owl_viewwin_pagedown(owl_viewwin *v) 86 { 85 87 v->topline+=v->winlines - BOTTOM_OFFSET; 86 88 if ( (v->topline+v->winlines-BOTTOM_OFFSET) > v->textlines) { … … 89 91 } 90 92 91 void owl_viewwin_linedown(owl_viewwin *v) { 93 void owl_viewwin_linedown(owl_viewwin *v) 94 { 92 95 v->topline++; 93 96 if ( (v->topline+v->winlines-BOTTOM_OFFSET) > v->textlines) { … … 96 99 } 97 100 98 void owl_viewwin_pageup(owl_viewwin *v) { 101 void owl_viewwin_pageup(owl_viewwin *v) 102 { 99 103 v->topline-=v->winlines; 100 104 if (v->topline<0) v->topline=0; 101 105 } 102 106 103 void owl_viewwin_lineup(owl_viewwin *v) { 107 void owl_viewwin_lineup(owl_viewwin *v) 108 { 104 109 v->topline--; 105 110 if (v->topline<0) v->topline=0; 106 111 } 107 112 108 void owl_viewwin_right(owl_viewwin *v, int n) { 113 void owl_viewwin_right(owl_viewwin *v, int n) 114 { 109 115 v->rightshift+=n; 110 116 } 111 117 112 void owl_viewwin_left(owl_viewwin *v, int n) { 118 void owl_viewwin_left(owl_viewwin *v, int n) 119 { 113 120 v->rightshift-=n; 114 121 if (v->rightshift<0) v->rightshift=0; 115 122 } 116 123 117 void owl_viewwin_top(owl_viewwin *v) { 124 void owl_viewwin_top(owl_viewwin *v) 125 { 118 126 v->topline=0; 119 127 v->rightshift=0; 120 128 } 121 129 122 void owl_viewwin_bottom(owl_viewwin *v) { 130 void owl_viewwin_bottom(owl_viewwin *v) 131 { 123 132 v->topline = v->textlines - v->winlines + BOTTOM_OFFSET; 124 133 } 125 134 126 void owl_viewwin_free(owl_viewwin *v) { 135 void owl_viewwin_free(owl_viewwin *v) 136 { 127 137 owl_fmtext_free(&(v->fmtext)); 128 138 }
Note: See TracChangeset
for help on using the changeset viewer.