Changeset c08c70a
- Timestamp:
- Aug 15, 2009, 7:08:19 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 1fdab04
- Parents:
- 25fb825
- git-author:
- Anders Kaseorg <andersk@mit.edu> (08/04/09 00:44:38)
- git-committer:
- Anders Kaseorg <andersk@mit.edu> (08/15/09 19:08:19)
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
commands.c
r0a0fb74 rc08c70a 2013 2013 owl_function_reply(1, !edit); 2014 2014 } else if (argc==2 && !strcmp(argv[1], "zaway")) { 2015 owl_message *m;2015 const owl_message *m; 2016 2016 owl_view *v; 2017 2017 v = owl_global_get_current_view(&g); -
filter.c
re19eb97 rc08c70a 189 189 * return 0. 190 190 */ 191 int owl_filter_message_match(owl_filter *f, owl_message *m)191 int owl_filter_message_match(owl_filter *f, const owl_message *m) 192 192 { 193 193 int ret; … … 270 270 #ifdef OWL_INCLUDE_REG_TESTS 271 271 272 int owl_filter_test_string(const char * filt, owl_message *m, int shouldmatch) /* noproto */ {272 int owl_filter_test_string(const char * filt, const owl_message *m, int shouldmatch) /* noproto */ { 273 273 owl_filter f; 274 274 int ok; -
filterelement.c
re19eb97 rc08c70a 1 1 #include "owl.h" 2 2 3 static const char * owl_filterelement_get_field( owl_message *m, const char * field)3 static const char * owl_filterelement_get_field(const owl_message *m, const char * field) 4 4 { 5 5 const char *match; … … 48 48 } 49 49 50 static int owl_filterelement_match_false(owl_filterelement *fe, owl_message *m)50 static int owl_filterelement_match_false(owl_filterelement *fe, const owl_message *m) 51 51 { 52 52 return 0; 53 53 } 54 54 55 static int owl_filterelement_match_true(owl_filterelement *fe, owl_message *m)55 static int owl_filterelement_match_true(owl_filterelement *fe, const owl_message *m) 56 56 { 57 57 return 1; 58 58 } 59 59 60 static int owl_filterelement_match_re(owl_filterelement *fe, owl_message *m)60 static int owl_filterelement_match_re(owl_filterelement *fe, const owl_message *m) 61 61 { 62 62 const char * val = owl_filterelement_get_field(m, fe->field); … … 64 64 } 65 65 66 static int owl_filterelement_match_filter(owl_filterelement *fe, owl_message *m)66 static int owl_filterelement_match_filter(owl_filterelement *fe, const owl_message *m) 67 67 { 68 68 owl_filter *subfilter; … … 77 77 } 78 78 79 static int owl_filterelement_match_perl(owl_filterelement *fe, owl_message *m)79 static int owl_filterelement_match_perl(owl_filterelement *fe, const owl_message *m) 80 80 { 81 81 const char *subname; … … 97 97 } 98 98 99 static int owl_filterelement_match_group(owl_filterelement *fe, owl_message *m)99 static int owl_filterelement_match_group(owl_filterelement *fe, const owl_message *m) 100 100 { 101 101 return owl_filterelement_match(fe->left, m); … … 106 106 */ 107 107 108 static int owl_filterelement_match_and(owl_filterelement *fe, owl_message *m)108 static int owl_filterelement_match_and(owl_filterelement *fe, const owl_message *m) 109 109 { 110 110 return owl_filterelement_match(fe->left, m) && … … 112 112 } 113 113 114 static int owl_filterelement_match_or(owl_filterelement *fe, owl_message *m)114 static int owl_filterelement_match_or(owl_filterelement *fe, const owl_message *m) 115 115 { 116 116 return owl_filterelement_match(fe->left, m) || … … 118 118 } 119 119 120 static int owl_filterelement_match_not(owl_filterelement *fe, owl_message *m)120 static int owl_filterelement_match_not(owl_filterelement *fe, const owl_message *m) 121 121 { 122 122 return !owl_filterelement_match(fe->left, m); … … 276 276 } 277 277 278 int owl_filterelement_match(owl_filterelement *fe, owl_message *m)278 int owl_filterelement_match(owl_filterelement *fe, const owl_message *m) 279 279 { 280 280 if(!fe) return 0; -
functions.c
r0a0fb74 rc08c70a 595 595 owl_view *v; 596 596 owl_filter *f = NULL; 597 owl_message *m;597 const owl_message *m; 598 598 599 599 v=owl_global_get_current_view(&g); … … 648 648 owl_view *v; 649 649 owl_filter *f = NULL; 650 owl_message *m;650 const owl_message *m; 651 651 652 652 v=owl_global_get_current_view(&g); … … 774 774 { 775 775 int curmsg; 776 owl_message *m;776 const owl_message *m; 777 777 owl_messagelist *ml; 778 778 owl_view *v; … … 1411 1411 void owl_function_info() 1412 1412 { 1413 owl_message *m;1413 const owl_message *m; 1414 1414 owl_fmtext fm, attrfm; 1415 1415 owl_view *v; … … 1547 1547 { 1548 1548 owl_view *v; 1549 owl_message *m;1549 const owl_message *m; 1550 1550 owl_style *s; 1551 1551 owl_fmtext fm; … … 1886 1886 { 1887 1887 char *buff=NULL; 1888 owl_message *m;1888 const owl_message *m; 1889 1889 owl_filter *f; 1890 1890 … … 2109 2109 owl_filter *f; 2110 2110 int curid=-1, newpos, curmsg; 2111 owl_message *curm=NULL;2111 const owl_message *curm=NULL; 2112 2112 2113 2113 v=owl_global_get_current_view(&g); … … 2580 2580 { 2581 2581 owl_view *v; 2582 owl_message *m;2582 const owl_message *m; 2583 2583 char *zperson, *filtname=NULL; 2584 2584 const char *argv[1]; … … 2652 2652 * If type=0, uses just class. If type=1, uses instance as well. */ 2653 2653 owl_view *v; 2654 owl_message *m;2654 const owl_message *m; 2655 2655 const char *cmdprefix, *mclass, *minst; 2656 2656 char *cmd; … … 3567 3567 } 3568 3568 3569 void _owl_function_mark_message( owl_message *m)3569 void _owl_function_mark_message(const owl_message *m) 3570 3570 { 3571 3571 if (m) … … 3575 3575 void owl_function_mark_message() 3576 3576 { 3577 owl_message *m;3577 const owl_message *m; 3578 3578 owl_view *v; 3579 3579 … … 3595 3595 { 3596 3596 int marked_id; 3597 owl_message *m;3597 const owl_message *m; 3598 3598 owl_view *v; 3599 3599 -
global.c
r77bced3 rc08c70a 212 212 g->markedmsgid=i; 213 213 /* i; index of message in the current view. 214 owl_message *m;214 const owl_message *m; 215 215 owl_view *v; 216 216 … … 684 684 } 685 685 686 int owl_global_message_is_puntable(owl_global *g, owl_message *m) {686 int owl_global_message_is_puntable(owl_global *g, const owl_message *m) { 687 687 const owl_list *pl; 688 688 int i, j; -
logging.c
re19eb97 rc08c70a 9 9 * functions in this file as necessary. 10 10 */ 11 void owl_log_message( owl_message *m) {11 void owl_log_message(const owl_message *m) { 12 12 owl_function_debugmsg("owl_log_message: entering"); 13 13 … … 37 37 38 38 /* Return 1 if we should log the given message, otherwise return 0 */ 39 int owl_log_shouldlog_message( owl_message *m) {39 int owl_log_shouldlog_message(const owl_message *m) { 40 40 owl_filter *f; 41 41 … … 70 70 } 71 71 72 void owl_log_zephyr( owl_message *m, FILE *file) {72 void owl_log_zephyr(const owl_message *m, FILE *file) { 73 73 char *tmp; 74 74 tmp=short_zuser(owl_message_get_sender(m)); … … 82 82 } 83 83 84 void owl_log_aim( owl_message *m, FILE *file) {84 void owl_log_aim(const owl_message *m, FILE *file) { 85 85 fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m)); 86 86 fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m)); … … 93 93 } 94 94 95 void owl_log_jabber( owl_message *m, FILE *file) {95 void owl_log_jabber(const owl_message *m, FILE *file) { 96 96 fprintf(file, "From: <%s> To: <%s>\n",owl_message_get_sender(m), owl_message_get_recipient(m)); 97 97 fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m)); … … 99 99 } 100 100 101 void owl_log_generic( owl_message *m, FILE *file) {101 void owl_log_generic(const owl_message *m, FILE *file) { 102 102 fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m)); 103 103 fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m)); … … 105 105 } 106 106 107 void owl_log_append( owl_message *m, const char *filename) {107 void owl_log_append(const owl_message *m, const char *filename) { 108 108 FILE *file; 109 109 file=fopen(filename, "a"); … … 124 124 } 125 125 126 void owl_log_outgoing( owl_message *m)126 void owl_log_outgoing(const owl_message *m) 127 127 { 128 128 char filename[MAXPATHLEN], *logpath; … … 227 227 } 228 228 229 void owl_log_incoming( owl_message *m)229 void owl_log_incoming(const owl_message *m) 230 230 { 231 231 char filename[MAXPATHLEN], allfilename[MAXPATHLEN], *logpath; -
message.c
r1077891a rc08c70a 82 82 * the attribute does not exist 83 83 */ 84 const char *owl_message_get_attribute_value( owl_message *m, const char *attrname)84 const char *owl_message_get_attribute_value(const owl_message *m, const char *attrname) 85 85 { 86 86 int i, j; … … 107 107 * function to indent fmtext. 108 108 */ 109 void owl_message_attributes_tofmtext( owl_message *m, owl_fmtext *fm) {109 void owl_message_attributes_tofmtext(const owl_message *m, owl_fmtext *fm) { 110 110 int i, j; 111 111 owl_pair *p; … … 164 164 } 165 165 166 const char *owl_message_get_class( owl_message *m)166 const char *owl_message_get_class(const owl_message *m) 167 167 { 168 168 const char *class; … … 178 178 } 179 179 180 const char *owl_message_get_instance( owl_message *m)180 const char *owl_message_get_instance(const owl_message *m) 181 181 { 182 182 const char *instance; … … 192 192 } 193 193 194 const char *owl_message_get_sender( owl_message *m)194 const char *owl_message_get_sender(const owl_message *m) 195 195 { 196 196 const char *sender; … … 206 206 } 207 207 208 const char *owl_message_get_zsig( owl_message *m)208 const char *owl_message_get_zsig(const owl_message *m) 209 209 { 210 210 const char *zsig; … … 220 220 } 221 221 222 const char *owl_message_get_recipient( owl_message *m)222 const char *owl_message_get_recipient(const owl_message *m) 223 223 { 224 224 /* this is stupid for outgoing messages, we need to fix it. */ … … 236 236 } 237 237 238 const char *owl_message_get_realm( owl_message *m)238 const char *owl_message_get_realm(const owl_message *m) 239 239 { 240 240 const char *realm; … … 250 250 } 251 251 252 const char *owl_message_get_body( owl_message *m)252 const char *owl_message_get_body(const owl_message *m) 253 253 { 254 254 const char *body; … … 265 265 } 266 266 267 const char *owl_message_get_opcode( owl_message *m)267 const char *owl_message_get_opcode(const owl_message *m) 268 268 { 269 269 const char *opcode; … … 286 286 } 287 287 288 int owl_message_is_loginout( owl_message *m)288 int owl_message_is_loginout(const owl_message *m) 289 289 { 290 290 const char *res; … … 295 295 } 296 296 297 int owl_message_is_login( owl_message *m)297 int owl_message_is_login(const owl_message *m) 298 298 { 299 299 const char *res; … … 306 306 307 307 308 int owl_message_is_logout( owl_message *m)308 int owl_message_is_logout(const owl_message *m) 309 309 { 310 310 const char *res; … … 321 321 } 322 322 323 int owl_message_is_private( owl_message *m)323 int owl_message_is_private(const owl_message *m) 324 324 { 325 325 const char *res; … … 330 330 } 331 331 332 const char *owl_message_get_timestr( owl_message *m)332 const char *owl_message_get_timestr(const owl_message *m) 333 333 { 334 334 if (m->timestr) return(m->timestr); … … 361 361 } 362 362 363 int owl_message_is_type( owl_message *m, const char *type) {363 int owl_message_is_type(const owl_message *m, const char *type) { 364 364 const char * t = owl_message_get_attribute_value(m, "type"); 365 365 if(!t) return 0; … … 367 367 } 368 368 369 int owl_message_is_type_admin( owl_message *m)369 int owl_message_is_type_admin(const owl_message *m) 370 370 { 371 371 return owl_message_is_type(m, "admin"); 372 372 } 373 373 374 int owl_message_is_type_zephyr( owl_message *m)374 int owl_message_is_type_zephyr(const owl_message *m) 375 375 { 376 376 return owl_message_is_type(m, "zephyr"); 377 377 } 378 378 379 int owl_message_is_type_aim( owl_message *m)379 int owl_message_is_type_aim(const owl_message *m) 380 380 { 381 381 return owl_message_is_type(m, "aim"); … … 383 383 384 384 /* XXX TODO: deprecate this */ 385 int owl_message_is_type_jabber( owl_message *m)385 int owl_message_is_type_jabber(const owl_message *m) 386 386 { 387 387 return owl_message_is_type(m, "jabber"); 388 388 } 389 389 390 int owl_message_is_type_loopback( owl_message *m)390 int owl_message_is_type_loopback(const owl_message *m) 391 391 { 392 392 return owl_message_is_type(m, "loopback"); 393 393 } 394 394 395 int owl_message_is_pseudo( owl_message *m)395 int owl_message_is_pseudo(const owl_message *m) 396 396 { 397 397 if (owl_message_get_attribute_value(m, "pseudo")) return(1); … … 425 425 } 426 426 427 int owl_message_is_direction_in( owl_message *m)427 int owl_message_is_direction_in(const owl_message *m) 428 428 { 429 429 if (m->direction==OWL_MESSAGE_DIRECTION_IN) return(1); … … 431 431 } 432 432 433 int owl_message_is_direction_out( owl_message *m)433 int owl_message_is_direction_out(const owl_message *m) 434 434 { 435 435 if (m->direction==OWL_MESSAGE_DIRECTION_OUT) return(1); … … 437 437 } 438 438 439 int owl_message_is_direction_none( owl_message *m)439 int owl_message_is_direction_none(const owl_message *m) 440 440 { 441 441 if (m->direction==OWL_MESSAGE_DIRECTION_NONE) return(1); … … 462 462 } 463 463 464 const char *owl_message_get_zwriteline( owl_message *m)464 const char *owl_message_get_zwriteline(const owl_message *m) 465 465 { 466 466 const char *z = owl_message_get_attribute_value(m, "zwriteline"); … … 474 474 } 475 475 476 int owl_message_is_delete( owl_message *m)476 int owl_message_is_delete(const owl_message *m) 477 477 { 478 478 if (m == NULL) return(0); … … 482 482 483 483 #ifdef HAVE_LIBZEPHYR 484 const ZNotice_t *owl_message_get_notice( owl_message *m)484 const ZNotice_t *owl_message_get_notice(const owl_message *m) 485 485 { 486 486 return(&(m->notice)); 487 487 } 488 488 #else 489 void *owl_message_get_notice( owl_message *m)489 void *owl_message_get_notice(const owl_message *m) 490 490 { 491 491 return(NULL); … … 498 498 } 499 499 500 const char *owl_message_get_hostname( owl_message *m)500 const char *owl_message_get_hostname(const owl_message *m) 501 501 { 502 502 return(m->hostname); … … 524 524 } 525 525 526 int owl_message_is_personal( owl_message *m)526 int owl_message_is_personal(const owl_message *m) 527 527 { 528 528 owl_filter * f = owl_global_get_filter(&g, "personal"); … … 534 534 } 535 535 536 int owl_message_is_question( owl_message *m)536 int owl_message_is_question(const owl_message *m) 537 537 { 538 538 if(!owl_message_is_type_admin(m)) return 0; … … 541 541 } 542 542 543 int owl_message_is_answered( owl_message *m) {543 int owl_message_is_answered(const owl_message *m) { 544 544 const char *q; 545 545 if(!owl_message_is_question(m)) return 0; … … 553 553 } 554 554 555 int owl_message_is_mail( owl_message *m)555 int owl_message_is_mail(const owl_message *m) 556 556 { 557 557 if (owl_message_is_type_zephyr(m)) { … … 566 566 567 567 /* caller must free return value. */ 568 char *owl_message_get_cc( owl_message *m)568 char *owl_message_get_cc(const owl_message *m) 569 569 { 570 570 const char *cur; … … 583 583 584 584 /* caller must free return value */ 585 char *owl_message_get_cc_without_recipient( owl_message *m)585 char *owl_message_get_cc_without_recipient(const owl_message *m) 586 586 { 587 587 char *cc, *out, *end, *shortuser, *recip; … … 620 620 } 621 621 622 int owl_message_get_id( owl_message *m)622 int owl_message_get_id(const owl_message *m) 623 623 { 624 624 return(m->id); 625 625 } 626 626 627 const char *owl_message_get_type( owl_message *m) {627 const char *owl_message_get_type(const owl_message *m) { 628 628 const char * type = owl_message_get_attribute_value(m, "type"); 629 629 if(!type) { … … 633 633 } 634 634 635 const char *owl_message_get_direction( owl_message *m) {635 const char *owl_message_get_direction(const owl_message *m) { 636 636 switch (m->direction) { 637 637 case OWL_MESSAGE_DIRECTION_IN: … … 657 657 658 658 659 const char *owl_message_get_login( owl_message *m) {659 const char *owl_message_get_login(const owl_message *m) { 660 660 if (owl_message_is_login(m)) { 661 661 return "login"; … … 668 668 669 669 670 const char *owl_message_get_header( owl_message *m) {670 const char *owl_message_get_header(const owl_message *m) { 671 671 return owl_message_get_attribute_value(m, "adminheader"); 672 672 } -
owl.h
r64735f0 rc08c70a 398 398 399 399 typedef struct _owl_filterelement { 400 int (*match_message)(struct _owl_filterelement *fe, owl_message *m);400 int (*match_message)(struct _owl_filterelement *fe, const owl_message *m); 401 401 /* Append a string representation of the filterelement onto buf*/ 402 402 void (*print_elt)(struct _owl_filterelement *fe, GString *buf); -
perlconfig.c
r25fb825 rc08c70a 22 22 } 23 23 24 SV *owl_perlconfig_message2hashref( owl_message *m)24 SV *owl_perlconfig_message2hashref(const owl_message *m) 25 25 { 26 26 HV *h, *stash; … … 197 197 /* Calls in a scalar context, passing it a hash reference. 198 198 If return value is non-null, caller must free. */ 199 char *owl_perlconfig_call_with_message(const char *subname, owl_message *m)199 char *owl_perlconfig_call_with_message(const char *subname, const owl_message *m) 200 200 { 201 201 dSP ; … … 246 246 If the return value is non-null, the caller must free it. 247 247 */ 248 char * owl_perlconfig_message_call_method( owl_message *m, const char *method, int argc, const char ** argv)248 char * owl_perlconfig_message_call_method(const owl_message *m, const char *method, int argc, const char ** argv) 249 249 { 250 250 dSP; … … 408 408 } 409 409 410 void owl_perlconfig_getmsg( owl_message *m, const char *subname)410 void owl_perlconfig_getmsg(const owl_message *m, const char *subname) 411 411 { 412 412 char *ptr = NULL; … … 419 419 420 420 /* Called on all new messages; receivemsg is only called on incoming ones */ 421 void owl_perlconfig_newmsg( owl_message *m, const char *subname)421 void owl_perlconfig_newmsg(const owl_message *m, const char *subname) 422 422 { 423 423 char *ptr = NULL; -
style.c
re19eb97 rc08c70a 39 39 * 'fm' should already be be initialzed 40 40 */ 41 void owl_style_get_formattext(owl_style *s, owl_fmtext *fm, owl_message *m)41 void owl_style_get_formattext(owl_style *s, owl_fmtext *fm, const owl_message *m) 42 42 { 43 43 const char *body; -
zephyr.c
r1077891a rc08c70a 570 570 * caller must free the return 571 571 */ 572 char *owl_zephyr_get_message(const ZNotice_t *n, owl_message *m)572 char *owl_zephyr_get_message(const ZNotice_t *n, const owl_message *m) 573 573 { 574 574 /* don't let ping messages have a body */ … … 824 824 #endif 825 825 826 void owl_zephyr_zaway( owl_message *m)826 void owl_zephyr_zaway(const owl_message *m) 827 827 { 828 828 #ifdef HAVE_LIBZEPHYR
Note: See TracChangeset
for help on using the changeset viewer.