Changeset c08c70a


Ignore:
Timestamp:
Aug 15, 2009, 7:08:19 PM (15 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
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)
Message:
Add const qualifiers for owl_message *.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    r0a0fb74 rc08c70a  
    20132013    owl_function_reply(1, !edit);
    20142014  } else if (argc==2 && !strcmp(argv[1], "zaway")) {
    2015     owl_message *m;
     2015    const owl_message *m;
    20162016    owl_view    *v;
    20172017    v = owl_global_get_current_view(&g);   
  • filter.c

    re19eb97 rc08c70a  
    189189 * return 0.
    190190 */
    191 int owl_filter_message_match(owl_filter *f, owl_message *m)
     191int owl_filter_message_match(owl_filter *f, const owl_message *m)
    192192{
    193193  int ret;
     
    270270#ifdef OWL_INCLUDE_REG_TESTS
    271271
    272 int owl_filter_test_string(const char * filt, owl_message *m, int shouldmatch) /* noproto */ {
     272int owl_filter_test_string(const char * filt, const owl_message *m, int shouldmatch) /* noproto */ {
    273273  owl_filter f;
    274274  int ok;
  • filterelement.c

    re19eb97 rc08c70a  
    11#include "owl.h"
    22
    3 static const char * owl_filterelement_get_field(owl_message *m, const char * field)
     3static const char * owl_filterelement_get_field(const owl_message *m, const char * field)
    44{
    55  const char *match;
     
    4848}
    4949
    50 static int owl_filterelement_match_false(owl_filterelement *fe, owl_message *m)
     50static int owl_filterelement_match_false(owl_filterelement *fe, const owl_message *m)
    5151{
    5252  return 0;
    5353}
    5454
    55 static int owl_filterelement_match_true(owl_filterelement *fe, owl_message *m)
     55static int owl_filterelement_match_true(owl_filterelement *fe, const owl_message *m)
    5656{
    5757  return 1;
    5858}
    5959
    60 static int owl_filterelement_match_re(owl_filterelement *fe, owl_message *m)
     60static int owl_filterelement_match_re(owl_filterelement *fe, const owl_message *m)
    6161{
    6262  const char * val = owl_filterelement_get_field(m, fe->field);
     
    6464}
    6565
    66 static int owl_filterelement_match_filter(owl_filterelement *fe, owl_message *m)
     66static int owl_filterelement_match_filter(owl_filterelement *fe, const owl_message *m)
    6767{
    6868  owl_filter *subfilter;
     
    7777}
    7878
    79 static int owl_filterelement_match_perl(owl_filterelement *fe, owl_message *m)
     79static int owl_filterelement_match_perl(owl_filterelement *fe, const owl_message *m)
    8080{
    8181  const char *subname;
     
    9797}
    9898
    99 static int owl_filterelement_match_group(owl_filterelement *fe, owl_message *m)
     99static int owl_filterelement_match_group(owl_filterelement *fe, const owl_message *m)
    100100{
    101101  return owl_filterelement_match(fe->left, m);
     
    106106*/
    107107
    108 static int owl_filterelement_match_and(owl_filterelement *fe, owl_message *m)
     108static int owl_filterelement_match_and(owl_filterelement *fe, const owl_message *m)
    109109{
    110110  return owl_filterelement_match(fe->left, m) &&
     
    112112}
    113113
    114 static int owl_filterelement_match_or(owl_filterelement *fe, owl_message *m)
     114static int owl_filterelement_match_or(owl_filterelement *fe, const owl_message *m)
    115115{
    116116  return owl_filterelement_match(fe->left, m) ||
     
    118118}
    119119
    120 static int owl_filterelement_match_not(owl_filterelement *fe, owl_message *m)
     120static int owl_filterelement_match_not(owl_filterelement *fe, const owl_message *m)
    121121{
    122122  return !owl_filterelement_match(fe->left, m);
     
    276276}
    277277
    278 int owl_filterelement_match(owl_filterelement *fe, owl_message *m)
     278int owl_filterelement_match(owl_filterelement *fe, const owl_message *m)
    279279{
    280280  if(!fe) return 0;
  • functions.c

    r0a0fb74 rc08c70a  
    595595  owl_view *v;
    596596  owl_filter *f = NULL;
    597   owl_message *m;
     597  const owl_message *m;
    598598
    599599  v=owl_global_get_current_view(&g);
     
    648648  owl_view *v;
    649649  owl_filter *f = NULL;
    650   owl_message *m;
     650  const owl_message *m;
    651651
    652652  v=owl_global_get_current_view(&g);
     
    774774{
    775775  int curmsg;
    776   owl_message *m;
     776  const owl_message *m;
    777777  owl_messagelist *ml;
    778778  owl_view *v;
     
    14111411void owl_function_info()
    14121412{
    1413   owl_message *m;
     1413  const owl_message *m;
    14141414  owl_fmtext fm, attrfm;
    14151415  owl_view *v;
     
    15471547{
    15481548  owl_view *v;
    1549   owl_message *m;
     1549  const owl_message *m;
    15501550  owl_style *s;
    15511551  owl_fmtext fm;
     
    18861886{
    18871887  char *buff=NULL;
    1888   owl_message *m;
     1888  const owl_message *m;
    18891889  owl_filter *f;
    18901890 
     
    21092109  owl_filter *f;
    21102110  int curid=-1, newpos, curmsg;
    2111   owl_message *curm=NULL;
     2111  const owl_message *curm=NULL;
    21122112
    21132113  v=owl_global_get_current_view(&g);
     
    25802580{
    25812581  owl_view *v;
    2582   owl_message *m;
     2582  const owl_message *m;
    25832583  char *zperson, *filtname=NULL;
    25842584  const char *argv[1];
     
    26522652   * If type=0, uses just class.  If type=1, uses instance as well. */
    26532653  owl_view *v;
    2654   owl_message *m;
     2654  const owl_message *m;
    26552655  const char *cmdprefix, *mclass, *minst;
    26562656  char *cmd;
     
    35673567}
    35683568
    3569 void _owl_function_mark_message(owl_message *m)
     3569void _owl_function_mark_message(const owl_message *m)
    35703570{
    35713571  if (m)
     
    35753575void owl_function_mark_message()
    35763576{
    3577   owl_message *m;
     3577  const owl_message *m;
    35783578  owl_view *v;
    35793579
     
    35953595{
    35963596  int marked_id;
    3597   owl_message *m;
     3597  const owl_message *m;
    35983598  owl_view *v;
    35993599
  • global.c

    r77bced3 rc08c70a  
    212212  g->markedmsgid=i;
    213213  /* i; index of message in the current view.
    214   owl_message *m;
     214  const owl_message *m;
    215215  owl_view *v;
    216216
     
    684684}
    685685
    686 int owl_global_message_is_puntable(owl_global *g, owl_message *m) {
     686int owl_global_message_is_puntable(owl_global *g, const owl_message *m) {
    687687  const owl_list *pl;
    688688  int i, j;
  • logging.c

    re19eb97 rc08c70a  
    99 * functions in this file as necessary.
    1010 */
    11 void owl_log_message(owl_message *m) {
     11void owl_log_message(const owl_message *m) {
    1212  owl_function_debugmsg("owl_log_message: entering");
    1313
     
    3737
    3838/* Return 1 if we should log the given message, otherwise return 0 */
    39 int owl_log_shouldlog_message(owl_message *m) {
     39int owl_log_shouldlog_message(const owl_message *m) {
    4040  owl_filter *f;
    4141
     
    7070}
    7171
    72 void owl_log_zephyr(owl_message *m, FILE *file) {
     72void owl_log_zephyr(const owl_message *m, FILE *file) {
    7373    char *tmp;
    7474    tmp=short_zuser(owl_message_get_sender(m));
     
    8282}
    8383
    84 void owl_log_aim(owl_message *m, FILE *file) {
     84void owl_log_aim(const owl_message *m, FILE *file) {
    8585    fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m));
    8686    fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m));
     
    9393}
    9494
    95 void owl_log_jabber(owl_message *m, FILE *file) {
     95void owl_log_jabber(const owl_message *m, FILE *file) {
    9696    fprintf(file, "From: <%s> To: <%s>\n",owl_message_get_sender(m), owl_message_get_recipient(m));
    9797    fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m));
     
    9999}
    100100
    101 void owl_log_generic(owl_message *m, FILE *file) {
     101void owl_log_generic(const owl_message *m, FILE *file) {
    102102    fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m));
    103103    fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m));
     
    105105}
    106106
    107 void owl_log_append(owl_message *m, const char *filename) {
     107void owl_log_append(const owl_message *m, const char *filename) {
    108108    FILE *file;
    109109    file=fopen(filename, "a");
     
    124124}
    125125
    126 void owl_log_outgoing(owl_message *m)
     126void owl_log_outgoing(const owl_message *m)
    127127{
    128128  char filename[MAXPATHLEN], *logpath;
     
    227227}
    228228
    229 void owl_log_incoming(owl_message *m)
     229void owl_log_incoming(const owl_message *m)
    230230{
    231231  char filename[MAXPATHLEN], allfilename[MAXPATHLEN], *logpath;
  • message.c

    r1077891a rc08c70a  
    8282 * the attribute does not exist
    8383 */
    84 const char *owl_message_get_attribute_value(owl_message *m, const char *attrname)
     84const char *owl_message_get_attribute_value(const owl_message *m, const char *attrname)
    8585{
    8686  int i, j;
     
    107107 * function to indent fmtext.
    108108 */
    109 void owl_message_attributes_tofmtext(owl_message *m, owl_fmtext *fm) {
     109void owl_message_attributes_tofmtext(const owl_message *m, owl_fmtext *fm) {
    110110  int i, j;
    111111  owl_pair *p;
     
    164164}
    165165
    166 const char *owl_message_get_class(owl_message *m)
     166const char *owl_message_get_class(const owl_message *m)
    167167{
    168168  const char *class;
     
    178178}
    179179
    180 const char *owl_message_get_instance(owl_message *m)
     180const char *owl_message_get_instance(const owl_message *m)
    181181{
    182182  const char *instance;
     
    192192}
    193193
    194 const char *owl_message_get_sender(owl_message *m)
     194const char *owl_message_get_sender(const owl_message *m)
    195195{
    196196  const char *sender;
     
    206206}
    207207
    208 const char *owl_message_get_zsig(owl_message *m)
     208const char *owl_message_get_zsig(const owl_message *m)
    209209{
    210210  const char *zsig;
     
    220220}
    221221
    222 const char *owl_message_get_recipient(owl_message *m)
     222const char *owl_message_get_recipient(const owl_message *m)
    223223{
    224224  /* this is stupid for outgoing messages, we need to fix it. */
     
    236236}
    237237
    238 const char *owl_message_get_realm(owl_message *m)
     238const char *owl_message_get_realm(const owl_message *m)
    239239{
    240240  const char *realm;
     
    250250}
    251251
    252 const char *owl_message_get_body(owl_message *m)
     252const char *owl_message_get_body(const owl_message *m)
    253253{
    254254  const char *body;
     
    265265}
    266266
    267 const char *owl_message_get_opcode(owl_message *m)
     267const char *owl_message_get_opcode(const owl_message *m)
    268268{
    269269  const char *opcode;
     
    286286}
    287287
    288 int owl_message_is_loginout(owl_message *m)
     288int owl_message_is_loginout(const owl_message *m)
    289289{
    290290  const char *res;
     
    295295}
    296296
    297 int owl_message_is_login(owl_message *m)
     297int owl_message_is_login(const owl_message *m)
    298298{
    299299  const char *res;
     
    306306
    307307
    308 int owl_message_is_logout(owl_message *m)
     308int owl_message_is_logout(const owl_message *m)
    309309{
    310310  const char *res;
     
    321321}
    322322
    323 int owl_message_is_private(owl_message *m)
     323int owl_message_is_private(const owl_message *m)
    324324{
    325325  const char *res;
     
    330330}
    331331
    332 const char *owl_message_get_timestr(owl_message *m)
     332const char *owl_message_get_timestr(const owl_message *m)
    333333{
    334334  if (m->timestr) return(m->timestr);
     
    361361}
    362362
    363 int owl_message_is_type(owl_message *m, const char *type) {
     363int owl_message_is_type(const owl_message *m, const char *type) {
    364364  const char * t = owl_message_get_attribute_value(m, "type");
    365365  if(!t) return 0;
     
    367367}
    368368                                               
    369 int owl_message_is_type_admin(owl_message *m)
     369int owl_message_is_type_admin(const owl_message *m)
    370370{
    371371  return owl_message_is_type(m, "admin");
    372372}
    373373
    374 int owl_message_is_type_zephyr(owl_message *m)
     374int owl_message_is_type_zephyr(const owl_message *m)
    375375{
    376376  return owl_message_is_type(m, "zephyr");
    377377}
    378378
    379 int owl_message_is_type_aim(owl_message *m)
     379int owl_message_is_type_aim(const owl_message *m)
    380380{
    381381  return owl_message_is_type(m, "aim");
     
    383383
    384384/* XXX TODO: deprecate this */
    385 int owl_message_is_type_jabber(owl_message *m)
     385int owl_message_is_type_jabber(const owl_message *m)
    386386{
    387387  return owl_message_is_type(m, "jabber");
    388388}
    389389
    390 int owl_message_is_type_loopback(owl_message *m)
     390int owl_message_is_type_loopback(const owl_message *m)
    391391{
    392392  return owl_message_is_type(m, "loopback");
    393393}
    394394
    395 int owl_message_is_pseudo(owl_message *m)
     395int owl_message_is_pseudo(const owl_message *m)
    396396{
    397397  if (owl_message_get_attribute_value(m, "pseudo")) return(1);
     
    425425}
    426426
    427 int owl_message_is_direction_in(owl_message *m)
     427int owl_message_is_direction_in(const owl_message *m)
    428428{
    429429  if (m->direction==OWL_MESSAGE_DIRECTION_IN) return(1);
     
    431431}
    432432
    433 int owl_message_is_direction_out(owl_message *m)
     433int owl_message_is_direction_out(const owl_message *m)
    434434{
    435435  if (m->direction==OWL_MESSAGE_DIRECTION_OUT) return(1);
     
    437437}
    438438
    439 int owl_message_is_direction_none(owl_message *m)
     439int owl_message_is_direction_none(const owl_message *m)
    440440{
    441441  if (m->direction==OWL_MESSAGE_DIRECTION_NONE) return(1);
     
    462462}
    463463
    464 const char *owl_message_get_zwriteline(owl_message *m)
     464const char *owl_message_get_zwriteline(const owl_message *m)
    465465{
    466466  const char *z = owl_message_get_attribute_value(m, "zwriteline");
     
    474474}
    475475
    476 int owl_message_is_delete(owl_message *m)
     476int owl_message_is_delete(const owl_message *m)
    477477{
    478478  if (m == NULL) return(0);
     
    482482
    483483#ifdef HAVE_LIBZEPHYR
    484 const ZNotice_t *owl_message_get_notice(owl_message *m)
     484const ZNotice_t *owl_message_get_notice(const owl_message *m)
    485485{
    486486  return(&(m->notice));
    487487}
    488488#else
    489 void *owl_message_get_notice(owl_message *m)
     489void *owl_message_get_notice(const owl_message *m)
    490490{
    491491  return(NULL);
     
    498498}
    499499
    500 const char *owl_message_get_hostname(owl_message *m)
     500const char *owl_message_get_hostname(const owl_message *m)
    501501{
    502502  return(m->hostname);
     
    524524}
    525525
    526 int owl_message_is_personal(owl_message *m)
     526int owl_message_is_personal(const owl_message *m)
    527527{
    528528  owl_filter * f = owl_global_get_filter(&g, "personal");
     
    534534}
    535535
    536 int owl_message_is_question(owl_message *m)
     536int owl_message_is_question(const owl_message *m)
    537537{
    538538  if(!owl_message_is_type_admin(m)) return 0;
     
    541541}
    542542
    543 int owl_message_is_answered(owl_message *m) {
     543int owl_message_is_answered(const owl_message *m) {
    544544  const char *q;
    545545  if(!owl_message_is_question(m)) return 0;
     
    553553}
    554554
    555 int owl_message_is_mail(owl_message *m)
     555int owl_message_is_mail(const owl_message *m)
    556556{
    557557  if (owl_message_is_type_zephyr(m)) {
     
    566566
    567567/* caller must free return value. */
    568 char *owl_message_get_cc(owl_message *m)
     568char *owl_message_get_cc(const owl_message *m)
    569569{
    570570  const char *cur;
     
    583583
    584584/* caller must free return value */
    585 char *owl_message_get_cc_without_recipient(owl_message *m)
     585char *owl_message_get_cc_without_recipient(const owl_message *m)
    586586{
    587587  char *cc, *out, *end, *shortuser, *recip;
     
    620620}
    621621
    622 int owl_message_get_id(owl_message *m)
     622int owl_message_get_id(const owl_message *m)
    623623{
    624624  return(m->id);
    625625}
    626626
    627 const char *owl_message_get_type(owl_message *m) {
     627const char *owl_message_get_type(const owl_message *m) {
    628628  const char * type = owl_message_get_attribute_value(m, "type");
    629629  if(!type) {
     
    633633}
    634634
    635 const char *owl_message_get_direction(owl_message *m) {
     635const char *owl_message_get_direction(const owl_message *m) {
    636636  switch (m->direction) {
    637637  case OWL_MESSAGE_DIRECTION_IN:
     
    657657
    658658
    659 const char *owl_message_get_login(owl_message *m) {
     659const char *owl_message_get_login(const owl_message *m) {
    660660  if (owl_message_is_login(m)) {
    661661    return "login";
     
    668668
    669669
    670 const char *owl_message_get_header(owl_message *m) {
     670const char *owl_message_get_header(const owl_message *m) {
    671671  return owl_message_get_attribute_value(m, "adminheader");
    672672}
  • owl.h

    r64735f0 rc08c70a  
    398398
    399399typedef 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);
    401401  /* Append a string representation of the filterelement onto buf*/
    402402  void (*print_elt)(struct _owl_filterelement *fe, GString *buf);
  • perlconfig.c

    r25fb825 rc08c70a  
    2222}
    2323
    24 SV *owl_perlconfig_message2hashref(owl_message *m)
     24SV *owl_perlconfig_message2hashref(const owl_message *m)
    2525{
    2626  HV *h, *stash;
     
    197197/* Calls in a scalar context, passing it a hash reference.
    198198   If return value is non-null, caller must free. */
    199 char *owl_perlconfig_call_with_message(const char *subname, owl_message *m)
     199char *owl_perlconfig_call_with_message(const char *subname, const owl_message *m)
    200200{
    201201  dSP ;
     
    246246   If the return value is non-null, the caller must free it.
    247247 */
    248 char * owl_perlconfig_message_call_method(owl_message *m, const char *method, int argc, const char ** argv)
     248char * owl_perlconfig_message_call_method(const owl_message *m, const char *method, int argc, const char ** argv)
    249249{
    250250  dSP;
     
    408408}
    409409
    410 void owl_perlconfig_getmsg(owl_message *m, const char *subname)
     410void owl_perlconfig_getmsg(const owl_message *m, const char *subname)
    411411{
    412412  char *ptr = NULL;
     
    419419
    420420/* Called on all new messages; receivemsg is only called on incoming ones */
    421 void owl_perlconfig_newmsg(owl_message *m, const char *subname)
     421void owl_perlconfig_newmsg(const owl_message *m, const char *subname)
    422422{
    423423  char *ptr = NULL;
  • style.c

    re19eb97 rc08c70a  
    3939 * 'fm' should already be be initialzed
    4040 */
    41 void owl_style_get_formattext(owl_style *s, owl_fmtext *fm, owl_message *m)
     41void owl_style_get_formattext(owl_style *s, owl_fmtext *fm, const owl_message *m)
    4242{
    4343  const char *body;
  • zephyr.c

    r1077891a rc08c70a  
    570570 * caller must free the return
    571571 */
    572 char *owl_zephyr_get_message(const ZNotice_t *n, owl_message *m)
     572char *owl_zephyr_get_message(const ZNotice_t *n, const owl_message *m)
    573573{
    574574  /* don't let ping messages have a body */
     
    824824#endif
    825825 
    826 void owl_zephyr_zaway(owl_message *m)
     826void owl_zephyr_zaway(const owl_message *m)
    827827{
    828828#ifdef HAVE_LIBZEPHYR
Note: See TracChangeset for help on using the changeset viewer.