2012-05-04 03:18 UTC+0200 Viktor Szakats (harbour syenar.net)

* contrib/hbct/getsecrt.prg
    * use hb_keyCode() instead of Asc() to form numeric key value.

  * contrib/hbtip/encqp.prg
    ! Quoted-printable encoding/decoding fixed to use FOR/NEXT
      loop instead of FOR/EACH and HB_B*() string functions to 
      operate on binary data regardless of HVM CP.
    ! Fixed old typo causing no encoding for line-ending whitespaces.

  * contrib/hbtip/mail.prg
    ! Q-encoding fixed to use FOR/NEXT 
      loop instead of FOR/EACH and HB_B*() string functions to 
      operate on binary data regardless of HVM CP
This commit is contained in:
Viktor Szakats
2012-05-04 01:21:23 +00:00
parent 1be0971119
commit 7a16a51936
4 changed files with 29 additions and 8 deletions

View File

@@ -16,6 +16,21 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-05-04 03:18 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/hbct/getsecrt.prg
* use hb_keyCode() instead of Asc() to form numeric key value.
* contrib/hbtip/encqp.prg
! Quoted-printable encoding/decoding fixed to use FOR/NEXT
loop instead of FOR/EACH and HB_B*() string functions to
operate on binary data regardless of HVM CP.
! Fixed old typo causing no encoding for line-ending whitespaces.
* contrib/hbtip/mail.prg
! Q-encoding fixed to use FOR/NEXT
loop instead of FOR/EACH and HB_B*() string functions to
operate on binary data regardless of HVM CP
2012-05-04 01:51 UTC+0200 Viktor Szakats (harbour syenar.net)
* include/harbour.hbx
* src/rtl/cdpapihb.c

View File

@@ -140,7 +140,7 @@ STATIC PROCEDURE _SECRET( _cGetSecret, lHide, oGet, oGetList )
ELSE
_cGetSecret := STUFF( _cGetSecret, oGet:pos, 1, cKey )
ENDIF
nKey := ASC( "*" )
nKey := hb_keyCode( "*" )
ENDIF
GetApplyKey( oGet, nKey )
ENDDO

View File

@@ -63,18 +63,22 @@ METHOD New() CLASS TIPEncoderQP
RETURN Self
METHOD Encode( cData ) CLASS TIPEncoderQP
LOCAL nPos
LOCAL c
LOCAL nLen
LOCAL cString := ""
LOCAL nLineLen := 0
FOR EACH c IN cData
nLen := hb_BLen( cData )
FOR nPos := 1 TO nLen
c := hb_BSubStr( cData, nPos, 1 )
IF c == Chr( 13 )
cString += Chr( 13 ) + Chr( 10 )
nLineLen := 0
ELSEIF Asc( c ) > 126 .OR. ;
c $ '=?!"#$@[\]^`{|}~' .OR. ;
( Asc( c ) < 32 .AND. !( c $ Chr( 13 ) + Chr( 10 ) + Chr( 9 ) ) ) .OR. ;
( c $ " " + Chr( 9 ) .AND. SubStr( cData, c:__enumIndex() + 1 ) $ Chr( 13 ) + Chr( 10 ) )
( c $ " " + Chr( 9 ) .AND. hb_BSubStr( cData, nPos + 1, 1 ) $ Chr( 13 ) + Chr( 10 ) )
IF nLineLen + 3 > 76
cString += "=" + Chr( 13 ) + Chr( 10 )
nLineLen := 0
@@ -99,11 +103,11 @@ METHOD Decode( cData ) CLASS TIPEncoderQP
cData := StrTran( cData, "=" + Chr( 13 ) + Chr( 10 ) )
cData := StrTran( cData, "=" + Chr( 10 ) ) /* also delete non-standard line breaks */
nLen := Len( cData )
nLen := hb_BLen( cData )
FOR tmp := 1 TO nLen
c := SubStr( cData, tmp, 1 )
IF c == "=" .AND. Len( SubStr( cData, tmp + 1, 2 ) ) == 2
cString += Chr( hb_HexToNum( SubStr( cData, tmp + 1, 2 ) ) )
c := hb_BSubStr( cData, tmp, 1 )
IF c == "=" .AND. hb_BLen( hb_BSubStr( cData, tmp + 1, 2 ) ) == 2
cString += Chr( hb_HexToNum( hb_BSubStr( cData, tmp + 1, 2 ) ) )
tmp += 2
ELSE
cString += c

View File

@@ -682,6 +682,7 @@ METHOD getMultiParts( aParts ) CLASS TipMail
RETURN aParts
STATIC FUNCTION WordEncodeQ( cData, cCharset )
LOCAL nPos
LOCAL c
LOCAL cString
LOCAL nLineLen := 0
@@ -695,7 +696,8 @@ STATIC FUNCTION WordEncodeQ( cData, cCharset )
cString := "=?" + cCharset + "?" + "Q" + "?"
FOR EACH c IN cData
FOR nPos := 1 TO hb_BLen( cData )
c := hb_BSubStr( cData, nPos, 1 )
IF Asc( c ) > 126 .OR. ;
c $ '=?!"#$@[\]^`{|}~_' .OR. ;
Asc( c ) <= 32