Changeset 6396


Ignore:
Timestamp:
Nov 5, 2012 8:09:01 PM (2 years ago)
Author:
tboeckel
Message:
  • StrBuf.c, YAM_WR.c: added a function to reset the contents of a dynamic string buffer. This fixes the empty CC and BCC entries when editing a mail which uses these lines.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r6395 r6396  
    99 
    1010  * locale/german.ct: updated german translation. 
     11  * StrBuf.c, YAM_WR.c: added a function to reset the contents of a dynamic 
     12    string buffer. This fixes the empty CC and BCC entries when editing a mail 
     13    which uses these lines. 
    1114 
    12152012-11-04 Samir Hawamdeh <s.hawamdeh@tin.it> 
  • trunk/src/StrBuf.c

    r6378 r6396  
    8181  RETURN(result); 
    8282  return result; 
     83} 
     84 
     85/// 
     86/// ResetStrBuf 
     87//  Reset a dynamic string 
     88void ResetStrBuf(char *buf) 
     89{ 
     90  ENTER(); 
     91 
     92  if(buf != NULL) 
     93  { 
     94    struct StrBuf *strbuf = STR_TO_STRBUF(buf); 
     95 
     96    strbuf->length = 0; 
     97    strbuf->string[0] = '\0'; 
     98  } 
     99 
     100  LEAVE(); 
    83101} 
    84102 
  • trunk/src/StrBuf.h

    r6370 r6396  
    3232 
    3333char * AllocStrBuf(size_t initsize); 
     34void ResetStrBuf(char *buf); 
    3435size_t StrBufCat(char **buf, const char *source); 
    3536size_t StrBufCpy(char **buf, const char *source); 
  • trunk/src/YAM_WR.c

    r6375 r6396  
    19361936    if((out = fopen(wmData->filename, "w")) != NULL) 
    19371937    { 
    1938       char *sbuf = NULL; 
    19391938      struct ReadMailData *rmData; 
    19401939      struct ExtendedMail *email; 
     1940      char *p; 
    19411941 
    19421942      setvbuf(out, NULL, _IOFBF, SIZE_FILEBUF); 
     
    19721972            char address[SIZE_LARGE]; 
    19731973            BOOL reuseReplyToAddress = TRUE; 
     1974            char *sbuf = NULL; 
    19741975 
    19751976            // free our temp text now 
     
    20222023                sbuf = AppendRcpt(sbuf, &email->SReplyTo[i], email->identity, FALSE); 
    20232024              } 
    2024  
    20252025              set(wmData->window, MUIA_WriteWindow_ReplyTo, sbuf); 
    20262026            } 
     
    20342034              sbuf = AppendRcpt(sbuf, &email->STo[i], email->identity, FALSE); 
    20352035            } 
    2036  
    20372036            set(wmData->window, MUIA_WriteWindow_To, sbuf); 
    20382037 
    20392038            // add all "CC:" recipients of the mail 
    2040             sbuf[0] = '\0'; 
     2039            ResetStrBuf(sbuf); 
    20412040            for(i=0; i < email->NumCC; i++) 
    20422041            { 
     
    20472046 
    20482047            // add all "BCC:" recipients of the mail 
    2049             sbuf[0] = '\0'; 
     2048            ResetStrBuf(sbuf); 
    20502049            for(i=0; i < email->NumBCC; i++) 
    20512050            { 
     
    21042103        SafeOpenWindow(wmData->window); 
    21052104 
    2106       sbuf = (STRPTR)xget(wmData->window, MUIA_WriteWindow_To); 
    2107       set(wmData->window, MUIA_WriteWindow_ActiveObject, *sbuf ? MUIV_WriteWindow_ActiveObject_TextEditor : 
    2108                                                                  MUIV_WriteWindow_ActiveObject_To); 
     2105      p = (char *)xget(wmData->window, MUIA_WriteWindow_To); 
     2106      set(wmData->window, MUIA_WriteWindow_ActiveObject, p[0] != '\0' ? MUIV_WriteWindow_ActiveObject_TextEditor : MUIV_WriteWindow_ActiveObject_To); 
    21092107 
    21102108      if(C->LaunchAlways == TRUE && quiet == FALSE) 
Note: See TracChangeset for help on using the changeset viewer.