Changeset 7e3e00a


Ignore:
Timestamp:
Feb 11, 2003, 11:14:36 AM (21 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
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:
a2641cd9
Parents:
8f44c6b
Message:
Added thew 'newlinestrip' variable, on by default, that strips leading
and trailing newlines from incoming zephyrs.
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r8f44c6b r7e3e00a  
    332.0.1-pre-1
    44        Moved the (broken) newmsgproc stuff it a function procedure
     5        Added thew 'newlinestrip' variable, on by default, that strips
     6          leading and trailing newlines from incoming messages.
    57
    681.2.8
  • message.c

    r5a35ae8e r7e3e00a  
    361361  struct hostent *hent;
    362362  int k, ret;
    363   char *ptr;
     363  char *ptr, *tmp;
    364364
    365365  m->id=owl_global_get_nextmsgid(&g);
     
    397397  /* set the body */
    398398  ptr=owl_zephyr_get_message(n, &k);
    399   m->body=owl_malloc(k+10);
    400   memcpy(m->body, ptr, k);
    401   m->body[k]='\0';
     399  tmp=owl_malloc(k+10);
     400  memcpy(tmp, ptr, k);
     401  tmp[k]='\0';
     402  if (owl_global_is_newlinestrip(&g)) {
     403    m->body=owl_util_stripnewlines(tmp);
     404    owl_free(tmp);
     405  } else {
     406    m->body=tmp;
     407  }
    402408
    403409  /* if zcrypt is enabled try to decrypt the message */
  • util.c

    ra15a84f r7e3e00a  
    616616}
    617617
     618char *owl_util_stripnewlines(char *in) {
     619  /* strip leading and trailing new lines.
     620     caller must free the return */
     621 
     622  char  *tmp, *ptr1, *ptr2, *out;
     623
     624  ptr1=tmp=owl_strdup(in);
     625  while (ptr1[0]=='\n') {
     626    ptr1++;
     627  }
     628  ptr2=ptr1+strlen(ptr1)-1;
     629  while (ptr2[0]=='\n' && ptr2>ptr1) {
     630    ptr2[0]='\0';
     631    ptr2--;
     632  }
     633
     634  out=owl_strdup(ptr1);
     635  owl_free(tmp);
     636  return(out);
     637}
     638
    618639/**************************************************************************/
    619640/************************* REGRESSION TESTS *******************************/
  • variable.c

    rd309eb3 r7e3e00a  
    8484  OWLVAR_BOOL( "smartstrip" /* %OwlVarStub */, 1,
    8585               "strip kerberos instance for reply", ""),
     86
     87  OWLVAR_BOOL( "newlinestrip" /* %OwlVarStub */, 1,
     88               "strip leading and trailing newlines", ""),
    8689
    8790  OWLVAR_BOOL( "displayoutgoing" /* %OwlVarStub */, 1,
Note: See TracChangeset for help on using the changeset viewer.