* contrib/hbtip/ccgi.prg
* contrib/hbtip/client.prg
* contrib/hbtip/encb64.prg
* contrib/hbtip/encoder.prg
* contrib/hbtip/encqp.prg
* contrib/hbtip/encurl.prg
* contrib/hbtip/ftpcli.prg
* contrib/hbtip/hbtip.hbp
* contrib/hbtip/hbtip.hbx
* contrib/hbtip/httpcli.prg
* contrib/hbtip/log.prg
* contrib/hbtip/mail.prg
* contrib/hbtip/mime.c
* contrib/hbtip/misc.c
* contrib/hbtip/popcli.prg
* contrib/hbtip/sessid.prg
* contrib/hbtip/smtpcli.prg
* contrib/hbtip/thtml.ch
* contrib/hbtip/thtml.prg
* contrib/hbtip/tip.ch
* contrib/hbtip/url.prg
+ contrib/hbtip/base64u.prg
+ contrib/hbtip/mailassy.prg
* contrib/hbtip/sendmail.prg -> [...]/mailsend.prg
+ contrib/hbtip/WARNING.txt
* contrib/hbtip/tests/base64.prg
* contrib/hbtip/tests/dbtohtml.prg
* contrib/hbtip/tests/dnldftp.prg -> [...]/ftp_dl.prg
* contrib/hbtip/tests/ftpadv.prg -> [...]/ftp_adv.prg
+ contrib/hbtip/tests/email.prg
+ contrib/hbtip/tests/ftp_ul.prg
- contrib/hbtip/tests/gmail.hbp
- contrib/hbtip/tests/gmail.prg
* contrib/hbtip/tests/hbmk.hbm
* contrib/hbtip/tests/httpadv.prg -> [...]/http_adv.prg
* contrib/hbtip/tests/httpcli.prg -> [...]/http_cli.prg
+ contrib/hbtip/tests/http_qry.prg
- contrib/hbtip/tests/loadhtml.prg
+ contrib/hbtip/tests/test.prg
+ contrib/hbtip/tests/url.prg
* synced with 3.4 fork by Viktor Szakats
; the only difference is slightly edited WARNING.txt
- contrib/hbtip/credent.prg
% deleted TIPCredentials() class that was never implemented
; changes above come from vast number of commits in 3.4 repository - many
thanks to Viktor Szakats for maintaining
88 lines
3.2 KiB
Plaintext
88 lines
3.2 KiB
Plaintext
/*
|
|
* TIP Class oriented Internet protocol library
|
|
*
|
|
* Copyright 2003 Giancarlo Niccolai <gian@niccolai.ws>
|
|
* Copyright 2007 Hannes Ziegler <hz AT knowlexbase.com> (tip_GetEncoder())
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this software; see the file COPYING.txt. If not, write to
|
|
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
* Boston, MA 02111-1307 USA (or visit the web site https://www.gnu.org/).
|
|
*
|
|
* As a special exception, the Harbour Project gives permission for
|
|
* additional uses of the text contained in its release of Harbour.
|
|
*
|
|
* The exception is that, if you link the Harbour libraries with other
|
|
* files to produce an executable, this does not by itself cause the
|
|
* resulting executable to be covered by the GNU General Public License.
|
|
* Your use of that executable is in no way restricted on account of
|
|
* linking the Harbour library code into it.
|
|
*
|
|
* This exception does not however invalidate any other reasons why
|
|
* the executable file might be covered by the GNU General Public License.
|
|
*
|
|
* This exception applies only to the code released by the Harbour
|
|
* Project under the name Harbour. If you copy code from other
|
|
* Harbour Project or Free Software Foundation releases into a copy of
|
|
* Harbour, as the General Public License permits, the exception does
|
|
* not apply to the code that you add in this way. To avoid misleading
|
|
* anyone as to the status of such modified files, you must delete
|
|
* this exception notice from them.
|
|
*
|
|
* If you write modifications of your own for Harbour, it is your choice
|
|
* whether to permit this exception to apply to your modifications.
|
|
* If you do not wish that, delete this exception notice.
|
|
*
|
|
*/
|
|
|
|
/* Internet Messaging: https://www.ietf.org/rfc/rfc2045.txt */
|
|
|
|
#include "hbclass.ch"
|
|
|
|
#include "fileio.ch"
|
|
|
|
CREATE CLASS TIPEncoder
|
|
|
|
VAR cName
|
|
|
|
METHOD New( cMode )
|
|
METHOD Encode( cData )
|
|
METHOD Decode( cData )
|
|
|
|
ENDCLASS
|
|
|
|
#define MODE_PASSTHROUGH "as-is"
|
|
|
|
METHOD New( cMode ) CLASS TIPEncoder
|
|
|
|
::cName := Lower( hb_defaultValue( cMode, MODE_PASSTHROUGH ) )
|
|
|
|
RETURN Self
|
|
|
|
METHOD Encode( cData ) CLASS TIPEncoder
|
|
RETURN iif( ::cName == MODE_PASSTHROUGH, cData, tip_GetEncoder( ::cName ):Encode( cData ) )
|
|
|
|
METHOD Decode( cData ) CLASS TIPEncoder
|
|
RETURN iif( ::cName == MODE_PASSTHROUGH, cData, tip_GetEncoder( ::cName ):Decode( cData ) )
|
|
|
|
FUNCTION tip_GetEncoder( cMode )
|
|
|
|
SWITCH Lower( hb_defaultValue( cMode, MODE_PASSTHROUGH ) )
|
|
CASE "base64" ; RETURN TIPEncoderBase64():New()
|
|
CASE "quoted-printable" ; RETURN TIPEncoderQP():New()
|
|
CASE "url"
|
|
CASE "urlencoded" ; RETURN TIPEncoderUrl():New()
|
|
ENDSWITCH
|
|
|
|
RETURN TIPEncoder():New()
|